diff --git a/Gruntfile.js b/Gruntfile.js index 2477aefb2..5d55be252 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -25,6 +25,8 @@ module.exports = function (grunt) { global: { + bases: [__dirname], + hostname: 'localhost', minify: 'optimize=none', port: '8001' }, @@ -360,8 +362,9 @@ module.exports = function (grunt) { dev: { options: { port: '<%= global.port %>', - base: '.', - directory: '.', + hostname: '<%= global.hostname %>', + base: '<%= global.bases %>', + directory: '<%= global.bases %>', keepalive: true, open: { target: 'http://localhost:<%= global.port %>/<%= config.directories.examples %>/' diff --git a/README.md b/README.md index a7bc89e56..a5dc6a4f5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,86 @@ -# Universal Viewer +# Universal Viewer (with OCR module) +This is a fork from Universal Viewer that implements a new OCR module. + +## What is the OCR module? + +The OCR module render a new right panel where you can find the text extracted from the viewed image, retrieved from a web-annotation service. + +## Functionality + +OCR module allows to show, in a new right panel, the text extracted from the viewed image by an OCR Software (e.g. Tesseract). +Moreover you can highlight the text within the OCR panel finding it on the image. +The highlighted text is rendered like searching with the footer panel search. + +![Demo Screenshot](http://uvdemo.4science.it/screenShotDemo01.jpg "Demo Screenshot") + +## Examples + +Try a live demo here : http://uvdemo.4science.it + +## How to enable the OCR module + +For using the OCR module you need to add a new service in your manifest : + + "service": [ + ... + { + "@context" : "http://www.w3.org/ns/anno.jsonld", + "@id" : "{ocrservice-id}", + "profile" : "http://4science.it/api/ocr/0/annotationCollection", + "label" : "OCR" + } + ] + +See http://uvdemo.4science.it/manifest/hamlet for an example manifest. + +## How does it works? + +The annotation server respond with an annotation collection described as below : + + { + "@context": [ + "http://www.w3.org/ns/anno.jsonld" + ], + "@id": "{ocr-service-id}?q={canvas-id}", + "type": "AnnotationCollection", + "label": "Page OCR", + "total": 184, + "first": { + "id": "{ocr-service-id}/annotationPage?q={canvas-id}#ltr", + "type": "AnnotationPage", + "startIndex": 0, + "items": [ + { + "id": "{item-id}#word_1_1", + "type": "Annotation", + "body": { + "type": "TextualBody", + "value": "64", + "format": "text", + "textDirection": "ltr" + }, + "target": [ + "{canvas-id}#xywh=107,83,16,13", + "{canvas-id}#area=block_1_1", + "{canvas-id}#paragraph=par_1_1", + "{canvas-id}#line=line_1_1" + ] + } + ] + } + } + +The server response is parsed by the new module and showed as a text rapresentation of the viewed image. + +[Next steps] + +- Enable editing of each single annotation (eg. single word recognized by the OCR software) from the user interface; +- Create a new annotation by drawing it over the image. + +# Universal Viewer + +[![Build Status](https://travis-ci.org/UniversalViewer/universalviewer.svg?branch=master)](https://travis-ci.org/UniversalViewer/universalviewer) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/UniversalViewer/universalviewer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/UniversalViewer/universalviewer.svg?branch=master)](https://travis-ci.org/UniversalViewer/universalviewer)    diff --git a/bower.json b/bower.json index 53d668ed2..bfce3582a 100644 --- a/bower.json +++ b/bower.json @@ -17,7 +17,7 @@ ], "dependencies": {}, "devDependencies": { - "uv-cy-GB-theme": "universalviewer/uv-cy-GB-theme", - "uv-en-GB-theme": "universalviewer/uv-en-GB-theme" + "uv-cy-GB-theme": "4Science/uv-cy-GB-theme", + "uv-en-GB-theme": "4Science/uv-en-GB-theme" } -} \ No newline at end of file +} diff --git a/dist/uv-2.0.1/lib/app.js b/dist/uv-2.0.1/lib/app.js index 698a7c463..e7310a5b1 100644 --- a/dist/uv-2.0.1/lib/app.js +++ b/dist/uv-2.0.1/lib/app.js @@ -1,8 +1,9 @@ -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-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;t0&&(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=w.map,$=v&&v["*"];if(e&&(e=e.split("/"),c=e.length-1,w.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(w.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(w.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"+(O+=1)),h=s(e),c=h[0],e=h[1],c&&(c=i(c,u,o),a=getOwn(T,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"+(L+=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(S,t);return i||(i=S[t]=new E.Module(e)),i}function l(e,t,i){var n=e.id,o=getOwn(S,n);!hasProp(T,n)||o&&!o.defineEmitComplete?(o=a(e),o.error&&"error"===t?i(o.error):o.on(t,i)):"defined"===t&&i(T[n])}function h(e,t){var i=e.requireModules,n=!1;t?t(e):(each(i,function(t){var i=getOwn(S,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 S[e],delete _[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(S,s);!r||e.depMatched[o]||i[s]||(getOwn(t,s)?(e.defineDep(o,T[s]),e.check()):p(r,t,i))}),i[n]=!0)}function d(){var e,t,i=1e3*w.waitSeconds,s=i&&E.startTime+i<(new Date).getTime(),r=[],a=[],l=!1,c=!0;if(!$){if($=!0,eachProp(_,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(T,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,x,y,w={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},S={},_={},C={},R=[],T={},I={},D={},O=1,L=1;return x={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?T[e.map.id]=e.exports:e.exports=T[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(w.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}},b=function(e){this.events=getOwn(C,e.id)||{},this.map=e,this.shim=getOwn(w.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;I[e]||(I[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&&(T[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(D,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(S,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(S,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(w.config,t)&&(w.config[s]=w.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,w))})),E.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){_[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(x,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=S[i],hasProp(x,i)||!n||n.enabled||E.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(S,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:w,contextName:e,registry:S,defined:T,urlFetched:I,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=w.shim,n={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(e,t){n[t]?(w[t]||(w[t]={}),mixin(w[t],e,!0,!0)):w[t]=e}),e.bundles&&eachProp(e.bundles,function(e,t){each(e,function(e){e!==t&&(D[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}),w.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&&(w.paths[i]=e.location),w.pkgs[i]=e.name+"/"+(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(S,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(x,i)?x[i](S[t.id]):req.get?req.get(E,i,t,s):(u=r(i,t,!1,!0),c=u.id,hasProp(T,c)?T[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(T,r(e,t,!1,!0).id)},specified:function(e){return e=r(e,t,!1,!0).id,hasProp(T,e)||hasProp(S,e)}}),t||(s.undef=function(e){c();var i=r(e,t,!0),o=getOwn(S,e);o.undefed=!0,n(e),delete T[e],delete I[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(S,e.id);t&&a(e).enable()},completeLoad:function(e){var t,i,n,s=getOwn(w.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(S,e),!t&&!hasProp(T,e)&&n&&!n.inited){if(!(!w.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(w.pkgs,e);if(c&&(e=c),h=getOwn(D,e))return E.nameToUrl(h,t,i);if(req.jsExtRegExp.test(e))a=e+(t||"");else{for(n=w.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\+\.\-]+:/)?"":w.baseUrl)+a}return w.urlArgs&&!/^blob\:/.test(a)?a+w.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(S,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){var i=function(){function e(){}return e.namespace="uv.",e.ACCEPT_TERMS=e.namespace+"onAcceptTerms",e.BOOKMARK=e.namespace+"onBookmark",e.CANVAS_INDEX_CHANGE_FAILED=e.namespace+"onCanvasIndexChangeFailed",e.CANVAS_INDEX_CHANGED=e.namespace+"onCanvasIndexChanged",e.CLICKTHROUGH=e.namespace+"onClickthrough",e.CLOSE_ACTIVE_DIALOGUE=e.namespace+"onCloseActiveDialogue",e.CLOSE_LEFT_PANEL=e.namespace+"onCloseLeftPanel",e.CLOSE_RIGHT_PANEL=e.namespace+"onCloseRightPanel",e.CREATED=e.namespace+"onCreated",e.DOWN_ARROW=e.namespace+"onDownArrow",e.DOWNLOAD=e.namespace+"onDownload",e.DROP=e.namespace+"onDrop",e.END=e.namespace+"onEnd",e.ESCAPE=e.namespace+"onEscape",e.EXTERNAL_LINK_CLICKED=e.namespace+"onExternalLinkClicked",e.FEEDBACK=e.namespace+"onFeedback",e.FORBIDDEN=e.namespace+"onForbidden",e.HIDE_CLICKTHROUGH_DIALOGUE=e.namespace+"onHideClickthroughDialogue",e.HIDE_DOWNLOAD_DIALOGUE=e.namespace+"onHideDownloadDialogue",e.HIDE_EMBED_DIALOGUE=e.namespace+"onHideEmbedDialogue",e.HIDE_EXTERNALCONTENT_DIALOGUE=e.namespace+"onHideExternalContentDialogue",e.HIDE_GENERIC_DIALOGUE=e.namespace+"onHideGenericDialogue",e.HIDE_HELP_DIALOGUE=e.namespace+"onHideHelpDialogue",e.HIDE_INFORMATION=e.namespace+"onHideInformation",e.HIDE_LOGIN_DIALOGUE=e.namespace+"onHideLoginDialogue",e.HIDE_MOREINFO_DIALOGUE=e.namespace+"onHideMoreInfoDialogue",e.HIDE_OVERLAY=e.namespace+"onHideOverlay",e.HIDE_RESTRICTED_DIALOGUE=e.namespace+"onHideRestrictedDialogue",e.HIDE_SETTINGS_DIALOGUE=e.namespace+"onHideSettingsDialogue",e.HIDE_SHARE_DIALOGUE=e.namespace+"onHideShareDialogue",e.HOME=e.namespace+"onHome",e.LEFT_ARROW=e.namespace+"onLeftArrow",e.LEFTPANEL_COLLAPSE_FULL_FINISH=e.namespace+"onLeftPanelCollapseFullFinish",e.LEFTPANEL_COLLAPSE_FULL_START=e.namespace+"onLeftPanelCollapseFullStart",e.LEFTPANEL_EXPAND_FULL_FINISH=e.namespace+"onLeftPanelExpandFullFinish",e.LEFTPANEL_EXPAND_FULL_START=e.namespace+"onLeftPanelExpandFullStart",e.LOAD_FAILED=e.namespace+"onLoadFailed",e.LOAD=e.namespace+"onLoad",e.LOGIN_FAILED=e.namespace+"onLoginFailed",e.LOGIN=e.namespace+"onLogin",e.LOGOUT=e.namespace+"onLogout",e.METRIC_CHANGED=e.namespace+"onMetricChanged",e.MINUS=e.namespace+"onMinus",e.NOT_FOUND=e.namespace+"onNotFound",e.OPEN_EXTERNAL_RESOURCE=e.namespace+"onOpenExternalResource",e.OPEN_LEFT_PANEL=e.namespace+"onOpenLeftPanel",e.OPEN_RIGHT_PANEL=e.namespace+"onOpenRightPanel",e.OPEN=e.namespace+"onOpen",e.PAGE_DOWN=e.namespace+"onPageDown",e.PAGE_UP=e.namespace+"onPageUp",e.PARENT_EXIT_FULLSCREEN=e.namespace+"onParentExitFullScreen",e.PLUS=e.namespace+"onPlus",e.REDIRECT=e.namespace+"onRedirect",e.REFRESH=e.namespace+"onRefresh",e.RESIZE=e.namespace+"onResize",e.RESOURCE_DEGRADED=e.namespace+"onResourceDegraded",e.RETRY=e.namespace+"onRetry",e.RETURN=e.namespace+"onReturn",e.RIGHT_ARROW=e.namespace+"onRightArrow",e.RIGHTPANEL_COLLAPSE_FULL_FINISH=e.namespace+"onRightPanelCollapseFullFinish",e.RIGHTPANEL_COLLAPSE_FULL_START=e.namespace+"onRightPanelCollapseFullStart",e.RIGHTPANEL_EXPAND_FULL_FINISH=e.namespace+"onRightPanelExpandFullFinish",e.RIGHTPANEL_EXPAND_FULL_START=e.namespace+"onRightPanelExpandFullStart",e.SEQUENCE_INDEX_CHANGED=e.namespace+"onSequenceIndexChanged",e.SETTINGS_CHANGED=e.namespace+"onSettingsChanged",e.SHOW_CLICKTHROUGH_DIALOGUE=e.namespace+"onShowClickThroughDialogue",e.SHOW_DOWNLOAD_DIALOGUE=e.namespace+"onShowDownloadDialogue",e.SHOW_EMBED_DIALOGUE=e.namespace+"onShowEmbedDialogue",e.SHOW_EXTERNALCONTENT_DIALOGUE=e.namespace+"onShowExternalContentDialogue",e.SHOW_GENERIC_DIALOGUE=e.namespace+"onShowGenericDialogue",e.SHOW_HELP_DIALOGUE=e.namespace+"onShowHelpDialogue",e.SHOW_INFORMATION=e.namespace+"onShowInformation",e.SHOW_LOGIN_DIALOGUE=e.namespace+"onShowLoginDialogue",e.SHOW_MOREINFO_DIALOGUE=e.namespace+"onShowMoreInfoDialogue",e.SHOW_OVERLAY=e.namespace+"onShowOverlay",e.SHOW_RESTRICTED_DIALOGUE=e.namespace+"onShowRestrictedDialogue",e.SHOW_SETTINGS_DIALOGUE=e.namespace+"onShowSettingsDialogue",e.SHOW_SHARE_DIALOGUE=e.namespace+"onShowShareDialogue",e.SHOW_TERMS_OF_USE=e.namespace+"onShowTermsOfUse",e.THUMB_SELECTED=e.namespace+"onThumbSelected",e.TOGGLE_EXPAND_LEFT_PANEL=e.namespace+"onToggleExpandLeftPanel",e.TOGGLE_EXPAND_RIGHT_PANEL=e.namespace+"onToggleExpandRightPanel",e.TOGGLE_FULLSCREEN=e.namespace+"onToggleFullScreen",e.UP_ARROW=e.namespace+"onUpArrow",e.UPDATE_SETTINGS=e.namespace+"onUpdateSettings",e.VIEW_FULL_TERMS=e.namespace+"onViewFullTerms",e.WINDOW_UNLOAD=e.namespace+"onWindowUnload",e}();return i}),define("Params",["require","exports"],function(e,t){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){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 #app").data("bootstrapper"),e.call(this,t,i,n)}return __extends(t,e),t.prototype.create=function(){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.length&&(t.modules=t.modules.reverse(),_.each(t.modules,function(e){t.config=$.extend(!0,t.config,t.extension.config.modules[e])}))},t.prototype.init=function(){},t.prototype.setConfig=function(e){this.modules.push(e)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/Dialogue",["require","exports","./BaseView","./BaseCommands"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t,!1,!1),this.allowClose=!0,this.isActive=!1,this.isUnopened=!0}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=$('
'),this.$element.append(this.$top),this.$closeButton=$(''+this.content.close+""),this.$top.append(this.$closeButton),this.$middle=$('
'),this.$element.append(this.$middle),this.$content=$('
'),this.$middle.append(this.$content),this.$bottom=$('
'),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/ClickThroughDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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=$("

"),this.$content.append(this.$title),this.$content.append('

'),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){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){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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/LoginDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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=$("

"),this.$content.append(this.$title),this.$content.append('

'),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=''+this.extension.config.content[this.options.warningMessage]+''+t+""),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){var i=function(){function e(){}return e.FORBIDDEN="forbiddenResourceMessage",e}();return i}),define("modules/uv-shared-module/StringValue",["require","exports"],function(e,t){var i=function(){function e(e){this.value="",e&&(this.value=e.toLowerCase())}return e.prototype.toString=function(){return this.value},e}();t.StringValue=i});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/MetricType",["require","exports","./StringValue"],function(e,t,i){var n=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.MOBILELANDSCAPE=new t("mobilelandscape"),t.LAPTOP=new t("laptop"),t}(i.StringValue);t.MetricType=n});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/RestrictedDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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=$("

"),this.$content.append(this.$title),this.$content.append('

'),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/GenericDialogue",["require","exports","./BaseCommands","./Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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=$("

"),this.$content.append(this.$message),this.$acceptButton=$(''),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/Shell",["require","exports","./BaseCommands","./BaseView","./GenericDialogue"],function(e,t,i,n,o){var s=function(e){function t(i){t.$element=i,e.call(this,t.$element,!0,!0)}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=$('
'),t.$element.append(t.$headerPanel),t.$mainPanel=$('
'),t.$element.append(t.$mainPanel),t.$centerPanel=$('
'),t.$mainPanel.append(t.$centerPanel),t.$leftPanel=$('
'),t.$mainPanel.append(t.$leftPanel),t.$rightPanel=$('
'),t.$mainPanel.append(t.$rightPanel),t.$footerPanel=$('
'),t.$element.append(t.$footerPanel),t.$mobileFooterPanel=$('
'),t.$element.append(t.$mobileFooterPanel),t.$overlays=$('
'),t.$element.append(t.$overlays),t.$genericDialogue=$('
'),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/MetricType","../../Params","../../modules/uv-dialogues-module/RestrictedDialogue","./Shell"],function(e,t,i,n,o,s,r,a,l,h,c,u,p){var d=function(){function t(e){this.isCreated=!1,this.isLoggedIn=!1,this.metric=h.MetricType.LAPTOP,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._parseMetrics(),!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;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(''),this.$element.append(''),$.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=$('
'),p.$overlays.append(this.$clickThroughDialogue),this.clickThroughDialogue=new o(this.$clickThroughDialogue),this.$restrictedDialogue=$(''),p.$overlays.append(this.$restrictedDialogue),this.restrictedDialogue=new u(this.$restrictedDialogue),this.$loginDialogue=$(''),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;ot.minWidth&&this.width()<=t.maxWidth&&this.metric!==t.type&&(this.metric=t.type,$.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;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){var n=_.filter(e,function(e){return e.name===t.name});if(n.length){var o=n[0];t.label&&(o.label=t.label),o.added=!0,i.push(o)}});var n=Utils.Bools.getBool(this.config.options.limitLocales,!1);return n||_.each(e,function(e){e.added||i.push(e),delete e.added}),this.locales=i},t.prototype.getAlternateLocale=function(){for(var e,t=this.getLocales(),i=0;i0&&(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"+this.content.title+""),this.$content.append(this.$title),this.$noneAvailable=$('
'+this.content.noneAvailable+"
"),this.$content.append(this.$noneAvailable),this.$downloadOptions=$('
    '),this.$content.append(this.$downloadOptions),this.$footer=$(''),this.$content.append(this.$footer),this.$termsOfUseButton=$(''+this.extension.config.content.termsOfUse+""),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){var n=t.getFormat(),o="";n&&(o=n.toString()),e.addEntireFileDownloadOption(t.id,Manifesto.TranslationCollection.getValue(t.getLabel()),o),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('
  1. '+String.format(t,n)+"
  2. ")},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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-mediaelement-extension/DownloadDialogue",["require","exports","../../modules/uv-dialogues-module/DownloadDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/ShareDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t),this.aspectRatio=.75,this.isEmbedViewVisible=!1,this.isShareViewVisible=!1,this.maxHeight=this.maxWidth*this.aspectRatio,this.maxWidth=8e3,this.minHeight=this.minWidth*this.aspectRatio,this.minWidth=200}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=$('
    '),this.$content.append(this.$tabs),this.$shareButton=$('
    "),this.$shareButton.prop("title",this.content.share),this.$tabs.append(this.$shareButton),this.$embedButton=$(''+this.content.embed+""),this.$embedButton.prop("title",this.content.embed),this.$tabs.append(this.$embedButton),this.$tabsContent=$('
    '),this.$content.append(this.$tabsContent),this.$footer=$(''),this.$content.append(this.$footer),this.$shareView=$('
    '),this.$tabsContent.append(this.$shareView),this.$shareHeader=$('
    '),this.$shareView.append(this.$shareHeader),this.$shareLink=$(''),this.$shareView.append(this.$shareLink),this.$shareInput=$(''),this.$shareView.append(this.$shareInput),this.$shareFrame=$(''),this.$shareView.append(this.$shareFrame),this.$embedView=$('
    '),this.$tabsContent.append(this.$embedView),this.$embedHeader=$('
    '),this.$embedView.append(this.$embedHeader),this.$code=$(''),this.$embedView.append(this.$code),this.$customSize=$('
    '),this.$embedView.append(this.$customSize),this.$size=$(''+this.content.size+""),this.$customSize.append(this.$size),this.$customSizeDropDown=$(''),this.$customSize.append(this.$customSizeDropDown),this.$customSizeDropDown.append(''),this.$customSizeDropDown.append(''),this.$customSizeDropDown.append(''),this.$customSizeDropDown.append('"),this.$widthInput=$(''),this.$customSize.append(this.$widthInput),this.$x=$('x'),this.$customSize.append(this.$x),this.$heightInput=$(''),this.$customSize.append(this.$heightInput);var n=this.extension.getIIIFShareUrl();this.$iiifButton=$(''),this.$footer.append(this.$iiifButton),this.$termsOfUseButton=$(''+this.extension.config.content.termsOfUse+""),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.currentHeightthis.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.currentWidththis.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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-mediaelement-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/FooterPanel",["require","exports","./BaseCommands","./BaseView","./MetricType"],function(e,t,i,n,o){var s=function(e){function t(t){e.call(this,t)}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=$('
    '),this.$element.append(this.$options),this.$feedbackButton=$('"),this.$options.prepend(this.$feedbackButton),this.$openButton=$(''+this.content.open+""),this.$options.prepend(this.$openButton),this.$bookmarkButton=$(''+this.content.bookmark+""),this.$options.prepend(this.$bookmarkButton),this.$shareButton=$('"),this.$options.append(this.$shareButton),this.$embedButton=$(''+this.content.embed+""),this.$options.append(this.$embedButton),this.$downloadButton=$(''+this.content.download+""),this.$options.prepend(this.$downloadButton),this.$moreInfoButton=$(''+this.content.moreInfo+""),this.$options.prepend(this.$moreInfoButton),this.$fullScreenBtn=$(''+this.content.fullScreen+""),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.toString()===o.MetricType.MOBILELANDSCAPE.toString()?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.toString()===o.MetricType.MOBILELANDSCAPE.toString()?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){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){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){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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/HeaderPanel",["require","exports","./BaseCommands","./BaseView","../uv-shared-module/InformationFactory"],function(e,t,i,n,o){var s=function(e){function t(t){e.call(this,t,!1,!1)}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=$('
    '),this.$element.append(this.$options),this.$centerOptions=$('
    '),this.$options.append(this.$centerOptions),this.$rightOptions=$('
    '),this.$options.append(this.$rightOptions),this.$localeToggleButton=$(''),this.$rightOptions.append(this.$localeToggleButton),this.$settingsButton=$(''),this.$settingsButton.attr("title",this.content.settings),this.$rightOptions.append(this.$settingsButton),this.$informationBox=$('
    '),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'+r.label+"");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.$content.append(this.$title),this.$scroll=$('
    '),this.$content.append(this.$scroll),this.$message=$("

    "),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/CenterPanel",["require","exports","./Shell","./BaseView"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t,!1,!0)}return __extends(t,e),t.prototype.create=function(){var t=this;e.prototype.create.call(this),this.$title=$('
    '),this.$element.append(this.$title),this.$content=$('
    '),this.$element.append(this.$content),this.$attribution=$('
    '),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var s=function(e){function t(t){e.call(this,t)}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=$('
    '),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){a.push({type:e.getFormat().toString(),src:e.id})}),t.extension.isVideo())t.media=t.$container.append('"),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('"),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/BaseExpandPanel",["require","exports","./BaseView"],function(e,t,i){var n=function(e){function t(t){e.call(this,t,!1,!0),this.isExpanded=!1,this.isFullyExpanded=!1,this.isUnopened=!0,this.autoToggled=!1,this.expandFullEnabled=!0}return __extends(t,e),t.prototype.create=function(){var t=this;e.prototype.create.call(this),this.$top=$('
    '),this.$element.append(this.$top),this.$title=$('
    '),this.$title.prop("title",this.content.title),this.$top.append(this.$title),this.$expandFullButton=$(''),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=$('
    '),this.$collapseButton.prop("title",this.content.collapse),this.$top.append(this.$collapseButton),this.$closed=$('
    '),this.$element.append(this.$closed),this.$expandButton=$(''),this.$expandButton.prop("title",this.content.expand),this.$closed.append(this.$expandButton),this.$closedTitle=$(''),this.$closedTitle.prop("title",this.content.title),this.$closed.append(this.$closedTitle),this.$main=$('
    '),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/RightPanel",["require","exports","./BaseCommands","./BaseExpandPanel"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-moreinforightpanel-module/MoreInfoRightPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/RightPanel"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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=$(''),this.$main.append(this.$metadata),this.component=new IIIFComponents.MetadataComponent(this._getOptions())},t.prototype.toggleFinish=function(){e.prototype.toggleFinish.call(this),this.databind()},t.prototype.databind=function(){this.component.options=this._getOptions(),this.component.databind()},t.prototype._getOptions=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),element:".rightPanel .iiif-metadata-component",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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/LeftPanel",["require","exports","./BaseCommands","./BaseExpandPanel"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/ThumbsView",["require","exports","./BaseCommands","./BaseView"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t,!0,!0),this.isCreated=!1,this.isOpen=!1}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=$('
    '),this.$element.append(this.$thumbs),this.$thumbs.addClass(this.extension.helper.getViewingDirection().toString());var n=this;$.templates({thumbsTemplate:'
    {{:#index + 1}} {{>label}}  {{>data.searchResults}}
    {{if ~separator()}}
    {{/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;n1&&(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');$(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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-resourcesleftpanel-module/ThumbsView",["require","exports","../uv-shared-module/ThumbsView"],function(e,t,i){var n=function(e){function t(){e.apply(this,arguments)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-resourcesleftpanel-module/ResourcesLeftPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/LeftPanel","./ThumbsView"],function(e,t,i,n,o){var s=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){this.setConfig("resourcesLeftPanel"),e.prototype.create.call(this),this.setTitle(this.content.title),this.$tabsContent=$('
    '),this.$main.append(this.$tabsContent),this.$views=$('
    '),this.$tabsContent.append(this.$views),this.$thumbsView=$('
    '),this.$views.append(this.$thumbsView),this.$resourcesView=$('
    '),this.$resources=$("
      "),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'+Manifesto.TranslationCollection.getValue(n.getLabel())+" ("+Utils.Files.simplifyMimeType(n.getFormat().toString())+")");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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var s=function(e){function t(t){e.call(this,t)}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=$("

      "),this.$content.append(this.$title),this.$scroll=$('
      '),this.$content.append(this.$scroll),this.$version=$('
      '),this.$content.append(this.$version),this.$website=$('
      '),this.$content.append(this.$website),this.$locale=$('
      '),this.$scroll.append(this.$locale),this.$localeLabel=$('"),this.$locale.append(this.$localeLabel),this.$localeDropDown=$(''),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'+s.label+"")}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-mediaelement-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var m=function(e){function t(t){e.call(this,t)}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=$('
      '),f.$overlays.append(this.$helpDialogue),this.helpDialogue=new c(this.$helpDialogue),this.$downloadDialogue=$('
      '),f.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new r(this.$downloadDialogue),this.$shareDialogue=$(''),f.$overlays.append(this.$shareDialogue),this.shareDialogue=new a(this.$shareDialogue),this.$settingsDialogue=$('
      '),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-pdf-extension/DownloadDialogue",["require","exports","../../modules/uv-dialogues-module/DownloadDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-pdf-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-pdfcenterpanel-module/PDFCenterPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/CenterPanel","../../Params"],function(e,t,i,n,o){var s=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-pdf-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){ -var g=function(e){function t(t){e.call(this,t)}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=$('
      '),d.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new s(this.$downloadDialogue),this.$shareDialogue=$(''),d.$overlays.append(this.$shareDialogue),this.shareDialogue=new r(this.$shareDialogue),this.$settingsDialogue=$('
      '),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){var i=function(){function e(){}return e.namespace="seadragonExtension.",e.CLEAR_SEARCH=e.namespace+"onClearSearch",e.CURRENT_VIEW_URI=e.namespace+"onCurrentViewUri",e.FIRST=e.namespace+"onFirst",e.GALLERY_DECREASE_SIZE=e.namespace+"onGalleryDecreaseSize",e.GALLERY_INCREASE_SIZE=e.namespace+"onGalleryIncreaseSize",e.GALLERY_THUMB_SELECTED=e.namespace+"onGalleryThumbSelected",e.HIDE_MULTISELECT_DIALOGUE=e.namespace+"onHideMultiSelectDialogue",e.IMAGE_SEARCH=e.namespace+"onImageSearch",e.LAST=e.namespace+"onLast",e.MODE_CHANGED=e.namespace+"onModeChanged",e.MULTISELECT_CHANGE=e.namespace+"onMultiSelectChange",e.MULTISELECTION_MADE=e.namespace+"onMultiSelectionMade",e.NEXT_SEARCH_RESULT=e.namespace+"onNextSearchResult",e.NEXT=e.namespace+"onNext",e.NEXT_IMAGES_SEARCH_RESULT_UNAVAILABLE=e.namespace+"onNextImagesSearchResultUnavailable",e.PREV_IMAGES_SEARCH_RESULT_UNAVAILABLE=e.namespace+"onPrevImagesSearchResultUnavailable",e.OPEN_THUMBS_VIEW=e.namespace+"onOpenThumbsView",e.OPEN_TREE_VIEW=e.namespace+"onOpenTreeView",e.PAGE_SEARCH=e.namespace+"onPageSearch",e.PAGING_TOGGLED=e.namespace+"onPagingToggled",e.PREV_SEARCH_RESULT=e.namespace+"onPrevSearchResult",e.PREV=e.namespace+"onPrev",e.PRINT=e.namespace+"onPrint",e.ROTATE=e.namespace+"onRotate",e.SEADRAGON_ANIMATION_FINISH=e.namespace+"onAnimationfinish",e.SEADRAGON_ANIMATION_START=e.namespace+"onAnimationStart",e.SEADRAGON_ANIMATION=e.namespace+"onAnimation",e.SEADRAGON_OPEN=e.namespace+"onOpen",e.SEADRAGON_RESIZE=e.namespace+"onResize",e.SEADRAGON_ROTATION=e.namespace+"onRotation",e.SEARCH_PREVIEW_FINISH=e.namespace+"onSearchPreviewFinish",e.SEARCH_PREVIEW_START=e.namespace+"onSearchPreviewStart",e.SEARCH_RESULT_CANVAS_CHANGED=e.namespace+"onSearchResultCanvasChanged",e.SEARCH_RESULT_RECT_CHANGED=e.namespace+"onSearchResultRectChanged",e.SEARCH_RESULTS_EMPTY=e.namespace+"onSearchResultsEmpty",e.SEARCH_RESULTS=e.namespace+"onSearchResults",e.SEARCH_RESULTS_CLEARED=e.namespace+"onSearchResultsCleared",e.SEARCH=e.namespace+"onSearch",e.SHOW_MULTISELECT_DIALOGUE=e.namespace+"onShowMultiSelectDialogue",e.THUMB_MULTISELECTED=e.namespace+"onThumbMultiSelected",e.TREE_NODE_MULTISELECTED=e.namespace+"onTreeNodeMultiSelected",e.TREE_NODE_SELECTED=e.namespace+"onTreeNodeSelected",e.VIEW_PAGE=e.namespace+"onViewPage",e.ZOOM_IN=e.namespace+"onZoomIn",e.ZOOM_OUT=e.namespace+"onZoomOut",e}();return i});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var s=function(e){function t(t){e.call(this,t,!0,!0),this.isOpen=!1}return __extends(t,e),t.prototype.create=function(){this.setConfig("contentLeftPanel"),e.prototype.create.call(this),this.$gallery=$(''),this.$element.append(this.$gallery)},t.prototype.setup=function(){this.component=new IIIFComponents.GalleryComponent(this.galleryOptions),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=this.galleryOptions,this.component.databind(),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.galleryOptions.element),i=t.find(".main"),n=t.find(".header");i.height(this.$element.height()-n.height())},t}(n);return s}),define("extensions/uv-seadragon-extension/Mode",["require","exports"],function(e,t){var i=function(){function e(e){this.value=e}return e.prototype.toString=function(){return this.value},e.image=new e("image"),e.page=new e("page"),e}();return i});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var s=function(e){function t(){e.apply(this,arguments)}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'),this.$element.append(this.$tree)},t.prototype.setup=function(){this.component=new IIIFComponents.TreeComponent(this.treeOptions),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=this.treeOptions,this.component.databind(),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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/MetricType","../../extensions/uv-seadragon-extension/Mode","./ThumbsView","./TreeView"],function(e,t,i,n,o,s,r,a,l,h){var c=function(e){function t(t){e.call(this,t),this.expandFullEnabled=!1,this.isThumbsViewOpen=!1,this.isTreeViewOpen=!1,this.treeSortType=Manifold.TreeSortType.NONE}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.toString()===r.MetricType.MOBILELANDSCAPE.toString()&&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=$('
      '),this.$main.append(this.$tabs),this.$treeButton=$('
      '+this.content.index+""),this.$tabs.append(this.$treeButton),this.$thumbsButton=$(''+this.content.thumbnails+""),this.$thumbsButton.prop("title",this.content.thumbnails),this.$tabs.append(this.$thumbsButton),this.$tabsContent=$('
      '),this.$main.append(this.$tabsContent),this.$options=$('
      '),this.$tabsContent.append(this.$options),this.$topOptions=$('
      '),this.$options.append(this.$topOptions),this.$treeSelect=$(""),this.$topOptions.append(this.$treeSelect),this.$bottomOptions=$('
      '),this.$options.append(this.$bottomOptions),this.$leftOptions=$('
      '),this.$bottomOptions.append(this.$leftOptions),this.$rightOptions=$('
      '),this.$bottomOptions.append(this.$rightOptions),this.$treeViewOptions=$('
      '),this.$leftOptions.append(this.$treeViewOptions),this.$sortByLabel=$(''+this.content.sortBy+""),this.$treeViewOptions.append(this.$sortByLabel),this.$sortButtonGroup=$('
      '),this.$treeViewOptions.append(this.$sortButtonGroup),this.$sortByDateButton=$('"),this.$sortButtonGroup.append(this.$sortByDateButton),this.$sortByVolumeButton=$('"),this.$sortButtonGroup.append(this.$sortByVolumeButton),this.$views=$('
      '),this.$tabsContent.append(this.$views),this.$treeView=$('
      '),this.$views.append(this.$treeView),this.$thumbsView=$('
      '),this.$views.append(this.$thumbsView),this.$galleryView=$('
      '),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.treeOptions=this.getTreeOptions(),this.treeView.setup(),this.databindTreeView();var e=this.extension.helper.getTopRanges();if(e.length>1)for(var t=0;t'+Manifesto.TranslationCollection.getValue(i.getLabel())+"")}this.updateTreeViewOptions()},t.prototype.databind=function(){this.databindThumbsView(),this.databindTreeView(),this.databindGalleryView()},t.prototype.updateTreeViewOptions=function(){var e=this.getTreeData();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.treeOptions=this.getTreeOptions(),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.treeOptions=this.getTreeOptions(),this.treeView.databind(),this.selectCurrentTreeNode(),this.$sortByDateButton.removeClass("on"),this.$sortByVolumeButton.addClass("on"),this.resize()},t.prototype.isCollection=function(){var e=this.getTreeData();return e.data.type===manifesto.TreeNodeType.collection().toString()},t.prototype.databindTreeView=function(){this.treeView&&(this.treeView.treeOptions=this.getTreeOptions(),this.treeView.databind(),this.selectCurrentTreeNode())},t.prototype.getTreeOptions=function(){return{branchNodesSelectable:!1,element:".views .treeView .iiif-tree-component",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;st?!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){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){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){var i=function(){function e(){}return e.CURRENTVIEW="currentView",e.ENTIREDOCUMENTASPDF="entireDocumentAsPdf",e.ENTIREDOCUMENTASTEXT="entireDocumentAsText",e.WHOLEIMAGEHIGHRES="wholeImageHighRes",e.WHOLEIMAGESHIGHRES="wholeImageHighRes",e.WHOLEIMAGELOWRES="wholeImageLowRes",e.UNKNOWN="unknown",e}();return i});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var a=Utils.Measurements.Size,l=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("downloadDialogue"),e.prototype.create.call(this),this.$imageOptionsContainer=$('
    • '),this.$downloadOptions.append(this.$imageOptionsContainer),this.$imageOptions=$("
        "),this.$imageOptionsContainer.append(this.$imageOptions),this.$currentViewAsJpgButton=$('
      • '),this.$imageOptions.append(this.$currentViewAsJpgButton),this.$currentViewAsJpgButton.hide(),this.$wholeImageHighResButton=$('
      • '),this.$imageOptions.append(this.$wholeImageHighResButton),this.$wholeImageHighResButton.hide(),this.$wholeImagesHighResButton=$('
      • '),this.$imageOptions.append(this.$wholeImagesHighResButton),this.$wholeImageHighResButton.hide(),this.$wholeImageLowResAsJpgButton=$('
      • "),this.$imageOptions.append(this.$wholeImageLowResAsJpgButton),this.$wholeImageLowResAsJpgButton.hide(),this.$canvasOptionsContainer=$('
      • '),this.$downloadOptions.append(this.$canvasOptionsContainer),this.$canvasOptions=$("
          "),this.$canvasOptionsContainer.append(this.$canvasOptions),this.$sequenceOptionsContainer=$('
        • '),this.$downloadOptions.append(this.$sequenceOptionsContainer),this.$sequenceOptions=$("
            "),this.$sequenceOptionsContainer.append(this.$sequenceOptions),this.$selectionButton=$('
          • '),this.$sequenceOptions.append(this.$selectionButton),this.$selectionButton.hide(),this.$buttonsContainer=$('
            '),this.$content.append(this.$buttonsContainer),this.$downloadButton=$(''+this.content.download+""),this.$buttonsContainer.append(this.$downloadButton),this.$explanatoryTextTemplate=$('');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=S&&w>=S?this.$currentViewAsJpgButton.hide():this.$currentViewAsJpgButton.show()}var _=this.$imageOptions.find("li.single");_=_.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}),_.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");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.width1?!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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/ExternalContentDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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=$(""),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){var i=function(){function e(e,t,i,n,o,s,r){var a=this;void 0===o&&(o=300),void 0===s&&(s=2),void 0===r&&(r=!1),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=$('
              '),this._positionAbove?this._$element.parent().prepend(this._$searchResultsList):this._$element.parent().append(this._$searchResultsList),this._$searchResultTemplate=$('
            • ');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('
            • '),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.content.print+""),this.$options.prepend(this.$printButton),this.$searchContainer=$(''),this.$element.prepend(this.$searchContainer),this.$searchOptions=$('
              '),this.$searchContainer.append(this.$searchOptions),this.$searchLabel=$(''+this.content.searchWithin+""),this.$searchOptions.append(this.$searchLabel),this.$searchTextContainer=$('
              '),this.$searchOptions.append(this.$searchTextContainer),this.$searchText=$(''),this.$searchTextContainer.append(this.$searchText),this.$searchButton=$(''),this.$searchTextContainer.append(this.$searchButton),this.$searchPagerContainer=$('
              '),this.$element.prepend(this.$searchPagerContainer),this.$searchPagerControls=$('
              '),this.$searchPagerContainer.prepend(this.$searchPagerControls),this.$previousResultButton=$(''+this.content.previousResult+""),this.$searchPagerControls.append(this.$previousResultButton),this.$searchResultsInfo=$('
              x \'y\'
              '),this.$searchPagerControls.append(this.$searchResultsInfo),this.$clearSearchResultsButton=$(''+this.content.clearSearch+""),this.$searchResultsInfo.append(this.$clearSearchResultsButton),this.$nextResultButton=$(''+this.content.nextResult+""),this.$searchPagerControls.append(this.$nextResultButton),this.$searchResultsContainer=$('
              '),this.$element.prepend(this.$searchResultsContainer),this.$line=$('
              '),this.$searchResultsContainer.append(this.$line),this.$pagePositionMarker=$('
              '),this.$searchResultsContainer.append(this.$pagePositionMarker),this.$pagePositionLabel=$('
              '),this.$searchResultsContainer.append(this.$pagePositionLabel),this.$placemarkerDetails=$('
              '),this.$searchResultsContainer.append(this.$placemarkerDetails),this.$placemarkerDetailsTop=$("

              "),this.$placemarkerDetails.append(this.$placemarkerDetailsTop),this.$placemarkerDetailsBottom=$("

              "),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');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;me.$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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-osdmobilefooterpanel-module/MobileFooter",["require","exports","../uv-shared-module/FooterPanel","../../extensions/uv-seadragon-extension/Commands"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){this.setConfig("mobileFooterPanel"),e.prototype.create.call(this),this.$spacer=$('
              '),this.$options.prepend(this.$spacer),this.$rotateButton=$(''+this.content.rotateRight+""),this.$options.prepend(this.$rotateButton),this.$zoomOutButton=$(''+this.content.zoomOut+""),this.$options.prepend(this.$zoomOutButton),this.$zoomInButton=$(''+this.content.zoomIn+""),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/MoreInfoDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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=$("

              "+this.config.content.title+"

              "),this.$content.append(this.$title),this.$metadata=$(''),this.$content.append(this.$metadata),this.component=new IIIFComponents.MetadataComponent(this._getOptions()),this.$element.hide()},t.prototype.open=function(t){e.prototype.open.call(this,t),this.component.databind()},t.prototype._getOptions=function(){var e=this;return{canvasDisplayOrder:this.config.options.canvasDisplayOrder,canvases:this.extension.getCurrentCanvases(),canvasExclude:this.config.options.canvasExclude,canvasLabels:"Left Page, Right Page",content:this.config.content,copiedMessageDuration:2e3,copyToClipboardEnabled:Utils.Bools.getBool(this.config.options.copyToClipboardEnabled,!1),element:".overlay.moreInfo .iiif-metadata-component",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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var s=function(e){function t(t){e.call(this,t)}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.databind()}),$.subscribe(this.closeCommand,function(e){t.close();var i=t.extension.helper.getMultiSelectState();i.setEnabled(!1)}),this.$title=$("

              "),this.$content.append(this.$title),this.$title.text(this.content.title),this.$gallery=$(''),this.$content.append(this.$gallery),this.options={element:".overlay.multiSelect .iiif-gallery-component",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(this.options);var o=$(this.options.element).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.options.element),i=t.find(".main"),n=t.find(".header");i.height(this.$content.height()-this.$title.outerHeight()-this.$title.verticalMargins()-n.height())},t}(n);return s}),define("extensions/uv-seadragon-extension/MultiSelectionArgs",["require","exports"],function(e,t){var i=function(){function e(){}return e}();return i});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var a=function(e){function t(t){e.call(this,t),this.firstButtonEnabled=!1, -this.lastButtonEnabled=!1,this.nextButtonEnabled=!1,this.prevButtonEnabled=!1}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=$('
              '),this.$centerOptions.append(this.$prevOptions),this.$firstButton=$(''),this.$prevOptions.append(this.$firstButton),this.$prevButton=$(''),this.$prevOptions.append(this.$prevButton),this.$modeOptions=$('
              '),this.$centerOptions.append(this.$modeOptions),this.$imageModeLabel=$('"),this.$modeOptions.append(this.$imageModeLabel),this.$imageModeOption=$(''),this.$modeOptions.append(this.$imageModeOption),this.$pageModeLabel=$(''),this.$modeOptions.append(this.$pageModeLabel),this.$pageModeOption=$(''),this.$modeOptions.append(this.$pageModeOption),this.$search=$(''),this.$centerOptions.append(this.$search),this.$searchText=$(''),this.$search.append(this.$searchText),Utils.Bools.getBool(this.options.autoCompleteBoxEnabled,!0))this.$searchText.hide(),this.$autoCompleteBox=$(''),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'),this.$centerOptions.append(this.$selectionBoxOptions),this.$imageSelectionBox=$(''),this.$selectionBoxOptions.append(this.$imageSelectionBox);for(var s=0;s"+l+"")}this.$imageSelectionBox.change(function(){var e=parseInt(t.$imageSelectionBox.val());$.publish(o.IMAGE_SEARCH,[e])})}this.$total=$(''),this.$search.append(this.$total),this.$searchButton=$(''+this.content.go+""),this.$search.append(this.$searchButton),this.$nextOptions=$('
              '),this.$centerOptions.append(this.$nextOptions),this.$nextButton=$(''),this.$nextOptions.append(this.$nextButton),this.$lastButton=$(''),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=$(''),this.$rightOptions.prepend(this.$galleryButton),this.$pagingToggleButtons=$('
              '),this.$rightOptions.prepend(this.$pagingToggleButtons),this.$oneUpButton=$(''),this.$pagingToggleButtons.append(this.$oneUpButton),this.$twoUpButton=$(''),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.$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.toString()===r.MetricType.MOBILELANDSCAPE.toString()?(this.viewer.autoHideControls=!1,this.$viewportNavButtons.hide()):(this.viewer.autoHideControls=!0,this.$viewportNavButtons.show())},t.prototype.createUI=function(){var e=this;this.$spinner=$('
              '),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=$(''),this.$prevButton.prop("title",this.content.previous),this.$nextButton=$(''),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;i1)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;a0;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;a0;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;tthis.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.canvasIndexthis.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;s0?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.toString()!==r.MetricType.MOBILELANDSCAPE.toString();this.viewer.navigator.setVisible(e),e?this.$navigator.show():this.$navigator.hide()},t}(o);return l});var __extends=this&&this.__extends||function(e,t){function i(){ -this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-seadragon-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("settingsDialogue"),e.prototype.create.call(this),this.$navigatorEnabled=$(''),this.$scroll.append(this.$navigatorEnabled),this.$navigatorEnabledCheckbox=$(''),this.$navigatorEnabled.append(this.$navigatorEnabledCheckbox),this.$navigatorEnabledLabel=$('"),this.$navigatorEnabled.append(this.$navigatorEnabledLabel),this.$pagingEnabled=$('
              '),this.$scroll.append(this.$pagingEnabled),this.$pagingEnabledCheckbox=$(''),this.$pagingEnabled.append(this.$pagingEnabledCheckbox),this.$pagingEnabledLabel=$('"),this.$pagingEnabled.append(this.$pagingEnabledLabel),this.$clickToZoomEnabled=$('
              '),this.$scroll.append(this.$clickToZoomEnabled),this.$clickToZoomEnabledCheckbox=$(''),this.$clickToZoomEnabled.append(this.$clickToZoomEnabledCheckbox),this.$clickToZoomEnabledLabel=$('"),this.$clickToZoomEnabled.append(this.$clickToZoomEnabledLabel),this.$preserveViewport=$('
              '),this.$scroll.append(this.$preserveViewport),this.$preserveViewportCheckbox=$(''),this.$preserveViewport.append(this.$preserveViewportCheckbox),this.$preserveViewportLabel=$('"),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-seadragon-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue","./Commands"],function(e,t,i,n){var o=function(e){function t(t){var i=this;e.call(this,t),$.subscribe(n.SEADRAGON_OPEN,function(){i.update()}),$.subscribe(n.SEADRAGON_ANIMATION_FINISH,function(){i.update()})}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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/MetricType","../../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,x,y,w,S,C,R){var T=Manifold.SearchResult,I=Utils.Measurements.Size,D=function(e){function t(t){e.call(this,t),this.currentRotation=0,this.isSearching=!1,this.searchResults=[]}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.toString()===p.MetricType.MOBILELANDSCAPE.toString()){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.toString()!==p.MetricType.MOBILELANDSCAPE.toString()&&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(x.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(x.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=$('
              '),R.$overlays.append(this.$helpDialogue),this.helpDialogue=new u(this.$helpDialogue),this.$moreInfoDialogue=$('
              '),R.$overlays.append(this.$moreInfoDialogue),this.moreInfoDialogue=new f(this.$moreInfoDialogue),this.$multiSelectDialogue=$('
              '),R.$overlays.append(this.$multiSelectDialogue),this.multiSelectDialogue=new v(this.$multiSelectDialogue),this.$shareDialogue=$(''),R.$overlays.append(this.$shareDialogue),this.shareDialogue=new C(this.$shareDialogue),this.$downloadDialogue=$('
              '),R.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new l(this.$downloadDialogue),this.$settingsDialogue=$('
              '),R.$overlays.append(this.$settingsDialogue),this.settingsDialogue=new S(this.$settingsDialogue),this.$externalContentDialogue=$('
              '),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(x.highlight);e&&(e.replace(/\+/g," ").replace(/"/g,""),$.publish(s.SEARCH,[e]))}},t.prototype.checkForRotationParam=function(){if(this.isDeepLinkingEnabled()){var e=Number(this.getParam(x.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.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 I(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 I(h,c),n.regionPos=new y(r,l),n.size=new I(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 I(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;rthis.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'),this.$content.prepend(this.$navigation),this.$zoomInButton=$(''),this.$navigation.append(this.$zoomInButton),this.$zoomOutButton=$(''),this.$navigation.append(this.$zoomOutButton),this.$viewport=$('
              '),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var g=function(e){function t(t){e.call(this,t)}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=$('
              '),p.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new r(this.$downloadDialogue),this.$shareDialogue=$(''),p.$overlays.append(this.$shareDialogue),this.shareDialogue=new a(this.$shareDialogue),this.$settingsDialogue=$('
              '),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(){}); \ No newline at end of file +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-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;t0&&(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=w.map,$=v&&v["*"];if(e&&(e=e.split("/"),c=e.length-1,w.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(w.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(w.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(S,t);return i||(i=S[t]=new E.Module(e)),i}function l(e,t,i){var n=e.id,o=getOwn(S,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(S,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 S[e],delete _[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(S,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*w.waitSeconds,s=i&&E.startTime+i<(new Date).getTime(),r=[],a=[],l=!1,c=!0;if(!$){if($=!0,eachProp(_,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,x,y,w={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},S={},_={},C={},R=[],I={},T={},O={},D=1,A=1;return x={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(w.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}},b=function(e){this.events=getOwn(C,e.id)||{},this.map=e,this.shim=getOwn(w.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(S,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(S,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(w.config,t)&&(w.config[s]=w.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,w))})),E.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){_[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(x,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=S[i],hasProp(x,i)||!n||n.enabled||E.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(S,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:w,contextName:e,registry:S,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=w.shim,n={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(e,t){n[t]?(w[t]||(w[t]={}),mixin(w[t],e,!0,!0)):w[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}),w.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&&(w.paths[i]=e.location),w.pkgs[i]=e.name+"/"+(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(S,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(x,i)?x[i](S[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(S,e)}}),t||(s.undef=function(e){c();var i=r(e,t,!0),o=getOwn(S,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(S,e.id);t&&a(e).enable()},completeLoad:function(e){var t,i,n,s=getOwn(w.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(S,e),!t&&!hasProp(I,e)&&n&&!n.inited){if(!(!w.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(w.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=w.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\+\.\-]+:/)?"":w.baseUrl)+a}return w.urlArgs&&!/^blob\:/.test(a)?a+w.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(S,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){var i=function(){function e(){}return e.namespace="uv.",e.ACCEPT_TERMS=e.namespace+"onAcceptTerms",e.BOOKMARK=e.namespace+"onBookmark",e.CANVAS_INDEX_CHANGE_FAILED=e.namespace+"onCanvasIndexChangeFailed",e.CANVAS_INDEX_CHANGED=e.namespace+"onCanvasIndexChanged",e.CLICKTHROUGH=e.namespace+"onClickthrough",e.CLOSE_ACTIVE_DIALOGUE=e.namespace+"onCloseActiveDialogue",e.CLOSE_LEFT_PANEL=e.namespace+"onCloseLeftPanel",e.CLOSE_RIGHT_PANEL=e.namespace+"onCloseRightPanel",e.CREATED=e.namespace+"onCreated",e.DOWN_ARROW=e.namespace+"onDownArrow",e.DOWNLOAD=e.namespace+"onDownload",e.DROP=e.namespace+"onDrop",e.END=e.namespace+"onEnd",e.ESCAPE=e.namespace+"onEscape",e.EXTERNAL_LINK_CLICKED=e.namespace+"onExternalLinkClicked",e.FEEDBACK=e.namespace+"onFeedback",e.FORBIDDEN=e.namespace+"onForbidden",e.GET_OCR=e.namespace+"onGetOcr",e.HIDE_CLICKTHROUGH_DIALOGUE=e.namespace+"onHideClickthroughDialogue",e.HIDE_DOWNLOAD_DIALOGUE=e.namespace+"onHideDownloadDialogue",e.HIDE_EMBED_DIALOGUE=e.namespace+"onHideEmbedDialogue",e.HIDE_EXTERNALCONTENT_DIALOGUE=e.namespace+"onHideExternalContentDialogue",e.HIDE_GENERIC_DIALOGUE=e.namespace+"onHideGenericDialogue",e.HIDE_HELP_DIALOGUE=e.namespace+"onHideHelpDialogue",e.HIDE_INFORMATION=e.namespace+"onHideInformation",e.HIDE_LOGIN_DIALOGUE=e.namespace+"onHideLoginDialogue",e.HIDE_MOREINFO_DIALOGUE=e.namespace+"onHideMoreInfoDialogue",e.HIDE_OVERLAY=e.namespace+"onHideOverlay",e.HIDE_RESTRICTED_DIALOGUE=e.namespace+"onHideRestrictedDialogue",e.HIDE_SETTINGS_DIALOGUE=e.namespace+"onHideSettingsDialogue",e.HIDE_SHARE_DIALOGUE=e.namespace+"onHideShareDialogue",e.HOME=e.namespace+"onHome",e.LEFT_ARROW=e.namespace+"onLeftArrow",e.LEFTPANEL_COLLAPSE_FULL_FINISH=e.namespace+"onLeftPanelCollapseFullFinish",e.LEFTPANEL_COLLAPSE_FULL_START=e.namespace+"onLeftPanelCollapseFullStart",e.LEFTPANEL_EXPAND_FULL_FINISH=e.namespace+"onLeftPanelExpandFullFinish",e.LEFTPANEL_EXPAND_FULL_START=e.namespace+"onLeftPanelExpandFullStart",e.LOAD_FAILED=e.namespace+"onLoadFailed",e.LOAD=e.namespace+"onLoad",e.LOGIN_FAILED=e.namespace+"onLoginFailed",e.LOGIN=e.namespace+"onLogin",e.LOGOUT=e.namespace+"onLogout",e.METRIC_CHANGED=e.namespace+"onMetricChanged",e.MINUS=e.namespace+"onMinus",e.NOT_FOUND=e.namespace+"onNotFound",e.OPEN_EXTERNAL_RESOURCE=e.namespace+"onOpenExternalResource",e.OPEN_LEFT_PANEL=e.namespace+"onOpenLeftPanel",e.OPEN_RIGHT_PANEL=e.namespace+"onOpenRightPanel",e.OPEN=e.namespace+"onOpen",e.PAGE_DOWN=e.namespace+"onPageDown",e.PAGE_UP=e.namespace+"onPageUp",e.PARENT_EXIT_FULLSCREEN=e.namespace+"onParentExitFullScreen",e.PLUS=e.namespace+"onPlus",e.REDIRECT=e.namespace+"onRedirect",e.REFRESH=e.namespace+"onRefresh",e.RESIZE=e.namespace+"onResize",e.RESOURCE_DEGRADED=e.namespace+"onResourceDegraded",e.RETRY=e.namespace+"onRetry",e.RETURN=e.namespace+"onReturn",e.RIGHT_ARROW=e.namespace+"onRightArrow",e.RIGHTPANEL_COLLAPSE_FULL_FINISH=e.namespace+"onRightPanelCollapseFullFinish",e.RIGHTPANEL_COLLAPSE_FULL_START=e.namespace+"onRightPanelCollapseFullStart",e.RIGHTPANEL_EXPAND_FULL_FINISH=e.namespace+"onRightPanelExpandFullFinish",e.RIGHTPANEL_EXPAND_FULL_START=e.namespace+"onRightPanelExpandFullStart",e.SEQUENCE_INDEX_CHANGED=e.namespace+"onSequenceIndexChanged",e.SETTINGS_CHANGED=e.namespace+"onSettingsChanged",e.SHOW_CLICKTHROUGH_DIALOGUE=e.namespace+"onShowClickThroughDialogue",e.SHOW_DOWNLOAD_DIALOGUE=e.namespace+"onShowDownloadDialogue",e.SHOW_EMBED_DIALOGUE=e.namespace+"onShowEmbedDialogue",e.SHOW_EXTERNALCONTENT_DIALOGUE=e.namespace+"onShowExternalContentDialogue",e.SHOW_GENERIC_DIALOGUE=e.namespace+"onShowGenericDialogue",e.SHOW_HELP_DIALOGUE=e.namespace+"onShowHelpDialogue",e.SHOW_INFORMATION=e.namespace+"onShowInformation",e.SHOW_LOGIN_DIALOGUE=e.namespace+"onShowLoginDialogue",e.SHOW_MOREINFO_DIALOGUE=e.namespace+"onShowMoreInfoDialogue",e.SHOW_OVERLAY=e.namespace+"onShowOverlay",e.SHOW_RESTRICTED_DIALOGUE=e.namespace+"onShowRestrictedDialogue",e.SHOW_SETTINGS_DIALOGUE=e.namespace+"onShowSettingsDialogue",e.SHOW_SHARE_DIALOGUE=e.namespace+"onShowShareDialogue",e.SHOW_TERMS_OF_USE=e.namespace+"onShowTermsOfUse",e.THUMB_SELECTED=e.namespace+"onThumbSelected",e.TOGGLE_EXPAND_LEFT_PANEL=e.namespace+"onToggleExpandLeftPanel",e.TOGGLE_EXPAND_RIGHT_PANEL=e.namespace+"onToggleExpandRightPanel",e.TOGGLE_FULLSCREEN=e.namespace+"onToggleFullScreen",e.UP_ARROW=e.namespace+"onUpArrow",e.UPDATE_SETTINGS=e.namespace+"onUpdateSettings",e.VIEW_FULL_TERMS=e.namespace+"onViewFullTerms",e.WINDOW_UNLOAD=e.namespace+"onWindowUnload",e}();return i}),define("Params",["require","exports"],function(e,t){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){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 #app").data("bootstrapper"),e.call(this,t,i,n)}return __extends(t,e),t.prototype.create=function(){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.length&&(t.modules=t.modules.reverse(),_.each(t.modules,function(e){t.config=$.extend(!0,t.config,t.extension.config.modules[e])}))},t.prototype.init=function(){},t.prototype.setConfig=function(e){this.modules.push(e)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/Dialogue",["require","exports","./BaseView","./BaseCommands"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t,!1,!1),this.allowClose=!0,this.isActive=!1,this.isUnopened=!0}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=$('
              '),this.$element.append(this.$top),this.$closeButton=$(''+this.content.close+""),this.$top.append(this.$closeButton),this.$middle=$('
              '),this.$element.append(this.$middle),this.$content=$('
              '),this.$middle.append(this.$content),this.$bottom=$('
              '),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/ClickThroughDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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=$("

              "),this.$content.append(this.$title),this.$content.append('

              '),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){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){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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/LoginDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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=$("

              "),this.$content.append(this.$title),this.$content.append('

              '),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=''+this.extension.config.content[this.options.warningMessage]+''+t+""),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){var i=function(){function e(){}return e.FORBIDDEN="forbiddenResourceMessage",e}();return i}),define("modules/uv-shared-module/StringValue",["require","exports"],function(e,t){var i=function(){function e(e){this.value="",e&&(this.value=e.toLowerCase())}return e.prototype.toString=function(){return this.value},e}();t.StringValue=i});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/MetricType",["require","exports","./StringValue"],function(e,t,i){var n=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.MOBILELANDSCAPE=new t("mobilelandscape"),t.LAPTOP=new t("laptop"),t}(i.StringValue);t.MetricType=n});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/RestrictedDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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=$("

              "),this.$content.append(this.$title),this.$content.append('

              '),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/GenericDialogue",["require","exports","./BaseCommands","./Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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=$("

              "),this.$content.append(this.$message),this.$acceptButton=$(''),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/Shell",["require","exports","./BaseCommands","./BaseView","./GenericDialogue"],function(e,t,i,n,o){var s=function(e){function t(i){t.$element=i,e.call(this,t.$element,!0,!0)}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=$('
              '),t.$element.append(t.$headerPanel),t.$mainPanel=$('
              '),t.$element.append(t.$mainPanel),t.$centerPanel=$('
              '),t.$mainPanel.append(t.$centerPanel),t.$leftPanel=$('
              '),t.$mainPanel.append(t.$leftPanel),t.$ocrRightPanel=$('
              '),t.$mainPanel.append(t.$ocrRightPanel),t.$rightPanel=$('
              '),t.$mainPanel.append(t.$rightPanel),t.$footerPanel=$('
              '),t.$element.append(t.$footerPanel),t.$mobileFooterPanel=$('
              '),t.$element.append(t.$mobileFooterPanel),t.$overlays=$('
              '),t.$element.append(t.$overlays),t.$genericDialogue=$('
              '),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/MetricType","../../Params","../../modules/uv-dialogues-module/RestrictedDialogue","./Shell"],function(e,t,i,n,o,s,r,a,l,h,c,u,p){var d=function(){function t(e){this.isCreated=!1,this.isLoggedIn=!1,this.metric=h.MetricType.LAPTOP,this.metrics=[],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._parseMetrics(),!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;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(''),this.$element.append(''),$.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=$('
              '),p.$overlays.append(this.$clickThroughDialogue),this.clickThroughDialogue=new o(this.$clickThroughDialogue),this.$restrictedDialogue=$(''),p.$overlays.append(this.$restrictedDialogue),this.restrictedDialogue=new u(this.$restrictedDialogue),this.$loginDialogue=$(''),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;ot.minWidth&&this.width()<=t.maxWidth&&this.metric!==t.type&&(this.metric=t.type,$.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;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){var n=_.filter(e,function(e){return e.name===t.name});if(n.length){var o=n[0];t.label&&(o.label=t.label),o.added=!0,i.push(o)}});var n=Utils.Bools.getBool(this.config.options.limitLocales,!1);return n||_.each(e,function(e){e.added||i.push(e),delete e.added}),this.locales=i},t.prototype.getAlternateLocale=function(){for(var e,t=this.getLocales(),i=0;i0&&(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"+this.content.title+""),this.$content.append(this.$title),this.$noneAvailable=$('
              '+this.content.noneAvailable+"
              "),this.$content.append(this.$noneAvailable),this.$downloadOptions=$('
                '),this.$content.append(this.$downloadOptions),this.$footer=$(''),this.$content.append(this.$footer),this.$termsOfUseButton=$(''+this.extension.config.content.termsOfUse+""),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){var n=t.getFormat(),o="";n&&(o=n.toString()),e.addEntireFileDownloadOption(t.id,Manifesto.TranslationCollection.getValue(t.getLabel()),o),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('
              1. '+String.format(t,n)+"
              2. ")},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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-mediaelement-extension/DownloadDialogue",["require","exports","../../modules/uv-dialogues-module/DownloadDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/ShareDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t),this.aspectRatio=.75,this.isEmbedViewVisible=!1,this.isShareViewVisible=!1,this.maxHeight=this.maxWidth*this.aspectRatio,this.maxWidth=8e3,this.minHeight=this.minWidth*this.aspectRatio,this.minWidth=200}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=$('
                '),this.$content.append(this.$tabs),this.$shareButton=$('
                "),this.$shareButton.prop("title",this.content.share),this.$tabs.append(this.$shareButton),this.$embedButton=$(''+this.content.embed+""),this.$embedButton.prop("title",this.content.embed),this.$tabs.append(this.$embedButton),this.$tabsContent=$('
                '),this.$content.append(this.$tabsContent),this.$footer=$(''),this.$content.append(this.$footer),this.$shareView=$('
                '),this.$tabsContent.append(this.$shareView),this.$shareHeader=$('
                '),this.$shareView.append(this.$shareHeader),this.$shareLink=$(''),this.$shareView.append(this.$shareLink),this.$shareInput=$(''),this.$shareView.append(this.$shareInput),this.$shareFrame=$(''),this.$shareView.append(this.$shareFrame),this.$embedView=$('
                '),this.$tabsContent.append(this.$embedView),this.$embedHeader=$('
                '),this.$embedView.append(this.$embedHeader),this.$code=$(''),this.$embedView.append(this.$code),this.$customSize=$('
                '),this.$embedView.append(this.$customSize),this.$size=$(''+this.content.size+""),this.$customSize.append(this.$size),this.$customSizeDropDown=$(''),this.$customSize.append(this.$customSizeDropDown),this.$customSizeDropDown.append(''),this.$customSizeDropDown.append(''),this.$customSizeDropDown.append(''),this.$customSizeDropDown.append('"),this.$widthInput=$(''),this.$customSize.append(this.$widthInput),this.$x=$('x'),this.$customSize.append(this.$x),this.$heightInput=$(''),this.$customSize.append(this.$heightInput);var n=this.extension.getIIIFShareUrl();this.$iiifButton=$(''),this.$footer.append(this.$iiifButton),this.$termsOfUseButton=$(''+this.extension.config.content.termsOfUse+""),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.currentHeightthis.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.currentWidththis.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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-mediaelement-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/FooterPanel",["require","exports","./BaseCommands","./BaseView","./MetricType"],function(e,t,i,n,o){var s=function(e){function t(t){e.call(this,t)}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.updateLogoButton(),t.updateMinimisedButtons(),t.updateMoreInfoButton()}),$.subscribe(i.SETTINGS_CHANGED,function(){t.updateDownloadButton()}),this.$options=$('
                '),this.$element.append(this.$options),this.$feedbackButton=$('"),this.$options.prepend(this.$feedbackButton),this.$openButton=$(''+this.content.open+""),this.$options.prepend(this.$openButton),this.$bookmarkButton=$(''+this.content.bookmark+""),this.$options.prepend(this.$bookmarkButton),this.$shareButton=$('"),this.$options.append(this.$shareButton),this.$embedButton=$(''+this.content.embed+""),this.$options.append(this.$embedButton),this.$downloadButton=$(''+this.content.download+""),this.$options.prepend(this.$downloadButton),this.$moreInfoButton=$(''+this.content.moreInfo+""),this.$options.prepend(this.$moreInfoButton),this.$logoButton=$('");var n=new Image;n.onload=function(){return t.imageReady(n)},n.src="themes/"+this.extension.config.options.theme+"/img/footer_logo.png",this.$options.append(this.$logoButton),this.$fullScreenBtn=$(''+this.content.fullScreen+""),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.updateLogoButton(),this.updateOpenButton(),this.updateFeedbackButton(),this.updateBookmarkButton(),this.updateEmbedButton(),this.updateDownloadButton(),this.updateFullScreenButton(),this.updateShareButton(),this.updateMinimisedButtons()},t.prototype.imageReady=function(e){this.$logoButton.css({width:e.width}),this.updateLogoButtonPosition()},t.prototype.updateMinimisedButtons=function(){return Utils.Bools.getBool(this.options.minimiseButtons,!1)?void this.$options.addClass("minimiseButtons"):void(this.extension.metric.toString()===o.MetricType.MOBILELANDSCAPE.toString()?this.$options.addClass("minimiseButtons"):this.$options.removeClass("minimiseButtons"))},t.prototype.updateLogoButton=function(){var e=Utils.Bools.getBool(this.options.logoEnabled,!1);e&&this.extension.metric.toString()!==o.MetricType.MOBILELANDSCAPE.toString()?this.$logoButton.show():this.$logoButton.hide()},t.prototype.updateLogoButtonPosition=function(){var e=this.$element.width()/2;this.$logoButton.css({left:e-this.$logoButton.outerWidth()/2,width:this.$logoImageWidth})},t.prototype.updateMoreInfoButton=function(){var e=Utils.Bools.getBool(this.options.moreInfoEnabled,!1);e&&this.extension.metric.toString()===o.MetricType.MOBILELANDSCAPE.toString()?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),this.updateLogoButtonPosition()},t}(n);return s}),define("modules/uv-shared-module/Information",["require","exports"],function(e,t){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){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){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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/HeaderPanel",["require","exports","./BaseCommands","./BaseView","../uv-shared-module/InformationFactory"],function(e,t,i,n,o){var s=function(e){function t(t){e.call(this,t,!1,!1)}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=$('
                '),this.$element.append(this.$options),this.$centerOptions=$('
                '),this.$options.append(this.$centerOptions),this.$rightOptions=$('
                '),this.$options.append(this.$rightOptions),this.$localeToggleButton=$(''),this.$rightOptions.append(this.$localeToggleButton),this.$settingsButton=$(''),this.$settingsButton.attr("title",this.content.settings),this.$rightOptions.append(this.$settingsButton),this.$informationBox=$('
                '),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'+r.label+"");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.$content.append(this.$title),this.$scroll=$('
                '),this.$content.append(this.$scroll),this.$message=$("

                "),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/CenterPanel",["require","exports","./Shell","./BaseView"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t,!1,!0)}return __extends(t,e),t.prototype.create=function(){var t=this;e.prototype.create.call(this),this.$title=$('
                '),this.$element.append(this.$title),this.$content=$('
                '),this.$element.append(this.$content),this.$attribution=$('
                '),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;if(i.$ocrRightPanel.width()>i.$rightPanel.width())var n=i.$ocrRightPanel.is(":visible")?Math.floor(i.$ocrRightPanel.width()):0;else var n=i.$rightPanel.is(":visible")?Math.floor(i.$rightPanel.width()):0;var 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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var s=function(e){function t(t){e.call(this,t)}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=$('
                '),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){a.push({type:e.getFormat().toString(),src:e.id})}),t.extension.isVideo())t.media=t.$container.append('"),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('"),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/BaseExpandPanel",["require","exports","./BaseView"],function(e,t,i){var n=function(e){function t(t){e.call(this,t,!1,!0),this.isExpanded=!1,this.isFullyExpanded=!1,this.isUnopened=!0,this.autoToggled=!1,this.expandFullEnabled=!0}return __extends(t,e),t.prototype.create=function(){var t=this;e.prototype.create.call(this),this.$top=$('
                '),this.$element.append(this.$top),this.$title=$('
                '),this.$title.prop("title",this.content.title),this.$top.append(this.$title),this.$expandFullButton=$(''),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=$('
                '),this.$collapseButton.prop("title",this.content.collapse),this.$top.append(this.$collapseButton),this.$closed=$('
                '),this.$element.append(this.$closed),this.$expandButton=$(''),this.$expandButton.prop("title",this.content.expand),this.$closed.append(this.$expandButton),this.$closedTitle=$(''),this.$closedTitle.prop("title",this.content.title),this.$closed.append(this.$closedTitle),this.$main=$('
                '),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/RightPanel",["require","exports","./BaseCommands","./BaseExpandPanel"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-moreinforightpanel-module/MoreInfoRightPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/RightPanel","../../modules/uv-shared-module/Shell"],function(e,t,i,n,o){var s=function(e){function t(t){e.call(this,t)}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=$(''),this.$main.append(this.$metadata),this.component=new IIIFComponents.MetadataComponent(this._getOptions())},t.prototype.toggleFinish=function(){e.prototype.toggleFinish.call(this),this.databind()},t.prototype.databind=function(){this.component.options=this._getOptions(),this.component.databind()},t.prototype._getOptions=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),element:".rightPanel .iiif-metadata-component",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.extension.isOcrRightPanelEnabled()?this.isExpanded?(this.$element.css({left:Math.floor(this.$element.parent().width()-this.$element.outerWidth())}),o.$ocrRightPanel.hide()):(this.$element.css({height:Math.floor(this.$element.height()/2),left:Math.floor(this.$element.parent().width()-this.$element.outerWidth())}),o.$ocrRightPanel.show()):this.$main.height(this.$element.height()-this.$top.height()-this.$main.verticalMargins())},t}(n);return s});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/LeftPanel",["require","exports","./BaseCommands","./BaseExpandPanel"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/ThumbsView",["require","exports","./BaseCommands","./BaseView"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t,!0,!0),this.isCreated=!1,this.isOpen=!1}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=$('
                '),this.$element.append(this.$thumbs),this.$thumbs.addClass(this.extension.helper.getViewingDirection().toString());var n=this;$.templates({thumbsTemplate:'
                {{:#index + 1}} {{>label}}  {{>data.searchResults}}
                {{if ~separator()}}
                {{/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;n1&&(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');$(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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-resourcesleftpanel-module/ThumbsView",["require","exports","../uv-shared-module/ThumbsView"],function(e,t,i){var n=function(e){function t(){e.apply(this,arguments)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-resourcesleftpanel-module/ResourcesLeftPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/LeftPanel","./ThumbsView"],function(e,t,i,n,o){var s=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){this.setConfig("resourcesLeftPanel"),e.prototype.create.call(this),this.setTitle(this.content.title),this.$tabsContent=$('
                '),this.$main.append(this.$tabsContent),this.$views=$('
                '),this.$tabsContent.append(this.$views),this.$thumbsView=$('
                '),this.$views.append(this.$thumbsView),this.$resourcesView=$('
                '),this.$resources=$("
                  "),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'+Manifesto.TranslationCollection.getValue(n.getLabel())+" ("+Utils.Files.simplifyMimeType(n.getFormat().toString())+")");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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var s=function(e){function t(t){e.call(this,t)}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=$("

                  "),this.$content.append(this.$title),this.$scroll=$('
                  '),this.$content.append(this.$scroll),this.$version=$('
                  '),this.$content.append(this.$version);var n=this.content.contributedBy,o='
                  '+this.options.contributedByOptions.contributor+"";n=String.format(n,o),this.$contributedBy=$('
                  '+n+"
                  "),this.$content.append(this.$contributedBy),this.$website=$('
                  '),this.$content.append(this.$website),this.$locale=$('
                  '),this.$scroll.append(this.$locale),this.$localeLabel=$('"),this.$locale.append(this.$localeLabel),this.$localeDropDown=$(''),this.$locale.append(this.$localeDropDown),this.$title.text(this.content.title);var s=String.format(this.content.website,this.options.moreInfo.website);this.$website.html(s),this.$website.targetBlank();for(var r=this.extension.getLocales(),a=0;a'+l.label+"")}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.updateContributedBy(),this.$element.hide()},t.prototype.getSettings=function(){return this.extension.getSettings()},t.prototype.updateContributedBy=function(){var e=Utils.Bools.getBool(this.options.contributedByEnabled,!1);e?this.$contributedBy.show():this.$contributedBy.hide()},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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-mediaelement-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var m=function(e){function t(t){e.call(this,t)}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=$('
                  '),f.$overlays.append(this.$helpDialogue),this.helpDialogue=new c(this.$helpDialogue),this.$downloadDialogue=$('
                  '),f.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new r(this.$downloadDialogue),this.$shareDialogue=$(''),f.$overlays.append(this.$shareDialogue),this.shareDialogue=new a(this.$shareDialogue),this.$settingsDialogue=$('
                  '),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-pdf-extension/DownloadDialogue",["require","exports","../../modules/uv-dialogues-module/DownloadDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-pdf-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-pdfcenterpanel-module/PDFCenterPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/CenterPanel","../../Params"],function(e,t,i,n,o){var s=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-pdf-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var g=function(e){function t(t){e.call(this,t)}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=$('
                  '),d.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new s(this.$downloadDialogue),this.$shareDialogue=$(''),d.$overlays.append(this.$shareDialogue),this.shareDialogue=new r(this.$shareDialogue),this.$settingsDialogue=$('
                  '),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){var i=function(){function e(){}return e.namespace="seadragonExtension.",e.CLEAR_SEARCH=e.namespace+"onClearSearch",e.CLEAR_SEARCH_PANEL=e.namespace+"onClearSearchPanel",e.CLEAR_OCR_PANEL=e.namespace+"onClearOcrPanel",e.CURRENT_VIEW_URI=e.namespace+"onCurrentViewUri",e.FIRST=e.namespace+"onFirst",e.GALLERY_DECREASE_SIZE=e.namespace+"onGalleryDecreaseSize",e.GALLERY_INCREASE_SIZE=e.namespace+"onGalleryIncreaseSize",e.GALLERY_THUMB_SELECTED=e.namespace+"onGalleryThumbSelected",e.HIDE_MULTISELECT_DIALOGUE=e.namespace+"onHideMultiSelectDialogue",e.IMAGE_SEARCH=e.namespace+"onImageSearch",e.LAST=e.namespace+"onLast",e.MODE_CHANGED=e.namespace+"onModeChanged",e.MULTISELECT_CHANGE=e.namespace+"onMultiSelectChange",e.MULTISELECTION_MADE=e.namespace+"onMultiSelectionMade",e.NEXT_SEARCH_RESULT=e.namespace+"onNextSearchResult",e.NEXT=e.namespace+"onNext",e.NEXT_IMAGES_SEARCH_RESULT_UNAVAILABLE=e.namespace+"onNextImagesSearchResultUnavailable",e.PREV_IMAGES_SEARCH_RESULT_UNAVAILABLE=e.namespace+"onPrevImagesSearchResultUnavailable",e.OPEN_THUMBS_VIEW=e.namespace+"onOpenThumbsView",e.OPEN_TREE_VIEW=e.namespace+"onOpenTreeView",e.PAGE_SEARCH=e.namespace+"onPageSearch",e.PAGING_TOGGLED=e.namespace+"onPagingToggled",e.PREV_SEARCH_RESULT=e.namespace+"onPrevSearchResult",e.PREV=e.namespace+"onPrev",e.PRINT=e.namespace+"onPrint",e.ROTATE=e.namespace+"onRotate",e.SEADRAGON_ANIMATION_FINISH=e.namespace+"onAnimationfinish",e.SEADRAGON_ANIMATION_START=e.namespace+"onAnimationStart",e.SEADRAGON_ANIMATION=e.namespace+"onAnimation",e.SEADRAGON_OPEN=e.namespace+"onOpen",e.SEADRAGON_RESIZE=e.namespace+"onResize",e.SEADRAGON_ROTATION=e.namespace+"onRotation",e.SEARCH_IN_CANVAS=e.namespace+"onSearchInCanvas",e.SEARCH_PREVIEW_FINISH=e.namespace+"onSearchPreviewFinish",e.SEARCH_PREVIEW_START=e.namespace+"onSearchPreviewStart",e.SEARCH_RESULT_CANVAS_CHANGED=e.namespace+"onSearchResultCanvasChanged",e.SEARCH_RESULT_RECT_CHANGED=e.namespace+"onSearchResultRectChanged",e.SEARCH_RESULTS_EMPTY=e.namespace+"onSearchResultsEmpty",e.SEARCH_RESULTS=e.namespace+"onSearchResults",e.SEARCH_RESULTS_CLEARED=e.namespace+"onSearchResultsCleared",e.SEARCH=e.namespace+"onSearch",e.SHOW_MULTISELECT_DIALOGUE=e.namespace+"onShowMultiSelectDialogue",e.THUMB_MULTISELECTED=e.namespace+"onThumbMultiSelected",e.TREE_NODE_MULTISELECTED=e.namespace+"onTreeNodeMultiSelected",e.TREE_NODE_SELECTED=e.namespace+"onTreeNodeSelected",e.VIEW_PAGE=e.namespace+"onViewPage",e.ZOOM_IN=e.namespace+"onZoomIn",e.ZOOM_OUT=e.namespace+"onZoomOut",e}();return i});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var s=function(e){function t(t){e.call(this,t,!0,!0),this.isOpen=!1}return __extends(t,e),t.prototype.create=function(){this.setConfig("contentLeftPanel"),e.prototype.create.call(this),this.$gallery=$(''),this.$element.append(this.$gallery)},t.prototype.setup=function(){this.component=new IIIFComponents.GalleryComponent(this.galleryOptions),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=this.galleryOptions,this.component.databind(),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.galleryOptions.element),i=t.find(".main"),n=t.find(".header");i.height(this.$element.height()-n.height())},t}(n);return s}),define("extensions/uv-seadragon-extension/Mode",["require","exports"],function(e,t){var i=function(){function e(e){this.value=e}return e.prototype.toString=function(){return this.value},e.image=new e("image"),e.page=new e("page"),e}();return i});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var s=function(e){function t(){e.apply(this,arguments)}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'),this.$element.append(this.$tree)},t.prototype.setup=function(){this.component=new IIIFComponents.TreeComponent(this.treeOptions),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=this.treeOptions,this.component.databind(),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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/MetricType","../../extensions/uv-seadragon-extension/Mode","./ThumbsView","./TreeView"],function(e,t,i,n,o,s,r,a,l,h){var c=function(e){function t(t){e.call(this,t),this.expandFullEnabled=!1,this.isThumbsViewOpen=!1,this.isTreeViewOpen=!1,this.treeSortType=Manifold.TreeSortType.NONE}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.toString()===r.MetricType.MOBILELANDSCAPE.toString()&&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=$('
                  '),this.$main.append(this.$tabs),this.$treeButton=$(''+this.content.index+""),this.$tabs.append(this.$treeButton),this.$thumbsButton=$(''+this.content.thumbnails+""),this.$thumbsButton.prop("title",this.content.thumbnails),this.$tabs.append(this.$thumbsButton),this.$tabsContent=$('
                  '),this.$main.append(this.$tabsContent),this.$options=$('
                  '),this.$tabsContent.append(this.$options),this.$topOptions=$('
                  '),this.$options.append(this.$topOptions),this.$treeSelect=$(""),this.$topOptions.append(this.$treeSelect),this.$bottomOptions=$('
                  '),this.$options.append(this.$bottomOptions),this.$leftOptions=$('
                  '),this.$bottomOptions.append(this.$leftOptions),this.$rightOptions=$('
                  '),this.$bottomOptions.append(this.$rightOptions),this.$treeViewOptions=$('
                  '),this.$leftOptions.append(this.$treeViewOptions),this.$sortByLabel=$(''+this.content.sortBy+""),this.$treeViewOptions.append(this.$sortByLabel),this.$sortButtonGroup=$('
                  '),this.$treeViewOptions.append(this.$sortButtonGroup),this.$sortByDateButton=$('"),this.$sortButtonGroup.append(this.$sortByDateButton),this.$sortByVolumeButton=$('"),this.$sortButtonGroup.append(this.$sortByVolumeButton),this.$views=$('
                  '),this.$tabsContent.append(this.$views),this.$treeView=$('
                  '),this.$views.append(this.$treeView),this.$thumbsView=$('
                  '),this.$views.append(this.$thumbsView),this.$galleryView=$('
                  '),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.treeOptions=this.getTreeOptions(),this.treeView.setup(),this.databindTreeView();var e=this.extension.helper.getTopRanges();if(e.length>1)for(var t=0;t'+Manifesto.TranslationCollection.getValue(i.getLabel())+"")}this.updateTreeViewOptions()},t.prototype.databind=function(){this.databindThumbsView(),this.databindTreeView(),this.databindGalleryView()},t.prototype.updateTreeViewOptions=function(){var e=this.getTreeData();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.treeOptions=this.getTreeOptions(),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.treeOptions=this.getTreeOptions(),this.treeView.databind(),this.selectCurrentTreeNode(),this.$sortByDateButton.removeClass("on"),this.$sortByVolumeButton.addClass("on"),this.resize()},t.prototype.isCollection=function(){var e=this.getTreeData();return e.data.type===manifesto.TreeNodeType.collection().toString()},t.prototype.databindTreeView=function(){this.treeView&&(this.treeView.treeOptions=this.getTreeOptions(),this.treeView.databind(),this.selectCurrentTreeNode())},t.prototype.getTreeOptions=function(){return{branchNodesSelectable:!1,element:".views .treeView .iiif-tree-component",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;st?!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){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){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){var i=function(){function e(){}return e.CURRENTVIEW="currentView",e.ENTIREDOCUMENTASPDF="entireDocumentAsPdf",e.ENTIREDOCUMENTASTEXT="entireDocumentAsText",e.WHOLEIMAGEHIGHRES="wholeImageHighRes",e.WHOLEIMAGESHIGHRES="wholeImageHighRes",e.WHOLEIMAGELOWRES="wholeImageLowRes",e.UNKNOWN="unknown",e}();return i});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var a=Utils.Measurements.Size,l=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("downloadDialogue"),e.prototype.create.call(this),this.$imageOptionsContainer=$('
                • '),this.$downloadOptions.append(this.$imageOptionsContainer),this.$imageOptions=$("
                    "),this.$imageOptionsContainer.append(this.$imageOptions),this.$currentViewAsJpgButton=$('
                  • '),this.$imageOptions.append(this.$currentViewAsJpgButton),this.$currentViewAsJpgButton.hide(),this.$wholeImageHighResButton=$('
                  • '),this.$imageOptions.append(this.$wholeImageHighResButton),this.$wholeImageHighResButton.hide(),this.$wholeImagesHighResButton=$('
                  • '),this.$imageOptions.append(this.$wholeImagesHighResButton),this.$wholeImageHighResButton.hide(),this.$wholeImageLowResAsJpgButton=$('
                  • "),this.$imageOptions.append(this.$wholeImageLowResAsJpgButton),this.$wholeImageLowResAsJpgButton.hide(),this.$canvasOptionsContainer=$('
                  • '),this.$downloadOptions.append(this.$canvasOptionsContainer),this.$canvasOptions=$("
                      "),this.$canvasOptionsContainer.append(this.$canvasOptions),this.$sequenceOptionsContainer=$('
                    • '),this.$downloadOptions.append(this.$sequenceOptionsContainer),this.$sequenceOptions=$("
                        "),this.$sequenceOptionsContainer.append(this.$sequenceOptions),this.$selectionButton=$('
                      • '),this.$sequenceOptions.append(this.$selectionButton),this.$selectionButton.hide(),this.$buttonsContainer=$('
                        '),this.$content.append(this.$buttonsContainer),this.$downloadButton=$(''+this.content.download+""),this.$buttonsContainer.append(this.$downloadButton),this.$explanatoryTextTemplate=$('');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=S&&w>=S?this.$currentViewAsJpgButton.hide():this.$currentViewAsJpgButton.show()}var _=this.$imageOptions.find("li.single");_=_.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}),_.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");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.width1?!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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/ExternalContentDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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=$(""),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){var i=function(){function e(e,t,i,n,o,s,r){var a=this;void 0===o&&(o=300),void 0===s&&(s=2),void 0===r&&(r=!1),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=$('
                          '),this._positionAbove?this._$element.parent().prepend(this._$searchResultsList):this._$element.parent().append(this._$searchResultsList),this._$searchResultTemplate=$('
                        • ');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('
                        • '),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.content.print+""),this.$options.prepend(this.$printButton),this.$searchContainer=$(''),this.$element.prepend(this.$searchContainer),this.$searchOptions=$('
                          '),this.$searchContainer.append(this.$searchOptions),this.$searchLabel=$(''+this.content.searchWithin+""),this.$searchOptions.append(this.$searchLabel),this.$searchTextContainer=$('
                          '),this.$searchOptions.append(this.$searchTextContainer),this.$searchText=$(''),this.$searchTextContainer.append(this.$searchText),this.$searchButton=$(''),this.$searchTextContainer.append(this.$searchButton),this.$searchPagerContainer=$('
                          '),this.$element.prepend(this.$searchPagerContainer),this.$searchPagerControls=$('
                          '),this.$searchPagerContainer.prepend(this.$searchPagerControls),this.$previousResultButton=$(''+this.content.previousResult+""),this.$searchPagerControls.append(this.$previousResultButton),this.$searchResultsInfo=$('
                          x \'y\'
                          '),this.$searchPagerControls.append(this.$searchResultsInfo),this.$clearSearchResultsButton=$(''+this.content.clearSearch+""),this.$searchResultsInfo.append(this.$clearSearchResultsButton),this.$nextResultButton=$(''+this.content.nextResult+""),this.$searchPagerControls.append(this.$nextResultButton),this.$searchResultsContainer=$('
                          '),this.$element.prepend(this.$searchResultsContainer),this.$line=$('
                          '),this.$searchResultsContainer.append(this.$line),this.$pagePositionMarker=$('
                          '),this.$searchResultsContainer.append(this.$pagePositionMarker),this.$pagePositionLabel=$('
                          '),this.$searchResultsContainer.append(this.$pagePositionLabel),this.$placemarkerDetails=$('
                          '),this.$searchResultsContainer.append(this.$placemarkerDetails),this.$placemarkerDetailsTop=$("

                          "),this.$placemarkerDetails.append(this.$placemarkerDetailsTop),this.$placemarkerDetailsBottom=$("

                          "),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(),$.publish(s.CLEAR_OCR_PANEL),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');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;me.$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.clearSearchPanel=function(){var e=this.getSearchResultPlacemarkers();e.remove(),this.$searchText.val(this.content.enterKeyword),this.$searchContainer.show(),this.$searchPagerContainer.hide()},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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-osdmobilefooterpanel-module/MobileFooter",["require","exports","../uv-shared-module/FooterPanel","../../extensions/uv-seadragon-extension/Commands"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){this.setConfig("mobileFooterPanel"),e.prototype.create.call(this),this.$spacer=$('
                          '),this.$options.prepend(this.$spacer),this.$rotateButton=$(''+this.content.rotateRight+""),this.$options.prepend(this.$rotateButton),this.$zoomOutButton=$(''+this.content.zoomOut+""),this.$options.prepend(this.$zoomOutButton),this.$zoomInButton=$(''+this.content.zoomIn+""),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/MoreInfoDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}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=$("

                          "+this.config.content.title+"

                          "),this.$content.append(this.$title),this.$metadata=$(''),this.$content.append(this.$metadata),this.component=new IIIFComponents.MetadataComponent(this._getOptions()),this.$element.hide()},t.prototype.open=function(t){e.prototype.open.call(this,t),this.component.databind()},t.prototype._getOptions=function(){var e=this;return{canvasDisplayOrder:this.config.options.canvasDisplayOrder,canvases:this.extension.getCurrentCanvases(),canvasExclude:this.config.options.canvasExclude,canvasLabels:"Left Page, Right Page",content:this.config.content,copiedMessageDuration:2e3,copyToClipboardEnabled:Utils.Bools.getBool(this.config.options.copyToClipboardEnabled,!1),element:".overlay.moreInfo .iiif-metadata-component",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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var s=function(e){function t(t){e.call(this,t)}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.databind()}),$.subscribe(this.closeCommand,function(e){t.close();var i=t.extension.helper.getMultiSelectState();i.setEnabled(!1)}),this.$title=$("

                          "),this.$content.append(this.$title),this.$title.text(this.content.title),this.$gallery=$(''),this.$content.append(this.$gallery),this.options={element:".overlay.multiSelect .iiif-gallery-component",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(this.options);var o=$(this.options.element).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.options.element),i=t.find(".main"),n=t.find(".header");i.height(this.$content.height()-this.$title.outerHeight()-this.$title.verticalMargins()-n.height())},t}(n);return s}),define("extensions/uv-seadragon-extension/MultiSelectionArgs",["require","exports"],function(e,t){var i=function(){function e(){}return e}();return i});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-ocrrightpanel-module/OcrRightPanel",["require","exports","../uv-shared-module/BaseCommands","../../extensions/uv-seadragon-extension/Commands","../uv-shared-module/RightPanel","../uv-shared-module/Shell"],function(e,t,i,n,o,s){var r=function(e){function t(t){e.call(this,t),this.isTextSelected=!1,this.defaultPreserveViewport=!1}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("ocrRightPanel"),e.prototype.create.call(this);var o=this.extension.getSettings();this.$clear=$('
                          '+this.extension.config.modules.searchFooterPanel.content.clearSearch+"
                          "),this.$clear.prop("title",this.content.clearSelection),this.$top.append(this.$clear),this.$clear.onPressed(function(){t.clearSelection()}),$.subscribe(i.CANVAS_INDEX_CHANGED,function(e,i){_.isNull(t.lastCanvasIndex)||t.lastCanvasIndex===i||t.getOCR(parseInt(i))}),$.subscribe(n.CLEAR_OCR_PANEL,function(e,i){t.clearSelection()}),$.subscribe(i.CLOSE_RIGHT_PANEL,function(e,i){t.clearSelection(),o.preserveViewport=t.defaultPreserveViewport}),$.subscribe(i.OPEN_RIGHT_PANEL,function(e,i){t.defaultPreserveViewport=o.preserveViewport,o.preserveViewport=!0}),this.setTitle(this.content.title)},t.prototype.clearSelection=function(){this.isTextSelected&&$.publish(n.CLEAR_SEARCH),$("div span.wordHighlight").each(function(){$(this).css({"background-color":""})}),this.isTextSelected=!1},t.prototype.getOCR=function(e){function t(e){var t,n="",o="",s="",r=e.first.id.split("#");"rtl"==r[1]&&(s='style="direction:rtl"');for(var a=0,l=e.first.items;a"),n+=''+h.body.value+" ",o=t.lineId}return'
                          "+n+"
                          "}function i(e){for(var t=0;t0&&(o=e.getRangeAt(0));var r=o.cloneContents(),l=r.childNodes.length;if(l>1)for(var h=0;l>h;h++)"wordHighlight"==r.childNodes[h].className&&""!=r.childNodes[h].innerText&&_.includes(t,r.childNodes[h].innerText)&&i.push(r.childNodes[h]);else null!=o.startContainer.parentNode.className&&"wordHighlight"==o.startContainer.parentNode.className&&i.push(o.startContainer.parentNode);s.clearSelection(),i.length>0?(s.isTextSelected=!0,$.publish(n.SEARCH_IN_CANVAS,[{terms:i,canvasId:a}])):(s.isTextSelected=!1,s.extension.showMessage(s.extension.config.modules.genericDialogue.content.wrongSelection)),e.removeAllRanges();for(var h=0;h'),this.$centerOptions.append(this.$prevOptions),this.$firstButton=$(''),this.$prevOptions.append(this.$firstButton),this.$prevButton=$(''),this.$prevOptions.append(this.$prevButton),this.$modeOptions=$('
                          '),this.$centerOptions.append(this.$modeOptions),this.$imageModeLabel=$('"),this.$modeOptions.append(this.$imageModeLabel),this.$imageModeOption=$(''),this.$modeOptions.append(this.$imageModeOption),this.$pageModeLabel=$(''),this.$modeOptions.append(this.$pageModeLabel),this.$pageModeOption=$(''),this.$modeOptions.append(this.$pageModeOption),this.$search=$(''),this.$centerOptions.append(this.$search),this.$searchText=$(''),this.$search.append(this.$searchText),Utils.Bools.getBool(this.options.autoCompleteBoxEnabled,!0))this.$searchText.hide(),this.$autoCompleteBox=$(''),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'),this.$centerOptions.append(this.$selectionBoxOptions),this.$imageSelectionBox=$(''),this.$selectionBoxOptions.append(this.$imageSelectionBox);for(var s=0;s"+l+"")}this.$imageSelectionBox.change(function(){var e=parseInt(t.$imageSelectionBox.val());$.publish(o.IMAGE_SEARCH,[e])})}this.$total=$(''),this.$search.append(this.$total),this.$searchButton=$(''+this.content.go+""),this.$search.append(this.$searchButton),this.$nextOptions=$('
                          '),this.$centerOptions.append(this.$nextOptions),this.$nextButton=$(''),this.$nextOptions.append(this.$nextButton),this.$lastButton=$(''),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=$(''),this.$rightOptions.prepend(this.$galleryButton),this.$pagingToggleButtons=$('
                          '),this.$rightOptions.prepend(this.$pagingToggleButtons),this.$oneUpButton=$(''),this.$pagingToggleButtons.append(this.$oneUpButton),this.$twoUpButton=$(''),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.$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.toString()===r.MetricType.MOBILELANDSCAPE.toString()?(this.viewer.autoHideControls=!1,this.$viewportNavButtons.hide()):(this.viewer.autoHideControls=!0,this.$viewportNavButtons.show())},t.prototype.createUI=function(){var e=this;this.$spinner=$('
                          '),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=$(''),this.$prevButton.prop("title",this.content.previous),this.$nextButton=$(''),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;i1)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;a0;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;a0;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;tthis.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.canvasIndexthis.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;s0?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.toString()!==r.MetricType.MOBILELANDSCAPE.toString();this.viewer.navigator.setVisible(e),e?this.$navigator.show():this.$navigator.hide()},t}(o);return l});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-seadragon-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("settingsDialogue"),e.prototype.create.call(this),this.$navigatorEnabled=$(''),this.$scroll.append(this.$navigatorEnabled),this.$navigatorEnabledCheckbox=$(''),this.$navigatorEnabled.append(this.$navigatorEnabledCheckbox),this.$navigatorEnabledLabel=$('"),this.$navigatorEnabled.append(this.$navigatorEnabledLabel),this.$pagingEnabled=$('
                          '),this.$scroll.append(this.$pagingEnabled),this.$pagingEnabledCheckbox=$(''),this.$pagingEnabled.append(this.$pagingEnabledCheckbox),this.$pagingEnabledLabel=$('"),this.$pagingEnabled.append(this.$pagingEnabledLabel),this.$clickToZoomEnabled=$('
                          '),this.$scroll.append(this.$clickToZoomEnabled),this.$clickToZoomEnabledCheckbox=$(''),this.$clickToZoomEnabled.append(this.$clickToZoomEnabledCheckbox),this.$clickToZoomEnabledLabel=$('"),this.$clickToZoomEnabled.append(this.$clickToZoomEnabledLabel),this.$preserveViewport=$('
                          '),this.$scroll.append(this.$preserveViewport),this.$preserveViewportCheckbox=$(''),this.$preserveViewport.append(this.$preserveViewportCheckbox),this.$preserveViewportLabel=$('"),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-seadragon-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue","./Commands"],function(e,t,i,n){var o=function(e){function t(t){var i=this;e.call(this,t),$.subscribe(n.SEADRAGON_OPEN,function(){i.update()}),$.subscribe(n.SEADRAGON_ANIMATION_FINISH,function(){i.update()})}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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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/MetricType","../../modules/uv-osdmobilefooterpanel-module/MobileFooter","./Mode","../../modules/uv-dialogues-module/MoreInfoDialogue","../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel","../../modules/uv-multiselectdialogue-module/MultiSelectDialogue","./MultiSelectionArgs","../../modules/uv-ocrrightpanel-module/OcrRightPanel","../../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,x,y,w,S,C,R,I){var T=Manifold.SearchResult,O=Utils.Measurements.Size,D=function(e){function t(t){e.call(this,t),this.currentRotation=0,this.isSearching=!1,this.searchResults=[]}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.toString()===p.MetricType.MOBILELANDSCAPE.toString()){var e={};e.pagingEnabled=!1,n.updateSettings(e),$.publish(i.UPDATE_SETTINGS),I.$rightPanel.hide()}else I.$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.toString()!==p.MetricType.MOBILELANDSCAPE.toString()&&I.$rightPanel.show()}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_FINISH,function(e){I.$centerPanel.show(),n.resize()}),$.subscribe(i.LEFTPANEL_EXPAND_FULL_START,function(e){I.$centerPanel.hide(),I.$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_IN_CANVAS,function(e,t){n.triggerSocket(s.SEARCH_IN_CANVAS,t),n.searchWithinCanvas(t.terms)}),$.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 x(I.$headerPanel):I.$headerPanel.hide(),this.isLeftPanelEnabled()?this.leftPanel=new r(I.$leftPanel):I.$leftPanel.hide(),this.centerPanel=new S(I.$centerPanel),this.isOcrRightPanelEnabled()?this.ocrRightPanel=new E(I.$ocrRightPanel):I.$ocrRightPanel.hide(),this.isRightPanelEnabled()?this.rightPanel=new m(I.$rightPanel):I.$rightPanel.hide(),this.isFooterPanelEnabled()?(this.footerPanel=new c(I.$footerPanel),this.mobileFooterPanel=new d(I.$mobileFooterPanel)):I.$footerPanel.hide(),this.$helpDialogue=$('
                          '),I.$overlays.append(this.$helpDialogue),this.helpDialogue=new u(this.$helpDialogue),this.$moreInfoDialogue=$('
                          '),I.$overlays.append(this.$moreInfoDialogue),this.moreInfoDialogue=new f(this.$moreInfoDialogue),this.$multiSelectDialogue=$('
                          '),I.$overlays.append(this.$multiSelectDialogue),this.multiSelectDialogue=new v(this.$multiSelectDialogue),this.$shareDialogue=$(''),I.$overlays.append(this.$shareDialogue),this.shareDialogue=new R(this.$shareDialogue),this.$downloadDialogue=$('
                          '),I.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new l(this.$downloadDialogue),this.$settingsDialogue=$('
                          '),I.$overlays.append(this.$settingsDialogue),this.settingsDialogue=new C(this.$settingsDialogue),this.$externalContentDialogue=$('
                          '),I.$overlays.append(this.$externalContentDialogue),this.externalContentDialogue=new h(this.$externalContentDialogue),this.isHeaderPanelEnabled()&&this.headerPanel.init(),this.isLeftPanelEnabled()&&this.leftPanel.init(),this.isOcrRightPanelEnabled()&&this.ocrRightPanel.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.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 O(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 O(h,c),n.regionPos=new w(r,l),n.size=new O(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 O(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;rthis.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.getOcrService=function(){for(var e=this.helper.manifest.getServices(),t=!1,i=0;i'),this.$content.prepend(this.$navigation),this.$zoomInButton=$(''),this.$navigation.append(this.$zoomInButton),this.$zoomOutButton=$(''),this.$navigation.append(this.$zoomOutButton),this.$viewport=$('
                          '),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(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};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){var g=function(e){function t(t){e.call(this,t)}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=$('
                          '),p.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new r(this.$downloadDialogue),this.$shareDialogue=$(''),p.$overlays.append(this.$shareDialogue),this.shareDialogue=new a(this.$shareDialogue),this.$settingsDialogue=$('
                          '),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(){}); \ No newline at end of file diff --git a/dist/uv-2.0.1/lib/uv-seadragon-extension.cy-GB.config.json b/dist/uv-2.0.1/lib/uv-seadragon-extension.cy-GB.config.json index aef3a6770..cb5ec557e 100644 --- a/dist/uv-2.0.1/lib/uv-seadragon-extension.cy-GB.config.json +++ b/dist/uv-2.0.1/lib/uv-seadragon-extension.cy-GB.config.json @@ -1 +1 @@ -{"options":{"allowStealFocus":false,"bookmarkThumbHeight":150,"bookmarkThumbWidth":90,"dropEnabled":true,"footerPanelEnabled":true,"headerPanelEnabled":true,"leftPanelEnabled":true,"limitLocales":false,"metrics":[{"type":"mobilelandscape","minWidth":0,"maxWidth":640},{"type":"laptop","minWidth":640,"maxWidth":100000}],"multiSelectionMimeType":"application/zip","navigatorEnabled":true,"openTemplate":"http://universalviewer.io?manifest={0}","overrideFullScreen":false,"pagingEnabled":true,"pagingOptionEnabled":true,"pessimisticAccessControl":false,"preserveViewport":false,"rightPanelEnabled":true,"saveUserSettings":false,"clickToZoomEnabled":true,"searchWithinEnabled":true,"termsOfUseEnabled":false,"theme":"uv-cy-GB-theme","tokenStorage":"session","useArrowKeysToNavigate":false,"zoomToSearchResultEnabled":true},"modules":{"contentLeftPanel":{"options":{"defaultToTreeEnabled":false,"defaultToTreeIfGreaterThan":0,"elideCount":40,"expandFullEnabled":true,"galleryThumbChunkedResizingThreshold":400,"galleryThumbHeight":320,"galleryThumbLoadPadding":3,"galleryThumbWidth":200,"oneColThumbHeight":320,"oneColThumbWidth":200,"pageModeEnabled":true,"panelAnimationDuration":250,"panelCollapsedWidth":30,"panelExpandedWidth":255,"panelOpen":true,"tabOrder":"","thumbsEnabled":true,"thumbsExtraHeight":8,"thumbsImageFadeInDuration":300,"thumbsLoadRange":15,"treeEnabled":true,"twoColThumbHeight":150,"twoColThumbWidth":90},"content":{"collapse":"Lleihau'r Cynnwys","collapseFull":"Lleihau'r Galeri","date":"Dyddiad","expand":"Ehangu'r Cynnwys","expandFull":"Ehangu'r Galeri","index":"Mynegai","searchResult":"{0} canlyniad chwilio","searchResults":"{0} canlyniad chwilio","sortBy":"Trefnu yn ôl:","thumbnails":"Bodluniau","title":"Cynnwys","volume":"cyfrol"}},"dialogue":{"content":{"close":"Cau"}},"downloadDialogue":{"options":{"confinedImageSize":1000,"currentViewDisabledPercentage":90,"maxImageWidth":5000,"optionsExplanatoryTextEnabled":false,"selectionEnabled":false},"content":{"currentViewAsJpg":"Delwedd ddethol {0} x {1}px (jpg)","currentViewAsJpgExplanation":"Agor mewn dwy ffenest newydd.","download":"Lawrlwytho","downloadSelection":"Lawrlwytho'r detholiad","downloadSelectionExplanation":"Agor ffenest er mwyn dewis tudalennau i'w lawrlwytho.","editSettings":"Golygu'r dewisiadau","entireDocument":"Y Ddogfen Gyfan ({0})","entireFileAsOriginal":"Y ffeil gyfan ({0})","noneAvailable":"Nid oes unrhyw opsiynau lawrlwytho ar gael.","pagingNote":"Dad-ddewiswch 'Arddangos Dwy Dudalen' i weld dewisiadau pellach.","preview":"Rhagolwg","title":"Lawrlwytho","wholeImageHighRes":"Delwedd gyfan {0} x {1}px ({2})","wholeImageHighResExplanation":"Agor mewn ffenest newydd","wholeImagesHighRes":"Delweddau cyfan ({0})","wholeImagesHighResExplanation":"Agor mewn dwy ffenest newydd.","wholeImageLowResAsJpg":"Delwedd gyfan {0} x {1}px (jpg)","wholeImageLowResAsJpgExplanation":"Agor mewn ffenest newydd"}},"footerPanel":{"options":{"bookmarkEnabled":false,"downloadEnabled":true,"embedEnabled":false,"feedbackEnabled":false,"fullscreenEnabled":true,"minimiseButtons":true,"moreInfoEnabled":true,"openEnabled":false,"printEnabled":false,"shareEnabled":true},"content":{"bookmark":"Ychwanegu at nodau tudalen","download":"Lawrlwytho","embed":"Ymgorffori","feedback":"Adborth","exitFullScreen":"Dianc o'r sgrin lawn","fullScreen":"Sgrin lawn","open":"Agor","share":"Rhannu"}},"genericDialogue":{"content":{"emptyValue":"rhowch rif","invalidNumber":"Rhowch rif dilys","noMatches":"Dim canlyniad sy'n cyfateb.","ok":"GWELD","pageNotFound":"Nid yw'r eitem yn cynnwys tudalen gyda'r rhif a nodwyd. Ceisiwch cyfnewid y math i 'delwedd'.","refresh":"Ailosod"}},"headerPanel":{"options":{"localeToggleEnabled":false,"settingsButtonEnabled":true}},"helpDialogue":{"content":{"text":"testun i'w osod","title":"Cymorth"}},"moreInfoRightPanel":{"options":{"canvasDisplayOrder":"","canvasExclude":"","copyToClipboardEnabled":false,"manifestDisplayOrder":"","manifestExclude":"","panelAnimationDuration":250,"panelCollapsedWidth":30,"panelExpandedWidth":255,"panelOpen":false,"rtlLanguageCodes":"ar, ara, dv, div, he, heb, ur, urd","showAllLanguages":false,"textLimit":4,"textLimitType":"lines"},"content":{"attribution":"Priodoledd","collapse":"Lleihau'r Wybodaeth","collapseFull":"Cuddio'r Galeri","description":"Disgrifiad","expand":"Ehangu'r Wybodaeth","expandFull":"Ehangu'r Galeri","holdingText":"Eich modiwl fan hyn!","less":"llai","license":"Trwydded","logo":"Logo","more":"mwy","noData":"Nid oes data i'w arddangos","page":"Tudalen","title":"Mwy o Wybodaeth","manifestHeader":"Am yr eitem","canvasHeader":"Am y ddelwedd","copyToClipboard":"Copïo i'r clipfwrdd","copiedToClipboard":"Copïwyd i'r clipfwrdd"}},"multiSelectDialogue":{"options":{"galleryThumbChunkedResizingEnabled":true,"galleryThumbChunkedResizingThreshold":400,"galleryThumbHeight":320,"galleryThumbLoadPadding":3,"galleryThumbWidth":200,"pageModeEnabled":true},"content":{"select":"Lawrlwytho","selectAll":"Dewis y cyfan","title":"Dewis Tudalennau i'w Lawrlwytho"}},"pagingHeaderPanel":{"options":{"autoCompleteBoxEnabled":true,"galleryButtonEnabled":true,"imageSelectionBoxEnabled":false,"pageModeEnabled":false,"pagingToggleEnabled":true},"content":{"close":"Cau","emptyValue":"Mewnosodwch werth","first":"gyntaf","firstImage":"Delwedd Gyntaf","firstPage":"Tudalen gyntaf","folio":"Ffolio","gallery":"Galeri","go":"GWELD","help":"Cymorth","image":"Delwedd","last":"Olaf","lastImage":"Delwedd Olaf","lastPage":"Tudalen Olaf","next":"Nesaf","nextImage":"Delwedd Nesaf","nextPage":"Tudalen Nesaf","of":"o {0}","oneUp":"Gweld un dudalen ar y tro","page":"Tudalen","previous":"Blaenorol","previousImage":"Delwedd Flaenorol","previousPage":"Tudalen Flaenorol","settings":"Dewisiadau","twoUp":"Gweld dwy dudalen ar y tro"}},"seadragonCenterPanel":{"options":{"animationTime":0.15,"autoHideControls":true,"attributionEnabled":true,"blendTime":0,"constrainDuringPan":false,"controlsFadeAfterInactive":1500,"controlsFadeDelay":250,"controlsFadeLength":250,"defaultZoomLevel":0,"immediateRender":false,"maxZoomPixelRatio":1.25,"navigatorPosition":"BOTTOM_RIGHT","pageGap":50,"showHomeControl":false,"trimAttributionCount":150,"visibilityRatio":0.5},"content":{"attribution":"Priodoliad","goHome":"Gweld y maint gwreiddiol","imageUnavailable":"Nid oes delwedd ar gael","next":"nesaf","previous":"blaenorol","rotateRight":"Cylchdroi i'r dde","zoomIn":"Closio","zoomOut":"Gwrthglosio"}},"searchFooterPanel":{"options":{"elideDetailsTermsCount":20,"elideResultsTermsCount":5,"pageModeEnabled":true,"positionMarkerEnabled":true},"content":{"clearSearch":"Gwaredu","defaultLabel":"-","displaying":"{0} {1} o {2}","enterKeyword":"Mewnosodwch allweddair","image":"delwedd","imageCaps":"delwedd","instanceFound":"Dangos 1 canlyniad ar gyfer '{0}' ","instancesFound":"Dangos {0} canlyniad o '{1}' ","nextResult":"Canlyniad nesaf","page":"tudalen","pageCaps":"tudalen","previousResult":"Canlyniad blaenorol","print":"Argraffu","resultFoundFor":"canlyniad a geir ar gyfer","resultsFoundFor":"canlyniad ar gyfer","searchWithin":"Chwilio tu fewn i:"}},"settingsDialogue":{"content":{"locale":"Iaith","navigatorEnabled":"Ffenest llywio ar gael","clickToZoomEnabled":"Cliciwch gyda'r llygoden i glosio","pagingEnabled":"Arddangos dwy dudalen","preserveViewport":"Cadw'r lefel o glosio","title":"Dewisiadau","website":"mwy o wybodaeth"}},"shareDialogue":{"options":{"embedTemplate":"
                          \n","instructionsEnabled":false,"shareFrameEnabled":true},"content":{"customSize":"dewisol","embed":"Ymgorffori","embedInstructions":"Er mwyn ymgorffori'r eitem hon ar eich gwefan, copïwch a gosodwch y cod isod.","height":"Hyd","iiif":"Maniffest IIIF","share":"Rhannu","shareInstructions":"Er mwyn rhannu'r eitem hon, copïwch y URL isod.","size":"Maint:","width":"Lled"}},"clickThroughDialogue":{"content":{"viewTerms":"Darllenwch y Telerau a'r Amodau Llawn"}},"loginDialogue":{"content":{"login":"Mewngofnodi","logout":"Allgofnodi","cancel":"Canslo"}},"mobileFooterPanel":{"content":{"rotateRight":"Cylchdroi i'r dde","moreInfo":"Mwy o Wybodaeth","zoomIn":"Closio","zoomOut":"Gwrthglosio"}},"restrictedDialogue":{"content":{"cancel":"Canslo"}}},"localisation":{"label":"Cymraeg","locales":[{"name":"cy-GB","label":"Cymraeg"},{"name":"en-GB","label":"English (GB)"}]},"content":{"authCORSError":"Mae angen diweddaru'ch porwr er mwyn galluogi rhannu adnoddau traws-safle.","authorisationFailedMessage":"Ni lwyddoch i fewngofnodi. Rhowch gynnig arni eto.","canvasIndexOutOfRange":"Canfas yn rhy fawr i'w arddangos (ceisiwch eto)","degradedResourceMessage":"Mewngofnodwch i weld ansawdd uchel.","degradedResourceLogin":"Mewngofnodi","forbiddenResourceMessage":"Nid yw'ch hawliau mynediad presennol yn ddigonol i weld y ddelwedd hon","termsOfUse":"Telerau Defnydd"}} \ No newline at end of file +{"options":{"allowStealFocus":false,"bookmarkThumbHeight":150,"bookmarkThumbWidth":90,"dropEnabled":true,"footerPanelEnabled":true,"headerPanelEnabled":true,"leftPanelEnabled":true,"limitLocales":false,"metrics":[{"type":"mobilelandscape","minWidth":0,"maxWidth":640},{"type":"laptop","minWidth":640,"maxWidth":100000}],"multiSelectionMimeType":"application/zip","navigatorEnabled":true,"openTemplate":"http://universalviewer.io?manifest={0}","overrideFullScreen":false,"pagingEnabled":true,"pagingOptionEnabled":true,"pessimisticAccessControl":false,"preserveViewport":false,"rightPanelEnabled":true,"ocrRightPanelEnabled":true,"saveUserSettings":false,"clickToZoomEnabled":true,"searchWithinEnabled":true,"termsOfUseEnabled":false,"theme":"uv-cy-GB-theme","tokenStorage":"session","useArrowKeysToNavigate":false,"zoomToSearchResultEnabled":true},"modules":{"contentLeftPanel":{"options":{"defaultToTreeEnabled":false,"defaultToTreeIfGreaterThan":0,"elideCount":40,"expandFullEnabled":true,"galleryThumbChunkedResizingThreshold":400,"galleryThumbHeight":320,"galleryThumbLoadPadding":3,"galleryThumbWidth":200,"oneColThumbHeight":320,"oneColThumbWidth":200,"pageModeEnabled":true,"panelAnimationDuration":250,"panelCollapsedWidth":30,"panelExpandedWidth":255,"panelOpen":true,"tabOrder":"","thumbsEnabled":true,"thumbsExtraHeight":8,"thumbsImageFadeInDuration":300,"thumbsLoadRange":15,"treeEnabled":true,"twoColThumbHeight":150,"twoColThumbWidth":90},"content":{"collapse":"Lleihau'r Cynnwys","collapseFull":"Lleihau'r Galeri","date":"Dyddiad","expand":"Ehangu'r Cynnwys","expandFull":"Ehangu'r Galeri","index":"Mynegai","searchResult":"{0} canlyniad chwilio","searchResults":"{0} canlyniad chwilio","sortBy":"Trefnu yn ôl:","thumbnails":"Bodluniau","title":"Cynnwys","volume":"cyfrol"}},"dialogue":{"content":{"close":"Cau"}},"downloadDialogue":{"options":{"confinedImageSize":1000,"currentViewDisabledPercentage":90,"maxImageWidth":5000,"optionsExplanatoryTextEnabled":false,"selectionEnabled":false},"content":{"currentViewAsJpg":"Delwedd ddethol {0} x {1}px (jpg)","currentViewAsJpgExplanation":"Agor mewn dwy ffenest newydd.","download":"Lawrlwytho","downloadSelection":"Lawrlwytho'r detholiad","downloadSelectionExplanation":"Agor ffenest er mwyn dewis tudalennau i'w lawrlwytho.","editSettings":"Golygu'r dewisiadau","entireDocument":"Y Ddogfen Gyfan ({0})","entireFileAsOriginal":"Y ffeil gyfan ({0})","noneAvailable":"Nid oes unrhyw opsiynau lawrlwytho ar gael.","pagingNote":"Dad-ddewiswch 'Arddangos Dwy Dudalen' i weld dewisiadau pellach.","preview":"Rhagolwg","title":"Lawrlwytho","wholeImageHighRes":"Delwedd gyfan {0} x {1}px ({2})","wholeImageHighResExplanation":"Agor mewn ffenest newydd","wholeImagesHighRes":"Delweddau cyfan ({0})","wholeImagesHighResExplanation":"Agor mewn dwy ffenest newydd.","wholeImageLowResAsJpg":"Delwedd gyfan {0} x {1}px (jpg)","wholeImageLowResAsJpgExplanation":"Agor mewn ffenest newydd"}},"footerPanel":{"options":{"bookmarkEnabled":false,"downloadEnabled":true,"embedEnabled":false,"feedbackEnabled":false,"fullscreenEnabled":true,"logoEnabled":true,"logoOptions":{"website":"http://www.4science.it"},"minimiseButtons":true,"moreInfoEnabled":true,"openEnabled":false,"printEnabled":false,"shareEnabled":true},"content":{"bookmark":"Ychwanegu at nodau tudalen","download":"Lawrlwytho","embed":"Ymgorffori","feedback":"Adborth","exitFullScreen":"Dianc o'r sgrin lawn","fullScreen":"Sgrin lawn","logo":"Logo","open":"Agor","share":"Rhannu"}},"genericDialogue":{"content":{"emptyValue":"rhowch rif","invalidNumber":"Rhowch rif dilys","noMatches":"Dim canlyniad sy'n cyfateb.","ok":"GWELD","pageNotFound":"Nid yw'r eitem yn cynnwys tudalen gyda'r rhif a nodwyd. Ceisiwch cyfnewid y math i 'delwedd'.","refresh":"Ailosod"}},"headerPanel":{"options":{"localeToggleEnabled":false,"settingsButtonEnabled":true}},"helpDialogue":{"content":{"text":"testun i'w osod","title":"Cymorth"}},"moreInfoRightPanel":{"options":{"canvasDisplayOrder":"","canvasExclude":"","copyToClipboardEnabled":false,"manifestDisplayOrder":"","manifestExclude":"","panelAnimationDuration":250,"panelCollapsedWidth":30,"panelExpandedWidth":255,"panelOpen":false,"rtlLanguageCodes":"ar, ara, dv, div, he, heb, ur, urd","showAllLanguages":false,"textLimit":4,"textLimitType":"lines"},"content":{"attribution":"Priodoledd","collapse":"Lleihau'r Wybodaeth","collapseFull":"Cuddio'r Galeri","description":"Disgrifiad","expand":"Ehangu'r Wybodaeth","expandFull":"Ehangu'r Galeri","holdingText":"Eich modiwl fan hyn!","less":"llai","license":"Trwydded","logo":"Logo","more":"mwy","noData":"Nid oes data i'w arddangos","page":"Tudalen","title":"Mwy o Wybodaeth","manifestHeader":"Am yr eitem","canvasHeader":"Am y ddelwedd","copyToClipboard":"Copïo i'r clipfwrdd","copiedToClipboard":"Copïwyd i'r clipfwrdd"}},"multiSelectDialogue":{"options":{"galleryThumbChunkedResizingEnabled":true,"galleryThumbChunkedResizingThreshold":400,"galleryThumbHeight":320,"galleryThumbLoadPadding":3,"galleryThumbWidth":200,"pageModeEnabled":true},"content":{"select":"Lawrlwytho","selectAll":"Dewis y cyfan","title":"Dewis Tudalennau i'w Lawrlwytho"}},"ocrRightPanel":{"options":{"panelAnimationDuration":250,"panelCollapsedWidth":30,"panelExpandedWidth":300,"panelOpen":false}},"pagingHeaderPanel":{"options":{"autoCompleteBoxEnabled":true,"galleryButtonEnabled":true,"imageSelectionBoxEnabled":false,"pageModeEnabled":false,"pagingToggleEnabled":true},"content":{"close":"Cau","emptyValue":"Mewnosodwch werth","first":"gyntaf","firstImage":"Delwedd Gyntaf","firstPage":"Tudalen gyntaf","folio":"Ffolio","gallery":"Galeri","go":"GWELD","help":"Cymorth","image":"Delwedd","last":"Olaf","lastImage":"Delwedd Olaf","lastPage":"Tudalen Olaf","next":"Nesaf","nextImage":"Delwedd Nesaf","nextPage":"Tudalen Nesaf","of":"o {0}","oneUp":"Gweld un dudalen ar y tro","page":"Tudalen","previous":"Blaenorol","previousImage":"Delwedd Flaenorol","previousPage":"Tudalen Flaenorol","settings":"Dewisiadau","twoUp":"Gweld dwy dudalen ar y tro"}},"seadragonCenterPanel":{"options":{"animationTime":0.15,"autoHideControls":true,"attributionEnabled":true,"blendTime":0,"constrainDuringPan":false,"controlsFadeAfterInactive":1500,"controlsFadeDelay":250,"controlsFadeLength":250,"defaultZoomLevel":0,"immediateRender":false,"maxZoomPixelRatio":1.25,"navigatorPosition":"BOTTOM_RIGHT","pageGap":50,"showHomeControl":false,"trimAttributionCount":150,"visibilityRatio":0.5},"content":{"attribution":"Priodoliad","goHome":"Gweld y maint gwreiddiol","imageUnavailable":"Nid oes delwedd ar gael","next":"nesaf","previous":"blaenorol","rotateRight":"Cylchdroi i'r dde","zoomIn":"Closio","zoomOut":"Gwrthglosio"}},"searchFooterPanel":{"options":{"elideDetailsTermsCount":20,"elideResultsTermsCount":5,"pageModeEnabled":true,"positionMarkerEnabled":true},"content":{"clearSearch":"Gwaredu","defaultLabel":"-","displaying":"{0} {1} o {2}","enterKeyword":"Mewnosodwch allweddair","image":"delwedd","imageCaps":"delwedd","instanceFound":"Dangos 1 canlyniad ar gyfer '{0}' ","instancesFound":"Dangos {0} canlyniad o '{1}' ","nextResult":"Canlyniad nesaf","page":"tudalen","pageCaps":"tudalen","previousResult":"Canlyniad blaenorol","print":"Argraffu","resultFoundFor":"canlyniad a geir ar gyfer","resultsFoundFor":"canlyniad ar gyfer","searchWithin":"Chwilio tu fewn i:"}},"settingsDialogue":{"options":{"contributedByEnabled":true,"contributedByOptions":{"contributor":"4Science","website":"http://www.4science.it"},"moreInfo":{"website":"https://github.com/4Science/universalviewer/tree/ocr"}},"content":{"locale":"Iaith","navigatorEnabled":"Ffenest llywio ar gael","clickToZoomEnabled":"Cliciwch gyda'r llygoden i glosio","pagingEnabled":"Arddangos dwy dudalen","preserveViewport":"Cadw'r lefel o glosio","title":"Dewisiadau","website":"mwy o wybodaeth"}},"shareDialogue":{"options":{"embedTemplate":"
                          \n","instructionsEnabled":false,"shareFrameEnabled":true},"content":{"customSize":"dewisol","embed":"Ymgorffori","embedInstructions":"Er mwyn ymgorffori'r eitem hon ar eich gwefan, copïwch a gosodwch y cod isod.","height":"Hyd","iiif":"Maniffest IIIF","share":"Rhannu","shareInstructions":"Er mwyn rhannu'r eitem hon, copïwch y URL isod.","size":"Maint:","width":"Lled"}},"clickThroughDialogue":{"content":{"viewTerms":"Darllenwch y Telerau a'r Amodau Llawn"}},"loginDialogue":{"content":{"login":"Mewngofnodi","logout":"Allgofnodi","cancel":"Canslo"}},"mobileFooterPanel":{"content":{"rotateRight":"Cylchdroi i'r dde","moreInfo":"Mwy o Wybodaeth","zoomIn":"Closio","zoomOut":"Gwrthglosio"}},"restrictedDialogue":{"content":{"cancel":"Canslo"}}},"localisation":{"label":"Cymraeg","locales":[{"name":"cy-GB","label":"Cymraeg"},{"name":"en-GB","label":"English (GB)"}]},"content":{"authCORSError":"Mae angen diweddaru'ch porwr er mwyn galluogi rhannu adnoddau traws-safle.","authorisationFailedMessage":"Ni lwyddoch i fewngofnodi. Rhowch gynnig arni eto.","canvasIndexOutOfRange":"Canfas yn rhy fawr i'w arddangos (ceisiwch eto)","degradedResourceMessage":"Mewngofnodwch i weld ansawdd uchel.","degradedResourceLogin":"Mewngofnodi","forbiddenResourceMessage":"Nid yw'ch hawliau mynediad presennol yn ddigonol i weld y ddelwedd hon","termsOfUse":"Telerau Defnydd"}} \ No newline at end of file diff --git a/dist/uv-2.0.1/lib/uv-seadragon-extension.en-GB.config.json b/dist/uv-2.0.1/lib/uv-seadragon-extension.en-GB.config.json index b83293a35..6ece3978a 100644 --- a/dist/uv-2.0.1/lib/uv-seadragon-extension.en-GB.config.json +++ b/dist/uv-2.0.1/lib/uv-seadragon-extension.en-GB.config.json @@ -1 +1 @@ -{"options":{"allowStealFocus":false,"bookmarkThumbHeight":150,"bookmarkThumbWidth":90,"dropEnabled":true,"footerPanelEnabled":true,"headerPanelEnabled":true,"leftPanelEnabled":true,"limitLocales":false,"metrics":[{"type":"mobilelandscape","minWidth":0,"maxWidth":640},{"type":"laptop","minWidth":640,"maxWidth":100000}],"multiSelectionMimeType":"application/zip","navigatorEnabled":true,"openTemplate":"http://universalviewer.io?manifest={0}","overrideFullScreen":false,"pagingEnabled":true,"pagingOptionEnabled":true,"pessimisticAccessControl":false,"preserveViewport":false,"rightPanelEnabled":true,"saveUserSettings":false,"clickToZoomEnabled":true,"searchWithinEnabled":true,"termsOfUseEnabled":false,"theme":"uv-en-GB-theme","tokenStorage":"session","useArrowKeysToNavigate":false,"zoomToSearchResultEnabled":true},"modules":{"contentLeftPanel":{"options":{"defaultToTreeEnabled":false,"defaultToTreeIfGreaterThan":0,"elideCount":40,"expandFullEnabled":true,"galleryThumbChunkedResizingThreshold":400,"galleryThumbHeight":320,"galleryThumbLoadPadding":3,"galleryThumbWidth":200,"oneColThumbHeight":320,"oneColThumbWidth":200,"pageModeEnabled":true,"panelAnimationDuration":250,"panelCollapsedWidth":30,"panelExpandedWidth":255,"panelOpen":true,"tabOrder":"","thumbsEnabled":true,"thumbsExtraHeight":8,"thumbsImageFadeInDuration":300,"thumbsLoadRange":15,"treeEnabled":true,"twoColThumbHeight":150,"twoColThumbWidth":90},"content":{"collapse":"Collapse Contents","collapseFull":"Collapse Gallery","date":"date","expand":"Expand Contents","expandFull":"Expand Gallery","index":"Index","searchResult":"{0} search result","searchResults":"{0} search results","sortBy":"Sort By:","thumbnails":"Thumbnails","title":"Contents","volume":"volume"}},"dialogue":{"content":{"close":"Close"}},"downloadDialogue":{"options":{"confinedImageSize":1000,"currentViewDisabledPercentage":90,"maxImageWidth":5000,"optionsExplanatoryTextEnabled":false,"selectionEnabled":false},"content":{"currentViewAsJpg":"Current view {0} x {1}px (jpg)","currentViewAsJpgExplanation":"Opens in a new window","download":"Download","downloadSelection":"Download Selection","downloadSelectionExplanation":"Opens a dialogue to select which pages to download.","editSettings":"Edit Settings","entireDocument":"Entire document ({0})","entireFileAsOriginal":"Entire file ({0})","noneAvailable":"No download options are available.","pagingNote":"Please turn off Two Page View for additional options.","preview":"Preview","title":"Download","wholeImageHighRes":"Whole image {0} x {1}px ({2})","wholeImageHighResExplanation":"Opens in a new window.","wholeImagesHighRes":"Whole images ({0})","wholeImagesHighResExplanation":"Opens in two new windows.","wholeImageLowResAsJpg":"Whole image {0} x {1}px (jpg)","wholeImageLowResAsJpgExplanation":"Opens in a new window."}},"footerPanel":{"options":{"bookmarkEnabled":false,"downloadEnabled":true,"embedEnabled":false,"feedbackEnabled":false,"fullscreenEnabled":true,"minimiseButtons":true,"moreInfoEnabled":true,"openEnabled":false,"printEnabled":false,"shareEnabled":true},"content":{"bookmark":"Add to bookmarks","download":"Download","embed":"Embed","feedback":"Feedback","exitFullScreen":"Exit Full Screen","fullScreen":"Full Screen","open":"Open","share":"Share"}},"genericDialogue":{"content":{"emptyValue":"please enter a value.","invalidNumber":"Please enter a valid number.","noMatches":"No matches were found.","ok":"OK","pageNotFound":"This item does not contain a page with the number you entered. Try switching the numbering mode to 'image'.","refresh":"Refresh"}},"headerPanel":{"options":{"localeToggleEnabled":false,"settingsButtonEnabled":true}},"helpDialogue":{"content":{"text":"placeholder text","title":"Help"}},"moreInfoRightPanel":{"options":{"canvasDisplayOrder":"","canvasExclude":"","copyToClipboardEnabled":false,"manifestDisplayOrder":"","manifestExclude":"","panelAnimationDuration":250,"panelCollapsedWidth":30,"panelExpandedWidth":255,"panelOpen":false,"rtlLanguageCodes":"ar, ara, dv, div, he, heb, ur, urd","showAllLanguages":false,"textLimit":4,"textLimitType":"lines"},"content":{"attribution":"Attribution","collapse":"Collapse Information","collapseFull":"Collapse Gallery","description":"Description","expand":"Expand Information","expandFull":"Expand Gallery","holdingText":"Your module goes here!","less":"less","license":"License","logo":"Logo","more":"more","noData":"No data to display","page":"Page","title":"More Information","manifestHeader":"About the item","canvasHeader":"About the image","copyToClipboard":"Copy to clipboard","copiedToClipboard":"Copied to clipboard"}},"multiSelectDialogue":{"options":{"galleryThumbChunkedResizingEnabled":true,"galleryThumbChunkedResizingThreshold":400,"galleryThumbHeight":320,"galleryThumbLoadPadding":3,"galleryThumbWidth":200,"pageModeEnabled":true},"content":{"select":"Download","selectAll":"Select All","title":"Select Pages for Download"}},"pagingHeaderPanel":{"options":{"autoCompleteBoxEnabled":true,"galleryButtonEnabled":true,"imageSelectionBoxEnabled":false,"pageModeEnabled":false,"pagingToggleEnabled":true},"content":{"close":"Close","emptyValue":"Please enter a value","first":"First","firstImage":"First Image","firstPage":"First Page","folio":"Folio","gallery":"Gallery","go":"Go","help":"Help","image":"Image","last":"Last","lastImage":"Last Image","lastPage":"Last Page","next":"Next","nextImage":"Next Image","nextPage":"Next Page","of":"of {0}","oneUp":"Single page view","page":"Page","previous":"Previous","previousImage":"Previous Image","previousPage":"Previous Page","settings":"Settings","twoUp":"Two page view"}},"seadragonCenterPanel":{"options":{"animationTime":0.15,"autoHideControls":true,"attributionEnabled":true,"blendTime":0,"constrainDuringPan":false,"controlsFadeAfterInactive":1500,"controlsFadeDelay":250,"controlsFadeLength":250,"defaultZoomLevel":0,"immediateRender":false,"maxZoomPixelRatio":1.25,"navigatorPosition":"BOTTOM_RIGHT","pageGap":50,"showHomeControl":false,"trimAttributionCount":150,"visibilityRatio":0.5},"content":{"attribution":"Attribution","goHome":"Go Home","imageUnavailable":"Image Unavailable","next":"Next","previous":"Previous","rotateRight":"Rotate Right","zoomIn":"Zoom In","zoomOut":"Zoom Out"}},"searchFooterPanel":{"options":{"elideDetailsTermsCount":20,"elideResultsTermsCount":10,"pageModeEnabled":true,"positionMarkerEnabled":true},"content":{"clearSearch":"Clear","defaultLabel":"-","displaying":"{0} {1} of {2}","enterKeyword":"Enter Keyword","image":"image","imageCaps":"Image","instanceFound":"1 instance of '{0}' found","instancesFound":"{0} instances of '{1}' found","nextResult":"Next Result","page":"page","pageCaps":"Page","previousResult":"Previous Result","print":"Print","resultFoundFor":"result found for","resultsFoundFor":"results found for","searchWithin":"Search within this item:"}},"settingsDialogue":{"content":{"locale":"Locale","navigatorEnabled":"Navigator Enabled","clickToZoomEnabled":"Mouse Click To Zoom","pagingEnabled":"Two Page View","preserveViewport":"Preserve Zoom","title":"Settings","website":"more info"}},"shareDialogue":{"options":{"embedTemplate":"
                          \n","instructionsEnabled":false,"shareFrameEnabled":true},"content":{"customSize":"custom","embed":"Embed","embedInstructions":"To embed this item in your own website, copy and paste the code below.","height":"Height","iiif":"IIIF Manifest","share":"Share","shareInstructions":"To share this item, copy the URL below.","size":"Size:","width":"Width"}},"clickThroughDialogue":{"content":{"viewTerms":"Read Full Terms and Conditions"}},"loginDialogue":{"content":{"login":"Login","logout":"Logout","cancel":"Cancel"}},"mobileFooterPanel":{"content":{"rotateRight":"Rotate Right","moreInfo":"More Information","zoomIn":"Zoom In","zoomOut":"Zoom Out"}},"restrictedDialogue":{"content":{"cancel":"Cancel"}}},"localisation":{"label":"English (GB)","locales":[{"name":"cy-GB","label":"Cymraeg"},{"name":"en-GB","label":"English (GB)"}]},"content":{"authCORSError":"Your browser does not support CORS, please upgrade to view this content.","authorisationFailedMessage":"Your log-in attempt did not appear to be successful. Please try again.","canvasIndexOutOfRange":"Canvas index out of range.","degradedResourceMessage":"Please log in to view at full quality.","degradedResourceLogin":"log in","forbiddenResourceMessage":"Your current access rights are insufficient to view this image","termsOfUse":"Terms of Use"}} \ No newline at end of file +{"options":{"allowStealFocus":false,"bookmarkThumbHeight":150,"bookmarkThumbWidth":90,"dropEnabled":true,"footerPanelEnabled":true,"headerPanelEnabled":true,"leftPanelEnabled":true,"limitLocales":false,"metrics":[{"type":"mobilelandscape","minWidth":0,"maxWidth":640},{"type":"laptop","minWidth":640,"maxWidth":100000}],"multiSelectionMimeType":"application/zip","navigatorEnabled":true,"openTemplate":"http://universalviewer.io?manifest={0}","overrideFullScreen":false,"pagingEnabled":true,"pagingOptionEnabled":true,"pessimisticAccessControl":false,"preserveViewport":false,"rightPanelEnabled":true,"ocrRightPanelEnabled":true,"saveUserSettings":false,"clickToZoomEnabled":true,"searchWithinEnabled":true,"termsOfUseEnabled":false,"theme":"uv-en-GB-theme","tokenStorage":"session","useArrowKeysToNavigate":false,"zoomToSearchResultEnabled":true},"modules":{"contentLeftPanel":{"options":{"defaultToTreeEnabled":false,"defaultToTreeIfGreaterThan":0,"elideCount":40,"expandFullEnabled":true,"galleryThumbChunkedResizingThreshold":400,"galleryThumbHeight":320,"galleryThumbLoadPadding":3,"galleryThumbWidth":200,"oneColThumbHeight":320,"oneColThumbWidth":200,"pageModeEnabled":true,"panelAnimationDuration":250,"panelCollapsedWidth":30,"panelExpandedWidth":255,"panelOpen":true,"tabOrder":"","thumbsEnabled":true,"thumbsExtraHeight":8,"thumbsImageFadeInDuration":300,"thumbsLoadRange":15,"treeEnabled":true,"twoColThumbHeight":150,"twoColThumbWidth":90},"content":{"collapse":"Collapse Contents","collapseFull":"Collapse Gallery","date":"date","expand":"Expand Contents","expandFull":"Expand Gallery","index":"Index","searchResult":"{0} search result","searchResults":"{0} search results","sortBy":"Sort By:","thumbnails":"Thumbnails","title":"Contents","volume":"volume"}},"dialogue":{"content":{"close":"Close"}},"downloadDialogue":{"options":{"confinedImageSize":1000,"currentViewDisabledPercentage":90,"maxImageWidth":5000,"optionsExplanatoryTextEnabled":false,"selectionEnabled":false},"content":{"currentViewAsJpg":"Current view {0} x {1}px (jpg)","currentViewAsJpgExplanation":"Opens in a new window","download":"Download","downloadSelection":"Download Selection","downloadSelectionExplanation":"Opens a dialogue to select which pages to download.","editSettings":"Edit Settings","entireDocument":"Entire document ({0})","entireFileAsOriginal":"Entire file ({0})","noneAvailable":"No download options are available.","pagingNote":"Please turn off Two Page View for additional options.","preview":"Preview","title":"Download","wholeImageHighRes":"Whole image {0} x {1}px ({2})","wholeImageHighResExplanation":"Opens in a new window.","wholeImagesHighRes":"Whole images ({0})","wholeImagesHighResExplanation":"Opens in two new windows.","wholeImageLowResAsJpg":"Whole image {0} x {1}px (jpg)","wholeImageLowResAsJpgExplanation":"Opens in a new window."}},"footerPanel":{"options":{"bookmarkEnabled":false,"downloadEnabled":true,"embedEnabled":false,"feedbackEnabled":false,"fullscreenEnabled":true,"logoEnabled":true,"logoOptions":{"website":"http://www.4science.it"},"minimiseButtons":true,"moreInfoEnabled":true,"openEnabled":false,"printEnabled":false,"shareEnabled":true},"content":{"bookmark":"Add to bookmarks","download":"Download","embed":"Embed","feedback":"Feedback","exitFullScreen":"Exit Full Screen","fullScreen":"Full Screen","logo":"Logo","open":"Open","share":"Share"}},"genericDialogue":{"content":{"emptyValue":"please enter a value.","invalidNumber":"Please enter a valid number.","noMatches":"No matches were found.","ok":"OK","pageNotFound":"This item does not contain a page with the number you entered. Try switching the numbering mode to 'image'.","refresh":"Refresh","wrongSelection":"Wrong selection. You can't select items outside text area of OCR panel"}},"headerPanel":{"options":{"localeToggleEnabled":false,"settingsButtonEnabled":true}},"helpDialogue":{"content":{"text":"placeholder text","title":"Help"}},"moreInfoRightPanel":{"options":{"canvasDisplayOrder":"","canvasExclude":"","copyToClipboardEnabled":false,"manifestDisplayOrder":"","manifestExclude":"","panelAnimationDuration":250,"panelCollapsedWidth":30,"panelExpandedWidth":255,"panelOpen":false,"rtlLanguageCodes":"ar, ara, dv, div, he, heb, ur, urd","showAllLanguages":false,"textLimit":4,"textLimitType":"lines"},"content":{"attribution":"Attribution","collapse":"Collapse Information","collapseFull":"Collapse Gallery","description":"Description","expand":"Expand Information","expandFull":"Expand Gallery","holdingText":"Your module goes here!","less":"less","license":"License","logo":"Logo","more":"more","noData":"No data to display","page":"Page","title":"More Information","manifestHeader":"About the item","canvasHeader":"About the image","copyToClipboard":"Copy to clipboard","copiedToClipboard":"Copied to clipboard"}},"multiSelectDialogue":{"options":{"galleryThumbChunkedResizingEnabled":true,"galleryThumbChunkedResizingThreshold":400,"galleryThumbHeight":320,"galleryThumbLoadPadding":3,"galleryThumbWidth":200,"pageModeEnabled":true},"content":{"select":"Download","selectAll":"Select All","title":"Select Pages for Download"}},"ocrRightPanel":{"options":{"panelAnimationDuration":250,"panelCollapsedWidth":30,"panelExpandedWidth":300,"panelOpen":false},"content":{"clearSelection":"Clear selected text","collapse":"Collapse Ocr","expand":"Expand Ocr","title":"Ocr"}},"pagingHeaderPanel":{"options":{"autoCompleteBoxEnabled":true,"galleryButtonEnabled":true,"imageSelectionBoxEnabled":false,"pageModeEnabled":false,"pagingToggleEnabled":true},"content":{"close":"Close","emptyValue":"Please enter a value","first":"First","firstImage":"First Image","firstPage":"First Page","folio":"Folio","gallery":"Gallery","go":"Go","help":"Help","image":"Image","last":"Last","lastImage":"Last Image","lastPage":"Last Page","next":"Next","nextImage":"Next Image","nextPage":"Next Page","of":"of {0}","oneUp":"Single page view","page":"Page","previous":"Previous","previousImage":"Previous Image","previousPage":"Previous Page","settings":"Settings","twoUp":"Two page view"}},"seadragonCenterPanel":{"options":{"animationTime":0.15,"autoHideControls":true,"attributionEnabled":true,"blendTime":0,"constrainDuringPan":false,"controlsFadeAfterInactive":1500,"controlsFadeDelay":250,"controlsFadeLength":250,"defaultZoomLevel":0,"immediateRender":false,"maxZoomPixelRatio":1.25,"navigatorPosition":"BOTTOM_RIGHT","pageGap":50,"showHomeControl":false,"trimAttributionCount":150,"visibilityRatio":0.5},"content":{"attribution":"Attribution","goHome":"Go Home","imageUnavailable":"Image Unavailable","next":"Next","previous":"Previous","rotateRight":"Rotate Right","zoomIn":"Zoom In","zoomOut":"Zoom Out"}},"searchFooterPanel":{"options":{"elideDetailsTermsCount":20,"elideResultsTermsCount":10,"pageModeEnabled":true,"positionMarkerEnabled":true},"content":{"clearSearch":"Clear","defaultLabel":"-","displaying":"{0} {1} of {2}","enterKeyword":"Enter Keyword","image":"image","imageCaps":"Image","instanceFound":"1 instance of '{0}' found","instancesFound":"{0} instances of '{1}' found","nextResult":"Next Result","page":"page","pageCaps":"Page","previousResult":"Previous Result","print":"Print","resultFoundFor":"result found for","resultsFoundFor":"results found for","searchWithin":"Search within this item:"}},"settingsDialogue":{"options":{"contributedByEnabled":true,"contributedByOptions":{"contributor":"4Science","website":"http://www.4science.it"},"moreInfo":{"website":"https://github.com/4Science/universalviewer/tree/ocr"}},"content":{"locale":"Locale","navigatorEnabled":"Navigator Enabled","clickToZoomEnabled":"Mouse Click To Zoom","contributedBy":" enhanced by {0}","pagingEnabled":"Two Page View","preserveViewport":"Preserve Zoom","title":"Settings","website":"more info"}},"shareDialogue":{"options":{"embedTemplate":"
                          \n","instructionsEnabled":false,"shareFrameEnabled":true},"content":{"customSize":"custom","embed":"Embed","embedInstructions":"To embed this item in your own website, copy and paste the code below.","height":"Height","iiif":"IIIF Manifest","share":"Share","shareInstructions":"To share this item, copy the URL below.","size":"Size:","width":"Width"}},"clickThroughDialogue":{"content":{"viewTerms":"Read Full Terms and Conditions"}},"loginDialogue":{"content":{"login":"Login","logout":"Logout","cancel":"Cancel"}},"mobileFooterPanel":{"content":{"rotateRight":"Rotate Right","moreInfo":"More Information","zoomIn":"Zoom In","zoomOut":"Zoom Out"}},"restrictedDialogue":{"content":{"cancel":"Cancel"}}},"localisation":{"label":"English (GB)","locales":[{"name":"cy-GB","label":"Cymraeg"},{"name":"en-GB","label":"English (GB)"}]},"content":{"authCORSError":"Your browser does not support CORS, please upgrade to view this content.","authorisationFailedMessage":"Your log-in attempt did not appear to be successful. Please try again.","canvasIndexOutOfRange":"Canvas index out of range.","degradedResourceMessage":"Please log in to view at full quality.","degradedResourceLogin":"log in","forbiddenResourceMessage":"Your current access rights are insufficient to view this image","termsOfUse":"Terms of Use"}} \ No newline at end of file diff --git a/dist/uv-2.0.1/schema/uv-seadragon-extension.cy-GB.schema.json b/dist/uv-2.0.1/schema/uv-seadragon-extension.cy-GB.schema.json index da598b928..092c7fced 100644 --- a/dist/uv-2.0.1/schema/uv-seadragon-extension.cy-GB.schema.json +++ b/dist/uv-2.0.1/schema/uv-seadragon-extension.cy-GB.schema.json @@ -1 +1 @@ -{"$schema":"http://json-schema.org/draft-04/schema#","description":"","type":"object","properties":{"options":{"type":"object","properties":{"allowStealFocus":{"type":"boolean"},"bookmarkThumbHeight":{"type":"number"},"bookmarkThumbWidth":{"type":"number"},"dropEnabled":{"type":"boolean"},"footerPanelEnabled":{"type":"boolean"},"headerPanelEnabled":{"type":"boolean"},"leftPanelEnabled":{"type":"boolean"},"limitLocales":{"type":"boolean"},"metrics":{"type":"array","uniqueItems":true,"minItems":1,"items":{"required":["type","minWidth","maxWidth"],"properties":{"type":{"type":"string","minLength":1},"minWidth":{"type":"number"},"maxWidth":{"type":"number"}}}},"multiSelectionMimeType":{"type":"string","minLength":1},"navigatorEnabled":{"type":"boolean"},"openTemplate":{"type":"string","minLength":1},"overrideFullScreen":{"type":"boolean"},"pagingEnabled":{"type":"boolean"},"pagingOptionEnabled":{"type":"boolean"},"pessimisticAccessControl":{"type":"boolean"},"preserveViewport":{"type":"boolean"},"rightPanelEnabled":{"type":"boolean"},"saveUserSettings":{"type":"boolean"},"clickToZoomEnabled":{"type":"boolean"},"searchWithinEnabled":{"type":"boolean"},"termsOfUseEnabled":{"type":"boolean"},"theme":{"type":"string","minLength":1},"tokenStorage":{"type":"string","minLength":1},"useArrowKeysToNavigate":{"type":"boolean"},"zoomToSearchResultEnabled":{"type":"boolean"}},"required":["allowStealFocus","bookmarkThumbHeight","bookmarkThumbWidth","dropEnabled","footerPanelEnabled","headerPanelEnabled","leftPanelEnabled","limitLocales","metrics","multiSelectionMimeType","navigatorEnabled","openTemplate","overrideFullScreen","pagingEnabled","pagingOptionEnabled","pessimisticAccessControl","preserveViewport","rightPanelEnabled","saveUserSettings","clickToZoomEnabled","searchWithinEnabled","termsOfUseEnabled","theme","tokenStorage","useArrowKeysToNavigate","zoomToSearchResultEnabled"]},"modules":{"type":"object","properties":{"contentLeftPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"defaultToTreeEnabled":{"type":"boolean"},"defaultToTreeIfGreaterThan":{"type":"number"},"elideCount":{"type":"number"},"expandFullEnabled":{"type":"boolean"},"galleryThumbChunkedResizingThreshold":{"type":"number"},"galleryThumbHeight":{"type":"number"},"galleryThumbLoadPadding":{"type":"number"},"galleryThumbWidth":{"type":"number"},"oneColThumbHeight":{"type":"number"},"oneColThumbWidth":{"type":"number"},"pageModeEnabled":{"type":"boolean"},"panelAnimationDuration":{"type":"number"},"panelCollapsedWidth":{"type":"number"},"panelExpandedWidth":{"type":"number"},"panelOpen":{"type":"boolean"},"tabOrder":{"type":"string"},"thumbsEnabled":{"type":"boolean"},"thumbsExtraHeight":{"type":"number"},"thumbsImageFadeInDuration":{"type":"number"},"thumbsLoadRange":{"type":"number"},"treeEnabled":{"type":"boolean"},"twoColThumbHeight":{"type":"number"},"twoColThumbWidth":{"type":"number"}},"required":["defaultToTreeEnabled","defaultToTreeIfGreaterThan","elideCount","expandFullEnabled","galleryThumbChunkedResizingThreshold","galleryThumbHeight","galleryThumbLoadPadding","galleryThumbWidth","oneColThumbHeight","oneColThumbWidth","pageModeEnabled","panelAnimationDuration","panelCollapsedWidth","panelExpandedWidth","panelOpen","tabOrder","thumbsEnabled","thumbsExtraHeight","thumbsImageFadeInDuration","thumbsLoadRange","treeEnabled","twoColThumbHeight","twoColThumbWidth"]},"content":{"type":"object","properties":{"collapse":{"type":"string","minLength":1},"collapseFull":{"type":"string","minLength":1},"date":{"type":"string","minLength":1},"expand":{"type":"string","minLength":1},"expandFull":{"type":"string","minLength":1},"index":{"type":"string","minLength":1},"searchResult":{"type":"string","minLength":1},"searchResults":{"type":"string","minLength":1},"sortBy":{"type":"string","minLength":1},"thumbnails":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"volume":{"type":"string","minLength":1}},"required":["collapse","collapseFull","date","expand","expandFull","index","searchResult","searchResults","sortBy","thumbnails","title","volume"]}},"required":["options","content"]},"dialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"close":{"type":"string","minLength":1}},"required":["close"]}},"required":["content"]},"downloadDialogue":{"type":"object","properties":{"options":{"type":"object","properties":{"confinedImageSize":{"type":"number"},"currentViewDisabledPercentage":{"type":"number"},"maxImageWidth":{"type":"number"},"optionsExplanatoryTextEnabled":{"type":"boolean"},"selectionEnabled":{"type":"boolean"}},"required":["confinedImageSize","currentViewDisabledPercentage","maxImageWidth","optionsExplanatoryTextEnabled","selectionEnabled"]},"content":{"type":"object","properties":{"currentViewAsJpg":{"type":"string","minLength":1},"currentViewAsJpgExplanation":{"type":"string","minLength":1},"download":{"type":"string","minLength":1},"downloadSelection":{"type":"string","minLength":1},"downloadSelectionExplanation":{"type":"string","minLength":1},"editSettings":{"type":"string","minLength":1},"entireDocument":{"type":"string","minLength":1},"entireFileAsOriginal":{"type":"string","minLength":1},"noneAvailable":{"type":"string","minLength":1},"pagingNote":{"type":"string","minLength":1},"preview":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"wholeImageHighRes":{"type":"string","minLength":1},"wholeImageHighResExplanation":{"type":"string","minLength":1},"wholeImagesHighRes":{"type":"string","minLength":1},"wholeImagesHighResExplanation":{"type":"string","minLength":1},"wholeImageLowResAsJpg":{"type":"string","minLength":1},"wholeImageLowResAsJpgExplanation":{"type":"string","minLength":1}},"required":["currentViewAsJpg","currentViewAsJpgExplanation","download","downloadSelection","downloadSelectionExplanation","editSettings","entireDocument","entireFileAsOriginal","noneAvailable","pagingNote","preview","title","wholeImageHighRes","wholeImageHighResExplanation","wholeImagesHighRes","wholeImagesHighResExplanation","wholeImageLowResAsJpg","wholeImageLowResAsJpgExplanation"]}},"required":["options","content"]},"footerPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"bookmarkEnabled":{"type":"boolean"},"downloadEnabled":{"type":"boolean"},"embedEnabled":{"type":"boolean"},"feedbackEnabled":{"type":"boolean"},"fullscreenEnabled":{"type":"boolean"},"minimiseButtons":{"type":"boolean"},"moreInfoEnabled":{"type":"boolean"},"openEnabled":{"type":"boolean"},"printEnabled":{"type":"boolean"},"shareEnabled":{"type":"boolean"}},"required":["bookmarkEnabled","downloadEnabled","embedEnabled","feedbackEnabled","fullscreenEnabled","minimiseButtons","moreInfoEnabled","openEnabled","printEnabled","shareEnabled"]},"content":{"type":"object","properties":{"bookmark":{"type":"string","minLength":1},"download":{"type":"string","minLength":1},"embed":{"type":"string","minLength":1},"feedback":{"type":"string","minLength":1},"exitFullScreen":{"type":"string","minLength":1},"fullScreen":{"type":"string","minLength":1},"open":{"type":"string","minLength":1},"share":{"type":"string","minLength":1}},"required":["bookmark","download","embed","feedback","exitFullScreen","fullScreen","open","share"]}},"required":["options","content"]},"genericDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"emptyValue":{"type":"string","minLength":1},"invalidNumber":{"type":"string","minLength":1},"noMatches":{"type":"string","minLength":1},"ok":{"type":"string","minLength":1},"pageNotFound":{"type":"string","minLength":1},"refresh":{"type":"string","minLength":1}},"required":["emptyValue","invalidNumber","noMatches","ok","pageNotFound","refresh"]}},"required":["content"]},"headerPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"localeToggleEnabled":{"type":"boolean"},"settingsButtonEnabled":{"type":"boolean"}},"required":["localeToggleEnabled","settingsButtonEnabled"]}},"required":["options"]},"helpDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"text":{"type":"string","minLength":1},"title":{"type":"string","minLength":1}},"required":["text","title"]}},"required":["content"]},"moreInfoRightPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"canvasDisplayOrder":{"type":"string"},"canvasExclude":{"type":"string"},"copyToClipboardEnabled":{"type":"boolean"},"manifestDisplayOrder":{"type":"string"},"manifestExclude":{"type":"string"},"panelAnimationDuration":{"type":"number"},"panelCollapsedWidth":{"type":"number"},"panelExpandedWidth":{"type":"number"},"panelOpen":{"type":"boolean"},"rtlLanguageCodes":{"type":"string","minLength":1},"showAllLanguages":{"type":"boolean"},"textLimit":{"type":"number"},"textLimitType":{"type":"string","minLength":1}},"required":["canvasDisplayOrder","canvasExclude","copyToClipboardEnabled","manifestDisplayOrder","manifestExclude","panelAnimationDuration","panelCollapsedWidth","panelExpandedWidth","panelOpen","rtlLanguageCodes","showAllLanguages","textLimit","textLimitType"]},"content":{"type":"object","properties":{"attribution":{"type":"string","minLength":1},"collapse":{"type":"string","minLength":1},"collapseFull":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"expand":{"type":"string","minLength":1},"expandFull":{"type":"string","minLength":1},"holdingText":{"type":"string","minLength":1},"less":{"type":"string","minLength":1},"license":{"type":"string","minLength":1},"logo":{"type":"string","minLength":1},"more":{"type":"string","minLength":1},"noData":{"type":"string","minLength":1},"page":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"manifestHeader":{"type":"string","minLength":1},"canvasHeader":{"type":"string","minLength":1},"copyToClipboard":{"type":"string","minLength":1},"copiedToClipboard":{"type":"string","minLength":1}},"required":["attribution","collapse","collapseFull","description","expand","expandFull","holdingText","less","license","logo","more","noData","page","title","manifestHeader","canvasHeader","copyToClipboard","copiedToClipboard"]}},"required":["options","content"]},"multiSelectDialogue":{"type":"object","properties":{"options":{"type":"object","properties":{"galleryThumbChunkedResizingEnabled":{"type":"boolean"},"galleryThumbChunkedResizingThreshold":{"type":"number"},"galleryThumbHeight":{"type":"number"},"galleryThumbLoadPadding":{"type":"number"},"galleryThumbWidth":{"type":"number"},"pageModeEnabled":{"type":"boolean"}},"required":["galleryThumbChunkedResizingEnabled","galleryThumbChunkedResizingThreshold","galleryThumbHeight","galleryThumbLoadPadding","galleryThumbWidth","pageModeEnabled"]},"content":{"type":"object","properties":{"select":{"type":"string","minLength":1},"selectAll":{"type":"string","minLength":1},"title":{"type":"string","minLength":1}},"required":["select","selectAll","title"]}},"required":["options","content"]},"pagingHeaderPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"autoCompleteBoxEnabled":{"type":"boolean"},"galleryButtonEnabled":{"type":"boolean"},"imageSelectionBoxEnabled":{"type":"boolean"},"pageModeEnabled":{"type":"boolean"},"pagingToggleEnabled":{"type":"boolean"}},"required":["autoCompleteBoxEnabled","galleryButtonEnabled","imageSelectionBoxEnabled","pageModeEnabled","pagingToggleEnabled"]},"content":{"type":"object","properties":{"close":{"type":"string","minLength":1},"emptyValue":{"type":"string","minLength":1},"first":{"type":"string","minLength":1},"firstImage":{"type":"string","minLength":1},"firstPage":{"type":"string","minLength":1},"folio":{"type":"string","minLength":1},"gallery":{"type":"string","minLength":1},"go":{"type":"string","minLength":1},"help":{"type":"string","minLength":1},"image":{"type":"string","minLength":1},"last":{"type":"string","minLength":1},"lastImage":{"type":"string","minLength":1},"lastPage":{"type":"string","minLength":1},"next":{"type":"string","minLength":1},"nextImage":{"type":"string","minLength":1},"nextPage":{"type":"string","minLength":1},"of":{"type":"string","minLength":1},"oneUp":{"type":"string","minLength":1},"page":{"type":"string","minLength":1},"previous":{"type":"string","minLength":1},"previousImage":{"type":"string","minLength":1},"previousPage":{"type":"string","minLength":1},"settings":{"type":"string","minLength":1},"twoUp":{"type":"string","minLength":1}},"required":["close","emptyValue","first","firstImage","firstPage","folio","gallery","go","help","image","last","lastImage","lastPage","next","nextImage","nextPage","of","oneUp","page","previous","previousImage","previousPage","settings","twoUp"]}},"required":["options","content"]},"seadragonCenterPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"animationTime":{"type":"number"},"autoHideControls":{"type":"boolean"},"attributionEnabled":{"type":"boolean"},"blendTime":{"type":"number"},"constrainDuringPan":{"type":"boolean"},"controlsFadeAfterInactive":{"type":"number"},"controlsFadeDelay":{"type":"number"},"controlsFadeLength":{"type":"number"},"defaultZoomLevel":{"type":"number"},"immediateRender":{"type":"boolean"},"maxZoomPixelRatio":{"type":"number"},"navigatorPosition":{"type":"string","minLength":1},"pageGap":{"type":"number"},"showHomeControl":{"type":"boolean"},"trimAttributionCount":{"type":"number"},"visibilityRatio":{"type":"number"}},"required":["animationTime","autoHideControls","attributionEnabled","blendTime","constrainDuringPan","controlsFadeAfterInactive","controlsFadeDelay","controlsFadeLength","defaultZoomLevel","immediateRender","maxZoomPixelRatio","navigatorPosition","pageGap","showHomeControl","trimAttributionCount","visibilityRatio"]},"content":{"type":"object","properties":{"attribution":{"type":"string","minLength":1},"goHome":{"type":"string","minLength":1},"imageUnavailable":{"type":"string","minLength":1},"next":{"type":"string","minLength":1},"previous":{"type":"string","minLength":1},"rotateRight":{"type":"string","minLength":1},"zoomIn":{"type":"string","minLength":1},"zoomOut":{"type":"string","minLength":1}},"required":["attribution","goHome","imageUnavailable","next","previous","rotateRight","zoomIn","zoomOut"]}},"required":["options","content"]},"searchFooterPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"elideDetailsTermsCount":{"type":"number"},"elideResultsTermsCount":{"type":"number"},"pageModeEnabled":{"type":"boolean"},"positionMarkerEnabled":{"type":"boolean"}},"required":["elideDetailsTermsCount","elideResultsTermsCount","pageModeEnabled","positionMarkerEnabled"]},"content":{"type":"object","properties":{"clearSearch":{"type":"string","minLength":1},"defaultLabel":{"type":"string","minLength":1},"displaying":{"type":"string","minLength":1},"enterKeyword":{"type":"string","minLength":1},"image":{"type":"string","minLength":1},"imageCaps":{"type":"string","minLength":1},"instanceFound":{"type":"string","minLength":1},"instancesFound":{"type":"string","minLength":1},"nextResult":{"type":"string","minLength":1},"page":{"type":"string","minLength":1},"pageCaps":{"type":"string","minLength":1},"previousResult":{"type":"string","minLength":1},"print":{"type":"string","minLength":1},"resultFoundFor":{"type":"string","minLength":1},"resultsFoundFor":{"type":"string","minLength":1},"searchWithin":{"type":"string","minLength":1}},"required":["clearSearch","defaultLabel","displaying","enterKeyword","image","imageCaps","instanceFound","instancesFound","nextResult","page","pageCaps","previousResult","print","resultFoundFor","resultsFoundFor","searchWithin"]}},"required":["options","content"]},"settingsDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"locale":{"type":"string","minLength":1},"navigatorEnabled":{"type":"string","minLength":1},"clickToZoomEnabled":{"type":"string","minLength":1},"pagingEnabled":{"type":"string","minLength":1},"preserveViewport":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"website":{"type":"string","minLength":1}},"required":["locale","navigatorEnabled","clickToZoomEnabled","pagingEnabled","preserveViewport","title","website"]}},"required":["content"]},"shareDialogue":{"type":"object","properties":{"options":{"type":"object","properties":{"embedTemplate":{"type":"string","minLength":1},"instructionsEnabled":{"type":"boolean"},"shareFrameEnabled":{"type":"boolean"}},"required":["embedTemplate","instructionsEnabled","shareFrameEnabled"]},"content":{"type":"object","properties":{"customSize":{"type":"string","minLength":1},"embed":{"type":"string","minLength":1},"embedInstructions":{"type":"string","minLength":1},"height":{"type":"string","minLength":1},"iiif":{"type":"string","minLength":1},"share":{"type":"string","minLength":1},"shareInstructions":{"type":"string","minLength":1},"size":{"type":"string","minLength":1},"width":{"type":"string","minLength":1}},"required":["customSize","embed","embedInstructions","height","iiif","share","shareInstructions","size","width"]}},"required":["options","content"]},"clickThroughDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"viewTerms":{"type":"string","minLength":1}},"required":["viewTerms"]}},"required":["content"]},"loginDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"login":{"type":"string","minLength":1},"logout":{"type":"string","minLength":1},"cancel":{"type":"string","minLength":1}},"required":["login","logout","cancel"]}},"required":["content"]},"mobileFooterPanel":{"type":"object","properties":{"content":{"type":"object","properties":{"rotateRight":{"type":"string","minLength":1},"moreInfo":{"type":"string","minLength":1},"zoomIn":{"type":"string","minLength":1},"zoomOut":{"type":"string","minLength":1}},"required":["rotateRight","moreInfo","zoomIn","zoomOut"]}},"required":["content"]},"restrictedDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"cancel":{"type":"string","minLength":1}},"required":["cancel"]}},"required":["content"]}},"required":["contentLeftPanel","dialogue","downloadDialogue","footerPanel","genericDialogue","headerPanel","helpDialogue","moreInfoRightPanel","multiSelectDialogue","pagingHeaderPanel","seadragonCenterPanel","searchFooterPanel","settingsDialogue","shareDialogue","clickThroughDialogue","loginDialogue","mobileFooterPanel","restrictedDialogue"]},"localisation":{"type":"object","properties":{"label":{"type":"string","minLength":1},"locales":{"type":"array","uniqueItems":true,"minItems":1,"items":{"required":["name","label"],"properties":{"name":{"type":"string","minLength":1},"label":{"type":"string","minLength":1}}}}},"required":["label","locales"]},"content":{"type":"object","properties":{"authCORSError":{"type":"string","minLength":1},"authorisationFailedMessage":{"type":"string","minLength":1},"canvasIndexOutOfRange":{"type":"string","minLength":1},"degradedResourceMessage":{"type":"string","minLength":1},"degradedResourceLogin":{"type":"string","minLength":1},"forbiddenResourceMessage":{"type":"string","minLength":1},"termsOfUse":{"type":"string","minLength":1}},"required":["authCORSError","authorisationFailedMessage","canvasIndexOutOfRange","degradedResourceMessage","degradedResourceLogin","forbiddenResourceMessage","termsOfUse"]}},"required":["options","modules","localisation","content"]} \ No newline at end of file +{"$schema":"http://json-schema.org/draft-04/schema#","description":"","type":"object","properties":{"options":{"type":"object","properties":{"allowStealFocus":{"type":"boolean"},"bookmarkThumbHeight":{"type":"number"},"bookmarkThumbWidth":{"type":"number"},"dropEnabled":{"type":"boolean"},"footerPanelEnabled":{"type":"boolean"},"headerPanelEnabled":{"type":"boolean"},"leftPanelEnabled":{"type":"boolean"},"limitLocales":{"type":"boolean"},"metrics":{"type":"array","uniqueItems":true,"minItems":1,"items":{"required":["type","minWidth","maxWidth"],"properties":{"type":{"type":"string","minLength":1},"minWidth":{"type":"number"},"maxWidth":{"type":"number"}}}},"multiSelectionMimeType":{"type":"string","minLength":1},"navigatorEnabled":{"type":"boolean"},"openTemplate":{"type":"string","minLength":1},"overrideFullScreen":{"type":"boolean"},"pagingEnabled":{"type":"boolean"},"pagingOptionEnabled":{"type":"boolean"},"pessimisticAccessControl":{"type":"boolean"},"preserveViewport":{"type":"boolean"},"rightPanelEnabled":{"type":"boolean"},"ocrRightPanelEnabled":{"type":"boolean"},"saveUserSettings":{"type":"boolean"},"clickToZoomEnabled":{"type":"boolean"},"searchWithinEnabled":{"type":"boolean"},"termsOfUseEnabled":{"type":"boolean"},"theme":{"type":"string","minLength":1},"tokenStorage":{"type":"string","minLength":1},"useArrowKeysToNavigate":{"type":"boolean"},"zoomToSearchResultEnabled":{"type":"boolean"}},"required":["allowStealFocus","bookmarkThumbHeight","bookmarkThumbWidth","dropEnabled","footerPanelEnabled","headerPanelEnabled","leftPanelEnabled","limitLocales","metrics","multiSelectionMimeType","navigatorEnabled","openTemplate","overrideFullScreen","pagingEnabled","pagingOptionEnabled","pessimisticAccessControl","preserveViewport","rightPanelEnabled","ocrRightPanelEnabled","saveUserSettings","clickToZoomEnabled","searchWithinEnabled","termsOfUseEnabled","theme","tokenStorage","useArrowKeysToNavigate","zoomToSearchResultEnabled"]},"modules":{"type":"object","properties":{"contentLeftPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"defaultToTreeEnabled":{"type":"boolean"},"defaultToTreeIfGreaterThan":{"type":"number"},"elideCount":{"type":"number"},"expandFullEnabled":{"type":"boolean"},"galleryThumbChunkedResizingThreshold":{"type":"number"},"galleryThumbHeight":{"type":"number"},"galleryThumbLoadPadding":{"type":"number"},"galleryThumbWidth":{"type":"number"},"oneColThumbHeight":{"type":"number"},"oneColThumbWidth":{"type":"number"},"pageModeEnabled":{"type":"boolean"},"panelAnimationDuration":{"type":"number"},"panelCollapsedWidth":{"type":"number"},"panelExpandedWidth":{"type":"number"},"panelOpen":{"type":"boolean"},"tabOrder":{"type":"string"},"thumbsEnabled":{"type":"boolean"},"thumbsExtraHeight":{"type":"number"},"thumbsImageFadeInDuration":{"type":"number"},"thumbsLoadRange":{"type":"number"},"treeEnabled":{"type":"boolean"},"twoColThumbHeight":{"type":"number"},"twoColThumbWidth":{"type":"number"}},"required":["defaultToTreeEnabled","defaultToTreeIfGreaterThan","elideCount","expandFullEnabled","galleryThumbChunkedResizingThreshold","galleryThumbHeight","galleryThumbLoadPadding","galleryThumbWidth","oneColThumbHeight","oneColThumbWidth","pageModeEnabled","panelAnimationDuration","panelCollapsedWidth","panelExpandedWidth","panelOpen","tabOrder","thumbsEnabled","thumbsExtraHeight","thumbsImageFadeInDuration","thumbsLoadRange","treeEnabled","twoColThumbHeight","twoColThumbWidth"]},"content":{"type":"object","properties":{"collapse":{"type":"string","minLength":1},"collapseFull":{"type":"string","minLength":1},"date":{"type":"string","minLength":1},"expand":{"type":"string","minLength":1},"expandFull":{"type":"string","minLength":1},"index":{"type":"string","minLength":1},"searchResult":{"type":"string","minLength":1},"searchResults":{"type":"string","minLength":1},"sortBy":{"type":"string","minLength":1},"thumbnails":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"volume":{"type":"string","minLength":1}},"required":["collapse","collapseFull","date","expand","expandFull","index","searchResult","searchResults","sortBy","thumbnails","title","volume"]}},"required":["options","content"]},"dialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"close":{"type":"string","minLength":1}},"required":["close"]}},"required":["content"]},"downloadDialogue":{"type":"object","properties":{"options":{"type":"object","properties":{"confinedImageSize":{"type":"number"},"currentViewDisabledPercentage":{"type":"number"},"maxImageWidth":{"type":"number"},"optionsExplanatoryTextEnabled":{"type":"boolean"},"selectionEnabled":{"type":"boolean"}},"required":["confinedImageSize","currentViewDisabledPercentage","maxImageWidth","optionsExplanatoryTextEnabled","selectionEnabled"]},"content":{"type":"object","properties":{"currentViewAsJpg":{"type":"string","minLength":1},"currentViewAsJpgExplanation":{"type":"string","minLength":1},"download":{"type":"string","minLength":1},"downloadSelection":{"type":"string","minLength":1},"downloadSelectionExplanation":{"type":"string","minLength":1},"editSettings":{"type":"string","minLength":1},"entireDocument":{"type":"string","minLength":1},"entireFileAsOriginal":{"type":"string","minLength":1},"noneAvailable":{"type":"string","minLength":1},"pagingNote":{"type":"string","minLength":1},"preview":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"wholeImageHighRes":{"type":"string","minLength":1},"wholeImageHighResExplanation":{"type":"string","minLength":1},"wholeImagesHighRes":{"type":"string","minLength":1},"wholeImagesHighResExplanation":{"type":"string","minLength":1},"wholeImageLowResAsJpg":{"type":"string","minLength":1},"wholeImageLowResAsJpgExplanation":{"type":"string","minLength":1}},"required":["currentViewAsJpg","currentViewAsJpgExplanation","download","downloadSelection","downloadSelectionExplanation","editSettings","entireDocument","entireFileAsOriginal","noneAvailable","pagingNote","preview","title","wholeImageHighRes","wholeImageHighResExplanation","wholeImagesHighRes","wholeImagesHighResExplanation","wholeImageLowResAsJpg","wholeImageLowResAsJpgExplanation"]}},"required":["options","content"]},"footerPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"bookmarkEnabled":{"type":"boolean"},"downloadEnabled":{"type":"boolean"},"embedEnabled":{"type":"boolean"},"feedbackEnabled":{"type":"boolean"},"fullscreenEnabled":{"type":"boolean"},"logoEnabled":{"type":"boolean"},"logoOptions":{"type":"object","properties":{"website":{"type":"string","minLength":1}},"required":["website"]},"minimiseButtons":{"type":"boolean"},"moreInfoEnabled":{"type":"boolean"},"openEnabled":{"type":"boolean"},"printEnabled":{"type":"boolean"},"shareEnabled":{"type":"boolean"}},"required":["bookmarkEnabled","downloadEnabled","embedEnabled","feedbackEnabled","fullscreenEnabled","logoEnabled","logoOptions","minimiseButtons","moreInfoEnabled","openEnabled","printEnabled","shareEnabled"]},"content":{"type":"object","properties":{"bookmark":{"type":"string","minLength":1},"download":{"type":"string","minLength":1},"embed":{"type":"string","minLength":1},"feedback":{"type":"string","minLength":1},"exitFullScreen":{"type":"string","minLength":1},"fullScreen":{"type":"string","minLength":1},"logo":{"type":"string","minLength":1},"open":{"type":"string","minLength":1},"share":{"type":"string","minLength":1}},"required":["bookmark","download","embed","feedback","exitFullScreen","fullScreen","logo","open","share"]}},"required":["options","content"]},"genericDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"emptyValue":{"type":"string","minLength":1},"invalidNumber":{"type":"string","minLength":1},"noMatches":{"type":"string","minLength":1},"ok":{"type":"string","minLength":1},"pageNotFound":{"type":"string","minLength":1},"refresh":{"type":"string","minLength":1}},"required":["emptyValue","invalidNumber","noMatches","ok","pageNotFound","refresh"]}},"required":["content"]},"headerPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"localeToggleEnabled":{"type":"boolean"},"settingsButtonEnabled":{"type":"boolean"}},"required":["localeToggleEnabled","settingsButtonEnabled"]}},"required":["options"]},"helpDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"text":{"type":"string","minLength":1},"title":{"type":"string","minLength":1}},"required":["text","title"]}},"required":["content"]},"moreInfoRightPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"canvasDisplayOrder":{"type":"string"},"canvasExclude":{"type":"string"},"copyToClipboardEnabled":{"type":"boolean"},"manifestDisplayOrder":{"type":"string"},"manifestExclude":{"type":"string"},"panelAnimationDuration":{"type":"number"},"panelCollapsedWidth":{"type":"number"},"panelExpandedWidth":{"type":"number"},"panelOpen":{"type":"boolean"},"rtlLanguageCodes":{"type":"string","minLength":1},"showAllLanguages":{"type":"boolean"},"textLimit":{"type":"number"},"textLimitType":{"type":"string","minLength":1}},"required":["canvasDisplayOrder","canvasExclude","copyToClipboardEnabled","manifestDisplayOrder","manifestExclude","panelAnimationDuration","panelCollapsedWidth","panelExpandedWidth","panelOpen","rtlLanguageCodes","showAllLanguages","textLimit","textLimitType"]},"content":{"type":"object","properties":{"attribution":{"type":"string","minLength":1},"collapse":{"type":"string","minLength":1},"collapseFull":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"expand":{"type":"string","minLength":1},"expandFull":{"type":"string","minLength":1},"holdingText":{"type":"string","minLength":1},"less":{"type":"string","minLength":1},"license":{"type":"string","minLength":1},"logo":{"type":"string","minLength":1},"more":{"type":"string","minLength":1},"noData":{"type":"string","minLength":1},"page":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"manifestHeader":{"type":"string","minLength":1},"canvasHeader":{"type":"string","minLength":1},"copyToClipboard":{"type":"string","minLength":1},"copiedToClipboard":{"type":"string","minLength":1}},"required":["attribution","collapse","collapseFull","description","expand","expandFull","holdingText","less","license","logo","more","noData","page","title","manifestHeader","canvasHeader","copyToClipboard","copiedToClipboard"]}},"required":["options","content"]},"multiSelectDialogue":{"type":"object","properties":{"options":{"type":"object","properties":{"galleryThumbChunkedResizingEnabled":{"type":"boolean"},"galleryThumbChunkedResizingThreshold":{"type":"number"},"galleryThumbHeight":{"type":"number"},"galleryThumbLoadPadding":{"type":"number"},"galleryThumbWidth":{"type":"number"},"pageModeEnabled":{"type":"boolean"}},"required":["galleryThumbChunkedResizingEnabled","galleryThumbChunkedResizingThreshold","galleryThumbHeight","galleryThumbLoadPadding","galleryThumbWidth","pageModeEnabled"]},"content":{"type":"object","properties":{"select":{"type":"string","minLength":1},"selectAll":{"type":"string","minLength":1},"title":{"type":"string","minLength":1}},"required":["select","selectAll","title"]}},"required":["options","content"]},"ocrRightPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"panelAnimationDuration":{"type":"number"},"panelCollapsedWidth":{"type":"number"},"panelExpandedWidth":{"type":"number"},"panelOpen":{"type":"boolean"}},"required":["panelAnimationDuration","panelCollapsedWidth","panelExpandedWidth","panelOpen"]}},"required":["options"]},"pagingHeaderPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"autoCompleteBoxEnabled":{"type":"boolean"},"galleryButtonEnabled":{"type":"boolean"},"imageSelectionBoxEnabled":{"type":"boolean"},"pageModeEnabled":{"type":"boolean"},"pagingToggleEnabled":{"type":"boolean"}},"required":["autoCompleteBoxEnabled","galleryButtonEnabled","imageSelectionBoxEnabled","pageModeEnabled","pagingToggleEnabled"]},"content":{"type":"object","properties":{"close":{"type":"string","minLength":1},"emptyValue":{"type":"string","minLength":1},"first":{"type":"string","minLength":1},"firstImage":{"type":"string","minLength":1},"firstPage":{"type":"string","minLength":1},"folio":{"type":"string","minLength":1},"gallery":{"type":"string","minLength":1},"go":{"type":"string","minLength":1},"help":{"type":"string","minLength":1},"image":{"type":"string","minLength":1},"last":{"type":"string","minLength":1},"lastImage":{"type":"string","minLength":1},"lastPage":{"type":"string","minLength":1},"next":{"type":"string","minLength":1},"nextImage":{"type":"string","minLength":1},"nextPage":{"type":"string","minLength":1},"of":{"type":"string","minLength":1},"oneUp":{"type":"string","minLength":1},"page":{"type":"string","minLength":1},"previous":{"type":"string","minLength":1},"previousImage":{"type":"string","minLength":1},"previousPage":{"type":"string","minLength":1},"settings":{"type":"string","minLength":1},"twoUp":{"type":"string","minLength":1}},"required":["close","emptyValue","first","firstImage","firstPage","folio","gallery","go","help","image","last","lastImage","lastPage","next","nextImage","nextPage","of","oneUp","page","previous","previousImage","previousPage","settings","twoUp"]}},"required":["options","content"]},"seadragonCenterPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"animationTime":{"type":"number"},"autoHideControls":{"type":"boolean"},"attributionEnabled":{"type":"boolean"},"blendTime":{"type":"number"},"constrainDuringPan":{"type":"boolean"},"controlsFadeAfterInactive":{"type":"number"},"controlsFadeDelay":{"type":"number"},"controlsFadeLength":{"type":"number"},"defaultZoomLevel":{"type":"number"},"immediateRender":{"type":"boolean"},"maxZoomPixelRatio":{"type":"number"},"navigatorPosition":{"type":"string","minLength":1},"pageGap":{"type":"number"},"showHomeControl":{"type":"boolean"},"trimAttributionCount":{"type":"number"},"visibilityRatio":{"type":"number"}},"required":["animationTime","autoHideControls","attributionEnabled","blendTime","constrainDuringPan","controlsFadeAfterInactive","controlsFadeDelay","controlsFadeLength","defaultZoomLevel","immediateRender","maxZoomPixelRatio","navigatorPosition","pageGap","showHomeControl","trimAttributionCount","visibilityRatio"]},"content":{"type":"object","properties":{"attribution":{"type":"string","minLength":1},"goHome":{"type":"string","minLength":1},"imageUnavailable":{"type":"string","minLength":1},"next":{"type":"string","minLength":1},"previous":{"type":"string","minLength":1},"rotateRight":{"type":"string","minLength":1},"zoomIn":{"type":"string","minLength":1},"zoomOut":{"type":"string","minLength":1}},"required":["attribution","goHome","imageUnavailable","next","previous","rotateRight","zoomIn","zoomOut"]}},"required":["options","content"]},"searchFooterPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"elideDetailsTermsCount":{"type":"number"},"elideResultsTermsCount":{"type":"number"},"pageModeEnabled":{"type":"boolean"},"positionMarkerEnabled":{"type":"boolean"}},"required":["elideDetailsTermsCount","elideResultsTermsCount","pageModeEnabled","positionMarkerEnabled"]},"content":{"type":"object","properties":{"clearSearch":{"type":"string","minLength":1},"defaultLabel":{"type":"string","minLength":1},"displaying":{"type":"string","minLength":1},"enterKeyword":{"type":"string","minLength":1},"image":{"type":"string","minLength":1},"imageCaps":{"type":"string","minLength":1},"instanceFound":{"type":"string","minLength":1},"instancesFound":{"type":"string","minLength":1},"nextResult":{"type":"string","minLength":1},"page":{"type":"string","minLength":1},"pageCaps":{"type":"string","minLength":1},"previousResult":{"type":"string","minLength":1},"print":{"type":"string","minLength":1},"resultFoundFor":{"type":"string","minLength":1},"resultsFoundFor":{"type":"string","minLength":1},"searchWithin":{"type":"string","minLength":1}},"required":["clearSearch","defaultLabel","displaying","enterKeyword","image","imageCaps","instanceFound","instancesFound","nextResult","page","pageCaps","previousResult","print","resultFoundFor","resultsFoundFor","searchWithin"]}},"required":["options","content"]},"settingsDialogue":{"type":"object","properties":{"options":{"type":"object","properties":{"contributedByEnabled":{"type":"boolean"},"contributedByOptions":{"type":"object","properties":{"contributor":{"type":"string","minLength":1},"website":{"type":"string","minLength":1}},"required":["contributor","website"]},"moreInfo":{"type":"object","properties":{"website":{"type":"string","minLength":1}},"required":["website"]}},"required":["contributedByEnabled","contributedByOptions","moreInfo"]},"content":{"type":"object","properties":{"locale":{"type":"string","minLength":1},"navigatorEnabled":{"type":"string","minLength":1},"clickToZoomEnabled":{"type":"string","minLength":1},"pagingEnabled":{"type":"string","minLength":1},"preserveViewport":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"website":{"type":"string","minLength":1}},"required":["locale","navigatorEnabled","clickToZoomEnabled","pagingEnabled","preserveViewport","title","website"]}},"required":["options","content"]},"shareDialogue":{"type":"object","properties":{"options":{"type":"object","properties":{"embedTemplate":{"type":"string","minLength":1},"instructionsEnabled":{"type":"boolean"},"shareFrameEnabled":{"type":"boolean"}},"required":["embedTemplate","instructionsEnabled","shareFrameEnabled"]},"content":{"type":"object","properties":{"customSize":{"type":"string","minLength":1},"embed":{"type":"string","minLength":1},"embedInstructions":{"type":"string","minLength":1},"height":{"type":"string","minLength":1},"iiif":{"type":"string","minLength":1},"share":{"type":"string","minLength":1},"shareInstructions":{"type":"string","minLength":1},"size":{"type":"string","minLength":1},"width":{"type":"string","minLength":1}},"required":["customSize","embed","embedInstructions","height","iiif","share","shareInstructions","size","width"]}},"required":["options","content"]},"clickThroughDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"viewTerms":{"type":"string","minLength":1}},"required":["viewTerms"]}},"required":["content"]},"loginDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"login":{"type":"string","minLength":1},"logout":{"type":"string","minLength":1},"cancel":{"type":"string","minLength":1}},"required":["login","logout","cancel"]}},"required":["content"]},"mobileFooterPanel":{"type":"object","properties":{"content":{"type":"object","properties":{"rotateRight":{"type":"string","minLength":1},"moreInfo":{"type":"string","minLength":1},"zoomIn":{"type":"string","minLength":1},"zoomOut":{"type":"string","minLength":1}},"required":["rotateRight","moreInfo","zoomIn","zoomOut"]}},"required":["content"]},"restrictedDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"cancel":{"type":"string","minLength":1}},"required":["cancel"]}},"required":["content"]}},"required":["contentLeftPanel","dialogue","downloadDialogue","footerPanel","genericDialogue","headerPanel","helpDialogue","moreInfoRightPanel","multiSelectDialogue","ocrRightPanel","pagingHeaderPanel","seadragonCenterPanel","searchFooterPanel","settingsDialogue","shareDialogue","clickThroughDialogue","loginDialogue","mobileFooterPanel","restrictedDialogue"]},"localisation":{"type":"object","properties":{"label":{"type":"string","minLength":1},"locales":{"type":"array","uniqueItems":true,"minItems":1,"items":{"required":["name","label"],"properties":{"name":{"type":"string","minLength":1},"label":{"type":"string","minLength":1}}}}},"required":["label","locales"]},"content":{"type":"object","properties":{"authCORSError":{"type":"string","minLength":1},"authorisationFailedMessage":{"type":"string","minLength":1},"canvasIndexOutOfRange":{"type":"string","minLength":1},"degradedResourceMessage":{"type":"string","minLength":1},"degradedResourceLogin":{"type":"string","minLength":1},"forbiddenResourceMessage":{"type":"string","minLength":1},"termsOfUse":{"type":"string","minLength":1}},"required":["authCORSError","authorisationFailedMessage","canvasIndexOutOfRange","degradedResourceMessage","degradedResourceLogin","forbiddenResourceMessage","termsOfUse"]}},"required":["options","modules","localisation","content"]} \ No newline at end of file diff --git a/dist/uv-2.0.1/schema/uv-seadragon-extension.en-GB.schema.json b/dist/uv-2.0.1/schema/uv-seadragon-extension.en-GB.schema.json index da598b928..a7f269e4a 100644 --- a/dist/uv-2.0.1/schema/uv-seadragon-extension.en-GB.schema.json +++ b/dist/uv-2.0.1/schema/uv-seadragon-extension.en-GB.schema.json @@ -1 +1 @@ -{"$schema":"http://json-schema.org/draft-04/schema#","description":"","type":"object","properties":{"options":{"type":"object","properties":{"allowStealFocus":{"type":"boolean"},"bookmarkThumbHeight":{"type":"number"},"bookmarkThumbWidth":{"type":"number"},"dropEnabled":{"type":"boolean"},"footerPanelEnabled":{"type":"boolean"},"headerPanelEnabled":{"type":"boolean"},"leftPanelEnabled":{"type":"boolean"},"limitLocales":{"type":"boolean"},"metrics":{"type":"array","uniqueItems":true,"minItems":1,"items":{"required":["type","minWidth","maxWidth"],"properties":{"type":{"type":"string","minLength":1},"minWidth":{"type":"number"},"maxWidth":{"type":"number"}}}},"multiSelectionMimeType":{"type":"string","minLength":1},"navigatorEnabled":{"type":"boolean"},"openTemplate":{"type":"string","minLength":1},"overrideFullScreen":{"type":"boolean"},"pagingEnabled":{"type":"boolean"},"pagingOptionEnabled":{"type":"boolean"},"pessimisticAccessControl":{"type":"boolean"},"preserveViewport":{"type":"boolean"},"rightPanelEnabled":{"type":"boolean"},"saveUserSettings":{"type":"boolean"},"clickToZoomEnabled":{"type":"boolean"},"searchWithinEnabled":{"type":"boolean"},"termsOfUseEnabled":{"type":"boolean"},"theme":{"type":"string","minLength":1},"tokenStorage":{"type":"string","minLength":1},"useArrowKeysToNavigate":{"type":"boolean"},"zoomToSearchResultEnabled":{"type":"boolean"}},"required":["allowStealFocus","bookmarkThumbHeight","bookmarkThumbWidth","dropEnabled","footerPanelEnabled","headerPanelEnabled","leftPanelEnabled","limitLocales","metrics","multiSelectionMimeType","navigatorEnabled","openTemplate","overrideFullScreen","pagingEnabled","pagingOptionEnabled","pessimisticAccessControl","preserveViewport","rightPanelEnabled","saveUserSettings","clickToZoomEnabled","searchWithinEnabled","termsOfUseEnabled","theme","tokenStorage","useArrowKeysToNavigate","zoomToSearchResultEnabled"]},"modules":{"type":"object","properties":{"contentLeftPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"defaultToTreeEnabled":{"type":"boolean"},"defaultToTreeIfGreaterThan":{"type":"number"},"elideCount":{"type":"number"},"expandFullEnabled":{"type":"boolean"},"galleryThumbChunkedResizingThreshold":{"type":"number"},"galleryThumbHeight":{"type":"number"},"galleryThumbLoadPadding":{"type":"number"},"galleryThumbWidth":{"type":"number"},"oneColThumbHeight":{"type":"number"},"oneColThumbWidth":{"type":"number"},"pageModeEnabled":{"type":"boolean"},"panelAnimationDuration":{"type":"number"},"panelCollapsedWidth":{"type":"number"},"panelExpandedWidth":{"type":"number"},"panelOpen":{"type":"boolean"},"tabOrder":{"type":"string"},"thumbsEnabled":{"type":"boolean"},"thumbsExtraHeight":{"type":"number"},"thumbsImageFadeInDuration":{"type":"number"},"thumbsLoadRange":{"type":"number"},"treeEnabled":{"type":"boolean"},"twoColThumbHeight":{"type":"number"},"twoColThumbWidth":{"type":"number"}},"required":["defaultToTreeEnabled","defaultToTreeIfGreaterThan","elideCount","expandFullEnabled","galleryThumbChunkedResizingThreshold","galleryThumbHeight","galleryThumbLoadPadding","galleryThumbWidth","oneColThumbHeight","oneColThumbWidth","pageModeEnabled","panelAnimationDuration","panelCollapsedWidth","panelExpandedWidth","panelOpen","tabOrder","thumbsEnabled","thumbsExtraHeight","thumbsImageFadeInDuration","thumbsLoadRange","treeEnabled","twoColThumbHeight","twoColThumbWidth"]},"content":{"type":"object","properties":{"collapse":{"type":"string","minLength":1},"collapseFull":{"type":"string","minLength":1},"date":{"type":"string","minLength":1},"expand":{"type":"string","minLength":1},"expandFull":{"type":"string","minLength":1},"index":{"type":"string","minLength":1},"searchResult":{"type":"string","minLength":1},"searchResults":{"type":"string","minLength":1},"sortBy":{"type":"string","minLength":1},"thumbnails":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"volume":{"type":"string","minLength":1}},"required":["collapse","collapseFull","date","expand","expandFull","index","searchResult","searchResults","sortBy","thumbnails","title","volume"]}},"required":["options","content"]},"dialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"close":{"type":"string","minLength":1}},"required":["close"]}},"required":["content"]},"downloadDialogue":{"type":"object","properties":{"options":{"type":"object","properties":{"confinedImageSize":{"type":"number"},"currentViewDisabledPercentage":{"type":"number"},"maxImageWidth":{"type":"number"},"optionsExplanatoryTextEnabled":{"type":"boolean"},"selectionEnabled":{"type":"boolean"}},"required":["confinedImageSize","currentViewDisabledPercentage","maxImageWidth","optionsExplanatoryTextEnabled","selectionEnabled"]},"content":{"type":"object","properties":{"currentViewAsJpg":{"type":"string","minLength":1},"currentViewAsJpgExplanation":{"type":"string","minLength":1},"download":{"type":"string","minLength":1},"downloadSelection":{"type":"string","minLength":1},"downloadSelectionExplanation":{"type":"string","minLength":1},"editSettings":{"type":"string","minLength":1},"entireDocument":{"type":"string","minLength":1},"entireFileAsOriginal":{"type":"string","minLength":1},"noneAvailable":{"type":"string","minLength":1},"pagingNote":{"type":"string","minLength":1},"preview":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"wholeImageHighRes":{"type":"string","minLength":1},"wholeImageHighResExplanation":{"type":"string","minLength":1},"wholeImagesHighRes":{"type":"string","minLength":1},"wholeImagesHighResExplanation":{"type":"string","minLength":1},"wholeImageLowResAsJpg":{"type":"string","minLength":1},"wholeImageLowResAsJpgExplanation":{"type":"string","minLength":1}},"required":["currentViewAsJpg","currentViewAsJpgExplanation","download","downloadSelection","downloadSelectionExplanation","editSettings","entireDocument","entireFileAsOriginal","noneAvailable","pagingNote","preview","title","wholeImageHighRes","wholeImageHighResExplanation","wholeImagesHighRes","wholeImagesHighResExplanation","wholeImageLowResAsJpg","wholeImageLowResAsJpgExplanation"]}},"required":["options","content"]},"footerPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"bookmarkEnabled":{"type":"boolean"},"downloadEnabled":{"type":"boolean"},"embedEnabled":{"type":"boolean"},"feedbackEnabled":{"type":"boolean"},"fullscreenEnabled":{"type":"boolean"},"minimiseButtons":{"type":"boolean"},"moreInfoEnabled":{"type":"boolean"},"openEnabled":{"type":"boolean"},"printEnabled":{"type":"boolean"},"shareEnabled":{"type":"boolean"}},"required":["bookmarkEnabled","downloadEnabled","embedEnabled","feedbackEnabled","fullscreenEnabled","minimiseButtons","moreInfoEnabled","openEnabled","printEnabled","shareEnabled"]},"content":{"type":"object","properties":{"bookmark":{"type":"string","minLength":1},"download":{"type":"string","minLength":1},"embed":{"type":"string","minLength":1},"feedback":{"type":"string","minLength":1},"exitFullScreen":{"type":"string","minLength":1},"fullScreen":{"type":"string","minLength":1},"open":{"type":"string","minLength":1},"share":{"type":"string","minLength":1}},"required":["bookmark","download","embed","feedback","exitFullScreen","fullScreen","open","share"]}},"required":["options","content"]},"genericDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"emptyValue":{"type":"string","minLength":1},"invalidNumber":{"type":"string","minLength":1},"noMatches":{"type":"string","minLength":1},"ok":{"type":"string","minLength":1},"pageNotFound":{"type":"string","minLength":1},"refresh":{"type":"string","minLength":1}},"required":["emptyValue","invalidNumber","noMatches","ok","pageNotFound","refresh"]}},"required":["content"]},"headerPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"localeToggleEnabled":{"type":"boolean"},"settingsButtonEnabled":{"type":"boolean"}},"required":["localeToggleEnabled","settingsButtonEnabled"]}},"required":["options"]},"helpDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"text":{"type":"string","minLength":1},"title":{"type":"string","minLength":1}},"required":["text","title"]}},"required":["content"]},"moreInfoRightPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"canvasDisplayOrder":{"type":"string"},"canvasExclude":{"type":"string"},"copyToClipboardEnabled":{"type":"boolean"},"manifestDisplayOrder":{"type":"string"},"manifestExclude":{"type":"string"},"panelAnimationDuration":{"type":"number"},"panelCollapsedWidth":{"type":"number"},"panelExpandedWidth":{"type":"number"},"panelOpen":{"type":"boolean"},"rtlLanguageCodes":{"type":"string","minLength":1},"showAllLanguages":{"type":"boolean"},"textLimit":{"type":"number"},"textLimitType":{"type":"string","minLength":1}},"required":["canvasDisplayOrder","canvasExclude","copyToClipboardEnabled","manifestDisplayOrder","manifestExclude","panelAnimationDuration","panelCollapsedWidth","panelExpandedWidth","panelOpen","rtlLanguageCodes","showAllLanguages","textLimit","textLimitType"]},"content":{"type":"object","properties":{"attribution":{"type":"string","minLength":1},"collapse":{"type":"string","minLength":1},"collapseFull":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"expand":{"type":"string","minLength":1},"expandFull":{"type":"string","minLength":1},"holdingText":{"type":"string","minLength":1},"less":{"type":"string","minLength":1},"license":{"type":"string","minLength":1},"logo":{"type":"string","minLength":1},"more":{"type":"string","minLength":1},"noData":{"type":"string","minLength":1},"page":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"manifestHeader":{"type":"string","minLength":1},"canvasHeader":{"type":"string","minLength":1},"copyToClipboard":{"type":"string","minLength":1},"copiedToClipboard":{"type":"string","minLength":1}},"required":["attribution","collapse","collapseFull","description","expand","expandFull","holdingText","less","license","logo","more","noData","page","title","manifestHeader","canvasHeader","copyToClipboard","copiedToClipboard"]}},"required":["options","content"]},"multiSelectDialogue":{"type":"object","properties":{"options":{"type":"object","properties":{"galleryThumbChunkedResizingEnabled":{"type":"boolean"},"galleryThumbChunkedResizingThreshold":{"type":"number"},"galleryThumbHeight":{"type":"number"},"galleryThumbLoadPadding":{"type":"number"},"galleryThumbWidth":{"type":"number"},"pageModeEnabled":{"type":"boolean"}},"required":["galleryThumbChunkedResizingEnabled","galleryThumbChunkedResizingThreshold","galleryThumbHeight","galleryThumbLoadPadding","galleryThumbWidth","pageModeEnabled"]},"content":{"type":"object","properties":{"select":{"type":"string","minLength":1},"selectAll":{"type":"string","minLength":1},"title":{"type":"string","minLength":1}},"required":["select","selectAll","title"]}},"required":["options","content"]},"pagingHeaderPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"autoCompleteBoxEnabled":{"type":"boolean"},"galleryButtonEnabled":{"type":"boolean"},"imageSelectionBoxEnabled":{"type":"boolean"},"pageModeEnabled":{"type":"boolean"},"pagingToggleEnabled":{"type":"boolean"}},"required":["autoCompleteBoxEnabled","galleryButtonEnabled","imageSelectionBoxEnabled","pageModeEnabled","pagingToggleEnabled"]},"content":{"type":"object","properties":{"close":{"type":"string","minLength":1},"emptyValue":{"type":"string","minLength":1},"first":{"type":"string","minLength":1},"firstImage":{"type":"string","minLength":1},"firstPage":{"type":"string","minLength":1},"folio":{"type":"string","minLength":1},"gallery":{"type":"string","minLength":1},"go":{"type":"string","minLength":1},"help":{"type":"string","minLength":1},"image":{"type":"string","minLength":1},"last":{"type":"string","minLength":1},"lastImage":{"type":"string","minLength":1},"lastPage":{"type":"string","minLength":1},"next":{"type":"string","minLength":1},"nextImage":{"type":"string","minLength":1},"nextPage":{"type":"string","minLength":1},"of":{"type":"string","minLength":1},"oneUp":{"type":"string","minLength":1},"page":{"type":"string","minLength":1},"previous":{"type":"string","minLength":1},"previousImage":{"type":"string","minLength":1},"previousPage":{"type":"string","minLength":1},"settings":{"type":"string","minLength":1},"twoUp":{"type":"string","minLength":1}},"required":["close","emptyValue","first","firstImage","firstPage","folio","gallery","go","help","image","last","lastImage","lastPage","next","nextImage","nextPage","of","oneUp","page","previous","previousImage","previousPage","settings","twoUp"]}},"required":["options","content"]},"seadragonCenterPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"animationTime":{"type":"number"},"autoHideControls":{"type":"boolean"},"attributionEnabled":{"type":"boolean"},"blendTime":{"type":"number"},"constrainDuringPan":{"type":"boolean"},"controlsFadeAfterInactive":{"type":"number"},"controlsFadeDelay":{"type":"number"},"controlsFadeLength":{"type":"number"},"defaultZoomLevel":{"type":"number"},"immediateRender":{"type":"boolean"},"maxZoomPixelRatio":{"type":"number"},"navigatorPosition":{"type":"string","minLength":1},"pageGap":{"type":"number"},"showHomeControl":{"type":"boolean"},"trimAttributionCount":{"type":"number"},"visibilityRatio":{"type":"number"}},"required":["animationTime","autoHideControls","attributionEnabled","blendTime","constrainDuringPan","controlsFadeAfterInactive","controlsFadeDelay","controlsFadeLength","defaultZoomLevel","immediateRender","maxZoomPixelRatio","navigatorPosition","pageGap","showHomeControl","trimAttributionCount","visibilityRatio"]},"content":{"type":"object","properties":{"attribution":{"type":"string","minLength":1},"goHome":{"type":"string","minLength":1},"imageUnavailable":{"type":"string","minLength":1},"next":{"type":"string","minLength":1},"previous":{"type":"string","minLength":1},"rotateRight":{"type":"string","minLength":1},"zoomIn":{"type":"string","minLength":1},"zoomOut":{"type":"string","minLength":1}},"required":["attribution","goHome","imageUnavailable","next","previous","rotateRight","zoomIn","zoomOut"]}},"required":["options","content"]},"searchFooterPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"elideDetailsTermsCount":{"type":"number"},"elideResultsTermsCount":{"type":"number"},"pageModeEnabled":{"type":"boolean"},"positionMarkerEnabled":{"type":"boolean"}},"required":["elideDetailsTermsCount","elideResultsTermsCount","pageModeEnabled","positionMarkerEnabled"]},"content":{"type":"object","properties":{"clearSearch":{"type":"string","minLength":1},"defaultLabel":{"type":"string","minLength":1},"displaying":{"type":"string","minLength":1},"enterKeyword":{"type":"string","minLength":1},"image":{"type":"string","minLength":1},"imageCaps":{"type":"string","minLength":1},"instanceFound":{"type":"string","minLength":1},"instancesFound":{"type":"string","minLength":1},"nextResult":{"type":"string","minLength":1},"page":{"type":"string","minLength":1},"pageCaps":{"type":"string","minLength":1},"previousResult":{"type":"string","minLength":1},"print":{"type":"string","minLength":1},"resultFoundFor":{"type":"string","minLength":1},"resultsFoundFor":{"type":"string","minLength":1},"searchWithin":{"type":"string","minLength":1}},"required":["clearSearch","defaultLabel","displaying","enterKeyword","image","imageCaps","instanceFound","instancesFound","nextResult","page","pageCaps","previousResult","print","resultFoundFor","resultsFoundFor","searchWithin"]}},"required":["options","content"]},"settingsDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"locale":{"type":"string","minLength":1},"navigatorEnabled":{"type":"string","minLength":1},"clickToZoomEnabled":{"type":"string","minLength":1},"pagingEnabled":{"type":"string","minLength":1},"preserveViewport":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"website":{"type":"string","minLength":1}},"required":["locale","navigatorEnabled","clickToZoomEnabled","pagingEnabled","preserveViewport","title","website"]}},"required":["content"]},"shareDialogue":{"type":"object","properties":{"options":{"type":"object","properties":{"embedTemplate":{"type":"string","minLength":1},"instructionsEnabled":{"type":"boolean"},"shareFrameEnabled":{"type":"boolean"}},"required":["embedTemplate","instructionsEnabled","shareFrameEnabled"]},"content":{"type":"object","properties":{"customSize":{"type":"string","minLength":1},"embed":{"type":"string","minLength":1},"embedInstructions":{"type":"string","minLength":1},"height":{"type":"string","minLength":1},"iiif":{"type":"string","minLength":1},"share":{"type":"string","minLength":1},"shareInstructions":{"type":"string","minLength":1},"size":{"type":"string","minLength":1},"width":{"type":"string","minLength":1}},"required":["customSize","embed","embedInstructions","height","iiif","share","shareInstructions","size","width"]}},"required":["options","content"]},"clickThroughDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"viewTerms":{"type":"string","minLength":1}},"required":["viewTerms"]}},"required":["content"]},"loginDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"login":{"type":"string","minLength":1},"logout":{"type":"string","minLength":1},"cancel":{"type":"string","minLength":1}},"required":["login","logout","cancel"]}},"required":["content"]},"mobileFooterPanel":{"type":"object","properties":{"content":{"type":"object","properties":{"rotateRight":{"type":"string","minLength":1},"moreInfo":{"type":"string","minLength":1},"zoomIn":{"type":"string","minLength":1},"zoomOut":{"type":"string","minLength":1}},"required":["rotateRight","moreInfo","zoomIn","zoomOut"]}},"required":["content"]},"restrictedDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"cancel":{"type":"string","minLength":1}},"required":["cancel"]}},"required":["content"]}},"required":["contentLeftPanel","dialogue","downloadDialogue","footerPanel","genericDialogue","headerPanel","helpDialogue","moreInfoRightPanel","multiSelectDialogue","pagingHeaderPanel","seadragonCenterPanel","searchFooterPanel","settingsDialogue","shareDialogue","clickThroughDialogue","loginDialogue","mobileFooterPanel","restrictedDialogue"]},"localisation":{"type":"object","properties":{"label":{"type":"string","minLength":1},"locales":{"type":"array","uniqueItems":true,"minItems":1,"items":{"required":["name","label"],"properties":{"name":{"type":"string","minLength":1},"label":{"type":"string","minLength":1}}}}},"required":["label","locales"]},"content":{"type":"object","properties":{"authCORSError":{"type":"string","minLength":1},"authorisationFailedMessage":{"type":"string","minLength":1},"canvasIndexOutOfRange":{"type":"string","minLength":1},"degradedResourceMessage":{"type":"string","minLength":1},"degradedResourceLogin":{"type":"string","minLength":1},"forbiddenResourceMessage":{"type":"string","minLength":1},"termsOfUse":{"type":"string","minLength":1}},"required":["authCORSError","authorisationFailedMessage","canvasIndexOutOfRange","degradedResourceMessage","degradedResourceLogin","forbiddenResourceMessage","termsOfUse"]}},"required":["options","modules","localisation","content"]} \ No newline at end of file +{"$schema":"http://json-schema.org/draft-04/schema#","description":"","type":"object","properties":{"options":{"type":"object","properties":{"allowStealFocus":{"type":"boolean"},"bookmarkThumbHeight":{"type":"number"},"bookmarkThumbWidth":{"type":"number"},"dropEnabled":{"type":"boolean"},"footerPanelEnabled":{"type":"boolean"},"headerPanelEnabled":{"type":"boolean"},"leftPanelEnabled":{"type":"boolean"},"limitLocales":{"type":"boolean"},"metrics":{"type":"array","uniqueItems":true,"minItems":1,"items":{"required":["type","minWidth","maxWidth"],"properties":{"type":{"type":"string","minLength":1},"minWidth":{"type":"number"},"maxWidth":{"type":"number"}}}},"multiSelectionMimeType":{"type":"string","minLength":1},"navigatorEnabled":{"type":"boolean"},"openTemplate":{"type":"string","minLength":1},"overrideFullScreen":{"type":"boolean"},"pagingEnabled":{"type":"boolean"},"pagingOptionEnabled":{"type":"boolean"},"pessimisticAccessControl":{"type":"boolean"},"preserveViewport":{"type":"boolean"},"rightPanelEnabled":{"type":"boolean"},"ocrRightPanelEnabled":{"type":"boolean"},"saveUserSettings":{"type":"boolean"},"clickToZoomEnabled":{"type":"boolean"},"searchWithinEnabled":{"type":"boolean"},"termsOfUseEnabled":{"type":"boolean"},"theme":{"type":"string","minLength":1},"tokenStorage":{"type":"string","minLength":1},"useArrowKeysToNavigate":{"type":"boolean"},"zoomToSearchResultEnabled":{"type":"boolean"}},"required":["allowStealFocus","bookmarkThumbHeight","bookmarkThumbWidth","dropEnabled","footerPanelEnabled","headerPanelEnabled","leftPanelEnabled","limitLocales","metrics","multiSelectionMimeType","navigatorEnabled","openTemplate","overrideFullScreen","pagingEnabled","pagingOptionEnabled","pessimisticAccessControl","preserveViewport","rightPanelEnabled","ocrRightPanelEnabled","saveUserSettings","clickToZoomEnabled","searchWithinEnabled","termsOfUseEnabled","theme","tokenStorage","useArrowKeysToNavigate","zoomToSearchResultEnabled"]},"modules":{"type":"object","properties":{"contentLeftPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"defaultToTreeEnabled":{"type":"boolean"},"defaultToTreeIfGreaterThan":{"type":"number"},"elideCount":{"type":"number"},"expandFullEnabled":{"type":"boolean"},"galleryThumbChunkedResizingThreshold":{"type":"number"},"galleryThumbHeight":{"type":"number"},"galleryThumbLoadPadding":{"type":"number"},"galleryThumbWidth":{"type":"number"},"oneColThumbHeight":{"type":"number"},"oneColThumbWidth":{"type":"number"},"pageModeEnabled":{"type":"boolean"},"panelAnimationDuration":{"type":"number"},"panelCollapsedWidth":{"type":"number"},"panelExpandedWidth":{"type":"number"},"panelOpen":{"type":"boolean"},"tabOrder":{"type":"string"},"thumbsEnabled":{"type":"boolean"},"thumbsExtraHeight":{"type":"number"},"thumbsImageFadeInDuration":{"type":"number"},"thumbsLoadRange":{"type":"number"},"treeEnabled":{"type":"boolean"},"twoColThumbHeight":{"type":"number"},"twoColThumbWidth":{"type":"number"}},"required":["defaultToTreeEnabled","defaultToTreeIfGreaterThan","elideCount","expandFullEnabled","galleryThumbChunkedResizingThreshold","galleryThumbHeight","galleryThumbLoadPadding","galleryThumbWidth","oneColThumbHeight","oneColThumbWidth","pageModeEnabled","panelAnimationDuration","panelCollapsedWidth","panelExpandedWidth","panelOpen","tabOrder","thumbsEnabled","thumbsExtraHeight","thumbsImageFadeInDuration","thumbsLoadRange","treeEnabled","twoColThumbHeight","twoColThumbWidth"]},"content":{"type":"object","properties":{"collapse":{"type":"string","minLength":1},"collapseFull":{"type":"string","minLength":1},"date":{"type":"string","minLength":1},"expand":{"type":"string","minLength":1},"expandFull":{"type":"string","minLength":1},"index":{"type":"string","minLength":1},"searchResult":{"type":"string","minLength":1},"searchResults":{"type":"string","minLength":1},"sortBy":{"type":"string","minLength":1},"thumbnails":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"volume":{"type":"string","minLength":1}},"required":["collapse","collapseFull","date","expand","expandFull","index","searchResult","searchResults","sortBy","thumbnails","title","volume"]}},"required":["options","content"]},"dialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"close":{"type":"string","minLength":1}},"required":["close"]}},"required":["content"]},"downloadDialogue":{"type":"object","properties":{"options":{"type":"object","properties":{"confinedImageSize":{"type":"number"},"currentViewDisabledPercentage":{"type":"number"},"maxImageWidth":{"type":"number"},"optionsExplanatoryTextEnabled":{"type":"boolean"},"selectionEnabled":{"type":"boolean"}},"required":["confinedImageSize","currentViewDisabledPercentage","maxImageWidth","optionsExplanatoryTextEnabled","selectionEnabled"]},"content":{"type":"object","properties":{"currentViewAsJpg":{"type":"string","minLength":1},"currentViewAsJpgExplanation":{"type":"string","minLength":1},"download":{"type":"string","minLength":1},"downloadSelection":{"type":"string","minLength":1},"downloadSelectionExplanation":{"type":"string","minLength":1},"editSettings":{"type":"string","minLength":1},"entireDocument":{"type":"string","minLength":1},"entireFileAsOriginal":{"type":"string","minLength":1},"noneAvailable":{"type":"string","minLength":1},"pagingNote":{"type":"string","minLength":1},"preview":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"wholeImageHighRes":{"type":"string","minLength":1},"wholeImageHighResExplanation":{"type":"string","minLength":1},"wholeImagesHighRes":{"type":"string","minLength":1},"wholeImagesHighResExplanation":{"type":"string","minLength":1},"wholeImageLowResAsJpg":{"type":"string","minLength":1},"wholeImageLowResAsJpgExplanation":{"type":"string","minLength":1}},"required":["currentViewAsJpg","currentViewAsJpgExplanation","download","downloadSelection","downloadSelectionExplanation","editSettings","entireDocument","entireFileAsOriginal","noneAvailable","pagingNote","preview","title","wholeImageHighRes","wholeImageHighResExplanation","wholeImagesHighRes","wholeImagesHighResExplanation","wholeImageLowResAsJpg","wholeImageLowResAsJpgExplanation"]}},"required":["options","content"]},"footerPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"bookmarkEnabled":{"type":"boolean"},"downloadEnabled":{"type":"boolean"},"embedEnabled":{"type":"boolean"},"feedbackEnabled":{"type":"boolean"},"fullscreenEnabled":{"type":"boolean"},"logoEnabled":{"type":"boolean"},"logoOptions":{"type":"object","properties":{"website":{"type":"string","minLength":1}},"required":["website"]},"minimiseButtons":{"type":"boolean"},"moreInfoEnabled":{"type":"boolean"},"openEnabled":{"type":"boolean"},"printEnabled":{"type":"boolean"},"shareEnabled":{"type":"boolean"}},"required":["bookmarkEnabled","downloadEnabled","embedEnabled","feedbackEnabled","fullscreenEnabled","logoEnabled","logoOptions","minimiseButtons","moreInfoEnabled","openEnabled","printEnabled","shareEnabled"]},"content":{"type":"object","properties":{"bookmark":{"type":"string","minLength":1},"download":{"type":"string","minLength":1},"embed":{"type":"string","minLength":1},"feedback":{"type":"string","minLength":1},"exitFullScreen":{"type":"string","minLength":1},"fullScreen":{"type":"string","minLength":1},"logo":{"type":"string","minLength":1},"open":{"type":"string","minLength":1},"share":{"type":"string","minLength":1}},"required":["bookmark","download","embed","feedback","exitFullScreen","fullScreen","logo","open","share"]}},"required":["options","content"]},"genericDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"emptyValue":{"type":"string","minLength":1},"invalidNumber":{"type":"string","minLength":1},"noMatches":{"type":"string","minLength":1},"ok":{"type":"string","minLength":1},"pageNotFound":{"type":"string","minLength":1},"refresh":{"type":"string","minLength":1},"wrongSelection":{"type":"string","minLength":1}},"required":["emptyValue","invalidNumber","noMatches","ok","pageNotFound","refresh","wrongSelection"]}},"required":["content"]},"headerPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"localeToggleEnabled":{"type":"boolean"},"settingsButtonEnabled":{"type":"boolean"}},"required":["localeToggleEnabled","settingsButtonEnabled"]}},"required":["options"]},"helpDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"text":{"type":"string","minLength":1},"title":{"type":"string","minLength":1}},"required":["text","title"]}},"required":["content"]},"moreInfoRightPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"canvasDisplayOrder":{"type":"string"},"canvasExclude":{"type":"string"},"copyToClipboardEnabled":{"type":"boolean"},"manifestDisplayOrder":{"type":"string"},"manifestExclude":{"type":"string"},"panelAnimationDuration":{"type":"number"},"panelCollapsedWidth":{"type":"number"},"panelExpandedWidth":{"type":"number"},"panelOpen":{"type":"boolean"},"rtlLanguageCodes":{"type":"string","minLength":1},"showAllLanguages":{"type":"boolean"},"textLimit":{"type":"number"},"textLimitType":{"type":"string","minLength":1}},"required":["canvasDisplayOrder","canvasExclude","copyToClipboardEnabled","manifestDisplayOrder","manifestExclude","panelAnimationDuration","panelCollapsedWidth","panelExpandedWidth","panelOpen","rtlLanguageCodes","showAllLanguages","textLimit","textLimitType"]},"content":{"type":"object","properties":{"attribution":{"type":"string","minLength":1},"collapse":{"type":"string","minLength":1},"collapseFull":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"expand":{"type":"string","minLength":1},"expandFull":{"type":"string","minLength":1},"holdingText":{"type":"string","minLength":1},"less":{"type":"string","minLength":1},"license":{"type":"string","minLength":1},"logo":{"type":"string","minLength":1},"more":{"type":"string","minLength":1},"noData":{"type":"string","minLength":1},"page":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"manifestHeader":{"type":"string","minLength":1},"canvasHeader":{"type":"string","minLength":1},"copyToClipboard":{"type":"string","minLength":1},"copiedToClipboard":{"type":"string","minLength":1}},"required":["attribution","collapse","collapseFull","description","expand","expandFull","holdingText","less","license","logo","more","noData","page","title","manifestHeader","canvasHeader","copyToClipboard","copiedToClipboard"]}},"required":["options","content"]},"multiSelectDialogue":{"type":"object","properties":{"options":{"type":"object","properties":{"galleryThumbChunkedResizingEnabled":{"type":"boolean"},"galleryThumbChunkedResizingThreshold":{"type":"number"},"galleryThumbHeight":{"type":"number"},"galleryThumbLoadPadding":{"type":"number"},"galleryThumbWidth":{"type":"number"},"pageModeEnabled":{"type":"boolean"}},"required":["galleryThumbChunkedResizingEnabled","galleryThumbChunkedResizingThreshold","galleryThumbHeight","galleryThumbLoadPadding","galleryThumbWidth","pageModeEnabled"]},"content":{"type":"object","properties":{"select":{"type":"string","minLength":1},"selectAll":{"type":"string","minLength":1},"title":{"type":"string","minLength":1}},"required":["select","selectAll","title"]}},"required":["options","content"]},"ocrRightPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"panelAnimationDuration":{"type":"number"},"panelCollapsedWidth":{"type":"number"},"panelExpandedWidth":{"type":"number"},"panelOpen":{"type":"boolean"}},"required":["panelAnimationDuration","panelCollapsedWidth","panelExpandedWidth","panelOpen"]},"content":{"type":"object","properties":{"clearSelection":{"type":"string","minLength":1},"collapse":{"type":"string","minLength":1},"expand":{"type":"string","minLength":1},"title":{"type":"string","minLength":1}},"required":["clearSelection","collapse","expand","title"]}},"required":["options","content"]},"pagingHeaderPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"autoCompleteBoxEnabled":{"type":"boolean"},"galleryButtonEnabled":{"type":"boolean"},"imageSelectionBoxEnabled":{"type":"boolean"},"pageModeEnabled":{"type":"boolean"},"pagingToggleEnabled":{"type":"boolean"}},"required":["autoCompleteBoxEnabled","galleryButtonEnabled","imageSelectionBoxEnabled","pageModeEnabled","pagingToggleEnabled"]},"content":{"type":"object","properties":{"close":{"type":"string","minLength":1},"emptyValue":{"type":"string","minLength":1},"first":{"type":"string","minLength":1},"firstImage":{"type":"string","minLength":1},"firstPage":{"type":"string","minLength":1},"folio":{"type":"string","minLength":1},"gallery":{"type":"string","minLength":1},"go":{"type":"string","minLength":1},"help":{"type":"string","minLength":1},"image":{"type":"string","minLength":1},"last":{"type":"string","minLength":1},"lastImage":{"type":"string","minLength":1},"lastPage":{"type":"string","minLength":1},"next":{"type":"string","minLength":1},"nextImage":{"type":"string","minLength":1},"nextPage":{"type":"string","minLength":1},"of":{"type":"string","minLength":1},"oneUp":{"type":"string","minLength":1},"page":{"type":"string","minLength":1},"previous":{"type":"string","minLength":1},"previousImage":{"type":"string","minLength":1},"previousPage":{"type":"string","minLength":1},"settings":{"type":"string","minLength":1},"twoUp":{"type":"string","minLength":1}},"required":["close","emptyValue","first","firstImage","firstPage","folio","gallery","go","help","image","last","lastImage","lastPage","next","nextImage","nextPage","of","oneUp","page","previous","previousImage","previousPage","settings","twoUp"]}},"required":["options","content"]},"seadragonCenterPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"animationTime":{"type":"number"},"autoHideControls":{"type":"boolean"},"attributionEnabled":{"type":"boolean"},"blendTime":{"type":"number"},"constrainDuringPan":{"type":"boolean"},"controlsFadeAfterInactive":{"type":"number"},"controlsFadeDelay":{"type":"number"},"controlsFadeLength":{"type":"number"},"defaultZoomLevel":{"type":"number"},"immediateRender":{"type":"boolean"},"maxZoomPixelRatio":{"type":"number"},"navigatorPosition":{"type":"string","minLength":1},"pageGap":{"type":"number"},"showHomeControl":{"type":"boolean"},"trimAttributionCount":{"type":"number"},"visibilityRatio":{"type":"number"}},"required":["animationTime","autoHideControls","attributionEnabled","blendTime","constrainDuringPan","controlsFadeAfterInactive","controlsFadeDelay","controlsFadeLength","defaultZoomLevel","immediateRender","maxZoomPixelRatio","navigatorPosition","pageGap","showHomeControl","trimAttributionCount","visibilityRatio"]},"content":{"type":"object","properties":{"attribution":{"type":"string","minLength":1},"goHome":{"type":"string","minLength":1},"imageUnavailable":{"type":"string","minLength":1},"next":{"type":"string","minLength":1},"previous":{"type":"string","minLength":1},"rotateRight":{"type":"string","minLength":1},"zoomIn":{"type":"string","minLength":1},"zoomOut":{"type":"string","minLength":1}},"required":["attribution","goHome","imageUnavailable","next","previous","rotateRight","zoomIn","zoomOut"]}},"required":["options","content"]},"searchFooterPanel":{"type":"object","properties":{"options":{"type":"object","properties":{"elideDetailsTermsCount":{"type":"number"},"elideResultsTermsCount":{"type":"number"},"pageModeEnabled":{"type":"boolean"},"positionMarkerEnabled":{"type":"boolean"}},"required":["elideDetailsTermsCount","elideResultsTermsCount","pageModeEnabled","positionMarkerEnabled"]},"content":{"type":"object","properties":{"clearSearch":{"type":"string","minLength":1},"defaultLabel":{"type":"string","minLength":1},"displaying":{"type":"string","minLength":1},"enterKeyword":{"type":"string","minLength":1},"image":{"type":"string","minLength":1},"imageCaps":{"type":"string","minLength":1},"instanceFound":{"type":"string","minLength":1},"instancesFound":{"type":"string","minLength":1},"nextResult":{"type":"string","minLength":1},"page":{"type":"string","minLength":1},"pageCaps":{"type":"string","minLength":1},"previousResult":{"type":"string","minLength":1},"print":{"type":"string","minLength":1},"resultFoundFor":{"type":"string","minLength":1},"resultsFoundFor":{"type":"string","minLength":1},"searchWithin":{"type":"string","minLength":1}},"required":["clearSearch","defaultLabel","displaying","enterKeyword","image","imageCaps","instanceFound","instancesFound","nextResult","page","pageCaps","previousResult","print","resultFoundFor","resultsFoundFor","searchWithin"]}},"required":["options","content"]},"settingsDialogue":{"type":"object","properties":{"options":{"type":"object","properties":{"contributedByEnabled":{"type":"boolean"},"contributedByOptions":{"type":"object","properties":{"contributor":{"type":"string","minLength":1},"website":{"type":"string","minLength":1}},"required":["contributor","website"]},"moreInfo":{"type":"object","properties":{"website":{"type":"string","minLength":1}},"required":["website"]}},"required":["contributedByEnabled","contributedByOptions","moreInfo"]},"content":{"type":"object","properties":{"locale":{"type":"string","minLength":1},"navigatorEnabled":{"type":"string","minLength":1},"clickToZoomEnabled":{"type":"string","minLength":1},"contributedBy":{"type":"string","minLength":1},"pagingEnabled":{"type":"string","minLength":1},"preserveViewport":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"website":{"type":"string","minLength":1}},"required":["locale","navigatorEnabled","clickToZoomEnabled","contributedBy","pagingEnabled","preserveViewport","title","website"]}},"required":["options","content"]},"shareDialogue":{"type":"object","properties":{"options":{"type":"object","properties":{"embedTemplate":{"type":"string","minLength":1},"instructionsEnabled":{"type":"boolean"},"shareFrameEnabled":{"type":"boolean"}},"required":["embedTemplate","instructionsEnabled","shareFrameEnabled"]},"content":{"type":"object","properties":{"customSize":{"type":"string","minLength":1},"embed":{"type":"string","minLength":1},"embedInstructions":{"type":"string","minLength":1},"height":{"type":"string","minLength":1},"iiif":{"type":"string","minLength":1},"share":{"type":"string","minLength":1},"shareInstructions":{"type":"string","minLength":1},"size":{"type":"string","minLength":1},"width":{"type":"string","minLength":1}},"required":["customSize","embed","embedInstructions","height","iiif","share","shareInstructions","size","width"]}},"required":["options","content"]},"clickThroughDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"viewTerms":{"type":"string","minLength":1}},"required":["viewTerms"]}},"required":["content"]},"loginDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"login":{"type":"string","minLength":1},"logout":{"type":"string","minLength":1},"cancel":{"type":"string","minLength":1}},"required":["login","logout","cancel"]}},"required":["content"]},"mobileFooterPanel":{"type":"object","properties":{"content":{"type":"object","properties":{"rotateRight":{"type":"string","minLength":1},"moreInfo":{"type":"string","minLength":1},"zoomIn":{"type":"string","minLength":1},"zoomOut":{"type":"string","minLength":1}},"required":["rotateRight","moreInfo","zoomIn","zoomOut"]}},"required":["content"]},"restrictedDialogue":{"type":"object","properties":{"content":{"type":"object","properties":{"cancel":{"type":"string","minLength":1}},"required":["cancel"]}},"required":["content"]}},"required":["contentLeftPanel","dialogue","downloadDialogue","footerPanel","genericDialogue","headerPanel","helpDialogue","moreInfoRightPanel","multiSelectDialogue","ocrRightPanel","pagingHeaderPanel","seadragonCenterPanel","searchFooterPanel","settingsDialogue","shareDialogue","clickThroughDialogue","loginDialogue","mobileFooterPanel","restrictedDialogue"]},"localisation":{"type":"object","properties":{"label":{"type":"string","minLength":1},"locales":{"type":"array","uniqueItems":true,"minItems":1,"items":{"required":["name","label"],"properties":{"name":{"type":"string","minLength":1},"label":{"type":"string","minLength":1}}}}},"required":["label","locales"]},"content":{"type":"object","properties":{"authCORSError":{"type":"string","minLength":1},"authorisationFailedMessage":{"type":"string","minLength":1},"canvasIndexOutOfRange":{"type":"string","minLength":1},"degradedResourceMessage":{"type":"string","minLength":1},"degradedResourceLogin":{"type":"string","minLength":1},"forbiddenResourceMessage":{"type":"string","minLength":1},"termsOfUse":{"type":"string","minLength":1}},"required":["authCORSError","authorisationFailedMessage","canvasIndexOutOfRange","degradedResourceMessage","degradedResourceLogin","forbiddenResourceMessage","termsOfUse"]}},"required":["options","modules","localisation","content"]} \ No newline at end of file diff --git a/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-mediaelement-extension/theme.css b/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-mediaelement-extension/theme.css index 50ac78810..6ff496210 100644 --- a/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-mediaelement-extension/theme.css +++ b/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-mediaelement-extension/theme.css @@ -2189,6 +2189,13 @@ input[type=range]:focus::-ms-fill-upper { cursor: pointer; left: 35px; } +#app .rightPanel .top .clearSel { + position: absolute; + height: 20px; + margin-top: 9px; + cursor: pointer; + right: 5px; +} #app .rightPanel .top .collapseButton { position: absolute; background: url('../../img/uv-shared-module/arrows_right.png') no-repeat; @@ -2243,6 +2250,10 @@ input[type=range]:focus::-ms-fill-upper { margin-right: 10px; margin-bottom: 10px; } +#app .rightPanel .main .wordHighlightDiv { + padding-left: 5px; + padding-right: 5px; +} #app.browser-Explorer.browser-version-8 .rightPanel .closed .title { writing-mode: tb-lr; } @@ -2462,6 +2473,27 @@ input[type=range]:focus::-ms-fill-upper { color: #fff; text-decoration: none; } +#app .footerPanel .options a.logo { + background-image: url('../../img/footer_logo.png'); + background-repeat: no-repeat; + height: 21px; + line-height: 21px; + cursor: pointer; + color: #fff; + text-decoration: none; + background-position: left center; + padding-left: 0; + padding-right: 10px; + line-height: 22px; + position: absolute; +} +#app .footerPanel .options a.logo:link, +#app .footerPanel .options a.logo:visited, +#app .footerPanel .options a.logo:hover, +#app .footerPanel .options a.logo:active { + color: #fff; + text-decoration: none; +} #app .footerPanel .options a.print { background-image: url('../../img/uv-shared-module/print.png'); background-repeat: no-repeat; @@ -2586,6 +2618,16 @@ input[type=range]:focus::-ms-fill-upper { width: 27px; padding: 0; } +#app .footerPanel .options.minimiseButtons a.logo { + font: 0/0 a; + text-shadow: none; + background-color: transparent; + border: 0; + line-height: 0; + font-size: 0; + color: transparent; + padding: 0; +} #app .footerPanel .options.minimiseButtons a.print { font: 0/0 a; text-shadow: none; diff --git a/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-pdf-extension/theme.css b/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-pdf-extension/theme.css index 16b526a15..5aef72b24 100644 --- a/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-pdf-extension/theme.css +++ b/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-pdf-extension/theme.css @@ -3045,6 +3045,13 @@ input[type=range]:focus::-ms-fill-upper { cursor: pointer; left: 35px; } +#app .rightPanel .top .clearSel { + position: absolute; + height: 20px; + margin-top: 9px; + cursor: pointer; + right: 5px; +} #app .rightPanel .top .collapseButton { position: absolute; background: url('../../img/uv-shared-module/arrows_right.png') no-repeat; @@ -3099,6 +3106,10 @@ input[type=range]:focus::-ms-fill-upper { margin-right: 10px; margin-bottom: 10px; } +#app .rightPanel .main .wordHighlightDiv { + padding-left: 5px; + padding-right: 5px; +} #app.browser-Explorer.browser-version-8 .rightPanel .closed .title { writing-mode: tb-lr; } @@ -3318,6 +3329,27 @@ input[type=range]:focus::-ms-fill-upper { color: #fff; text-decoration: none; } +#app .footerPanel .options a.logo { + background-image: url('../../img/footer_logo.png'); + background-repeat: no-repeat; + height: 21px; + line-height: 21px; + cursor: pointer; + color: #fff; + text-decoration: none; + background-position: left center; + padding-left: 0; + padding-right: 10px; + line-height: 22px; + position: absolute; +} +#app .footerPanel .options a.logo:link, +#app .footerPanel .options a.logo:visited, +#app .footerPanel .options a.logo:hover, +#app .footerPanel .options a.logo:active { + color: #fff; + text-decoration: none; +} #app .footerPanel .options a.print { background-image: url('../../img/uv-shared-module/print.png'); background-repeat: no-repeat; @@ -3442,6 +3474,16 @@ input[type=range]:focus::-ms-fill-upper { width: 27px; padding: 0; } +#app .footerPanel .options.minimiseButtons a.logo { + font: 0/0 a; + text-shadow: none; + background-color: transparent; + border: 0; + line-height: 0; + font-size: 0; + color: transparent; + padding: 0; +} #app .footerPanel .options.minimiseButtons a.print { font: 0/0 a; text-shadow: none; diff --git a/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-seadragon-extension/theme.css b/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-seadragon-extension/theme.css index 6a9083ff0..00a512ca2 100644 --- a/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-seadragon-extension/theme.css +++ b/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-seadragon-extension/theme.css @@ -2075,6 +2075,13 @@ input[type=range]:focus::-ms-fill-upper { cursor: pointer; left: 35px; } +#app .rightPanel .top .clearSel { + position: absolute; + height: 20px; + margin-top: 9px; + cursor: pointer; + right: 5px; +} #app .rightPanel .top .collapseButton { position: absolute; background: url('../../img/uv-shared-module/arrows_right.png') no-repeat; @@ -2129,6 +2136,10 @@ input[type=range]:focus::-ms-fill-upper { margin-right: 10px; margin-bottom: 10px; } +#app .rightPanel .main .wordHighlightDiv { + padding-left: 5px; + padding-right: 5px; +} #app.browser-Explorer.browser-version-8 .rightPanel .closed .title { writing-mode: tb-lr; } @@ -2348,6 +2359,27 @@ input[type=range]:focus::-ms-fill-upper { color: #fff; text-decoration: none; } +#app .footerPanel .options a.logo { + background-image: url('../../img/footer_logo.png'); + background-repeat: no-repeat; + height: 21px; + line-height: 21px; + cursor: pointer; + color: #fff; + text-decoration: none; + background-position: left center; + padding-left: 0; + padding-right: 10px; + line-height: 22px; + position: absolute; +} +#app .footerPanel .options a.logo:link, +#app .footerPanel .options a.logo:visited, +#app .footerPanel .options a.logo:hover, +#app .footerPanel .options a.logo:active { + color: #fff; + text-decoration: none; +} #app .footerPanel .options a.print { background-image: url('../../img/uv-shared-module/print.png'); background-repeat: no-repeat; @@ -2472,6 +2504,16 @@ input[type=range]:focus::-ms-fill-upper { width: 27px; padding: 0; } +#app .footerPanel .options.minimiseButtons a.logo { + font: 0/0 a; + text-shadow: none; + background-color: transparent; + border: 0; + line-height: 0; + font-size: 0; + color: transparent; + padding: 0; +} #app .footerPanel .options.minimiseButtons a.print { font: 0/0 a; text-shadow: none; diff --git a/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-virtex-extension/theme.css b/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-virtex-extension/theme.css index d1d158f35..42c6df525 100644 --- a/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-virtex-extension/theme.css +++ b/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-virtex-extension/theme.css @@ -1466,6 +1466,13 @@ input[type=range]:focus::-ms-fill-upper { cursor: pointer; left: 35px; } +#app .rightPanel .top .clearSel { + position: absolute; + height: 20px; + margin-top: 9px; + cursor: pointer; + right: 5px; +} #app .rightPanel .top .collapseButton { position: absolute; background: url('../../img/uv-shared-module/arrows_right.png') no-repeat; @@ -1520,6 +1527,10 @@ input[type=range]:focus::-ms-fill-upper { margin-right: 10px; margin-bottom: 10px; } +#app .rightPanel .main .wordHighlightDiv { + padding-left: 5px; + padding-right: 5px; +} #app.browser-Explorer.browser-version-8 .rightPanel .closed .title { writing-mode: tb-lr; } @@ -1739,6 +1750,27 @@ input[type=range]:focus::-ms-fill-upper { color: #fff; text-decoration: none; } +#app .footerPanel .options a.logo { + background-image: url('../../img/footer_logo.png'); + background-repeat: no-repeat; + height: 21px; + line-height: 21px; + cursor: pointer; + color: #fff; + text-decoration: none; + background-position: left center; + padding-left: 0; + padding-right: 10px; + line-height: 22px; + position: absolute; +} +#app .footerPanel .options a.logo:link, +#app .footerPanel .options a.logo:visited, +#app .footerPanel .options a.logo:hover, +#app .footerPanel .options a.logo:active { + color: #fff; + text-decoration: none; +} #app .footerPanel .options a.print { background-image: url('../../img/uv-shared-module/print.png'); background-repeat: no-repeat; @@ -1863,6 +1895,16 @@ input[type=range]:focus::-ms-fill-upper { width: 27px; padding: 0; } +#app .footerPanel .options.minimiseButtons a.logo { + font: 0/0 a; + text-shadow: none; + background-color: transparent; + border: 0; + line-height: 0; + font-size: 0; + color: transparent; + padding: 0; +} #app .footerPanel .options.minimiseButtons a.print { font: 0/0 a; text-shadow: none; diff --git a/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/footer_logo.png b/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/footer_logo.png new file mode 100644 index 000000000..4ee3ff378 Binary files /dev/null and b/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/footer_logo.png differ diff --git a/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-ocrrightpanel-module/copy.png b/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-ocrrightpanel-module/copy.png new file mode 100644 index 000000000..0e64490c4 Binary files /dev/null and b/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-ocrrightpanel-module/copy.png differ diff --git a/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-mediaelement-extension/theme.css b/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-mediaelement-extension/theme.css index a207fe947..c70b14929 100644 --- a/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-mediaelement-extension/theme.css +++ b/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-mediaelement-extension/theme.css @@ -2189,6 +2189,13 @@ input[type=range]:focus::-ms-fill-upper { cursor: pointer; left: 35px; } +#app .rightPanel .top .clearSel { + position: absolute; + height: 20px; + margin-top: 9px; + cursor: pointer; + right: 5px; +} #app .rightPanel .top .collapseButton { position: absolute; background: url('../../img/uv-shared-module/arrows_right.png') no-repeat; @@ -2243,6 +2250,10 @@ input[type=range]:focus::-ms-fill-upper { margin-right: 10px; margin-bottom: 10px; } +#app .rightPanel .main .wordHighlightDiv { + padding-left: 5px; + padding-right: 5px; +} #app.browser-Explorer.browser-version-8 .rightPanel .closed .title { writing-mode: tb-lr; } @@ -2462,6 +2473,27 @@ input[type=range]:focus::-ms-fill-upper { color: #fff; text-decoration: none; } +#app .footerPanel .options a.logo { + background-image: url('../../img/footer_logo.png'); + background-repeat: no-repeat; + height: 21px; + line-height: 21px; + cursor: pointer; + color: #fff; + text-decoration: none; + background-position: left center; + padding-left: 0; + padding-right: 10px; + line-height: 22px; + position: absolute; +} +#app .footerPanel .options a.logo:link, +#app .footerPanel .options a.logo:visited, +#app .footerPanel .options a.logo:hover, +#app .footerPanel .options a.logo:active { + color: #fff; + text-decoration: none; +} #app .footerPanel .options a.print { background-image: url('../../img/uv-shared-module/print.png'); background-repeat: no-repeat; @@ -2586,6 +2618,16 @@ input[type=range]:focus::-ms-fill-upper { width: 27px; padding: 0; } +#app .footerPanel .options.minimiseButtons a.logo { + font: 0/0 a; + text-shadow: none; + background-color: transparent; + border: 0; + line-height: 0; + font-size: 0; + color: transparent; + padding: 0; +} #app .footerPanel .options.minimiseButtons a.print { font: 0/0 a; text-shadow: none; diff --git a/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-pdf-extension/theme.css b/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-pdf-extension/theme.css index 00b175d67..9bfba42fe 100644 --- a/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-pdf-extension/theme.css +++ b/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-pdf-extension/theme.css @@ -3045,6 +3045,13 @@ input[type=range]:focus::-ms-fill-upper { cursor: pointer; left: 35px; } +#app .rightPanel .top .clearSel { + position: absolute; + height: 20px; + margin-top: 9px; + cursor: pointer; + right: 5px; +} #app .rightPanel .top .collapseButton { position: absolute; background: url('../../img/uv-shared-module/arrows_right.png') no-repeat; @@ -3099,6 +3106,10 @@ input[type=range]:focus::-ms-fill-upper { margin-right: 10px; margin-bottom: 10px; } +#app .rightPanel .main .wordHighlightDiv { + padding-left: 5px; + padding-right: 5px; +} #app.browser-Explorer.browser-version-8 .rightPanel .closed .title { writing-mode: tb-lr; } @@ -3318,6 +3329,27 @@ input[type=range]:focus::-ms-fill-upper { color: #fff; text-decoration: none; } +#app .footerPanel .options a.logo { + background-image: url('../../img/footer_logo.png'); + background-repeat: no-repeat; + height: 21px; + line-height: 21px; + cursor: pointer; + color: #fff; + text-decoration: none; + background-position: left center; + padding-left: 0; + padding-right: 10px; + line-height: 22px; + position: absolute; +} +#app .footerPanel .options a.logo:link, +#app .footerPanel .options a.logo:visited, +#app .footerPanel .options a.logo:hover, +#app .footerPanel .options a.logo:active { + color: #fff; + text-decoration: none; +} #app .footerPanel .options a.print { background-image: url('../../img/uv-shared-module/print.png'); background-repeat: no-repeat; @@ -3442,6 +3474,16 @@ input[type=range]:focus::-ms-fill-upper { width: 27px; padding: 0; } +#app .footerPanel .options.minimiseButtons a.logo { + font: 0/0 a; + text-shadow: none; + background-color: transparent; + border: 0; + line-height: 0; + font-size: 0; + color: transparent; + padding: 0; +} #app .footerPanel .options.minimiseButtons a.print { font: 0/0 a; text-shadow: none; diff --git a/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-seadragon-extension/theme.css b/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-seadragon-extension/theme.css index 0c39ef957..e64f0771b 100644 --- a/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-seadragon-extension/theme.css +++ b/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-seadragon-extension/theme.css @@ -2075,6 +2075,13 @@ input[type=range]:focus::-ms-fill-upper { cursor: pointer; left: 35px; } +#app .rightPanel .top .clearSel { + position: absolute; + height: 20px; + margin-top: 9px; + cursor: pointer; + right: 5px; +} #app .rightPanel .top .collapseButton { position: absolute; background: url('../../img/uv-shared-module/arrows_right.png') no-repeat; @@ -2129,6 +2136,10 @@ input[type=range]:focus::-ms-fill-upper { margin-right: 10px; margin-bottom: 10px; } +#app .rightPanel .main .wordHighlightDiv { + padding-left: 5px; + padding-right: 5px; +} #app.browser-Explorer.browser-version-8 .rightPanel .closed .title { writing-mode: tb-lr; } @@ -2348,6 +2359,27 @@ input[type=range]:focus::-ms-fill-upper { color: #fff; text-decoration: none; } +#app .footerPanel .options a.logo { + background-image: url('../../img/footer_logo.png'); + background-repeat: no-repeat; + height: 21px; + line-height: 21px; + cursor: pointer; + color: #fff; + text-decoration: none; + background-position: left center; + padding-left: 0; + padding-right: 10px; + line-height: 22px; + position: absolute; +} +#app .footerPanel .options a.logo:link, +#app .footerPanel .options a.logo:visited, +#app .footerPanel .options a.logo:hover, +#app .footerPanel .options a.logo:active { + color: #fff; + text-decoration: none; +} #app .footerPanel .options a.print { background-image: url('../../img/uv-shared-module/print.png'); background-repeat: no-repeat; @@ -2472,6 +2504,16 @@ input[type=range]:focus::-ms-fill-upper { width: 27px; padding: 0; } +#app .footerPanel .options.minimiseButtons a.logo { + font: 0/0 a; + text-shadow: none; + background-color: transparent; + border: 0; + line-height: 0; + font-size: 0; + color: transparent; + padding: 0; +} #app .footerPanel .options.minimiseButtons a.print { font: 0/0 a; text-shadow: none; diff --git a/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-virtex-extension/theme.css b/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-virtex-extension/theme.css index 0daab7cd8..cb3b59580 100644 --- a/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-virtex-extension/theme.css +++ b/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-virtex-extension/theme.css @@ -1466,6 +1466,13 @@ input[type=range]:focus::-ms-fill-upper { cursor: pointer; left: 35px; } +#app .rightPanel .top .clearSel { + position: absolute; + height: 20px; + margin-top: 9px; + cursor: pointer; + right: 5px; +} #app .rightPanel .top .collapseButton { position: absolute; background: url('../../img/uv-shared-module/arrows_right.png') no-repeat; @@ -1520,6 +1527,10 @@ input[type=range]:focus::-ms-fill-upper { margin-right: 10px; margin-bottom: 10px; } +#app .rightPanel .main .wordHighlightDiv { + padding-left: 5px; + padding-right: 5px; +} #app.browser-Explorer.browser-version-8 .rightPanel .closed .title { writing-mode: tb-lr; } @@ -1739,6 +1750,27 @@ input[type=range]:focus::-ms-fill-upper { color: #fff; text-decoration: none; } +#app .footerPanel .options a.logo { + background-image: url('../../img/footer_logo.png'); + background-repeat: no-repeat; + height: 21px; + line-height: 21px; + cursor: pointer; + color: #fff; + text-decoration: none; + background-position: left center; + padding-left: 0; + padding-right: 10px; + line-height: 22px; + position: absolute; +} +#app .footerPanel .options a.logo:link, +#app .footerPanel .options a.logo:visited, +#app .footerPanel .options a.logo:hover, +#app .footerPanel .options a.logo:active { + color: #fff; + text-decoration: none; +} #app .footerPanel .options a.print { background-image: url('../../img/uv-shared-module/print.png'); background-repeat: no-repeat; @@ -1863,6 +1895,16 @@ input[type=range]:focus::-ms-fill-upper { width: 27px; padding: 0; } +#app .footerPanel .options.minimiseButtons a.logo { + font: 0/0 a; + text-shadow: none; + background-color: transparent; + border: 0; + line-height: 0; + font-size: 0; + color: transparent; + padding: 0; +} #app .footerPanel .options.minimiseButtons a.print { font: 0/0 a; text-shadow: none; diff --git a/dist/uv-2.0.1/themes/uv-en-GB-theme/img/footer_logo.png b/dist/uv-2.0.1/themes/uv-en-GB-theme/img/footer_logo.png new file mode 100644 index 000000000..4ee3ff378 Binary files /dev/null and b/dist/uv-2.0.1/themes/uv-en-GB-theme/img/footer_logo.png differ diff --git a/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-ocrrightpanel-module/copy.png b/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-ocrrightpanel-module/copy.png new file mode 100644 index 000000000..0e64490c4 Binary files /dev/null and b/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-ocrrightpanel-module/copy.png differ diff --git a/examples b/examples index a108e3dd2..a04f04128 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit a108e3dd2540fc1f3ee355c3f1382f13bd20433a +Subproject commit a04f04128b320749df03232ba5ea271ba097a13e diff --git a/src/extensions/uv-seadragon-extension/Commands.ts b/src/extensions/uv-seadragon-extension/Commands.ts index de526e9f4..d4f45e2fc 100644 --- a/src/extensions/uv-seadragon-extension/Commands.ts +++ b/src/extensions/uv-seadragon-extension/Commands.ts @@ -2,6 +2,8 @@ class Commands { static namespace: string = 'seadragonExtension.'; static CLEAR_SEARCH: string = Commands.namespace + 'onClearSearch'; + static CLEAR_SEARCH_PANEL: string = Commands.namespace + 'onClearSearchPanel'; + static CLEAR_OCR_PANEL: string = Commands.namespace + 'onClearOcrPanel'; static CURRENT_VIEW_URI: string = Commands.namespace + 'onCurrentViewUri'; static FIRST: string = Commands.namespace + 'onFirst'; static GALLERY_DECREASE_SIZE: string = Commands.namespace + 'onGalleryDecreaseSize'; @@ -31,6 +33,7 @@ class Commands { static SEADRAGON_OPEN: string = Commands.namespace + 'onOpen'; static SEADRAGON_RESIZE: string = Commands.namespace + 'onResize'; static SEADRAGON_ROTATION: string = Commands.namespace + 'onRotation'; + static SEARCH_IN_CANVAS: string = Commands.namespace + 'onSearchInCanvas'; static SEARCH_PREVIEW_FINISH: string = Commands.namespace + 'onSearchPreviewFinish'; static SEARCH_PREVIEW_START: string = Commands.namespace + 'onSearchPreviewStart'; static SEARCH_RESULT_CANVAS_CHANGED: string = Commands.namespace + 'onSearchResultCanvasChanged'; diff --git a/src/extensions/uv-seadragon-extension/Extension.ts b/src/extensions/uv-seadragon-extension/Extension.ts index 3bdf45f28..ba25227a0 100644 --- a/src/extensions/uv-seadragon-extension/Extension.ts +++ b/src/extensions/uv-seadragon-extension/Extension.ts @@ -22,6 +22,7 @@ import MoreInfoDialogue = require("../../modules/uv-dialogues-module/MoreInfoDia import MoreInfoRightPanel = require("../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel"); import MultiSelectDialogue = require("../../modules/uv-multiselectdialogue-module/MultiSelectDialogue"); import MultiSelectionArgs = require("./MultiSelectionArgs"); +import OcrRightPanel = require("../../modules/uv-ocrrightpanel-module/OcrRightPanel"); import PagingHeaderPanel = require("../../modules/uv-pagingheaderpanel-module/PagingHeaderPanel"); import Params = require("../../Params"); import Point = require("../../modules/uv-shared-module/Point"); @@ -58,6 +59,7 @@ class Extension extends BaseExtension implements ISeadragonExtension { mode: Mode; moreInfoDialogue: MoreInfoDialogue; multiSelectDialogue: MultiSelectDialogue; + ocrRightPanel: OcrRightPanel; previousSearchResultRect: SearchResultRect; rightPanel: MoreInfoRightPanel; searchResults: SearchResult[] = []; @@ -89,6 +91,7 @@ class Extension extends BaseExtension implements ISeadragonExtension { this.searchResults = null; $.publish(Commands.SEARCH_RESULTS_CLEARED); this.triggerSocket(Commands.CLEAR_SEARCH); + //this.clearSearch(); }); $.subscribe(BaseCommands.DOWN_ARROW, (e) => { @@ -289,6 +292,11 @@ class Extension extends BaseExtension implements ISeadragonExtension { this.searchWithin(terms); }); + $.subscribe(Commands.SEARCH_IN_CANVAS, (e, obj) => { + this.triggerSocket(Commands.SEARCH_IN_CANVAS, obj); + this.searchWithinCanvas(obj.terms); + }); + $.subscribe(Commands.SEARCH_PREVIEW_FINISH, (e) => { this.triggerSocket(Commands.SEARCH_PREVIEW_FINISH); }); @@ -360,6 +368,12 @@ class Extension extends BaseExtension implements ISeadragonExtension { this.centerPanel = new SeadragonCenterPanel(Shell.$centerPanel); + if (this.isOcrRightPanelEnabled()){ + this.ocrRightPanel = new OcrRightPanel(Shell.$ocrRightPanel); + } else { + Shell.$ocrRightPanel.hide(); + } + if (this.isRightPanelEnabled()){ this.rightPanel = new MoreInfoRightPanel(Shell.$rightPanel); } else { @@ -409,6 +423,10 @@ class Extension extends BaseExtension implements ISeadragonExtension { this.leftPanel.init(); } + if (this.isOcrRightPanelEnabled()){ + this.ocrRightPanel.init(); + } + if (this.isRightPanelEnabled()){ this.rightPanel.init(); } @@ -868,6 +886,18 @@ class Extension extends BaseExtension implements ISeadragonExtension { return true; } + isOcrRightPanelEnabled(): boolean { + if (!Utils.Bools.getBool(this.config.options.ocrRightPanelEnabled, false)){ + return false; + } + + if (!this.getOcrService()) { + return false; + } + + return true; + } + isPagingSettingEnabled(): boolean { if (this.helper.isPagingAvailable()){ return this.getSettings().pagingEnabled; @@ -913,6 +943,30 @@ class Extension extends BaseExtension implements ISeadragonExtension { return service.id + '?q={0}'; } + getOcrService(): Manifesto.IService { + var services: Manifesto.IService[] = this.helper.manifest.getServices(); + + var findService = false; + for (var i = 0; i < services.length; i++) { + var service: Manifesto.IService = services[i]; + var profile = service.getProfile().value; + + if (_.includes(profile, '/api/ocr/')) { + findService = true; + } + } + + if (!findService) return null; + + return service; + } + + getOcrServiceUri(): string{ + var service = this.getOcrService(); + if (!service) return null; + return service.id; + } + getSearchWithinServiceUri(): string { const service: Manifesto.IService = this.helper.getSearchWithinService(); @@ -977,6 +1031,70 @@ class Extension extends BaseExtension implements ISeadragonExtension { }); } + searchWithinCanvas(terms): void { + + if (this.isSearching) return; + + this.isSearching = true; + + // clear search results + this.searchResults = []; + + const that = this; + + this.getSearchWithinCanvasResults(terms, this.searchResults, (results: SearchResult[]) => { + + this.isSearching = false; + + if (results.length) { + this.searchResults = results.sort((a, b) => { + return a.canvasIndex - b.canvasIndex; + }); + + $.publish(Commands.SEARCH_RESULTS_EMPTY); + + // reload current index as it may contain results. + that.viewPage(that.helper.canvasIndex, true); + } else { + that.showMessage(that.config.modules.genericDialogue.content.noMatches, () => { + $.publish(Commands.SEARCH_RESULTS_EMPTY); + }); + } + }); + } + + getSearchWithinCanvasResults(terms: any, + searchResults: SearchResult[], + cb: (results: SearchResult[]) => void): void { + + const that = this; + let results = {resources : Array()}; + + let canvasId = this.helper.getCurrentCanvas().id; + + for (let i = 0; i < terms.length; i++) { + let xywh = $('#'+terms[i].id).attr('data-xywh'); + let text = $('#'+terms[i].id).html(); + + let termObj = { + '@type' : 'oa:Annotation', + motivation : 'sc:painting', + on: canvasId + '#xywh=' + xywh, + resource : { + '@type' : 'cnt:ContentAsText', + chars : text + } + }; + results.resources.push(termObj); + } + + if (results.resources && results.resources.length) { + searchResults = searchResults.concat(this.parseSearchJson(results, searchResults)); + } + + cb(searchResults); + } + parseSearchJson(resultsToParse: any, searchResults: SearchResult[]): SearchResult[] { const parsedResults: SearchResult[] = []; diff --git a/src/extensions/uv-seadragon-extension/ISeadragonExtension.ts b/src/extensions/uv-seadragon-extension/ISeadragonExtension.ts index 5266937a0..d838f76e8 100644 --- a/src/extensions/uv-seadragon-extension/ISeadragonExtension.ts +++ b/src/extensions/uv-seadragon-extension/ISeadragonExtension.ts @@ -19,6 +19,8 @@ interface ISeadragonExtension extends IExtension{ getLastSearchResultRectIndex(): number; getMode(): Mode; getNextPageIndex(index?: number): number; + getOcrService(): Manifesto.IService; + getOcrServiceUri(): string; getPrevPageIndex(index?: number): number; getSearchResultRects(): SearchResultRect[]; getSearchWithinServiceUri(): string; @@ -27,11 +29,12 @@ interface ISeadragonExtension extends IExtension{ getViewerRotation(): number; getViewportBounds(): string; isFirstSearchResultRect(): boolean; + isOcrRightPanelEnabled(): boolean; isPagingSettingEnabled(): boolean; isSearchWithinEnabled(): boolean; previousSearchResultRect: SearchResultRect; searchResults: SearchResult[]; - searchWithin(terms: string, callback: (results: any) => void): void; + searchWithin(terms: string, callback: (results: any) => void): void; } export = ISeadragonExtension; \ No newline at end of file diff --git a/src/extensions/uv-seadragon-extension/config/en-GB.json b/src/extensions/uv-seadragon-extension/config/en-GB.json index 2d628cd8e..0aa17a012 100644 --- a/src/extensions/uv-seadragon-extension/config/en-GB.json +++ b/src/extensions/uv-seadragon-extension/config/en-GB.json @@ -29,6 +29,7 @@ "pessimisticAccessControl": false, "preserveViewport": false, "rightPanelEnabled": true, + "ocrRightPanelEnabled": true, "saveUserSettings": false, "clickToZoomEnabled": true, "searchWithinEnabled": true, @@ -84,6 +85,10 @@ "embedEnabled": false, "feedbackEnabled": false, "fullscreenEnabled": true, + "logoEnabled": true, + "logoOptions": { + "website": "http://www.4science.it" + }, "minimiseButtons": true, "moreInfoEnabled": true, "openEnabled": false, @@ -128,6 +133,14 @@ "pageModeEnabled": true } }, + "ocrRightPanel": { + "options": { + "panelAnimationDuration": 250, + "panelCollapsedWidth": 30, + "panelExpandedWidth": 300, + "panelOpen": false + } + }, "pagingHeaderPanel": { "options": { "autoCompleteBoxEnabled": true, @@ -166,6 +179,17 @@ } }, "settingsDialogue": { + "options": { + "contributedByEnabled" : true, + "contributedByOptions" : { + "contributor" : "4Science", + "website" : "http://www.4science.it" + }, + "moreInfo": { + "website": "https://github.com/4Science/universalviewer/tree/ocr" + } + + } }, "shareDialogue": { "options": { diff --git a/src/extensions/uv-seadragon-extension/l10n/cy-GB.json b/src/extensions/uv-seadragon-extension/l10n/cy-GB.json index 915dd2913..c63c24bc6 100644 --- a/src/extensions/uv-seadragon-extension/l10n/cy-GB.json +++ b/src/extensions/uv-seadragon-extension/l10n/cy-GB.json @@ -68,6 +68,7 @@ "feedback": "Adborth", "exitFullScreen": "Dianc o'r sgrin lawn", "fullScreen": "Sgrin lawn", + "logo": "Logo", "open": "Agor", "share": "Rhannu" } diff --git a/src/extensions/uv-seadragon-extension/l10n/en-GB.json b/src/extensions/uv-seadragon-extension/l10n/en-GB.json index 224e1c251..81a3bc480 100644 --- a/src/extensions/uv-seadragon-extension/l10n/en-GB.json +++ b/src/extensions/uv-seadragon-extension/l10n/en-GB.json @@ -70,6 +70,7 @@ "feedback": "Feedback", "exitFullScreen": "Exit Full Screen", "fullScreen": "Full Screen", + "logo": "Logo", "open": "Open", "share": "Share" } @@ -81,7 +82,8 @@ "noMatches": "No matches were found.", "ok": "OK", "pageNotFound": "This item does not contain a page with the number you entered. Try switching the numbering mode to 'image'.", - "refresh": "Refresh" + "refresh": "Refresh", + "wrongSelection": "Wrong selection. You can't select items outside text area of OCR panel" } }, "helpDialogue": { @@ -134,6 +136,14 @@ "title": "Select Pages for Download" } }, + "ocrRightPanel": { + "content": { + "clearSelection": "Clear selected text", + "collapse": "Collapse Ocr", + "expand": "Expand Ocr", + "title": "Ocr" + } + }, "pagingHeaderPanel": { "content": { "close": "Close", @@ -206,10 +216,11 @@ "locale": "Locale", "navigatorEnabled": "Navigator Enabled", "clickToZoomEnabled": "Mouse Click To Zoom", + "contributedBy": " enhanced by {0}", "pagingEnabled": "Two Page View", "preserveViewport": "Preserve Zoom", "title": "Settings", - "website": "more info" + "website": "more info" } }, "shareDialogue": { diff --git a/src/lib/bundle.js b/src/lib/bundle.js index 4e4da047c..c0d0be83a 100644 --- a/src/lib/bundle.js +++ b/src/lib/bundle.js @@ -1,18299 +1,18299 @@ -window.browserDetect = { - init: function () { - this.browser = this.searchString(this.dataBrowser) || "Other"; - this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown"; - // detect IE 11 - if (this.browser == 'Explorer' && this.version == '7' && navigator.userAgent.match(/Trident/i)) { - this.version = this.searchVersionIE(); - } - }, - - searchString: function (data) { - for (var i = 0 ; i < data.length ; i++) { - var dataString = data[i].string; - this.versionSearchString = data[i].subString; - - if (dataString.indexOf(data[i].subString) != -1) { - return data[i].identity; - } - } - }, - - searchVersion: function (dataString) { - var index = dataString.indexOf(this.versionSearchString); - if (index == -1) return; - return parseFloat(dataString.substring(index + this.versionSearchString.length + 1)); - }, - - searchVersionIE: function() { - var ua = navigator.userAgent.toString().toLowerCase(), - match = /(trident)(?:.*rv:([\w.]+))?/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ['', null, -1], - ver; - try { - ver = (match[2]).split('.')[0]; // version - } - catch (err) { - ver = 'unknown'; // - } - return ver; - }, - - dataBrowser: - [ - { string: navigator.userAgent, subString: "Chrome", identity: "Chrome" }, - { string: navigator.userAgent, subString: "MSIE", identity: "Explorer" }, - { string: navigator.userAgent, subString: "Trident", identity: "Explorer" }, - { string: navigator.userAgent, subString: "Firefox", identity: "Firefox" }, - { string: navigator.userAgent, subString: "Safari", identity: "Safari" }, - { string: navigator.userAgent, subString: "Opera", identity: "Opera" } - ] - -}; - +window.browserDetect = { + init: function () { + this.browser = this.searchString(this.dataBrowser) || "Other"; + this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown"; + // detect IE 11 + if (this.browser == 'Explorer' && this.version == '7' && navigator.userAgent.match(/Trident/i)) { + this.version = this.searchVersionIE(); + } + }, + + searchString: function (data) { + for (var i = 0 ; i < data.length ; i++) { + var dataString = data[i].string; + this.versionSearchString = data[i].subString; + + if (dataString.indexOf(data[i].subString) != -1) { + return data[i].identity; + } + } + }, + + searchVersion: function (dataString) { + var index = dataString.indexOf(this.versionSearchString); + if (index == -1) return; + return parseFloat(dataString.substring(index + this.versionSearchString.length + 1)); + }, + + searchVersionIE: function() { + var ua = navigator.userAgent.toString().toLowerCase(), + match = /(trident)(?:.*rv:([\w.]+))?/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ['', null, -1], + ver; + try { + ver = (match[2]).split('.')[0]; // version + } + catch (err) { + ver = 'unknown'; // + } + return ver; + }, + + dataBrowser: + [ + { string: navigator.userAgent, subString: "Chrome", identity: "Chrome" }, + { string: navigator.userAgent, subString: "MSIE", identity: "Explorer" }, + { string: navigator.userAgent, subString: "Trident", identity: "Explorer" }, + { string: navigator.userAgent, subString: "Firefox", identity: "Firefox" }, + { string: navigator.userAgent, subString: "Safari", identity: "Safari" }, + { string: navigator.userAgent, subString: "Opera", identity: "Opera" } + ] + +}; + window.browserDetect.init(); (function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|android|ipad|playbook|silk|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera); -/*! - * jQuery-ajaxTransport-XDomainRequest - v1.0.4 - 2015-03-05 - * https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest - * Copyright (c) 2015 Jason Moon (@JSONMOON) - * Licensed MIT (/blob/master/LICENSE.txt) - */ -(function(factory) { - //if (typeof define === 'function' && define.amd) { - // // AMD. Register as anonymous module. - // define(['jquery'], factory); - //} else if (typeof exports === 'object') { - // // CommonJS - // module.exports = factory(require('jquery')); - //} else { - // Browser globals. - factory(jQuery); - //} -}(function($) { - -// Only continue if we're on IE8/IE9 with jQuery 1.5+ (contains the ajaxTransport function) - if ($.support.cors || !$.ajaxTransport || !window.XDomainRequest) { - return $; - } - - var httpRegEx = /^(https?:)?\/\//i; - var getOrPostRegEx = /^get|post$/i; - var sameSchemeRegEx = new RegExp('^(\/\/|' + location.protocol + ')', 'i'); - -// ajaxTransport exists in jQuery 1.5+ - $.ajaxTransport('* text html xml json', function(options, userOptions, jqXHR) { - - // Only continue if the request is: asynchronous, uses GET or POST method, has HTTP or HTTPS protocol, and has the same scheme as the calling page - if (!options.crossDomain || !options.async || !getOrPostRegEx.test(options.type) || !httpRegEx.test(options.url) || !sameSchemeRegEx.test(options.url)) { - return; - } - - var xdr = null; - - return { - send: function(headers, complete) { - var postData = ''; - var userType = (userOptions.dataType || '').toLowerCase(); - - xdr = new XDomainRequest(); - if (/^\d+$/.test(userOptions.timeout)) { - xdr.timeout = userOptions.timeout; - } - - xdr.ontimeout = function() { - complete(500, 'timeout'); - }; - - xdr.onload = function() { - var allResponseHeaders = 'Content-Length: ' + xdr.responseText.length + '\r\nContent-Type: ' + xdr.contentType; - var status = { - code: 200, - message: 'success' - }; - var responses = { - text: xdr.responseText - }; - try { - if (userType === 'html' || /text\/html/i.test(xdr.contentType)) { - responses.html = xdr.responseText; - } else if (userType === 'json' || (userType !== 'text' && /\/json/i.test(xdr.contentType))) { - try { - responses.json = $.parseJSON(xdr.responseText); - } catch(e) { - status.code = 500; - status.message = 'parseerror'; - //throw 'Invalid JSON: ' + xdr.responseText; - } - } else if (userType === 'xml' || (userType !== 'text' && /\/xml/i.test(xdr.contentType))) { - var doc = new ActiveXObject('Microsoft.XMLDOM'); - doc.async = false; - try { - doc.loadXML(xdr.responseText); - } catch(e) { - doc = undefined; - } - if (!doc || !doc.documentElement || doc.getElementsByTagName('parsererror').length) { - status.code = 500; - status.message = 'parseerror'; - throw 'Invalid XML: ' + xdr.responseText; - } - responses.xml = doc; - } - } catch(parseMessage) { - throw parseMessage; - } finally { - complete(status.code, status.message, responses, allResponseHeaders); - } - }; - - // set an empty handler for 'onprogress' so requests don't get aborted - xdr.onprogress = function(){}; - xdr.onerror = function() { - complete(401, 'error', { - text: xdr.responseText - }); - }; - - if (userOptions.data) { - postData = ($.type(userOptions.data) === 'string') ? userOptions.data : $.param(userOptions.data); - } - xdr.open(options.type, options.url); - xdr.send(postData); - }, - abort: function() { - if (xdr) { - xdr.abort(); - } - } - }; - }); - - return $; - -})); - -/* Modernizr 2.8.3 (Custom Build) | MIT & BSD - * Build: http://modernizr.com/download/#-input-inputtypes-cssclasses-load - */ -/* Modernizr 2.8.3 (Custom Build) | MIT & BSD - * Build: http://modernizr.com/download/#-input-inputtypes-cssclasses-cors-load - * (add Non-core detects: cors) - */ +/*! + * jQuery-ajaxTransport-XDomainRequest - v1.0.4 - 2015-03-05 + * https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest + * Copyright (c) 2015 Jason Moon (@JSONMOON) + * Licensed MIT (/blob/master/LICENSE.txt) + */ +(function(factory) { + //if (typeof define === 'function' && define.amd) { + // // AMD. Register as anonymous module. + // define(['jquery'], factory); + //} else if (typeof exports === 'object') { + // // CommonJS + // module.exports = factory(require('jquery')); + //} else { + // Browser globals. + factory(jQuery); + //} +}(function($) { + +// Only continue if we're on IE8/IE9 with jQuery 1.5+ (contains the ajaxTransport function) + if ($.support.cors || !$.ajaxTransport || !window.XDomainRequest) { + return $; + } + + var httpRegEx = /^(https?:)?\/\//i; + var getOrPostRegEx = /^get|post$/i; + var sameSchemeRegEx = new RegExp('^(\/\/|' + location.protocol + ')', 'i'); + +// ajaxTransport exists in jQuery 1.5+ + $.ajaxTransport('* text html xml json', function(options, userOptions, jqXHR) { + + // Only continue if the request is: asynchronous, uses GET or POST method, has HTTP or HTTPS protocol, and has the same scheme as the calling page + if (!options.crossDomain || !options.async || !getOrPostRegEx.test(options.type) || !httpRegEx.test(options.url) || !sameSchemeRegEx.test(options.url)) { + return; + } + + var xdr = null; + + return { + send: function(headers, complete) { + var postData = ''; + var userType = (userOptions.dataType || '').toLowerCase(); + + xdr = new XDomainRequest(); + if (/^\d+$/.test(userOptions.timeout)) { + xdr.timeout = userOptions.timeout; + } + + xdr.ontimeout = function() { + complete(500, 'timeout'); + }; + + xdr.onload = function() { + var allResponseHeaders = 'Content-Length: ' + xdr.responseText.length + '\r\nContent-Type: ' + xdr.contentType; + var status = { + code: 200, + message: 'success' + }; + var responses = { + text: xdr.responseText + }; + try { + if (userType === 'html' || /text\/html/i.test(xdr.contentType)) { + responses.html = xdr.responseText; + } else if (userType === 'json' || (userType !== 'text' && /\/json/i.test(xdr.contentType))) { + try { + responses.json = $.parseJSON(xdr.responseText); + } catch(e) { + status.code = 500; + status.message = 'parseerror'; + //throw 'Invalid JSON: ' + xdr.responseText; + } + } else if (userType === 'xml' || (userType !== 'text' && /\/xml/i.test(xdr.contentType))) { + var doc = new ActiveXObject('Microsoft.XMLDOM'); + doc.async = false; + try { + doc.loadXML(xdr.responseText); + } catch(e) { + doc = undefined; + } + if (!doc || !doc.documentElement || doc.getElementsByTagName('parsererror').length) { + status.code = 500; + status.message = 'parseerror'; + throw 'Invalid XML: ' + xdr.responseText; + } + responses.xml = doc; + } + } catch(parseMessage) { + throw parseMessage; + } finally { + complete(status.code, status.message, responses, allResponseHeaders); + } + }; + + // set an empty handler for 'onprogress' so requests don't get aborted + xdr.onprogress = function(){}; + xdr.onerror = function() { + complete(401, 'error', { + text: xdr.responseText + }); + }; + + if (userOptions.data) { + postData = ($.type(userOptions.data) === 'string') ? userOptions.data : $.param(userOptions.data); + } + xdr.open(options.type, options.url); + xdr.send(postData); + }, + abort: function() { + if (xdr) { + xdr.abort(); + } + } + }; + }); + + return $; + +})); + +/* Modernizr 2.8.3 (Custom Build) | MIT & BSD + * Build: http://modernizr.com/download/#-input-inputtypes-cssclasses-load + */ +/* Modernizr 2.8.3 (Custom Build) | MIT & BSD + * Build: http://modernizr.com/download/#-input-inputtypes-cssclasses-cors-load + * (add Non-core detects: cors) + */ ;window.Modernizr=function(a,b,c){function v(a){j.cssText=a}function w(a,b){return v(prefixes.join(a+";")+(b||""))}function x(a,b){return typeof a===b}function y(a,b){return!!~(""+a).indexOf(b)}function z(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:x(f,"function")?f.bind(d||b):f}return!1}function A(){e.input=function(c){for(var d=0,e=c.length;d 0) { - this.current_element.removeChild(this.current_element.firstChild); - } - parent_element.appendChild(this.current_element); - } - - // iterate over child nodes - if(!this.config.remove_all_contents && !this.config.remove_element_contents[name]) { - for(i=0;i 0) { + this.current_element.removeChild(this.current_element.firstChild); + } + parent_element.appendChild(this.current_element); + } + + // iterate over child nodes + if(!this.config.remove_all_contents && !this.config.remove_element_contents[name]) { + for(i=0;i chars) { - var trimmedText = text.substr(0, chars); - trimmedText = trimmedText.substr(0, Math.min(trimmedText.length, trimmedText.lastIndexOf(" "))); - $self.empty().html(trimmedText + "…"); - } - }); - }; - $.fn.ellipsisFill = function (text) { - var textPassed = true; - if (!text) - textPassed = false; - return this.each(function () { - var $self = $(this); - if (!textPassed) - text = $self.text(); - $self.empty(); - $self.spanElem = $(''); - $self.append($self.spanElem); - $self.css('overflow', 'hidden'); - $self.spanElem.css('white-space', 'nowrap'); - $self.spanElem.html(text); - // get the width of the span. - // if it's wider than the container, remove a word until it's not. - if ($self.spanElem.width() > $self.width()) { - var lastText; - while ($self.spanElem.width() > $self.width()) { - var t = $self.spanElem.html(); - t = t.substring(0, t.lastIndexOf(' ')) + '…'; - if (t === lastText) - break; - $self.spanElem.html(t); - lastText = t; - } - } - }); - }; - $.fn.ellipsisFixed = function (chars, buttonText) { - return this.each(function () { - var $self = $(this); - var text = $self.text(); - $self.empty(); - var $span = $(''); - var $ellipsis = $(''); - if (buttonText) { - $ellipsis.html(buttonText); - } - else { - $ellipsis.html('…'); - } - $ellipsis.click(function (e) { - e.preventDefault(); - var $this = $(this); - $span.html(text); - $this.remove(); - }); - if (text.length > chars) { - var trimmedText = text.substr(0, chars); - trimmedText = trimmedText.substr(0, Math.min(trimmedText.length, trimmedText.lastIndexOf(" "))); - $span.html(trimmedText + " "); - $span.append($ellipsis); - } - else { - $span.html(text); - } - $self.append($span); - }); - }; - // Truncates to a certain number of letters, while ignoring and preserving HTML - $.fn.ellipsisHtmlFixed = function (chars, cb) { - return this.each(function () { - var $self = $(this); - var expandedText = $self.html(); - var $trunc = $(''); - $trunc.html($self.html().replace(/\s[\s]*/g, ' ').trim()); - if ($trunc.text().trim().length <= chars) { - return; // do nothing if we're under the limit! - } - while ($trunc.text().trim().length > chars) { - $trunc.removeLastWord(chars); - } - var collapsedText = $trunc.html(); - // Toggle function - var expanded = false; - $self.toggle = function () { - $self.empty(); - var $toggleButton = $(''); - if (expanded) { - $self.html(expandedText + " "); - $toggleButton.text("less"); - $toggleButton.toggleClass("less", "more"); - } - else { - $self.html(collapsedText + "… "); - $toggleButton.text("more"); - $toggleButton.toggleClass("more", "less"); - } - $toggleButton.one('click', function (e) { - e.preventDefault(); - $self.toggle(); - }); - expanded = !expanded; - $self.append($toggleButton); - if (cb) - cb(); - }; - $self.toggle(); - }); - }; - $.fn.enable = function () { - return this.each(function () { - var $this = $(this); - $this.removeClass('disabled'); - $this.attr('tabindex', $this.data('tabindex')); - }); - }; - $.fn.equaliseHeight = function (reset, average) { - var maxHeight = -1; - var minHeight = Number.MAX_VALUE; - var heights = []; - // reset all heights to auto first so they can be re-measured. - if (reset) { - this.each(function () { - $(this).height('auto'); - }); - } - this.each(function () { - var currentHeight = $(this).height(); - heights.push(currentHeight); - maxHeight = maxHeight > currentHeight ? maxHeight : currentHeight; - minHeight = minHeight < currentHeight ? minHeight : currentHeight; - }); - var finalHeight = maxHeight; - if (average) { - finalHeight = Math.median(heights); - } - this.each(function () { - $(this).height(finalHeight); - }); - return this; - }; - $.fn.getVisibleElementWithGreatestTabIndex = function () { - var $self = $(this); - var maxTabIndex = 0; - var $elementWithGreatestTabIndex = null; - $self.find('*:visible[tabindex]').each(function (idx, el) { - var $el = $(el); - var tabIndex = parseInt($el.attr('tabindex')); - if (tabIndex > maxTabIndex) { - maxTabIndex = tabIndex; - $elementWithGreatestTabIndex = $el; - } - }); - return $elementWithGreatestTabIndex; - }; - $.fn.horizontalMargins = function () { - var $self = $(this); - return parseInt($self.css('marginLeft')) + parseInt($self.css('marginRight')); - }; - $.fn.leftMargin = function () { - var $self = $(this); - return parseInt($self.css('marginLeft')); - }; - $.fn.rightMargin = function () { - var $self = $(this); - return parseInt($self.css('marginRight')); - }; - $.fn.horizontalPadding = function () { - var $self = $(this); - return parseInt($self.css('paddingLeft')) + parseInt($self.css('paddingRight')); - }; - $.fn.leftPadding = function () { - var $self = $(this); - return parseInt($self.css('paddingLeft')); - }; - $.fn.rightPadding = function () { - var $self = $(this); - return parseInt($self.css('paddingRight')); - }; - $.mlp = { x: 0, y: 0 }; // Mouse Last Position - function documentHandler() { - var $current = this === document ? $(this) : $(this).contents(); - $current.mousemove(function (e) { jQuery.mlp = { x: e.pageX, y: e.pageY }; }); - $current.find("iframe").load(documentHandler); - } - $(documentHandler); - $.fn.ismouseover = function (overThis) { - var result = false; - this.eq(0).each(function () { - var $current = $(this).is("iframe") ? $(this).contents().find("body") : $(this); - var offset = $current.offset(); - result = offset.left <= $.mlp.x && offset.left + $current.outerWidth() > $.mlp.x && - offset.top <= $.mlp.y && offset.top + $current.outerHeight() > $.mlp.y; - }); - return result; - }; - var on = $.fn.on, timer; - $.fn.on = function () { - var args = Array.apply(null, arguments); - var last = args[args.length - 1]; - if (isNaN(last) || (last === 1 && args.pop())) - return on.apply(this, args); - var delay = args.pop(); - var fn = args.pop(); - args.push(function () { - var self = this, params = arguments; - clearTimeout(timer); - timer = setTimeout(function () { - fn.apply(self, params); - }, delay); - }); - return on.apply(this, args); - }; - $.fn.onEnter = function (cb) { - return this.each(function () { - var $this = $(this); - $this.on('keyup', function (e) { - if (e.keyCode === 13) { - e.preventDefault(); - cb(); - } - }); - }); - }; - $.fn.onPressed = function (cb) { - return this.each(function () { - var $this = $(this); - $this.on('touchstart click', function (e) { - e.preventDefault(); - cb(e); - }); - $this.on('keyup', function (e) { - if (e.keyCode === 13) { - e.preventDefault(); - cb(e); - } - }); - }); - }; - // Recursively removes the last empty element (img, audio, etc) or word in an element - $.fn.removeLastWord = function (chars, depth) { - if ('undefined' === typeof chars) - chars = 8; - if ('undefined' === typeof depth) - depth = 0; - return this.each(function () { - var $self = $(this); - if ($self.contents().length > 0) { - var $lastElement = $self.contents().last(); - if ($lastElement[0].nodeType === 3) { - var words = $lastElement.text().trim().split(' '); - if (words.length > 1) { - words.splice(words.length - 1, 1); - $lastElement[0].data = words.join(' '); // textnode.data - return; - } - else if ('undefined' !== typeof chars && words.length === 1 && words[0].length > chars) { - $lastElement[0].data = words.join(' ').substring(0, chars); - return; - } - } - $lastElement.removeLastWord(chars, depth + 1); // Element - } - else if (depth > 0) { - // Empty element - $self.remove(); - } - }); - }; - $.fn.swapClass = function (removeClass, addClass) { - return this.each(function () { - $(this).removeClass(removeClass).addClass(addClass); - }); - }; - $.fn.targetBlank = function () { - return this.each(function () { - $(this).find('a').prop('target', '_blank'); - }); - }; - $.fn.toggleClass = function (class1, class2) { - return this.each(function () { - var $this = $(this); - if ($this.hasClass(class1)) { - $(this).removeClass(class1).addClass(class2); - } - else { - $(this).removeClass(class2).addClass(class1); - } - }); - }; - $.fn.toggleExpandText = function (chars, lessText, moreText, cb) { - return this.each(function () { - var $self = $(this); - var expandedText = $self.html(); - if (chars > expandedText.length) - return; - var expanded = false; - var collapsedText = expandedText.substr(0, chars); - collapsedText = collapsedText.substr(0, Math.min(collapsedText.length, collapsedText.lastIndexOf(" "))); - $self.toggle = function () { - $self.empty(); - var $toggleButton = $(''); - if (expanded) { - $self.html(expandedText + " "); - $toggleButton.text(lessText); - $toggleButton.toggleClass("less", "more"); - } - else { - $self.html(collapsedText + " "); - $toggleButton.text(moreText); - $toggleButton.toggleClass("more", "less"); - } - $toggleButton.one('click', function (e) { - e.preventDefault(); - $self.toggle(); - }); - expanded = !expanded; - $self.append($toggleButton); - if (cb) - cb(); - }; - $self.toggle(); - }); - }; - // Toggle expansion by number of lines - $.fn.toggleExpandTextByLines = function (lines, lessText, moreText, cb) { - return this.each(function () { - var $self = $(this); - var expandedText = $self.html(); - // add 'pad' to account for the right margin in the sidebar - var $buttonPad = $('morepad'); - // when height changes, store string, then pick from line counts - var stringsByLine = [expandedText]; - var lastHeight = $self.height(); - // Until empty - while ($self.text().length > 0) { - $self.removeLastWord(); - var html = $self.html(); - $self.append($buttonPad); - if (lastHeight > $self.height()) { - stringsByLine.unshift(html); - lastHeight = $self.height(); - } - $buttonPad.remove(); - } - if (stringsByLine.length <= lines) { - $self.html(expandedText); - return; - } - var collapsedText = stringsByLine[lines - 1]; - // Toggle function - var expanded = false; - $self.toggle = function () { - $self.empty(); - var $toggleButton = $(''); - if (expanded) { - $self.html(expandedText + " "); - $toggleButton.text(lessText); - $toggleButton.toggleClass("less", "more"); - } - else { - $self.html(collapsedText + "… "); - $toggleButton.text(moreText); - $toggleButton.toggleClass("more", "less"); - } - $toggleButton.one('click', function (e) { - e.preventDefault(); - $self.toggle(); - }); - expanded = !expanded; - $self.append($toggleButton); - if (cb) - cb(); - }; - $self.toggle(); - }); - }; - $.fn.toggleText = function (text1, text2) { - return this.each(function () { - var $this = $(this); - if ($this.text() === text1) { - $(this).text(text2); - } - else { - $(this).text(text1); - } - }); - }; - $.fn.updateAttr = function (attrName, oldVal, newVal) { - return this.each(function () { - var $this = $(this); - var attr = $this.attr(attrName); - if (attr && attr.indexOf(oldVal) === 0) { - attr = attr.replace(oldVal, newVal); - $this.attr(attrName, attr); - } - }); - }; - $.fn.verticalMargins = function () { - var $self = $(this); - return parseInt($self.css('marginTop')) + parseInt($self.css('marginBottom')); - }; - $.fn.verticalPadding = function () { - var $self = $(this); - return parseInt($self.css('paddingTop')) + parseInt($self.css('paddingBottom')); - }; -})(jQuery); - -/*! Tiny Pub/Sub - v0.7.0 - 2015-04-21 -* https://github.com/cowboy/jquery-tiny-pubsub -* Copyright (c) 2015 "Cowboy" Ben Alman; Licensed MIT */ +(function ($) { + $.fn.checkboxButton = function (onClick) { + return this.each(function () { + var $this = $(this); + $this.on('click', function (e) { + var tagName = e.target.tagName; + var $checkbox = $(this).find(':checkbox'); + if (tagName !== "INPUT") { + e.preventDefault(); + $checkbox.prop('checked', !$checkbox.prop('checked')); + } + var checked = $checkbox.is(':checked'); + onClick.call(this, checked); + }); + }); + }; + $.fn.disable = function () { + return this.each(function () { + var $this = $(this); + $this.addClass('disabled'); + $this.data('tabindex', $this.attr('tabindex')); + $this.removeAttr('tabindex'); + }); + }; + $.fn.ellipsis = function (chars) { + return this.each(function () { + var $self = $(this); + var text = $self.text(); + if (text.length > chars) { + var trimmedText = text.substr(0, chars); + trimmedText = trimmedText.substr(0, Math.min(trimmedText.length, trimmedText.lastIndexOf(" "))); + $self.empty().html(trimmedText + "…"); + } + }); + }; + $.fn.ellipsisFill = function (text) { + var textPassed = true; + if (!text) + textPassed = false; + return this.each(function () { + var $self = $(this); + if (!textPassed) + text = $self.text(); + $self.empty(); + $self.spanElem = $(''); + $self.append($self.spanElem); + $self.css('overflow', 'hidden'); + $self.spanElem.css('white-space', 'nowrap'); + $self.spanElem.html(text); + // get the width of the span. + // if it's wider than the container, remove a word until it's not. + if ($self.spanElem.width() > $self.width()) { + var lastText; + while ($self.spanElem.width() > $self.width()) { + var t = $self.spanElem.html(); + t = t.substring(0, t.lastIndexOf(' ')) + '…'; + if (t === lastText) + break; + $self.spanElem.html(t); + lastText = t; + } + } + }); + }; + $.fn.ellipsisFixed = function (chars, buttonText) { + return this.each(function () { + var $self = $(this); + var text = $self.text(); + $self.empty(); + var $span = $(''); + var $ellipsis = $(''); + if (buttonText) { + $ellipsis.html(buttonText); + } + else { + $ellipsis.html('…'); + } + $ellipsis.click(function (e) { + e.preventDefault(); + var $this = $(this); + $span.html(text); + $this.remove(); + }); + if (text.length > chars) { + var trimmedText = text.substr(0, chars); + trimmedText = trimmedText.substr(0, Math.min(trimmedText.length, trimmedText.lastIndexOf(" "))); + $span.html(trimmedText + " "); + $span.append($ellipsis); + } + else { + $span.html(text); + } + $self.append($span); + }); + }; + // Truncates to a certain number of letters, while ignoring and preserving HTML + $.fn.ellipsisHtmlFixed = function (chars, cb) { + return this.each(function () { + var $self = $(this); + var expandedText = $self.html(); + var $trunc = $(''); + $trunc.html($self.html().replace(/\s[\s]*/g, ' ').trim()); + if ($trunc.text().trim().length <= chars) { + return; // do nothing if we're under the limit! + } + while ($trunc.text().trim().length > chars) { + $trunc.removeLastWord(chars); + } + var collapsedText = $trunc.html(); + // Toggle function + var expanded = false; + $self.toggle = function () { + $self.empty(); + var $toggleButton = $(''); + if (expanded) { + $self.html(expandedText + " "); + $toggleButton.text("less"); + $toggleButton.toggleClass("less", "more"); + } + else { + $self.html(collapsedText + "… "); + $toggleButton.text("more"); + $toggleButton.toggleClass("more", "less"); + } + $toggleButton.one('click', function (e) { + e.preventDefault(); + $self.toggle(); + }); + expanded = !expanded; + $self.append($toggleButton); + if (cb) + cb(); + }; + $self.toggle(); + }); + }; + $.fn.enable = function () { + return this.each(function () { + var $this = $(this); + $this.removeClass('disabled'); + $this.attr('tabindex', $this.data('tabindex')); + }); + }; + $.fn.equaliseHeight = function (reset, average) { + var maxHeight = -1; + var minHeight = Number.MAX_VALUE; + var heights = []; + // reset all heights to auto first so they can be re-measured. + if (reset) { + this.each(function () { + $(this).height('auto'); + }); + } + this.each(function () { + var currentHeight = $(this).height(); + heights.push(currentHeight); + maxHeight = maxHeight > currentHeight ? maxHeight : currentHeight; + minHeight = minHeight < currentHeight ? minHeight : currentHeight; + }); + var finalHeight = maxHeight; + if (average) { + finalHeight = Math.median(heights); + } + this.each(function () { + $(this).height(finalHeight); + }); + return this; + }; + $.fn.getVisibleElementWithGreatestTabIndex = function () { + var $self = $(this); + var maxTabIndex = 0; + var $elementWithGreatestTabIndex = null; + $self.find('*:visible[tabindex]').each(function (idx, el) { + var $el = $(el); + var tabIndex = parseInt($el.attr('tabindex')); + if (tabIndex > maxTabIndex) { + maxTabIndex = tabIndex; + $elementWithGreatestTabIndex = $el; + } + }); + return $elementWithGreatestTabIndex; + }; + $.fn.horizontalMargins = function () { + var $self = $(this); + return parseInt($self.css('marginLeft')) + parseInt($self.css('marginRight')); + }; + $.fn.leftMargin = function () { + var $self = $(this); + return parseInt($self.css('marginLeft')); + }; + $.fn.rightMargin = function () { + var $self = $(this); + return parseInt($self.css('marginRight')); + }; + $.fn.horizontalPadding = function () { + var $self = $(this); + return parseInt($self.css('paddingLeft')) + parseInt($self.css('paddingRight')); + }; + $.fn.leftPadding = function () { + var $self = $(this); + return parseInt($self.css('paddingLeft')); + }; + $.fn.rightPadding = function () { + var $self = $(this); + return parseInt($self.css('paddingRight')); + }; + $.mlp = { x: 0, y: 0 }; // Mouse Last Position + function documentHandler() { + var $current = this === document ? $(this) : $(this).contents(); + $current.mousemove(function (e) { jQuery.mlp = { x: e.pageX, y: e.pageY }; }); + $current.find("iframe").load(documentHandler); + } + $(documentHandler); + $.fn.ismouseover = function (overThis) { + var result = false; + this.eq(0).each(function () { + var $current = $(this).is("iframe") ? $(this).contents().find("body") : $(this); + var offset = $current.offset(); + result = offset.left <= $.mlp.x && offset.left + $current.outerWidth() > $.mlp.x && + offset.top <= $.mlp.y && offset.top + $current.outerHeight() > $.mlp.y; + }); + return result; + }; + var on = $.fn.on, timer; + $.fn.on = function () { + var args = Array.apply(null, arguments); + var last = args[args.length - 1]; + if (isNaN(last) || (last === 1 && args.pop())) + return on.apply(this, args); + var delay = args.pop(); + var fn = args.pop(); + args.push(function () { + var self = this, params = arguments; + clearTimeout(timer); + timer = setTimeout(function () { + fn.apply(self, params); + }, delay); + }); + return on.apply(this, args); + }; + $.fn.onEnter = function (cb) { + return this.each(function () { + var $this = $(this); + $this.on('keyup', function (e) { + if (e.keyCode === 13) { + e.preventDefault(); + cb(); + } + }); + }); + }; + $.fn.onPressed = function (cb) { + return this.each(function () { + var $this = $(this); + $this.on('touchstart click', function (e) { + e.preventDefault(); + cb(e); + }); + $this.on('keyup', function (e) { + if (e.keyCode === 13) { + e.preventDefault(); + cb(e); + } + }); + }); + }; + // Recursively removes the last empty element (img, audio, etc) or word in an element + $.fn.removeLastWord = function (chars, depth) { + if ('undefined' === typeof chars) + chars = 8; + if ('undefined' === typeof depth) + depth = 0; + return this.each(function () { + var $self = $(this); + if ($self.contents().length > 0) { + var $lastElement = $self.contents().last(); + if ($lastElement[0].nodeType === 3) { + var words = $lastElement.text().trim().split(' '); + if (words.length > 1) { + words.splice(words.length - 1, 1); + $lastElement[0].data = words.join(' '); // textnode.data + return; + } + else if ('undefined' !== typeof chars && words.length === 1 && words[0].length > chars) { + $lastElement[0].data = words.join(' ').substring(0, chars); + return; + } + } + $lastElement.removeLastWord(chars, depth + 1); // Element + } + else if (depth > 0) { + // Empty element + $self.remove(); + } + }); + }; + $.fn.swapClass = function (removeClass, addClass) { + return this.each(function () { + $(this).removeClass(removeClass).addClass(addClass); + }); + }; + $.fn.targetBlank = function () { + return this.each(function () { + $(this).find('a').prop('target', '_blank'); + }); + }; + $.fn.toggleClass = function (class1, class2) { + return this.each(function () { + var $this = $(this); + if ($this.hasClass(class1)) { + $(this).removeClass(class1).addClass(class2); + } + else { + $(this).removeClass(class2).addClass(class1); + } + }); + }; + $.fn.toggleExpandText = function (chars, lessText, moreText, cb) { + return this.each(function () { + var $self = $(this); + var expandedText = $self.html(); + if (chars > expandedText.length) + return; + var expanded = false; + var collapsedText = expandedText.substr(0, chars); + collapsedText = collapsedText.substr(0, Math.min(collapsedText.length, collapsedText.lastIndexOf(" "))); + $self.toggle = function () { + $self.empty(); + var $toggleButton = $(''); + if (expanded) { + $self.html(expandedText + " "); + $toggleButton.text(lessText); + $toggleButton.toggleClass("less", "more"); + } + else { + $self.html(collapsedText + " "); + $toggleButton.text(moreText); + $toggleButton.toggleClass("more", "less"); + } + $toggleButton.one('click', function (e) { + e.preventDefault(); + $self.toggle(); + }); + expanded = !expanded; + $self.append($toggleButton); + if (cb) + cb(); + }; + $self.toggle(); + }); + }; + // Toggle expansion by number of lines + $.fn.toggleExpandTextByLines = function (lines, lessText, moreText, cb) { + return this.each(function () { + var $self = $(this); + var expandedText = $self.html(); + // add 'pad' to account for the right margin in the sidebar + var $buttonPad = $('morepad'); + // when height changes, store string, then pick from line counts + var stringsByLine = [expandedText]; + var lastHeight = $self.height(); + // Until empty + while ($self.text().length > 0) { + $self.removeLastWord(); + var html = $self.html(); + $self.append($buttonPad); + if (lastHeight > $self.height()) { + stringsByLine.unshift(html); + lastHeight = $self.height(); + } + $buttonPad.remove(); + } + if (stringsByLine.length <= lines) { + $self.html(expandedText); + return; + } + var collapsedText = stringsByLine[lines - 1]; + // Toggle function + var expanded = false; + $self.toggle = function () { + $self.empty(); + var $toggleButton = $(''); + if (expanded) { + $self.html(expandedText + " "); + $toggleButton.text(lessText); + $toggleButton.toggleClass("less", "more"); + } + else { + $self.html(collapsedText + "… "); + $toggleButton.text(moreText); + $toggleButton.toggleClass("more", "less"); + } + $toggleButton.one('click', function (e) { + e.preventDefault(); + $self.toggle(); + }); + expanded = !expanded; + $self.append($toggleButton); + if (cb) + cb(); + }; + $self.toggle(); + }); + }; + $.fn.toggleText = function (text1, text2) { + return this.each(function () { + var $this = $(this); + if ($this.text() === text1) { + $(this).text(text2); + } + else { + $(this).text(text1); + } + }); + }; + $.fn.updateAttr = function (attrName, oldVal, newVal) { + return this.each(function () { + var $this = $(this); + var attr = $this.attr(attrName); + if (attr && attr.indexOf(oldVal) === 0) { + attr = attr.replace(oldVal, newVal); + $this.attr(attrName, attr); + } + }); + }; + $.fn.verticalMargins = function () { + var $self = $(this); + return parseInt($self.css('marginTop')) + parseInt($self.css('marginBottom')); + }; + $.fn.verticalPadding = function () { + var $self = $(this); + return parseInt($self.css('paddingTop')) + parseInt($self.css('paddingBottom')); + }; +})(jQuery); + +/*! Tiny Pub/Sub - v0.7.0 - 2015-04-21 +* https://github.com/cowboy/jquery-tiny-pubsub +* Copyright (c) 2015 "Cowboy" Ben Alman; Licensed MIT */ !function(a){var b=null;a.initPubSub=function(){b=a({})},a.subscribe=function(){b||a.initPubSub(),b.on.apply(b,arguments)},a.unsubscribe=function(){b||a.initPubSub(),b.off.apply(b,arguments)},a.disposePubSub=function(){b=null},a.publish=function(){b||a.initPubSub(),b.trigger.apply(b,arguments)}}(jQuery); -// key-codes v0.0.5 https://github.com/edsilv/key-codes -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.keyCodes = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o-1?(this._keys.splice(e,1),this._values.splice(e,1),this.size--,!0):!1},e.prototype.entries=function(){var e=this;return r.range(0,this.size).select(function(r){return[e._keys[r],e._values[r]]})},e.prototype.forEach=function(r,e){null==e&&(e=this);for(var t=0,n=this._keys,o=this._values,u=n.length;u>t;t++)r.call(e,o[t],n[t],this)},e.prototype.get=function(r){var e=this._keys.indexOf(r);return this._values[e]},e.prototype.has=function(r){return this._keys.indexOf(r)>-1},e.prototype.keys=function(){return this._keys.en()},e.prototype.set=function(r,e){var t=this._keys.indexOf(r);t>-1?this._values[t]=e:(this._keys.push(r),this._values.push(e),this.size++)},e.prototype.values=function(){return this._values.en()},e}();r.Map3=e,r.Enumerable.prototype.toMap=function(r,t){for(var n=new e,o=this.getEnumerator();o.moveNext();)n.set(r(o.current),t(o.current));return n},r.List&&(r.List.prototype.toMap=r.Enumerable.prototype.toMap)}(exjs||(exjs={})),function(r){r.Map||(r.Map=exjs.Map3)}("undefined"==typeof window?global:window);var exjs;!function(r){function e(e){var t=new r.Enumerable;return t.getEnumerator=function(){var r={current:void 0,moveNext:function(){return e(r)}};return r},t}r.anonymous=e}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n,o=1,u={current:void 0,moveNext:function(){if(2>o){if(t=t||r.getEnumerator(),t.moveNext())return u.current=t.current,!0;o++}return n=n||e.en().getEnumerator(),n.moveNext()?(u.current=n.current,!0):(u.current=void 0,!1)}};return u}r.Enumerable.prototype.append=function(){for(var t=this,n=[],o=0;o=e?(t.current=void 0,!1):(t.current=r[n],!0)},t}function t(){return this&&Array.isArray(this)?new n(this):new r.Enumerable}var n=function(r){function t(t){r.call(this),this.getEnumerator=function(){return e(t)},this.toArray=function(){return t.slice(0)}}return __extends(t,r),t}(r.Enumerable);try{Object.defineProperty(Array.prototype,"en",{value:t,enumerable:!1,writable:!1,configurable:!1})}catch(o){Array.prototype.en=t}}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n=!1,o={current:void 0,moveNext:function(){return t||(t=r.getEnumerator()),o.current=void 0,t.moveNext()?(o.current=t.current,!0):n?!1:(n=!0,t=e.getEnumerator(),t.moveNext()?(o.current=t.current,!0):!1)}};return o}r.Enumerable.prototype.concat=function(t){var n=this,o=t instanceof Array?t.en():t,u=new r.Enumerable;return u.getEnumerator=function(){return e(n,o)},u},r.List&&(r.List.prototype.concat=r.Enumerable.prototype.concat)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n=[],o={current:void 0,moveNext:function(){if(t||(t=r.getEnumerator()),o.current=void 0,!e){for(;t.moveNext();)if(n.indexOf(t.current)<0)return n.push(o.current=t.current),!0;return!1}for(;t.moveNext();){for(var u=0,i=n.length,c=!1;i>u&&!c;u++)c=!!e(n[u],t.current);if(!c)return n.push(o.current=t.current),!0}return!1}};return o}r.Enumerable.prototype.distinct=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.List&&(r.List.prototype.distinct=r.Enumerable.prototype.distinct)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e,t){t=t||function(r,e){return r===e};var n,o={current:void 0,moveNext:function(){for(n||(n=r.getEnumerator()),o.current=void 0;n.moveNext();){for(var u=!1,i=e.getEnumerator();i.moveNext()&&!u;)u=t(n.current,i.current);if(!u)return o.current=n.current,!0}return!1}};return o}r.Enumerable.prototype.except=function(t,n){var o=this,u=t instanceof Array?t.en():t,i=new r.Enumerable;return i.getEnumerator=function(){return e(o,u,n)},i},r.List&&(r.List.prototype.except=r.Enumerable.prototype.except)}(exjs||(exjs={})),Function.prototype.fromJson=function(r,e){function t(r,e){if(null==r)return r;if(e instanceof Function)return e(r);if(e instanceof Array){if(e=e[0],!(e instanceof Function&&r instanceof Array))return;for(var t=[],n=0;n-1)){var i=t(r[u],this.$jsonMappings[u]);void 0!==i&&(n[u]=i,o.push(u))}for(var u in r)o.indexOf(u)>-1||(n[u]=r[u]);return n};var exjs;!function(r){function e(r,e,n){var o,u=0,i={current:void 0,moveNext:function(){return o||(o=t(r,e,n)),i.current=void 0,u>=o.length?!1:(i.current=o[u],u++,!0)}};return i}function t(r,e,t){t=t||function(r,e){return r===e};for(var o,u=[],i=[],c=r.getEnumerator();c.moveNext();){o=e(c.current);for(var a=-1,p=0,s=i.length;s>p;p++)if(t(o,i[p])){a=p;break}var f;0>a?(i.push(o),u.push(f=new n(o))):f=u[a],f._add(c.current)}return u}var n=function(r){function e(e){var t=this;r.call(this),this.key=e,this._arr=[],this.getEnumerator=function(){return t._arr.en().getEnumerator()}}return __extends(e,r),e.prototype._add=function(r){this._arr.push(r)},e}(r.Enumerable);r.Enumerable.prototype.groupBy=function(t,n){var o=this,u=new r.Enumerable;return u.getEnumerator=function(){return e(o,t,n)},u},r.List&&(r.List.prototype.groupBy=r.Enumerable.prototype.groupBy)}(exjs||(exjs={}));var exjs;!function(r){function e(e,t,n){n=n||function(r,e){return r===e};var o,u={current:void 0,moveNext:function(){for(o||(o=r.en(e).distinct().getEnumerator()),u.current=void 0;o.moveNext();){for(var i=!1,c=t.getEnumerator();c.moveNext()&&!i;)i=n(o.current,c.current);if(i)return u.current=o.current,!0}return!1}};return u}r.Enumerable.prototype.intersect=function(t,n){var o=this,u=t instanceof Array?t.en():t,i=new r.Enumerable;return i.getEnumerator=function(){return e(o,u,n)},i},r.List&&(r.List.prototype.intersect=r.Enumerable.prototype.intersect)}(exjs||(exjs={}));var exjs;!function(r){function e(e,t,n,o,u,i){i=i||function(r,e){return r===e};var c,a,p=0,s={current:void 0,moveNext:function(){if(s.current=void 0,!c){if(c=e.getEnumerator(),!c.moveNext())return!1;a=r.en(t).toArray()}var f;do{for(;p=e?(t.current=void 0,!1):(t.current=r[n],!0)},t},t.prototype.remove=function(r){return this.removeWhere(function(e){return e===r}).any()},t.prototype.removeWhere=function(r){for(var e,t=[],n=this.length-1;n>=0;n--)e=this[n],r(e,n)===!0&&(this.splice(n,1),t.push(e));return t.en().reverse()}}(exjs||(exjs={}));var exjs;!function(r){function e(r,e,n,o){return new t(r,e,n,o)}var t=function(e){function t(r,t,n,o){e.call(this),this.Source=r,o=o||function(r,e){return r>e?1:e>r?-1:0};var u=n===!0?-1:1;this.Sorter=function(r,e){return u*o(t(r),t(e))}}return __extends(t,e),t.prototype.getEnumerator=function(){var e,t=this.Source,n=this.Sorter,o=0,u={current:void 0,moveNext:function(){return e||(e=r.en(t).toArray(),e.sort(n)),u.current=void 0,o>=e.length?!1:(u.current=e[o],o++,!0)}};return u},t.prototype.thenBy=function(r,e){return new n(this,r,!1,e)},t.prototype.thenByDescending=function(r,e){return new n(this,r,!0,e)},t}(r.Enumerable),n=function(r){function e(e,t,n,o){r.call(this,e,t,n,o);var u=e.Sorter,i=this.Sorter;this.Sorter=function(r,e){return u(r,e)||i(r,e)}}return __extends(e,r),e}(t),o=r.Enumerable.prototype;o.orderBy=function(r,t){return e(this,r,!1,t)},o.orderByDescending=function(r,t){return e(this,r,!0,t)},r.List&&(r.List.prototype.orderBy=r.Enumerable.prototype.orderBy,r.List.prototype.orderByDescending=r.Enumerable.prototype.orderByDescending)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n,o=1,u={current:void 0,moveNext:function(){if(2>o){if(t=t||e.en().getEnumerator(),t.moveNext())return u.current=t.current,!0;o++}return n=n||r.getEnumerator(),n.moveNext()?(u.current=n.current,!0):(u.current=void 0,!1)}};return u}r.Enumerable.prototype.prepend=function(){for(var t=this,n=[],o=0;o=e?!1:(o.current=n,!0)}};return o}function t(t,n,o){if(t=t||0,n=n||0,t>n)throw new Error("Start cannot be greater than end.");null==o&&(o=1);var u=new r.Enumerable;return u.getEnumerator=function(){return e(t,n,o)},u}r.range=t}(exjs||(exjs={}));var exjs;!function(r){function e(e){var t,n=0,o={current:void 0,moveNext:function(){return t||(t=r.en(e).toArray(),n=t.length),n--,o.current=t[n],n>=0}};return o}r.Enumerable.prototype.reverse=function(){var t=this,n=new r.Enumerable;return n.getEnumerator=function(){return e(t)},n},r.List&&(r.List.prototype.reverse=r.Enumerable.prototype.reverse)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){if(e=e||0,0===e)return Math.round(r);var t=Math.pow(10,e);return Math.round(r*t)/t}r.round=e}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n=0,o={current:void 0,moveNext:function(){return t||(t=r.getEnumerator()),t.moveNext()?(o.current=e(t.current,n),n++,!0):!1}};return o}function t(e,t){var n,o,u={current:void 0,moveNext:function(){for(u.current=void 0,n||(n=e.getEnumerator());!o||!o.moveNext();){if(!n.moveNext())return!1;o=r.selectorEnumerator(t(n.current))}return u.current=o.current,!0}};return u}r.Enumerable.prototype.select=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.Enumerable.prototype.selectMany=function(e){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return t(n,e)},o},r.List&&(r.List.prototype.select=r.Enumerable.prototype.select,r.List.prototype.selectMany=r.Enumerable.prototype.selectMany)}(exjs||(exjs={}));var exjs;!function(r){function e(r){return Array.isArray(r)?r.en().getEnumerator():null!=r&&"function"==typeof r.getEnumerator?r.getEnumerator():null}r.selectorEnumerator=e}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n={current:void 0,moveNext:function(){if(!t){t=r.getEnumerator();for(var o=0;e>o;o++)if(!t.moveNext())return!1}return t.moveNext()?(n.current=t.current,!0):(n.current=void 0,!1)}};return n}function t(r,e){var t,n={current:void 0,moveNext:function(){if(!t){t=r.getEnumerator();for(var o=0;t.moveNext();o++)if(!e(n.current=t.current,o))return!0;return n.current=void 0,!1}return t.moveNext()?(n.current=t.current,!0):(n.current=void 0,!1)}};return n}r.Enumerable.prototype.skip=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.Enumerable.prototype.skipWhile=function(e){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return t(n,e)},o},r.List&&(r.List.prototype.skip=r.Enumerable.prototype.skip,r.List.prototype.skipWhile=r.Enumerable.prototype.skipWhile)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n=0,o={current:void 0,moveNext:function(){return t||(t=r.getEnumerator()),n++,n>e?!1:(o.current=void 0,t.moveNext()?(o.current=t.current,!0):!1)}};return o}function t(r,e){var t,n=0,o={current:void 0,moveNext:function(){return t||(t=r.getEnumerator()),t.moveNext()&&e(t.current,n)?(n++,o.current=t.current,!0):(o.current=void 0,!1)}};return o}r.Enumerable.prototype.take=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.Enumerable.prototype.takeWhile=function(e){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return t(n,e)},o},r.List&&(r.List.prototype.take=r.Enumerable.prototype.take,r.List.prototype.takeWhile=r.Enumerable.prototype.takeWhile)}(exjs||(exjs={}));var exjs;!function(r){function e(e,t){var n,o=!1,u=[],i={current:void 0,moveNext:function(){if(o){if(null==n)return!1;u.push(n),n=r.selectorEnumerator(t(i.current))}else n=e.getEnumerator(),o=!0;for(;!(n&&n.moveNext()||u.length<1);)n=u.pop();return i.current=null==n?void 0:n.current,void 0!==i.current}};return i}function t(e,t,n){var o,u=!1,i=[],c={current:void 0,moveNext:function(){if(u){if(null==o)return!1;i.push(o),o=r.selectorEnumerator(t(c.current))}else o=e.getEnumerator(),u=!0;do{for(;!(o&&o.moveNext()||i.length<1);)o=i.pop();c.current=null==o?void 0:o.current}while(n(c.current));return void 0!==c.current}};return c}r.Enumerable.prototype.traverse=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.Enumerable.prototype.traverseUnique=function(e,n){var o=this,u=[],i=new r.Enumerable;return n?i.getEnumerator=function(){return t(o,e,function(r){return u.some(function(e){return n(r,e)})?!0:(u.push(r),!1)})}:i.getEnumerator=function(){return t(o,e,function(r){return u.indexOf(r)>-1?!0:(u.push(r),!1)})},i},r.List&&(r.List.prototype.traverse=r.Enumerable.prototype.traverse,r.List.prototype.traverseUnique=r.Enumerable.prototype.traverseUnique)}(exjs||(exjs={}));var exjs;!function(r){function e(e,t,n){n=n||function(r,e){return r===e};var o,u,i=[],c={current:void 0,moveNext:function(){if(o||(o=r.en(e).distinct().getEnumerator()),c.current=void 0,!u&&o.moveNext())return i.push(c.current=o.current),!0;for(u=u||r.en(t).distinct().getEnumerator();u.moveNext();){for(var a=0,p=!1,s=i.length;s>a&&!p;a++)p=n(i[a],u.current);if(!p)return c.current=u.current,!0}return!1}};return c}r.Enumerable.prototype.union=function(t,n){var o=this,u=t instanceof Array?t.en():t,i=new r.Enumerable;return i.getEnumerator=function(){return e(o,u,n)},i},r.List&&(r.List.prototype.union=r.Enumerable.prototype.union)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n={current:void 0,moveNext:function(){t||(t=r.getEnumerator());for(var o;t.moveNext();)if(e(o=t.current))return n.current=o,!0;return!1}};return n}r.Enumerable.prototype.where=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.List&&(r.List.prototype.where=r.Enumerable.prototype.where)}(exjs||(exjs={}));var exjs;!function(r){function e(e){var n=new r.Enumerable;return n.getEnumerator=function(){return t(e)},n}function t(r){var e=r.getEnumerator(),t={current:void 0,moveNext:void 0};return t.moveNext=function(){return e.moveNext()?(t.current=e.current,!0):(t.current=void 0,!1)},t}r.en=e}(exjs||(exjs={}));var ex=exjs.en,exjs;!function(r){function e(r,e,t){var n,o,u={current:void 0,moveNext:function(){return n||(n=r.getEnumerator()),o||(o=e.getEnumerator()),u.current=void 0,n.moveNext()&&o.moveNext()?(u.current=t(n.current,o.current),!0):!1}};return u}r.Enumerable.prototype.zip=function(t,n){var o=this,u=t instanceof Array?t.en():t,i=new r.Enumerable;return i.getEnumerator=function(){return e(o,u,n)},i},r.List&&(r.List.prototype.zip=r.Enumerable.prototype.zip)}(exjs||(exjs={})); -//# sourceMappingURL=ex.es3.min.js.map - -// extensions v0.1.11 https://github.com/edsilv/extensions -Array.prototype.clone||(Array.prototype.clone=function(){return this.slice(0)}),Array.prototype.contains||(Array.prototype.contains=function(val){return this.indexOf(val)!==-1}),Array.prototype.indexOf||(Array.prototype.indexOf=function(searchElement,fromIndex){var i=fromIndex||0,j=this.length;for(i;i>>0;if("function"!=typeof callback)throw new TypeError(callback+" is not a function");for(arguments.length>1&&(T=thisArg),A=new Array(len),k=0;k-1&&this.splice(index,1)},Array.prototype.removeAt=function(index){this.splice(index,1)},Math.clamp=function(value,min,max){return Math.min(Math.max(value,min),max)},Math.constrain=function(value,low,high){return Math.clamp(value,low,high)},Math.degreesToRadians=function(degrees){return Math.TAU*(degrees/360)},Math.distanceBetween=function(x1,y1,x2,y2){return Math.sqrt(Math.sq(x2-x1)+Math.sq(y2-y1))},Math.lerp=function(start,stop,amount){return start+(stop-start)*amount},Math.mag=function(a,b,c){return Math.sqrt(a*a+b*b+c*c)},Math.map=function(value,start1,stop1,start2,stop2){return start2+(stop2-start2)*((value-start1)/(stop1-start1))},Math.median=function(values){values.sort(function(a,b){return a-b});var half=Math.floor(values.length/2);return values.length%2?values[half]:(values[half-1]+values[half])/2},Math.normalise=function(num,min,max){return(num-min)/(max-min)},Math.radiansToDegrees=function(radians){return 360*radians/Math.TAU},Math.randomBetween=function(low,high){return high||(high=low,low=0),low>=high?low:low+(high-low)*Math.random()},Math.roundToDecimalPlace=function(num,dec){return Math.round(num*Math.pow(10,dec))/Math.pow(10,dec)},Math.sq=function(n){return n*n},Math.TAU=2*Math.PI,Number.prototype.isInteger||(Number.prototype.isInteger=function(){return this%1===0}),"function"!=typeof Object.create&&(Object.create=function(o,props){function F(){}F.prototype=o;var result=new F;if("object"==typeof props)for(var prop in props)props.hasOwnProperty(prop)&&(result[prop]=props[prop].value);return result}),Object.keys||(Object.keys=function(){var hasOwnProperty=Object.prototype.hasOwnProperty,hasDontEnumBug=!{toString:null}.propertyIsEnumerable("toString"),dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length;return function(obj){if("object"!=typeof obj&&"function"!=typeof obj||null===obj)throw new TypeError("Object.keys called on non-object");var result=[];for(var prop in obj)hasOwnProperty.call(obj,prop)&&result.push(prop);if(hasDontEnumBug)for(var i=0;i=65&&c<=90?"_"+s.toLowerCase():"__"+("000"+c.toString(16)).slice(-4)})},String.prototype.toFileName=function(){return this.replace(/[^a-z0-9]/gi,"_").toLowerCase()},String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}),String.prototype.utf8_to_b64=function(){return window.btoa(unescape(encodeURIComponent(this)))}; -var HTTPStatusCode; -(function (HTTPStatusCode) { - HTTPStatusCode.CONTINUE = 100; - HTTPStatusCode.SWITCHING_PROTOCOLS = 101; - HTTPStatusCode.PROCESSING = 102; - HTTPStatusCode.OK = 200; - HTTPStatusCode.CREATED = 201; - HTTPStatusCode.ACCEPTED = 202; - HTTPStatusCode.NON_AUTHORITATIVE_INFORMATION = 203; - HTTPStatusCode.NO_CONTENT = 204; - HTTPStatusCode.RESET_CONTENT = 205; - HTTPStatusCode.PARTIAL_CONTENT = 206; - HTTPStatusCode.MULTI_STATUS = 207; - HTTPStatusCode.MULTIPLE_CHOICES = 300; - HTTPStatusCode.MOVED_PERMANENTLY = 301; - HTTPStatusCode.MOVED_TEMPORARILY = 302; - HTTPStatusCode.SEE_OTHER = 303; - HTTPStatusCode.NOT_MODIFIED = 304; - HTTPStatusCode.USE_PROXY = 305; - HTTPStatusCode.TEMPORARY_REDIRECT = 307; - HTTPStatusCode.BAD_REQUEST = 400; - HTTPStatusCode.UNAUTHORIZED = 401; - HTTPStatusCode.PAYMENT_REQUIRED = 402; - HTTPStatusCode.FORBIDDEN = 403; - HTTPStatusCode.NOT_FOUND = 404; - HTTPStatusCode.METHOD_NOT_ALLOWED = 405; - HTTPStatusCode.NOT_ACCEPTABLE = 406; - HTTPStatusCode.PROXY_AUTHENTICATION_REQUIRED = 407; - HTTPStatusCode.REQUEST_TIME_OUT = 408; - HTTPStatusCode.CONFLICT = 409; - HTTPStatusCode.GONE = 410; - HTTPStatusCode.LENGTH_REQUIRED = 411; - HTTPStatusCode.PRECONDITION_FAILED = 412; - HTTPStatusCode.REQUEST_ENTITY_TOO_LARGE = 413; - HTTPStatusCode.REQUEST_URI_TOO_LARGE = 414; - HTTPStatusCode.UNSUPPORTED_MEDIA_TYPE = 415; - HTTPStatusCode.REQUESTED_RANGE_NOT_SATISFIABLE = 416; - HTTPStatusCode.EXPECTATION_FAILED = 417; - HTTPStatusCode.IM_A_TEAPOT = 418; - HTTPStatusCode.UNPROCESSABLE_ENTITY = 422; - HTTPStatusCode.LOCKED = 423; - HTTPStatusCode.FAILED_DEPENDENCY = 424; - HTTPStatusCode.UNORDERED_COLLECTION = 425; - HTTPStatusCode.UPGRADE_REQUIRED = 426; - HTTPStatusCode.PRECONDITION_REQUIRED = 428; - HTTPStatusCode.TOO_MANY_REQUESTS = 429; - HTTPStatusCode.REQUEST_HEADER_FIELDS_TOO_LARGE = 431; - HTTPStatusCode.INTERNAL_SERVER_ERROR = 500; - HTTPStatusCode.NOT_IMPLEMENTED = 501; - HTTPStatusCode.BAD_GATEWAY = 502; - HTTPStatusCode.SERVICE_UNAVAILABLE = 503; - HTTPStatusCode.GATEWAY_TIME_OUT = 504; - HTTPStatusCode.HTTP_VERSION_NOT_SUPPORTED = 505; - HTTPStatusCode.VARIANT_ALSO_NEGOTIATES = 506; - HTTPStatusCode.INSUFFICIENT_STORAGE = 507; - HTTPStatusCode.BANDWIDTH_LIMIT_EXCEEDED = 509; - HTTPStatusCode.NOT_EXTENDED = 510; - HTTPStatusCode.NETWORK_AUTHENTICATION_REQUIRED = 511; -})(HTTPStatusCode || (HTTPStatusCode = {})); - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.manifesto = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o -1 || - this.externalResource.data['@context'].indexOf('/1.1/context.json') > -1 || - this.externalResource.data['@context'].indexOf('/1/context.json') > -1) { - quality = 'native'; - } - } - } - else { - // info.json hasn't been loaded yet - var images = this.getImages(); - if (images && images.length) { - var firstImage = images[0]; - var resource = firstImage.getResource(); - var services = resource.getServices(); - if (!width) { - width = resource.getWidth(); - } - if (services.length) { - var service = services[0]; - id = service.id; - quality = Manifesto.Utils.getImageQuality(service.getProfile()); - } - } - // todo: this is not compatible and should be moved to getThumbUri - if (!id) { - return "undefined" == typeof this.__jsonld.thumbnail - ? null : this.__jsonld.thumbnail; - } - } - size = width + ','; - var uri = [id, region, size, rotation, quality + '.jpg'].join('/'); - return uri; - }; - Canvas.prototype.getImages = function () { - var images = []; - if (!this.__jsonld.images) - return images; - for (var i = 0; i < this.__jsonld.images.length; i++) { - var a = this.__jsonld.images[i]; - var annotation = new Manifesto.Annotation(a, this.options); - images.push(annotation); - } - return images; - }; - Canvas.prototype.getIndex = function () { - return this.getProperty('index'); - }; - // Prefer thumbnail service to image service if supplied and if - // the thumbnail service can provide a satisfactory size +/- x pixels. - // this is used to get thumb URIs *before* the info.json has been requested - // and populate thumbnails in a viewer. - // the publisher may also provide pre-computed fixed-size thumbs for better performance. - //getThumbUri(width: number): string { - // - // var uri; - // var images: IAnnotation[] = this.getImages(); - // - // if (images && images.length) { - // var firstImage = images[0]; - // var resource: IResource = firstImage.getResource(); - // var services: IService[] = resource.getServices(); - // - // for (var i = 0; i < services.length; i++) { - // var service: IService = services[i]; - // var id = service.id; - // - // if (!_endsWith(id, '/')) { - // id += '/'; - // } - // - // uri = id + 'full/' + width + ',/0/' + Utils.getImageQuality(service.getProfile()) + '.jpg'; - // } - // } - // - // return uri; - //} - //getType(): CanvasType { - // return new CanvasType(this.getProperty('@type').toLowerCase()); - //} - Canvas.prototype.getWidth = function () { - return this.getProperty('width'); - }; - Canvas.prototype.getHeight = function () { - return this.getProperty('height'); - }; - return Canvas; - }(Manifesto.Element)); - Manifesto.Canvas = Canvas; -})(Manifesto || (Manifesto = {})); - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var _assign = require("lodash.assign"); -var Manifesto; -(function (Manifesto) { - var IIIFResource = (function (_super) { - __extends(IIIFResource, _super); - function IIIFResource(jsonld, options) { - _super.call(this, jsonld, options); - this.index = -1; - this.isLoaded = false; - var defaultOptions = { - defaultLabel: '-', - locale: 'en-GB', - resource: this, - pessimisticAccessControl: false - }; - this.options = _assign(defaultOptions, options); - } - IIIFResource.prototype.getAttribution = function () { - var attribution = this.getProperty('attribution'); - if (attribution) { - return Manifesto.TranslationCollection.parse(attribution, this.options.locale); - } - return []; - }; - IIIFResource.prototype.getDescription = function () { - var description = this.getProperty('description'); - if (description) { - return Manifesto.TranslationCollection.parse(description, this.options.locale); - } - return []; - }; - IIIFResource.prototype.getIIIFResourceType = function () { - return new Manifesto.IIIFResourceType(this.getProperty('@type')); - }; - IIIFResource.prototype.getLogo = function () { - var logo = this.getProperty('logo'); - if (!logo) - return null; - if (_isString(logo)) - return logo; - return logo['@id']; - }; - IIIFResource.prototype.getLicense = function () { - return Manifesto.Utils.getLocalisedValue(this.getProperty('license'), this.options.locale); - }; - IIIFResource.prototype.getNavDate = function () { - return new Date(this.getProperty('navDate')); - }; - IIIFResource.prototype.getRelated = function () { - return this.getProperty('related'); - }; - IIIFResource.prototype.getSeeAlso = function () { - return this.getProperty('seeAlso'); - }; - IIIFResource.prototype.getLabel = function () { - var label = this.getProperty('label'); - if (label) { - return Manifesto.TranslationCollection.parse(label, this.options.locale); - } - return []; - }; - IIIFResource.prototype.getDefaultTree = function () { - this.defaultTree = new Manifesto.TreeNode('root'); - this.defaultTree.data = this; - return this.defaultTree; - }; - IIIFResource.prototype.isCollection = function () { - return this.getIIIFResourceType().toString() === Manifesto.IIIFResourceType.COLLECTION.toString(); - }; - IIIFResource.prototype.isManifest = function () { - return this.getIIIFResourceType().toString() === Manifesto.IIIFResourceType.MANIFEST.toString(); - }; - IIIFResource.prototype.load = function () { - var that = this; - return new Promise(function (resolve, reject) { - if (that.isLoaded) { - resolve(that); - } - else { - var options = that.options; - options.navDate = that.getNavDate(); - Manifesto.Utils.loadResource(that.__jsonld['@id']).then(function (data) { - that.parentLabel = Manifesto.TranslationCollection.getValue(that.getLabel(), options.locale); - var parsed = Manifesto.Deserialiser.parse(data, options); - that = _assign(that, parsed); - that.index = options.index; - resolve(that); - }); - } - }); - }; - return IIIFResource; - }(Manifesto.ManifestResource)); - Manifesto.IIIFResource = IIIFResource; -})(Manifesto || (Manifesto = {})); - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var _isArray = require("lodash.isarray"); -var _map = require("lodash.map"); -var Manifesto; -(function (Manifesto) { - var Manifest = (function (_super) { - __extends(Manifest, _super); - function Manifest(jsonld, options) { - _super.call(this, jsonld, options); - this.index = 0; - this._allRanges = null; - this._sequences = null; - this._topRanges = []; - if (this.__jsonld.structures && this.__jsonld.structures.length) { - var topRanges = this._getTopRanges(); - for (var i = 0; i < topRanges.length; i++) { - var range = topRanges[i]; - this._parseRanges(range, String(i)); - } - } - } - Manifest.prototype.getDefaultTree = function () { - _super.prototype.getDefaultTree.call(this); - this.defaultTree.data.type = Manifesto.TreeNodeType.MANIFEST.toString(); - if (!this.isLoaded) { - return this.defaultTree; - } - var topRanges = this.getTopRanges(); - // if there are any ranges in the manifest, default to the first 'top' range or generated placeholder - if (topRanges.length) { - topRanges[0].getTree(this.defaultTree); - } - Manifesto.Utils.generateTreeNodeIds(this.defaultTree); - return this.defaultTree; - }; - Manifest.prototype._getTopRanges = function () { - var topRanges = []; - if (this.__jsonld.structures && this.__jsonld.structures.length) { - for (var i = 0; i < this.__jsonld.structures.length; i++) { - var json = this.__jsonld.structures[i]; - if (json.viewingHint === Manifesto.ViewingHint.TOP.toString()) { - topRanges.push(json); - } - } - // if no viewingHint="top" range was found, create a default one - if (!topRanges.length) { - var range = {}; - range.ranges = this.__jsonld.structures; - topRanges.push(range); - } - } - return topRanges; - }; - Manifest.prototype.getTopRanges = function () { - return this._topRanges; - }; - Manifest.prototype._getRangeById = function (id) { - if (this.__jsonld.structures && this.__jsonld.structures.length) { - for (var i = 0; i < this.__jsonld.structures.length; i++) { - var r = this.__jsonld.structures[i]; - if (r['@id'] === id) { - return r; - } - } - } - return null; - }; - Manifest.prototype._parseRangeCanvas = function (json, range) { - // todo: currently this isn't needed - //var canvas: IJSONLDResource = new JSONLDResource(json); - //range.members.push(canvas); - }; - Manifest.prototype._parseRanges = function (r, path, parentRange) { - var range; - var id; - if (_isString(r)) { - id = r; - r = this._getRangeById(id); - } - if (!r) { - console.warn("Range:", id, "does not exist"); - return; - } - range = new Manifesto.Range(r, this.options); - range.parentRange = parentRange; - range.path = path; - if (!parentRange) { - this._topRanges.push(range); - } - else { - parentRange.members.push(range); - } - if (r.ranges) { - for (var i = 0; i < r.ranges.length; i++) { - this._parseRanges(r.ranges[i], path + '/' + i, range); - } - } - if (r.members) { - var _loop_1 = function(i) { - var child = r.members[i]; - // only add to members if not already parsed from backwards-compatible ranges/canvases arrays - if (r.members.en().where(function (m) { return m.id === child.id; }).first()) { - return "continue"; - } - if (child['@type'].toLowerCase() === 'sc:range') { - this_1._parseRanges(child, path + '/' + i, range); - } - }; - var this_1 = this; - for (var i = 0; i < r.members.length; i++) { - var state_1 = _loop_1(i); - if (state_1 === "continue") continue; - } - } - }; - Manifest.prototype.getAllRanges = function () { - if (this._allRanges != null) - return this._allRanges; - this._allRanges = []; - var topRanges = this.getTopRanges(); - for (var i = 0; i < topRanges.length; i++) { - var topRange = topRanges[i]; - if (topRange.id) { - this._allRanges.push(topRange); // it might be a placeholder root range - } - var subRanges = topRange.getRanges(); - this._allRanges = this._allRanges.concat(subRanges.en().traverseUnique(function (range) { return range.getRanges(); }).toArray()); - } - return this._allRanges; - }; - Manifest.prototype.getRangeById = function (id) { - var ranges = this.getAllRanges(); - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - if (range.id === id) { - return range; - } - } - return null; - }; - Manifest.prototype.getRangeByPath = function (path) { - var ranges = this.getAllRanges(); - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - if (range.path === path) { - return range; - } - } - return null; - }; - Manifest.prototype.getSequences = function () { - if (this._sequences != null) - return this._sequences; - this._sequences = []; - // if IxIF mediaSequences is present, use that. Otherwise fall back to IIIF sequences. - var children = this.__jsonld.mediaSequences || this.__jsonld.sequences; - if (children) { - for (var i = 0; i < children.length; i++) { - var s = children[i]; - var sequence = new Manifesto.Sequence(s, this.options); - this._sequences.push(sequence); - } - } - return this._sequences; - }; - Manifest.prototype.getSequenceByIndex = function (sequenceIndex) { - return this.getSequences()[sequenceIndex]; - }; - Manifest.prototype.getTotalSequences = function () { - return this.getSequences().length; - }; - Manifest.prototype.getManifestType = function () { - var service = this.getService(Manifesto.ServiceProfile.UIEXTENSIONS); - if (service) { - return new Manifesto.ManifestType(service.getProperty('manifestType')); - } - return new Manifesto.ManifestType(''); - }; - Manifest.prototype.getTrackingLabel = function () { - var service = this.getService(Manifesto.ServiceProfile.TRACKINGEXTENSIONS); - if (service) { - return service.getProperty('trackingLabel'); - } - return ''; - }; - Manifest.prototype.isMultiSequence = function () { - return this.getTotalSequences() > 1; - }; - Manifest.prototype.isPagingEnabled = function () { - return this.getViewingHint().toString() === Manifesto.ViewingHint.PAGED.toString(); - }; - Manifest.prototype.getViewingDirection = function () { - if (this.getProperty('viewingDirection')) { - return new Manifesto.ViewingDirection(this.getProperty('viewingDirection')); - } - return Manifesto.ViewingDirection.LEFTTORIGHT; - }; - Manifest.prototype.getViewingHint = function () { - if (this.getProperty('viewingHint')) { - return new Manifesto.ViewingHint(this.getProperty('viewingHint')); - } - return Manifesto.ViewingHint.EMPTY; - }; - return Manifest; - }(Manifesto.IIIFResource)); - Manifesto.Manifest = Manifest; -})(Manifesto || (Manifesto = {})); - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Manifesto; -(function (Manifesto) { - var Collection = (function (_super) { - __extends(Collection, _super); - function Collection(jsonld, options) { - _super.call(this, jsonld, options); - this.members = []; - this._collections = null; - this._manifests = null; - jsonld.__collection = this; - } - Collection.prototype.getCollections = function () { - if (this._collections) { - return this._collections; - } - return this._collections = this.members.en().where(function (m) { return m.isCollection(); }).toArray(); - }; - Collection.prototype.getManifests = function () { - if (this._manifests) { - return this._manifests; - } - return this._manifests = this.members.en().where(function (m) { return m.isManifest(); }).toArray(); - }; - Collection.prototype.getCollectionByIndex = function (collectionIndex) { - var collection = this.getCollections()[collectionIndex]; - collection.options.index = collectionIndex; - // id for collection MUST be dereferenceable - return collection.load(); - }; - Collection.prototype.getManifestByIndex = function (manifestIndex) { - var manifest = this.getManifests()[manifestIndex]; - manifest.options.index = manifestIndex; - return manifest.load(); - }; - Collection.prototype.getTotalCollections = function () { - return this.getCollections().length; - }; - Collection.prototype.getTotalManifests = function () { - return this.getManifests().length; - }; - Collection.prototype.getTotalMembers = function () { - return this.members.length; - }; - /** - * Get a tree of sub collections and manifests, using each child manifest's first 'top' range. - */ - Collection.prototype.getDefaultTree = function () { - _super.prototype.getDefaultTree.call(this); - this.defaultTree.data.type = Manifesto.TreeNodeType.COLLECTION.toString(); - this._parseManifests(this); - this._parseCollections(this); - Manifesto.Utils.generateTreeNodeIds(this.defaultTree); - return this.defaultTree; - }; - Collection.prototype._parseManifests = function (parentCollection) { - if (parentCollection.getManifests() && parentCollection.getManifests().length) { - for (var i = 0; i < parentCollection.getManifests().length; i++) { - var manifest = parentCollection.getManifests()[i]; - var tree = manifest.getDefaultTree(); - tree.label = manifest.parentLabel || Manifesto.TranslationCollection.getValue(manifest.getLabel(), this.options.locale) || 'manifest ' + (i + 1); - tree.navDate = manifest.getNavDate(); - tree.data.id = manifest.id; - tree.data.type = Manifesto.TreeNodeType.MANIFEST.toString(); - parentCollection.defaultTree.addNode(tree); - } - } - }; - Collection.prototype._parseCollections = function (parentCollection) { - if (parentCollection.getCollections() && parentCollection.getCollections().length) { - for (var i = 0; i < parentCollection.getCollections().length; i++) { - var collection = parentCollection.getCollections()[i]; - var tree = collection.getDefaultTree(); - tree.label = collection.parentLabel || Manifesto.TranslationCollection.getValue(collection.getLabel(), this.options.locale) || 'collection ' + (i + 1); - tree.navDate = collection.getNavDate(); - tree.data.id = collection.id; - tree.data.type = Manifesto.TreeNodeType.COLLECTION.toString(); - parentCollection.defaultTree.addNode(tree); - this._parseCollections(collection); - } - } - }; - return Collection; - }(Manifesto.IIIFResource)); - Manifesto.Collection = Collection; -})(Manifesto || (Manifesto = {})); - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Manifesto; -(function (Manifesto) { - var Range = (function (_super) { - __extends(Range, _super); - function Range(jsonld, options) { - _super.call(this, jsonld, options); - this._canvases = null; - this._ranges = null; - this.members = []; - } - Range.prototype.getCanvasIds = function () { - if (this.__jsonld.canvases) { - return this.__jsonld.canvases; - } - return []; - }; - Range.prototype.getCanvases = function () { - if (this._canvases) { - return this._canvases; - } - return this._canvases = this.members.en().where(function (m) { return m.isCanvas(); }).toArray(); - }; - Range.prototype.getRanges = function () { - if (this._ranges) { - return this._ranges; - } - return this._ranges = this.members.en().where(function (m) { return m.isRange(); }).toArray(); - }; - Range.prototype.getViewingDirection = function () { - if (this.getProperty('viewingDirection')) { - return new Manifesto.ViewingDirection(this.getProperty('viewingDirection')); - } - return null; - }; - Range.prototype.getViewingHint = function () { - if (this.getProperty('viewingHint')) { - return new Manifesto.ViewingHint(this.getProperty('viewingHint')); - } - return null; - }; - Range.prototype.getTree = function (treeRoot) { - treeRoot.data = this; - this.treeNode = treeRoot; - var ranges = this.getRanges(); - if (ranges && ranges.length) { - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - var node = new Manifesto.TreeNode(); - treeRoot.addNode(node); - this._parseTreeNode(node, range); - } - } - Manifesto.Utils.generateTreeNodeIds(treeRoot); - return treeRoot; - }; - Range.prototype._parseTreeNode = function (node, range) { - node.label = Manifesto.TranslationCollection.getValue(range.getLabel(), this.options.locale); - node.data = range; - node.data.type = Manifesto.TreeNodeType.RANGE.toString(); - range.treeNode = node; - var ranges = range.getRanges(); - if (ranges && ranges.length) { - for (var i = 0; i < ranges.length; i++) { - var childRange = ranges[i]; - var childNode = new Manifesto.TreeNode(); - node.addNode(childNode); - this._parseTreeNode(childNode, childRange); - } - } - }; - return Range; - }(Manifesto.ManifestResource)); - Manifesto.Range = Range; -})(Manifesto || (Manifesto = {})); - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Manifesto; -(function (Manifesto) { - var Rendering = (function (_super) { - __extends(Rendering, _super); - function Rendering(jsonld, options) { - _super.call(this, jsonld, options); - } - Rendering.prototype.getFormat = function () { - return new Manifesto.RenderingFormat(this.getProperty('format')); - }; - return Rendering; - }(Manifesto.ManifestResource)); - Manifesto.Rendering = Rendering; -})(Manifesto || (Manifesto = {})); - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var _last = require("lodash.last"); -var Manifesto; -(function (Manifesto) { - var Sequence = (function (_super) { - __extends(Sequence, _super); - function Sequence(jsonld, options) { - _super.call(this, jsonld, options); - this.canvases = null; - } - Sequence.prototype.getCanvases = function () { - if (this.canvases != null) - return this.canvases; - this.canvases = []; - // if IxIF elements are present, use them. Otherwise fall back to IIIF canvases. - var children = this.__jsonld.elements || this.__jsonld.canvases; - if (children) { - for (var i = 0; i < children.length; i++) { - var c = children[i]; - var canvas = new Manifesto.Canvas(c, this.options); - canvas.index = i; - this.canvases.push(canvas); - } - } - return this.canvases; - }; - Sequence.prototype.getCanvasById = function (id) { - for (var i = 0; i < this.getTotalCanvases(); i++) { - var canvas = this.getCanvasByIndex(i); - if (canvas.id === id) { - return canvas; - } - } - return null; - }; - Sequence.prototype.getCanvasByIndex = function (canvasIndex) { - return this.getCanvases()[canvasIndex]; - }; - Sequence.prototype.getCanvasIndexById = function (id) { - for (var i = 0; i < this.getTotalCanvases(); i++) { - var canvas = this.getCanvasByIndex(i); - if (canvas.id === id) { - return i; - } - } - return null; - }; - Sequence.prototype.getCanvasIndexByLabel = function (label, foliated) { - label = label.trim(); - if (!isNaN(label)) { - label = parseInt(label, 10).toString(); // trim any preceding zeros. - if (foliated) - label += 'r'; // default to recto - } - var doublePageRegExp = /(\d*)\D+(\d*)/; - var match, regExp, regStr, labelPart1, labelPart2; - for (var i = 0; i < this.getTotalCanvases(); i++) { - var canvas = this.getCanvasByIndex(i); - // check if there's a literal match - if (Manifesto.TranslationCollection.getValue(canvas.getLabel(), this.options.locale) === label) { - return i; - } - // check if there's a match for double-page spreads e.g. 100-101, 100_101, 100 101 - match = doublePageRegExp.exec(label); - if (!match) - continue; - labelPart1 = match[1]; - labelPart2 = match[2]; - if (!labelPart2) - continue; - regStr = "^" + labelPart1 + "\\D+" + labelPart2 + "$"; - regExp = new RegExp(regStr); - if (regExp.test(canvas.getLabel())) { - return i; - } - } - return -1; - }; - Sequence.prototype.getLastCanvasLabel = function (alphanumeric) { - for (var i = this.getTotalCanvases() - 1; i >= 0; i--) { - var canvas = this.getCanvasByIndex(i); - var label = Manifesto.TranslationCollection.getValue(canvas.getLabel(), this.options.locale); - if (alphanumeric) { - var regExp = /^[a-zA-Z0-9]*$/; - if (regExp.test(label)) { - return label; - } - } - else if (label) { - return label; - } - } - return this.options.defaultLabel; - }; - Sequence.prototype.getLastPageIndex = function () { - return this.getTotalCanvases() - 1; - }; - Sequence.prototype.getNextPageIndex = function (canvasIndex, pagingEnabled) { - var index; - if (pagingEnabled) { - var indices = this.getPagedIndices(canvasIndex); - if (this.getViewingDirection().toString() === Manifesto.ViewingDirection.RIGHTTOLEFT.toString()) { - index = indices[0] + 1; - } - else { - index = _last(indices) + 1; - } - } - else { - index = canvasIndex + 1; - } - if (index > this.getLastPageIndex()) { - return -1; - } - return index; - }; - Sequence.prototype.getPagedIndices = function (canvasIndex, pagingEnabled) { - var indices = []; - if (!pagingEnabled) { - indices.push(canvasIndex); - } - else { - if (this.isFirstCanvas(canvasIndex) || this.isLastCanvas(canvasIndex)) { - indices = [canvasIndex]; - } - else if (canvasIndex % 2) { - indices = [canvasIndex, canvasIndex + 1]; - } - else { - indices = [canvasIndex - 1, canvasIndex]; - } - if (this.getViewingDirection().toString() === Manifesto.ViewingDirection.RIGHTTOLEFT.toString()) { - indices = indices.reverse(); - } - } - return indices; - }; - Sequence.prototype.getPrevPageIndex = function (canvasIndex, pagingEnabled) { - var index; - if (pagingEnabled) { - var indices = this.getPagedIndices(canvasIndex); - if (this.getViewingDirection().toString() === Manifesto.ViewingDirection.RIGHTTOLEFT.toString()) { - index = _last(indices) - 1; - } - else { - index = indices[0] - 1; - } - } - else { - index = canvasIndex - 1; - } - return index; - }; - Sequence.prototype.getStartCanvasIndex = function () { - var startCanvas = this.getStartCanvas(); - if (startCanvas) { - // if there's a startCanvas attribute, loop through the canvases and return the matching index. - for (var i = 0; i < this.getTotalCanvases(); i++) { - var canvas = this.getCanvasByIndex(i); - if (canvas.id === startCanvas) - return i; - } - } - // default to first canvas. - return 0; - }; - Sequence.prototype.getThumbs = function (width, height) { - var thumbs = []; - var totalCanvases = this.getTotalCanvases(); - for (var i = 0; i < totalCanvases; i++) { - var canvas = this.getCanvasByIndex(i); - thumbs.push(new Manifesto.Thumb(width, canvas)); - } - return thumbs; - }; - Sequence.prototype.getStartCanvas = function () { - return this.getProperty('startCanvas'); - }; - Sequence.prototype.getTotalCanvases = function () { - return this.getCanvases().length; - }; - Sequence.prototype.getViewingDirection = function () { - if (this.getProperty('viewingDirection')) { - return new Manifesto.ViewingDirection(this.getProperty('viewingDirection')); - } - else if (this.options.resource.getViewingDirection) { - return this.options.resource.getViewingDirection(); - } - return Manifesto.ViewingDirection.LEFTTORIGHT; - }; - Sequence.prototype.getViewingHint = function () { - if (this.getProperty('viewingHint')) { - return new Manifesto.ViewingHint(this.getProperty('viewingHint')); - } - return Manifesto.ViewingHint.EMPTY; - }; - Sequence.prototype.isCanvasIndexOutOfRange = function (canvasIndex) { - return canvasIndex > this.getTotalCanvases() - 1; - }; - Sequence.prototype.isFirstCanvas = function (canvasIndex) { - return canvasIndex === 0; - }; - Sequence.prototype.isLastCanvas = function (canvasIndex) { - return canvasIndex === this.getTotalCanvases() - 1; - }; - Sequence.prototype.isMultiCanvas = function () { - return this.getTotalCanvases() > 1; - }; - Sequence.prototype.isPagingEnabled = function () { - return this.getViewingHint().toString() === Manifesto.ViewingHint.PAGED.toString(); - }; - // checks if the number of canvases is even - therefore has a front and back cover - Sequence.prototype.isTotalCanvasesEven = function () { - return this.getTotalCanvases() % 2 === 0; - }; - return Sequence; - }(Manifesto.ManifestResource)); - Manifesto.Sequence = Sequence; -})(Manifesto || (Manifesto = {})); - -var _isString = require("lodash.isstring"); -var Manifesto; -(function (Manifesto) { - var Deserialiser = (function () { - function Deserialiser() { - } - Deserialiser.parse = function (manifest, options) { - return this.parseJson(JSON.parse(manifest), options); - }; - Deserialiser.parseJson = function (json, options) { - var resource; - // have options been passed for the manifest to inherit? - if (options) { - if (options.navDate && !isNaN(options.navDate.getTime())) { - json.navDate = options.navDate.toString(); - } - } - switch (json['@type']) { - case 'sc:Collection': - resource = this.parseCollection(json, options); - break; - case 'sc:Manifest': - resource = this.parseManifest(json, options); - break; - default: - return null; - } - // Top-level resource was loaded from a URI, so flag it to prevent - // unnecessary reload: - resource.isLoaded = true; - return resource; - }; - Deserialiser.parseCollection = function (json, options) { - var collection = new Manifesto.Collection(json, options); - if (options) { - collection.index = options.index || 0; - } - else { - collection.index = 0; - } - this.parseCollections(collection, options); - this.parseManifests(collection, options); - this.parseMembers(collection, options); - return collection; - }; - Deserialiser.parseCollections = function (collection, options) { - var children = collection.__jsonld.collections; - if (children) { - for (var i = 0; i < children.length; i++) { - if (options) { - options.index = i; - } - var child = this.parseCollection(children[i], options); - child.index = i; - child.parentCollection = collection; - collection.members.push(child); - } - } - }; - Deserialiser.parseManifest = function (json, options) { - var manifest = new Manifesto.Manifest(json, options); - return manifest; - }; - Deserialiser.parseManifests = function (collection, options) { - var children = collection.__jsonld.manifests; - if (children) { - for (var i = 0; i < children.length; i++) { - var child = this.parseManifest(children[i], options); - child.index = i; - child.parentCollection = collection; - collection.members.push(child); - } - } - }; - Deserialiser.parseMember = function (json, options) { - if (json['@type'].toLowerCase() === 'sc:manifest') { - return this.parseManifest(json, options); - } - else if (json['@type'].toLowerCase() === 'sc:collection') { - return this.parseCollection(json, options); - } - }; - Deserialiser.parseMembers = function (collection, options) { - var children = collection.__jsonld.members; - if (children) { - for (var i = 0; i < children.length; i++) { - if (options) { - options.index = i; - } - var child = this.parseMember(children[i], options); - // only add to members if not already parsed from backwards-compatible collections/manifests arrays - if (collection.members.en().where(function (m) { return m.id === child.id; }).first()) { - continue; - } - child.index = i; - child.parentCollection = collection; - collection.members.push(child); - } - } - }; - return Deserialiser; - }()); - Manifesto.Deserialiser = Deserialiser; - var Serialiser = (function () { - function Serialiser() { - } - Serialiser.serialise = function (manifest) { - // todo - return ""; - }; - return Serialiser; - }()); - Manifesto.Serialiser = Serialiser; -})(Manifesto || (Manifesto = {})); - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var _endsWith = require("lodash.endswith"); -var _isArray = require("lodash.isarray"); -var Manifesto; -(function (Manifesto) { - var Service = (function (_super) { - __extends(Service, _super); - function Service(jsonld, options) { - _super.call(this, jsonld, options); - } - Service.prototype.getProfile = function () { - var profile = this.getProperty('profile'); - if (!profile) { - profile = this.getProperty('dcterms:conformsTo'); - } - if (_isArray(profile)) { - return new Manifesto.ServiceProfile(profile[0]); - } - return new Manifesto.ServiceProfile(profile); - }; - Service.prototype.getDescription = function () { - return Manifesto.Utils.getLocalisedValue(this.getProperty('description'), this.options.locale); - }; - Service.prototype.getInfoUri = function () { - var infoUri = this.id; - if (!_endsWith(infoUri, '/')) { - infoUri += '/'; - } - infoUri += 'info.json'; - return infoUri; - }; - return Service; - }(Manifesto.ManifestResource)); - Manifesto.Service = Service; -})(Manifesto || (Manifesto = {})); - - - -var Manifesto; -(function (Manifesto) { - var Thumb = (function () { - function Thumb(width, canvas) { - this.data = canvas; - this.index = canvas.index; - this.width = width; - var heightRatio = canvas.getHeight() / canvas.getWidth(); - if (heightRatio) { - this.height = Math.floor(this.width * heightRatio); - } - else { - this.height = width; - } - this.uri = canvas.getCanonicalImageUri(width); - this.label = Manifesto.TranslationCollection.getValue(canvas.getLabel()); // todo: pass locale? - } - return Thumb; - }()); - Manifesto.Thumb = Thumb; -})(Manifesto || (Manifesto = {})); - - - -var Manifesto; -(function (Manifesto) { - var TreeNode = (function () { - function TreeNode(label, data) { - this.label = label; - this.data = data || {}; - this.nodes = []; - } - TreeNode.prototype.addNode = function (node) { - this.nodes.push(node); - node.parentNode = this; - }; - TreeNode.prototype.isCollection = function () { - return this.data.type === Manifesto.TreeNodeType.COLLECTION.toString(); - }; - TreeNode.prototype.isManifest = function () { - return this.data.type === Manifesto.TreeNodeType.MANIFEST.toString(); - }; - TreeNode.prototype.isRange = function () { - return this.data.type === Manifesto.TreeNodeType.RANGE.toString(); - }; - return TreeNode; - }()); - Manifesto.TreeNode = TreeNode; -})(Manifesto || (Manifesto = {})); - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Manifesto; -(function (Manifesto) { - var TreeNodeType = (function (_super) { - __extends(TreeNodeType, _super); - function TreeNodeType() { - _super.apply(this, arguments); - } - // todo: use getters when ES3 target is no longer required. - TreeNodeType.prototype.collection = function () { - return new TreeNodeType(TreeNodeType.COLLECTION.toString()); - }; - TreeNodeType.prototype.manifest = function () { - return new TreeNodeType(TreeNodeType.MANIFEST.toString()); - }; - TreeNodeType.prototype.range = function () { - return new TreeNodeType(TreeNodeType.RANGE.toString()); - }; - TreeNodeType.COLLECTION = new TreeNodeType("sc:collection"); - TreeNodeType.MANIFEST = new TreeNodeType("sc:manifest"); - TreeNodeType.RANGE = new TreeNodeType("sc:range"); - return TreeNodeType; - }(Manifesto.StringValue)); - Manifesto.TreeNodeType = TreeNodeType; -})(Manifesto || (Manifesto = {})); - -var http = require("http"); -var https = require("https"); -var url = require("url"); -var Manifesto; -(function (Manifesto) { - var Utils = (function () { - function Utils() { - } - Utils.getImageQuality = function (profile) { - var p = profile.toString(); - if (p === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE1.toString() || - p === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE2.toString() || - p === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE1.toString() || - p === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE2.toString() || - p === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE1.toString() || - p === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE2.toString() || - p === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE1.toString() || - p === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE2.toString() || - p === Manifesto.ServiceProfile.IIIF1IMAGELEVEL1.toString() || - p === Manifesto.ServiceProfile.IIIF1IMAGELEVEL1PROFILE.toString() || - p === Manifesto.ServiceProfile.IIIF1IMAGELEVEL2.toString() || - p === Manifesto.ServiceProfile.IIIF1IMAGELEVEL2PROFILE.toString()) { - return 'native'; - } - return 'default'; - }; - Utils.getInexactLocale = function (locale) { - if (locale.indexOf('-') !== -1) { - return locale.substr(0, locale.indexOf('-')); - } - return locale; - }; - Utils.getLocalisedValue = function (resource, locale) { - // if the resource is not an array of translations, return the string. - if (!_isArray(resource)) { - return resource; - } - // test for exact match - for (var i = 0; i < resource.length; i++) { - var value = resource[i]; - var language = value['@language']; - if (locale === language) { - return value['@value']; - } - } - // test for inexact match - var match = locale.substr(0, locale.indexOf('-')); - for (var i = 0; i < resource.length; i++) { - var value = resource[i]; - var language = value['@language']; - if (language === match) { - return value['@value']; - } - } - return null; - }; - Utils.generateTreeNodeIds = function (treeNode, index) { - if (index === void 0) { index = 0; } - var id; - if (!treeNode.parentNode) { - id = '0'; - } - else { - id = treeNode.parentNode.id + "-" + index; - } - treeNode.id = id; - for (var i = 0; i < treeNode.nodes.length; i++) { - var n = treeNode.nodes[i]; - Utils.generateTreeNodeIds(n, i); - } - }; - Utils.isImageProfile = function (profile) { - if (profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE0.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE1.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE2.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE0.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE1.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE2.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE0.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE1.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE2.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE0.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE1.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE2.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL0.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL0PROFILE.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL1.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL1PROFILE.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL2.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL2PROFILE.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL0.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL0PROFILE.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL1.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL1PROFILE.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL2.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL2PROFILE.toString()) { - return true; - } - return false; - }; - Utils.isLevel0ImageProfile = function (profile) { - if (profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE0.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE0.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE0.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE0.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL0.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL0PROFILE.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL0.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL0PROFILE.toString()) { - return true; - } - return false; - }; - Utils.isLevel1ImageProfile = function (profile) { - if (profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE1.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE1.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE1.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE1.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL1.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL1PROFILE.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL1.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL1PROFILE.toString()) { - return true; - } - return false; - }; - Utils.isLevel2ImageProfile = function (profile) { - if (profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE2.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE2.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE2.toString() || - profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE2.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL2.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL2PROFILE.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL2.toString() || - profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL2PROFILE.toString()) { - return true; - } - return false; - }; - Utils.loadResource = function (uri) { - return new Promise(function (resolve, reject) { - var u = url.parse(uri); - var request; - var opts = { - host: u.hostname, - port: u.port, - path: u.path, - method: "GET", - withCredentials: false - }; - if (u.protocol === 'https:') { - request = https.request(opts, function (response) { - var result = ""; - response.on('data', function (chunk) { - result += chunk; - }); - response.on('end', function () { - resolve(result); - }); - }); - } - else { - request = http.request(opts, function (response) { - var result = ""; - response.on('data', function (chunk) { - result += chunk; - }); - response.on('end', function () { - resolve(result); - }); - }); - } - request.on('error', function (error) { - reject(error); - }); - request.end(); - }); - }; - Utils.loadExternalResource = function (resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken, handleResourceResponse, options) { - return new Promise(function (resolve, reject) { - if (options && options.pessimisticAccessControl) { - // pessimistic: access control cookies may have been deleted. - // always request the access token for every access controlled info.json request - // returned access tokens are not stored, therefore the login window flashes for every request. - resource.getData().then(function () { - if (resource.isAccessControlled()) { - // if the resource has a click through service, use that. - if (resource.clickThroughService) { - resolve(clickThrough(resource)); - } - else if (resource.restrictedService) { - resolve(restricted(resource)); - } - else { - login(resource).then(function () { - getAccessToken(resource, true).then(function (token) { - resource.getData(token).then(function () { - resolve(handleResourceResponse(resource)); - })["catch"](function (message) { - reject(Utils.createInternalServerError(message)); - }); - })["catch"](function (message) { - reject(Utils.createInternalServerError(message)); - }); - })["catch"](function (message) { - reject(Utils.createInternalServerError(message)); - }); - } - } - else { - // this info.json isn't access controlled, therefore no need to request an access token. - resolve(resource); - } - })["catch"](function (message) { - reject(Utils.createInternalServerError(message)); - }); - } - else { - // optimistic: access control cookies may not have been deleted. - // store access tokens to avoid login window flashes. - // if cookies are deleted a page refresh is required. - // try loading the resource using an access token that matches the info.json domain. - // if an access token is found, request the resource using it regardless of whether it is access controlled. - getStoredAccessToken(resource, tokenStorageStrategy).then(function (storedAccessToken) { - if (storedAccessToken) { - // try using the stored access token - resource.getData(storedAccessToken).then(function () { - // if the info.json loaded using the stored access token - if (resource.status === HTTPStatusCode.OK) { - resolve(handleResourceResponse(resource)); - } - else { - // otherwise, load the resource data to determine the correct access control services. - // if access controlled, do login. - Utils.authorize(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken).then(function () { - resolve(handleResourceResponse(resource)); - })["catch"](function (error) { - if (resource.restrictedService) { - reject(Utils.createRestrictedError()); - } - else { - reject(Utils.createAuthorizationFailedError()); - } - }); - } - })["catch"](function (error) { - reject(Utils.createAuthorizationFailedError()); - }); - } - else { - Utils.authorize(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken).then(function () { - resolve(handleResourceResponse(resource)); - })["catch"](function (error) { - reject(Utils.createAuthorizationFailedError()); - }); - } - })["catch"](function (error) { - reject(Utils.createAuthorizationFailedError()); - }); - } - }); - }; - Utils.createError = function (name, message) { - var error = new Error(); - error.message = message; - error.name = name; - return error; - }; - Utils.createAuthorizationFailedError = function () { - return Utils.createError(manifesto.StatusCodes.AUTHORIZATION_FAILED.toString(), "Authorization failed"); - }; - Utils.createRestrictedError = function () { - return Utils.createError(manifesto.StatusCodes.RESTRICTED.toString(), "Restricted"); - }; - Utils.createInternalServerError = function (message) { - return Utils.createError(manifesto.StatusCodes.INTERNAL_SERVER_ERROR.toString(), message); - }; - Utils.loadExternalResources = function (resources, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken, handleResourceResponse, options) { - return new Promise(function (resolve, reject) { - var promises = _map(resources, function (resource) { - return Utils.loadExternalResource(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken, handleResourceResponse, options); - }); - Promise.all(promises) - .then(function () { - resolve(resources); - })["catch"](function (error) { - reject(error); - }); - }); - }; - Utils.authorize = function (resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken) { - return new Promise(function (resolve, reject) { - resource.getData().then(function () { - if (resource.isAccessControlled()) { - getStoredAccessToken(resource, tokenStorageStrategy).then(function (storedAccessToken) { - if (storedAccessToken) { - // try using the stored access token - resource.getData(storedAccessToken).then(function () { - if (resource.status === HTTPStatusCode.OK) { - resolve(resource); // happy path ended - } - else { - // the stored token is no good for this resource - Utils.showAuthInteraction(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, resolve, reject); - } - })["catch"](function (message) { - reject(Utils.createInternalServerError(message)); - }); - } - else { - // There was no stored token, but the user might have a cookie that will grant a token - getAccessToken(resource, false).then(function (accessToken) { - if (accessToken) { - storeAccessToken(resource, accessToken, tokenStorageStrategy).then(function () { - // try using the fresh access token - resource.getData(accessToken).then(function () { - if (resource.status === HTTPStatusCode.OK) { - resolve(resource); - } - else { - // User has a token, but it's not good enough - Utils.showAuthInteraction(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, resolve, reject); - } - })["catch"](function (message) { - reject(Utils.createInternalServerError(message)); - }); - })["catch"](function (message) { - // not able to store access token - reject(Utils.createInternalServerError(message)); - }); - } - else { - // The user did not have a cookie that granted a token - Utils.showAuthInteraction(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, resolve, reject); - } - }); - } - })["catch"](function (message) { - reject(Utils.createInternalServerError(message)); - }); - } - else { - // this info.json isn't access controlled, therefore there's no need to request an access token - resolve(resource); - } - }); - }); - }; - Utils.showAuthInteraction = function (resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, resolve, reject) { - if (resource.status === HTTPStatusCode.MOVED_TEMPORARILY && !resource.isResponseHandled) { - // if the resource was redirected to a degraded version - // and the response hasn't been handled yet. - // if the client wishes to trigger a login, set resource.isResponseHandled to true - // and call loadExternalResources() again passing the resource. - resolve(resource); - } - else if (resource.restrictedService) { - resolve(restricted(resource)); - } - else if (resource.clickThroughService && !resource.isResponseHandled) { - // if the resource has a click through service, use that. - clickThrough(resource).then(function () { - getAccessToken(resource, true).then(function (accessToken) { - storeAccessToken(resource, accessToken, tokenStorageStrategy).then(function () { - resource.getData(accessToken).then(function () { - resolve(resource); - })["catch"](function (message) { - reject(Utils.createInternalServerError(message)); - }); - })["catch"](function (message) { - reject(Utils.createInternalServerError(message)); - }); - })["catch"](function (message) { - reject(Utils.createInternalServerError(message)); - }); - }); - } - else { - // get an access token - login(resource).then(function () { - getAccessToken(resource, true).then(function (accessToken) { - storeAccessToken(resource, accessToken, tokenStorageStrategy).then(function () { - resource.getData(accessToken).then(function () { - resolve(resource); - })["catch"](function (message) { - reject(Utils.createInternalServerError(message)); - }); - })["catch"](function (message) { - reject(Utils.createInternalServerError(message)); - }); - })["catch"](function (message) { - reject(Utils.createInternalServerError(message)); - }); - }); - } - }; - ; - Utils.getService = function (resource, profile) { - var services = this.getServices(resource); - // coerce profile to string - if (typeof profile !== 'string') { - profile = profile.toString(); - } - for (var i = 0; i < services.length; i++) { - var service = services[i]; - if (service.getProfile().toString() === profile) { - return service; - } - } - return null; - }; - Utils.getResourceById = function (parentResource, id) { - return [parentResource.__jsonld].en().traverseUnique(function (x) { return Utils.getAllArrays(x); }) - .first(function (r) { return r['@id'] === id; }); - }; - Utils.getAllArrays = function (obj) { - var all = [].en(); - if (!obj) - return all; - for (var key in obj) { - var val = obj[key]; - if (_isArray(val)) { - all = all.concat(val); - } - } - return all; - }; - Utils.getServices = function (resource) { - var service; - // if passing a manifesto-parsed object, use the __jsonld.service property, - // otherwise look for a service property (info.json services) - if (resource.__jsonld) { - service = resource.__jsonld.service; - } - else { - service = resource.service; - } - var services = []; - if (!service) - return services; - // coerce to array - if (!_isArray(service)) { - service = [service]; - } - for (var i = 0; i < service.length; i++) { - var s = service[i]; - if (_isString(s)) { - var r = this.getResourceById(resource.options.resource, s); - if (r) { - services.push(new Manifesto.Service(r.__jsonld || r, resource.options)); - } - } - else { - services.push(new Manifesto.Service(s, resource.options)); - } - } - return services; - }; - return Utils; - }()); - Manifesto.Utils = Utils; -})(Manifesto || (Manifesto = {})); - -var Manifesto; -(function (Manifesto) { - var MetadataItem = (function () { - function MetadataItem(defaultLocale) { - this.defaultLocale = defaultLocale; - } - MetadataItem.prototype.parse = function (resource) { - this.resource = resource; - this.label = Manifesto.TranslationCollection.parse(this.resource.label, this.defaultLocale); - this.value = Manifesto.TranslationCollection.parse(this.resource.value, this.defaultLocale); - }; - // shortcuts to get/set values based on default locale - MetadataItem.prototype.getLabel = function () { - if (this.label) { - return Manifesto.TranslationCollection.getValue(this.label, this.defaultLocale); - } - return null; - }; - MetadataItem.prototype.setLabel = function (value) { - var _this = this; - if (this.label && this.label.length) { - var t = this.label.en().where(function (x) { return x.locale === _this.defaultLocale || x.locale === Manifesto.Utils.getInexactLocale(_this.defaultLocale); }).first(); - if (t) - t.value = value; - } - }; - MetadataItem.prototype.getValue = function () { - if (this.value) { - var locale = this.defaultLocale; - // if the label has a locale, prefer that to the default locale - if (this.label.length && this.label[0].locale) { - locale = this.label[0].locale; - } - return Manifesto.TranslationCollection.getValue(this.value, locale); - } - return null; - }; - MetadataItem.prototype.setValue = function (value) { - var _this = this; - if (this.value && this.value.length) { - var t = this.value.en().where(function (x) { return x.locale === _this.defaultLocale || x.locale === Manifesto.Utils.getInexactLocale(_this.defaultLocale); }).first(); - if (t) - t.value = value; - } - }; - return MetadataItem; - }()); - Manifesto.MetadataItem = MetadataItem; -})(Manifesto || (Manifesto = {})); - -var Manifesto; -(function (Manifesto) { - var Translation = (function () { - function Translation(value, locale) { - this.value = value; - this.locale = locale; - } - return Translation; - }()); - Manifesto.Translation = Translation; -})(Manifesto || (Manifesto = {})); - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Manifesto; -(function (Manifesto) { - var TranslationCollection = (function (_super) { - __extends(TranslationCollection, _super); - function TranslationCollection() { - _super.apply(this, arguments); - } - TranslationCollection.parse = function (translation, defaultLocale) { - var tc = []; - var t; - if (!translation) { - return tc; - } - else if (_isArray(translation)) { - for (var i = 0; i < translation.length; i++) { - var value = translation[i]; - if (_isString(value)) { - t = new Manifesto.Translation(value, defaultLocale); - } - else { - t = new Manifesto.Translation(value['@value'], value['@language'] || defaultLocale); - } - tc.push(t); - } - } - else if (_isString(translation)) { - // if it's just a single string value, create one translation in the configured locale - t = new Manifesto.Translation(translation, defaultLocale); - tc.push(t); - return tc; - } - else { - // it's an object - t = new Manifesto.Translation(translation['@value'], translation['@language'] || defaultLocale); - tc.push(t); - return tc; - } - return tc; - }; - TranslationCollection.getValue = function (translationCollection, locale) { - if (translationCollection.length) { - if (locale) { - var translation = translationCollection.en().where(function (t) { return t.locale === locale || Manifesto.Utils.getInexactLocale(t.locale) === Manifesto.Utils.getInexactLocale(locale); }).first(); - if (translation) { - return translation.value; - } - } - // return the first value - return translationCollection[0].value; - } - return null; - }; - return TranslationCollection; - }(Array)); - Manifesto.TranslationCollection = TranslationCollection; -})(Manifesto || (Manifesto = {})); - -global.manifesto = global.Manifesto = module.exports = { - AnnotationMotivation: new Manifesto.AnnotationMotivation(), - ElementType: new Manifesto.ElementType(), - IIIFResourceType: new Manifesto.IIIFResourceType(), - ManifestType: new Manifesto.ManifestType(), - MetadataItem: Manifesto.MetadataItem, - RenderingFormat: new Manifesto.RenderingFormat(), - ResourceFormat: new Manifesto.ResourceFormat(), - ResourceType: new Manifesto.ResourceType(), - ServiceProfile: new Manifesto.ServiceProfile(), - Translation: Manifesto.Translation, - TranslationCollection: Manifesto.TranslationCollection, - TreeNode: Manifesto.TreeNode, - TreeNodeType: new Manifesto.TreeNodeType(), - Utils: Manifesto.Utils, - ViewingDirection: new Manifesto.ViewingDirection(), - ViewingHint: new Manifesto.ViewingHint(), - StatusCodes: { - AUTHORIZATION_FAILED: 1, - FORBIDDEN: 2, - INTERNAL_SERVER_ERROR: 3, - RESTRICTED: 4 - }, - create: function (manifest, options) { - return Manifesto.Deserialiser.parse(manifest, options); - }, - loadManifest: function (uri) { - return Manifesto.Utils.loadResource(uri); - } -}; - -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Manifesto; -(function (Manifesto) { - var Annotation = (function (_super) { - __extends(Annotation, _super); - function Annotation(jsonld, options) { - _super.call(this, jsonld, options); - } - Annotation.prototype.getMotivation = function () { - var motivation = this.getProperty('motivation'); - if (motivation) { - return new Manifesto.AnnotationMotivation(motivation.toLowerCase()); - } - return null; - }; - Annotation.prototype.getOn = function () { - return this.getProperty('on'); - }; - Annotation.prototype.getResource = function () { - return new Manifesto.Resource(this.getProperty('resource'), this.options); - }; - return Annotation; - }(Manifesto.ManifestResource)); - Manifesto.Annotation = Annotation; -})(Manifesto || (Manifesto = {})); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Manifesto; -(function (Manifesto) { - var Resource = (function (_super) { - __extends(Resource, _super); - function Resource(jsonld, options) { - _super.call(this, jsonld, options); - } - Resource.prototype.getFormat = function () { - var format = this.getProperty('format'); - if (format) { - return new Manifesto.ResourceFormat(format.toLowerCase()); - } - return null; - }; - Resource.prototype.getType = function () { - var type = this.getProperty('@type'); - if (type) { - return new Manifesto.ResourceType(type.toLowerCase()); - } - return null; - }; - Resource.prototype.getWidth = function () { - return this.getProperty('width'); - }; - Resource.prototype.getHeight = function () { - return this.getProperty('height'); - }; - Resource.prototype.getMaxWidth = function () { - return this.getProperty('maxWidth'); - }; - Resource.prototype.getMaxHeight = function () { - var maxHeight = this.getProperty('maxHeight'); - // if a maxHeight hasn't been specified, default to maxWidth. - // maxWidth in essence becomes maxEdge - if (!maxHeight) { - return this.getMaxWidth(); - } - }; - return Resource; - }(Manifesto.ManifestResource)); - Manifesto.Resource = Resource; -})(Manifesto || (Manifesto = {})); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"http":49,"https":9,"lodash.assign":25,"lodash.endswith":26,"lodash.isarray":28,"lodash.isstring":29,"lodash.last":32,"lodash.map":33,"url":55}],2:[function(require,module,exports){ -'use strict' - -exports.byteLength = byteLength -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray - -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i -} - -revLookup['-'.charCodeAt(0)] = 62 -revLookup['_'.charCodeAt(0)] = 63 - -function placeHoldersCount (b64) { - var len = b64.length - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // the number of equal signs (place holders) - // if there are two placeholders, than the two characters before it - // represent one byte - // if there is only one, then the three characters before it represent 2 bytes - // this is just a cheap hack to not do indexOf twice - return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0 -} - -function byteLength (b64) { - // base64 is 4/3 + up to two characters of the original data - return b64.length * 3 / 4 - placeHoldersCount(b64) -} - -function toByteArray (b64) { - var i, j, l, tmp, placeHolders, arr - var len = b64.length - placeHolders = placeHoldersCount(b64) - - arr = new Arr(len * 3 / 4 - placeHolders) - - // if there are placeholders, only get up to the last complete 4 chars - l = placeHolders > 0 ? len - 4 : len - - var L = 0 - - for (i = 0, j = 0; i < l; i += 4, j += 3) { - tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] - arr[L++] = (tmp >> 16) & 0xFF - arr[L++] = (tmp >> 8) & 0xFF - arr[L++] = tmp & 0xFF - } - - if (placeHolders === 2) { - tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[L++] = tmp & 0xFF - } else if (placeHolders === 1) { - tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[L++] = (tmp >> 8) & 0xFF - arr[L++] = tmp & 0xFF - } - - return arr -} - -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] -} - -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) - output.push(tripletToBase64(tmp)) - } - return output.join('') -} - -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var output = '' - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 - - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - output += lookup[tmp >> 2] - output += lookup[(tmp << 4) & 0x3F] - output += '==' - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + (uint8[len - 1]) - output += lookup[tmp >> 10] - output += lookup[(tmp >> 4) & 0x3F] - output += lookup[(tmp << 2) & 0x3F] - output += '=' - } - - parts.push(output) - - return parts.join('') -} - -},{}],3:[function(require,module,exports){ - -},{}],4:[function(require,module,exports){ -(function (global){ -'use strict'; - -var buffer = require('buffer'); -var Buffer = buffer.Buffer; -var SlowBuffer = buffer.SlowBuffer; -var MAX_LEN = buffer.kMaxLength || 2147483647; -exports.alloc = function alloc(size, fill, encoding) { - if (typeof Buffer.alloc === 'function') { - return Buffer.alloc(size, fill, encoding); - } - if (typeof encoding === 'number') { - throw new TypeError('encoding must not be number'); - } - if (typeof size !== 'number') { - throw new TypeError('size must be a number'); - } - if (size > MAX_LEN) { - throw new RangeError('size is too large'); - } - var enc = encoding; - var _fill = fill; - if (_fill === undefined) { - enc = undefined; - _fill = 0; - } - var buf = new Buffer(size); - if (typeof _fill === 'string') { - var fillBuf = new Buffer(_fill, enc); - var flen = fillBuf.length; - var i = -1; - while (++i < size) { - buf[i] = fillBuf[i % flen]; - } - } else { - buf.fill(_fill); - } - return buf; -} -exports.allocUnsafe = function allocUnsafe(size) { - if (typeof Buffer.allocUnsafe === 'function') { - return Buffer.allocUnsafe(size); - } - if (typeof size !== 'number') { - throw new TypeError('size must be a number'); - } - if (size > MAX_LEN) { - throw new RangeError('size is too large'); - } - return new Buffer(size); -} -exports.from = function from(value, encodingOrOffset, length) { - if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) { - return Buffer.from(value, encodingOrOffset, length); - } - if (typeof value === 'number') { - throw new TypeError('"value" argument must not be a number'); - } - if (typeof value === 'string') { - return new Buffer(value, encodingOrOffset); - } - if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { - var offset = encodingOrOffset; - if (arguments.length === 1) { - return new Buffer(value); - } - if (typeof offset === 'undefined') { - offset = 0; - } - var len = length; - if (typeof len === 'undefined') { - len = value.byteLength - offset; - } - if (offset >= value.byteLength) { - throw new RangeError('\'offset\' is out of bounds'); - } - if (len > value.byteLength - offset) { - throw new RangeError('\'length\' is out of bounds'); - } - return new Buffer(value.slice(offset, offset + len)); - } - if (Buffer.isBuffer(value)) { - var out = new Buffer(value.length); - value.copy(out, 0, 0, value.length); - return out; - } - if (value) { - if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) { - return new Buffer(value); - } - if (value.type === 'Buffer' && Array.isArray(value.data)) { - return new Buffer(value.data); - } - } - - throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.'); -} -exports.allocUnsafeSlow = function allocUnsafeSlow(size) { - if (typeof Buffer.allocUnsafeSlow === 'function') { - return Buffer.allocUnsafeSlow(size); - } - if (typeof size !== 'number') { - throw new TypeError('size must be a number'); - } - if (size >= MAX_LEN) { - throw new RangeError('size is too large'); - } - return new SlowBuffer(size); -} - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"buffer":5}],5:[function(require,module,exports){ -(function (global){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ - -'use strict' - -var base64 = require('base64-js') -var ieee754 = require('ieee754') -var isArray = require('isarray') - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Use Object implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * Due to various browser bugs, sometimes the Object implementation will be used even - * when the browser supports typed arrays. - * - * Note: - * - * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, - * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. - * - * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. - * - * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of - * incorrect length in some situations. - - * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they - * get the Object implementation, which is slower but behaves correctly. - */ -Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined - ? global.TYPED_ARRAY_SUPPORT - : typedArraySupport() - -/* - * Export kMaxLength after typed array support is determined. - */ -exports.kMaxLength = kMaxLength() - -function typedArraySupport () { - try { - var arr = new Uint8Array(1) - arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} - return arr.foo() === 42 && // typed array instances can be augmented - typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` - arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` - } catch (e) { - return false - } -} - -function kMaxLength () { - return Buffer.TYPED_ARRAY_SUPPORT - ? 0x7fffffff - : 0x3fffffff -} - -function createBuffer (that, length) { - if (kMaxLength() < length) { - throw new RangeError('Invalid typed array length') - } - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - that = new Uint8Array(length) - that.__proto__ = Buffer.prototype - } else { - // Fallback: Return an object instance of the Buffer class - if (that === null) { - that = new Buffer(length) - } - that.length = length - } - - return that -} - -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ - -function Buffer (arg, encodingOrOffset, length) { - if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { - return new Buffer(arg, encodingOrOffset, length) - } - - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new Error( - 'If encoding is specified then the first argument must be a string' - ) - } - return allocUnsafe(this, arg) - } - return from(this, arg, encodingOrOffset, length) -} - -Buffer.poolSize = 8192 // not used by this implementation - -// TODO: Legacy, not needed anymore. Remove in next major version. -Buffer._augment = function (arr) { - arr.__proto__ = Buffer.prototype - return arr -} - -function from (that, value, encodingOrOffset, length) { - if (typeof value === 'number') { - throw new TypeError('"value" argument must not be a number') - } - - if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { - return fromArrayBuffer(that, value, encodingOrOffset, length) - } - - if (typeof value === 'string') { - return fromString(that, value, encodingOrOffset) - } - - return fromObject(that, value) -} - -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ -Buffer.from = function (value, encodingOrOffset, length) { - return from(null, value, encodingOrOffset, length) -} - -if (Buffer.TYPED_ARRAY_SUPPORT) { - Buffer.prototype.__proto__ = Uint8Array.prototype - Buffer.__proto__ = Uint8Array - if (typeof Symbol !== 'undefined' && Symbol.species && - Buffer[Symbol.species] === Buffer) { - // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true - }) - } -} - -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be a number') - } else if (size < 0) { - throw new RangeError('"size" argument must not be negative') - } -} - -function alloc (that, size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(that, size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpretted as a start offset. - return typeof encoding === 'string' - ? createBuffer(that, size).fill(fill, encoding) - : createBuffer(that, size).fill(fill) - } - return createBuffer(that, size) -} - -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(null, size, fill, encoding) -} - -function allocUnsafe (that, size) { - assertSize(size) - that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) { - for (var i = 0; i < size; ++i) { - that[i] = 0 - } - } - return that -} - -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ -Buffer.allocUnsafe = function (size) { - return allocUnsafe(null, size) -} -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ -Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(null, size) -} - -function fromString (that, string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('"encoding" must be a valid string encoding') - } - - var length = byteLength(string, encoding) | 0 - that = createBuffer(that, length) - - var actual = that.write(string, encoding) - - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - that = that.slice(0, actual) - } - - return that -} - -function fromArrayLike (that, array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0 - that = createBuffer(that, length) - for (var i = 0; i < length; i += 1) { - that[i] = array[i] & 255 - } - return that -} - -function fromArrayBuffer (that, array, byteOffset, length) { - array.byteLength // this throws if `array` is not a valid ArrayBuffer - - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('\'offset\' is out of bounds') - } - - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('\'length\' is out of bounds') - } - - if (byteOffset === undefined && length === undefined) { - array = new Uint8Array(array) - } else if (length === undefined) { - array = new Uint8Array(array, byteOffset) - } else { - array = new Uint8Array(array, byteOffset, length) - } - - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - that = array - that.__proto__ = Buffer.prototype - } else { - // Fallback: Return an object instance of the Buffer class - that = fromArrayLike(that, array) - } - return that -} - -function fromObject (that, obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - that = createBuffer(that, len) - - if (that.length === 0) { - return that - } - - obj.copy(that, 0, 0, len) - return that - } - - if (obj) { - if ((typeof ArrayBuffer !== 'undefined' && - obj.buffer instanceof ArrayBuffer) || 'length' in obj) { - if (typeof obj.length !== 'number' || isnan(obj.length)) { - return createBuffer(that, 0) - } - return fromArrayLike(that, obj) - } - - if (obj.type === 'Buffer' && isArray(obj.data)) { - return fromArrayLike(that, obj.data) - } - } - - throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') -} - -function checked (length) { - // Note: cannot use `length < kMaxLength()` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= kMaxLength()) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + kMaxLength().toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) -} - -Buffer.isBuffer = function isBuffer (b) { - return !!(b != null && b._isBuffer) -} - -Buffer.compare = function compare (a, b) { - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError('Arguments must be Buffers') - } - - if (a === b) return 0 - - var x = a.length - var y = b.length - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - - if (list.length === 0) { - return Buffer.alloc(0) - } - - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } - - var buffer = Buffer.allocUnsafe(length) - var pos = 0 - for (i = 0; i < list.length; ++i) { - var buf = list[i] - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && - (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - string = '' + string - } - - var len = string.length - if (len === 0) return 0 - - // Use a for loop to avoid recursion - var loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - case undefined: - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) return utf8ToBytes(string).length // assume utf8 - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength - -function slowToString (encoding, start, end) { - var loweredCase = false - - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } - - if (end === undefined || end > this.length) { - end = this.length - } - - if (end <= 0) { - return '' - } - - // Force coersion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 - - if (end <= start) { - return '' - } - - if (!encoding) encoding = 'utf8' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } -} - -// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect -// Buffer instances. -Buffer.prototype._isBuffer = true - -function swap (b, n, m) { - var i = b[n] - b[n] = b[m] - b[m] = i -} - -Buffer.prototype.swap16 = function swap16 () { - var len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this -} - -Buffer.prototype.swap32 = function swap32 () { - var len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) - } - return this -} - -Buffer.prototype.swap64 = function swap64 () { - var len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) - } - return this -} - -Buffer.prototype.toString = function toString () { - var length = this.length | 0 - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - if (this.length > 0) { - str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') - if (this.length > max) str += ' ... ' - } - return '' -} - -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (!Buffer.isBuffer(target)) { - throw new TypeError('Argument must be a Buffer') - } - - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length - } - - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') - } - - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 - } - if (start >= end) { - return 1 - } - - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 - - if (this === target) return 0 - - var x = thisEnd - thisStart - var y = end - start - var len = Math.min(x, y) - - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) - - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 - - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (isNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } - - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } - - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } - - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (Buffer.TYPED_ARRAY_SUPPORT && - typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) - } - } - return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) - } - - throw new TypeError('val must be string, number or Buffer') -} - -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length - - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 - } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 - } - } - - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } - } - - var i - if (dir) { - var foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - var found = true - for (var j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i - } - } - - return -1 -} - -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} - -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - // must be an even number of digits - var strLen = string.length - if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') - - if (length > strLen / 2) { - length = strLen / 2 - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16) - if (isNaN(parsed)) return i - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset | 0 - if (isFinite(length)) { - length = length | 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - // legacy write(string, encoding, offset, length) - remove in v0.13 - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } - - var remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - var loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - return asciiWrite(this, string, offset, length) - - case 'latin1': - case 'binary': - return latin1Write(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] - - var i = start - while (i < end) { - var firstByte = buf[i] - var codePoint = null - var bytesPerSequence = (firstByte > 0xEF) ? 4 - : (firstByte > 0xDF) ? 3 - : (firstByte > 0xBF) ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF - } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) -} - -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -var MAX_ARGUMENTS_LENGTH = 0x1000 - -function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - var res = '' - var i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res -} - -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function latin1Slice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - var len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - var out = '' - for (var i = start; i < end; ++i) { - out += toHex(buf[i]) - } - return out -} - -function utf16leSlice (buf, start, end) { - var bytes = buf.slice(start, end) - var res = '' - for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - var newBuf - if (Buffer.TYPED_ARRAY_SUPPORT) { - newBuf = this.subarray(start, end) - newBuf.__proto__ = Buffer.prototype - } else { - var sliceLen = end - start - newBuf = new Buffer(sliceLen, undefined) - for (var i = 0; i < sliceLen; ++i) { - newBuf[i] = this[i + start] - } - } - - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') -} - -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - this[offset] = (value & 0xff) - return offset + 1 -} - -function objectWriteUInt16 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { - buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> - (littleEndian ? i : 1 - i) * 8 - } -} - -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 -} - -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 -} - -function objectWriteUInt32 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffffffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { - buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff - } -} - -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 -} - -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 -} - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = 0 - var mul = 1 - var sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = byteLength - 1 - var mul = 1 - var sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 -} - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - var len = end - start - var i - - if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { - // ascending copy from start - for (i = 0; i < len; ++i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, start + len), - targetStart - ) - } - - return len -} - -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if (code < 256) { - val = code - } - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - } else if (typeof val === 'number') { - val = val & 255 - } - - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return this - } - - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 - - if (!val) val = 0 - - var i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - var bytes = Buffer.isBuffer(val) - ? val - : utf8ToBytes(new Buffer(val, encoding).toString()) - var len = bytes.length - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } - - return this -} - -// HELPER FUNCTIONS -// ================ - -var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = stringtrim(str).replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function stringtrim (str) { - if (str.trim) return str.trim() - return str.replace(/^\s+|\s+$/g, '') -} - -function toHex (n) { - if (n < 16) return '0' + n.toString(16) - return n.toString(16) -} - -function utf8ToBytes (string, units) { - units = units || Infinity - var codePoint - var length = string.length - var leadSurrogate = null - var bytes = [] - - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes -} - -function asciiToBytes (str) { - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -function isnan (val) { - return val !== val // eslint-disable-line no-self-compare -} - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"base64-js":2,"ieee754":10,"isarray":13}],6:[function(require,module,exports){ -module.exports = { - "100": "Continue", - "101": "Switching Protocols", - "102": "Processing", - "200": "OK", - "201": "Created", - "202": "Accepted", - "203": "Non-Authoritative Information", - "204": "No Content", - "205": "Reset Content", - "206": "Partial Content", - "207": "Multi-Status", - "208": "Already Reported", - "226": "IM Used", - "300": "Multiple Choices", - "301": "Moved Permanently", - "302": "Found", - "303": "See Other", - "304": "Not Modified", - "305": "Use Proxy", - "307": "Temporary Redirect", - "308": "Permanent Redirect", - "400": "Bad Request", - "401": "Unauthorized", - "402": "Payment Required", - "403": "Forbidden", - "404": "Not Found", - "405": "Method Not Allowed", - "406": "Not Acceptable", - "407": "Proxy Authentication Required", - "408": "Request Timeout", - "409": "Conflict", - "410": "Gone", - "411": "Length Required", - "412": "Precondition Failed", - "413": "Payload Too Large", - "414": "URI Too Long", - "415": "Unsupported Media Type", - "416": "Range Not Satisfiable", - "417": "Expectation Failed", - "418": "I'm a teapot", - "421": "Misdirected Request", - "422": "Unprocessable Entity", - "423": "Locked", - "424": "Failed Dependency", - "425": "Unordered Collection", - "426": "Upgrade Required", - "428": "Precondition Required", - "429": "Too Many Requests", - "431": "Request Header Fields Too Large", - "500": "Internal Server Error", - "501": "Not Implemented", - "502": "Bad Gateway", - "503": "Service Unavailable", - "504": "Gateway Timeout", - "505": "HTTP Version Not Supported", - "506": "Variant Also Negotiates", - "507": "Insufficient Storage", - "508": "Loop Detected", - "509": "Bandwidth Limit Exceeded", - "510": "Not Extended", - "511": "Network Authentication Required" -} - -},{}],7:[function(require,module,exports){ -(function (Buffer){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. - -function isArray(arg) { - if (Array.isArray) { - return Array.isArray(arg); - } - return objectToString(arg) === '[object Array]'; -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = Buffer.isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - -}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":12}],8:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -function EventEmitter() { - this._events = this._events || {}; - this._maxListeners = this._maxListeners || undefined; -} -module.exports = EventEmitter; - -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; - -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._maxListeners = undefined; - -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -EventEmitter.defaultMaxListeners = 10; - -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function(n) { - if (!isNumber(n) || n < 0 || isNaN(n)) - throw TypeError('n must be a positive number'); - this._maxListeners = n; - return this; -}; - -EventEmitter.prototype.emit = function(type) { - var er, handler, len, args, i, listeners; - - if (!this._events) - this._events = {}; - - // If there is no 'error' event listener then throw. - if (type === 'error') { - if (!this._events.error || - (isObject(this._events.error) && !this._events.error.length)) { - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Uncaught, unspecified "error" event. (' + er + ')'); - err.context = er; - throw err; - } - } - } - - handler = this._events[type]; - - if (isUndefined(handler)) - return false; - - if (isFunction(handler)) { - switch (arguments.length) { - // fast cases - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - // slower - default: - args = Array.prototype.slice.call(arguments, 1); - handler.apply(this, args); - } - } else if (isObject(handler)) { - args = Array.prototype.slice.call(arguments, 1); - listeners = handler.slice(); - len = listeners.length; - for (i = 0; i < len; i++) - listeners[i].apply(this, args); - } - - return true; -}; - -EventEmitter.prototype.addListener = function(type, listener) { - var m; - - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - if (!this._events) - this._events = {}; - - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (this._events.newListener) - this.emit('newListener', type, - isFunction(listener.listener) ? - listener.listener : listener); - - if (!this._events[type]) - // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; - else if (isObject(this._events[type])) - // If we've already got an array, just append. - this._events[type].push(listener); - else - // Adding the second element, need to change to array. - this._events[type] = [this._events[type], listener]; - - // Check for listener leak - if (isObject(this._events[type]) && !this._events[type].warned) { - if (!isUndefined(this._maxListeners)) { - m = this._maxListeners; - } else { - m = EventEmitter.defaultMaxListeners; - } - - if (m && m > 0 && this._events[type].length > m) { - this._events[type].warned = true; - console.error('(node) warning: possible EventEmitter memory ' + - 'leak detected. %d listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.', - this._events[type].length); - if (typeof console.trace === 'function') { - // not supported in IE 10 - console.trace(); - } - } - } - - return this; -}; - -EventEmitter.prototype.on = EventEmitter.prototype.addListener; - -EventEmitter.prototype.once = function(type, listener) { - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - var fired = false; - - function g() { - this.removeListener(type, g); - - if (!fired) { - fired = true; - listener.apply(this, arguments); - } - } - - g.listener = listener; - this.on(type, g); - - return this; -}; - -// emits a 'removeListener' event iff the listener was removed -EventEmitter.prototype.removeListener = function(type, listener) { - var list, position, length, i; - - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - if (!this._events || !this._events[type]) - return this; - - list = this._events[type]; - length = list.length; - position = -1; - - if (list === listener || - (isFunction(list.listener) && list.listener === listener)) { - delete this._events[type]; - if (this._events.removeListener) - this.emit('removeListener', type, listener); - - } else if (isObject(list)) { - for (i = length; i-- > 0;) { - if (list[i] === listener || - (list[i].listener && list[i].listener === listener)) { - position = i; - break; - } - } - - if (position < 0) - return this; - - if (list.length === 1) { - list.length = 0; - delete this._events[type]; - } else { - list.splice(position, 1); - } - - if (this._events.removeListener) - this.emit('removeListener', type, listener); - } - - return this; -}; - -EventEmitter.prototype.removeAllListeners = function(type) { - var key, listeners; - - if (!this._events) - return this; - - // not listening for removeListener, no need to emit - if (!this._events.removeListener) { - if (arguments.length === 0) - this._events = {}; - else if (this._events[type]) - delete this._events[type]; - return this; - } - - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - for (key in this._events) { - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = {}; - return this; - } - - listeners = this._events[type]; - - if (isFunction(listeners)) { - this.removeListener(type, listeners); - } else if (listeners) { - // LIFO order - while (listeners.length) - this.removeListener(type, listeners[listeners.length - 1]); - } - delete this._events[type]; - - return this; -}; - -EventEmitter.prototype.listeners = function(type) { - var ret; - if (!this._events || !this._events[type]) - ret = []; - else if (isFunction(this._events[type])) - ret = [this._events[type]]; - else - ret = this._events[type].slice(); - return ret; -}; - -EventEmitter.prototype.listenerCount = function(type) { - if (this._events) { - var evlistener = this._events[type]; - - if (isFunction(evlistener)) - return 1; - else if (evlistener) - return evlistener.length; - } - return 0; -}; - -EventEmitter.listenerCount = function(emitter, type) { - return emitter.listenerCount(type); -}; - -function isFunction(arg) { - return typeof arg === 'function'; -} - -function isNumber(arg) { - return typeof arg === 'number'; -} - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} - -function isUndefined(arg) { - return arg === void 0; -} - -},{}],9:[function(require,module,exports){ -var http = require('http'); - -var https = module.exports; - -for (var key in http) { - if (http.hasOwnProperty(key)) https[key] = http[key]; -}; - -https.request = function (params, cb) { - if (!params) params = {}; - params.scheme = 'https'; - params.protocol = 'https:'; - return http.request.call(this, params, cb); -} - -},{"http":49}],10:[function(require,module,exports){ -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = nBytes * 8 - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] - - i += d - - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} - - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} - - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} - -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = nBytes * 8 - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - - value = Math.abs(value) - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } - - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} - - buffer[offset + i - d] |= s * 128 -} - -},{}],11:[function(require,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} - -},{}],12:[function(require,module,exports){ -/*! - * Determine if an object is a Buffer - * - * @author Feross Aboukhadijeh - * @license MIT - */ - -// The _isBuffer check is for Safari 5-7 support, because it's missing -// Object.prototype.constructor. Remove this eventually -module.exports = function (obj) { - return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) -} - -function isBuffer (obj) { - return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) -} - -// For Node v0.10 support. Remove this eventually. -function isSlowBuffer (obj) { - return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) -} - -},{}],13:[function(require,module,exports){ -var toString = {}.toString; - -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; - -},{}],14:[function(require,module,exports){ -/** - * lodash 3.0.0 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.7.0 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** - * A specialized version of `_.map` for arrays without support for callback - * shorthands or `this` binding. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ -function arrayMap(array, iteratee) { - var index = -1, - length = array.length, - result = Array(length); - - while (++index < length) { - result[index] = iteratee(array[index], index, array); - } - return result; -} - -module.exports = arrayMap; - -},{}],15:[function(require,module,exports){ -/** - * lodash 3.2.0 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -var baseCopy = require('lodash._basecopy'), - keys = require('lodash.keys'); - -/** - * The base implementation of `_.assign` without support for argument juggling, - * multiple sources, and `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ -function baseAssign(object, source) { - return source == null - ? object - : baseCopy(source, keys(source), object); -} - -module.exports = baseAssign; - -},{"lodash._basecopy":17,"lodash.keys":31}],16:[function(require,module,exports){ -/** - * lodash 3.3.1 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -var baseIsEqual = require('lodash._baseisequal'), - bindCallback = require('lodash._bindcallback'), - isArray = require('lodash.isarray'), - pairs = require('lodash.pairs'); - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * Converts `value` to a string if it's not one. An empty string is returned - * for `null` or `undefined` values. - * - * @private - * @param {*} value The value to process. - * @returns {string} Returns the string. - */ -function baseToString(value) { - return value == null ? '' : (value + ''); -} - -/** - * The base implementation of `_.callback` which supports specifying the - * number of arguments to provide to `func`. - * - * @private - * @param {*} [func=_.identity] The value to convert to a callback. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {number} [argCount] The number of arguments to provide to `func`. - * @returns {Function} Returns the callback. - */ -function baseCallback(func, thisArg, argCount) { - var type = typeof func; - if (type == 'function') { - return thisArg === undefined - ? func - : bindCallback(func, thisArg, argCount); - } - if (func == null) { - return identity; - } - if (type == 'object') { - return baseMatches(func); - } - return thisArg === undefined - ? property(func) - : baseMatchesProperty(func, thisArg); -} - -/** - * The base implementation of `get` without support for string paths - * and default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array} path The path of the property to get. - * @param {string} [pathKey] The key representation of path. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path, pathKey) { - if (object == null) { - return; - } - if (pathKey !== undefined && pathKey in toObject(object)) { - path = [pathKey]; - } - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.isMatch` without support for callback - * shorthands and `this` binding. - * - * @private - * @param {Object} object The object to inspect. - * @param {Array} matchData The propery names, values, and compare flags to match. - * @param {Function} [customizer] The function to customize comparing objects. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - */ -function baseIsMatch(object, matchData, customizer) { - var index = matchData.length, - length = index, - noCustomizer = !customizer; - - if (object == null) { - return !length; - } - object = toObject(object); - while (index--) { - var data = matchData[index]; - if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { - return false; - } - } - while (++index < length) { - data = matchData[index]; - var key = data[0], - objValue = object[key], - srcValue = data[1]; - - if (noCustomizer && data[2]) { - if (objValue === undefined && !(key in object)) { - return false; - } - } else { - var result = customizer ? customizer(objValue, srcValue, key) : undefined; - if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) { - return false; - } - } - } - return true; -} - -/** - * The base implementation of `_.matches` which does not clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && (value !== undefined || (key in toObject(object))); - }; - } - return function(object) { - return baseIsMatch(object, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which does not clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to compare. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - var isArr = isArray(path), - isCommon = isKey(path) && isStrictComparable(srcValue), - pathKey = (path + ''); - - path = toPath(path); - return function(object) { - if (object == null) { - return false; - } - var key = pathKey; - object = toObject(object); - if ((isArr || !isCommon) && !(key in object)) { - object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); - if (object == null) { - return false; - } - key = last(path); - object = toObject(object); - } - return object[key] === srcValue - ? (srcValue !== undefined || (key in object)) - : baseIsEqual(srcValue, object[key], undefined, true); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - var pathKey = (path + ''); - path = toPath(path); - return function(object) { - return baseGet(object, path, pathKey); - }; -} - -/** - * The base implementation of `_.slice` without an iteratee call guard. - * - * @private - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ -function baseSlice(array, start, end) { - var index = -1, - length = array.length; - - start = start == null ? 0 : (+start || 0); - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = (end === undefined || end > length) ? length : (+end || 0); - if (end < 0) { - end += length; - } - length = start > end ? 0 : ((end - start) >>> 0); - start >>>= 0; - - var result = Array(length); - while (++index < length) { - result[index] = array[index + start]; - } - return result; -} - -/** - * Gets the propery names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = pairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - var type = typeof value; - if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') { - return true; - } - if (isArray(value)) { - return false; - } - var result = !reIsDeepProp.test(value); - return result || (object != null && value in toObject(object)); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `value` to an object if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Object} Returns the object. - */ -function toObject(value) { - return isObject(value) ? value : Object(value); -} - -/** - * Converts `value` to property path array if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function toPath(value) { - if (isArray(value)) { - return value; - } - var result = []; - baseToString(value).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -/** - * Gets the last element of `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the last element of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - */ -function last(array) { - var length = array ? array.length : 0; - return length ? array[length - 1] : undefined; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument provided to it. - * - * @static - * @memberOf _ - * @category Utility - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the property value at `path` on a - * given object. - * - * @static - * @memberOf _ - * @category Utility - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - -module.exports = baseCallback; - -},{"lodash._baseisequal":19,"lodash._bindcallback":20,"lodash.isarray":28,"lodash.pairs":34}],17:[function(require,module,exports){ -/** - * lodash 3.0.1 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** - * Copies properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property names to copy. - * @param {Object} [object={}] The object to copy properties to. - * @returns {Object} Returns `object`. - */ -function baseCopy(source, props, object) { - object || (object = {}); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index]; - object[key] = source[key]; - } - return object; -} - -module.exports = baseCopy; - -},{}],18:[function(require,module,exports){ -/** - * lodash 3.0.4 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -var keys = require('lodash.keys'); - -/** - * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) - * of an array-like value. - */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** - * The base implementation of `_.forEach` without support for callback - * shorthands and `this` binding. - * - * @private - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object|string} Returns `collection`. - */ -var baseEach = createBaseEach(baseForOwn); - -/** - * The base implementation of `baseForIn` and `baseForOwn` which iterates - * over `object` properties returned by `keysFunc` invoking `iteratee` for - * each property. Iteratee functions may exit iteration early by explicitly - * returning `false`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ -var baseFor = createBaseFor(); - -/** - * The base implementation of `_.forOwn` without support for callback - * shorthands and `this` binding. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ -function baseForOwn(object, iteratee) { - return baseFor(object, iteratee, keys); -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * Creates a `baseEach` or `baseEachRight` function. - * - * @private - * @param {Function} eachFunc The function to iterate over a collection. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ -function createBaseEach(eachFunc, fromRight) { - return function(collection, iteratee) { - var length = collection ? getLength(collection) : 0; - if (!isLength(length)) { - return eachFunc(collection, iteratee); - } - var index = fromRight ? length : -1, - iterable = toObject(collection); - - while ((fromRight ? index-- : ++index < length)) { - if (iteratee(iterable[index], index, iterable) === false) { - break; - } - } - return collection; - }; -} - -/** - * Creates a base function for `_.forIn` or `_.forInRight`. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ -function createBaseFor(fromRight) { - return function(object, iteratee, keysFunc) { - var iterable = toObject(object), - props = keysFunc(object), - length = props.length, - index = fromRight ? length : -1; - - while ((fromRight ? index-- : ++index < length)) { - var key = props[index]; - if (iteratee(iterable[key], key, iterable) === false) { - break; - } - } - return object; - }; -} - -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * that affects Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - */ -function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - -/** - * Converts `value` to an object if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Object} Returns the object. - */ -function toObject(value) { - return isObject(value) ? value : Object(value); -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -module.exports = baseEach; - -},{"lodash.keys":31}],19:[function(require,module,exports){ -/** - * lodash 3.0.7 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -var isArray = require('lodash.isarray'), - isTypedArray = require('lodash.istypedarray'), - keys = require('lodash.keys'); - -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - numberTag = '[object Number]', - objectTag = '[object Object]', - regexpTag = '[object RegExp]', - stringTag = '[object String]'; - -/** - * Checks if `value` is object-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/** - * A specialized version of `_.some` for arrays without support for callback - * shorthands and `this` binding. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ -function arraySome(array, predicate) { - var index = -1, - length = array.length; - - while (++index < length) { - if (predicate(array[index], index, array)) { - return true; - } - } - return false; -} - -/** - * The base implementation of `_.isEqual` without support for `this` binding - * `customizer` functions. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {Function} [customizer] The function to customize comparing values. - * @param {boolean} [isLoose] Specify performing partial comparisons. - * @param {Array} [stackA] Tracks traversed `value` objects. - * @param {Array} [stackB] Tracks traversed `other` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ -function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { - if (value === other) { - return true; - } - if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { - return value !== value && other !== other; - } - return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB); -} - -/** - * A specialized version of `baseIsEqual` for arrays and objects which performs - * deep comparisons and tracks traversed objects enabling objects with circular - * references to be compared. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparing objects. - * @param {boolean} [isLoose] Specify performing partial comparisons. - * @param {Array} [stackA=[]] Tracks traversed `value` objects. - * @param {Array} [stackB=[]] Tracks traversed `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ -function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) { - var objIsArr = isArray(object), - othIsArr = isArray(other), - objTag = arrayTag, - othTag = arrayTag; - - if (!objIsArr) { - objTag = objToString.call(object); - if (objTag == argsTag) { - objTag = objectTag; - } else if (objTag != objectTag) { - objIsArr = isTypedArray(object); - } - } - if (!othIsArr) { - othTag = objToString.call(other); - if (othTag == argsTag) { - othTag = objectTag; - } else if (othTag != objectTag) { - othIsArr = isTypedArray(other); - } - } - var objIsObj = objTag == objectTag, - othIsObj = othTag == objectTag, - isSameTag = objTag == othTag; - - if (isSameTag && !(objIsArr || objIsObj)) { - return equalByTag(object, other, objTag); - } - if (!isLoose) { - var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - - if (objIsWrapped || othIsWrapped) { - return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB); - } - } - if (!isSameTag) { - return false; - } - // Assume cyclic values are equal. - // For more information on detecting circular references see https://es5.github.io/#JO. - stackA || (stackA = []); - stackB || (stackB = []); - - var length = stackA.length; - while (length--) { - if (stackA[length] == object) { - return stackB[length] == other; - } - } - // Add `object` and `other` to the stack of traversed objects. - stackA.push(object); - stackB.push(other); - - var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB); - - stackA.pop(); - stackB.pop(); - - return result; -} - -/** - * A specialized version of `baseIsEqualDeep` for arrays with support for - * partial deep comparisons. - * - * @private - * @param {Array} array The array to compare. - * @param {Array} other The other array to compare. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparing arrays. - * @param {boolean} [isLoose] Specify performing partial comparisons. - * @param {Array} [stackA] Tracks traversed `value` objects. - * @param {Array} [stackB] Tracks traversed `other` objects. - * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. - */ -function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) { - var index = -1, - arrLength = array.length, - othLength = other.length; - - if (arrLength != othLength && !(isLoose && othLength > arrLength)) { - return false; - } - // Ignore non-index properties. - while (++index < arrLength) { - var arrValue = array[index], - othValue = other[index], - result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined; - - if (result !== undefined) { - if (result) { - continue; - } - return false; - } - // Recursively compare arrays (susceptible to call stack limits). - if (isLoose) { - if (!arraySome(other, function(othValue) { - return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); - })) { - return false; - } - } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) { - return false; - } - } - return true; -} - -/** - * A specialized version of `baseIsEqualDeep` for comparing objects of - * the same `toStringTag`. - * - * **Note:** This function only supports comparing values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} value The object to compare. - * @param {Object} other The other object to compare. - * @param {string} tag The `toStringTag` of the objects to compare. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ -function equalByTag(object, other, tag) { - switch (tag) { - case boolTag: - case dateTag: - // Coerce dates and booleans to numbers, dates to milliseconds and booleans - // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. - return +object == +other; - - case errorTag: - return object.name == other.name && object.message == other.message; - - case numberTag: - // Treat `NaN` vs. `NaN` as equal. - return (object != +object) - ? other != +other - : object == +other; - - case regexpTag: - case stringTag: - // Coerce regexes to strings and treat strings primitives and string - // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. - return object == (other + ''); - } - return false; -} - -/** - * A specialized version of `baseIsEqualDeep` for objects with support for - * partial deep comparisons. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparing values. - * @param {boolean} [isLoose] Specify performing partial comparisons. - * @param {Array} [stackA] Tracks traversed `value` objects. - * @param {Array} [stackB] Tracks traversed `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ -function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) { - var objProps = keys(object), - objLength = objProps.length, - othProps = keys(other), - othLength = othProps.length; - - if (objLength != othLength && !isLoose) { - return false; - } - var index = objLength; - while (index--) { - var key = objProps[index]; - if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) { - return false; - } - } - var skipCtor = isLoose; - while (++index < objLength) { - key = objProps[index]; - var objValue = object[key], - othValue = other[key], - result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined; - - // Recursively compare objects (susceptible to call stack limits). - if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) { - return false; - } - skipCtor || (skipCtor = key == 'constructor'); - } - if (!skipCtor) { - var objCtor = object.constructor, - othCtor = other.constructor; - - // Non `Object` object instances with different constructors are not equal. - if (objCtor != othCtor && - ('constructor' in object && 'constructor' in other) && - !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { - return false; - } - } - return true; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -module.exports = baseIsEqual; - -},{"lodash.isarray":28,"lodash.istypedarray":30,"lodash.keys":31}],20:[function(require,module,exports){ -/** - * lodash 3.0.1 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** - * A specialized version of `baseCallback` which only supports `this` binding - * and specifying the number of arguments to provide to `func`. - * - * @private - * @param {Function} func The function to bind. - * @param {*} thisArg The `this` binding of `func`. - * @param {number} [argCount] The number of arguments to provide to `func`. - * @returns {Function} Returns the callback. - */ -function bindCallback(func, thisArg, argCount) { - if (typeof func != 'function') { - return identity; - } - if (thisArg === undefined) { - return func; - } - switch (argCount) { - case 1: return function(value) { - return func.call(thisArg, value); - }; - case 3: return function(value, index, collection) { - return func.call(thisArg, value, index, collection); - }; - case 4: return function(accumulator, value, index, collection) { - return func.call(thisArg, accumulator, value, index, collection); - }; - case 5: return function(value, other, key, object, source) { - return func.call(thisArg, value, other, key, object, source); - }; - } - return function() { - return func.apply(thisArg, arguments); - }; -} - -/** - * This method returns the first argument provided to it. - * - * @static - * @memberOf _ - * @category Utility - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -module.exports = bindCallback; - -},{}],21:[function(require,module,exports){ -/** - * lodash 3.1.1 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -var bindCallback = require('lodash._bindcallback'), - isIterateeCall = require('lodash._isiterateecall'), - restParam = require('lodash.restparam'); - -/** - * Creates a function that assigns properties of source object(s) to a given - * destination object. - * - * **Note:** This function is used to create `_.assign`, `_.defaults`, and `_.merge`. - * - * @private - * @param {Function} assigner The function to assign values. - * @returns {Function} Returns the new assigner function. - */ -function createAssigner(assigner) { - return restParam(function(object, sources) { - var index = -1, - length = object == null ? 0 : sources.length, - customizer = length > 2 ? sources[length - 2] : undefined, - guard = length > 2 ? sources[2] : undefined, - thisArg = length > 1 ? sources[length - 1] : undefined; - - if (typeof customizer == 'function') { - customizer = bindCallback(customizer, thisArg, 5); - length -= 2; - } else { - customizer = typeof thisArg == 'function' ? thisArg : undefined; - length -= (customizer ? 1 : 0); - } - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - customizer = length < 3 ? undefined : customizer; - length = 1; - } - while (++index < length) { - var source = sources[index]; - if (source) { - assigner(object, source, customizer); - } - } - return object; - }); -} - -module.exports = createAssigner; - -},{"lodash._bindcallback":20,"lodash._isiterateecall":23,"lodash.restparam":35}],22:[function(require,module,exports){ -/** - * lodash 3.9.1 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** `Object#toString` result references. */ -var funcTag = '[object Function]'; - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** - * Checks if `value` is object-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to resolve the decompiled source of functions. */ -var fnToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; -} - -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in older versions of Chrome and Safari which return 'function' for regexes - // and Safari 8 equivalents which return 'object' for typed array constructors. - return isObject(value) && objToString.call(value) == funcTag; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(fnToString.call(value)); - } - return isObjectLike(value) && reIsHostCtor.test(value); -} - -module.exports = getNative; - -},{}],23:[function(require,module,exports){ -/** - * lodash 3.0.9 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** Used to detect unsigned integer values. */ -var reIsUint = /^\d+$/; - -/** - * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) - * of an array-like value. - */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * that affects Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -/** - * Checks if `value` is array-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - */ -function isArrayLike(value) { - return value != null && isLength(getLength(value)); -} - -/** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ -function isIndex(value, length) { - value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; - length = length == null ? MAX_SAFE_INTEGER : length; - return value > -1 && value % 1 == 0 && value < length; -} - -/** - * Checks if the provided arguments are from an iteratee call. - * - * @private - * @param {*} value The potential iteratee value argument. - * @param {*} index The potential iteratee index or key argument. - * @param {*} object The potential iteratee object argument. - * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. - */ -function isIterateeCall(value, index, object) { - if (!isObject(object)) { - return false; - } - var type = typeof index; - if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object)) { - var other = object[index]; - return value === value ? (value === other) : (other !== other); - } - return false; -} - -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - */ -function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -module.exports = isIterateeCall; - -},{}],24:[function(require,module,exports){ -(function (global){ -/** - * lodash 3.0.1 (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** Used to determine if values are of the language type `Object`. */ -var objectTypes = { - 'function': true, - 'object': true -}; - -/** Detect free variable `exports`. */ -var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) - ? exports - : undefined; - -/** Detect free variable `module`. */ -var freeModule = (objectTypes[typeof module] && module && !module.nodeType) - ? module - : undefined; - -/** Detect free variable `global` from Node.js. */ -var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); - -/** Detect free variable `self`. */ -var freeSelf = checkGlobal(objectTypes[typeof self] && self); - -/** Detect free variable `window`. */ -var freeWindow = checkGlobal(objectTypes[typeof window] && window); - -/** Detect `this` as the global object. */ -var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - -/** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ -var root = freeGlobal || - ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || - freeSelf || thisGlobal || Function('return this')(); - -/** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ -function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; -} - -module.exports = root; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],25:[function(require,module,exports){ -/** - * lodash 3.2.0 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -var baseAssign = require('lodash._baseassign'), - createAssigner = require('lodash._createassigner'), - keys = require('lodash.keys'); - -/** - * A specialized version of `_.assign` for customizing assigned values without - * support for argument juggling, multiple sources, and `this` binding `customizer` - * functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {Function} customizer The function to customize assigned values. - * @returns {Object} Returns `object`. - */ -function assignWith(object, source, customizer) { - var index = -1, - props = keys(source), - length = props.length; - - while (++index < length) { - var key = props[index], - value = object[key], - result = customizer(value, source[key], key, object, source); - - if ((result === result ? (result !== value) : (value === value)) || - (value === undefined && !(key in object))) { - object[key] = result; - } - } - return object; -} - -/** - * Assigns own enumerable properties of source object(s) to the destination - * object. Subsequent sources overwrite property assignments of previous sources. - * If `customizer` is provided it is invoked to produce the assigned values. - * The `customizer` is bound to `thisArg` and invoked with five arguments: - * (objectValue, sourceValue, key, object, source). - * - * **Note:** This method mutates `object` and is based on - * [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign). - * - * @static - * @memberOf _ - * @alias extend - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @param {*} [thisArg] The `this` binding of `customizer`. - * @returns {Object} Returns `object`. - * @example - * - * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' }); - * // => { 'user': 'fred', 'age': 40 } - * - * // using a customizer callback - * var defaults = _.partialRight(_.assign, function(value, other) { - * return _.isUndefined(value) ? other : value; - * }); - * - * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); - * // => { 'user': 'barney', 'age': 36 } - */ -var assign = createAssigner(function(object, source, customizer) { - return customizer - ? assignWith(object, source, customizer) - : baseAssign(object, source); -}); - -module.exports = assign; - -},{"lodash._baseassign":15,"lodash._createassigner":21,"lodash.keys":31}],26:[function(require,module,exports){ -/** - * lodash 3.2.0 (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -var root = require('lodash._root'); - -/** Used as references for various `Number` constants. */ -var INFINITY = 1 / 0, - MAX_INTEGER = 1.7976931348623157e+308, - NAN = 0 / 0; - -/** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - symbolTag = '[object Symbol]'; - -/** Used to match leading and trailing whitespace. */ -var reTrim = /^\s+|\s+$/g; - -/** Used to detect bad signed hexadecimal string values. */ -var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; - -/** Used to detect binary string values. */ -var reIsBinary = /^0b[01]+$/i; - -/** Used to detect octal string values. */ -var reIsOctal = /^0o[0-7]+$/i; - -/** Built-in method references without a dependency on `root`. */ -var freeParseInt = parseInt; - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Built-in value references. */ -var Symbol = root.Symbol; - -/** Used to convert symbols to primitives and strings. */ -var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolToString = Symbol ? symbolProto.toString : undefined; - -/** - * The base implementation of `_.clamp` which doesn't coerce arguments to numbers. - * - * @private - * @param {number} number The number to clamp. - * @param {number} [lower] The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the clamped number. - */ -function baseClamp(number, lower, upper) { - if (number === number) { - if (upper !== undefined) { - number = number <= upper ? number : upper; - } - if (lower !== undefined) { - number = number >= lower ? number : lower; - } - } - return number; -} - -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ -function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && objectToString.call(value) == symbolTag); -} - -/** - * Converts `value` to an integer. - * - * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toInteger(3); - * // => 3 - * - * _.toInteger(Number.MIN_VALUE); - * // => 0 - * - * _.toInteger(Infinity); - * // => 1.7976931348623157e+308 - * - * _.toInteger('3'); - * // => 3 - */ -function toInteger(value) { - if (!value) { - return value === 0 ? value : 0; - } - value = toNumber(value); - if (value === INFINITY || value === -INFINITY) { - var sign = (value < 0 ? -1 : 1); - return sign * MAX_INTEGER; - } - var remainder = value % 1; - return value === value ? (remainder ? value - remainder : value) : 0; -} - -/** - * Converts `value` to a number. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to process. - * @returns {number} Returns the number. - * @example - * - * _.toNumber(3); - * // => 3 - * - * _.toNumber(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toNumber(Infinity); - * // => Infinity - * - * _.toNumber('3'); - * // => 3 - */ -function toNumber(value) { - if (isObject(value)) { - var other = isFunction(value.valueOf) ? value.valueOf() : value; - value = isObject(other) ? (other + '') : other; - } - if (typeof value != 'string') { - return value === 0 ? value : +value; - } - value = value.replace(reTrim, ''); - var isBinary = reIsBinary.test(value); - return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); -} - -/** - * Converts `value` to a string if it's not one. An empty string is returned - * for `null` and `undefined` values. The sign of `-0` is preserved. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to process. - * @returns {string} Returns the string. - * @example - * - * _.toString(null); - * // => '' - * - * _.toString(-0); - * // => '-0' - * - * _.toString([1, 2, 3]); - * // => '1,2,3' - */ -function toString(value) { - // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { - return value; - } - if (value == null) { - return ''; - } - if (isSymbol(value)) { - return Symbol ? symbolToString.call(value) : ''; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; -} - -/** - * Checks if `string` ends with the given target string. - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to search. - * @param {string} [target] The string to search for. - * @param {number} [position=string.length] The position to search from. - * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`. - * @example - * - * _.endsWith('abc', 'c'); - * // => true - * - * _.endsWith('abc', 'b'); - * // => false - * - * _.endsWith('abc', 'b', 2); - * // => true - */ -function endsWith(string, target, position) { - string = toString(string); - target = typeof target == 'string' ? target : (target + ''); - - var length = string.length; - position = position === undefined - ? length - : baseClamp(toInteger(position), 0, length); - - position -= target.length; - return position >= 0 && string.indexOf(target, position) == position; -} - -module.exports = endsWith; - -},{"lodash._root":24}],27:[function(require,module,exports){ -/** - * lodash (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ - -/** Used as references for various `Number` constants. */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Built-in value references. */ -var propertyIsEnumerable = objectProto.propertyIsEnumerable; - -/** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ -function isArguments(value) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. - return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && - (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); -} - -/** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ -function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); -} - -/** - * This method is like `_.isArrayLike` except that it also checks if `value` - * is an object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, - * else `false`. - * @example - * - * _.isArrayLikeObject([1, 2, 3]); - * // => true - * - * _.isArrayLikeObject(document.body.children); - * // => true - * - * _.isArrayLikeObject('abc'); - * // => false - * - * _.isArrayLikeObject(_.noop); - * // => false - */ -function isArrayLikeObject(value) { - return isObjectLike(value) && isArrayLike(value); -} - -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8-9 which returns 'object' for typed array and other constructors. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; -} - -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ -function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - -/** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -module.exports = isArguments; - -},{}],28:[function(require,module,exports){ -/** - * lodash 3.0.4 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** `Object#toString` result references. */ -var arrayTag = '[object Array]', - funcTag = '[object Function]'; - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** - * Checks if `value` is object-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to resolve the decompiled source of functions. */ -var fnToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeIsArray = getNative(Array, 'isArray'); - -/** - * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) - * of an array-like value. - */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; -} - -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - */ -function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(function() { return arguments; }()); - * // => false - */ -var isArray = nativeIsArray || function(value) { - return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; -}; - -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in older versions of Chrome and Safari which return 'function' for regexes - // and Safari 8 equivalents which return 'object' for typed array constructors. - return isObject(value) && objToString.call(value) == funcTag; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(fnToString.call(value)); - } - return isObjectLike(value) && reIsHostCtor.test(value); -} - -module.exports = isArray; - -},{}],29:[function(require,module,exports){ -/** - * lodash 3.0.1 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.2 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** `Object#toString` result references. */ -var stringTag = '[object String]'; - -/** - * Checks if `value` is object-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ -function isString(value) { - return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag); -} - -module.exports = isString; - -},{}],30:[function(require,module,exports){ -/** - * lodash 3.0.6 (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ - -/** Used as references for various `Number` constants. */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - mapTag = '[object Map]', - numberTag = '[object Number]', - objectTag = '[object Object]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - weakMapTag = '[object WeakMap]'; - -var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - -/** Used to identify `toStringTag` values of typed arrays. */ -var typedArrayTags = {}; -typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = -typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = -typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = -typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = -typedArrayTags[uint32Tag] = true; -typedArrayTags[argsTag] = typedArrayTags[arrayTag] = -typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = -typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = -typedArrayTags[errorTag] = typedArrayTags[funcTag] = -typedArrayTags[mapTag] = typedArrayTags[numberTag] = -typedArrayTags[objectTag] = typedArrayTags[regexpTag] = -typedArrayTags[setTag] = typedArrayTags[stringTag] = -typedArrayTags[weakMapTag] = false; - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ -function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true - * - * _.isTypedArray([]); - * // => false - */ -function isTypedArray(value) { - return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; -} - -module.exports = isTypedArray; - -},{}],31:[function(require,module,exports){ -/** - * lodash 3.1.2 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -var getNative = require('lodash._getnative'), - isArguments = require('lodash.isarguments'), - isArray = require('lodash.isarray'); - -/** Used to detect unsigned integer values. */ -var reIsUint = /^\d+$/; - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeKeys = getNative(Object, 'keys'); - -/** - * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) - * of an array-like value. - */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * that affects Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -/** - * Checks if `value` is array-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - */ -function isArrayLike(value) { - return value != null && isLength(getLength(value)); -} - -/** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ -function isIndex(value, length) { - value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; - length = length == null ? MAX_SAFE_INTEGER : length; - return value > -1 && value % 1 == 0 && value < length; -} - -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - */ -function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - -/** - * A fallback implementation of `Object.keys` which creates an array of the - * own enumerable property names of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ -function shimKeys(object) { - var props = keysIn(object), - propsLength = props.length, - length = propsLength && object.length; - - var allowIndexes = !!length && isLength(length) && - (isArray(object) || isArguments(object)); - - var index = -1, - result = []; - - while (++index < propsLength) { - var key = props[index]; - if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { - result.push(key); - } - } - return result; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) - * for more details. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ -var keys = !nativeKeys ? shimKeys : function(object) { - var Ctor = object == null ? undefined : object.constructor; - if ((typeof Ctor == 'function' && Ctor.prototype === object) || - (typeof object != 'function' && isArrayLike(object))) { - return shimKeys(object); - } - return isObject(object) ? nativeKeys(object) : []; -}; - -/** - * Creates an array of the own and inherited enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) - */ -function keysIn(object) { - if (object == null) { - return []; - } - if (!isObject(object)) { - object = Object(object); - } - var length = object.length; - length = (length && isLength(length) && - (isArray(object) || isArguments(object)) && length) || 0; - - var Ctor = object.constructor, - index = -1, - isProto = typeof Ctor == 'function' && Ctor.prototype === object, - result = Array(length), - skipIndexes = length > 0; - - while (++index < length) { - result[index] = (index + ''); - } - for (var key in object) { - if (!(skipIndexes && isIndex(key, length)) && - !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; -} - -module.exports = keys; - -},{"lodash._getnative":22,"lodash.isarguments":27,"lodash.isarray":28}],32:[function(require,module,exports){ -/** - * lodash 3.0.0 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.7.0 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** - * Gets the last element of `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the last element of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - */ -function last(array) { - var length = array ? array.length : 0; - return length ? array[length - 1] : undefined; -} - -module.exports = last; - -},{}],33:[function(require,module,exports){ -/** - * lodash 3.1.4 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -var arrayMap = require('lodash._arraymap'), - baseCallback = require('lodash._basecallback'), - baseEach = require('lodash._baseeach'), - isArray = require('lodash.isarray'); - -/** - * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) - * of an array-like value. - */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** - * The base implementation of `_.map` without support for callback shorthands - * and `this` binding. - * - * @private - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ -function baseMap(collection, iteratee) { - var index = -1, - result = isArrayLike(collection) ? Array(collection.length) : []; - - baseEach(collection, function(value, key, collection) { - result[++index] = iteratee(value, key, collection); - }); - return result; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * that affects Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -/** - * Checks if `value` is array-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - */ -function isArrayLike(value) { - return value != null && isLength(getLength(value)); -} - -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - */ -function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - -/** - * Creates an array of values by running each element in `collection` through - * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three - * arguments: (value, index|key, collection). - * - * If a property name is provided for `iteratee` the created `_.property` - * style callback returns the property value of the given element. - * - * If a value is also provided for `thisArg` the created `_.matchesProperty` - * style callback returns `true` for elements that have a matching property - * value, else `false`. - * - * If an object is provided for `iteratee` the created `_.matches` style - * callback returns `true` for elements that have the properties of the given - * object, else `false`. - * - * Many lodash methods are guarded to work as iteratees for methods like - * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. - * - * The guarded methods are: - * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, - * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, - * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, - * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, - * `sum`, `uniq`, and `words` - * - * @static - * @memberOf _ - * @alias collect - * @category Collection - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked - * per iteration. - * @param {*} [thisArg] The `this` binding of `iteratee`. - * @returns {Array} Returns the new mapped array. - * @example - * - * function timesThree(n) { - * return n * 3; - * } - * - * _.map([1, 2], timesThree); - * // => [3, 6] - * - * _.map({ 'a': 1, 'b': 2 }, timesThree); - * // => [3, 6] (iteration order is not guaranteed) - * - * var users = [ - * { 'user': 'barney' }, - * { 'user': 'fred' } - * ]; - * - * // using the `_.property` callback shorthand - * _.map(users, 'user'); - * // => ['barney', 'fred'] - */ -function map(collection, iteratee, thisArg) { - var func = isArray(collection) ? arrayMap : baseMap; - iteratee = baseCallback(iteratee, thisArg, 3); - return func(collection, iteratee); -} - -module.exports = map; - -},{"lodash._arraymap":14,"lodash._basecallback":16,"lodash._baseeach":18,"lodash.isarray":28}],34:[function(require,module,exports){ -/** - * lodash 3.0.1 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -var keys = require('lodash.keys'); - -/** - * Converts `value` to an object if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Object} Returns the object. - */ -function toObject(value) { - return isObject(value) ? value : Object(value); -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Creates a two dimensional array of the key-value pairs for `object`, - * e.g. `[[key1, value1], [key2, value2]]`. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the new array of key-value pairs. - * @example - * - * _.pairs({ 'barney': 36, 'fred': 40 }); - * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed) - */ -function pairs(object) { - object = toObject(object); - - var index = -1, - props = keys(object), - length = props.length, - result = Array(length); - - while (++index < length) { - var key = props[index]; - result[index] = [key, object[key]]; - } - return result; -} - -module.exports = pairs; - -},{"lodash.keys":31}],35:[function(require,module,exports){ -/** - * lodash 3.6.1 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** Used as the `TypeError` message for "Functions" methods. */ -var FUNC_ERROR_TEXT = 'Expected a function'; - -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max; - -/** - * Creates a function that invokes `func` with the `this` binding of the - * created function and arguments from `start` and beyond provided as an array. - * - * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters). - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - * @example - * - * var say = _.restParam(function(what, names) { - * return what + ' ' + _.initial(names).join(', ') + - * (_.size(names) > 1 ? ', & ' : '') + _.last(names); - * }); - * - * say('hello', 'fred', 'barney', 'pebbles'); - * // => 'hello fred, barney, & pebbles' - */ -function restParam(func, start) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - rest = Array(length); - - while (++index < length) { - rest[index] = args[start + index]; - } - switch (start) { - case 0: return func.call(this, rest); - case 1: return func.call(this, args[0], rest); - case 2: return func.call(this, args[0], args[1], rest); - } - var otherArgs = Array(start + 1); - index = -1; - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = rest; - return func.apply(this, otherArgs); - }; -} - -module.exports = restParam; - -},{}],36:[function(require,module,exports){ -(function (process){ -'use strict'; - -if (!process.version || - process.version.indexOf('v0.') === 0 || - process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { - module.exports = nextTick; -} else { - module.exports = process.nextTick; -} - -function nextTick(fn, arg1, arg2, arg3) { - if (typeof fn !== 'function') { - throw new TypeError('"callback" argument must be a function'); - } - var len = arguments.length; - var args, i; - switch (len) { - case 0: - case 1: - return process.nextTick(fn); - case 2: - return process.nextTick(function afterTickOne() { - fn.call(null, arg1); - }); - case 3: - return process.nextTick(function afterTickTwo() { - fn.call(null, arg1, arg2); - }); - case 4: - return process.nextTick(function afterTickThree() { - fn.call(null, arg1, arg2, arg3); - }); - default: - args = new Array(len - 1); - i = 0; - while (i < args.length) { - args[i++] = arguments[i]; - } - return process.nextTick(function afterTick() { - fn.apply(null, args); - }); - } -} - -}).call(this,require('_process')) -},{"_process":37}],37:[function(require,module,exports){ -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - -},{}],38:[function(require,module,exports){ -(function (global){ -/*! https://mths.be/punycode v1.4.1 by @mathias */ -;(function(root) { - - /** Detect free variables */ - var freeExports = typeof exports == 'object' && exports && - !exports.nodeType && exports; - var freeModule = typeof module == 'object' && module && - !module.nodeType && module; - var freeGlobal = typeof global == 'object' && global; - if ( - freeGlobal.global === freeGlobal || - freeGlobal.window === freeGlobal || - freeGlobal.self === freeGlobal - ) { - root = freeGlobal; - } - - /** - * The `punycode` object. - * @name punycode - * @type Object - */ - var punycode, - - /** Highest positive signed 32-bit float value */ - maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 - - /** Bootstring parameters */ - base = 36, - tMin = 1, - tMax = 26, - skew = 38, - damp = 700, - initialBias = 72, - initialN = 128, // 0x80 - delimiter = '-', // '\x2D' - - /** Regular expressions */ - regexPunycode = /^xn--/, - regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars - regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators - - /** Error messages */ - errors = { - 'overflow': 'Overflow: input needs wider integers to process', - 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', - 'invalid-input': 'Invalid input' - }, - - /** Convenience shortcuts */ - baseMinusTMin = base - tMin, - floor = Math.floor, - stringFromCharCode = String.fromCharCode, - - /** Temporary variable */ - key; - - /*--------------------------------------------------------------------------*/ - - /** - * A generic error utility function. - * @private - * @param {String} type The error type. - * @returns {Error} Throws a `RangeError` with the applicable error message. - */ - function error(type) { - throw new RangeError(errors[type]); - } - - /** - * A generic `Array#map` utility function. - * @private - * @param {Array} array The array to iterate over. - * @param {Function} callback The function that gets called for every array - * item. - * @returns {Array} A new array of values returned by the callback function. - */ - function map(array, fn) { - var length = array.length; - var result = []; - while (length--) { - result[length] = fn(array[length]); - } - return result; - } - - /** - * A simple `Array#map`-like wrapper to work with domain name strings or email - * addresses. - * @private - * @param {String} domain The domain name or email address. - * @param {Function} callback The function that gets called for every - * character. - * @returns {Array} A new string of characters returned by the callback - * function. - */ - function mapDomain(string, fn) { - var parts = string.split('@'); - var result = ''; - if (parts.length > 1) { - // In email addresses, only the domain name should be punycoded. Leave - // the local part (i.e. everything up to `@`) intact. - result = parts[0] + '@'; - string = parts[1]; - } - // Avoid `split(regex)` for IE8 compatibility. See #17. - string = string.replace(regexSeparators, '\x2E'); - var labels = string.split('.'); - var encoded = map(labels, fn).join('.'); - return result + encoded; - } - - /** - * Creates an array containing the numeric code points of each Unicode - * character in the string. While JavaScript uses UCS-2 internally, - * this function will convert a pair of surrogate halves (each of which - * UCS-2 exposes as separate characters) into a single code point, - * matching UTF-16. - * @see `punycode.ucs2.encode` - * @see - * @memberOf punycode.ucs2 - * @name decode - * @param {String} string The Unicode input string (UCS-2). - * @returns {Array} The new array of code points. - */ - function ucs2decode(string) { - var output = [], - counter = 0, - length = string.length, - value, - extra; - while (counter < length) { - value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // low surrogate - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } - - /** - * Creates a string based on an array of numeric code points. - * @see `punycode.ucs2.decode` - * @memberOf punycode.ucs2 - * @name encode - * @param {Array} codePoints The array of numeric code points. - * @returns {String} The new Unicode string (UCS-2). - */ - function ucs2encode(array) { - return map(array, function(value) { - var output = ''; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - return output; - }).join(''); - } - - /** - * Converts a basic code point into a digit/integer. - * @see `digitToBasic()` - * @private - * @param {Number} codePoint The basic numeric code point value. - * @returns {Number} The numeric value of a basic code point (for use in - * representing integers) in the range `0` to `base - 1`, or `base` if - * the code point does not represent a value. - */ - function basicToDigit(codePoint) { - if (codePoint - 48 < 10) { - return codePoint - 22; - } - if (codePoint - 65 < 26) { - return codePoint - 65; - } - if (codePoint - 97 < 26) { - return codePoint - 97; - } - return base; - } - - /** - * Converts a digit/integer into a basic code point. - * @see `basicToDigit()` - * @private - * @param {Number} digit The numeric value of a basic code point. - * @returns {Number} The basic code point whose value (when used for - * representing integers) is `digit`, which needs to be in the range - * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is - * used; else, the lowercase form is used. The behavior is undefined - * if `flag` is non-zero and `digit` has no uppercase form. - */ - function digitToBasic(digit, flag) { - // 0..25 map to ASCII a..z or A..Z - // 26..35 map to ASCII 0..9 - return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); - } - - /** - * Bias adaptation function as per section 3.4 of RFC 3492. - * https://tools.ietf.org/html/rfc3492#section-3.4 - * @private - */ - function adapt(delta, numPoints, firstTime) { - var k = 0; - delta = firstTime ? floor(delta / damp) : delta >> 1; - delta += floor(delta / numPoints); - for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { - delta = floor(delta / baseMinusTMin); - } - return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); - } - - /** - * Converts a Punycode string of ASCII-only symbols to a string of Unicode - * symbols. - * @memberOf punycode - * @param {String} input The Punycode string of ASCII-only symbols. - * @returns {String} The resulting string of Unicode symbols. - */ - function decode(input) { - // Don't use UCS-2 - var output = [], - inputLength = input.length, - out, - i = 0, - n = initialN, - bias = initialBias, - basic, - j, - index, - oldi, - w, - k, - digit, - t, - /** Cached calculation results */ - baseMinusT; - - // Handle the basic code points: let `basic` be the number of input code - // points before the last delimiter, or `0` if there is none, then copy - // the first basic code points to the output. - - basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } - - for (j = 0; j < basic; ++j) { - // if it's not a basic code point - if (input.charCodeAt(j) >= 0x80) { - error('not-basic'); - } - output.push(input.charCodeAt(j)); - } - - // Main decoding loop: start just after the last delimiter if any basic code - // points were copied; start at the beginning otherwise. - - for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { - - // `index` is the index of the next character to be consumed. - // Decode a generalized variable-length integer into `delta`, - // which gets added to `i`. The overflow checking is easier - // if we increase `i` as we go, then subtract off its starting - // value at the end to obtain `delta`. - for (oldi = i, w = 1, k = base; /* no condition */; k += base) { - - if (index >= inputLength) { - error('invalid-input'); - } - - digit = basicToDigit(input.charCodeAt(index++)); - - if (digit >= base || digit > floor((maxInt - i) / w)) { - error('overflow'); - } - - i += digit * w; - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - - if (digit < t) { - break; - } - - baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error('overflow'); - } - - w *= baseMinusT; - - } - - out = output.length + 1; - bias = adapt(i - oldi, out, oldi == 0); - - // `i` was supposed to wrap around from `out` to `0`, - // incrementing `n` each time, so we'll fix that now: - if (floor(i / out) > maxInt - n) { - error('overflow'); - } - - n += floor(i / out); - i %= out; - - // Insert `n` at position `i` of the output - output.splice(i++, 0, n); - - } - - return ucs2encode(output); - } - - /** - * Converts a string of Unicode symbols (e.g. a domain name label) to a - * Punycode string of ASCII-only symbols. - * @memberOf punycode - * @param {String} input The string of Unicode symbols. - * @returns {String} The resulting Punycode string of ASCII-only symbols. - */ - function encode(input) { - var n, - delta, - handledCPCount, - basicLength, - bias, - j, - m, - q, - k, - t, - currentValue, - output = [], - /** `inputLength` will hold the number of code points in `input`. */ - inputLength, - /** Cached calculation results */ - handledCPCountPlusOne, - baseMinusT, - qMinusT; - - // Convert the input in UCS-2 to Unicode - input = ucs2decode(input); - - // Cache the length - inputLength = input.length; - - // Initialize the state - n = initialN; - delta = 0; - bias = initialBias; - - // Handle the basic code points - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue < 0x80) { - output.push(stringFromCharCode(currentValue)); - } - } - - handledCPCount = basicLength = output.length; - - // `handledCPCount` is the number of code points that have been handled; - // `basicLength` is the number of basic code points. - - // Finish the basic string - if it is not empty - with a delimiter - if (basicLength) { - output.push(delimiter); - } - - // Main encoding loop: - while (handledCPCount < inputLength) { - - // All non-basic code points < n have been handled already. Find the next - // larger one: - for (m = maxInt, j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } - - // Increase `delta` enough to advance the decoder's state to , - // but guard against overflow - handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error('overflow'); - } - - delta += (m - n) * handledCPCountPlusOne; - n = m; - - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - - if (currentValue < n && ++delta > maxInt) { - error('overflow'); - } - - if (currentValue == n) { - // Represent delta as a generalized variable-length integer - for (q = delta, k = base; /* no condition */; k += base) { - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - if (q < t) { - break; - } - qMinusT = q - t; - baseMinusT = base - t; - output.push( - stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) - ); - q = floor(qMinusT / baseMinusT); - } - - output.push(stringFromCharCode(digitToBasic(q, 0))); - bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); - delta = 0; - ++handledCPCount; - } - } - - ++delta; - ++n; - - } - return output.join(''); - } - - /** - * Converts a Punycode string representing a domain name or an email address - * to Unicode. Only the Punycoded parts of the input will be converted, i.e. - * it doesn't matter if you call it on a string that has already been - * converted to Unicode. - * @memberOf punycode - * @param {String} input The Punycoded domain name or email address to - * convert to Unicode. - * @returns {String} The Unicode representation of the given Punycode - * string. - */ - function toUnicode(input) { - return mapDomain(input, function(string) { - return regexPunycode.test(string) - ? decode(string.slice(4).toLowerCase()) - : string; - }); - } - - /** - * Converts a Unicode string representing a domain name or an email address to - * Punycode. Only the non-ASCII parts of the domain name will be converted, - * i.e. it doesn't matter if you call it with a domain that's already in - * ASCII. - * @memberOf punycode - * @param {String} input The domain name or email address to convert, as a - * Unicode string. - * @returns {String} The Punycode representation of the given domain name or - * email address. - */ - function toASCII(input) { - return mapDomain(input, function(string) { - return regexNonASCII.test(string) - ? 'xn--' + encode(string) - : string; - }); - } - - /*--------------------------------------------------------------------------*/ - - /** Define the public API */ - punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - 'version': '1.4.1', - /** - * An object of methods to convert from JavaScript's internal character - * representation (UCS-2) to Unicode code points, and back. - * @see - * @memberOf punycode - * @type Object - */ - 'ucs2': { - 'decode': ucs2decode, - 'encode': ucs2encode - }, - 'decode': decode, - 'encode': encode, - 'toASCII': toASCII, - 'toUnicode': toUnicode - }; - - /** Expose `punycode` */ - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - typeof define == 'function' && - typeof define.amd == 'object' && - define.amd - ) { - define('punycode', function() { - return punycode; - }); - } else if (freeExports && freeModule) { - if (module.exports == freeExports) { - // in Node.js, io.js, or RingoJS v0.8.0+ - freeModule.exports = punycode; - } else { - // in Narwhal or RingoJS v0.7.0- - for (key in punycode) { - punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); - } - } - } else { - // in Rhino or a web browser - root.punycode = punycode; - } - -}(this)); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],39:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -// If obj.hasOwnProperty has been overridden, then calling -// obj.hasOwnProperty(prop) will break. -// See: https://github.com/joyent/node/issues/1707 -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -module.exports = function(qs, sep, eq, options) { - sep = sep || '&'; - eq = eq || '='; - var obj = {}; - - if (typeof qs !== 'string' || qs.length === 0) { - return obj; - } - - var regexp = /\+/g; - qs = qs.split(sep); - - var maxKeys = 1000; - if (options && typeof options.maxKeys === 'number') { - maxKeys = options.maxKeys; - } - - var len = qs.length; - // maxKeys <= 0 means that we should not limit keys count - if (maxKeys > 0 && len > maxKeys) { - len = maxKeys; - } - - for (var i = 0; i < len; ++i) { - var x = qs[i].replace(regexp, '%20'), - idx = x.indexOf(eq), - kstr, vstr, k, v; - - if (idx >= 0) { - kstr = x.substr(0, idx); - vstr = x.substr(idx + 1); - } else { - kstr = x; - vstr = ''; - } - - k = decodeURIComponent(kstr); - v = decodeURIComponent(vstr); - - if (!hasOwnProperty(obj, k)) { - obj[k] = v; - } else if (isArray(obj[k])) { - obj[k].push(v); - } else { - obj[k] = [obj[k], v]; - } - } - - return obj; -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - -},{}],40:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -var stringifyPrimitive = function(v) { - switch (typeof v) { - case 'string': - return v; - - case 'boolean': - return v ? 'true' : 'false'; - - case 'number': - return isFinite(v) ? v : ''; - - default: - return ''; - } -}; - -module.exports = function(obj, sep, eq, name) { - sep = sep || '&'; - eq = eq || '='; - if (obj === null) { - obj = undefined; - } - - if (typeof obj === 'object') { - return map(objectKeys(obj), function(k) { - var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; - if (isArray(obj[k])) { - return map(obj[k], function(v) { - return ks + encodeURIComponent(stringifyPrimitive(v)); - }).join(sep); - } else { - return ks + encodeURIComponent(stringifyPrimitive(obj[k])); - } - }).join(sep); - - } - - if (!name) return ''; - return encodeURIComponent(stringifyPrimitive(name)) + eq + - encodeURIComponent(stringifyPrimitive(obj)); -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - -function map (xs, f) { - if (xs.map) return xs.map(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - res.push(f(xs[i], i)); - } - return res; -} - -var objectKeys = Object.keys || function (obj) { - var res = []; - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); - } - return res; -}; - -},{}],41:[function(require,module,exports){ -'use strict'; - -exports.decode = exports.parse = require('./decode'); -exports.encode = exports.stringify = require('./encode'); - -},{"./decode":39,"./encode":40}],42:[function(require,module,exports){ -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. - -'use strict'; - -/**/ - -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - keys.push(key); - }return keys; -}; -/**/ - -module.exports = Duplex; - -/**/ -var processNextTick = require('process-nextick-args'); -/**/ - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var Readable = require('./_stream_readable'); -var Writable = require('./_stream_writable'); - -util.inherits(Duplex, Readable); - -var keys = objectKeys(Writable.prototype); -for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; -} - -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); - - Readable.call(this, options); - Writable.call(this, options); - - if (options && options.readable === false) this.readable = false; - - if (options && options.writable === false) this.writable = false; - - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; - - this.once('end', onend); -} - -// the no-half-open enforcer -function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) return; - - // no more data can be written. - // But allow more writes to happen in this tick. - processNextTick(onEndNT, this); -} - -function onEndNT(self) { - self.end(); -} - -function forEach(xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } -} -},{"./_stream_readable":44,"./_stream_writable":46,"core-util-is":7,"inherits":11,"process-nextick-args":36}],43:[function(require,module,exports){ -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. - -'use strict'; - -module.exports = PassThrough; - -var Transform = require('./_stream_transform'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(PassThrough, Transform); - -function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options); - - Transform.call(this, options); -} - -PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk); -}; -},{"./_stream_transform":45,"core-util-is":7,"inherits":11}],44:[function(require,module,exports){ -(function (process){ -'use strict'; - -module.exports = Readable; - -/**/ -var processNextTick = require('process-nextick-args'); -/**/ - -/**/ -var isArray = require('isarray'); -/**/ - -Readable.ReadableState = ReadableState; - -/**/ -var EE = require('events').EventEmitter; - -var EElistenerCount = function (emitter, type) { - return emitter.listeners(type).length; -}; -/**/ - -/**/ -var Stream; -(function () { - try { - Stream = require('st' + 'ream'); - } catch (_) {} finally { - if (!Stream) Stream = require('events').EventEmitter; - } -})(); -/**/ - -var Buffer = require('buffer').Buffer; -/**/ -var bufferShim = require('buffer-shims'); -/**/ - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -/**/ -var debugUtil = require('util'); -var debug = void 0; -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function () {}; -} -/**/ - -var BufferList = require('./internal/streams/BufferList'); -var StringDecoder; - -util.inherits(Readable, Stream); - -function prependListener(emitter, event, fn) { - if (typeof emitter.prependListener === 'function') { - return emitter.prependListener(event, fn); - } else { - // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; - } -} - -var Duplex; -function ReadableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); - - options = options || {}; - - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - - if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode; - - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; - - // cast to ints. - this.highWaterMark = ~ ~this.highWaterMark; - - // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift() - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // when piping, we only care about 'readable' events that happen - // after read()ing all the bytes and not getting any pushback. - this.ranOut = false; - - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -var Duplex; -function Readable(options) { - Duplex = Duplex || require('./_stream_duplex'); - - if (!(this instanceof Readable)) return new Readable(options); - - this._readableState = new ReadableState(options, this); - - // legacy - this.readable = true; - - if (options && typeof options.read === 'function') this._read = options.read; - - Stream.call(this); -} - -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function (chunk, encoding) { - var state = this._readableState; - - if (!state.objectMode && typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = bufferShim.from(chunk, encoding); - encoding = ''; - } - } - - return readableAddChunk(this, state, chunk, encoding, false); -}; - -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function (chunk) { - var state = this._readableState; - return readableAddChunk(this, state, chunk, '', true); -}; - -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; -}; - -function readableAddChunk(stream, state, chunk, encoding, addToFront) { - var er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (state.ended && !addToFront) { - var e = new Error('stream.push() after EOF'); - stream.emit('error', e); - } else if (state.endEmitted && addToFront) { - var _e = new Error('stream.unshift() after end event'); - stream.emit('error', _e); - } else { - var skipAdd; - if (state.decoder && !addToFront && !encoding) { - chunk = state.decoder.write(chunk); - skipAdd = !state.objectMode && chunk.length === 0; - } - - if (!addToFront) state.reading = false; - - // Don't add to the buffer if we've decoded to an empty string chunk and - // we're not in object mode - if (!skipAdd) { - // if we want the data now, just emit it. - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); - - if (state.needReadable) emitReadable(stream); - } - } - - maybeReadMore(stream, state); - } - } else if (!addToFront) { - state.reading = false; - } - - return needMoreData(state); -} - -// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state) { - return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); -} - -// backwards compatibility. -Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; - return this; -}; - -// Don't raise the hwm > 8MB -var MAX_HWM = 0x800000; -function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - return n; -} - -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) return 0; - if (state.objectMode) return 1; - if (n !== n) { - // Only flow one buffer at a time - if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; - } - // If we're asking for more than the current hwm, then raise the hwm. - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) return n; - // Don't have enough - if (!state.ended) { - state.needReadable = true; - return 0; - } - return state.length; -} - -// you can override either this method, or the async _read(n) below. -Readable.prototype.read = function (n) { - debug('read', n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - - if (n !== 0) state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); - - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this); - return null; - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); - - // if we currently have less than the highWaterMark, then also read some - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } - - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } else if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (!state.reading) n = howMuchToRead(nOrig, state); - } - - var ret; - if (n > 0) ret = fromList(n, state);else ret = null; - - if (ret === null) { - state.needReadable = true; - n = 0; - } else { - state.length -= n; - } - - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true; - - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended) endReadable(this); - } - - if (ret !== null) this.emit('data', ret); - - return ret; -}; - -function chunkInvalid(state, chunk) { - var er = null; - if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; -} - -function onEofChunk(stream, state) { - if (state.ended) return; - if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); -} - -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream); - } -} - -function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); -} - -// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - processNextTick(maybeReadMore_, stream, state); - } -} - -function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break;else len = state.length; - } - state.readingMore = false; -} - -// abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function (n) { - this.emit('error', new Error('not implemented')); -}; - -Readable.prototype.pipe = function (dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - - var endFn = doEnd ? onend : cleanup; - if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn); - - dest.on('unpipe', onunpipe); - function onunpipe(readable) { - debug('onunpipe'); - if (readable === src) { - cleanup(); - } - } - - function onend() { - debug('onend'); - dest.end(); - } - - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - - var cleanedUp = false; - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', cleanup); - src.removeListener('data', ondata); - - cleanedUp = true; - - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); - } - - // If the user pushes more data while we're writing to dest then we'll end up - // in ondata again. However, we only want to increase awaitDrain once because - // dest will only emit one 'drain' event for the multiple writes. - // => Introduce a guard on increasing awaitDrain. - var increasedAwaitDrain = false; - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - increasedAwaitDrain = false; - var ret = dest.write(chunk); - if (false === ret && !increasedAwaitDrain) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug('false write response, pause', src._readableState.awaitDrain); - src._readableState.awaitDrain++; - increasedAwaitDrain = true; - } - src.pause(); - } - } - - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); - } - - // Make sure our error handler is attached before userland ones. - prependListener(dest, 'error', onerror); - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } - - // tell the dest that it's being piped to - dest.emit('pipe', src); - - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - - return dest; -}; - -function pipeOnDrain(src) { - return function () { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; - if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; -} - -Readable.prototype.unpipe = function (dest) { - var state = this._readableState; - - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) return this; - - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; - - if (!dest) dest = state.pipes; - - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this); - return this; - } - - // slow case. multiple pipe destinations. - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - - for (var _i = 0; _i < len; _i++) { - dests[_i].emit('unpipe', this); - }return this; - } - - // try to find the right one. - var i = indexOf(state.pipes, dest); - if (i === -1) return this; - - state.pipes.splice(i, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) state.pipes = state.pipes[0]; - - dest.emit('unpipe', this); - - return this; -}; - -// set up data events if they are asked for -// Ensure readable listeners eventually get something -Readable.prototype.on = function (ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - - if (ev === 'data') { - // Start flowing on next tick if stream isn't explicitly paused - if (this._readableState.flowing !== false) this.resume(); - } else if (ev === 'readable') { - var state = this._readableState; - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.emittedReadable = false; - if (!state.reading) { - processNextTick(nReadingNextTick, this); - } else if (state.length) { - emitReadable(this, state); - } - } - } - - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; - -function nReadingNextTick(self) { - debug('readable nexttick read 0'); - self.read(0); -} - -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function () { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - resume(this, state); - } - return this; -}; - -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - processNextTick(resume_, stream, state); - } -} - -function resume_(stream, state) { - if (!state.reading) { - debug('resume read 0'); - stream.read(0); - } - - state.resumeScheduled = false; - state.awaitDrain = 0; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); -} - -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - return this; -}; - -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - while (state.flowing && stream.read() !== null) {} -} - -// wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function (stream) { - var state = this._readableState; - var paused = false; - - var self = this; - stream.on('end', function () { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) self.push(chunk); - } - - self.push(null); - }); - - stream.on('data', function (chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); - - // don't skip over falsy values in objectMode - if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; - - var ret = self.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function (method) { - return function () { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } - - // proxy certain important events. - var events = ['error', 'close', 'destroy', 'pause', 'resume']; - forEach(events, function (ev) { - stream.on(ev, self.emit.bind(self, ev)); - }); - - // when we try to consume some more bytes, simply unpause the - // underlying stream. - self._read = function (n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; - - return self; -}; - -// exposed for testing purposes only. -Readable._fromList = fromList; - -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromList(n, state) { - // nothing buffered - if (state.length === 0) return null; - - var ret; - if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { - // read it all, truncate the list - if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - // read part of list - ret = fromListPartial(n, state.buffer, state.decoder); - } - - return ret; -} - -// Extracts only enough buffered data to satisfy the amount requested. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromListPartial(n, list, hasStrings) { - var ret; - if (n < list.head.data.length) { - // slice is the same for buffers and strings - ret = list.head.data.slice(0, n); - list.head.data = list.head.data.slice(n); - } else if (n === list.head.data.length) { - // first chunk is a perfect match - ret = list.shift(); - } else { - // result spans more than one buffer - ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); - } - return ret; -} - -// Copies a specified amount of characters from the list of buffered data -// chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBufferString(n, list) { - var p = list.head; - var c = 1; - var ret = p.data; - n -= ret.length; - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) ret += str;else ret += str.slice(0, n); - n -= nb; - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) list.head = p.next;else list.head = list.tail = null; - } else { - list.head = p; - p.data = str.slice(nb); - } - break; - } - ++c; - } - list.length -= c; - return ret; -} - -// Copies a specified amount of bytes from the list of buffered data chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBuffer(n, list) { - var ret = bufferShim.allocUnsafe(n); - var p = list.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - while (p = p.next) { - var buf = p.data; - var nb = n > buf.length ? buf.length : n; - buf.copy(ret, ret.length - n, 0, nb); - n -= nb; - if (n === 0) { - if (nb === buf.length) { - ++c; - if (p.next) list.head = p.next;else list.head = list.tail = null; - } else { - list.head = p; - p.data = buf.slice(nb); - } - break; - } - ++c; - } - list.length -= c; - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; - - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); - - if (!state.endEmitted) { - state.ended = true; - processNextTick(endReadableNT, state, stream); - } -} - -function endReadableNT(state, stream) { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } -} - -function forEach(xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } -} - -function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - return -1; -} -}).call(this,require('_process')) -},{"./_stream_duplex":42,"./internal/streams/BufferList":47,"_process":37,"buffer":5,"buffer-shims":4,"core-util-is":7,"events":8,"inherits":11,"isarray":13,"process-nextick-args":36,"string_decoder/":53,"util":3}],45:[function(require,module,exports){ -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - -'use strict'; - -module.exports = Transform; - -var Duplex = require('./_stream_duplex'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(Transform, Duplex); - -function TransformState(stream) { - this.afterTransform = function (er, data) { - return afterTransform(stream, er, data); - }; - - this.needTransform = false; - this.transforming = false; - this.writecb = null; - this.writechunk = null; - this.writeencoding = null; -} - -function afterTransform(stream, er, data) { - var ts = stream._transformState; - ts.transforming = false; - - var cb = ts.writecb; - - if (!cb) return stream.emit('error', new Error('no writecb in Transform class')); - - ts.writechunk = null; - ts.writecb = null; - - if (data !== null && data !== undefined) stream.push(data); - - cb(er); - - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); - } -} - -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); - - Duplex.call(this, options); - - this._transformState = new TransformState(this); - - // when the writable side finishes, then flush out anything remaining. - var stream = this; - - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform; - - if (typeof options.flush === 'function') this._flush = options.flush; - } - - this.once('prefinish', function () { - if (typeof this._flush === 'function') this._flush(function (er) { - done(stream, er); - });else done(stream); - }); -} - -Transform.prototype.push = function (chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; - -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function (chunk, encoding, cb) { - throw new Error('Not implemented'); -}; - -Transform.prototype._write = function (chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } -}; - -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function (n) { - var ts = this._transformState; - - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; - -function done(stream, er) { - if (er) return stream.emit('error', er); - - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - var ws = stream._writableState; - var ts = stream._transformState; - - if (ws.length) throw new Error('Calling transform done when ws.length != 0'); - - if (ts.transforming) throw new Error('Calling transform done when still transforming'); - - return stream.push(null); -} -},{"./_stream_duplex":42,"core-util-is":7,"inherits":11}],46:[function(require,module,exports){ -(function (process){ -// A bit simpler than readable streams. -// Implement an async ._write(chunk, encoding, cb), and it'll handle all -// the drain event emission and buffering. - -'use strict'; - -module.exports = Writable; - -/**/ -var processNextTick = require('process-nextick-args'); -/**/ - -/**/ -var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick; -/**/ - -Writable.WritableState = WritableState; - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -/**/ -var internalUtil = { - deprecate: require('util-deprecate') -}; -/**/ - -/**/ -var Stream; -(function () { - try { - Stream = require('st' + 'ream'); - } catch (_) {} finally { - if (!Stream) Stream = require('events').EventEmitter; - } -})(); -/**/ - -var Buffer = require('buffer').Buffer; -/**/ -var bufferShim = require('buffer-shims'); -/**/ - -util.inherits(Writable, Stream); - -function nop() {} - -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - this.next = null; -} - -var Duplex; -function WritableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); - - options = options || {}; - - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - - if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode; - - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; - - // cast to ints. - this.highWaterMark = ~ ~this.highWaterMark; - - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - - // a flag to see when we're in the middle of a write. - this.writing = false; - - // when true all writes will be buffered until .uncork() call - this.corked = 0; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - - // the callback that's passed to _write(chunk,cb) - this.onwrite = function (er) { - onwrite(stream, er); - }; - - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - - // the amount that is being written when _write is called. - this.writelen = 0; - - this.bufferedRequest = null; - this.lastBufferedRequest = null; - - // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; - - // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - this.prefinished = false; - - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; - - // count buffered requests - this.bufferedRequestCount = 0; - - // allocate the first CorkedRequest, there is always - // one allocated and free to use, and we maintain at most two - this.corkedRequestsFree = new CorkedRequest(this); -} - -WritableState.prototype.getBuffer = function writableStateGetBuffer() { - var current = this.bufferedRequest; - var out = []; - while (current) { - out.push(current); - current = current.next; - } - return out; -}; - -(function () { - try { - Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function () { - return this.getBuffer(); - }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.') - }); - } catch (_) {} -})(); - -var Duplex; -function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); - - // Writable ctor is applied to Duplexes, though they're not - // instanceof Writable, they're instanceof Readable. - if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options); - - this._writableState = new WritableState(options, this); - - // legacy. - this.writable = true; - - if (options) { - if (typeof options.write === 'function') this._write = options.write; - - if (typeof options.writev === 'function') this._writev = options.writev; - } - - Stream.call(this); -} - -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function () { - this.emit('error', new Error('Cannot pipe, not readable')); -}; - -function writeAfterEnd(stream, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - processNextTick(cb, er); -} - -// If we get something that is not a buffer, string, null, or undefined, -// and we're not in objectMode, then that's an error. -// Otherwise stream chunks are all considered to be of length=1, and the -// watermarks determine how many objects to keep in the buffer, rather than -// how many bytes or characters. -function validChunk(stream, state, chunk, cb) { - var valid = true; - var er = false; - // Always throw error if a null is written - // if we are not in object mode then throw - // if it is not a buffer, string, or undefined. - if (chunk === null) { - er = new TypeError('May not write null values to stream'); - } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - if (er) { - stream.emit('error', er); - processNextTick(cb, er); - valid = false; - } - return valid; -} - -Writable.prototype.write = function (chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - - if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - - if (typeof cb !== 'function') cb = nop; - - if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, chunk, encoding, cb); - } - - return ret; -}; - -Writable.prototype.cork = function () { - var state = this._writableState; - - state.corked++; -}; - -Writable.prototype.uncork = function () { - var state = this._writableState; - - if (state.corked) { - state.corked--; - - if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); - } -}; - -Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = encoding.toLowerCase(); - if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); - this._writableState.defaultEncoding = encoding; - return this; -}; - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = bufferShim.from(chunk, encoding); - } - return chunk; -} - -// if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, chunk, encoding, cb) { - chunk = decodeChunk(state, chunk, encoding); - - if (Buffer.isBuffer(chunk)) encoding = 'buffer'; - var len = state.objectMode ? 1 : chunk.length; - - state.length += len; - - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) state.needDrain = true; - - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = new WriteReq(chunk, encoding, cb); - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); - } - - return ret; -} - -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} - -function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - if (sync) processNextTick(cb, er);else cb(er); - - stream._writableState.errorEmitted = true; - stream.emit('error', er); -} - -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} - -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - - onwriteStateUpdate(state); - - if (er) onwriteError(stream, state, sync, er, cb);else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state); - - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } - - if (sync) { - /**/ - asyncWrite(afterWrite, stream, state, finished, cb); - /**/ - } else { - afterWrite(stream, state, finished, cb); - } - } -} - -function afterWrite(stream, state, finished, cb) { - if (!finished) onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); -} - -// Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } -} - -// if there's something in the buffer waiting, then process it -function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - - if (stream._writev && entry && entry.next) { - // Fast case, write everything using _writev() - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - - var count = 0; - while (entry) { - buffer[count] = entry; - entry = entry.next; - count += 1; - } - - doWrite(stream, state, true, state.length, buffer, '', holder.finish); - - // doWrite is almost always async, defer these to save a bit of time - // as the hot path ends with doWrite - state.pendingcb++; - state.lastBufferedRequest = null; - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; - } else { - state.corkedRequestsFree = new CorkedRequest(state); - } - } else { - // Slow case, write chunks one-by-one - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - break; - } - } - - if (entry === null) state.lastBufferedRequest = null; - } - - state.bufferedRequestCount = 0; - state.bufferedRequest = entry; - state.bufferProcessing = false; -} - -Writable.prototype._write = function (chunk, encoding, cb) { - cb(new Error('not implemented')); -}; - -Writable.prototype._writev = null; - -Writable.prototype.end = function (chunk, encoding, cb) { - var state = this._writableState; - - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); - - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } - - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) endWritable(this, state, cb); -}; - -function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; -} - -function prefinish(stream, state) { - if (!state.prefinished) { - state.prefinished = true; - stream.emit('prefinish'); - } -} - -function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - if (state.pendingcb === 0) { - prefinish(stream, state); - state.finished = true; - stream.emit('finish'); - } else { - prefinish(stream, state); - } - } - return need; -} - -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) processNextTick(cb);else stream.once('finish', cb); - } - state.ended = true; - stream.writable = false; -} - -// It seems a linked list but it is not -// there will be only 2 of these for each stream -function CorkedRequest(state) { - var _this = this; - - this.next = null; - this.entry = null; - - this.finish = function (err) { - var entry = _this.entry; - _this.entry = null; - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - if (state.corkedRequestsFree) { - state.corkedRequestsFree.next = _this; - } else { - state.corkedRequestsFree = _this; - } - }; -} -}).call(this,require('_process')) -},{"./_stream_duplex":42,"_process":37,"buffer":5,"buffer-shims":4,"core-util-is":7,"events":8,"inherits":11,"process-nextick-args":36,"util-deprecate":57}],47:[function(require,module,exports){ -'use strict'; - -var Buffer = require('buffer').Buffer; -/**/ -var bufferShim = require('buffer-shims'); -/**/ - -module.exports = BufferList; - -function BufferList() { - this.head = null; - this.tail = null; - this.length = 0; -} - -BufferList.prototype.push = function (v) { - var entry = { data: v, next: null }; - if (this.length > 0) this.tail.next = entry;else this.head = entry; - this.tail = entry; - ++this.length; -}; - -BufferList.prototype.unshift = function (v) { - var entry = { data: v, next: this.head }; - if (this.length === 0) this.tail = entry; - this.head = entry; - ++this.length; -}; - -BufferList.prototype.shift = function () { - if (this.length === 0) return; - var ret = this.head.data; - if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; - --this.length; - return ret; -}; - -BufferList.prototype.clear = function () { - this.head = this.tail = null; - this.length = 0; -}; - -BufferList.prototype.join = function (s) { - if (this.length === 0) return ''; - var p = this.head; - var ret = '' + p.data; - while (p = p.next) { - ret += s + p.data; - }return ret; -}; - -BufferList.prototype.concat = function (n) { - if (this.length === 0) return bufferShim.alloc(0); - if (this.length === 1) return this.head.data; - var ret = bufferShim.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - while (p) { - p.data.copy(ret, i); - i += p.data.length; - p = p.next; - } - return ret; -}; -},{"buffer":5,"buffer-shims":4}],48:[function(require,module,exports){ -(function (process){ -var Stream = (function (){ - try { - return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify - } catch(_){} -}()); -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Stream = Stream || exports; -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); - -if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) { - module.exports = Stream; -} - -}).call(this,require('_process')) -},{"./lib/_stream_duplex.js":42,"./lib/_stream_passthrough.js":43,"./lib/_stream_readable.js":44,"./lib/_stream_transform.js":45,"./lib/_stream_writable.js":46,"_process":37}],49:[function(require,module,exports){ -(function (global){ -var ClientRequest = require('./lib/request') -var extend = require('xtend') -var statusCodes = require('builtin-status-codes') -var url = require('url') - -var http = exports - -http.request = function (opts, cb) { - if (typeof opts === 'string') - opts = url.parse(opts) - else - opts = extend(opts) - - // Normally, the page is loaded from http or https, so not specifying a protocol - // will result in a (valid) protocol-relative url. However, this won't work if - // the protocol is something else, like 'file:' - var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '' - - var protocol = opts.protocol || defaultProtocol - var host = opts.hostname || opts.host - var port = opts.port - var path = opts.path || '/' - - // Necessary for IPv6 addresses - if (host && host.indexOf(':') !== -1) - host = '[' + host + ']' - - // This may be a relative url. The browser should always be able to interpret it correctly. - opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path - opts.method = (opts.method || 'GET').toUpperCase() - opts.headers = opts.headers || {} - - // Also valid opts.auth, opts.mode - - var req = new ClientRequest(opts) - if (cb) - req.on('response', cb) - return req -} - -http.get = function get (opts, cb) { - var req = http.request(opts, cb) - req.end() - return req -} - -http.Agent = function () {} -http.Agent.defaultMaxSockets = 4 - -http.STATUS_CODES = statusCodes - -http.METHODS = [ - 'CHECKOUT', - 'CONNECT', - 'COPY', - 'DELETE', - 'GET', - 'HEAD', - 'LOCK', - 'M-SEARCH', - 'MERGE', - 'MKACTIVITY', - 'MKCOL', - 'MOVE', - 'NOTIFY', - 'OPTIONS', - 'PATCH', - 'POST', - 'PROPFIND', - 'PROPPATCH', - 'PURGE', - 'PUT', - 'REPORT', - 'SEARCH', - 'SUBSCRIBE', - 'TRACE', - 'UNLOCK', - 'UNSUBSCRIBE' -] -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./lib/request":51,"builtin-status-codes":6,"url":55,"xtend":58}],50:[function(require,module,exports){ -(function (global){ -exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream) - -exports.blobConstructor = false -try { - new Blob([new ArrayBuffer(1)]) - exports.blobConstructor = true -} catch (e) {} - -var xhr = new global.XMLHttpRequest() -// If location.host is empty, e.g. if this page/worker was loaded -// from a Blob, then use example.com to avoid an error -xhr.open('GET', global.location.host ? '/' : 'https://example.com') - -function checkTypeSupport (type) { - try { - xhr.responseType = type - return xhr.responseType === type - } catch (e) {} - return false -} - -// For some strange reason, Safari 7.0 reports typeof global.ArrayBuffer === 'object'. -// Safari 7.1 appears to have fixed this bug. -var haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined' -var haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice) - -exports.arraybuffer = haveArrayBuffer && checkTypeSupport('arraybuffer') -// These next two tests unavoidably show warnings in Chrome. Since fetch will always -// be used if it's available, just return false for these to avoid the warnings. -exports.msstream = !exports.fetch && haveSlice && checkTypeSupport('ms-stream') -exports.mozchunkedarraybuffer = !exports.fetch && haveArrayBuffer && - checkTypeSupport('moz-chunked-arraybuffer') -exports.overrideMimeType = isFunction(xhr.overrideMimeType) -exports.vbArray = isFunction(global.VBArray) - -function isFunction (value) { - return typeof value === 'function' -} - -xhr = null // Help gc - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],51:[function(require,module,exports){ -(function (process,global,Buffer){ -var capability = require('./capability') -var inherits = require('inherits') -var response = require('./response') -var stream = require('readable-stream') -var toArrayBuffer = require('to-arraybuffer') - -var IncomingMessage = response.IncomingMessage -var rStates = response.readyStates - -function decideMode (preferBinary, useFetch) { - if (capability.fetch && useFetch) { - return 'fetch' - } else if (capability.mozchunkedarraybuffer) { - return 'moz-chunked-arraybuffer' - } else if (capability.msstream) { - return 'ms-stream' - } else if (capability.arraybuffer && preferBinary) { - return 'arraybuffer' - } else if (capability.vbArray && preferBinary) { - return 'text:vbarray' - } else { - return 'text' - } -} - -var ClientRequest = module.exports = function (opts) { - var self = this - stream.Writable.call(self) - - self._opts = opts - self._body = [] - self._headers = {} - if (opts.auth) - self.setHeader('Authorization', 'Basic ' + new Buffer(opts.auth).toString('base64')) - Object.keys(opts.headers).forEach(function (name) { - self.setHeader(name, opts.headers[name]) - }) - - var preferBinary - var useFetch = true - if (opts.mode === 'disable-fetch') { - // If the use of XHR should be preferred and includes preserving the 'content-type' header - useFetch = false - preferBinary = true - } else if (opts.mode === 'prefer-streaming') { - // If streaming is a high priority but binary compatibility and - // the accuracy of the 'content-type' header aren't - preferBinary = false - } else if (opts.mode === 'allow-wrong-content-type') { - // If streaming is more important than preserving the 'content-type' header - preferBinary = !capability.overrideMimeType - } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') { - // Use binary if text streaming may corrupt data or the content-type header, or for speed - preferBinary = true - } else { - throw new Error('Invalid value for opts.mode') - } - self._mode = decideMode(preferBinary, useFetch) - - self.on('finish', function () { - self._onFinish() - }) -} - -inherits(ClientRequest, stream.Writable) - -ClientRequest.prototype.setHeader = function (name, value) { - var self = this - var lowerName = name.toLowerCase() - // This check is not necessary, but it prevents warnings from browsers about setting unsafe - // headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but - // http-browserify did it, so I will too. - if (unsafeHeaders.indexOf(lowerName) !== -1) - return - - self._headers[lowerName] = { - name: name, - value: value - } -} - -ClientRequest.prototype.getHeader = function (name) { - var self = this - return self._headers[name.toLowerCase()].value -} - -ClientRequest.prototype.removeHeader = function (name) { - var self = this - delete self._headers[name.toLowerCase()] -} - -ClientRequest.prototype._onFinish = function () { - var self = this - - if (self._destroyed) - return - var opts = self._opts - - var headersObj = self._headers - var body - if (opts.method === 'POST' || opts.method === 'PUT' || opts.method === 'PATCH') { - if (capability.blobConstructor) { - body = new global.Blob(self._body.map(function (buffer) { - return toArrayBuffer(buffer) - }), { - type: (headersObj['content-type'] || {}).value || '' - }) - } else { - // get utf8 string - body = Buffer.concat(self._body).toString() - } - } - - if (self._mode === 'fetch') { - var headers = Object.keys(headersObj).map(function (name) { - return [headersObj[name].name, headersObj[name].value] - }) - - global.fetch(self._opts.url, { - method: self._opts.method, - headers: headers, - body: body, - mode: 'cors', - credentials: opts.withCredentials ? 'include' : 'same-origin' - }).then(function (response) { - self._fetchResponse = response - self._connect() - }, function (reason) { - self.emit('error', reason) - }) - } else { - var xhr = self._xhr = new global.XMLHttpRequest() - try { - xhr.open(self._opts.method, self._opts.url, true) - } catch (err) { - process.nextTick(function () { - self.emit('error', err) - }) - return - } - - // Can't set responseType on really old browsers - if ('responseType' in xhr) - xhr.responseType = self._mode.split(':')[0] - - if ('withCredentials' in xhr) - xhr.withCredentials = !!opts.withCredentials - - if (self._mode === 'text' && 'overrideMimeType' in xhr) - xhr.overrideMimeType('text/plain; charset=x-user-defined') - - Object.keys(headersObj).forEach(function (name) { - xhr.setRequestHeader(headersObj[name].name, headersObj[name].value) - }) - - self._response = null - xhr.onreadystatechange = function () { - switch (xhr.readyState) { - case rStates.LOADING: - case rStates.DONE: - self._onXHRProgress() - break - } - } - // Necessary for streaming in Firefox, since xhr.response is ONLY defined - // in onprogress, not in onreadystatechange with xhr.readyState = 3 - if (self._mode === 'moz-chunked-arraybuffer') { - xhr.onprogress = function () { - self._onXHRProgress() - } - } - - xhr.onerror = function () { - if (self._destroyed) - return - self.emit('error', new Error('XHR error')) - } - - try { - xhr.send(body) - } catch (err) { - process.nextTick(function () { - self.emit('error', err) - }) - return - } - } -} - -/** - * Checks if xhr.status is readable and non-zero, indicating no error. - * Even though the spec says it should be available in readyState 3, - * accessing it throws an exception in IE8 - */ -function statusValid (xhr) { - try { - var status = xhr.status - return (status !== null && status !== 0) - } catch (e) { - return false - } -} - -ClientRequest.prototype._onXHRProgress = function () { - var self = this - - if (!statusValid(self._xhr) || self._destroyed) - return - - if (!self._response) - self._connect() - - self._response._onXHRProgress() -} - -ClientRequest.prototype._connect = function () { - var self = this - - if (self._destroyed) - return - - self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode) - self.emit('response', self._response) -} - -ClientRequest.prototype._write = function (chunk, encoding, cb) { - var self = this - - self._body.push(chunk) - cb() -} - -ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () { - var self = this - self._destroyed = true - if (self._response) - self._response._destroyed = true - if (self._xhr) - self._xhr.abort() - // Currently, there isn't a way to truly abort a fetch. - // If you like bikeshedding, see https://github.com/whatwg/fetch/issues/27 -} - -ClientRequest.prototype.end = function (data, encoding, cb) { - var self = this - if (typeof data === 'function') { - cb = data - data = undefined - } - - stream.Writable.prototype.end.call(self, data, encoding, cb) -} - -ClientRequest.prototype.flushHeaders = function () {} -ClientRequest.prototype.setTimeout = function () {} -ClientRequest.prototype.setNoDelay = function () {} -ClientRequest.prototype.setSocketKeepAlive = function () {} - -// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method -var unsafeHeaders = [ - 'accept-charset', - 'accept-encoding', - 'access-control-request-headers', - 'access-control-request-method', - 'connection', - 'content-length', - 'cookie', - 'cookie2', - 'date', - 'dnt', - 'expect', - 'host', - 'keep-alive', - 'origin', - 'referer', - 'te', - 'trailer', - 'transfer-encoding', - 'upgrade', - 'user-agent', - 'via' -] - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./capability":50,"./response":52,"_process":37,"buffer":5,"inherits":11,"readable-stream":48,"to-arraybuffer":54}],52:[function(require,module,exports){ -(function (process,global,Buffer){ -var capability = require('./capability') -var inherits = require('inherits') -var stream = require('readable-stream') - -var rStates = exports.readyStates = { - UNSENT: 0, - OPENED: 1, - HEADERS_RECEIVED: 2, - LOADING: 3, - DONE: 4 -} - -var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode) { - var self = this - stream.Readable.call(self) - - self._mode = mode - self.headers = {} - self.rawHeaders = [] - self.trailers = {} - self.rawTrailers = [] - - // Fake the 'close' event, but only once 'end' fires - self.on('end', function () { - // The nextTick is necessary to prevent the 'request' module from causing an infinite loop - process.nextTick(function () { - self.emit('close') - }) - }) - - if (mode === 'fetch') { - self._fetchResponse = response - - self.url = response.url - self.statusCode = response.status - self.statusMessage = response.statusText - // backwards compatible version of for ( of ): - // for (var ,_i,_it = [Symbol.iterator](); = (_i = _it.next()).value,!_i.done;) - for (var header, _i, _it = response.headers[Symbol.iterator](); header = (_i = _it.next()).value, !_i.done;) { - self.headers[header[0].toLowerCase()] = header[1] - self.rawHeaders.push(header[0], header[1]) - } - - // TODO: this doesn't respect backpressure. Once WritableStream is available, this can be fixed - var reader = response.body.getReader() - function read () { - reader.read().then(function (result) { - if (self._destroyed) - return - if (result.done) { - self.push(null) - return - } - self.push(new Buffer(result.value)) - read() - }) - } - read() - - } else { - self._xhr = xhr - self._pos = 0 - - self.url = xhr.responseURL - self.statusCode = xhr.status - self.statusMessage = xhr.statusText - var headers = xhr.getAllResponseHeaders().split(/\r?\n/) - headers.forEach(function (header) { - var matches = header.match(/^([^:]+):\s*(.*)/) - if (matches) { - var key = matches[1].toLowerCase() - if (key === 'set-cookie') { - if (self.headers[key] === undefined) { - self.headers[key] = [] - } - self.headers[key].push(matches[2]) - } else if (self.headers[key] !== undefined) { - self.headers[key] += ', ' + matches[2] - } else { - self.headers[key] = matches[2] - } - self.rawHeaders.push(matches[1], matches[2]) - } - }) - - self._charset = 'x-user-defined' - if (!capability.overrideMimeType) { - var mimeType = self.rawHeaders['mime-type'] - if (mimeType) { - var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/) - if (charsetMatch) { - self._charset = charsetMatch[1].toLowerCase() - } - } - if (!self._charset) - self._charset = 'utf-8' // best guess - } - } -} - -inherits(IncomingMessage, stream.Readable) - -IncomingMessage.prototype._read = function () {} - -IncomingMessage.prototype._onXHRProgress = function () { - var self = this - - var xhr = self._xhr - - var response = null - switch (self._mode) { - case 'text:vbarray': // For IE9 - if (xhr.readyState !== rStates.DONE) - break - try { - // This fails in IE8 - response = new global.VBArray(xhr.responseBody).toArray() - } catch (e) {} - if (response !== null) { - self.push(new Buffer(response)) - break - } - // Falls through in IE8 - case 'text': - try { // This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4 - response = xhr.responseText - } catch (e) { - self._mode = 'text:vbarray' - break - } - if (response.length > self._pos) { - var newData = response.substr(self._pos) - if (self._charset === 'x-user-defined') { - var buffer = new Buffer(newData.length) - for (var i = 0; i < newData.length; i++) - buffer[i] = newData.charCodeAt(i) & 0xff - - self.push(buffer) - } else { - self.push(newData, self._charset) - } - self._pos = response.length - } - break - case 'arraybuffer': - if (xhr.readyState !== rStates.DONE || !xhr.response) - break - response = xhr.response - self.push(new Buffer(new Uint8Array(response))) - break - case 'moz-chunked-arraybuffer': // take whole - response = xhr.response - if (xhr.readyState !== rStates.LOADING || !response) - break - self.push(new Buffer(new Uint8Array(response))) - break - case 'ms-stream': - response = xhr.response - if (xhr.readyState !== rStates.LOADING) - break - var reader = new global.MSStreamReader() - reader.onprogress = function () { - if (reader.result.byteLength > self._pos) { - self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos)))) - self._pos = reader.result.byteLength - } - } - reader.onload = function () { - self.push(null) - } - // reader.onerror = ??? // TODO: this - reader.readAsArrayBuffer(response) - break - } - - // The ms-stream case handles end separately in reader.onload() - if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') { - self.push(null) - } -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./capability":50,"_process":37,"buffer":5,"inherits":11,"readable-stream":48}],53:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var Buffer = require('buffer').Buffer; - -var isBufferEncoding = Buffer.isEncoding - || function(encoding) { - switch (encoding && encoding.toLowerCase()) { - case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; - default: return false; - } - } - - -function assertEncoding(encoding) { - if (encoding && !isBufferEncoding(encoding)) { - throw new Error('Unknown encoding: ' + encoding); - } -} - -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. CESU-8 is handled as part of the UTF-8 encoding. -// -// @TODO Handling all encodings inside a single object makes it very difficult -// to reason about this code, so it should be split up in the future. -// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code -// points as used by CESU-8. -var StringDecoder = exports.StringDecoder = function(encoding) { - this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); - assertEncoding(encoding); - switch (this.encoding) { - case 'utf8': - // CESU-8 represents each of Surrogate Pair by 3-bytes - this.surrogateSize = 3; - break; - case 'ucs2': - case 'utf16le': - // UTF-16 represents each of Surrogate Pair by 2-bytes - this.surrogateSize = 2; - this.detectIncompleteChar = utf16DetectIncompleteChar; - break; - case 'base64': - // Base-64 stores 3 bytes in 4 chars, and pads the remainder. - this.surrogateSize = 3; - this.detectIncompleteChar = base64DetectIncompleteChar; - break; - default: - this.write = passThroughWrite; - return; - } - - // Enough space to store all bytes of a single character. UTF-8 needs 4 - // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). - this.charBuffer = new Buffer(6); - // Number of bytes received for the current incomplete multi-byte character. - this.charReceived = 0; - // Number of bytes expected for the current incomplete multi-byte character. - this.charLength = 0; -}; - - -// write decodes the given buffer and returns it as JS string that is -// guaranteed to not contain any partial multi-byte characters. Any partial -// character found at the end of the buffer is buffered up, and will be -// returned when calling write again with the remaining bytes. -// -// Note: Converting a Buffer containing an orphan surrogate to a String -// currently works, but converting a String to a Buffer (via `new Buffer`, or -// Buffer#write) will replace incomplete surrogates with the unicode -// replacement character. See https://codereview.chromium.org/121173009/ . -StringDecoder.prototype.write = function(buffer) { - var charStr = ''; - // if our last write ended with an incomplete multibyte character - while (this.charLength) { - // determine how many remaining bytes this buffer has to offer for this char - var available = (buffer.length >= this.charLength - this.charReceived) ? - this.charLength - this.charReceived : - buffer.length; - - // add the new bytes to the char buffer - buffer.copy(this.charBuffer, this.charReceived, 0, available); - this.charReceived += available; - - if (this.charReceived < this.charLength) { - // still not enough chars in this buffer? wait for more ... - return ''; - } - - // remove bytes belonging to the current character from the buffer - buffer = buffer.slice(available, buffer.length); - - // get the character that was split - charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); - - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - var charCode = charStr.charCodeAt(charStr.length - 1); - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - this.charLength += this.surrogateSize; - charStr = ''; - continue; - } - this.charReceived = this.charLength = 0; - - // if there are no more bytes in this buffer, just emit our char - if (buffer.length === 0) { - return charStr; - } - break; - } - - // determine and set charLength / charReceived - this.detectIncompleteChar(buffer); - - var end = buffer.length; - if (this.charLength) { - // buffer the incomplete character bytes we got - buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); - end -= this.charReceived; - } - - charStr += buffer.toString(this.encoding, 0, end); - - var end = charStr.length - 1; - var charCode = charStr.charCodeAt(end); - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - var size = this.surrogateSize; - this.charLength += size; - this.charReceived += size; - this.charBuffer.copy(this.charBuffer, size, 0, size); - buffer.copy(this.charBuffer, 0, 0, size); - return charStr.substring(0, end); - } - - // or just emit the charStr - return charStr; -}; - -// detectIncompleteChar determines if there is an incomplete UTF-8 character at -// the end of the given buffer. If so, it sets this.charLength to the byte -// length that character, and sets this.charReceived to the number of bytes -// that are available for this character. -StringDecoder.prototype.detectIncompleteChar = function(buffer) { - // determine how many bytes we have to check at the end of this buffer - var i = (buffer.length >= 3) ? 3 : buffer.length; - - // Figure out if one of the last i bytes of our buffer announces an - // incomplete char. - for (; i > 0; i--) { - var c = buffer[buffer.length - i]; - - // See http://en.wikipedia.org/wiki/UTF-8#Description - - // 110XXXXX - if (i == 1 && c >> 5 == 0x06) { - this.charLength = 2; - break; - } - - // 1110XXXX - if (i <= 2 && c >> 4 == 0x0E) { - this.charLength = 3; - break; - } - - // 11110XXX - if (i <= 3 && c >> 3 == 0x1E) { - this.charLength = 4; - break; - } - } - this.charReceived = i; -}; - -StringDecoder.prototype.end = function(buffer) { - var res = ''; - if (buffer && buffer.length) - res = this.write(buffer); - - if (this.charReceived) { - var cr = this.charReceived; - var buf = this.charBuffer; - var enc = this.encoding; - res += buf.slice(0, cr).toString(enc); - } - - return res; -}; - -function passThroughWrite(buffer) { - return buffer.toString(this.encoding); -} - -function utf16DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 2; - this.charLength = this.charReceived ? 2 : 0; -} - -function base64DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 3; - this.charLength = this.charReceived ? 3 : 0; -} - -},{"buffer":5}],54:[function(require,module,exports){ -var Buffer = require('buffer').Buffer - -module.exports = function (buf) { - // If the buffer is backed by a Uint8Array, a faster version will work - if (buf instanceof Uint8Array) { - // If the buffer isn't a subarray, return the underlying ArrayBuffer - if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) { - return buf.buffer - } else if (typeof buf.buffer.slice === 'function') { - // Otherwise we need to get a proper copy - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength) - } - } - - if (Buffer.isBuffer(buf)) { - // This is the slow version that will work with any Buffer - // implementation (even in old browsers) - var arrayCopy = new Uint8Array(buf.length) - var len = buf.length - for (var i = 0; i < len; i++) { - arrayCopy[i] = buf[i] - } - return arrayCopy.buffer - } else { - throw new Error('Argument must be a Buffer') - } -} - -},{"buffer":5}],55:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -var punycode = require('punycode'); -var util = require('./util'); - -exports.parse = urlParse; -exports.resolve = urlResolve; -exports.resolveObject = urlResolveObject; -exports.format = urlFormat; - -exports.Url = Url; - -function Url() { - this.protocol = null; - this.slashes = null; - this.auth = null; - this.host = null; - this.port = null; - this.hostname = null; - this.hash = null; - this.search = null; - this.query = null; - this.pathname = null; - this.path = null; - this.href = null; -} - -// Reference: RFC 3986, RFC 1808, RFC 2396 - -// define these here so at least they only have to be -// compiled once on the first module load. -var protocolPattern = /^([a-z0-9.+-]+:)/i, - portPattern = /:[0-9]*$/, - - // Special case for a simple path URL - simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, - - // RFC 2396: characters reserved for delimiting URLs. - // We actually just auto-escape these. - delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], - - // RFC 2396: characters not allowed for various reasons. - unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), - - // Allowed by RFCs, but cause of XSS attacks. Always escape these. - autoEscape = ['\''].concat(unwise), - // Characters that are never ever allowed in a hostname. - // Note that any invalid chars are also handled, but these - // are the ones that are *expected* to be seen, so we fast-path - // them. - nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), - hostEndingChars = ['/', '?', '#'], - hostnameMaxLen = 255, - hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, - hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, - // protocols that can allow "unsafe" and "unwise" chars. - unsafeProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that never have a hostname. - hostlessProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that always contain a // bit. - slashedProtocol = { - 'http': true, - 'https': true, - 'ftp': true, - 'gopher': true, - 'file': true, - 'http:': true, - 'https:': true, - 'ftp:': true, - 'gopher:': true, - 'file:': true - }, - querystring = require('querystring'); - -function urlParse(url, parseQueryString, slashesDenoteHost) { - if (url && util.isObject(url) && url instanceof Url) return url; - - var u = new Url; - u.parse(url, parseQueryString, slashesDenoteHost); - return u; -} - -Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { - if (!util.isString(url)) { - throw new TypeError("Parameter 'url' must be a string, not " + typeof url); - } - - // Copy chrome, IE, opera backslash-handling behavior. - // Back slashes before the query string get converted to forward slashes - // See: https://code.google.com/p/chromium/issues/detail?id=25916 - var queryIndex = url.indexOf('?'), - splitter = - (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', - uSplit = url.split(splitter), - slashRegex = /\\/g; - uSplit[0] = uSplit[0].replace(slashRegex, '/'); - url = uSplit.join(splitter); - - var rest = url; - - // trim before proceeding. - // This is to support parse stuff like " http://foo.com \n" - rest = rest.trim(); - - if (!slashesDenoteHost && url.split('#').length === 1) { - // Try fast path regexp - var simplePath = simplePathPattern.exec(rest); - if (simplePath) { - this.path = rest; - this.href = rest; - this.pathname = simplePath[1]; - if (simplePath[2]) { - this.search = simplePath[2]; - if (parseQueryString) { - this.query = querystring.parse(this.search.substr(1)); - } else { - this.query = this.search.substr(1); - } - } else if (parseQueryString) { - this.search = ''; - this.query = {}; - } - return this; - } - } - - var proto = protocolPattern.exec(rest); - if (proto) { - proto = proto[0]; - var lowerProto = proto.toLowerCase(); - this.protocol = lowerProto; - rest = rest.substr(proto.length); - } - - // figure out if it's got a host - // user@server is *always* interpreted as a hostname, and url - // resolution will treat //foo/bar as host=foo,path=bar because that's - // how the browser resolves relative URLs. - if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { - var slashes = rest.substr(0, 2) === '//'; - if (slashes && !(proto && hostlessProtocol[proto])) { - rest = rest.substr(2); - this.slashes = true; - } - } - - if (!hostlessProtocol[proto] && - (slashes || (proto && !slashedProtocol[proto]))) { - - // there's a hostname. - // the first instance of /, ?, ;, or # ends the host. - // - // If there is an @ in the hostname, then non-host chars *are* allowed - // to the left of the last @ sign, unless some host-ending character - // comes *before* the @-sign. - // URLs are obnoxious. - // - // ex: - // http://a@b@c/ => user:a@b host:c - // http://a@b?@c => user:a host:c path:/?@c - - // v0.12 TODO(isaacs): This is not quite how Chrome does things. - // Review our test case against browsers more comprehensively. - - // find the first instance of any hostEndingChars - var hostEnd = -1; - for (var i = 0; i < hostEndingChars.length; i++) { - var hec = rest.indexOf(hostEndingChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - hostEnd = hec; - } - - // at this point, either we have an explicit point where the - // auth portion cannot go past, or the last @ char is the decider. - var auth, atSign; - if (hostEnd === -1) { - // atSign can be anywhere. - atSign = rest.lastIndexOf('@'); - } else { - // atSign must be in auth portion. - // http://a@b/c@d => host:b auth:a path:/c@d - atSign = rest.lastIndexOf('@', hostEnd); - } - - // Now we have a portion which is definitely the auth. - // Pull that off. - if (atSign !== -1) { - auth = rest.slice(0, atSign); - rest = rest.slice(atSign + 1); - this.auth = decodeURIComponent(auth); - } - - // the host is the remaining to the left of the first non-host char - hostEnd = -1; - for (var i = 0; i < nonHostChars.length; i++) { - var hec = rest.indexOf(nonHostChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - hostEnd = hec; - } - // if we still have not hit it, then the entire thing is a host. - if (hostEnd === -1) - hostEnd = rest.length; - - this.host = rest.slice(0, hostEnd); - rest = rest.slice(hostEnd); - - // pull out port. - this.parseHost(); - - // we've indicated that there is a hostname, - // so even if it's empty, it has to be present. - this.hostname = this.hostname || ''; - - // if hostname begins with [ and ends with ] - // assume that it's an IPv6 address. - var ipv6Hostname = this.hostname[0] === '[' && - this.hostname[this.hostname.length - 1] === ']'; - - // validate a little. - if (!ipv6Hostname) { - var hostparts = this.hostname.split(/\./); - for (var i = 0, l = hostparts.length; i < l; i++) { - var part = hostparts[i]; - if (!part) continue; - if (!part.match(hostnamePartPattern)) { - var newpart = ''; - for (var j = 0, k = part.length; j < k; j++) { - if (part.charCodeAt(j) > 127) { - // we replace non-ASCII char with a temporary placeholder - // we need this to make sure size of hostname is not - // broken by replacing non-ASCII by nothing - newpart += 'x'; - } else { - newpart += part[j]; - } - } - // we test again with ASCII char only - if (!newpart.match(hostnamePartPattern)) { - var validParts = hostparts.slice(0, i); - var notHost = hostparts.slice(i + 1); - var bit = part.match(hostnamePartStart); - if (bit) { - validParts.push(bit[1]); - notHost.unshift(bit[2]); - } - if (notHost.length) { - rest = '/' + notHost.join('.') + rest; - } - this.hostname = validParts.join('.'); - break; - } - } - } - } - - if (this.hostname.length > hostnameMaxLen) { - this.hostname = ''; - } else { - // hostnames are always lower case. - this.hostname = this.hostname.toLowerCase(); - } - - if (!ipv6Hostname) { - // IDNA Support: Returns a punycoded representation of "domain". - // It only converts parts of the domain name that - // have non-ASCII characters, i.e. it doesn't matter if - // you call it with a domain that already is ASCII-only. - this.hostname = punycode.toASCII(this.hostname); - } - - var p = this.port ? ':' + this.port : ''; - var h = this.hostname || ''; - this.host = h + p; - this.href += this.host; - - // strip [ and ] from the hostname - // the host field still retains them, though - if (ipv6Hostname) { - this.hostname = this.hostname.substr(1, this.hostname.length - 2); - if (rest[0] !== '/') { - rest = '/' + rest; - } - } - } - - // now rest is set to the post-host stuff. - // chop off any delim chars. - if (!unsafeProtocol[lowerProto]) { - - // First, make 100% sure that any "autoEscape" chars get - // escaped, even if encodeURIComponent doesn't think they - // need to be. - for (var i = 0, l = autoEscape.length; i < l; i++) { - var ae = autoEscape[i]; - if (rest.indexOf(ae) === -1) - continue; - var esc = encodeURIComponent(ae); - if (esc === ae) { - esc = escape(ae); - } - rest = rest.split(ae).join(esc); - } - } - - - // chop off from the tail first. - var hash = rest.indexOf('#'); - if (hash !== -1) { - // got a fragment string. - this.hash = rest.substr(hash); - rest = rest.slice(0, hash); - } - var qm = rest.indexOf('?'); - if (qm !== -1) { - this.search = rest.substr(qm); - this.query = rest.substr(qm + 1); - if (parseQueryString) { - this.query = querystring.parse(this.query); - } - rest = rest.slice(0, qm); - } else if (parseQueryString) { - // no query string, but parseQueryString still requested - this.search = ''; - this.query = {}; - } - if (rest) this.pathname = rest; - if (slashedProtocol[lowerProto] && - this.hostname && !this.pathname) { - this.pathname = '/'; - } - - //to support http.request - if (this.pathname || this.search) { - var p = this.pathname || ''; - var s = this.search || ''; - this.path = p + s; - } - - // finally, reconstruct the href based on what has been validated. - this.href = this.format(); - return this; -}; - -// format a parsed object into a url string -function urlFormat(obj) { - // ensure it's an object, and not a string url. - // If it's an obj, this is a no-op. - // this way, you can call url_format() on strings - // to clean up potentially wonky urls. - if (util.isString(obj)) obj = urlParse(obj); - if (!(obj instanceof Url)) return Url.prototype.format.call(obj); - return obj.format(); -} - -Url.prototype.format = function() { - var auth = this.auth || ''; - if (auth) { - auth = encodeURIComponent(auth); - auth = auth.replace(/%3A/i, ':'); - auth += '@'; - } - - var protocol = this.protocol || '', - pathname = this.pathname || '', - hash = this.hash || '', - host = false, - query = ''; - - if (this.host) { - host = auth + this.host; - } else if (this.hostname) { - host = auth + (this.hostname.indexOf(':') === -1 ? - this.hostname : - '[' + this.hostname + ']'); - if (this.port) { - host += ':' + this.port; - } - } - - if (this.query && - util.isObject(this.query) && - Object.keys(this.query).length) { - query = querystring.stringify(this.query); - } - - var search = this.search || (query && ('?' + query)) || ''; - - if (protocol && protocol.substr(-1) !== ':') protocol += ':'; - - // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. - // unless they had them to begin with. - if (this.slashes || - (!protocol || slashedProtocol[protocol]) && host !== false) { - host = '//' + (host || ''); - if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; - } else if (!host) { - host = ''; - } - - if (hash && hash.charAt(0) !== '#') hash = '#' + hash; - if (search && search.charAt(0) !== '?') search = '?' + search; - - pathname = pathname.replace(/[?#]/g, function(match) { - return encodeURIComponent(match); - }); - search = search.replace('#', '%23'); - - return protocol + host + pathname + search + hash; -}; - -function urlResolve(source, relative) { - return urlParse(source, false, true).resolve(relative); -} - -Url.prototype.resolve = function(relative) { - return this.resolveObject(urlParse(relative, false, true)).format(); -}; - -function urlResolveObject(source, relative) { - if (!source) return relative; - return urlParse(source, false, true).resolveObject(relative); -} - -Url.prototype.resolveObject = function(relative) { - if (util.isString(relative)) { - var rel = new Url(); - rel.parse(relative, false, true); - relative = rel; - } - - var result = new Url(); - var tkeys = Object.keys(this); - for (var tk = 0; tk < tkeys.length; tk++) { - var tkey = tkeys[tk]; - result[tkey] = this[tkey]; - } - - // hash is always overridden, no matter what. - // even href="" will remove it. - result.hash = relative.hash; - - // if the relative url is empty, then there's nothing left to do here. - if (relative.href === '') { - result.href = result.format(); - return result; - } - - // hrefs like //foo/bar always cut to the protocol. - if (relative.slashes && !relative.protocol) { - // take everything except the protocol from relative - var rkeys = Object.keys(relative); - for (var rk = 0; rk < rkeys.length; rk++) { - var rkey = rkeys[rk]; - if (rkey !== 'protocol') - result[rkey] = relative[rkey]; - } - - //urlParse appends trailing / to urls like http://www.example.com - if (slashedProtocol[result.protocol] && - result.hostname && !result.pathname) { - result.path = result.pathname = '/'; - } - - result.href = result.format(); - return result; - } - - if (relative.protocol && relative.protocol !== result.protocol) { - // if it's a known url protocol, then changing - // the protocol does weird things - // first, if it's not file:, then we MUST have a host, - // and if there was a path - // to begin with, then we MUST have a path. - // if it is file:, then the host is dropped, - // because that's known to be hostless. - // anything else is assumed to be absolute. - if (!slashedProtocol[relative.protocol]) { - var keys = Object.keys(relative); - for (var v = 0; v < keys.length; v++) { - var k = keys[v]; - result[k] = relative[k]; - } - result.href = result.format(); - return result; - } - - result.protocol = relative.protocol; - if (!relative.host && !hostlessProtocol[relative.protocol]) { - var relPath = (relative.pathname || '').split('/'); - while (relPath.length && !(relative.host = relPath.shift())); - if (!relative.host) relative.host = ''; - if (!relative.hostname) relative.hostname = ''; - if (relPath[0] !== '') relPath.unshift(''); - if (relPath.length < 2) relPath.unshift(''); - result.pathname = relPath.join('/'); - } else { - result.pathname = relative.pathname; - } - result.search = relative.search; - result.query = relative.query; - result.host = relative.host || ''; - result.auth = relative.auth; - result.hostname = relative.hostname || relative.host; - result.port = relative.port; - // to support http.request - if (result.pathname || result.search) { - var p = result.pathname || ''; - var s = result.search || ''; - result.path = p + s; - } - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; - } - - var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), - isRelAbs = ( - relative.host || - relative.pathname && relative.pathname.charAt(0) === '/' - ), - mustEndAbs = (isRelAbs || isSourceAbs || - (result.host && relative.pathname)), - removeAllDots = mustEndAbs, - srcPath = result.pathname && result.pathname.split('/') || [], - relPath = relative.pathname && relative.pathname.split('/') || [], - psychotic = result.protocol && !slashedProtocol[result.protocol]; - - // if the url is a non-slashed url, then relative - // links like ../.. should be able - // to crawl up to the hostname, as well. This is strange. - // result.protocol has already been set by now. - // Later on, put the first path part into the host field. - if (psychotic) { - result.hostname = ''; - result.port = null; - if (result.host) { - if (srcPath[0] === '') srcPath[0] = result.host; - else srcPath.unshift(result.host); - } - result.host = ''; - if (relative.protocol) { - relative.hostname = null; - relative.port = null; - if (relative.host) { - if (relPath[0] === '') relPath[0] = relative.host; - else relPath.unshift(relative.host); - } - relative.host = null; - } - mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); - } - - if (isRelAbs) { - // it's absolute. - result.host = (relative.host || relative.host === '') ? - relative.host : result.host; - result.hostname = (relative.hostname || relative.hostname === '') ? - relative.hostname : result.hostname; - result.search = relative.search; - result.query = relative.query; - srcPath = relPath; - // fall through to the dot-handling below. - } else if (relPath.length) { - // it's relative - // throw away the existing file, and take the new path instead. - if (!srcPath) srcPath = []; - srcPath.pop(); - srcPath = srcPath.concat(relPath); - result.search = relative.search; - result.query = relative.query; - } else if (!util.isNullOrUndefined(relative.search)) { - // just pull out the search. - // like href='?foo'. - // Put this after the other two cases because it simplifies the booleans - if (psychotic) { - result.hostname = result.host = srcPath.shift(); - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - result.search = relative.search; - result.query = relative.query; - //to support http.request - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.href = result.format(); - return result; - } - - if (!srcPath.length) { - // no path at all. easy. - // we've already handled the other stuff above. - result.pathname = null; - //to support http.request - if (result.search) { - result.path = '/' + result.search; - } else { - result.path = null; - } - result.href = result.format(); - return result; - } - - // if a url ENDs in . or .., then it must get a trailing slash. - // however, if it ends in anything else non-slashy, - // then it must NOT get a trailing slash. - var last = srcPath.slice(-1)[0]; - var hasTrailingSlash = ( - (result.host || relative.host || srcPath.length > 1) && - (last === '.' || last === '..') || last === ''); - - // strip single dots, resolve double dots to parent dir - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = srcPath.length; i >= 0; i--) { - last = srcPath[i]; - if (last === '.') { - srcPath.splice(i, 1); - } else if (last === '..') { - srcPath.splice(i, 1); - up++; - } else if (up) { - srcPath.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (!mustEndAbs && !removeAllDots) { - for (; up--; up) { - srcPath.unshift('..'); - } - } - - if (mustEndAbs && srcPath[0] !== '' && - (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { - srcPath.unshift(''); - } - - if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { - srcPath.push(''); - } - - var isAbsolute = srcPath[0] === '' || - (srcPath[0] && srcPath[0].charAt(0) === '/'); - - // put the host back - if (psychotic) { - result.hostname = result.host = isAbsolute ? '' : - srcPath.length ? srcPath.shift() : ''; - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - - mustEndAbs = mustEndAbs || (result.host && srcPath.length); - - if (mustEndAbs && !isAbsolute) { - srcPath.unshift(''); - } - - if (!srcPath.length) { - result.pathname = null; - result.path = null; - } else { - result.pathname = srcPath.join('/'); - } - - //to support request.http - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.auth = relative.auth || result.auth; - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; -}; - -Url.prototype.parseHost = function() { - var host = this.host; - var port = portPattern.exec(host); - if (port) { - port = port[0]; - if (port !== ':') { - this.port = port.substr(1); - } - host = host.substr(0, host.length - port.length); - } - if (host) this.hostname = host; -}; - -},{"./util":56,"punycode":38,"querystring":41}],56:[function(require,module,exports){ -'use strict'; - -module.exports = { - isString: function(arg) { - return typeof(arg) === 'string'; - }, - isObject: function(arg) { - return typeof(arg) === 'object' && arg !== null; - }, - isNull: function(arg) { - return arg === null; - }, - isNullOrUndefined: function(arg) { - return arg == null; - } -}; - -},{}],57:[function(require,module,exports){ -(function (global){ - -/** - * Module exports. - */ - -module.exports = deprecate; - -/** - * Mark that a method should not be used. - * Returns a modified function which warns once by default. - * - * If `localStorage.noDeprecation = true` is set, then it is a no-op. - * - * If `localStorage.throwDeprecation = true` is set, then deprecated functions - * will throw an Error when invoked. - * - * If `localStorage.traceDeprecation = true` is set, then deprecated functions - * will invoke `console.trace()` instead of `console.error()`. - * - * @param {Function} fn - the function to deprecate - * @param {String} msg - the string to print to the console when `fn` is invoked - * @returns {Function} a new "deprecated" version of `fn` - * @api public - */ - -function deprecate (fn, msg) { - if (config('noDeprecation')) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (config('throwDeprecation')) { - throw new Error(msg); - } else if (config('traceDeprecation')) { - console.trace(msg); - } else { - console.warn(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -} - -/** - * Checks `localStorage` for boolean values for the given `name`. - * - * @param {String} name - * @returns {Boolean} - * @api private - */ - -function config (name) { - // accessing global.localStorage can trigger a DOMException in sandboxed iframes - try { - if (!global.localStorage) return false; - } catch (_) { - return false; - } - var val = global.localStorage[name]; - if (null == val) return false; - return String(val).toLowerCase() === 'true'; -} - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],58:[function(require,module,exports){ -module.exports = extend - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -function extend() { - var target = {} - - for (var i = 0; i < arguments.length; i++) { - var source = arguments[i] - - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - target[key] = source[key] - } - } - } - - return target -} - -},{}]},{},[1])(1) -}); -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.manifold = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o -/// - -var Manifold; -(function (Manifold) { - var Bootstrapper = (function () { - function Bootstrapper(options) { - this._options = options; - this._options.locale = this._options.locale || 'en-GB'; // default locale - } - Bootstrapper.prototype.bootstrap = function () { - var that = this; - return new Promise(function (resolve, reject) { - var msie = that._msieversion(); - // if not a recent version of IE - if (msie > 0 && msie < 11) { - if (msie === 9) { - // CORS not available, use jsonp - var settings = { - url: that._options.iiifResourceUri, - type: 'GET', - dataType: 'jsonp', - jsonp: 'callback', - jsonpCallback: 'manifestCallback' - }; - $.ajax(settings); - window.manifestCallback = function (json) { - that._loaded(that, JSON.stringify(json), resolve, reject); - }; - } - else if (msie === 10) { - $.getJSON(that._options.iiifResourceUri, function (json) { - that._loaded(that, JSON.stringify(json), resolve, reject); - }); - } - } - else { - manifesto.loadManifest(that._options.iiifResourceUri).then(function (json) { - that._loaded(that, json, resolve, reject); - }); - } - }); - }; - Bootstrapper.prototype._loaded = function (bootstrapper, json, resolve, reject) { - var iiifResource = manifesto.create(json, { - locale: bootstrapper._options.locale - }); - // only set the root IIIFResource on the first load - if (!bootstrapper._options.iiifResource) { - bootstrapper._options.iiifResource = iiifResource; - } - if (iiifResource.getIIIFResourceType().toString() === manifesto.IIIFResourceType.collection().toString()) { - // if it's a collection and has child collections, get the collection by index - var collections = iiifResource.getCollections(); - if (collections && collections.length) { - iiifResource.getCollectionByIndex(bootstrapper._options.collectionIndex).then(function (collection) { - if (!collection) { - reject('Collection index not found'); - } - // Special case: we're trying to load the first manifest of the - // collection, but the collection has no manifests but does have - // subcollections. Thus, we should dive in until we find something - // we can display! - if (collection.getTotalManifests() === 0 && bootstrapper._options.manifestIndex === 0 && collection.getTotalCollections() > 0) { - bootstrapper._options.collectionIndex = 0; - bootstrapper._options.iiifResourceUri = collection.id; - bootstrapper.bootstrap(); - } - collection.getManifestByIndex(bootstrapper._options.manifestIndex).then(function (manifest) { - bootstrapper._options.manifest = manifest; - var helper = new Manifold.Helper(bootstrapper._options); - resolve(helper); - }); - }); - } - else { - iiifResource.getManifestByIndex(bootstrapper._options.manifestIndex).then(function (manifest) { - bootstrapper._options.manifest = manifest; - var helper = new Manifold.Helper(bootstrapper._options); - resolve(helper); - }); - } - } - else { - bootstrapper._options.manifest = iiifResource; - var helper = new Manifold.Helper(bootstrapper._options); - resolve(helper); - } - }; - Bootstrapper.prototype._msieversion = function () { - var ua = window.navigator.userAgent; - var msie = ua.indexOf("MSIE "); - if (msie > 0) { - return parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))); - } - else { - return 0; - } - }; - return Bootstrapper; - }()); - Manifold.Bootstrapper = Bootstrapper; -})(Manifold || (Manifold = {})); - -var Manifold; -(function (Manifold) { - var ExternalResource = (function () { - function ExternalResource(resource, dataUriFunc) { - this.isResponseHandled = false; - resource.externalResource = this; - this.dataUri = dataUriFunc(resource); - this._parseAuthServices(resource); - } - ExternalResource.prototype._parseAuthServices = function (resource) { - this.clickThroughService = manifesto.Utils.getService(resource, manifesto.ServiceProfile.clickThrough().toString()); - this.loginService = manifesto.Utils.getService(resource, manifesto.ServiceProfile.login().toString()); - this.restrictedService = manifesto.Utils.getService(resource, manifesto.ServiceProfile.restricted().toString()); - // todo: create this.preferredService? - if (this.clickThroughService) { - this.logoutService = this.clickThroughService.getService(manifesto.ServiceProfile.logout().toString()); - this.tokenService = this.clickThroughService.getService(manifesto.ServiceProfile.token().toString()); - } - else if (this.loginService) { - this.logoutService = this.loginService.getService(manifesto.ServiceProfile.logout().toString()); - this.tokenService = this.loginService.getService(manifesto.ServiceProfile.token().toString()); - } - else if (this.restrictedService) { - this.logoutService = this.restrictedService.getService(manifesto.ServiceProfile.logout().toString()); - this.tokenService = this.restrictedService.getService(manifesto.ServiceProfile.token().toString()); - } - }; - ExternalResource.prototype.isAccessControlled = function () { - if (this.clickThroughService || this.loginService || this.restrictedService) { - return true; - } - return false; - }; - ExternalResource.prototype.hasServiceDescriptor = function () { - return this.dataUri.endsWith('info.json'); - }; - ExternalResource.prototype.getData = function (accessToken) { - var that = this; - that.data = {}; - return new Promise(function (resolve, reject) { - // check if dataUri ends with info.json - // if not issue a HEAD request. - var type = 'GET'; - if (!that.hasServiceDescriptor()) { - // If access control is unnecessary, short circuit the process. - // Note that isAccessControlled check for short-circuiting only - // works in the "binary resource" context, since in that case, - // we know about access control from the manifest. For image - // resources, we need to check info.json for details and can't - // short-circuit like this. - if (!that.isAccessControlled()) { - that.status = HTTPStatusCode.OK; - resolve(that); - return; - } - type = 'HEAD'; - } - $.ajax({ - url: that.dataUri, - type: type, - dataType: 'json', - beforeSend: function (xhr) { - if (accessToken) { - xhr.setRequestHeader("Authorization", "Bearer " + accessToken.accessToken); - } - } - }).done(function (data) { - // if it's a resource without an info.json - // todo: if resource doesn't have a @profile - if (!data) { - that.status = HTTPStatusCode.OK; - resolve(that); - } - else { - var uri = unescape(data['@id']); - that.data = data; - that._parseAuthServices(that.data); - // remove trailing /info.json - if (uri.endsWith('/info.json')) { - uri = uri.substr(0, uri.lastIndexOf('/')); - } - var dataUri = that.dataUri; - if (dataUri.endsWith('/info.json')) { - dataUri = dataUri.substr(0, dataUri.lastIndexOf('/')); - } - // if the request was redirected to a degraded version and there's a login service to get the full quality version - if (uri !== dataUri && that.loginService) { - that.status = HTTPStatusCode.MOVED_TEMPORARILY; - } - else { - that.status = HTTPStatusCode.OK; - } - resolve(that); - } - }).fail(function (error) { - that.status = error.status; - that.error = error; - if (error.responseJSON) { - that._parseAuthServices(error.responseJSON); - } - resolve(that); - }); - }); - }; - return ExternalResource; - }()); - Manifold.ExternalResource = ExternalResource; -})(Manifold || (Manifold = {})); - -var Manifold; -(function (Manifold) { - var Helper = (function () { - function Helper(options) { - this.options = options; - this.iiifResource = this.options.iiifResource; - this.iiifResourceUri = this.options.iiifResourceUri; - this.manifest = this.options.manifest; - this.collectionIndex = this.options.collectionIndex || 0; - this.manifestIndex = this.options.manifestIndex || 0; - this.sequenceIndex = this.options.sequenceIndex || 0; - this.canvasIndex = this.options.canvasIndex || 0; - } - // getters // - Helper.prototype.getAutoCompleteService = function () { - var service = this.getSearchWithinService(); - if (!service) - return null; - return service.getService(manifesto.ServiceProfile.autoComplete()); - }; - Helper.prototype.getAttribution = function () { - return Manifesto.TranslationCollection.getValue(this.manifest.getAttribution()); - }; - Helper.prototype.getCanvases = function () { - return this.getCurrentSequence().getCanvases(); - }; - Helper.prototype.getCanvasById = function (id) { - return this.getCurrentSequence().getCanvasById(id); - }; - Helper.prototype.getCanvasesById = function (ids) { - var canvases = []; - for (var i = 0; i < ids.length; i++) { - var id = ids[i]; - canvases.push(this.getCanvasById(id)); - } - return canvases; - }; - Helper.prototype.getCanvasByIndex = function (index) { - return this.getCurrentSequence().getCanvasByIndex(index); - }; - Helper.prototype.getCanvasIndexById = function (id) { - return this.getCurrentSequence().getCanvasIndexById(id); - }; - Helper.prototype.getCanvasIndexByLabel = function (label) { - var foliated = this.getManifestType().toString() === manifesto.ManifestType.manuscript().toString(); - return this.getCurrentSequence().getCanvasIndexByLabel(label, foliated); - }; - Helper.prototype.getCanvasRange = function (canvas, path) { - var ranges = this.getCanvasRanges(canvas); - if (path) { - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - if (range.path === path) { - return range; - } - } - return null; - } - else { - return ranges[0]; // else return the first range - } - }; - Helper.prototype.getCanvasRanges = function (canvas) { - if (canvas.ranges) { - return canvas.ranges; // cache - } - else { - canvas.ranges = this.manifest.getAllRanges().en().where(function (range) { return (range.getCanvasIds().en().any(function (c) { return c === canvas.id; })); }).toArray(); - } - return canvas.ranges; - }; - Helper.prototype.getCollectionIndex = function (iiifResource) { - // todo: support nested collections. walk up parents adding to array and return csv string. - var index; - if (iiifResource.parentCollection) { - index = iiifResource.parentCollection.index; - } - return index; - }; - Helper.prototype.getCurrentCanvas = function () { - return this.getCurrentSequence().getCanvasByIndex(this.canvasIndex); - }; - Helper.prototype.getCurrentElement = function () { - return this.getCanvasByIndex(this.canvasIndex); - }; - Helper.prototype.getCurrentSequence = function () { - return this.getSequenceByIndex(this.sequenceIndex); - }; - Helper.prototype.getElementType = function (element) { - if (!element) { - element = this.getCurrentCanvas(); - } - return element.getType(); - }; - Helper.prototype.getFirstPageIndex = function () { - return 0; - }; - Helper.prototype.getInfoUri = function (canvas) { - var images = canvas.getImages(); - // if the canvas has images it's IIIF - if (images && images.length) { - var infoUri; - var firstImage = images[0]; - var resource = firstImage.getResource(); - var services = resource.getServices(); - for (var i = 0; i < services.length; i++) { - var service = services[i]; - var id = service.id; - if (!id.endsWith('/')) { - id += '/'; - } - if (manifesto.Utils.isImageProfile(service.getProfile())) { - infoUri = id + 'info.json'; - } - } - return infoUri; - } - else { - // IxIF - var service = canvas.getService(manifesto.ServiceProfile.ixif()); - if (service) { - return service.getInfoUri(); - } - // return the canvas id. - return canvas.id; - } - }; - Helper.prototype.getLabel = function () { - return Manifesto.TranslationCollection.getValue(this.manifest.getLabel()); - }; - Helper.prototype.getLastCanvasLabel = function (alphanumeric) { - return this.getCurrentSequence().getLastCanvasLabel(alphanumeric); - }; - Helper.prototype.getLastPageIndex = function () { - return this.getTotalCanvases() - 1; - }; - Helper.prototype.getLicense = function () { - return this.manifest.getLicense(); - }; - Helper.prototype.getLogo = function () { - return this.manifest.getLogo(); - }; - Helper.prototype.getManifestType = function () { - var manifestType = this.manifest.getManifestType(); - // default to monograph - if (manifestType.toString() === "") { - manifestType = manifesto.ManifestType.monograph(); - } - return manifestType; - }; - Helper.prototype.getMetadata = function (options) { - var metadataGroups = []; - var manifestMetadata = this.manifest.getMetadata(); - var manifestGroup = new Manifold.MetadataGroup(this.manifest); - if (manifestMetadata && manifestMetadata.length) { - manifestGroup.addMetadata(manifestMetadata, true); - } - if (this.manifest.getDescription().length) { - var metadataItem = new Manifesto.MetadataItem(this.options.locale); - metadataItem.label = [new Manifesto.Translation("description", this.options.locale)]; - metadataItem.value = this.manifest.getDescription(); - metadataItem.isRootLevel = true; - manifestGroup.addItem(metadataItem); - } - if (this.manifest.getAttribution().length) { - var metadataItem = new Manifesto.MetadataItem(this.options.locale); - metadataItem.label = [new Manifesto.Translation("attribution", this.options.locale)]; - metadataItem.value = this.manifest.getAttribution(); - metadataItem.isRootLevel = true; - manifestGroup.addItem(metadataItem); - } - if (this.manifest.getLicense()) { - var item = { - label: "license", - value: (options && options.licenseFormatter) ? options.licenseFormatter.format(this.manifest.getLicense()) : this.manifest.getLicense() - }; - var metadataItem = new Manifesto.MetadataItem(this.options.locale); - metadataItem.parse(item); - metadataItem.isRootLevel = true; - manifestGroup.addItem(metadataItem); - } - if (this.manifest.getLogo()) { - var item = { - label: "logo", - value: '' - }; - var metadataItem = new Manifesto.MetadataItem(this.options.locale); - metadataItem.parse(item); - metadataItem.isRootLevel = true; - manifestGroup.addItem(metadataItem); - } - metadataGroups.push(manifestGroup); - if (options) { - return this._parseMetadataOptions(options, metadataGroups); - } - else { - return metadataGroups; - } - }; - Helper.prototype._parseMetadataOptions = function (options, metadataGroups) { - // get sequence metadata - var sequence = this.getCurrentSequence(); - var sequenceMetadata = sequence.getMetadata(); - if (sequenceMetadata && sequenceMetadata.length) { - var sequenceGroup = new Manifold.MetadataGroup(sequence); - sequenceGroup.addMetadata(sequenceMetadata); - metadataGroups.push(sequenceGroup); - } - // get range metadata - if (options.range) { - var rangeGroups = this._getRangeMetadata([], options.range); - rangeGroups = rangeGroups.reverse(); - metadataGroups = metadataGroups.concat(rangeGroups); - } - // get canvas metadata - if (options.canvases && options.canvases.length) { - for (var i = 0; i < options.canvases.length; i++) { - var canvas = options.canvases[i]; - var canvasMetadata = canvas.getMetadata(); - if (canvasMetadata && canvasMetadata.length) { - var canvasGroup = new Manifold.MetadataGroup(canvas); - canvasGroup.addMetadata(canvas.getMetadata()); - metadataGroups.push(canvasGroup); - } - // add image metadata - var images = canvas.getImages(); - for (var j = 0; j < images.length; j++) { - var image = images[j]; - var imageMetadata = image.getMetadata(); - if (imageMetadata && imageMetadata.length) { - var imageGroup = new Manifold.MetadataGroup(image); - imageGroup.addMetadata(imageMetadata); - metadataGroups.push(imageGroup); - } - } - } - } - return metadataGroups; - }; - Helper.prototype._getRangeMetadata = function (metadataGroups, range) { - var rangeMetadata = range.getMetadata(); - if (rangeMetadata && rangeMetadata.length) { - var rangeGroup = new Manifold.MetadataGroup(range); - rangeGroup.addMetadata(rangeMetadata); - metadataGroups.push(rangeGroup); - } - if (range.parentRange) { - return this._getRangeMetadata(metadataGroups, range.parentRange); - } - else { - return metadataGroups; - } - }; - Helper.prototype.getMultiSelectState = function () { - if (!this._multiSelectState) { - this._multiSelectState = new Manifold.MultiSelectState(); - this._multiSelectState.ranges = this.getRanges().clone(); - this._multiSelectState.canvases = this.getCurrentSequence().getCanvases().clone(); - } - return this._multiSelectState; - }; - Helper.prototype.getRanges = function () { - return this.manifest.getAllRanges(); - }; - Helper.prototype.getRangeByPath = function (path) { - return this.manifest.getRangeByPath(path); - }; - Helper.prototype.getRangeCanvases = function (range) { - var ids = range.getCanvasIds(); - return this.getCanvasesById(ids); - }; - Helper.prototype.getRelated = function () { - return this.manifest.getRelated(); - }; - Helper.prototype.getResources = function () { - var element = this.getCurrentElement(); - return element.getResources(); - }; - Helper.prototype.getSearchWithinService = function () { - return this.manifest.getService(manifesto.ServiceProfile.searchWithin()); - }; - Helper.prototype.getSeeAlso = function () { - return this.manifest.getSeeAlso(); - }; - Helper.prototype.getSequenceByIndex = function (index) { - return this.manifest.getSequenceByIndex(index); - }; - Helper.prototype.getShareServiceUrl = function () { - var url; - var shareService = this.manifest.getService(manifesto.ServiceProfile.shareExtensions()); - if (shareService) { - if (shareService.length) { - shareService = shareService[0]; - } - url = shareService.__jsonld.shareUrl; - } - return url; - }; - Helper.prototype.getSortedTreeNodesByDate = function (sortedTree, tree) { - var all = tree.nodes.en().traverseUnique(function (node) { return node.nodes; }) - .where(function (n) { return n.data.type === manifesto.TreeNodeType.collection().toString() || - n.data.type === manifesto.TreeNodeType.manifest().toString(); }).toArray(); - //var collections: ITreeNode[] = tree.nodes.en().traverseUnique(n => n.nodes) - // .where((n) => n.data.type === ITreeNodeType.collection().toString()).toArray(); - var manifests = tree.nodes.en().traverseUnique(function (n) { return n.nodes; }) - .where(function (n) { return n.data.type === manifesto.TreeNodeType.manifest().toString(); }).toArray(); - this.createDecadeNodes(sortedTree, all); - this.sortDecadeNodes(sortedTree); - this.createYearNodes(sortedTree, all); - this.sortYearNodes(sortedTree); - this.createMonthNodes(sortedTree, manifests); - this.sortMonthNodes(sortedTree); - this.createDateNodes(sortedTree, manifests); - this.pruneDecadeNodes(sortedTree); - }; - Helper.prototype.getStartCanvasIndex = function () { - return this.getCurrentSequence().getStartCanvasIndex(); - }; - Helper.prototype.getThumbs = function (width, height) { - return this.getCurrentSequence().getThumbs(width, height); - }; - Helper.prototype.getTopRanges = function () { - return this.manifest.getTopRanges(); - }; - Helper.prototype.getTotalCanvases = function () { - return this.getCurrentSequence().getTotalCanvases(); - }; - Helper.prototype.getTrackingLabel = function () { - return this.manifest.getTrackingLabel(); - }; - Helper.prototype.getTree = function (topRangeIndex, sortType) { - // if it's a collection, use IIIFResource.getDefaultTree() - // otherwise, get the top range by index and use Range.getTree() - if (topRangeIndex === void 0) { topRangeIndex = 0; } - if (sortType === void 0) { sortType = Manifold.TreeSortType.NONE; } - var tree; - if (this.iiifResource.isCollection()) { - tree = this.iiifResource.getDefaultTree(); - } - else { - var topRanges = this.iiifResource.getTopRanges(); - var root = new manifesto.TreeNode(); - root.label = 'root'; - root.data = this.iiifResource; - if (topRanges.length) { - var range = topRanges[topRangeIndex]; - tree = range.getTree(root); - } - else { - return root; - } - } - var sortedTree = new manifesto.TreeNode(); - switch (sortType.toString()) { - case Manifold.TreeSortType.DATE.toString(): - // returns a list of treenodes for each decade. - // expanding a decade generates a list of years - // expanding a year gives a list of months containing issues - // expanding a month gives a list of issues. - if (this.treeHasNavDates(tree)) { - this.getSortedTreeNodesByDate(sortedTree, tree); - break; - } - default: - sortedTree = tree; - } - return sortedTree; - }; - Helper.prototype.treeHasNavDates = function (tree) { - var node = tree.nodes.en().traverseUnique(function (node) { return node.nodes; }).where(function (n) { return !isNaN(n.navDate); }).first(); - return (node) ? true : false; - }; - Helper.prototype.getViewingDirection = function () { - var viewingDirection = this.getCurrentSequence().getViewingDirection(); - if (!viewingDirection.toString()) { - viewingDirection = this.manifest.getViewingDirection(); - } - return viewingDirection; - }; - Helper.prototype.getViewingHint = function () { - var viewingHint = this.getCurrentSequence().getViewingHint(); - if (!viewingHint.toString()) { - viewingHint = this.manifest.getViewingHint(); - } - return viewingHint; - }; - // inquiries // - Helper.prototype.hasParentCollection = function () { - return !!this.manifest.parentCollection; - }; - Helper.prototype.hasRelatedPage = function () { - var related = this.getRelated(); - if (!related) - return false; - if (related.length) { - related = related[0]; - } - return related['format'] === 'text/html'; - }; - Helper.prototype.hasResources = function () { - return this.getResources().length > 0; - }; - Helper.prototype.isBottomToTop = function () { - return this.getViewingDirection().toString() === manifesto.ViewingDirection.bottomToTop().toString(); - }; - Helper.prototype.isCanvasIndexOutOfRange = function (index) { - return this.getCurrentSequence().isCanvasIndexOutOfRange(index); - }; - Helper.prototype.isContinuous = function () { - return this.getViewingHint().toString() === manifesto.ViewingHint.continuous().toString(); - }; - Helper.prototype.isFirstCanvas = function (index) { - if (typeof index !== 'undefined') { - return this.getCurrentSequence().isFirstCanvas(index); - } - return this.getCurrentSequence().isFirstCanvas(this.canvasIndex); - }; - Helper.prototype.isHorizontallyAligned = function () { - return this.isLeftToRight() || this.isRightToLeft(); - }; - Helper.prototype.isLastCanvas = function (index) { - if (typeof index !== 'undefined') { - return this.getCurrentSequence().isLastCanvas(index); - } - return this.getCurrentSequence().isLastCanvas(this.canvasIndex); - }; - Helper.prototype.isLeftToRight = function () { - return this.getViewingDirection().toString() === manifesto.ViewingDirection.leftToRight().toString(); - }; - Helper.prototype.isMultiCanvas = function () { - return this.getCurrentSequence().isMultiCanvas(); - }; - Helper.prototype.isMultiSequence = function () { - return this.manifest.isMultiSequence(); - }; - Helper.prototype.isPaged = function () { - return this.getViewingHint().toString() === manifesto.ViewingHint.paged().toString(); - }; - Helper.prototype.isPagingAvailable = function () { - // paged mode is useless unless you have at least 3 pages... - return this.isPagingEnabled() && this.getTotalCanvases() > 2; - }; - Helper.prototype.isPagingEnabled = function () { - return (this.manifest.isPagingEnabled() || this.getCurrentSequence().isPagingEnabled()); - }; - Helper.prototype.isRightToLeft = function () { - return this.getViewingDirection().toString() === manifesto.ViewingDirection.rightToLeft().toString(); - }; - Helper.prototype.isTopToBottom = function () { - return this.getViewingDirection().toString() === manifesto.ViewingDirection.topToBottom().toString(); - }; - Helper.prototype.isTotalCanvasesEven = function () { - return this.getCurrentSequence().isTotalCanvasesEven(); - }; - Helper.prototype.isUIEnabled = function (name) { - var uiExtensions = this.manifest.getService(manifesto.ServiceProfile.uiExtensions()); - if (uiExtensions) { - var disableUI = uiExtensions.getProperty('disableUI'); - if (disableUI) { - if (disableUI.contains(name) || disableUI.contains(name.toLowerCase())) { - return false; - } - } - } - return true; - }; - Helper.prototype.isVerticallyAligned = function () { - return this.isTopToBottom() || this.isBottomToTop(); - }; - // dates // - Helper.prototype.createDateNodes = function (rootNode, nodes) { - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - var year = this.getNodeYear(node); - var month = this.getNodeMonth(node); - var dateNode = new manifesto.TreeNode(); - dateNode.id = node.id; - dateNode.label = this.getNodeDisplayDate(node); - dateNode.data = node.data; - dateNode.data.type = manifesto.TreeNodeType.manifest().toString(); - dateNode.data.year = year; - dateNode.data.month = month; - var decadeNode = this.getDecadeNode(rootNode, year); - if (decadeNode) { - var yearNode = this.getYearNode(decadeNode, year); - if (yearNode) { - var monthNode = this.getMonthNode(yearNode, month); - if (monthNode) { - monthNode.addNode(dateNode); - } - } - } - } - }; - Helper.prototype.createDecadeNodes = function (rootNode, nodes) { - var decadeNode; - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - var year = this.getNodeYear(node); - var decade = Number(year.toString().substr(2, 1)); - var endYear = Number(year.toString().substr(0, 3) + "9"); - if (!this.getDecadeNode(rootNode, year)) { - decadeNode = new manifesto.TreeNode(); - decadeNode.label = year + " - " + endYear; - decadeNode.navDate = node.navDate; - decadeNode.data.startYear = year; - decadeNode.data.endYear = endYear; - rootNode.addNode(decadeNode); - } - } - }; - Helper.prototype.createMonthNodes = function (rootNode, nodes) { - var monthNode; - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - var year = this.getNodeYear(node); - var month = this.getNodeMonth(node); - var decadeNode = this.getDecadeNode(rootNode, year); - var yearNode = this.getYearNode(decadeNode, year); - if (decadeNode && yearNode && !this.getMonthNode(yearNode, month)) { - monthNode = new manifesto.TreeNode(); - monthNode.label = this.getNodeDisplayMonth(node); - monthNode.navDate = node.navDate; - monthNode.data.year = year; - monthNode.data.month = month; - yearNode.addNode(monthNode); - } - } - }; - Helper.prototype.createYearNodes = function (rootNode, nodes) { - var yearNode; - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - var year = this.getNodeYear(node); - var decadeNode = this.getDecadeNode(rootNode, year); - if (decadeNode && !this.getYearNode(decadeNode, year)) { - yearNode = new manifesto.TreeNode(); - yearNode.label = year.toString(); - yearNode.navDate = node.navDate; - yearNode.data.year = year; - decadeNode.addNode(yearNode); - } - } - }; - Helper.prototype.getDecadeNode = function (rootNode, year) { - for (var i = 0; i < rootNode.nodes.length; i++) { - var n = rootNode.nodes[i]; - if (year >= n.data.startYear && year <= n.data.endYear) - return n; - } - return null; - }; - Helper.prototype.getMonthNode = function (yearNode, month) { - for (var i = 0; i < yearNode.nodes.length; i++) { - var n = yearNode.nodes[i]; - if (month === this.getNodeMonth(n)) - return n; - } - return null; - }; - Helper.prototype.getNodeDisplayDate = function (node) { - return node.navDate.toDateString(); - }; - Helper.prototype.getNodeDisplayMonth = function (node) { - var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; - return months[node.navDate.getMonth()]; - }; - Helper.prototype.getNodeMonth = function (node) { - return node.navDate.getMonth(); - }; - Helper.prototype.getNodeYear = function (node) { - return node.navDate.getFullYear(); - }; - Helper.prototype.getYearNode = function (decadeNode, year) { - for (var i = 0; i < decadeNode.nodes.length; i++) { - var n = decadeNode.nodes[i]; - if (year === this.getNodeYear(n)) - return n; - } - return null; - }; - // delete any empty decades - Helper.prototype.pruneDecadeNodes = function (rootNode) { - var pruned = []; - for (var i = 0; i < rootNode.nodes.length; i++) { - var n = rootNode.nodes[i]; - if (!n.nodes.length) { - pruned.push(n); - } - } - for (var j = 0; j < pruned.length; j++) { - var p = pruned[j]; - rootNode.nodes.remove(p); - } - }; - Helper.prototype.sortDecadeNodes = function (rootNode) { - rootNode.nodes = rootNode.nodes.sort(function (a, b) { - return a.data.startYear - b.data.startYear; - }); - }; - Helper.prototype.sortMonthNodes = function (rootNode) { - var _this = this; - for (var i = 0; i < rootNode.nodes.length; i++) { - var decadeNode = rootNode.nodes[i]; - for (var j = 0; j < decadeNode.nodes.length; j++) { - var monthNode = decadeNode.nodes[j]; - monthNode.nodes = monthNode.nodes.sort(function (a, b) { - return _this.getNodeMonth(a) - _this.getNodeMonth(b); - }); - } - } - }; - Helper.prototype.sortYearNodes = function (rootNode) { - var _this = this; - for (var i = 0; i < rootNode.nodes.length; i++) { - var decadeNode = rootNode.nodes[i]; - decadeNode.nodes = decadeNode.nodes.sort(function (a, b) { - return (_this.getNodeYear(a) - _this.getNodeYear(b)); - }); - } - }; - return Helper; - }()); - Manifold.Helper = Helper; -})(Manifold || (Manifold = {})); - - - - - - - - - - - - - - - - - - - -var Manifold; -(function (Manifold) { - function loadManifest(options) { - var bootstrapper = new Manifold.Bootstrapper(options); - return bootstrapper.bootstrap(); - } - Manifold.loadManifest = loadManifest; -})(Manifold || (Manifold = {})); -(function (w) { - if (!w.Manifold) { - w.Manifold = Manifold; - } -})(window); - -var Manifold; -(function (Manifold) { - var MetadataGroup = (function () { - function MetadataGroup(resource, label) { - this.items = []; - this.resource = resource; - this.label = label; - } - MetadataGroup.prototype.addItem = function (item) { - this.items.push(item); - }; - MetadataGroup.prototype.addMetadata = function (metadata, isRootLevel) { - if (isRootLevel === void 0) { isRootLevel = false; } - for (var i = 0; i < metadata.length; i++) { - var item = metadata[i]; - item.isRootLevel = isRootLevel; - this.addItem(item); - } - }; - return MetadataGroup; - }()); - Manifold.MetadataGroup = MetadataGroup; -})(Manifold || (Manifold = {})); - -var Manifold; -(function (Manifold) { - var MetadataOptions = (function () { - function MetadataOptions() { - } - return MetadataOptions; - }()); - Manifold.MetadataOptions = MetadataOptions; -})(Manifold || (Manifold = {})); - -var Manifold; -(function (Manifold) { - var MultiSelectState = (function () { - function MultiSelectState() { - this.isEnabled = false; - this.ranges = []; - this.canvases = []; - } - MultiSelectState.prototype.allCanvasesSelected = function () { - return this.canvases.length > 0 && this.getAllSelectedCanvases().length === this.canvases.length; - }; - MultiSelectState.prototype.allRangesSelected = function () { - return this.ranges.length > 0 && this.getAllSelectedRanges().length === this.ranges.length; - }; - MultiSelectState.prototype.allSelected = function () { - return this.allRangesSelected() && this.allCanvasesSelected(); - }; - MultiSelectState.prototype.getAll = function () { - return this.canvases.concat(this.ranges); - }; - MultiSelectState.prototype.getAllSelectedCanvases = function () { - return this.canvases.en().where(function (c) { return c.multiSelected; }).toArray(); - }; - MultiSelectState.prototype.getAllSelectedRanges = function () { - return this.ranges.en().where(function (r) { return r.multiSelected; }).toArray(); - }; - MultiSelectState.prototype.getCanvasById = function (id) { - return this.canvases.en().where(function (c) { return c.id === id; }).first(); - }; - MultiSelectState.prototype.getCanvasesByIds = function (ids) { - var canvases = []; - for (var i = 0; i < ids.length; i++) { - var id = ids[i]; - canvases.push(this.getCanvasById(id)); - } - return canvases; - }; - MultiSelectState.prototype.getRangeCanvases = function (range) { - var ids = range.getCanvasIds(); - return this.getCanvasesByIds(ids); - }; - MultiSelectState.prototype.selectAll = function (selected) { - this.selectRanges(this.ranges, selected); - this.selectCanvases(this.canvases, selected); - }; - MultiSelectState.prototype.selectCanvas = function (canvas, selected) { - var c = this.canvases.en().where(function (c) { return c.id === canvas.id; }).first(); - c.multiSelected = selected; - }; - MultiSelectState.prototype.selectAllCanvases = function (selected) { - this.selectCanvases(this.canvases, selected); - }; - MultiSelectState.prototype.selectCanvases = function (canvases, selected) { - for (var j = 0; j < canvases.length; j++) { - var canvas = canvases[j]; - canvas.multiSelected = selected; - } - }; - MultiSelectState.prototype.selectRange = function (range, selected) { - var r = this.ranges.en().where(function (r) { return r.id === range.id; }).first(); - r.multiSelected = selected; - var canvases = this.getRangeCanvases(r); - this.selectCanvases(canvases, selected); - }; - MultiSelectState.prototype.selectAllRanges = function (selected) { - this.selectRanges(this.ranges, selected); - }; - MultiSelectState.prototype.selectRanges = function (ranges, selected) { - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - range.multiSelected = selected; - var canvases = this.getCanvasesByIds(range.getCanvasIds()); - this.selectCanvases(canvases, selected); - } - }; - MultiSelectState.prototype.setEnabled = function (enabled) { - this.isEnabled = enabled; - var items = this.getAll(); - for (var i = 0; i < items.length; i++) { - var item = items[i]; - item.multiSelectEnabled = this.isEnabled; - if (!enabled) { - item.multiSelected = false; - } - } - }; - return MultiSelectState; - }()); - Manifold.MultiSelectState = MultiSelectState; -})(Manifold || (Manifold = {})); - -var Manifold; -(function (Manifold) { - var SearchResult = (function () { - function SearchResult(resource, canvasIndex) { - this.rects = []; - this.canvasIndex = canvasIndex; - this.addRect(resource); - } - SearchResult.prototype.addRect = function (resource) { - var rect = new Manifold.SearchResultRect(resource); - rect.canvasIndex = this.canvasIndex; - rect.index = this.rects.length; - this.rects.push(rect); - // sort ascending - this.rects.sort(function (a, b) { - return a.index - b.index; - }); - }; - return SearchResult; - }()); - Manifold.SearchResult = SearchResult; -})(Manifold || (Manifold = {})); - -var Manifold; -(function (Manifold) { - var SearchResultRect = (function () { - function SearchResultRect(result) { - this.isVisible = true; - var xywh = result.on.match(/.*xywh=(\d*),(\d*),(\d*),(\d*)/); - this.x = Number(xywh[1]); - this.y = Number(xywh[2]); - this.width = Number(xywh[3]); - this.height = Number(xywh[4]); - this.chars = result.resource.chars; - } - return SearchResultRect; - }()); - Manifold.SearchResultRect = SearchResultRect; -})(Manifold || (Manifold = {})); - -var Manifold; -(function (Manifold) { - var Translation = (function () { - function Translation(value, locale) { - this.value = value; - this.locale = locale; - } - return Translation; - }()); - Manifold.Translation = Translation; -})(Manifold || (Manifold = {})); - -var Manifold; -(function (Manifold) { - // This class formats URIs into HTML links, applying labels when available - var UriLabeller = (function () { - function UriLabeller(labels) { - this.labels = labels; - } - UriLabeller.prototype.format = function (url) { - // if already a link, do nothing. - if (url.indexOf('' + label + ''; - }; - return UriLabeller; - }()); - Manifold.UriLabeller = UriLabeller; -})(Manifold || (Manifold = {})); - -},{}]},{},[1])(1) +// manifold v1.1.11 https://github.com/viewdir/manifold#readme +var exjs;!function(r){r.version="0.4.0"}(exjs||(exjs={}));var exjs;!function(r){Array.isArray||(Array.isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)})}(exjs||(exjs={}));var exjs;!function(r){var e=function(){function r(){}return r.prototype.getEnumerator=function(){return{moveNext:function(){return!1},current:void 0}},r.prototype.aggregate=function(r,e){for(var t=r,n=this.getEnumerator();n.moveNext();)t=e(t,n.current);return t},r.prototype.all=function(r){if(r)for(var e=this.getEnumerator(),t=0;e.moveNext();){if(!r(e.current,t))return!1;t++}return!0},r.prototype.any=function(r){for(var e=this.getEnumerator(),t=0;e.moveNext();){if(!r)return!0;if(r(e.current,t))return!0;t++}return!1},r.prototype.append=function(){for(var r=[],e=0;e-1?(this._keys.splice(e,1),this._values.splice(e,1),this.size--,!0):!1},e.prototype.entries=function(){var e=this;return r.range(0,this.size).select(function(r){return[e._keys[r],e._values[r]]})},e.prototype.forEach=function(r,e){null==e&&(e=this);for(var t=0,n=this._keys,o=this._values,u=n.length;u>t;t++)r.call(e,o[t],n[t],this)},e.prototype.get=function(r){var e=this._keys.indexOf(r);return this._values[e]},e.prototype.has=function(r){return this._keys.indexOf(r)>-1},e.prototype.keys=function(){return this._keys.en()},e.prototype.set=function(r,e){var t=this._keys.indexOf(r);t>-1?this._values[t]=e:(this._keys.push(r),this._values.push(e),this.size++)},e.prototype.values=function(){return this._values.en()},e}();r.Map3=e,r.Enumerable.prototype.toMap=function(r,t){for(var n=new e,o=this.getEnumerator();o.moveNext();)n.set(r(o.current),t(o.current));return n},r.List&&(r.List.prototype.toMap=r.Enumerable.prototype.toMap)}(exjs||(exjs={})),function(r){r.Map||(r.Map=exjs.Map3)}("undefined"==typeof window?global:window);var exjs;!function(r){function e(e){var t=new r.Enumerable;return t.getEnumerator=function(){var r={current:void 0,moveNext:function(){return e(r)}};return r},t}r.anonymous=e}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n,o=1,u={current:void 0,moveNext:function(){if(2>o){if(t=t||r.getEnumerator(),t.moveNext())return u.current=t.current,!0;o++}return n=n||e.en().getEnumerator(),n.moveNext()?(u.current=n.current,!0):(u.current=void 0,!1)}};return u}r.Enumerable.prototype.append=function(){for(var t=this,n=[],o=0;o=e?(t.current=void 0,!1):(t.current=r[n],!0)},t}function t(){return this&&Array.isArray(this)?new n(this):new r.Enumerable}var n=function(r){function t(t){r.call(this),this.getEnumerator=function(){return e(t)},this.toArray=function(){return t.slice(0)}}return __extends(t,r),t}(r.Enumerable);try{Object.defineProperty(Array.prototype,"en",{value:t,enumerable:!1,writable:!1,configurable:!1})}catch(o){Array.prototype.en=t}}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n=!1,o={current:void 0,moveNext:function(){return t||(t=r.getEnumerator()),o.current=void 0,t.moveNext()?(o.current=t.current,!0):n?!1:(n=!0,t=e.getEnumerator(),t.moveNext()?(o.current=t.current,!0):!1)}};return o}r.Enumerable.prototype.concat=function(t){var n=this,o=t instanceof Array?t.en():t,u=new r.Enumerable;return u.getEnumerator=function(){return e(n,o)},u},r.List&&(r.List.prototype.concat=r.Enumerable.prototype.concat)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n=[],o={current:void 0,moveNext:function(){if(t||(t=r.getEnumerator()),o.current=void 0,!e){for(;t.moveNext();)if(n.indexOf(t.current)<0)return n.push(o.current=t.current),!0;return!1}for(;t.moveNext();){for(var u=0,i=n.length,c=!1;i>u&&!c;u++)c=!!e(n[u],t.current);if(!c)return n.push(o.current=t.current),!0}return!1}};return o}r.Enumerable.prototype.distinct=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.List&&(r.List.prototype.distinct=r.Enumerable.prototype.distinct)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e,t){t=t||function(r,e){return r===e};var n,o={current:void 0,moveNext:function(){for(n||(n=r.getEnumerator()),o.current=void 0;n.moveNext();){for(var u=!1,i=e.getEnumerator();i.moveNext()&&!u;)u=t(n.current,i.current);if(!u)return o.current=n.current,!0}return!1}};return o}r.Enumerable.prototype.except=function(t,n){var o=this,u=t instanceof Array?t.en():t,i=new r.Enumerable;return i.getEnumerator=function(){return e(o,u,n)},i},r.List&&(r.List.prototype.except=r.Enumerable.prototype.except)}(exjs||(exjs={})),Function.prototype.fromJson=function(r,e){function t(r,e){if(null==r)return r;if(e instanceof Function)return e(r);if(e instanceof Array){if(e=e[0],!(e instanceof Function&&r instanceof Array))return;for(var t=[],n=0;n-1)){var i=t(r[u],this.$jsonMappings[u]);void 0!==i&&(n[u]=i,o.push(u))}for(var u in r)o.indexOf(u)>-1||(n[u]=r[u]);return n};var exjs;!function(r){function e(r,e,n){var o,u=0,i={current:void 0,moveNext:function(){return o||(o=t(r,e,n)),i.current=void 0,u>=o.length?!1:(i.current=o[u],u++,!0)}};return i}function t(r,e,t){t=t||function(r,e){return r===e};for(var o,u=[],i=[],c=r.getEnumerator();c.moveNext();){o=e(c.current);for(var a=-1,p=0,s=i.length;s>p;p++)if(t(o,i[p])){a=p;break}var f;0>a?(i.push(o),u.push(f=new n(o))):f=u[a],f._add(c.current)}return u}var n=function(r){function e(e){var t=this;r.call(this),this.key=e,this._arr=[],this.getEnumerator=function(){return t._arr.en().getEnumerator()}}return __extends(e,r),e.prototype._add=function(r){this._arr.push(r)},e}(r.Enumerable);r.Enumerable.prototype.groupBy=function(t,n){var o=this,u=new r.Enumerable;return u.getEnumerator=function(){return e(o,t,n)},u},r.List&&(r.List.prototype.groupBy=r.Enumerable.prototype.groupBy)}(exjs||(exjs={}));var exjs;!function(r){function e(e,t,n){n=n||function(r,e){return r===e};var o,u={current:void 0,moveNext:function(){for(o||(o=r.en(e).distinct().getEnumerator()),u.current=void 0;o.moveNext();){for(var i=!1,c=t.getEnumerator();c.moveNext()&&!i;)i=n(o.current,c.current);if(i)return u.current=o.current,!0}return!1}};return u}r.Enumerable.prototype.intersect=function(t,n){var o=this,u=t instanceof Array?t.en():t,i=new r.Enumerable;return i.getEnumerator=function(){return e(o,u,n)},i},r.List&&(r.List.prototype.intersect=r.Enumerable.prototype.intersect)}(exjs||(exjs={}));var exjs;!function(r){function e(e,t,n,o,u,i){i=i||function(r,e){return r===e};var c,a,p=0,s={current:void 0,moveNext:function(){if(s.current=void 0,!c){if(c=e.getEnumerator(),!c.moveNext())return!1;a=r.en(t).toArray()}var f;do{for(;p=e?(t.current=void 0,!1):(t.current=r[n],!0)},t},t.prototype.remove=function(r){return this.removeWhere(function(e){return e===r}).any()},t.prototype.removeWhere=function(r){for(var e,t=[],n=this.length-1;n>=0;n--)e=this[n],r(e,n)===!0&&(this.splice(n,1),t.push(e));return t.en().reverse()}}(exjs||(exjs={}));var exjs;!function(r){function e(r,e,n,o){return new t(r,e,n,o)}var t=function(e){function t(r,t,n,o){e.call(this),this.Source=r,o=o||function(r,e){return r>e?1:e>r?-1:0};var u=n===!0?-1:1;this.Sorter=function(r,e){return u*o(t(r),t(e))}}return __extends(t,e),t.prototype.getEnumerator=function(){var e,t=this.Source,n=this.Sorter,o=0,u={current:void 0,moveNext:function(){return e||(e=r.en(t).toArray(),e.sort(n)),u.current=void 0,o>=e.length?!1:(u.current=e[o],o++,!0)}};return u},t.prototype.thenBy=function(r,e){return new n(this,r,!1,e)},t.prototype.thenByDescending=function(r,e){return new n(this,r,!0,e)},t}(r.Enumerable),n=function(r){function e(e,t,n,o){r.call(this,e,t,n,o);var u=e.Sorter,i=this.Sorter;this.Sorter=function(r,e){return u(r,e)||i(r,e)}}return __extends(e,r),e}(t),o=r.Enumerable.prototype;o.orderBy=function(r,t){return e(this,r,!1,t)},o.orderByDescending=function(r,t){return e(this,r,!0,t)},r.List&&(r.List.prototype.orderBy=r.Enumerable.prototype.orderBy,r.List.prototype.orderByDescending=r.Enumerable.prototype.orderByDescending)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n,o=1,u={current:void 0,moveNext:function(){if(2>o){if(t=t||e.en().getEnumerator(),t.moveNext())return u.current=t.current,!0;o++}return n=n||r.getEnumerator(),n.moveNext()?(u.current=n.current,!0):(u.current=void 0,!1)}};return u}r.Enumerable.prototype.prepend=function(){for(var t=this,n=[],o=0;o=e?!1:(o.current=n,!0)}};return o}function t(t,n,o){if(t=t||0,n=n||0,t>n)throw new Error("Start cannot be greater than end.");null==o&&(o=1);var u=new r.Enumerable;return u.getEnumerator=function(){return e(t,n,o)},u}r.range=t}(exjs||(exjs={}));var exjs;!function(r){function e(e){var t,n=0,o={current:void 0,moveNext:function(){return t||(t=r.en(e).toArray(),n=t.length),n--,o.current=t[n],n>=0}};return o}r.Enumerable.prototype.reverse=function(){var t=this,n=new r.Enumerable;return n.getEnumerator=function(){return e(t)},n},r.List&&(r.List.prototype.reverse=r.Enumerable.prototype.reverse)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){if(e=e||0,0===e)return Math.round(r);var t=Math.pow(10,e);return Math.round(r*t)/t}r.round=e}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n=0,o={current:void 0,moveNext:function(){return t||(t=r.getEnumerator()),t.moveNext()?(o.current=e(t.current,n),n++,!0):!1}};return o}function t(e,t){var n,o,u={current:void 0,moveNext:function(){for(u.current=void 0,n||(n=e.getEnumerator());!o||!o.moveNext();){if(!n.moveNext())return!1;o=r.selectorEnumerator(t(n.current))}return u.current=o.current,!0}};return u}r.Enumerable.prototype.select=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.Enumerable.prototype.selectMany=function(e){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return t(n,e)},o},r.List&&(r.List.prototype.select=r.Enumerable.prototype.select,r.List.prototype.selectMany=r.Enumerable.prototype.selectMany)}(exjs||(exjs={}));var exjs;!function(r){function e(r){return Array.isArray(r)?r.en().getEnumerator():null!=r&&"function"==typeof r.getEnumerator?r.getEnumerator():null}r.selectorEnumerator=e}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n={current:void 0,moveNext:function(){if(!t){t=r.getEnumerator();for(var o=0;e>o;o++)if(!t.moveNext())return!1}return t.moveNext()?(n.current=t.current,!0):(n.current=void 0,!1)}};return n}function t(r,e){var t,n={current:void 0,moveNext:function(){if(!t){t=r.getEnumerator();for(var o=0;t.moveNext();o++)if(!e(n.current=t.current,o))return!0;return n.current=void 0,!1}return t.moveNext()?(n.current=t.current,!0):(n.current=void 0,!1)}};return n}r.Enumerable.prototype.skip=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.Enumerable.prototype.skipWhile=function(e){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return t(n,e)},o},r.List&&(r.List.prototype.skip=r.Enumerable.prototype.skip,r.List.prototype.skipWhile=r.Enumerable.prototype.skipWhile)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n=0,o={current:void 0,moveNext:function(){return t||(t=r.getEnumerator()),n++,n>e?!1:(o.current=void 0,t.moveNext()?(o.current=t.current,!0):!1)}};return o}function t(r,e){var t,n=0,o={current:void 0,moveNext:function(){return t||(t=r.getEnumerator()),t.moveNext()&&e(t.current,n)?(n++,o.current=t.current,!0):(o.current=void 0,!1)}};return o}r.Enumerable.prototype.take=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.Enumerable.prototype.takeWhile=function(e){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return t(n,e)},o},r.List&&(r.List.prototype.take=r.Enumerable.prototype.take,r.List.prototype.takeWhile=r.Enumerable.prototype.takeWhile)}(exjs||(exjs={}));var exjs;!function(r){function e(e,t){var n,o=!1,u=[],i={current:void 0,moveNext:function(){if(o){if(null==n)return!1;u.push(n),n=r.selectorEnumerator(t(i.current))}else n=e.getEnumerator(),o=!0;for(;!(n&&n.moveNext()||u.length<1);)n=u.pop();return i.current=null==n?void 0:n.current,void 0!==i.current}};return i}function t(e,t,n){var o,u=!1,i=[],c={current:void 0,moveNext:function(){if(u){if(null==o)return!1;i.push(o),o=r.selectorEnumerator(t(c.current))}else o=e.getEnumerator(),u=!0;do{for(;!(o&&o.moveNext()||i.length<1);)o=i.pop();c.current=null==o?void 0:o.current}while(n(c.current));return void 0!==c.current}};return c}r.Enumerable.prototype.traverse=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.Enumerable.prototype.traverseUnique=function(e,n){var o=this,u=[],i=new r.Enumerable;return n?i.getEnumerator=function(){return t(o,e,function(r){return u.some(function(e){return n(r,e)})?!0:(u.push(r),!1)})}:i.getEnumerator=function(){return t(o,e,function(r){return u.indexOf(r)>-1?!0:(u.push(r),!1)})},i},r.List&&(r.List.prototype.traverse=r.Enumerable.prototype.traverse,r.List.prototype.traverseUnique=r.Enumerable.prototype.traverseUnique)}(exjs||(exjs={}));var exjs;!function(r){function e(e,t,n){n=n||function(r,e){return r===e};var o,u,i=[],c={current:void 0,moveNext:function(){if(o||(o=r.en(e).distinct().getEnumerator()),c.current=void 0,!u&&o.moveNext())return i.push(c.current=o.current),!0;for(u=u||r.en(t).distinct().getEnumerator();u.moveNext();){for(var a=0,p=!1,s=i.length;s>a&&!p;a++)p=n(i[a],u.current);if(!p)return c.current=u.current,!0}return!1}};return c}r.Enumerable.prototype.union=function(t,n){var o=this,u=t instanceof Array?t.en():t,i=new r.Enumerable;return i.getEnumerator=function(){return e(o,u,n)},i},r.List&&(r.List.prototype.union=r.Enumerable.prototype.union)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n={current:void 0,moveNext:function(){t||(t=r.getEnumerator());for(var o;t.moveNext();)if(e(o=t.current))return n.current=o,!0;return!1}};return n}r.Enumerable.prototype.where=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.List&&(r.List.prototype.where=r.Enumerable.prototype.where)}(exjs||(exjs={}));var exjs;!function(r){function e(e){var n=new r.Enumerable;return n.getEnumerator=function(){return t(e)},n}function t(r){var e=r.getEnumerator(),t={current:void 0,moveNext:void 0};return t.moveNext=function(){return e.moveNext()?(t.current=e.current,!0):(t.current=void 0,!1)},t}r.en=e}(exjs||(exjs={}));var ex=exjs.en,exjs;!function(r){function e(r,e,t){var n,o,u={current:void 0,moveNext:function(){return n||(n=r.getEnumerator()),o||(o=e.getEnumerator()),u.current=void 0,n.moveNext()&&o.moveNext()?(u.current=t(n.current,o.current),!0):!1}};return u}r.Enumerable.prototype.zip=function(t,n){var o=this,u=t instanceof Array?t.en():t,i=new r.Enumerable;return i.getEnumerator=function(){return e(o,u,n)},i},r.List&&(r.List.prototype.zip=r.Enumerable.prototype.zip)}(exjs||(exjs={})); +//# sourceMappingURL=ex.es3.min.js.map + +// extensions v0.1.11 https://github.com/edsilv/extensions +Array.prototype.clone||(Array.prototype.clone=function(){return this.slice(0)}),Array.prototype.contains||(Array.prototype.contains=function(val){return this.indexOf(val)!==-1}),Array.prototype.indexOf||(Array.prototype.indexOf=function(searchElement,fromIndex){var i=fromIndex||0,j=this.length;for(i;i>>0;if("function"!=typeof callback)throw new TypeError(callback+" is not a function");for(arguments.length>1&&(T=thisArg),A=new Array(len),k=0;k-1&&this.splice(index,1)},Array.prototype.removeAt=function(index){this.splice(index,1)},Math.clamp=function(value,min,max){return Math.min(Math.max(value,min),max)},Math.constrain=function(value,low,high){return Math.clamp(value,low,high)},Math.degreesToRadians=function(degrees){return Math.TAU*(degrees/360)},Math.distanceBetween=function(x1,y1,x2,y2){return Math.sqrt(Math.sq(x2-x1)+Math.sq(y2-y1))},Math.lerp=function(start,stop,amount){return start+(stop-start)*amount},Math.mag=function(a,b,c){return Math.sqrt(a*a+b*b+c*c)},Math.map=function(value,start1,stop1,start2,stop2){return start2+(stop2-start2)*((value-start1)/(stop1-start1))},Math.median=function(values){values.sort(function(a,b){return a-b});var half=Math.floor(values.length/2);return values.length%2?values[half]:(values[half-1]+values[half])/2},Math.normalise=function(num,min,max){return(num-min)/(max-min)},Math.radiansToDegrees=function(radians){return 360*radians/Math.TAU},Math.randomBetween=function(low,high){return high||(high=low,low=0),low>=high?low:low+(high-low)*Math.random()},Math.roundToDecimalPlace=function(num,dec){return Math.round(num*Math.pow(10,dec))/Math.pow(10,dec)},Math.sq=function(n){return n*n},Math.TAU=2*Math.PI,Number.prototype.isInteger||(Number.prototype.isInteger=function(){return this%1===0}),"function"!=typeof Object.create&&(Object.create=function(o,props){function F(){}F.prototype=o;var result=new F;if("object"==typeof props)for(var prop in props)props.hasOwnProperty(prop)&&(result[prop]=props[prop].value);return result}),Object.keys||(Object.keys=function(){var hasOwnProperty=Object.prototype.hasOwnProperty,hasDontEnumBug=!{toString:null}.propertyIsEnumerable("toString"),dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length;return function(obj){if("object"!=typeof obj&&"function"!=typeof obj||null===obj)throw new TypeError("Object.keys called on non-object");var result=[];for(var prop in obj)hasOwnProperty.call(obj,prop)&&result.push(prop);if(hasDontEnumBug)for(var i=0;i=65&&c<=90?"_"+s.toLowerCase():"__"+("000"+c.toString(16)).slice(-4)})},String.prototype.toFileName=function(){return this.replace(/[^a-z0-9]/gi,"_").toLowerCase()},String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}),String.prototype.utf8_to_b64=function(){return window.btoa(unescape(encodeURIComponent(this)))}; +var HTTPStatusCode; +(function (HTTPStatusCode) { + HTTPStatusCode.CONTINUE = 100; + HTTPStatusCode.SWITCHING_PROTOCOLS = 101; + HTTPStatusCode.PROCESSING = 102; + HTTPStatusCode.OK = 200; + HTTPStatusCode.CREATED = 201; + HTTPStatusCode.ACCEPTED = 202; + HTTPStatusCode.NON_AUTHORITATIVE_INFORMATION = 203; + HTTPStatusCode.NO_CONTENT = 204; + HTTPStatusCode.RESET_CONTENT = 205; + HTTPStatusCode.PARTIAL_CONTENT = 206; + HTTPStatusCode.MULTI_STATUS = 207; + HTTPStatusCode.MULTIPLE_CHOICES = 300; + HTTPStatusCode.MOVED_PERMANENTLY = 301; + HTTPStatusCode.MOVED_TEMPORARILY = 302; + HTTPStatusCode.SEE_OTHER = 303; + HTTPStatusCode.NOT_MODIFIED = 304; + HTTPStatusCode.USE_PROXY = 305; + HTTPStatusCode.TEMPORARY_REDIRECT = 307; + HTTPStatusCode.BAD_REQUEST = 400; + HTTPStatusCode.UNAUTHORIZED = 401; + HTTPStatusCode.PAYMENT_REQUIRED = 402; + HTTPStatusCode.FORBIDDEN = 403; + HTTPStatusCode.NOT_FOUND = 404; + HTTPStatusCode.METHOD_NOT_ALLOWED = 405; + HTTPStatusCode.NOT_ACCEPTABLE = 406; + HTTPStatusCode.PROXY_AUTHENTICATION_REQUIRED = 407; + HTTPStatusCode.REQUEST_TIME_OUT = 408; + HTTPStatusCode.CONFLICT = 409; + HTTPStatusCode.GONE = 410; + HTTPStatusCode.LENGTH_REQUIRED = 411; + HTTPStatusCode.PRECONDITION_FAILED = 412; + HTTPStatusCode.REQUEST_ENTITY_TOO_LARGE = 413; + HTTPStatusCode.REQUEST_URI_TOO_LARGE = 414; + HTTPStatusCode.UNSUPPORTED_MEDIA_TYPE = 415; + HTTPStatusCode.REQUESTED_RANGE_NOT_SATISFIABLE = 416; + HTTPStatusCode.EXPECTATION_FAILED = 417; + HTTPStatusCode.IM_A_TEAPOT = 418; + HTTPStatusCode.UNPROCESSABLE_ENTITY = 422; + HTTPStatusCode.LOCKED = 423; + HTTPStatusCode.FAILED_DEPENDENCY = 424; + HTTPStatusCode.UNORDERED_COLLECTION = 425; + HTTPStatusCode.UPGRADE_REQUIRED = 426; + HTTPStatusCode.PRECONDITION_REQUIRED = 428; + HTTPStatusCode.TOO_MANY_REQUESTS = 429; + HTTPStatusCode.REQUEST_HEADER_FIELDS_TOO_LARGE = 431; + HTTPStatusCode.INTERNAL_SERVER_ERROR = 500; + HTTPStatusCode.NOT_IMPLEMENTED = 501; + HTTPStatusCode.BAD_GATEWAY = 502; + HTTPStatusCode.SERVICE_UNAVAILABLE = 503; + HTTPStatusCode.GATEWAY_TIME_OUT = 504; + HTTPStatusCode.HTTP_VERSION_NOT_SUPPORTED = 505; + HTTPStatusCode.VARIANT_ALSO_NEGOTIATES = 506; + HTTPStatusCode.INSUFFICIENT_STORAGE = 507; + HTTPStatusCode.BANDWIDTH_LIMIT_EXCEEDED = 509; + HTTPStatusCode.NOT_EXTENDED = 510; + HTTPStatusCode.NETWORK_AUTHENTICATION_REQUIRED = 511; +})(HTTPStatusCode || (HTTPStatusCode = {})); + +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.manifesto = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o -1 || + this.externalResource.data['@context'].indexOf('/1.1/context.json') > -1 || + this.externalResource.data['@context'].indexOf('/1/context.json') > -1) { + quality = 'native'; + } + } + } + else { + // info.json hasn't been loaded yet + var images = this.getImages(); + if (images && images.length) { + var firstImage = images[0]; + var resource = firstImage.getResource(); + var services = resource.getServices(); + if (!width) { + width = resource.getWidth(); + } + if (services.length) { + var service = services[0]; + id = service.id; + quality = Manifesto.Utils.getImageQuality(service.getProfile()); + } + } + // todo: this is not compatible and should be moved to getThumbUri + if (!id) { + return "undefined" == typeof this.__jsonld.thumbnail + ? null : this.__jsonld.thumbnail; + } + } + size = width + ','; + var uri = [id, region, size, rotation, quality + '.jpg'].join('/'); + return uri; + }; + Canvas.prototype.getImages = function () { + var images = []; + if (!this.__jsonld.images) + return images; + for (var i = 0; i < this.__jsonld.images.length; i++) { + var a = this.__jsonld.images[i]; + var annotation = new Manifesto.Annotation(a, this.options); + images.push(annotation); + } + return images; + }; + Canvas.prototype.getIndex = function () { + return this.getProperty('index'); + }; + // Prefer thumbnail service to image service if supplied and if + // the thumbnail service can provide a satisfactory size +/- x pixels. + // this is used to get thumb URIs *before* the info.json has been requested + // and populate thumbnails in a viewer. + // the publisher may also provide pre-computed fixed-size thumbs for better performance. + //getThumbUri(width: number): string { + // + // var uri; + // var images: IAnnotation[] = this.getImages(); + // + // if (images && images.length) { + // var firstImage = images[0]; + // var resource: IResource = firstImage.getResource(); + // var services: IService[] = resource.getServices(); + // + // for (var i = 0; i < services.length; i++) { + // var service: IService = services[i]; + // var id = service.id; + // + // if (!_endsWith(id, '/')) { + // id += '/'; + // } + // + // uri = id + 'full/' + width + ',/0/' + Utils.getImageQuality(service.getProfile()) + '.jpg'; + // } + // } + // + // return uri; + //} + //getType(): CanvasType { + // return new CanvasType(this.getProperty('@type').toLowerCase()); + //} + Canvas.prototype.getWidth = function () { + return this.getProperty('width'); + }; + Canvas.prototype.getHeight = function () { + return this.getProperty('height'); + }; + return Canvas; + }(Manifesto.Element)); + Manifesto.Canvas = Canvas; +})(Manifesto || (Manifesto = {})); + +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var _assign = require("lodash.assign"); +var Manifesto; +(function (Manifesto) { + var IIIFResource = (function (_super) { + __extends(IIIFResource, _super); + function IIIFResource(jsonld, options) { + _super.call(this, jsonld, options); + this.index = -1; + this.isLoaded = false; + var defaultOptions = { + defaultLabel: '-', + locale: 'en-GB', + resource: this, + pessimisticAccessControl: false + }; + this.options = _assign(defaultOptions, options); + } + IIIFResource.prototype.getAttribution = function () { + var attribution = this.getProperty('attribution'); + if (attribution) { + return Manifesto.TranslationCollection.parse(attribution, this.options.locale); + } + return []; + }; + IIIFResource.prototype.getDescription = function () { + var description = this.getProperty('description'); + if (description) { + return Manifesto.TranslationCollection.parse(description, this.options.locale); + } + return []; + }; + IIIFResource.prototype.getIIIFResourceType = function () { + return new Manifesto.IIIFResourceType(this.getProperty('@type')); + }; + IIIFResource.prototype.getLogo = function () { + var logo = this.getProperty('logo'); + if (!logo) + return null; + if (_isString(logo)) + return logo; + return logo['@id']; + }; + IIIFResource.prototype.getLicense = function () { + return Manifesto.Utils.getLocalisedValue(this.getProperty('license'), this.options.locale); + }; + IIIFResource.prototype.getNavDate = function () { + return new Date(this.getProperty('navDate')); + }; + IIIFResource.prototype.getRelated = function () { + return this.getProperty('related'); + }; + IIIFResource.prototype.getSeeAlso = function () { + return this.getProperty('seeAlso'); + }; + IIIFResource.prototype.getLabel = function () { + var label = this.getProperty('label'); + if (label) { + return Manifesto.TranslationCollection.parse(label, this.options.locale); + } + return []; + }; + IIIFResource.prototype.getDefaultTree = function () { + this.defaultTree = new Manifesto.TreeNode('root'); + this.defaultTree.data = this; + return this.defaultTree; + }; + IIIFResource.prototype.isCollection = function () { + return this.getIIIFResourceType().toString() === Manifesto.IIIFResourceType.COLLECTION.toString(); + }; + IIIFResource.prototype.isManifest = function () { + return this.getIIIFResourceType().toString() === Manifesto.IIIFResourceType.MANIFEST.toString(); + }; + IIIFResource.prototype.load = function () { + var that = this; + return new Promise(function (resolve, reject) { + if (that.isLoaded) { + resolve(that); + } + else { + var options = that.options; + options.navDate = that.getNavDate(); + Manifesto.Utils.loadResource(that.__jsonld['@id']).then(function (data) { + that.parentLabel = Manifesto.TranslationCollection.getValue(that.getLabel(), options.locale); + var parsed = Manifesto.Deserialiser.parse(data, options); + that = _assign(that, parsed); + that.index = options.index; + resolve(that); + }); + } + }); + }; + return IIIFResource; + }(Manifesto.ManifestResource)); + Manifesto.IIIFResource = IIIFResource; +})(Manifesto || (Manifesto = {})); + +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var _isArray = require("lodash.isarray"); +var _map = require("lodash.map"); +var Manifesto; +(function (Manifesto) { + var Manifest = (function (_super) { + __extends(Manifest, _super); + function Manifest(jsonld, options) { + _super.call(this, jsonld, options); + this.index = 0; + this._allRanges = null; + this._sequences = null; + this._topRanges = []; + if (this.__jsonld.structures && this.__jsonld.structures.length) { + var topRanges = this._getTopRanges(); + for (var i = 0; i < topRanges.length; i++) { + var range = topRanges[i]; + this._parseRanges(range, String(i)); + } + } + } + Manifest.prototype.getDefaultTree = function () { + _super.prototype.getDefaultTree.call(this); + this.defaultTree.data.type = Manifesto.TreeNodeType.MANIFEST.toString(); + if (!this.isLoaded) { + return this.defaultTree; + } + var topRanges = this.getTopRanges(); + // if there are any ranges in the manifest, default to the first 'top' range or generated placeholder + if (topRanges.length) { + topRanges[0].getTree(this.defaultTree); + } + Manifesto.Utils.generateTreeNodeIds(this.defaultTree); + return this.defaultTree; + }; + Manifest.prototype._getTopRanges = function () { + var topRanges = []; + if (this.__jsonld.structures && this.__jsonld.structures.length) { + for (var i = 0; i < this.__jsonld.structures.length; i++) { + var json = this.__jsonld.structures[i]; + if (json.viewingHint === Manifesto.ViewingHint.TOP.toString()) { + topRanges.push(json); + } + } + // if no viewingHint="top" range was found, create a default one + if (!topRanges.length) { + var range = {}; + range.ranges = this.__jsonld.structures; + topRanges.push(range); + } + } + return topRanges; + }; + Manifest.prototype.getTopRanges = function () { + return this._topRanges; + }; + Manifest.prototype._getRangeById = function (id) { + if (this.__jsonld.structures && this.__jsonld.structures.length) { + for (var i = 0; i < this.__jsonld.structures.length; i++) { + var r = this.__jsonld.structures[i]; + if (r['@id'] === id) { + return r; + } + } + } + return null; + }; + Manifest.prototype._parseRangeCanvas = function (json, range) { + // todo: currently this isn't needed + //var canvas: IJSONLDResource = new JSONLDResource(json); + //range.members.push(canvas); + }; + Manifest.prototype._parseRanges = function (r, path, parentRange) { + var range; + var id; + if (_isString(r)) { + id = r; + r = this._getRangeById(id); + } + if (!r) { + console.warn("Range:", id, "does not exist"); + return; + } + range = new Manifesto.Range(r, this.options); + range.parentRange = parentRange; + range.path = path; + if (!parentRange) { + this._topRanges.push(range); + } + else { + parentRange.members.push(range); + } + if (r.ranges) { + for (var i = 0; i < r.ranges.length; i++) { + this._parseRanges(r.ranges[i], path + '/' + i, range); + } + } + if (r.members) { + var _loop_1 = function(i) { + var child = r.members[i]; + // only add to members if not already parsed from backwards-compatible ranges/canvases arrays + if (r.members.en().where(function (m) { return m.id === child.id; }).first()) { + return "continue"; + } + if (child['@type'].toLowerCase() === 'sc:range') { + this_1._parseRanges(child, path + '/' + i, range); + } + }; + var this_1 = this; + for (var i = 0; i < r.members.length; i++) { + var state_1 = _loop_1(i); + if (state_1 === "continue") continue; + } + } + }; + Manifest.prototype.getAllRanges = function () { + if (this._allRanges != null) + return this._allRanges; + this._allRanges = []; + var topRanges = this.getTopRanges(); + for (var i = 0; i < topRanges.length; i++) { + var topRange = topRanges[i]; + if (topRange.id) { + this._allRanges.push(topRange); // it might be a placeholder root range + } + var subRanges = topRange.getRanges(); + this._allRanges = this._allRanges.concat(subRanges.en().traverseUnique(function (range) { return range.getRanges(); }).toArray()); + } + return this._allRanges; + }; + Manifest.prototype.getRangeById = function (id) { + var ranges = this.getAllRanges(); + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i]; + if (range.id === id) { + return range; + } + } + return null; + }; + Manifest.prototype.getRangeByPath = function (path) { + var ranges = this.getAllRanges(); + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i]; + if (range.path === path) { + return range; + } + } + return null; + }; + Manifest.prototype.getSequences = function () { + if (this._sequences != null) + return this._sequences; + this._sequences = []; + // if IxIF mediaSequences is present, use that. Otherwise fall back to IIIF sequences. + var children = this.__jsonld.mediaSequences || this.__jsonld.sequences; + if (children) { + for (var i = 0; i < children.length; i++) { + var s = children[i]; + var sequence = new Manifesto.Sequence(s, this.options); + this._sequences.push(sequence); + } + } + return this._sequences; + }; + Manifest.prototype.getSequenceByIndex = function (sequenceIndex) { + return this.getSequences()[sequenceIndex]; + }; + Manifest.prototype.getTotalSequences = function () { + return this.getSequences().length; + }; + Manifest.prototype.getManifestType = function () { + var service = this.getService(Manifesto.ServiceProfile.UIEXTENSIONS); + if (service) { + return new Manifesto.ManifestType(service.getProperty('manifestType')); + } + return new Manifesto.ManifestType(''); + }; + Manifest.prototype.getTrackingLabel = function () { + var service = this.getService(Manifesto.ServiceProfile.TRACKINGEXTENSIONS); + if (service) { + return service.getProperty('trackingLabel'); + } + return ''; + }; + Manifest.prototype.isMultiSequence = function () { + return this.getTotalSequences() > 1; + }; + Manifest.prototype.isPagingEnabled = function () { + return this.getViewingHint().toString() === Manifesto.ViewingHint.PAGED.toString(); + }; + Manifest.prototype.getViewingDirection = function () { + if (this.getProperty('viewingDirection')) { + return new Manifesto.ViewingDirection(this.getProperty('viewingDirection')); + } + return Manifesto.ViewingDirection.LEFTTORIGHT; + }; + Manifest.prototype.getViewingHint = function () { + if (this.getProperty('viewingHint')) { + return new Manifesto.ViewingHint(this.getProperty('viewingHint')); + } + return Manifesto.ViewingHint.EMPTY; + }; + return Manifest; + }(Manifesto.IIIFResource)); + Manifesto.Manifest = Manifest; +})(Manifesto || (Manifesto = {})); + +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Manifesto; +(function (Manifesto) { + var Collection = (function (_super) { + __extends(Collection, _super); + function Collection(jsonld, options) { + _super.call(this, jsonld, options); + this.members = []; + this._collections = null; + this._manifests = null; + jsonld.__collection = this; + } + Collection.prototype.getCollections = function () { + if (this._collections) { + return this._collections; + } + return this._collections = this.members.en().where(function (m) { return m.isCollection(); }).toArray(); + }; + Collection.prototype.getManifests = function () { + if (this._manifests) { + return this._manifests; + } + return this._manifests = this.members.en().where(function (m) { return m.isManifest(); }).toArray(); + }; + Collection.prototype.getCollectionByIndex = function (collectionIndex) { + var collection = this.getCollections()[collectionIndex]; + collection.options.index = collectionIndex; + // id for collection MUST be dereferenceable + return collection.load(); + }; + Collection.prototype.getManifestByIndex = function (manifestIndex) { + var manifest = this.getManifests()[manifestIndex]; + manifest.options.index = manifestIndex; + return manifest.load(); + }; + Collection.prototype.getTotalCollections = function () { + return this.getCollections().length; + }; + Collection.prototype.getTotalManifests = function () { + return this.getManifests().length; + }; + Collection.prototype.getTotalMembers = function () { + return this.members.length; + }; + /** + * Get a tree of sub collections and manifests, using each child manifest's first 'top' range. + */ + Collection.prototype.getDefaultTree = function () { + _super.prototype.getDefaultTree.call(this); + this.defaultTree.data.type = Manifesto.TreeNodeType.COLLECTION.toString(); + this._parseManifests(this); + this._parseCollections(this); + Manifesto.Utils.generateTreeNodeIds(this.defaultTree); + return this.defaultTree; + }; + Collection.prototype._parseManifests = function (parentCollection) { + if (parentCollection.getManifests() && parentCollection.getManifests().length) { + for (var i = 0; i < parentCollection.getManifests().length; i++) { + var manifest = parentCollection.getManifests()[i]; + var tree = manifest.getDefaultTree(); + tree.label = manifest.parentLabel || Manifesto.TranslationCollection.getValue(manifest.getLabel(), this.options.locale) || 'manifest ' + (i + 1); + tree.navDate = manifest.getNavDate(); + tree.data.id = manifest.id; + tree.data.type = Manifesto.TreeNodeType.MANIFEST.toString(); + parentCollection.defaultTree.addNode(tree); + } + } + }; + Collection.prototype._parseCollections = function (parentCollection) { + if (parentCollection.getCollections() && parentCollection.getCollections().length) { + for (var i = 0; i < parentCollection.getCollections().length; i++) { + var collection = parentCollection.getCollections()[i]; + var tree = collection.getDefaultTree(); + tree.label = collection.parentLabel || Manifesto.TranslationCollection.getValue(collection.getLabel(), this.options.locale) || 'collection ' + (i + 1); + tree.navDate = collection.getNavDate(); + tree.data.id = collection.id; + tree.data.type = Manifesto.TreeNodeType.COLLECTION.toString(); + parentCollection.defaultTree.addNode(tree); + this._parseCollections(collection); + } + } + }; + return Collection; + }(Manifesto.IIIFResource)); + Manifesto.Collection = Collection; +})(Manifesto || (Manifesto = {})); + +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Manifesto; +(function (Manifesto) { + var Range = (function (_super) { + __extends(Range, _super); + function Range(jsonld, options) { + _super.call(this, jsonld, options); + this._canvases = null; + this._ranges = null; + this.members = []; + } + Range.prototype.getCanvasIds = function () { + if (this.__jsonld.canvases) { + return this.__jsonld.canvases; + } + return []; + }; + Range.prototype.getCanvases = function () { + if (this._canvases) { + return this._canvases; + } + return this._canvases = this.members.en().where(function (m) { return m.isCanvas(); }).toArray(); + }; + Range.prototype.getRanges = function () { + if (this._ranges) { + return this._ranges; + } + return this._ranges = this.members.en().where(function (m) { return m.isRange(); }).toArray(); + }; + Range.prototype.getViewingDirection = function () { + if (this.getProperty('viewingDirection')) { + return new Manifesto.ViewingDirection(this.getProperty('viewingDirection')); + } + return null; + }; + Range.prototype.getViewingHint = function () { + if (this.getProperty('viewingHint')) { + return new Manifesto.ViewingHint(this.getProperty('viewingHint')); + } + return null; + }; + Range.prototype.getTree = function (treeRoot) { + treeRoot.data = this; + this.treeNode = treeRoot; + var ranges = this.getRanges(); + if (ranges && ranges.length) { + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i]; + var node = new Manifesto.TreeNode(); + treeRoot.addNode(node); + this._parseTreeNode(node, range); + } + } + Manifesto.Utils.generateTreeNodeIds(treeRoot); + return treeRoot; + }; + Range.prototype._parseTreeNode = function (node, range) { + node.label = Manifesto.TranslationCollection.getValue(range.getLabel(), this.options.locale); + node.data = range; + node.data.type = Manifesto.TreeNodeType.RANGE.toString(); + range.treeNode = node; + var ranges = range.getRanges(); + if (ranges && ranges.length) { + for (var i = 0; i < ranges.length; i++) { + var childRange = ranges[i]; + var childNode = new Manifesto.TreeNode(); + node.addNode(childNode); + this._parseTreeNode(childNode, childRange); + } + } + }; + return Range; + }(Manifesto.ManifestResource)); + Manifesto.Range = Range; +})(Manifesto || (Manifesto = {})); + +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Manifesto; +(function (Manifesto) { + var Rendering = (function (_super) { + __extends(Rendering, _super); + function Rendering(jsonld, options) { + _super.call(this, jsonld, options); + } + Rendering.prototype.getFormat = function () { + return new Manifesto.RenderingFormat(this.getProperty('format')); + }; + return Rendering; + }(Manifesto.ManifestResource)); + Manifesto.Rendering = Rendering; +})(Manifesto || (Manifesto = {})); + +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var _last = require("lodash.last"); +var Manifesto; +(function (Manifesto) { + var Sequence = (function (_super) { + __extends(Sequence, _super); + function Sequence(jsonld, options) { + _super.call(this, jsonld, options); + this.canvases = null; + } + Sequence.prototype.getCanvases = function () { + if (this.canvases != null) + return this.canvases; + this.canvases = []; + // if IxIF elements are present, use them. Otherwise fall back to IIIF canvases. + var children = this.__jsonld.elements || this.__jsonld.canvases; + if (children) { + for (var i = 0; i < children.length; i++) { + var c = children[i]; + var canvas = new Manifesto.Canvas(c, this.options); + canvas.index = i; + this.canvases.push(canvas); + } + } + return this.canvases; + }; + Sequence.prototype.getCanvasById = function (id) { + for (var i = 0; i < this.getTotalCanvases(); i++) { + var canvas = this.getCanvasByIndex(i); + if (canvas.id === id) { + return canvas; + } + } + return null; + }; + Sequence.prototype.getCanvasByIndex = function (canvasIndex) { + return this.getCanvases()[canvasIndex]; + }; + Sequence.prototype.getCanvasIndexById = function (id) { + for (var i = 0; i < this.getTotalCanvases(); i++) { + var canvas = this.getCanvasByIndex(i); + if (canvas.id === id) { + return i; + } + } + return null; + }; + Sequence.prototype.getCanvasIndexByLabel = function (label, foliated) { + label = label.trim(); + if (!isNaN(label)) { + label = parseInt(label, 10).toString(); // trim any preceding zeros. + if (foliated) + label += 'r'; // default to recto + } + var doublePageRegExp = /(\d*)\D+(\d*)/; + var match, regExp, regStr, labelPart1, labelPart2; + for (var i = 0; i < this.getTotalCanvases(); i++) { + var canvas = this.getCanvasByIndex(i); + // check if there's a literal match + if (Manifesto.TranslationCollection.getValue(canvas.getLabel(), this.options.locale) === label) { + return i; + } + // check if there's a match for double-page spreads e.g. 100-101, 100_101, 100 101 + match = doublePageRegExp.exec(label); + if (!match) + continue; + labelPart1 = match[1]; + labelPart2 = match[2]; + if (!labelPart2) + continue; + regStr = "^" + labelPart1 + "\\D+" + labelPart2 + "$"; + regExp = new RegExp(regStr); + if (regExp.test(canvas.getLabel())) { + return i; + } + } + return -1; + }; + Sequence.prototype.getLastCanvasLabel = function (alphanumeric) { + for (var i = this.getTotalCanvases() - 1; i >= 0; i--) { + var canvas = this.getCanvasByIndex(i); + var label = Manifesto.TranslationCollection.getValue(canvas.getLabel(), this.options.locale); + if (alphanumeric) { + var regExp = /^[a-zA-Z0-9]*$/; + if (regExp.test(label)) { + return label; + } + } + else if (label) { + return label; + } + } + return this.options.defaultLabel; + }; + Sequence.prototype.getLastPageIndex = function () { + return this.getTotalCanvases() - 1; + }; + Sequence.prototype.getNextPageIndex = function (canvasIndex, pagingEnabled) { + var index; + if (pagingEnabled) { + var indices = this.getPagedIndices(canvasIndex); + if (this.getViewingDirection().toString() === Manifesto.ViewingDirection.RIGHTTOLEFT.toString()) { + index = indices[0] + 1; + } + else { + index = _last(indices) + 1; + } + } + else { + index = canvasIndex + 1; + } + if (index > this.getLastPageIndex()) { + return -1; + } + return index; + }; + Sequence.prototype.getPagedIndices = function (canvasIndex, pagingEnabled) { + var indices = []; + if (!pagingEnabled) { + indices.push(canvasIndex); + } + else { + if (this.isFirstCanvas(canvasIndex) || this.isLastCanvas(canvasIndex)) { + indices = [canvasIndex]; + } + else if (canvasIndex % 2) { + indices = [canvasIndex, canvasIndex + 1]; + } + else { + indices = [canvasIndex - 1, canvasIndex]; + } + if (this.getViewingDirection().toString() === Manifesto.ViewingDirection.RIGHTTOLEFT.toString()) { + indices = indices.reverse(); + } + } + return indices; + }; + Sequence.prototype.getPrevPageIndex = function (canvasIndex, pagingEnabled) { + var index; + if (pagingEnabled) { + var indices = this.getPagedIndices(canvasIndex); + if (this.getViewingDirection().toString() === Manifesto.ViewingDirection.RIGHTTOLEFT.toString()) { + index = _last(indices) - 1; + } + else { + index = indices[0] - 1; + } + } + else { + index = canvasIndex - 1; + } + return index; + }; + Sequence.prototype.getStartCanvasIndex = function () { + var startCanvas = this.getStartCanvas(); + if (startCanvas) { + // if there's a startCanvas attribute, loop through the canvases and return the matching index. + for (var i = 0; i < this.getTotalCanvases(); i++) { + var canvas = this.getCanvasByIndex(i); + if (canvas.id === startCanvas) + return i; + } + } + // default to first canvas. + return 0; + }; + Sequence.prototype.getThumbs = function (width, height) { + var thumbs = []; + var totalCanvases = this.getTotalCanvases(); + for (var i = 0; i < totalCanvases; i++) { + var canvas = this.getCanvasByIndex(i); + thumbs.push(new Manifesto.Thumb(width, canvas)); + } + return thumbs; + }; + Sequence.prototype.getStartCanvas = function () { + return this.getProperty('startCanvas'); + }; + Sequence.prototype.getTotalCanvases = function () { + return this.getCanvases().length; + }; + Sequence.prototype.getViewingDirection = function () { + if (this.getProperty('viewingDirection')) { + return new Manifesto.ViewingDirection(this.getProperty('viewingDirection')); + } + else if (this.options.resource.getViewingDirection) { + return this.options.resource.getViewingDirection(); + } + return Manifesto.ViewingDirection.LEFTTORIGHT; + }; + Sequence.prototype.getViewingHint = function () { + if (this.getProperty('viewingHint')) { + return new Manifesto.ViewingHint(this.getProperty('viewingHint')); + } + return Manifesto.ViewingHint.EMPTY; + }; + Sequence.prototype.isCanvasIndexOutOfRange = function (canvasIndex) { + return canvasIndex > this.getTotalCanvases() - 1; + }; + Sequence.prototype.isFirstCanvas = function (canvasIndex) { + return canvasIndex === 0; + }; + Sequence.prototype.isLastCanvas = function (canvasIndex) { + return canvasIndex === this.getTotalCanvases() - 1; + }; + Sequence.prototype.isMultiCanvas = function () { + return this.getTotalCanvases() > 1; + }; + Sequence.prototype.isPagingEnabled = function () { + return this.getViewingHint().toString() === Manifesto.ViewingHint.PAGED.toString(); + }; + // checks if the number of canvases is even - therefore has a front and back cover + Sequence.prototype.isTotalCanvasesEven = function () { + return this.getTotalCanvases() % 2 === 0; + }; + return Sequence; + }(Manifesto.ManifestResource)); + Manifesto.Sequence = Sequence; +})(Manifesto || (Manifesto = {})); + +var _isString = require("lodash.isstring"); +var Manifesto; +(function (Manifesto) { + var Deserialiser = (function () { + function Deserialiser() { + } + Deserialiser.parse = function (manifest, options) { + return this.parseJson(JSON.parse(manifest), options); + }; + Deserialiser.parseJson = function (json, options) { + var resource; + // have options been passed for the manifest to inherit? + if (options) { + if (options.navDate && !isNaN(options.navDate.getTime())) { + json.navDate = options.navDate.toString(); + } + } + switch (json['@type']) { + case 'sc:Collection': + resource = this.parseCollection(json, options); + break; + case 'sc:Manifest': + resource = this.parseManifest(json, options); + break; + default: + return null; + } + // Top-level resource was loaded from a URI, so flag it to prevent + // unnecessary reload: + resource.isLoaded = true; + return resource; + }; + Deserialiser.parseCollection = function (json, options) { + var collection = new Manifesto.Collection(json, options); + if (options) { + collection.index = options.index || 0; + } + else { + collection.index = 0; + } + this.parseCollections(collection, options); + this.parseManifests(collection, options); + this.parseMembers(collection, options); + return collection; + }; + Deserialiser.parseCollections = function (collection, options) { + var children = collection.__jsonld.collections; + if (children) { + for (var i = 0; i < children.length; i++) { + if (options) { + options.index = i; + } + var child = this.parseCollection(children[i], options); + child.index = i; + child.parentCollection = collection; + collection.members.push(child); + } + } + }; + Deserialiser.parseManifest = function (json, options) { + var manifest = new Manifesto.Manifest(json, options); + return manifest; + }; + Deserialiser.parseManifests = function (collection, options) { + var children = collection.__jsonld.manifests; + if (children) { + for (var i = 0; i < children.length; i++) { + var child = this.parseManifest(children[i], options); + child.index = i; + child.parentCollection = collection; + collection.members.push(child); + } + } + }; + Deserialiser.parseMember = function (json, options) { + if (json['@type'].toLowerCase() === 'sc:manifest') { + return this.parseManifest(json, options); + } + else if (json['@type'].toLowerCase() === 'sc:collection') { + return this.parseCollection(json, options); + } + }; + Deserialiser.parseMembers = function (collection, options) { + var children = collection.__jsonld.members; + if (children) { + for (var i = 0; i < children.length; i++) { + if (options) { + options.index = i; + } + var child = this.parseMember(children[i], options); + // only add to members if not already parsed from backwards-compatible collections/manifests arrays + if (collection.members.en().where(function (m) { return m.id === child.id; }).first()) { + continue; + } + child.index = i; + child.parentCollection = collection; + collection.members.push(child); + } + } + }; + return Deserialiser; + }()); + Manifesto.Deserialiser = Deserialiser; + var Serialiser = (function () { + function Serialiser() { + } + Serialiser.serialise = function (manifest) { + // todo + return ""; + }; + return Serialiser; + }()); + Manifesto.Serialiser = Serialiser; +})(Manifesto || (Manifesto = {})); + +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var _endsWith = require("lodash.endswith"); +var _isArray = require("lodash.isarray"); +var Manifesto; +(function (Manifesto) { + var Service = (function (_super) { + __extends(Service, _super); + function Service(jsonld, options) { + _super.call(this, jsonld, options); + } + Service.prototype.getProfile = function () { + var profile = this.getProperty('profile'); + if (!profile) { + profile = this.getProperty('dcterms:conformsTo'); + } + if (_isArray(profile)) { + return new Manifesto.ServiceProfile(profile[0]); + } + return new Manifesto.ServiceProfile(profile); + }; + Service.prototype.getDescription = function () { + return Manifesto.Utils.getLocalisedValue(this.getProperty('description'), this.options.locale); + }; + Service.prototype.getInfoUri = function () { + var infoUri = this.id; + if (!_endsWith(infoUri, '/')) { + infoUri += '/'; + } + infoUri += 'info.json'; + return infoUri; + }; + return Service; + }(Manifesto.ManifestResource)); + Manifesto.Service = Service; +})(Manifesto || (Manifesto = {})); + + + +var Manifesto; +(function (Manifesto) { + var Thumb = (function () { + function Thumb(width, canvas) { + this.data = canvas; + this.index = canvas.index; + this.width = width; + var heightRatio = canvas.getHeight() / canvas.getWidth(); + if (heightRatio) { + this.height = Math.floor(this.width * heightRatio); + } + else { + this.height = width; + } + this.uri = canvas.getCanonicalImageUri(width); + this.label = Manifesto.TranslationCollection.getValue(canvas.getLabel()); // todo: pass locale? + } + return Thumb; + }()); + Manifesto.Thumb = Thumb; +})(Manifesto || (Manifesto = {})); + + + +var Manifesto; +(function (Manifesto) { + var TreeNode = (function () { + function TreeNode(label, data) { + this.label = label; + this.data = data || {}; + this.nodes = []; + } + TreeNode.prototype.addNode = function (node) { + this.nodes.push(node); + node.parentNode = this; + }; + TreeNode.prototype.isCollection = function () { + return this.data.type === Manifesto.TreeNodeType.COLLECTION.toString(); + }; + TreeNode.prototype.isManifest = function () { + return this.data.type === Manifesto.TreeNodeType.MANIFEST.toString(); + }; + TreeNode.prototype.isRange = function () { + return this.data.type === Manifesto.TreeNodeType.RANGE.toString(); + }; + return TreeNode; + }()); + Manifesto.TreeNode = TreeNode; +})(Manifesto || (Manifesto = {})); + +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Manifesto; +(function (Manifesto) { + var TreeNodeType = (function (_super) { + __extends(TreeNodeType, _super); + function TreeNodeType() { + _super.apply(this, arguments); + } + // todo: use getters when ES3 target is no longer required. + TreeNodeType.prototype.collection = function () { + return new TreeNodeType(TreeNodeType.COLLECTION.toString()); + }; + TreeNodeType.prototype.manifest = function () { + return new TreeNodeType(TreeNodeType.MANIFEST.toString()); + }; + TreeNodeType.prototype.range = function () { + return new TreeNodeType(TreeNodeType.RANGE.toString()); + }; + TreeNodeType.COLLECTION = new TreeNodeType("sc:collection"); + TreeNodeType.MANIFEST = new TreeNodeType("sc:manifest"); + TreeNodeType.RANGE = new TreeNodeType("sc:range"); + return TreeNodeType; + }(Manifesto.StringValue)); + Manifesto.TreeNodeType = TreeNodeType; +})(Manifesto || (Manifesto = {})); + +var http = require("http"); +var https = require("https"); +var url = require("url"); +var Manifesto; +(function (Manifesto) { + var Utils = (function () { + function Utils() { + } + Utils.getImageQuality = function (profile) { + var p = profile.toString(); + if (p === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE1.toString() || + p === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE2.toString() || + p === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE1.toString() || + p === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE2.toString() || + p === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE1.toString() || + p === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE2.toString() || + p === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE1.toString() || + p === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE2.toString() || + p === Manifesto.ServiceProfile.IIIF1IMAGELEVEL1.toString() || + p === Manifesto.ServiceProfile.IIIF1IMAGELEVEL1PROFILE.toString() || + p === Manifesto.ServiceProfile.IIIF1IMAGELEVEL2.toString() || + p === Manifesto.ServiceProfile.IIIF1IMAGELEVEL2PROFILE.toString()) { + return 'native'; + } + return 'default'; + }; + Utils.getInexactLocale = function (locale) { + if (locale.indexOf('-') !== -1) { + return locale.substr(0, locale.indexOf('-')); + } + return locale; + }; + Utils.getLocalisedValue = function (resource, locale) { + // if the resource is not an array of translations, return the string. + if (!_isArray(resource)) { + return resource; + } + // test for exact match + for (var i = 0; i < resource.length; i++) { + var value = resource[i]; + var language = value['@language']; + if (locale === language) { + return value['@value']; + } + } + // test for inexact match + var match = locale.substr(0, locale.indexOf('-')); + for (var i = 0; i < resource.length; i++) { + var value = resource[i]; + var language = value['@language']; + if (language === match) { + return value['@value']; + } + } + return null; + }; + Utils.generateTreeNodeIds = function (treeNode, index) { + if (index === void 0) { index = 0; } + var id; + if (!treeNode.parentNode) { + id = '0'; + } + else { + id = treeNode.parentNode.id + "-" + index; + } + treeNode.id = id; + for (var i = 0; i < treeNode.nodes.length; i++) { + var n = treeNode.nodes[i]; + Utils.generateTreeNodeIds(n, i); + } + }; + Utils.isImageProfile = function (profile) { + if (profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE0.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE1.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE2.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE0.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE1.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE2.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE0.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE1.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE2.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE0.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE1.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE2.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL0.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL0PROFILE.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL1.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL1PROFILE.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL2.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL2PROFILE.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL0.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL0PROFILE.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL1.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL1PROFILE.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL2.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL2PROFILE.toString()) { + return true; + } + return false; + }; + Utils.isLevel0ImageProfile = function (profile) { + if (profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE0.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE0.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE0.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE0.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL0.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL0PROFILE.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL0.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL0PROFILE.toString()) { + return true; + } + return false; + }; + Utils.isLevel1ImageProfile = function (profile) { + if (profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE1.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE1.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE1.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE1.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL1.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL1PROFILE.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL1.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL1PROFILE.toString()) { + return true; + } + return false; + }; + Utils.isLevel2ImageProfile = function (profile) { + if (profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE2.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE2.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE2.toString() || + profile.toString() === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE2.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL2.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF1IMAGELEVEL2PROFILE.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL2.toString() || + profile.toString() === Manifesto.ServiceProfile.IIIF2IMAGELEVEL2PROFILE.toString()) { + return true; + } + return false; + }; + Utils.loadResource = function (uri) { + return new Promise(function (resolve, reject) { + var u = url.parse(uri); + var request; + var opts = { + host: u.hostname, + port: u.port, + path: u.path, + method: "GET", + withCredentials: false + }; + if (u.protocol === 'https:') { + request = https.request(opts, function (response) { + var result = ""; + response.on('data', function (chunk) { + result += chunk; + }); + response.on('end', function () { + resolve(result); + }); + }); + } + else { + request = http.request(opts, function (response) { + var result = ""; + response.on('data', function (chunk) { + result += chunk; + }); + response.on('end', function () { + resolve(result); + }); + }); + } + request.on('error', function (error) { + reject(error); + }); + request.end(); + }); + }; + Utils.loadExternalResource = function (resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken, handleResourceResponse, options) { + return new Promise(function (resolve, reject) { + if (options && options.pessimisticAccessControl) { + // pessimistic: access control cookies may have been deleted. + // always request the access token for every access controlled info.json request + // returned access tokens are not stored, therefore the login window flashes for every request. + resource.getData().then(function () { + if (resource.isAccessControlled()) { + // if the resource has a click through service, use that. + if (resource.clickThroughService) { + resolve(clickThrough(resource)); + } + else if (resource.restrictedService) { + resolve(restricted(resource)); + } + else { + login(resource).then(function () { + getAccessToken(resource, true).then(function (token) { + resource.getData(token).then(function () { + resolve(handleResourceResponse(resource)); + })["catch"](function (message) { + reject(Utils.createInternalServerError(message)); + }); + })["catch"](function (message) { + reject(Utils.createInternalServerError(message)); + }); + })["catch"](function (message) { + reject(Utils.createInternalServerError(message)); + }); + } + } + else { + // this info.json isn't access controlled, therefore no need to request an access token. + resolve(resource); + } + })["catch"](function (message) { + reject(Utils.createInternalServerError(message)); + }); + } + else { + // optimistic: access control cookies may not have been deleted. + // store access tokens to avoid login window flashes. + // if cookies are deleted a page refresh is required. + // try loading the resource using an access token that matches the info.json domain. + // if an access token is found, request the resource using it regardless of whether it is access controlled. + getStoredAccessToken(resource, tokenStorageStrategy).then(function (storedAccessToken) { + if (storedAccessToken) { + // try using the stored access token + resource.getData(storedAccessToken).then(function () { + // if the info.json loaded using the stored access token + if (resource.status === HTTPStatusCode.OK) { + resolve(handleResourceResponse(resource)); + } + else { + // otherwise, load the resource data to determine the correct access control services. + // if access controlled, do login. + Utils.authorize(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken).then(function () { + resolve(handleResourceResponse(resource)); + })["catch"](function (error) { + if (resource.restrictedService) { + reject(Utils.createRestrictedError()); + } + else { + reject(Utils.createAuthorizationFailedError()); + } + }); + } + })["catch"](function (error) { + reject(Utils.createAuthorizationFailedError()); + }); + } + else { + Utils.authorize(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken).then(function () { + resolve(handleResourceResponse(resource)); + })["catch"](function (error) { + reject(Utils.createAuthorizationFailedError()); + }); + } + })["catch"](function (error) { + reject(Utils.createAuthorizationFailedError()); + }); + } + }); + }; + Utils.createError = function (name, message) { + var error = new Error(); + error.message = message; + error.name = name; + return error; + }; + Utils.createAuthorizationFailedError = function () { + return Utils.createError(manifesto.StatusCodes.AUTHORIZATION_FAILED.toString(), "Authorization failed"); + }; + Utils.createRestrictedError = function () { + return Utils.createError(manifesto.StatusCodes.RESTRICTED.toString(), "Restricted"); + }; + Utils.createInternalServerError = function (message) { + return Utils.createError(manifesto.StatusCodes.INTERNAL_SERVER_ERROR.toString(), message); + }; + Utils.loadExternalResources = function (resources, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken, handleResourceResponse, options) { + return new Promise(function (resolve, reject) { + var promises = _map(resources, function (resource) { + return Utils.loadExternalResource(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken, handleResourceResponse, options); + }); + Promise.all(promises) + .then(function () { + resolve(resources); + })["catch"](function (error) { + reject(error); + }); + }); + }; + Utils.authorize = function (resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken) { + return new Promise(function (resolve, reject) { + resource.getData().then(function () { + if (resource.isAccessControlled()) { + getStoredAccessToken(resource, tokenStorageStrategy).then(function (storedAccessToken) { + if (storedAccessToken) { + // try using the stored access token + resource.getData(storedAccessToken).then(function () { + if (resource.status === HTTPStatusCode.OK) { + resolve(resource); // happy path ended + } + else { + // the stored token is no good for this resource + Utils.showAuthInteraction(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, resolve, reject); + } + })["catch"](function (message) { + reject(Utils.createInternalServerError(message)); + }); + } + else { + // There was no stored token, but the user might have a cookie that will grant a token + getAccessToken(resource, false).then(function (accessToken) { + if (accessToken) { + storeAccessToken(resource, accessToken, tokenStorageStrategy).then(function () { + // try using the fresh access token + resource.getData(accessToken).then(function () { + if (resource.status === HTTPStatusCode.OK) { + resolve(resource); + } + else { + // User has a token, but it's not good enough + Utils.showAuthInteraction(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, resolve, reject); + } + })["catch"](function (message) { + reject(Utils.createInternalServerError(message)); + }); + })["catch"](function (message) { + // not able to store access token + reject(Utils.createInternalServerError(message)); + }); + } + else { + // The user did not have a cookie that granted a token + Utils.showAuthInteraction(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, resolve, reject); + } + }); + } + })["catch"](function (message) { + reject(Utils.createInternalServerError(message)); + }); + } + else { + // this info.json isn't access controlled, therefore there's no need to request an access token + resolve(resource); + } + }); + }); + }; + Utils.showAuthInteraction = function (resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, resolve, reject) { + if (resource.status === HTTPStatusCode.MOVED_TEMPORARILY && !resource.isResponseHandled) { + // if the resource was redirected to a degraded version + // and the response hasn't been handled yet. + // if the client wishes to trigger a login, set resource.isResponseHandled to true + // and call loadExternalResources() again passing the resource. + resolve(resource); + } + else if (resource.restrictedService) { + resolve(restricted(resource)); + } + else if (resource.clickThroughService && !resource.isResponseHandled) { + // if the resource has a click through service, use that. + clickThrough(resource).then(function () { + getAccessToken(resource, true).then(function (accessToken) { + storeAccessToken(resource, accessToken, tokenStorageStrategy).then(function () { + resource.getData(accessToken).then(function () { + resolve(resource); + })["catch"](function (message) { + reject(Utils.createInternalServerError(message)); + }); + })["catch"](function (message) { + reject(Utils.createInternalServerError(message)); + }); + })["catch"](function (message) { + reject(Utils.createInternalServerError(message)); + }); + }); + } + else { + // get an access token + login(resource).then(function () { + getAccessToken(resource, true).then(function (accessToken) { + storeAccessToken(resource, accessToken, tokenStorageStrategy).then(function () { + resource.getData(accessToken).then(function () { + resolve(resource); + })["catch"](function (message) { + reject(Utils.createInternalServerError(message)); + }); + })["catch"](function (message) { + reject(Utils.createInternalServerError(message)); + }); + })["catch"](function (message) { + reject(Utils.createInternalServerError(message)); + }); + }); + } + }; + ; + Utils.getService = function (resource, profile) { + var services = this.getServices(resource); + // coerce profile to string + if (typeof profile !== 'string') { + profile = profile.toString(); + } + for (var i = 0; i < services.length; i++) { + var service = services[i]; + if (service.getProfile().toString() === profile) { + return service; + } + } + return null; + }; + Utils.getResourceById = function (parentResource, id) { + return [parentResource.__jsonld].en().traverseUnique(function (x) { return Utils.getAllArrays(x); }) + .first(function (r) { return r['@id'] === id; }); + }; + Utils.getAllArrays = function (obj) { + var all = [].en(); + if (!obj) + return all; + for (var key in obj) { + var val = obj[key]; + if (_isArray(val)) { + all = all.concat(val); + } + } + return all; + }; + Utils.getServices = function (resource) { + var service; + // if passing a manifesto-parsed object, use the __jsonld.service property, + // otherwise look for a service property (info.json services) + if (resource.__jsonld) { + service = resource.__jsonld.service; + } + else { + service = resource.service; + } + var services = []; + if (!service) + return services; + // coerce to array + if (!_isArray(service)) { + service = [service]; + } + for (var i = 0; i < service.length; i++) { + var s = service[i]; + if (_isString(s)) { + var r = this.getResourceById(resource.options.resource, s); + if (r) { + services.push(new Manifesto.Service(r.__jsonld || r, resource.options)); + } + } + else { + services.push(new Manifesto.Service(s, resource.options)); + } + } + return services; + }; + return Utils; + }()); + Manifesto.Utils = Utils; +})(Manifesto || (Manifesto = {})); + +var Manifesto; +(function (Manifesto) { + var MetadataItem = (function () { + function MetadataItem(defaultLocale) { + this.defaultLocale = defaultLocale; + } + MetadataItem.prototype.parse = function (resource) { + this.resource = resource; + this.label = Manifesto.TranslationCollection.parse(this.resource.label, this.defaultLocale); + this.value = Manifesto.TranslationCollection.parse(this.resource.value, this.defaultLocale); + }; + // shortcuts to get/set values based on default locale + MetadataItem.prototype.getLabel = function () { + if (this.label) { + return Manifesto.TranslationCollection.getValue(this.label, this.defaultLocale); + } + return null; + }; + MetadataItem.prototype.setLabel = function (value) { + var _this = this; + if (this.label && this.label.length) { + var t = this.label.en().where(function (x) { return x.locale === _this.defaultLocale || x.locale === Manifesto.Utils.getInexactLocale(_this.defaultLocale); }).first(); + if (t) + t.value = value; + } + }; + MetadataItem.prototype.getValue = function () { + if (this.value) { + var locale = this.defaultLocale; + // if the label has a locale, prefer that to the default locale + if (this.label.length && this.label[0].locale) { + locale = this.label[0].locale; + } + return Manifesto.TranslationCollection.getValue(this.value, locale); + } + return null; + }; + MetadataItem.prototype.setValue = function (value) { + var _this = this; + if (this.value && this.value.length) { + var t = this.value.en().where(function (x) { return x.locale === _this.defaultLocale || x.locale === Manifesto.Utils.getInexactLocale(_this.defaultLocale); }).first(); + if (t) + t.value = value; + } + }; + return MetadataItem; + }()); + Manifesto.MetadataItem = MetadataItem; +})(Manifesto || (Manifesto = {})); + +var Manifesto; +(function (Manifesto) { + var Translation = (function () { + function Translation(value, locale) { + this.value = value; + this.locale = locale; + } + return Translation; + }()); + Manifesto.Translation = Translation; +})(Manifesto || (Manifesto = {})); + +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Manifesto; +(function (Manifesto) { + var TranslationCollection = (function (_super) { + __extends(TranslationCollection, _super); + function TranslationCollection() { + _super.apply(this, arguments); + } + TranslationCollection.parse = function (translation, defaultLocale) { + var tc = []; + var t; + if (!translation) { + return tc; + } + else if (_isArray(translation)) { + for (var i = 0; i < translation.length; i++) { + var value = translation[i]; + if (_isString(value)) { + t = new Manifesto.Translation(value, defaultLocale); + } + else { + t = new Manifesto.Translation(value['@value'], value['@language'] || defaultLocale); + } + tc.push(t); + } + } + else if (_isString(translation)) { + // if it's just a single string value, create one translation in the configured locale + t = new Manifesto.Translation(translation, defaultLocale); + tc.push(t); + return tc; + } + else { + // it's an object + t = new Manifesto.Translation(translation['@value'], translation['@language'] || defaultLocale); + tc.push(t); + return tc; + } + return tc; + }; + TranslationCollection.getValue = function (translationCollection, locale) { + if (translationCollection.length) { + if (locale) { + var translation = translationCollection.en().where(function (t) { return t.locale === locale || Manifesto.Utils.getInexactLocale(t.locale) === Manifesto.Utils.getInexactLocale(locale); }).first(); + if (translation) { + return translation.value; + } + } + // return the first value + return translationCollection[0].value; + } + return null; + }; + return TranslationCollection; + }(Array)); + Manifesto.TranslationCollection = TranslationCollection; +})(Manifesto || (Manifesto = {})); + +global.manifesto = global.Manifesto = module.exports = { + AnnotationMotivation: new Manifesto.AnnotationMotivation(), + ElementType: new Manifesto.ElementType(), + IIIFResourceType: new Manifesto.IIIFResourceType(), + ManifestType: new Manifesto.ManifestType(), + MetadataItem: Manifesto.MetadataItem, + RenderingFormat: new Manifesto.RenderingFormat(), + ResourceFormat: new Manifesto.ResourceFormat(), + ResourceType: new Manifesto.ResourceType(), + ServiceProfile: new Manifesto.ServiceProfile(), + Translation: Manifesto.Translation, + TranslationCollection: Manifesto.TranslationCollection, + TreeNode: Manifesto.TreeNode, + TreeNodeType: new Manifesto.TreeNodeType(), + Utils: Manifesto.Utils, + ViewingDirection: new Manifesto.ViewingDirection(), + ViewingHint: new Manifesto.ViewingHint(), + StatusCodes: { + AUTHORIZATION_FAILED: 1, + FORBIDDEN: 2, + INTERNAL_SERVER_ERROR: 3, + RESTRICTED: 4 + }, + create: function (manifest, options) { + return Manifesto.Deserialiser.parse(manifest, options); + }, + loadManifest: function (uri) { + return Manifesto.Utils.loadResource(uri); + } +}; + +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// + +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Manifesto; +(function (Manifesto) { + var Annotation = (function (_super) { + __extends(Annotation, _super); + function Annotation(jsonld, options) { + _super.call(this, jsonld, options); + } + Annotation.prototype.getMotivation = function () { + var motivation = this.getProperty('motivation'); + if (motivation) { + return new Manifesto.AnnotationMotivation(motivation.toLowerCase()); + } + return null; + }; + Annotation.prototype.getOn = function () { + return this.getProperty('on'); + }; + Annotation.prototype.getResource = function () { + return new Manifesto.Resource(this.getProperty('resource'), this.options); + }; + return Annotation; + }(Manifesto.ManifestResource)); + Manifesto.Annotation = Annotation; +})(Manifesto || (Manifesto = {})); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Manifesto; +(function (Manifesto) { + var Resource = (function (_super) { + __extends(Resource, _super); + function Resource(jsonld, options) { + _super.call(this, jsonld, options); + } + Resource.prototype.getFormat = function () { + var format = this.getProperty('format'); + if (format) { + return new Manifesto.ResourceFormat(format.toLowerCase()); + } + return null; + }; + Resource.prototype.getType = function () { + var type = this.getProperty('@type'); + if (type) { + return new Manifesto.ResourceType(type.toLowerCase()); + } + return null; + }; + Resource.prototype.getWidth = function () { + return this.getProperty('width'); + }; + Resource.prototype.getHeight = function () { + return this.getProperty('height'); + }; + Resource.prototype.getMaxWidth = function () { + return this.getProperty('maxWidth'); + }; + Resource.prototype.getMaxHeight = function () { + var maxHeight = this.getProperty('maxHeight'); + // if a maxHeight hasn't been specified, default to maxWidth. + // maxWidth in essence becomes maxEdge + if (!maxHeight) { + return this.getMaxWidth(); + } + }; + return Resource; + }(Manifesto.ManifestResource)); + Manifesto.Resource = Resource; +})(Manifesto || (Manifesto = {})); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"http":49,"https":9,"lodash.assign":25,"lodash.endswith":26,"lodash.isarray":28,"lodash.isstring":29,"lodash.last":32,"lodash.map":33,"url":55}],2:[function(require,module,exports){ +'use strict' + +exports.byteLength = byteLength +exports.toByteArray = toByteArray +exports.fromByteArray = fromByteArray + +var lookup = [] +var revLookup = [] +var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array + +var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' +for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i] + revLookup[code.charCodeAt(i)] = i +} + +revLookup['-'.charCodeAt(0)] = 62 +revLookup['_'.charCodeAt(0)] = 63 + +function placeHoldersCount (b64) { + var len = b64.length + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + + // the number of equal signs (place holders) + // if there are two placeholders, than the two characters before it + // represent one byte + // if there is only one, then the three characters before it represent 2 bytes + // this is just a cheap hack to not do indexOf twice + return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0 +} + +function byteLength (b64) { + // base64 is 4/3 + up to two characters of the original data + return b64.length * 3 / 4 - placeHoldersCount(b64) +} + +function toByteArray (b64) { + var i, j, l, tmp, placeHolders, arr + var len = b64.length + placeHolders = placeHoldersCount(b64) + + arr = new Arr(len * 3 / 4 - placeHolders) + + // if there are placeholders, only get up to the last complete 4 chars + l = placeHolders > 0 ? len - 4 : len + + var L = 0 + + for (i = 0, j = 0; i < l; i += 4, j += 3) { + tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] + arr[L++] = (tmp >> 16) & 0xFF + arr[L++] = (tmp >> 8) & 0xFF + arr[L++] = tmp & 0xFF + } + + if (placeHolders === 2) { + tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[L++] = tmp & 0xFF + } else if (placeHolders === 1) { + tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[L++] = (tmp >> 8) & 0xFF + arr[L++] = tmp & 0xFF + } + + return arr +} + +function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] +} + +function encodeChunk (uint8, start, end) { + var tmp + var output = [] + for (var i = start; i < end; i += 3) { + tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) + output.push(tripletToBase64(tmp)) + } + return output.join('') +} + +function fromByteArray (uint8) { + var tmp + var len = uint8.length + var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes + var output = '' + var parts = [] + var maxChunkLength = 16383 // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + output += lookup[tmp >> 2] + output += lookup[(tmp << 4) & 0x3F] + output += '==' + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + (uint8[len - 1]) + output += lookup[tmp >> 10] + output += lookup[(tmp >> 4) & 0x3F] + output += lookup[(tmp << 2) & 0x3F] + output += '=' + } + + parts.push(output) + + return parts.join('') +} + +},{}],3:[function(require,module,exports){ + +},{}],4:[function(require,module,exports){ +(function (global){ +'use strict'; + +var buffer = require('buffer'); +var Buffer = buffer.Buffer; +var SlowBuffer = buffer.SlowBuffer; +var MAX_LEN = buffer.kMaxLength || 2147483647; +exports.alloc = function alloc(size, fill, encoding) { + if (typeof Buffer.alloc === 'function') { + return Buffer.alloc(size, fill, encoding); + } + if (typeof encoding === 'number') { + throw new TypeError('encoding must not be number'); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size > MAX_LEN) { + throw new RangeError('size is too large'); + } + var enc = encoding; + var _fill = fill; + if (_fill === undefined) { + enc = undefined; + _fill = 0; + } + var buf = new Buffer(size); + if (typeof _fill === 'string') { + var fillBuf = new Buffer(_fill, enc); + var flen = fillBuf.length; + var i = -1; + while (++i < size) { + buf[i] = fillBuf[i % flen]; + } + } else { + buf.fill(_fill); + } + return buf; +} +exports.allocUnsafe = function allocUnsafe(size) { + if (typeof Buffer.allocUnsafe === 'function') { + return Buffer.allocUnsafe(size); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size > MAX_LEN) { + throw new RangeError('size is too large'); + } + return new Buffer(size); +} +exports.from = function from(value, encodingOrOffset, length) { + if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) { + return Buffer.from(value, encodingOrOffset, length); + } + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number'); + } + if (typeof value === 'string') { + return new Buffer(value, encodingOrOffset); + } + if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { + var offset = encodingOrOffset; + if (arguments.length === 1) { + return new Buffer(value); + } + if (typeof offset === 'undefined') { + offset = 0; + } + var len = length; + if (typeof len === 'undefined') { + len = value.byteLength - offset; + } + if (offset >= value.byteLength) { + throw new RangeError('\'offset\' is out of bounds'); + } + if (len > value.byteLength - offset) { + throw new RangeError('\'length\' is out of bounds'); + } + return new Buffer(value.slice(offset, offset + len)); + } + if (Buffer.isBuffer(value)) { + var out = new Buffer(value.length); + value.copy(out, 0, 0, value.length); + return out; + } + if (value) { + if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) { + return new Buffer(value); + } + if (value.type === 'Buffer' && Array.isArray(value.data)) { + return new Buffer(value.data); + } + } + + throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.'); +} +exports.allocUnsafeSlow = function allocUnsafeSlow(size) { + if (typeof Buffer.allocUnsafeSlow === 'function') { + return Buffer.allocUnsafeSlow(size); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size >= MAX_LEN) { + throw new RangeError('size is too large'); + } + return new SlowBuffer(size); +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"buffer":5}],5:[function(require,module,exports){ +(function (global){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +/* eslint-disable no-proto */ + +'use strict' + +var base64 = require('base64-js') +var ieee754 = require('ieee754') +var isArray = require('isarray') + +exports.Buffer = Buffer +exports.SlowBuffer = SlowBuffer +exports.INSPECT_MAX_BYTES = 50 + +/** + * If `Buffer.TYPED_ARRAY_SUPPORT`: + * === true Use Uint8Array implementation (fastest) + * === false Use Object implementation (most compatible, even IE6) + * + * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, + * Opera 11.6+, iOS 4.2+. + * + * Due to various browser bugs, sometimes the Object implementation will be used even + * when the browser supports typed arrays. + * + * Note: + * + * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, + * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. + * + * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. + * + * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of + * incorrect length in some situations. + + * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they + * get the Object implementation, which is slower but behaves correctly. + */ +Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined + ? global.TYPED_ARRAY_SUPPORT + : typedArraySupport() + +/* + * Export kMaxLength after typed array support is determined. + */ +exports.kMaxLength = kMaxLength() + +function typedArraySupport () { + try { + var arr = new Uint8Array(1) + arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} + return arr.foo() === 42 && // typed array instances can be augmented + typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` + arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` + } catch (e) { + return false + } +} + +function kMaxLength () { + return Buffer.TYPED_ARRAY_SUPPORT + ? 0x7fffffff + : 0x3fffffff +} + +function createBuffer (that, length) { + if (kMaxLength() < length) { + throw new RangeError('Invalid typed array length') + } + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = new Uint8Array(length) + that.__proto__ = Buffer.prototype + } else { + // Fallback: Return an object instance of the Buffer class + if (that === null) { + that = new Buffer(length) + } + that.length = length + } + + return that +} + +/** + * The Buffer constructor returns instances of `Uint8Array` that have their + * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of + * `Uint8Array`, so the returned instances will have all the node `Buffer` methods + * and the `Uint8Array` methods. Square bracket notation works as expected -- it + * returns a single octet. + * + * The `Uint8Array` prototype remains unmodified. + */ + +function Buffer (arg, encodingOrOffset, length) { + if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { + return new Buffer(arg, encodingOrOffset, length) + } + + // Common case. + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new Error( + 'If encoding is specified then the first argument must be a string' + ) + } + return allocUnsafe(this, arg) + } + return from(this, arg, encodingOrOffset, length) +} + +Buffer.poolSize = 8192 // not used by this implementation + +// TODO: Legacy, not needed anymore. Remove in next major version. +Buffer._augment = function (arr) { + arr.__proto__ = Buffer.prototype + return arr +} + +function from (that, value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number') + } + + if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { + return fromArrayBuffer(that, value, encodingOrOffset, length) + } + + if (typeof value === 'string') { + return fromString(that, value, encodingOrOffset) + } + + return fromObject(that, value) +} + +/** + * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError + * if value is a number. + * Buffer.from(str[, encoding]) + * Buffer.from(array) + * Buffer.from(buffer) + * Buffer.from(arrayBuffer[, byteOffset[, length]]) + **/ +Buffer.from = function (value, encodingOrOffset, length) { + return from(null, value, encodingOrOffset, length) +} + +if (Buffer.TYPED_ARRAY_SUPPORT) { + Buffer.prototype.__proto__ = Uint8Array.prototype + Buffer.__proto__ = Uint8Array + if (typeof Symbol !== 'undefined' && Symbol.species && + Buffer[Symbol.species] === Buffer) { + // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 + Object.defineProperty(Buffer, Symbol.species, { + value: null, + configurable: true + }) + } +} + +function assertSize (size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be a number') + } else if (size < 0) { + throw new RangeError('"size" argument must not be negative') + } +} + +function alloc (that, size, fill, encoding) { + assertSize(size) + if (size <= 0) { + return createBuffer(that, size) + } + if (fill !== undefined) { + // Only pay attention to encoding if it's a string. This + // prevents accidentally sending in a number that would + // be interpretted as a start offset. + return typeof encoding === 'string' + ? createBuffer(that, size).fill(fill, encoding) + : createBuffer(that, size).fill(fill) + } + return createBuffer(that, size) +} + +/** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ +Buffer.alloc = function (size, fill, encoding) { + return alloc(null, size, fill, encoding) +} + +function allocUnsafe (that, size) { + assertSize(size) + that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) + if (!Buffer.TYPED_ARRAY_SUPPORT) { + for (var i = 0; i < size; ++i) { + that[i] = 0 + } + } + return that +} + +/** + * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. + * */ +Buffer.allocUnsafe = function (size) { + return allocUnsafe(null, size) +} +/** + * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. + */ +Buffer.allocUnsafeSlow = function (size) { + return allocUnsafe(null, size) +} + +function fromString (that, string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8' + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('"encoding" must be a valid string encoding') + } + + var length = byteLength(string, encoding) | 0 + that = createBuffer(that, length) + + var actual = that.write(string, encoding) + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + that = that.slice(0, actual) + } + + return that +} + +function fromArrayLike (that, array) { + var length = array.length < 0 ? 0 : checked(array.length) | 0 + that = createBuffer(that, length) + for (var i = 0; i < length; i += 1) { + that[i] = array[i] & 255 + } + return that +} + +function fromArrayBuffer (that, array, byteOffset, length) { + array.byteLength // this throws if `array` is not a valid ArrayBuffer + + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('\'offset\' is out of bounds') + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('\'length\' is out of bounds') + } + + if (byteOffset === undefined && length === undefined) { + array = new Uint8Array(array) + } else if (length === undefined) { + array = new Uint8Array(array, byteOffset) + } else { + array = new Uint8Array(array, byteOffset, length) + } + + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = array + that.__proto__ = Buffer.prototype + } else { + // Fallback: Return an object instance of the Buffer class + that = fromArrayLike(that, array) + } + return that +} + +function fromObject (that, obj) { + if (Buffer.isBuffer(obj)) { + var len = checked(obj.length) | 0 + that = createBuffer(that, len) + + if (that.length === 0) { + return that + } + + obj.copy(that, 0, 0, len) + return that + } + + if (obj) { + if ((typeof ArrayBuffer !== 'undefined' && + obj.buffer instanceof ArrayBuffer) || 'length' in obj) { + if (typeof obj.length !== 'number' || isnan(obj.length)) { + return createBuffer(that, 0) + } + return fromArrayLike(that, obj) + } + + if (obj.type === 'Buffer' && isArray(obj.data)) { + return fromArrayLike(that, obj.data) + } + } + + throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') +} + +function checked (length) { + // Note: cannot use `length < kMaxLength()` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= kMaxLength()) { + throw new RangeError('Attempt to allocate Buffer larger than maximum ' + + 'size: 0x' + kMaxLength().toString(16) + ' bytes') + } + return length | 0 +} + +function SlowBuffer (length) { + if (+length != length) { // eslint-disable-line eqeqeq + length = 0 + } + return Buffer.alloc(+length) +} + +Buffer.isBuffer = function isBuffer (b) { + return !!(b != null && b._isBuffer) +} + +Buffer.compare = function compare (a, b) { + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError('Arguments must be Buffers') + } + + if (a === b) return 0 + + var x = a.length + var y = b.length + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i] + y = b[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +Buffer.isEncoding = function isEncoding (encoding) { + switch (String(encoding).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'latin1': + case 'binary': + case 'base64': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return true + default: + return false + } +} + +Buffer.concat = function concat (list, length) { + if (!isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + + if (list.length === 0) { + return Buffer.alloc(0) + } + + var i + if (length === undefined) { + length = 0 + for (i = 0; i < list.length; ++i) { + length += list[i].length + } + } + + var buffer = Buffer.allocUnsafe(length) + var pos = 0 + for (i = 0; i < list.length; ++i) { + var buf = list[i] + if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + buf.copy(buffer, pos) + pos += buf.length + } + return buffer +} + +function byteLength (string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length + } + if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && + (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { + return string.byteLength + } + if (typeof string !== 'string') { + string = '' + string + } + + var len = string.length + if (len === 0) return 0 + + // Use a for loop to avoid recursion + var loweredCase = false + for (;;) { + switch (encoding) { + case 'ascii': + case 'latin1': + case 'binary': + return len + case 'utf8': + case 'utf-8': + case undefined: + return utf8ToBytes(string).length + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2 + case 'hex': + return len >>> 1 + case 'base64': + return base64ToBytes(string).length + default: + if (loweredCase) return utf8ToBytes(string).length // assume utf8 + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} +Buffer.byteLength = byteLength + +function slowToString (encoding, start, end) { + var loweredCase = false + + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. + + // This behaves neither like String nor Uint8Array in that we set start/end + // to their upper/lower bounds if the value passed is out of range. + // undefined is handled specially as per ECMA-262 6th Edition, + // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. + if (start === undefined || start < 0) { + start = 0 + } + // Return early if start > this.length. Done here to prevent potential uint32 + // coercion fail below. + if (start > this.length) { + return '' + } + + if (end === undefined || end > this.length) { + end = this.length + } + + if (end <= 0) { + return '' + } + + // Force coersion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0 + start >>>= 0 + + if (end <= start) { + return '' + } + + if (!encoding) encoding = 'utf8' + + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end) + + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end) + + case 'ascii': + return asciiSlice(this, start, end) + + case 'latin1': + case 'binary': + return latin1Slice(this, start, end) + + case 'base64': + return base64Slice(this, start, end) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = (encoding + '').toLowerCase() + loweredCase = true + } + } +} + +// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect +// Buffer instances. +Buffer.prototype._isBuffer = true + +function swap (b, n, m) { + var i = b[n] + b[n] = b[m] + b[m] = i +} + +Buffer.prototype.swap16 = function swap16 () { + var len = this.length + if (len % 2 !== 0) { + throw new RangeError('Buffer size must be a multiple of 16-bits') + } + for (var i = 0; i < len; i += 2) { + swap(this, i, i + 1) + } + return this +} + +Buffer.prototype.swap32 = function swap32 () { + var len = this.length + if (len % 4 !== 0) { + throw new RangeError('Buffer size must be a multiple of 32-bits') + } + for (var i = 0; i < len; i += 4) { + swap(this, i, i + 3) + swap(this, i + 1, i + 2) + } + return this +} + +Buffer.prototype.swap64 = function swap64 () { + var len = this.length + if (len % 8 !== 0) { + throw new RangeError('Buffer size must be a multiple of 64-bits') + } + for (var i = 0; i < len; i += 8) { + swap(this, i, i + 7) + swap(this, i + 1, i + 6) + swap(this, i + 2, i + 5) + swap(this, i + 3, i + 4) + } + return this +} + +Buffer.prototype.toString = function toString () { + var length = this.length | 0 + if (length === 0) return '' + if (arguments.length === 0) return utf8Slice(this, 0, length) + return slowToString.apply(this, arguments) +} + +Buffer.prototype.equals = function equals (b) { + if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') + if (this === b) return true + return Buffer.compare(this, b) === 0 +} + +Buffer.prototype.inspect = function inspect () { + var str = '' + var max = exports.INSPECT_MAX_BYTES + if (this.length > 0) { + str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') + if (this.length > max) str += ' ... ' + } + return '' +} + +Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { + if (!Buffer.isBuffer(target)) { + throw new TypeError('Argument must be a Buffer') + } + + if (start === undefined) { + start = 0 + } + if (end === undefined) { + end = target ? target.length : 0 + } + if (thisStart === undefined) { + thisStart = 0 + } + if (thisEnd === undefined) { + thisEnd = this.length + } + + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index') + } + + if (thisStart >= thisEnd && start >= end) { + return 0 + } + if (thisStart >= thisEnd) { + return -1 + } + if (start >= end) { + return 1 + } + + start >>>= 0 + end >>>= 0 + thisStart >>>= 0 + thisEnd >>>= 0 + + if (this === target) return 0 + + var x = thisEnd - thisStart + var y = end - start + var len = Math.min(x, y) + + var thisCopy = this.slice(thisStart, thisEnd) + var targetCopy = target.slice(start, end) + + for (var i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i] + y = targetCopy[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, +// OR the last index of `val` in `buffer` at offset <= `byteOffset`. +// +// Arguments: +// - buffer - a Buffer to search +// - val - a string, Buffer, or number +// - byteOffset - an index into `buffer`; will be clamped to an int32 +// - encoding - an optional encoding, relevant is val is a string +// - dir - true for indexOf, false for lastIndexOf +function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { + // Empty buffer means no match + if (buffer.length === 0) return -1 + + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset + byteOffset = 0 + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000 + } + byteOffset = +byteOffset // Coerce to Number. + if (isNaN(byteOffset)) { + // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer + byteOffset = dir ? 0 : (buffer.length - 1) + } + + // Normalize byteOffset: negative offsets start from the end of the buffer + if (byteOffset < 0) byteOffset = buffer.length + byteOffset + if (byteOffset >= buffer.length) { + if (dir) return -1 + else byteOffset = buffer.length - 1 + } else if (byteOffset < 0) { + if (dir) byteOffset = 0 + else return -1 + } + + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, encoding) + } + + // Finally, search either indexOf (if dir is true) or lastIndexOf + if (Buffer.isBuffer(val)) { + // Special case: looking for empty string/buffer always fails + if (val.length === 0) { + return -1 + } + return arrayIndexOf(buffer, val, byteOffset, encoding, dir) + } else if (typeof val === 'number') { + val = val & 0xFF // Search for a byte value [0-255] + if (Buffer.TYPED_ARRAY_SUPPORT && + typeof Uint8Array.prototype.indexOf === 'function') { + if (dir) { + return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) + } else { + return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) + } + } + return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) + } + + throw new TypeError('val must be string, number or Buffer') +} + +function arrayIndexOf (arr, val, byteOffset, encoding, dir) { + var indexSize = 1 + var arrLength = arr.length + var valLength = val.length + + if (encoding !== undefined) { + encoding = String(encoding).toLowerCase() + if (encoding === 'ucs2' || encoding === 'ucs-2' || + encoding === 'utf16le' || encoding === 'utf-16le') { + if (arr.length < 2 || val.length < 2) { + return -1 + } + indexSize = 2 + arrLength /= 2 + valLength /= 2 + byteOffset /= 2 + } + } + + function read (buf, i) { + if (indexSize === 1) { + return buf[i] + } else { + return buf.readUInt16BE(i * indexSize) + } + } + + var i + if (dir) { + var foundIndex = -1 + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (foundIndex === -1) foundIndex = i + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize + } else { + if (foundIndex !== -1) i -= i - foundIndex + foundIndex = -1 + } + } + } else { + if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength + for (i = byteOffset; i >= 0; i--) { + var found = true + for (var j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false + break + } + } + if (found) return i + } + } + + return -1 +} + +Buffer.prototype.includes = function includes (val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1 +} + +Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true) +} + +Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false) +} + +function hexWrite (buf, string, offset, length) { + offset = Number(offset) || 0 + var remaining = buf.length - offset + if (!length) { + length = remaining + } else { + length = Number(length) + if (length > remaining) { + length = remaining + } + } + + // must be an even number of digits + var strLen = string.length + if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') + + if (length > strLen / 2) { + length = strLen / 2 + } + for (var i = 0; i < length; ++i) { + var parsed = parseInt(string.substr(i * 2, 2), 16) + if (isNaN(parsed)) return i + buf[offset + i] = parsed + } + return i +} + +function utf8Write (buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) +} + +function asciiWrite (buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length) +} + +function latin1Write (buf, string, offset, length) { + return asciiWrite(buf, string, offset, length) +} + +function base64Write (buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length) +} + +function ucs2Write (buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) +} + +Buffer.prototype.write = function write (string, offset, length, encoding) { + // Buffer#write(string) + if (offset === undefined) { + encoding = 'utf8' + length = this.length + offset = 0 + // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + encoding = offset + length = this.length + offset = 0 + // Buffer#write(string, offset[, length][, encoding]) + } else if (isFinite(offset)) { + offset = offset | 0 + if (isFinite(length)) { + length = length | 0 + if (encoding === undefined) encoding = 'utf8' + } else { + encoding = length + length = undefined + } + // legacy write(string, encoding, offset, length) - remove in v0.13 + } else { + throw new Error( + 'Buffer.write(string, encoding, offset[, length]) is no longer supported' + ) + } + + var remaining = this.length - offset + if (length === undefined || length > remaining) length = remaining + + if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds') + } + + if (!encoding) encoding = 'utf8' + + var loweredCase = false + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length) + + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length) + + case 'ascii': + return asciiWrite(this, string, offset, length) + + case 'latin1': + case 'binary': + return latin1Write(this, string, offset, length) + + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} + +Buffer.prototype.toJSON = function toJSON () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } +} + +function base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf) + } else { + return base64.fromByteArray(buf.slice(start, end)) + } +} + +function utf8Slice (buf, start, end) { + end = Math.min(buf.length, end) + var res = [] + + var i = start + while (i < end) { + var firstByte = buf[i] + var codePoint = null + var bytesPerSequence = (firstByte > 0xEF) ? 4 + : (firstByte > 0xDF) ? 3 + : (firstByte > 0xBF) ? 2 + : 1 + + if (i + bytesPerSequence <= end) { + var secondByte, thirdByte, fourthByte, tempCodePoint + + switch (bytesPerSequence) { + case 1: + if (firstByte < 0x80) { + codePoint = firstByte + } + break + case 2: + secondByte = buf[i + 1] + if ((secondByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) + if (tempCodePoint > 0x7F) { + codePoint = tempCodePoint + } + } + break + case 3: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) + if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { + codePoint = tempCodePoint + } + } + break + case 4: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + fourthByte = buf[i + 3] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) + if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { + codePoint = tempCodePoint + } + } + } + } + + if (codePoint === null) { + // we did not generate a valid codePoint so insert a + // replacement char (U+FFFD) and advance only 1 byte + codePoint = 0xFFFD + bytesPerSequence = 1 + } else if (codePoint > 0xFFFF) { + // encode to utf16 (surrogate pair dance) + codePoint -= 0x10000 + res.push(codePoint >>> 10 & 0x3FF | 0xD800) + codePoint = 0xDC00 | codePoint & 0x3FF + } + + res.push(codePoint) + i += bytesPerSequence + } + + return decodeCodePointsArray(res) +} + +// Based on http://stackoverflow.com/a/22747272/680742, the browser with +// the lowest limit is Chrome, with 0x10000 args. +// We go 1 magnitude less, for safety +var MAX_ARGUMENTS_LENGTH = 0x1000 + +function decodeCodePointsArray (codePoints) { + var len = codePoints.length + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints) // avoid extra slice() + } + + // Decode in chunks to avoid "call stack size exceeded". + var res = '' + var i = 0 + while (i < len) { + res += String.fromCharCode.apply( + String, + codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) + ) + } + return res +} + +function asciiSlice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 0x7F) + } + return ret +} + +function latin1Slice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]) + } + return ret +} + +function hexSlice (buf, start, end) { + var len = buf.length + + if (!start || start < 0) start = 0 + if (!end || end < 0 || end > len) end = len + + var out = '' + for (var i = start; i < end; ++i) { + out += toHex(buf[i]) + } + return out +} + +function utf16leSlice (buf, start, end) { + var bytes = buf.slice(start, end) + var res = '' + for (var i = 0; i < bytes.length; i += 2) { + res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) + } + return res +} + +Buffer.prototype.slice = function slice (start, end) { + var len = this.length + start = ~~start + end = end === undefined ? len : ~~end + + if (start < 0) { + start += len + if (start < 0) start = 0 + } else if (start > len) { + start = len + } + + if (end < 0) { + end += len + if (end < 0) end = 0 + } else if (end > len) { + end = len + } + + if (end < start) end = start + + var newBuf + if (Buffer.TYPED_ARRAY_SUPPORT) { + newBuf = this.subarray(start, end) + newBuf.__proto__ = Buffer.prototype + } else { + var sliceLen = end - start + newBuf = new Buffer(sliceLen, undefined) + for (var i = 0; i < sliceLen; ++i) { + newBuf[i] = this[i + start] + } + } + + return newBuf +} + +/* + * Need to make sure that buffer isn't trying to write out of bounds. + */ +function checkOffset (offset, ext, length) { + if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') + if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') +} + +Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var val = this[offset] + var mul = 1 + var i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + + return val +} + +Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) { + checkOffset(offset, byteLength, this.length) + } + + var val = this[offset + --byteLength] + var mul = 1 + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul + } + + return val +} + +Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length) + return this[offset] +} + +Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length) + return this[offset] | (this[offset + 1] << 8) +} + +Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length) + return (this[offset] << 8) | this[offset + 1] +} + +Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + + return ((this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16)) + + (this[offset + 3] * 0x1000000) +} + +Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] * 0x1000000) + + ((this[offset + 1] << 16) | + (this[offset + 2] << 8) | + this[offset + 3]) +} + +Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var val = this[offset] + var mul = 1 + var i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var i = byteLength + var mul = 1 + var val = this[offset + --i] + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length) + if (!(this[offset] & 0x80)) return (this[offset]) + return ((0xff - this[offset] + 1) * -1) +} + +Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length) + var val = this[offset] | (this[offset + 1] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length) + var val = this[offset + 1] | (this[offset] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24) +} + +Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] << 24) | + (this[offset + 1] << 16) | + (this[offset + 2] << 8) | + (this[offset + 3]) +} + +Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, true, 23, 4) +} + +Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, false, 23, 4) +} + +Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, true, 52, 8) +} + +Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, false, 52, 8) +} + +function checkInt (buf, value, offset, ext, max, min) { + if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') + if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') + if (offset + ext > buf.length) throw new RangeError('Index out of range') +} + +Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + var mul = 1 + var i = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + var i = byteLength - 1 + var mul = 1 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) + if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) + this[offset] = (value & 0xff) + return offset + 1 +} + +function objectWriteUInt16 (buf, value, offset, littleEndian) { + if (value < 0) value = 0xffff + value + 1 + for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { + buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> + (littleEndian ? i : 1 - i) * 8 + } +} + +Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + } else { + objectWriteUInt16(this, value, offset, true) + } + return offset + 2 +} + +Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + } else { + objectWriteUInt16(this, value, offset, false) + } + return offset + 2 +} + +function objectWriteUInt32 (buf, value, offset, littleEndian) { + if (value < 0) value = 0xffffffff + value + 1 + for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { + buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff + } +} + +Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset + 3] = (value >>> 24) + this[offset + 2] = (value >>> 16) + this[offset + 1] = (value >>> 8) + this[offset] = (value & 0xff) + } else { + objectWriteUInt32(this, value, offset, true) + } + return offset + 4 +} + +Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + } else { + objectWriteUInt32(this, value, offset, false) + } + return offset + 4 +} + +Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + var i = 0 + var mul = 1 + var sub = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + var i = byteLength - 1 + var mul = 1 + var sub = 0 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) + if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) + if (value < 0) value = 0xff + value + 1 + this[offset] = (value & 0xff) + return offset + 1 +} + +Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + } else { + objectWriteUInt16(this, value, offset, true) + } + return offset + 2 +} + +Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + } else { + objectWriteUInt16(this, value, offset, false) + } + return offset + 2 +} + +Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + this[offset + 2] = (value >>> 16) + this[offset + 3] = (value >>> 24) + } else { + objectWriteUInt32(this, value, offset, true) + } + return offset + 4 +} + +Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + if (value < 0) value = 0xffffffff + value + 1 + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + } else { + objectWriteUInt32(this, value, offset, false) + } + return offset + 4 +} + +function checkIEEE754 (buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError('Index out of range') + if (offset < 0) throw new RangeError('Index out of range') +} + +function writeFloat (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) + } + ieee754.write(buf, value, offset, littleEndian, 23, 4) + return offset + 4 +} + +Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert) +} + +function writeDouble (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) + } + ieee754.write(buf, value, offset, littleEndian, 52, 8) + return offset + 8 +} + +Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert) +} + +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function copy (target, targetStart, start, end) { + if (!start) start = 0 + if (!end && end !== 0) end = this.length + if (targetStart >= target.length) targetStart = target.length + if (!targetStart) targetStart = 0 + if (end > 0 && end < start) end = start + + // Copy 0 bytes; we're done + if (end === start) return 0 + if (target.length === 0 || this.length === 0) return 0 + + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds') + } + if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') + if (end < 0) throw new RangeError('sourceEnd out of bounds') + + // Are we oob? + if (end > this.length) end = this.length + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start + } + + var len = end - start + var i + + if (this === target && start < targetStart && targetStart < end) { + // descending copy from end + for (i = len - 1; i >= 0; --i) { + target[i + targetStart] = this[i + start] + } + } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { + // ascending copy from start + for (i = 0; i < len; ++i) { + target[i + targetStart] = this[i + start] + } + } else { + Uint8Array.prototype.set.call( + target, + this.subarray(start, start + len), + targetStart + ) + } + + return len +} + +// Usage: +// buffer.fill(number[, offset[, end]]) +// buffer.fill(buffer[, offset[, end]]) +// buffer.fill(string[, offset[, end]][, encoding]) +Buffer.prototype.fill = function fill (val, start, end, encoding) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start + start = 0 + end = this.length + } else if (typeof end === 'string') { + encoding = end + end = this.length + } + if (val.length === 1) { + var code = val.charCodeAt(0) + if (code < 256) { + val = code + } + } + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string') + } + if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + } else if (typeof val === 'number') { + val = val & 255 + } + + // Invalid ranges are not set to a default, so can range check early. + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index') + } + + if (end <= start) { + return this + } + + start = start >>> 0 + end = end === undefined ? this.length : end >>> 0 + + if (!val) val = 0 + + var i + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val + } + } else { + var bytes = Buffer.isBuffer(val) + ? val + : utf8ToBytes(new Buffer(val, encoding).toString()) + var len = bytes.length + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len] + } + } + + return this +} + +// HELPER FUNCTIONS +// ================ + +var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g + +function base64clean (str) { + // Node strips out invalid characters like \n and \t from the string, base64-js does not + str = stringtrim(str).replace(INVALID_BASE64_RE, '') + // Node converts strings with length < 2 to '' + if (str.length < 2) return '' + // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not + while (str.length % 4 !== 0) { + str = str + '=' + } + return str +} + +function stringtrim (str) { + if (str.trim) return str.trim() + return str.replace(/^\s+|\s+$/g, '') +} + +function toHex (n) { + if (n < 16) return '0' + n.toString(16) + return n.toString(16) +} + +function utf8ToBytes (string, units) { + units = units || Infinity + var codePoint + var length = string.length + var leadSurrogate = null + var bytes = [] + + for (var i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i) + + // is surrogate component + if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } + + // valid lead + leadSurrogate = codePoint + + continue + } + + // 2 leads in a row + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + leadSurrogate = codePoint + continue + } + + // valid surrogate pair + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + } + + leadSurrogate = null + + // encode utf8 + if (codePoint < 0x80) { + if ((units -= 1) < 0) break + bytes.push(codePoint) + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break + bytes.push( + codePoint >> 0x6 | 0xC0, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break + bytes.push( + codePoint >> 0xC | 0xE0, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break + bytes.push( + codePoint >> 0x12 | 0xF0, + codePoint >> 0xC & 0x3F | 0x80, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else { + throw new Error('Invalid code point') + } + } + + return bytes +} + +function asciiToBytes (str) { + var byteArray = [] + for (var i = 0; i < str.length; ++i) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xFF) + } + return byteArray +} + +function utf16leToBytes (str, units) { + var c, hi, lo + var byteArray = [] + for (var i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break + + c = str.charCodeAt(i) + hi = c >> 8 + lo = c % 256 + byteArray.push(lo) + byteArray.push(hi) + } + + return byteArray +} + +function base64ToBytes (str) { + return base64.toByteArray(base64clean(str)) +} + +function blitBuffer (src, dst, offset, length) { + for (var i = 0; i < length; ++i) { + if ((i + offset >= dst.length) || (i >= src.length)) break + dst[i + offset] = src[i] + } + return i +} + +function isnan (val) { + return val !== val // eslint-disable-line no-self-compare +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"base64-js":2,"ieee754":10,"isarray":13}],6:[function(require,module,exports){ +module.exports = { + "100": "Continue", + "101": "Switching Protocols", + "102": "Processing", + "200": "OK", + "201": "Created", + "202": "Accepted", + "203": "Non-Authoritative Information", + "204": "No Content", + "205": "Reset Content", + "206": "Partial Content", + "207": "Multi-Status", + "208": "Already Reported", + "226": "IM Used", + "300": "Multiple Choices", + "301": "Moved Permanently", + "302": "Found", + "303": "See Other", + "304": "Not Modified", + "305": "Use Proxy", + "307": "Temporary Redirect", + "308": "Permanent Redirect", + "400": "Bad Request", + "401": "Unauthorized", + "402": "Payment Required", + "403": "Forbidden", + "404": "Not Found", + "405": "Method Not Allowed", + "406": "Not Acceptable", + "407": "Proxy Authentication Required", + "408": "Request Timeout", + "409": "Conflict", + "410": "Gone", + "411": "Length Required", + "412": "Precondition Failed", + "413": "Payload Too Large", + "414": "URI Too Long", + "415": "Unsupported Media Type", + "416": "Range Not Satisfiable", + "417": "Expectation Failed", + "418": "I'm a teapot", + "421": "Misdirected Request", + "422": "Unprocessable Entity", + "423": "Locked", + "424": "Failed Dependency", + "425": "Unordered Collection", + "426": "Upgrade Required", + "428": "Precondition Required", + "429": "Too Many Requests", + "431": "Request Header Fields Too Large", + "500": "Internal Server Error", + "501": "Not Implemented", + "502": "Bad Gateway", + "503": "Service Unavailable", + "504": "Gateway Timeout", + "505": "HTTP Version Not Supported", + "506": "Variant Also Negotiates", + "507": "Insufficient Storage", + "508": "Loop Detected", + "509": "Bandwidth Limit Exceeded", + "510": "Not Extended", + "511": "Network Authentication Required" +} + +},{}],7:[function(require,module,exports){ +(function (Buffer){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = Buffer.isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + +}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) +},{"../../is-buffer/index.js":12}],8:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +function EventEmitter() { + this._events = this._events || {}; + this._maxListeners = this._maxListeners || undefined; +} +module.exports = EventEmitter; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +EventEmitter.defaultMaxListeners = 10; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function(n) { + if (!isNumber(n) || n < 0 || isNaN(n)) + throw TypeError('n must be a positive number'); + this._maxListeners = n; + return this; +}; + +EventEmitter.prototype.emit = function(type) { + var er, handler, len, args, i, listeners; + + if (!this._events) + this._events = {}; + + // If there is no 'error' event listener then throw. + if (type === 'error') { + if (!this._events.error || + (isObject(this._events.error) && !this._events.error.length)) { + er = arguments[1]; + if (er instanceof Error) { + throw er; // Unhandled 'error' event + } else { + // At least give some kind of context to the user + var err = new Error('Uncaught, unspecified "error" event. (' + er + ')'); + err.context = er; + throw err; + } + } + } + + handler = this._events[type]; + + if (isUndefined(handler)) + return false; + + if (isFunction(handler)) { + switch (arguments.length) { + // fast cases + case 1: + handler.call(this); + break; + case 2: + handler.call(this, arguments[1]); + break; + case 3: + handler.call(this, arguments[1], arguments[2]); + break; + // slower + default: + args = Array.prototype.slice.call(arguments, 1); + handler.apply(this, args); + } + } else if (isObject(handler)) { + args = Array.prototype.slice.call(arguments, 1); + listeners = handler.slice(); + len = listeners.length; + for (i = 0; i < len; i++) + listeners[i].apply(this, args); + } + + return true; +}; + +EventEmitter.prototype.addListener = function(type, listener) { + var m; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + if (!this._events) + this._events = {}; + + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (this._events.newListener) + this.emit('newListener', type, + isFunction(listener.listener) ? + listener.listener : listener); + + if (!this._events[type]) + // Optimize the case of one listener. Don't need the extra array object. + this._events[type] = listener; + else if (isObject(this._events[type])) + // If we've already got an array, just append. + this._events[type].push(listener); + else + // Adding the second element, need to change to array. + this._events[type] = [this._events[type], listener]; + + // Check for listener leak + if (isObject(this._events[type]) && !this._events[type].warned) { + if (!isUndefined(this._maxListeners)) { + m = this._maxListeners; + } else { + m = EventEmitter.defaultMaxListeners; + } + + if (m && m > 0 && this._events[type].length > m) { + this._events[type].warned = true; + console.error('(node) warning: possible EventEmitter memory ' + + 'leak detected. %d listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.', + this._events[type].length); + if (typeof console.trace === 'function') { + // not supported in IE 10 + console.trace(); + } + } + } + + return this; +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.once = function(type, listener) { + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + var fired = false; + + function g() { + this.removeListener(type, g); + + if (!fired) { + fired = true; + listener.apply(this, arguments); + } + } + + g.listener = listener; + this.on(type, g); + + return this; +}; + +// emits a 'removeListener' event iff the listener was removed +EventEmitter.prototype.removeListener = function(type, listener) { + var list, position, length, i; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + if (!this._events || !this._events[type]) + return this; + + list = this._events[type]; + length = list.length; + position = -1; + + if (list === listener || + (isFunction(list.listener) && list.listener === listener)) { + delete this._events[type]; + if (this._events.removeListener) + this.emit('removeListener', type, listener); + + } else if (isObject(list)) { + for (i = length; i-- > 0;) { + if (list[i] === listener || + (list[i].listener && list[i].listener === listener)) { + position = i; + break; + } + } + + if (position < 0) + return this; + + if (list.length === 1) { + list.length = 0; + delete this._events[type]; + } else { + list.splice(position, 1); + } + + if (this._events.removeListener) + this.emit('removeListener', type, listener); + } + + return this; +}; + +EventEmitter.prototype.removeAllListeners = function(type) { + var key, listeners; + + if (!this._events) + return this; + + // not listening for removeListener, no need to emit + if (!this._events.removeListener) { + if (arguments.length === 0) + this._events = {}; + else if (this._events[type]) + delete this._events[type]; + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + for (key in this._events) { + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = {}; + return this; + } + + listeners = this._events[type]; + + if (isFunction(listeners)) { + this.removeListener(type, listeners); + } else if (listeners) { + // LIFO order + while (listeners.length) + this.removeListener(type, listeners[listeners.length - 1]); + } + delete this._events[type]; + + return this; +}; + +EventEmitter.prototype.listeners = function(type) { + var ret; + if (!this._events || !this._events[type]) + ret = []; + else if (isFunction(this._events[type])) + ret = [this._events[type]]; + else + ret = this._events[type].slice(); + return ret; +}; + +EventEmitter.prototype.listenerCount = function(type) { + if (this._events) { + var evlistener = this._events[type]; + + if (isFunction(evlistener)) + return 1; + else if (evlistener) + return evlistener.length; + } + return 0; +}; + +EventEmitter.listenerCount = function(emitter, type) { + return emitter.listenerCount(type); +}; + +function isFunction(arg) { + return typeof arg === 'function'; +} + +function isNumber(arg) { + return typeof arg === 'number'; +} + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} + +function isUndefined(arg) { + return arg === void 0; +} + +},{}],9:[function(require,module,exports){ +var http = require('http'); + +var https = module.exports; + +for (var key in http) { + if (http.hasOwnProperty(key)) https[key] = http[key]; +}; + +https.request = function (params, cb) { + if (!params) params = {}; + params.scheme = 'https'; + params.protocol = 'https:'; + return http.request.call(this, params, cb); +} + +},{"http":49}],10:[function(require,module,exports){ +exports.read = function (buffer, offset, isLE, mLen, nBytes) { + var e, m + var eLen = nBytes * 8 - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var nBits = -7 + var i = isLE ? (nBytes - 1) : 0 + var d = isLE ? -1 : 1 + var s = buffer[offset + i] + + i += d + + e = s & ((1 << (-nBits)) - 1) + s >>= (-nBits) + nBits += eLen + for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} + + m = e & ((1 << (-nBits)) - 1) + e >>= (-nBits) + nBits += mLen + for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} + + if (e === 0) { + e = 1 - eBias + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity) + } else { + m = m + Math.pow(2, mLen) + e = e - eBias + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen) +} + +exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c + var eLen = nBytes * 8 - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) + var i = isLE ? 0 : (nBytes - 1) + var d = isLE ? 1 : -1 + var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 + + value = Math.abs(value) + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0 + e = eMax + } else { + e = Math.floor(Math.log(value) / Math.LN2) + if (value * (c = Math.pow(2, -e)) < 1) { + e-- + c *= 2 + } + if (e + eBias >= 1) { + value += rt / c + } else { + value += rt * Math.pow(2, 1 - eBias) + } + if (value * c >= 2) { + e++ + c /= 2 + } + + if (e + eBias >= eMax) { + m = 0 + e = eMax + } else if (e + eBias >= 1) { + m = (value * c - 1) * Math.pow(2, mLen) + e = e + eBias + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) + e = 0 + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + + e = (e << mLen) | m + eLen += mLen + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + + buffer[offset + i - d] |= s * 128 +} + +},{}],11:[function(require,module,exports){ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} + +},{}],12:[function(require,module,exports){ +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +// The _isBuffer check is for Safari 5-7 support, because it's missing +// Object.prototype.constructor. Remove this eventually +module.exports = function (obj) { + return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) +} + +function isBuffer (obj) { + return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) +} + +// For Node v0.10 support. Remove this eventually. +function isSlowBuffer (obj) { + return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) +} + +},{}],13:[function(require,module,exports){ +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; + +},{}],14:[function(require,module,exports){ +/** + * lodash 3.0.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.7.0 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** + * A specialized version of `_.map` for arrays without support for callback + * shorthands or `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + +module.exports = arrayMap; + +},{}],15:[function(require,module,exports){ +/** + * lodash 3.2.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var baseCopy = require('lodash._basecopy'), + keys = require('lodash.keys'); + +/** + * The base implementation of `_.assign` without support for argument juggling, + * multiple sources, and `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ +function baseAssign(object, source) { + return source == null + ? object + : baseCopy(source, keys(source), object); +} + +module.exports = baseAssign; + +},{"lodash._basecopy":17,"lodash.keys":31}],16:[function(require,module,exports){ +/** + * lodash 3.3.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var baseIsEqual = require('lodash._baseisequal'), + bindCallback = require('lodash._bindcallback'), + isArray = require('lodash.isarray'), + pairs = require('lodash.pairs'); + +/** Used to match property names within property paths. */ +var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; + +/** Used to match backslashes in property paths. */ +var reEscapeChar = /\\(\\)?/g; + +/** + * Converts `value` to a string if it's not one. An empty string is returned + * for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + return value == null ? '' : (value + ''); +} + +/** + * The base implementation of `_.callback` which supports specifying the + * number of arguments to provide to `func`. + * + * @private + * @param {*} [func=_.identity] The value to convert to a callback. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {number} [argCount] The number of arguments to provide to `func`. + * @returns {Function} Returns the callback. + */ +function baseCallback(func, thisArg, argCount) { + var type = typeof func; + if (type == 'function') { + return thisArg === undefined + ? func + : bindCallback(func, thisArg, argCount); + } + if (func == null) { + return identity; + } + if (type == 'object') { + return baseMatches(func); + } + return thisArg === undefined + ? property(func) + : baseMatchesProperty(func, thisArg); +} + +/** + * The base implementation of `get` without support for string paths + * and default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path of the property to get. + * @param {string} [pathKey] The key representation of path. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path, pathKey) { + if (object == null) { + return; + } + if (pathKey !== undefined && pathKey in toObject(object)) { + path = [pathKey]; + } + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return (index && index == length) ? object : undefined; +} + +/** + * The base implementation of `_.isMatch` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Object} object The object to inspect. + * @param {Array} matchData The propery names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparing objects. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ +function baseIsMatch(object, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; + + if (object == null) { + return !length; + } + object = toObject(object); + while (index--) { + var data = matchData[index]; + if ((noCustomizer && data[2]) + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], + objValue = object[key], + srcValue = data[1]; + + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; + } + } else { + var result = customizer ? customizer(objValue, srcValue, key) : undefined; + if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) { + return false; + } + } + } + return true; +} + +/** + * The base implementation of `_.matches` which does not clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new function. + */ +function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + var key = matchData[0][0], + value = matchData[0][1]; + + return function(object) { + if (object == null) { + return false; + } + return object[key] === value && (value !== undefined || (key in toObject(object))); + }; + } + return function(object) { + return baseIsMatch(object, matchData); + }; +} + +/** + * The base implementation of `_.matchesProperty` which does not clone `srcValue`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to compare. + * @returns {Function} Returns the new function. + */ +function baseMatchesProperty(path, srcValue) { + var isArr = isArray(path), + isCommon = isKey(path) && isStrictComparable(srcValue), + pathKey = (path + ''); + + path = toPath(path); + return function(object) { + if (object == null) { + return false; + } + var key = pathKey; + object = toObject(object); + if ((isArr || !isCommon) && !(key in object)) { + object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); + if (object == null) { + return false; + } + key = last(path); + object = toObject(object); + } + return object[key] === srcValue + ? (srcValue !== undefined || (key in object)) + : baseIsEqual(srcValue, object[key], undefined, true); + }; +} + +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new function. + */ +function basePropertyDeep(path) { + var pathKey = (path + ''); + path = toPath(path); + return function(object) { + return baseGet(object, path, pathKey); + }; +} + +/** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ +function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + start = start == null ? 0 : (+start || 0); + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = (end === undefined || end > length) ? length : (+end || 0); + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; +} + +/** + * Gets the propery names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ +function getMatchData(object) { + var result = pairs(object), + length = result.length; + + while (length--) { + result[length][2] = isStrictComparable(result[length][1]); + } + return result; +} + +/** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ +function isKey(value, object) { + var type = typeof value; + if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') { + return true; + } + if (isArray(value)) { + return false; + } + var result = !reIsDeepProp.test(value); + return result || (object != null && value in toObject(object)); +} + +/** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ +function isStrictComparable(value) { + return value === value && !isObject(value); +} + +/** + * Converts `value` to an object if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ +function toObject(value) { + return isObject(value) ? value : Object(value); +} + +/** + * Converts `value` to property path array if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Array} Returns the property path array. + */ +function toPath(value) { + if (isArray(value)) { + return value; + } + var result = []; + baseToString(value).replace(rePropName, function(match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; +} + +/** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ +function last(array) { + var length = array ? array.length : 0; + return length ? array[length - 1] : undefined; +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ +function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * This method returns the first argument provided to it. + * + * @static + * @memberOf _ + * @category Utility + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'user': 'fred' }; + * + * _.identity(object) === object; + * // => true + */ +function identity(value) { + return value; +} + +/** + * Creates a function that returns the property value at `path` on a + * given object. + * + * @static + * @memberOf _ + * @category Utility + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new function. + * @example + * + * var objects = [ + * { 'a': { 'b': { 'c': 2 } } }, + * { 'a': { 'b': { 'c': 1 } } } + * ]; + * + * _.map(objects, _.property('a.b.c')); + * // => [2, 1] + * + * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); + * // => [1, 2] + */ +function property(path) { + return isKey(path) ? baseProperty(path) : basePropertyDeep(path); +} + +module.exports = baseCallback; + +},{"lodash._baseisequal":19,"lodash._bindcallback":20,"lodash.isarray":28,"lodash.pairs":34}],17:[function(require,module,exports){ +/** + * lodash 3.0.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** + * Copies properties of `source` to `object`. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Array} props The property names to copy. + * @param {Object} [object={}] The object to copy properties to. + * @returns {Object} Returns `object`. + */ +function baseCopy(source, props, object) { + object || (object = {}); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + object[key] = source[key]; + } + return object; +} + +module.exports = baseCopy; + +},{}],18:[function(require,module,exports){ +/** + * lodash 3.0.4 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var keys = require('lodash.keys'); + +/** + * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * of an array-like value. + */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** + * The base implementation of `_.forEach` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object|string} Returns `collection`. + */ +var baseEach = createBaseEach(baseForOwn); + +/** + * The base implementation of `baseForIn` and `baseForOwn` which iterates + * over `object` properties returned by `keysFunc` invoking `iteratee` for + * each property. Iteratee functions may exit iteration early by explicitly + * returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ +var baseFor = createBaseFor(); + +/** + * The base implementation of `_.forOwn` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ +function baseForOwn(object, iteratee) { + return baseFor(object, iteratee, keys); +} + +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * Creates a `baseEach` or `baseEachRight` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseEach(eachFunc, fromRight) { + return function(collection, iteratee) { + var length = collection ? getLength(collection) : 0; + if (!isLength(length)) { + return eachFunc(collection, iteratee); + } + var index = fromRight ? length : -1, + iterable = toObject(collection); + + while ((fromRight ? index-- : ++index < length)) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection; + }; +} + +/** + * Creates a base function for `_.forIn` or `_.forInRight`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var iterable = toObject(object), + props = keysFunc(object), + length = props.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length)) { + var key = props[index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; +} + +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ +function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Converts `value` to an object if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ +function toObject(value) { + return isObject(value) ? value : Object(value); +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ +function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +module.exports = baseEach; + +},{"lodash.keys":31}],19:[function(require,module,exports){ +/** + * lodash 3.0.7 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var isArray = require('lodash.isarray'), + isTypedArray = require('lodash.istypedarray'), + keys = require('lodash.keys'); + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + stringTag = '[object String]'; + +/** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * of values. + */ +var objToString = objectProto.toString; + +/** + * A specialized version of `_.some` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ +function arraySome(array, predicate) { + var index = -1, + length = array.length; + + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; +} + +/** + * The base implementation of `_.isEqual` without support for `this` binding + * `customizer` functions. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize comparing values. + * @param {boolean} [isLoose] Specify performing partial comparisons. + * @param {Array} [stackA] Tracks traversed `value` objects. + * @param {Array} [stackB] Tracks traversed `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ +function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { + if (value === other) { + return true; + } + if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB); +} + +/** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparing objects. + * @param {boolean} [isLoose] Specify performing partial comparisons. + * @param {Array} [stackA=[]] Tracks traversed `value` objects. + * @param {Array} [stackB=[]] Tracks traversed `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) { + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = arrayTag, + othTag = arrayTag; + + if (!objIsArr) { + objTag = objToString.call(object); + if (objTag == argsTag) { + objTag = objectTag; + } else if (objTag != objectTag) { + objIsArr = isTypedArray(object); + } + } + if (!othIsArr) { + othTag = objToString.call(other); + if (othTag == argsTag) { + othTag = objectTag; + } else if (othTag != objectTag) { + othIsArr = isTypedArray(other); + } + } + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, + isSameTag = objTag == othTag; + + if (isSameTag && !(objIsArr || objIsObj)) { + return equalByTag(object, other, objTag); + } + if (!isLoose) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); + + if (objIsWrapped || othIsWrapped) { + return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB); + } + } + if (!isSameTag) { + return false; + } + // Assume cyclic values are equal. + // For more information on detecting circular references see https://es5.github.io/#JO. + stackA || (stackA = []); + stackB || (stackB = []); + + var length = stackA.length; + while (length--) { + if (stackA[length] == object) { + return stackB[length] == other; + } + } + // Add `object` and `other` to the stack of traversed objects. + stackA.push(object); + stackB.push(other); + + var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB); + + stackA.pop(); + stackB.pop(); + + return result; +} + +/** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparing arrays. + * @param {boolean} [isLoose] Specify performing partial comparisons. + * @param {Array} [stackA] Tracks traversed `value` objects. + * @param {Array} [stackB] Tracks traversed `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ +function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) { + var index = -1, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isLoose && othLength > arrLength)) { + return false; + } + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index], + result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined; + + if (result !== undefined) { + if (result) { + continue; + } + return false; + } + // Recursively compare arrays (susceptible to call stack limits). + if (isLoose) { + if (!arraySome(other, function(othValue) { + return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); + })) { + return false; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) { + return false; + } + } + return true; +} + +/** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} value The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalByTag(object, other, tag) { + switch (tag) { + case boolTag: + case dateTag: + // Coerce dates and booleans to numbers, dates to milliseconds and booleans + // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. + return +object == +other; + + case errorTag: + return object.name == other.name && object.message == other.message; + + case numberTag: + // Treat `NaN` vs. `NaN` as equal. + return (object != +object) + ? other != +other + : object == +other; + + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings primitives and string + // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. + return object == (other + ''); + } + return false; +} + +/** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparing values. + * @param {boolean} [isLoose] Specify performing partial comparisons. + * @param {Array} [stackA] Tracks traversed `value` objects. + * @param {Array} [stackB] Tracks traversed `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) { + var objProps = keys(object), + objLength = objProps.length, + othProps = keys(other), + othLength = othProps.length; + + if (objLength != othLength && !isLoose) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) { + return false; + } + } + var skipCtor = isLoose; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key], + result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined; + + // Recursively compare objects (susceptible to call stack limits). + if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) { + return false; + } + skipCtor || (skipCtor = key == 'constructor'); + } + if (!skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; + + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && + ('constructor' in object && 'constructor' in other) && + !(typeof objCtor == 'function' && objCtor instanceof objCtor && + typeof othCtor == 'function' && othCtor instanceof othCtor)) { + return false; + } + } + return true; +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ +function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +module.exports = baseIsEqual; + +},{"lodash.isarray":28,"lodash.istypedarray":30,"lodash.keys":31}],20:[function(require,module,exports){ +/** + * lodash 3.0.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** + * A specialized version of `baseCallback` which only supports `this` binding + * and specifying the number of arguments to provide to `func`. + * + * @private + * @param {Function} func The function to bind. + * @param {*} thisArg The `this` binding of `func`. + * @param {number} [argCount] The number of arguments to provide to `func`. + * @returns {Function} Returns the callback. + */ +function bindCallback(func, thisArg, argCount) { + if (typeof func != 'function') { + return identity; + } + if (thisArg === undefined) { + return func; + } + switch (argCount) { + case 1: return function(value) { + return func.call(thisArg, value); + }; + case 3: return function(value, index, collection) { + return func.call(thisArg, value, index, collection); + }; + case 4: return function(accumulator, value, index, collection) { + return func.call(thisArg, accumulator, value, index, collection); + }; + case 5: return function(value, other, key, object, source) { + return func.call(thisArg, value, other, key, object, source); + }; + } + return function() { + return func.apply(thisArg, arguments); + }; +} + +/** + * This method returns the first argument provided to it. + * + * @static + * @memberOf _ + * @category Utility + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'user': 'fred' }; + * + * _.identity(object) === object; + * // => true + */ +function identity(value) { + return value; +} + +module.exports = bindCallback; + +},{}],21:[function(require,module,exports){ +/** + * lodash 3.1.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var bindCallback = require('lodash._bindcallback'), + isIterateeCall = require('lodash._isiterateecall'), + restParam = require('lodash.restparam'); + +/** + * Creates a function that assigns properties of source object(s) to a given + * destination object. + * + * **Note:** This function is used to create `_.assign`, `_.defaults`, and `_.merge`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ +function createAssigner(assigner) { + return restParam(function(object, sources) { + var index = -1, + length = object == null ? 0 : sources.length, + customizer = length > 2 ? sources[length - 2] : undefined, + guard = length > 2 ? sources[2] : undefined, + thisArg = length > 1 ? sources[length - 1] : undefined; + + if (typeof customizer == 'function') { + customizer = bindCallback(customizer, thisArg, 5); + length -= 2; + } else { + customizer = typeof thisArg == 'function' ? thisArg : undefined; + length -= (customizer ? 1 : 0); + } + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; + } + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, customizer); + } + } + return object; + }); +} + +module.exports = createAssigner; + +},{"lodash._bindcallback":20,"lodash._isiterateecall":23,"lodash.restparam":35}],22:[function(require,module,exports){ +/** + * lodash 3.9.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** `Object#toString` result references. */ +var funcTag = '[object Function]'; + +/** Used to detect host constructors (Safari > 5). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var fnToString = Function.prototype.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = object == null ? undefined : object[key]; + return isNative(value) ? value : undefined; +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in older versions of Chrome and Safari which return 'function' for regexes + // and Safari 8 equivalents which return 'object' for typed array constructors. + return isObject(value) && objToString.call(value) == funcTag; +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ +function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ +function isNative(value) { + if (value == null) { + return false; + } + if (isFunction(value)) { + return reIsNative.test(fnToString.call(value)); + } + return isObjectLike(value) && reIsHostCtor.test(value); +} + +module.exports = getNative; + +},{}],23:[function(require,module,exports){ +/** + * lodash 3.0.9 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** Used to detect unsigned integer values. */ +var reIsUint = /^\d+$/; + +/** + * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * of an array-like value. + */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)); +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; + length = length == null ? MAX_SAFE_INTEGER : length; + return value > -1 && value % 1 == 0 && value < length; +} + +/** + * Checks if the provided arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. + */ +function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object)) { + var other = object[index]; + return value === value ? (value === other) : (other !== other); + } + return false; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ +function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ +function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +module.exports = isIterateeCall; + +},{}],24:[function(require,module,exports){ +(function (global){ +/** + * lodash 3.0.1 (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright 2012-2016 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** Used to determine if values are of the language type `Object`. */ +var objectTypes = { + 'function': true, + 'object': true +}; + +/** Detect free variable `exports`. */ +var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) + ? exports + : undefined; + +/** Detect free variable `module`. */ +var freeModule = (objectTypes[typeof module] && module && !module.nodeType) + ? module + : undefined; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); + +/** Detect free variable `self`. */ +var freeSelf = checkGlobal(objectTypes[typeof self] && self); + +/** Detect free variable `window`. */ +var freeWindow = checkGlobal(objectTypes[typeof window] && window); + +/** Detect `this` as the global object. */ +var thisGlobal = checkGlobal(objectTypes[typeof this] && this); + +/** + * Used as a reference to the global object. + * + * The `this` value is used if it's the global object to avoid Greasemonkey's + * restricted `window` object, otherwise the `window` object is used. + */ +var root = freeGlobal || + ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || + freeSelf || thisGlobal || Function('return this')(); + +/** + * Checks if `value` is a global object. + * + * @private + * @param {*} value The value to check. + * @returns {null|Object} Returns `value` if it's a global object, else `null`. + */ +function checkGlobal(value) { + return (value && value.Object === Object) ? value : null; +} + +module.exports = root; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],25:[function(require,module,exports){ +/** + * lodash 3.2.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var baseAssign = require('lodash._baseassign'), + createAssigner = require('lodash._createassigner'), + keys = require('lodash.keys'); + +/** + * A specialized version of `_.assign` for customizing assigned values without + * support for argument juggling, multiple sources, and `this` binding `customizer` + * functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {Function} customizer The function to customize assigned values. + * @returns {Object} Returns `object`. + */ +function assignWith(object, source, customizer) { + var index = -1, + props = keys(source), + length = props.length; + + while (++index < length) { + var key = props[index], + value = object[key], + result = customizer(value, source[key], key, object, source); + + if ((result === result ? (result !== value) : (value === value)) || + (value === undefined && !(key in object))) { + object[key] = result; + } + } + return object; +} + +/** + * Assigns own enumerable properties of source object(s) to the destination + * object. Subsequent sources overwrite property assignments of previous sources. + * If `customizer` is provided it is invoked to produce the assigned values. + * The `customizer` is bound to `thisArg` and invoked with five arguments: + * (objectValue, sourceValue, key, object, source). + * + * **Note:** This method mutates `object` and is based on + * [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign). + * + * @static + * @memberOf _ + * @alias extend + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @param {*} [thisArg] The `this` binding of `customizer`. + * @returns {Object} Returns `object`. + * @example + * + * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' }); + * // => { 'user': 'fred', 'age': 40 } + * + * // using a customizer callback + * var defaults = _.partialRight(_.assign, function(value, other) { + * return _.isUndefined(value) ? other : value; + * }); + * + * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); + * // => { 'user': 'barney', 'age': 36 } + */ +var assign = createAssigner(function(object, source, customizer) { + return customizer + ? assignWith(object, source, customizer) + : baseAssign(object, source); +}); + +module.exports = assign; + +},{"lodash._baseassign":15,"lodash._createassigner":21,"lodash.keys":31}],26:[function(require,module,exports){ +/** + * lodash 3.2.0 (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright 2012-2016 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var root = require('lodash._root'); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0, + MAX_INTEGER = 1.7976931348623157e+308, + NAN = 0 / 0; + +/** `Object#toString` result references. */ +var funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + symbolTag = '[object Symbol]'; + +/** Used to match leading and trailing whitespace. */ +var reTrim = /^\s+|\s+$/g; + +/** Used to detect bad signed hexadecimal string values. */ +var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + +/** Used to detect binary string values. */ +var reIsBinary = /^0b[01]+$/i; + +/** Used to detect octal string values. */ +var reIsOctal = /^0o[0-7]+$/i; + +/** Built-in method references without a dependency on `root`. */ +var freeParseInt = parseInt; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var Symbol = root.Symbol; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = Symbol ? symbolProto.toString : undefined; + +/** + * The base implementation of `_.clamp` which doesn't coerce arguments to numbers. + * + * @private + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + */ +function baseClamp(number, lower, upper) { + if (number === number) { + if (upper !== undefined) { + number = number <= upper ? number : upper; + } + if (lower !== undefined) { + number = number >= lower ? number : lower; + } + } + return number; +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array constructors, and + // PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to an integer. + * + * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3'); + * // => 3 + */ +function toInteger(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + var remainder = value % 1; + return value === value ? (remainder ? value - remainder : value) : 0; +} + +/** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3); + * // => 3 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3'); + * // => 3 + */ +function toNumber(value) { + if (isObject(value)) { + var other = isFunction(value.valueOf) ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); +} + +/** + * Converts `value` to a string if it's not one. An empty string is returned + * for `null` and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (value == null) { + return ''; + } + if (isSymbol(value)) { + return Symbol ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + +/** + * Checks if `string` ends with the given target string. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to search. + * @param {string} [target] The string to search for. + * @param {number} [position=string.length] The position to search from. + * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`. + * @example + * + * _.endsWith('abc', 'c'); + * // => true + * + * _.endsWith('abc', 'b'); + * // => false + * + * _.endsWith('abc', 'b', 2); + * // => true + */ +function endsWith(string, target, position) { + string = toString(string); + target = typeof target == 'string' ? target : (target + ''); + + var length = string.length; + position = position === undefined + ? length + : baseClamp(toInteger(position), 0, length); + + position -= target.length; + return position >= 0 && string.indexOf(target, position) == position; +} + +module.exports = endsWith; + +},{"lodash._root":24}],27:[function(require,module,exports){ +/** + * lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright jQuery Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8-9 which returns 'object' for typed array and other constructors. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +module.exports = isArguments; + +},{}],28:[function(require,module,exports){ +/** + * lodash 3.0.4 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** `Object#toString` result references. */ +var arrayTag = '[object Array]', + funcTag = '[object Function]'; + +/** Used to detect host constructors (Safari > 5). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var fnToString = Function.prototype.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeIsArray = getNative(Array, 'isArray'); + +/** + * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) + * of an array-like value. + */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = object == null ? undefined : object[key]; + return isNative(value) ? value : undefined; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ +function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(function() { return arguments; }()); + * // => false + */ +var isArray = nativeIsArray || function(value) { + return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; +}; + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in older versions of Chrome and Safari which return 'function' for regexes + // and Safari 8 equivalents which return 'object' for typed array constructors. + return isObject(value) && objToString.call(value) == funcTag; +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ +function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ +function isNative(value) { + if (value == null) { + return false; + } + if (isFunction(value)) { + return reIsNative.test(fnToString.call(value)); + } + return isObjectLike(value) && reIsHostCtor.test(value); +} + +module.exports = isArray; + +},{}],29:[function(require,module,exports){ +/** + * lodash 3.0.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.2 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** `Object#toString` result references. */ +var stringTag = '[object String]'; + +/** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * of values. + */ +var objToString = objectProto.toString; + +/** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ +function isString(value) { + return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag); +} + +module.exports = isString; + +},{}],30:[function(require,module,exports){ +/** + * lodash 3.0.6 (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright jQuery Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + weakMapTag = '[object WeakMap]'; + +var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + +/** Used to identify `toStringTag` values of typed arrays. */ +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = +typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = +typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = +typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = +typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag] = typedArrayTags[arrayTag] = +typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = +typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = +typedArrayTags[errorTag] = typedArrayTags[funcTag] = +typedArrayTags[mapTag] = typedArrayTags[numberTag] = +typedArrayTags[objectTag] = typedArrayTags[regexpTag] = +typedArrayTags[setTag] = typedArrayTags[stringTag] = +typedArrayTags[weakMapTag] = false; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ +function isTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; +} + +module.exports = isTypedArray; + +},{}],31:[function(require,module,exports){ +/** + * lodash 3.1.2 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var getNative = require('lodash._getnative'), + isArguments = require('lodash.isarguments'), + isArray = require('lodash.isarray'); + +/** Used to detect unsigned integer values. */ +var reIsUint = /^\d+$/; + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeKeys = getNative(Object, 'keys'); + +/** + * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) + * of an array-like value. + */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)); +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; + length = length == null ? MAX_SAFE_INTEGER : length; + return value > -1 && value % 1 == 0 && value < length; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ +function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * A fallback implementation of `Object.keys` which creates an array of the + * own enumerable property names of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function shimKeys(object) { + var props = keysIn(object), + propsLength = props.length, + length = propsLength && object.length; + + var allowIndexes = !!length && isLength(length) && + (isArray(object) || isArguments(object)); + + var index = -1, + result = []; + + while (++index < propsLength) { + var key = props[index]; + if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { + result.push(key); + } + } + return result; +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ +function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * for more details. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ +var keys = !nativeKeys ? shimKeys : function(object) { + var Ctor = object == null ? undefined : object.constructor; + if ((typeof Ctor == 'function' && Ctor.prototype === object) || + (typeof object != 'function' && isArrayLike(object))) { + return shimKeys(object); + } + return isObject(object) ? nativeKeys(object) : []; +}; + +/** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ +function keysIn(object) { + if (object == null) { + return []; + } + if (!isObject(object)) { + object = Object(object); + } + var length = object.length; + length = (length && isLength(length) && + (isArray(object) || isArguments(object)) && length) || 0; + + var Ctor = object.constructor, + index = -1, + isProto = typeof Ctor == 'function' && Ctor.prototype === object, + result = Array(length), + skipIndexes = length > 0; + + while (++index < length) { + result[index] = (index + ''); + } + for (var key in object) { + if (!(skipIndexes && isIndex(key, length)) && + !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } + } + return result; +} + +module.exports = keys; + +},{"lodash._getnative":22,"lodash.isarguments":27,"lodash.isarray":28}],32:[function(require,module,exports){ +/** + * lodash 3.0.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.7.0 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ +function last(array) { + var length = array ? array.length : 0; + return length ? array[length - 1] : undefined; +} + +module.exports = last; + +},{}],33:[function(require,module,exports){ +/** + * lodash 3.1.4 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var arrayMap = require('lodash._arraymap'), + baseCallback = require('lodash._basecallback'), + baseEach = require('lodash._baseeach'), + isArray = require('lodash.isarray'); + +/** + * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * of an array-like value. + */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** + * The base implementation of `_.map` without support for callback shorthands + * and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function baseMap(collection, iteratee) { + var index = -1, + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value, key, collection) { + result[++index] = iteratee(value, key, collection); + }); + return result; +} + +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)); +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ +function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Creates an array of values by running each element in `collection` through + * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three + * arguments: (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, + * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, + * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, + * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, + * `sum`, `uniq`, and `words` + * + * @static + * @memberOf _ + * @alias collect + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new mapped array. + * @example + * + * function timesThree(n) { + * return n * 3; + * } + * + * _.map([1, 2], timesThree); + * // => [3, 6] + * + * _.map({ 'a': 1, 'b': 2 }, timesThree); + * // => [3, 6] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // using the `_.property` callback shorthand + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */ +function map(collection, iteratee, thisArg) { + var func = isArray(collection) ? arrayMap : baseMap; + iteratee = baseCallback(iteratee, thisArg, 3); + return func(collection, iteratee); +} + +module.exports = map; + +},{"lodash._arraymap":14,"lodash._basecallback":16,"lodash._baseeach":18,"lodash.isarray":28}],34:[function(require,module,exports){ +/** + * lodash 3.0.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var keys = require('lodash.keys'); + +/** + * Converts `value` to an object if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ +function toObject(value) { + return isObject(value) ? value : Object(value); +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ +function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Creates a two dimensional array of the key-value pairs for `object`, + * e.g. `[[key1, value1], [key2, value2]]`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the new array of key-value pairs. + * @example + * + * _.pairs({ 'barney': 36, 'fred': 40 }); + * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed) + */ +function pairs(object) { + object = toObject(object); + + var index = -1, + props = keys(object), + length = props.length, + result = Array(length); + + while (++index < length) { + var key = props[index]; + result[index] = [key, object[key]]; + } + return result; +} + +module.exports = pairs; + +},{"lodash.keys":31}],35:[function(require,module,exports){ +/** + * lodash 3.6.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Creates a function that invokes `func` with the `this` binding of the + * created function and arguments from `start` and beyond provided as an array. + * + * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters). + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.restParam(function(what, names) { + * return what + ' ' + _.initial(names).join(', ') + + * (_.size(names) > 1 ? ', & ' : '') + _.last(names); + * }); + * + * say('hello', 'fred', 'barney', 'pebbles'); + * // => 'hello fred, barney, & pebbles' + */ +function restParam(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + rest = Array(length); + + while (++index < length) { + rest[index] = args[start + index]; + } + switch (start) { + case 0: return func.call(this, rest); + case 1: return func.call(this, args[0], rest); + case 2: return func.call(this, args[0], args[1], rest); + } + var otherArgs = Array(start + 1); + index = -1; + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = rest; + return func.apply(this, otherArgs); + }; +} + +module.exports = restParam; + +},{}],36:[function(require,module,exports){ +(function (process){ +'use strict'; + +if (!process.version || + process.version.indexOf('v0.') === 0 || + process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = nextTick; +} else { + module.exports = process.nextTick; +} + +function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== 'function') { + throw new TypeError('"callback" argument must be a function'); + } + var len = arguments.length; + var args, i; + switch (len) { + case 0: + case 1: + return process.nextTick(fn); + case 2: + return process.nextTick(function afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + fn.call(null, arg1, arg2, arg3); + }); + default: + args = new Array(len - 1); + i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + return process.nextTick(function afterTick() { + fn.apply(null, args); + }); + } +} + +}).call(this,require('_process')) +},{"_process":37}],37:[function(require,module,exports){ +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + +},{}],38:[function(require,module,exports){ +(function (global){ +/*! https://mths.be/punycode v1.4.1 by @mathias */ +;(function(root) { + + /** Detect free variables */ + var freeExports = typeof exports == 'object' && exports && + !exports.nodeType && exports; + var freeModule = typeof module == 'object' && module && + !module.nodeType && module; + var freeGlobal = typeof global == 'object' && global; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw new RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.4.1', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == 'function' && + typeof define.amd == 'object' && + define.amd + ) { + define('punycode', function() { + return punycode; + }); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { + // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { + // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { + // in Rhino or a web browser + root.punycode = punycode; + } + +}(this)); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],39:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +// If obj.hasOwnProperty has been overridden, then calling +// obj.hasOwnProperty(prop) will break. +// See: https://github.com/joyent/node/issues/1707 +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +module.exports = function(qs, sep, eq, options) { + sep = sep || '&'; + eq = eq || '='; + var obj = {}; + + if (typeof qs !== 'string' || qs.length === 0) { + return obj; + } + + var regexp = /\+/g; + qs = qs.split(sep); + + var maxKeys = 1000; + if (options && typeof options.maxKeys === 'number') { + maxKeys = options.maxKeys; + } + + var len = qs.length; + // maxKeys <= 0 means that we should not limit keys count + if (maxKeys > 0 && len > maxKeys) { + len = maxKeys; + } + + for (var i = 0; i < len; ++i) { + var x = qs[i].replace(regexp, '%20'), + idx = x.indexOf(eq), + kstr, vstr, k, v; + + if (idx >= 0) { + kstr = x.substr(0, idx); + vstr = x.substr(idx + 1); + } else { + kstr = x; + vstr = ''; + } + + k = decodeURIComponent(kstr); + v = decodeURIComponent(vstr); + + if (!hasOwnProperty(obj, k)) { + obj[k] = v; + } else if (isArray(obj[k])) { + obj[k].push(v); + } else { + obj[k] = [obj[k], v]; + } + } + + return obj; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +},{}],40:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var stringifyPrimitive = function(v) { + switch (typeof v) { + case 'string': + return v; + + case 'boolean': + return v ? 'true' : 'false'; + + case 'number': + return isFinite(v) ? v : ''; + + default: + return ''; + } +}; + +module.exports = function(obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + if (obj === null) { + obj = undefined; + } + + if (typeof obj === 'object') { + return map(objectKeys(obj), function(k) { + var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; + if (isArray(obj[k])) { + return map(obj[k], function(v) { + return ks + encodeURIComponent(stringifyPrimitive(v)); + }).join(sep); + } else { + return ks + encodeURIComponent(stringifyPrimitive(obj[k])); + } + }).join(sep); + + } + + if (!name) return ''; + return encodeURIComponent(stringifyPrimitive(name)) + eq + + encodeURIComponent(stringifyPrimitive(obj)); +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +function map (xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f(xs[i], i)); + } + return res; +} + +var objectKeys = Object.keys || function (obj) { + var res = []; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); + } + return res; +}; + +},{}],41:[function(require,module,exports){ +'use strict'; + +exports.decode = exports.parse = require('./decode'); +exports.encode = exports.stringify = require('./encode'); + +},{"./decode":39,"./encode":40}],42:[function(require,module,exports){ +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + +'use strict'; + +/**/ + +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + }return keys; +}; +/**/ + +module.exports = Duplex; + +/**/ +var processNextTick = require('process-nextick-args'); +/**/ + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +var Readable = require('./_stream_readable'); +var Writable = require('./_stream_writable'); + +util.inherits(Duplex, Readable); + +var keys = objectKeys(Writable.prototype); +for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; +} + +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) this.readable = false; + + if (options && options.writable === false) this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; + + this.once('end', onend); +} + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + processNextTick(onEndNT, this); +} + +function onEndNT(self) { + self.end(); +} + +function forEach(xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} +},{"./_stream_readable":44,"./_stream_writable":46,"core-util-is":7,"inherits":11,"process-nextick-args":36}],43:[function(require,module,exports){ +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + +'use strict'; + +module.exports = PassThrough; + +var Transform = require('./_stream_transform'); + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +util.inherits(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + + Transform.call(this, options); +} + +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; +},{"./_stream_transform":45,"core-util-is":7,"inherits":11}],44:[function(require,module,exports){ +(function (process){ +'use strict'; + +module.exports = Readable; + +/**/ +var processNextTick = require('process-nextick-args'); +/**/ + +/**/ +var isArray = require('isarray'); +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = require('events').EventEmitter; + +var EElistenerCount = function (emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream; +(function () { + try { + Stream = require('st' + 'ream'); + } catch (_) {} finally { + if (!Stream) Stream = require('events').EventEmitter; + } +})(); +/**/ + +var Buffer = require('buffer').Buffer; +/**/ +var bufferShim = require('buffer-shims'); +/**/ + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +/**/ +var debugUtil = require('util'); +var debug = void 0; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function () {}; +} +/**/ + +var BufferList = require('./internal/streams/BufferList'); +var StringDecoder; + +util.inherits(Readable, Stream); + +function prependListener(emitter, event, fn) { + if (typeof emitter.prependListener === 'function') { + return emitter.prependListener(event, fn); + } else { + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; + } +} + +var Duplex; +function ReadableState(options, stream) { + Duplex = Duplex || require('./_stream_duplex'); + + options = options || {}; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + + if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; + + // cast to ints. + this.highWaterMark = ~ ~this.highWaterMark; + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // when piping, we only care about 'readable' events that happen + // after read()ing all the bytes and not getting any pushback. + this.ranOut = false; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +var Duplex; +function Readable(options) { + Duplex = Duplex || require('./_stream_duplex'); + + if (!(this instanceof Readable)) return new Readable(options); + + this._readableState = new ReadableState(options, this); + + // legacy + this.readable = true; + + if (options && typeof options.read === 'function') this._read = options.read; + + Stream.call(this); +} + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + + if (!state.objectMode && typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = bufferShim.from(chunk, encoding); + encoding = ''; + } + } + + return readableAddChunk(this, state, chunk, encoding, false); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + var state = this._readableState; + return readableAddChunk(this, state, chunk, '', true); +}; + +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +function readableAddChunk(stream, state, chunk, encoding, addToFront) { + var er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (state.ended && !addToFront) { + var e = new Error('stream.push() after EOF'); + stream.emit('error', e); + } else if (state.endEmitted && addToFront) { + var _e = new Error('stream.unshift() after end event'); + stream.emit('error', _e); + } else { + var skipAdd; + if (state.decoder && !addToFront && !encoding) { + chunk = state.decoder.write(chunk); + skipAdd = !state.objectMode && chunk.length === 0; + } + + if (!addToFront) state.reading = false; + + // Don't add to the buffer if we've decoded to an empty string chunk and + // we're not in object mode + if (!skipAdd) { + // if we want the data now, just emit it. + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit('data', chunk); + stream.read(0); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + + if (state.needReadable) emitReadable(stream); + } + } + + maybeReadMore(stream, state); + } + } else if (!addToFront) { + state.reading = false; + } + + return needMoreData(state); +} + +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); +} + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; + return this; +}; + +// Don't raise the hwm > 8MB +var MAX_HWM = 0x800000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + + if (ret === null) { + state.needReadable = true; + n = 0; + } else { + state.length -= n; + } + + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } + + if (ret !== null) this.emit('data', ret); + + return ret; +}; + +function chunkInvalid(state, chunk) { + var er = null; + if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + +function onEofChunk(stream, state) { + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + + // emit 'readable' now to make sure it gets picked up. + emitReadable(stream); +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream); + } +} + +function emitReadable_(stream) { + debug('emit readable'); + stream.emit('readable'); + flow(stream); +} + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + processNextTick(maybeReadMore_, stream, state); + } +} + +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break;else len = state.length; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + this.emit('error', new Error('not implemented')); +}; + +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + + var endFn = doEnd ? onend : cleanup; + if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable) { + debug('onunpipe'); + if (readable === src) { + cleanup(); + } + } + + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', cleanup); + src.removeListener('data', ondata); + + cleanedUp = true; + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + + // If the user pushes more data while we're writing to dest then we'll end up + // in ondata again. However, we only want to increase awaitDrain once because + // dest will only emit one 'drain' event for the multiple writes. + // => Introduce a guard on increasing awaitDrain. + var increasedAwaitDrain = false; + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + increasedAwaitDrain = false; + var ret = dest.write(chunk); + if (false === ret && !increasedAwaitDrain) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', src._readableState.awaitDrain); + src._readableState.awaitDrain++; + increasedAwaitDrain = true; + } + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); + } + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function () { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} + +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + + for (var _i = 0; _i < len; _i++) { + dests[_i].emit('unpipe', this); + }return this; + } + + // try to find the right one. + var i = indexOf(state.pipes, dest); + if (i === -1) return this; + + state.pipes.splice(i, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + + dest.emit('unpipe', this); + + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + + if (ev === 'data') { + // Start flowing on next tick if stream isn't explicitly paused + if (this._readableState.flowing !== false) this.resume(); + } else if (ev === 'readable') { + var state = this._readableState; + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.emittedReadable = false; + if (!state.reading) { + processNextTick(nReadingNextTick, this); + } else if (state.length) { + emitReadable(this, state); + } + } + } + + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + state.flowing = true; + resume(this, state); + } + return this; +}; + +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + processNextTick(resume_, stream, state); + } +} + +function resume_(stream, state) { + if (!state.reading) { + debug('resume read 0'); + stream.read(0); + } + + state.resumeScheduled = false; + state.awaitDrain = 0; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} + +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (false !== this._readableState.flowing) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + return this; +}; + +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null) {} +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var state = this._readableState; + var paused = false; + + var self = this; + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) self.push(chunk); + } + + self.push(null); + }); + + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + + var ret = self.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function (method) { + return function () { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + var events = ['error', 'close', 'destroy', 'pause', 'resume']; + forEach(events, function (ev) { + stream.on(ev, self.emit.bind(self, ev)); + }); + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + self._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + + return self; +}; + +// exposed for testing purposes only. +Readable._fromList = fromList; + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = fromListPartial(n, state.buffer, state.decoder); + } + + return ret; +} + +// Extracts only enough buffered data to satisfy the amount requested. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromListPartial(n, list, hasStrings) { + var ret; + if (n < list.head.data.length) { + // slice is the same for buffers and strings + ret = list.head.data.slice(0, n); + list.head.data = list.head.data.slice(n); + } else if (n === list.head.data.length) { + // first chunk is a perfect match + ret = list.shift(); + } else { + // result spans more than one buffer + ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); + } + return ret; +} + +// Copies a specified amount of characters from the list of buffered data +// chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBufferString(n, list) { + var p = list.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +// Copies a specified amount of bytes from the list of buffered data chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBuffer(n, list) { + var ret = bufferShim.allocUnsafe(n); + var p = list.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); + + if (!state.endEmitted) { + state.ended = true; + processNextTick(endReadableNT, state, stream); + } +} + +function endReadableNT(state, stream) { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } +} + +function forEach(xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} + +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} +}).call(this,require('_process')) +},{"./_stream_duplex":42,"./internal/streams/BufferList":47,"_process":37,"buffer":5,"buffer-shims":4,"core-util-is":7,"events":8,"inherits":11,"isarray":13,"process-nextick-args":36,"string_decoder/":53,"util":3}],45:[function(require,module,exports){ +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + +'use strict'; + +module.exports = Transform; + +var Duplex = require('./_stream_duplex'); + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +util.inherits(Transform, Duplex); + +function TransformState(stream) { + this.afterTransform = function (er, data) { + return afterTransform(stream, er, data); + }; + + this.needTransform = false; + this.transforming = false; + this.writecb = null; + this.writechunk = null; + this.writeencoding = null; +} + +function afterTransform(stream, er, data) { + var ts = stream._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) return stream.emit('error', new Error('no writecb in Transform class')); + + ts.writechunk = null; + ts.writecb = null; + + if (data !== null && data !== undefined) stream.push(data); + + cb(er); + + var rs = stream._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + stream._read(rs.highWaterMark); + } +} + +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + + Duplex.call(this, options); + + this._transformState = new TransformState(this); + + // when the writable side finishes, then flush out anything remaining. + var stream = this; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + + if (typeof options.flush === 'function') this._flush = options.flush; + } + + this.once('prefinish', function () { + if (typeof this._flush === 'function') this._flush(function (er) { + done(stream, er); + });else done(stream); + }); +} + +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + throw new Error('Not implemented'); +}; + +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + +function done(stream, er) { + if (er) return stream.emit('error', er); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + var ws = stream._writableState; + var ts = stream._transformState; + + if (ws.length) throw new Error('Calling transform done when ws.length != 0'); + + if (ts.transforming) throw new Error('Calling transform done when still transforming'); + + return stream.push(null); +} +},{"./_stream_duplex":42,"core-util-is":7,"inherits":11}],46:[function(require,module,exports){ +(function (process){ +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + +'use strict'; + +module.exports = Writable; + +/**/ +var processNextTick = require('process-nextick-args'); +/**/ + +/**/ +var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +/**/ +var internalUtil = { + deprecate: require('util-deprecate') +}; +/**/ + +/**/ +var Stream; +(function () { + try { + Stream = require('st' + 'ream'); + } catch (_) {} finally { + if (!Stream) Stream = require('events').EventEmitter; + } +})(); +/**/ + +var Buffer = require('buffer').Buffer; +/**/ +var bufferShim = require('buffer-shims'); +/**/ + +util.inherits(Writable, Stream); + +function nop() {} + +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +var Duplex; +function WritableState(options, stream) { + Duplex = Duplex || require('./_stream_duplex'); + + options = options || {}; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; + + // cast to ints. + this.highWaterMark = ~ ~this.highWaterMark; + + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} + +WritableState.prototype.getBuffer = function writableStateGetBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; + +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function () { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.') + }); + } catch (_) {} +})(); + +var Duplex; +function Writable(options) { + Duplex = Duplex || require('./_stream_duplex'); + + // Writable ctor is applied to Duplexes, though they're not + // instanceof Writable, they're instanceof Readable. + if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options); + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + if (options) { + if (typeof options.write === 'function') this._write = options.write; + + if (typeof options.writev === 'function') this._writev = options.writev; + } + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + this.emit('error', new Error('Cannot pipe, not readable')); +}; + +function writeAfterEnd(stream, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + processNextTick(cb, er); +} + +// If we get something that is not a buffer, string, null, or undefined, +// and we're not in objectMode, then that's an error. +// Otherwise stream chunks are all considered to be of length=1, and the +// watermarks determine how many objects to keep in the buffer, rather than +// how many bytes or characters. +function validChunk(stream, state, chunk, cb) { + var valid = true; + var er = false; + // Always throw error if a null is written + // if we are not in object mode then throw + // if it is not a buffer, string, or undefined. + if (chunk === null) { + er = new TypeError('May not write null values to stream'); + } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + if (er) { + stream.emit('error', er); + processNextTick(cb, er); + valid = false; + } + return valid; +} + +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + + if (typeof cb !== 'function') cb = nop; + + if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, chunk, encoding, cb); + } + + return ret; +}; + +Writable.prototype.cork = function () { + var state = this._writableState; + + state.corked++; +}; + +Writable.prototype.uncork = function () { + var state = this._writableState; + + if (state.corked) { + state.corked--; + + if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; + +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = bufferShim.from(chunk, encoding); + } + return chunk; +} + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, chunk, encoding, cb) { + chunk = decodeChunk(state, chunk, encoding); + + if (Buffer.isBuffer(chunk)) encoding = 'buffer'; + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = new WriteReq(chunk, encoding, cb); + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + + return ret; +} + +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) processNextTick(cb, er);else cb(er); + + stream._writableState.errorEmitted = true; + stream.emit('error', er); +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + + onwriteStateUpdate(state); + + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state); + + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + + if (sync) { + /**/ + asyncWrite(afterWrite, stream, state, finished, cb); + /**/ + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + + var count = 0; + while (entry) { + buffer[count] = entry; + entry = entry.next; + count += 1; + } + + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + + if (entry === null) state.lastBufferedRequest = null; + } + + state.bufferedRequestCount = 0; + state.bufferedRequest = entry; + state.bufferProcessing = false; +} + +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new Error('not implemented')); +}; + +Writable.prototype._writev = null; + +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) endWritable(this, state, cb); +}; + +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} + +function prefinish(stream, state) { + if (!state.prefinished) { + state.prefinished = true; + stream.emit('prefinish'); + } +} + +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + if (state.pendingcb === 0) { + prefinish(stream, state); + state.finished = true; + stream.emit('finish'); + } else { + prefinish(stream, state); + } + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) processNextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + + this.next = null; + this.entry = null; + + this.finish = function (err) { + var entry = _this.entry; + _this.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + if (state.corkedRequestsFree) { + state.corkedRequestsFree.next = _this; + } else { + state.corkedRequestsFree = _this; + } + }; +} +}).call(this,require('_process')) +},{"./_stream_duplex":42,"_process":37,"buffer":5,"buffer-shims":4,"core-util-is":7,"events":8,"inherits":11,"process-nextick-args":36,"util-deprecate":57}],47:[function(require,module,exports){ +'use strict'; + +var Buffer = require('buffer').Buffer; +/**/ +var bufferShim = require('buffer-shims'); +/**/ + +module.exports = BufferList; + +function BufferList() { + this.head = null; + this.tail = null; + this.length = 0; +} + +BufferList.prototype.push = function (v) { + var entry = { data: v, next: null }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; +}; + +BufferList.prototype.unshift = function (v) { + var entry = { data: v, next: this.head }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; +}; + +BufferList.prototype.shift = function () { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; +}; + +BufferList.prototype.clear = function () { + this.head = this.tail = null; + this.length = 0; +}; + +BufferList.prototype.join = function (s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) { + ret += s + p.data; + }return ret; +}; + +BufferList.prototype.concat = function (n) { + if (this.length === 0) return bufferShim.alloc(0); + if (this.length === 1) return this.head.data; + var ret = bufferShim.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + p.data.copy(ret, i); + i += p.data.length; + p = p.next; + } + return ret; +}; +},{"buffer":5,"buffer-shims":4}],48:[function(require,module,exports){ +(function (process){ +var Stream = (function (){ + try { + return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify + } catch(_){} +}()); +exports = module.exports = require('./lib/_stream_readable.js'); +exports.Stream = Stream || exports; +exports.Readable = exports; +exports.Writable = require('./lib/_stream_writable.js'); +exports.Duplex = require('./lib/_stream_duplex.js'); +exports.Transform = require('./lib/_stream_transform.js'); +exports.PassThrough = require('./lib/_stream_passthrough.js'); + +if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) { + module.exports = Stream; +} + +}).call(this,require('_process')) +},{"./lib/_stream_duplex.js":42,"./lib/_stream_passthrough.js":43,"./lib/_stream_readable.js":44,"./lib/_stream_transform.js":45,"./lib/_stream_writable.js":46,"_process":37}],49:[function(require,module,exports){ +(function (global){ +var ClientRequest = require('./lib/request') +var extend = require('xtend') +var statusCodes = require('builtin-status-codes') +var url = require('url') + +var http = exports + +http.request = function (opts, cb) { + if (typeof opts === 'string') + opts = url.parse(opts) + else + opts = extend(opts) + + // Normally, the page is loaded from http or https, so not specifying a protocol + // will result in a (valid) protocol-relative url. However, this won't work if + // the protocol is something else, like 'file:' + var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '' + + var protocol = opts.protocol || defaultProtocol + var host = opts.hostname || opts.host + var port = opts.port + var path = opts.path || '/' + + // Necessary for IPv6 addresses + if (host && host.indexOf(':') !== -1) + host = '[' + host + ']' + + // This may be a relative url. The browser should always be able to interpret it correctly. + opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path + opts.method = (opts.method || 'GET').toUpperCase() + opts.headers = opts.headers || {} + + // Also valid opts.auth, opts.mode + + var req = new ClientRequest(opts) + if (cb) + req.on('response', cb) + return req +} + +http.get = function get (opts, cb) { + var req = http.request(opts, cb) + req.end() + return req +} + +http.Agent = function () {} +http.Agent.defaultMaxSockets = 4 + +http.STATUS_CODES = statusCodes + +http.METHODS = [ + 'CHECKOUT', + 'CONNECT', + 'COPY', + 'DELETE', + 'GET', + 'HEAD', + 'LOCK', + 'M-SEARCH', + 'MERGE', + 'MKACTIVITY', + 'MKCOL', + 'MOVE', + 'NOTIFY', + 'OPTIONS', + 'PATCH', + 'POST', + 'PROPFIND', + 'PROPPATCH', + 'PURGE', + 'PUT', + 'REPORT', + 'SEARCH', + 'SUBSCRIBE', + 'TRACE', + 'UNLOCK', + 'UNSUBSCRIBE' +] +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./lib/request":51,"builtin-status-codes":6,"url":55,"xtend":58}],50:[function(require,module,exports){ +(function (global){ +exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream) + +exports.blobConstructor = false +try { + new Blob([new ArrayBuffer(1)]) + exports.blobConstructor = true +} catch (e) {} + +var xhr = new global.XMLHttpRequest() +// If location.host is empty, e.g. if this page/worker was loaded +// from a Blob, then use example.com to avoid an error +xhr.open('GET', global.location.host ? '/' : 'https://example.com') + +function checkTypeSupport (type) { + try { + xhr.responseType = type + return xhr.responseType === type + } catch (e) {} + return false +} + +// For some strange reason, Safari 7.0 reports typeof global.ArrayBuffer === 'object'. +// Safari 7.1 appears to have fixed this bug. +var haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined' +var haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice) + +exports.arraybuffer = haveArrayBuffer && checkTypeSupport('arraybuffer') +// These next two tests unavoidably show warnings in Chrome. Since fetch will always +// be used if it's available, just return false for these to avoid the warnings. +exports.msstream = !exports.fetch && haveSlice && checkTypeSupport('ms-stream') +exports.mozchunkedarraybuffer = !exports.fetch && haveArrayBuffer && + checkTypeSupport('moz-chunked-arraybuffer') +exports.overrideMimeType = isFunction(xhr.overrideMimeType) +exports.vbArray = isFunction(global.VBArray) + +function isFunction (value) { + return typeof value === 'function' +} + +xhr = null // Help gc + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],51:[function(require,module,exports){ +(function (process,global,Buffer){ +var capability = require('./capability') +var inherits = require('inherits') +var response = require('./response') +var stream = require('readable-stream') +var toArrayBuffer = require('to-arraybuffer') + +var IncomingMessage = response.IncomingMessage +var rStates = response.readyStates + +function decideMode (preferBinary, useFetch) { + if (capability.fetch && useFetch) { + return 'fetch' + } else if (capability.mozchunkedarraybuffer) { + return 'moz-chunked-arraybuffer' + } else if (capability.msstream) { + return 'ms-stream' + } else if (capability.arraybuffer && preferBinary) { + return 'arraybuffer' + } else if (capability.vbArray && preferBinary) { + return 'text:vbarray' + } else { + return 'text' + } +} + +var ClientRequest = module.exports = function (opts) { + var self = this + stream.Writable.call(self) + + self._opts = opts + self._body = [] + self._headers = {} + if (opts.auth) + self.setHeader('Authorization', 'Basic ' + new Buffer(opts.auth).toString('base64')) + Object.keys(opts.headers).forEach(function (name) { + self.setHeader(name, opts.headers[name]) + }) + + var preferBinary + var useFetch = true + if (opts.mode === 'disable-fetch') { + // If the use of XHR should be preferred and includes preserving the 'content-type' header + useFetch = false + preferBinary = true + } else if (opts.mode === 'prefer-streaming') { + // If streaming is a high priority but binary compatibility and + // the accuracy of the 'content-type' header aren't + preferBinary = false + } else if (opts.mode === 'allow-wrong-content-type') { + // If streaming is more important than preserving the 'content-type' header + preferBinary = !capability.overrideMimeType + } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') { + // Use binary if text streaming may corrupt data or the content-type header, or for speed + preferBinary = true + } else { + throw new Error('Invalid value for opts.mode') + } + self._mode = decideMode(preferBinary, useFetch) + + self.on('finish', function () { + self._onFinish() + }) +} + +inherits(ClientRequest, stream.Writable) + +ClientRequest.prototype.setHeader = function (name, value) { + var self = this + var lowerName = name.toLowerCase() + // This check is not necessary, but it prevents warnings from browsers about setting unsafe + // headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but + // http-browserify did it, so I will too. + if (unsafeHeaders.indexOf(lowerName) !== -1) + return + + self._headers[lowerName] = { + name: name, + value: value + } +} + +ClientRequest.prototype.getHeader = function (name) { + var self = this + return self._headers[name.toLowerCase()].value +} + +ClientRequest.prototype.removeHeader = function (name) { + var self = this + delete self._headers[name.toLowerCase()] +} + +ClientRequest.prototype._onFinish = function () { + var self = this + + if (self._destroyed) + return + var opts = self._opts + + var headersObj = self._headers + var body + if (opts.method === 'POST' || opts.method === 'PUT' || opts.method === 'PATCH') { + if (capability.blobConstructor) { + body = new global.Blob(self._body.map(function (buffer) { + return toArrayBuffer(buffer) + }), { + type: (headersObj['content-type'] || {}).value || '' + }) + } else { + // get utf8 string + body = Buffer.concat(self._body).toString() + } + } + + if (self._mode === 'fetch') { + var headers = Object.keys(headersObj).map(function (name) { + return [headersObj[name].name, headersObj[name].value] + }) + + global.fetch(self._opts.url, { + method: self._opts.method, + headers: headers, + body: body, + mode: 'cors', + credentials: opts.withCredentials ? 'include' : 'same-origin' + }).then(function (response) { + self._fetchResponse = response + self._connect() + }, function (reason) { + self.emit('error', reason) + }) + } else { + var xhr = self._xhr = new global.XMLHttpRequest() + try { + xhr.open(self._opts.method, self._opts.url, true) + } catch (err) { + process.nextTick(function () { + self.emit('error', err) + }) + return + } + + // Can't set responseType on really old browsers + if ('responseType' in xhr) + xhr.responseType = self._mode.split(':')[0] + + if ('withCredentials' in xhr) + xhr.withCredentials = !!opts.withCredentials + + if (self._mode === 'text' && 'overrideMimeType' in xhr) + xhr.overrideMimeType('text/plain; charset=x-user-defined') + + Object.keys(headersObj).forEach(function (name) { + xhr.setRequestHeader(headersObj[name].name, headersObj[name].value) + }) + + self._response = null + xhr.onreadystatechange = function () { + switch (xhr.readyState) { + case rStates.LOADING: + case rStates.DONE: + self._onXHRProgress() + break + } + } + // Necessary for streaming in Firefox, since xhr.response is ONLY defined + // in onprogress, not in onreadystatechange with xhr.readyState = 3 + if (self._mode === 'moz-chunked-arraybuffer') { + xhr.onprogress = function () { + self._onXHRProgress() + } + } + + xhr.onerror = function () { + if (self._destroyed) + return + self.emit('error', new Error('XHR error')) + } + + try { + xhr.send(body) + } catch (err) { + process.nextTick(function () { + self.emit('error', err) + }) + return + } + } +} + +/** + * Checks if xhr.status is readable and non-zero, indicating no error. + * Even though the spec says it should be available in readyState 3, + * accessing it throws an exception in IE8 + */ +function statusValid (xhr) { + try { + var status = xhr.status + return (status !== null && status !== 0) + } catch (e) { + return false + } +} + +ClientRequest.prototype._onXHRProgress = function () { + var self = this + + if (!statusValid(self._xhr) || self._destroyed) + return + + if (!self._response) + self._connect() + + self._response._onXHRProgress() +} + +ClientRequest.prototype._connect = function () { + var self = this + + if (self._destroyed) + return + + self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode) + self.emit('response', self._response) +} + +ClientRequest.prototype._write = function (chunk, encoding, cb) { + var self = this + + self._body.push(chunk) + cb() +} + +ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () { + var self = this + self._destroyed = true + if (self._response) + self._response._destroyed = true + if (self._xhr) + self._xhr.abort() + // Currently, there isn't a way to truly abort a fetch. + // If you like bikeshedding, see https://github.com/whatwg/fetch/issues/27 +} + +ClientRequest.prototype.end = function (data, encoding, cb) { + var self = this + if (typeof data === 'function') { + cb = data + data = undefined + } + + stream.Writable.prototype.end.call(self, data, encoding, cb) +} + +ClientRequest.prototype.flushHeaders = function () {} +ClientRequest.prototype.setTimeout = function () {} +ClientRequest.prototype.setNoDelay = function () {} +ClientRequest.prototype.setSocketKeepAlive = function () {} + +// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method +var unsafeHeaders = [ + 'accept-charset', + 'accept-encoding', + 'access-control-request-headers', + 'access-control-request-method', + 'connection', + 'content-length', + 'cookie', + 'cookie2', + 'date', + 'dnt', + 'expect', + 'host', + 'keep-alive', + 'origin', + 'referer', + 'te', + 'trailer', + 'transfer-encoding', + 'upgrade', + 'user-agent', + 'via' +] + +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) +},{"./capability":50,"./response":52,"_process":37,"buffer":5,"inherits":11,"readable-stream":48,"to-arraybuffer":54}],52:[function(require,module,exports){ +(function (process,global,Buffer){ +var capability = require('./capability') +var inherits = require('inherits') +var stream = require('readable-stream') + +var rStates = exports.readyStates = { + UNSENT: 0, + OPENED: 1, + HEADERS_RECEIVED: 2, + LOADING: 3, + DONE: 4 +} + +var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode) { + var self = this + stream.Readable.call(self) + + self._mode = mode + self.headers = {} + self.rawHeaders = [] + self.trailers = {} + self.rawTrailers = [] + + // Fake the 'close' event, but only once 'end' fires + self.on('end', function () { + // The nextTick is necessary to prevent the 'request' module from causing an infinite loop + process.nextTick(function () { + self.emit('close') + }) + }) + + if (mode === 'fetch') { + self._fetchResponse = response + + self.url = response.url + self.statusCode = response.status + self.statusMessage = response.statusText + // backwards compatible version of for ( of ): + // for (var ,_i,_it = [Symbol.iterator](); = (_i = _it.next()).value,!_i.done;) + for (var header, _i, _it = response.headers[Symbol.iterator](); header = (_i = _it.next()).value, !_i.done;) { + self.headers[header[0].toLowerCase()] = header[1] + self.rawHeaders.push(header[0], header[1]) + } + + // TODO: this doesn't respect backpressure. Once WritableStream is available, this can be fixed + var reader = response.body.getReader() + function read () { + reader.read().then(function (result) { + if (self._destroyed) + return + if (result.done) { + self.push(null) + return + } + self.push(new Buffer(result.value)) + read() + }) + } + read() + + } else { + self._xhr = xhr + self._pos = 0 + + self.url = xhr.responseURL + self.statusCode = xhr.status + self.statusMessage = xhr.statusText + var headers = xhr.getAllResponseHeaders().split(/\r?\n/) + headers.forEach(function (header) { + var matches = header.match(/^([^:]+):\s*(.*)/) + if (matches) { + var key = matches[1].toLowerCase() + if (key === 'set-cookie') { + if (self.headers[key] === undefined) { + self.headers[key] = [] + } + self.headers[key].push(matches[2]) + } else if (self.headers[key] !== undefined) { + self.headers[key] += ', ' + matches[2] + } else { + self.headers[key] = matches[2] + } + self.rawHeaders.push(matches[1], matches[2]) + } + }) + + self._charset = 'x-user-defined' + if (!capability.overrideMimeType) { + var mimeType = self.rawHeaders['mime-type'] + if (mimeType) { + var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/) + if (charsetMatch) { + self._charset = charsetMatch[1].toLowerCase() + } + } + if (!self._charset) + self._charset = 'utf-8' // best guess + } + } +} + +inherits(IncomingMessage, stream.Readable) + +IncomingMessage.prototype._read = function () {} + +IncomingMessage.prototype._onXHRProgress = function () { + var self = this + + var xhr = self._xhr + + var response = null + switch (self._mode) { + case 'text:vbarray': // For IE9 + if (xhr.readyState !== rStates.DONE) + break + try { + // This fails in IE8 + response = new global.VBArray(xhr.responseBody).toArray() + } catch (e) {} + if (response !== null) { + self.push(new Buffer(response)) + break + } + // Falls through in IE8 + case 'text': + try { // This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4 + response = xhr.responseText + } catch (e) { + self._mode = 'text:vbarray' + break + } + if (response.length > self._pos) { + var newData = response.substr(self._pos) + if (self._charset === 'x-user-defined') { + var buffer = new Buffer(newData.length) + for (var i = 0; i < newData.length; i++) + buffer[i] = newData.charCodeAt(i) & 0xff + + self.push(buffer) + } else { + self.push(newData, self._charset) + } + self._pos = response.length + } + break + case 'arraybuffer': + if (xhr.readyState !== rStates.DONE || !xhr.response) + break + response = xhr.response + self.push(new Buffer(new Uint8Array(response))) + break + case 'moz-chunked-arraybuffer': // take whole + response = xhr.response + if (xhr.readyState !== rStates.LOADING || !response) + break + self.push(new Buffer(new Uint8Array(response))) + break + case 'ms-stream': + response = xhr.response + if (xhr.readyState !== rStates.LOADING) + break + var reader = new global.MSStreamReader() + reader.onprogress = function () { + if (reader.result.byteLength > self._pos) { + self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos)))) + self._pos = reader.result.byteLength + } + } + reader.onload = function () { + self.push(null) + } + // reader.onerror = ??? // TODO: this + reader.readAsArrayBuffer(response) + break + } + + // The ms-stream case handles end separately in reader.onload() + if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') { + self.push(null) + } +} + +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) +},{"./capability":50,"_process":37,"buffer":5,"inherits":11,"readable-stream":48}],53:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var Buffer = require('buffer').Buffer; + +var isBufferEncoding = Buffer.isEncoding + || function(encoding) { + switch (encoding && encoding.toLowerCase()) { + case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; + default: return false; + } + } + + +function assertEncoding(encoding) { + if (encoding && !isBufferEncoding(encoding)) { + throw new Error('Unknown encoding: ' + encoding); + } +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. CESU-8 is handled as part of the UTF-8 encoding. +// +// @TODO Handling all encodings inside a single object makes it very difficult +// to reason about this code, so it should be split up in the future. +// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code +// points as used by CESU-8. +var StringDecoder = exports.StringDecoder = function(encoding) { + this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); + assertEncoding(encoding); + switch (this.encoding) { + case 'utf8': + // CESU-8 represents each of Surrogate Pair by 3-bytes + this.surrogateSize = 3; + break; + case 'ucs2': + case 'utf16le': + // UTF-16 represents each of Surrogate Pair by 2-bytes + this.surrogateSize = 2; + this.detectIncompleteChar = utf16DetectIncompleteChar; + break; + case 'base64': + // Base-64 stores 3 bytes in 4 chars, and pads the remainder. + this.surrogateSize = 3; + this.detectIncompleteChar = base64DetectIncompleteChar; + break; + default: + this.write = passThroughWrite; + return; + } + + // Enough space to store all bytes of a single character. UTF-8 needs 4 + // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). + this.charBuffer = new Buffer(6); + // Number of bytes received for the current incomplete multi-byte character. + this.charReceived = 0; + // Number of bytes expected for the current incomplete multi-byte character. + this.charLength = 0; +}; + + +// write decodes the given buffer and returns it as JS string that is +// guaranteed to not contain any partial multi-byte characters. Any partial +// character found at the end of the buffer is buffered up, and will be +// returned when calling write again with the remaining bytes. +// +// Note: Converting a Buffer containing an orphan surrogate to a String +// currently works, but converting a String to a Buffer (via `new Buffer`, or +// Buffer#write) will replace incomplete surrogates with the unicode +// replacement character. See https://codereview.chromium.org/121173009/ . +StringDecoder.prototype.write = function(buffer) { + var charStr = ''; + // if our last write ended with an incomplete multibyte character + while (this.charLength) { + // determine how many remaining bytes this buffer has to offer for this char + var available = (buffer.length >= this.charLength - this.charReceived) ? + this.charLength - this.charReceived : + buffer.length; + + // add the new bytes to the char buffer + buffer.copy(this.charBuffer, this.charReceived, 0, available); + this.charReceived += available; + + if (this.charReceived < this.charLength) { + // still not enough chars in this buffer? wait for more ... + return ''; + } + + // remove bytes belonging to the current character from the buffer + buffer = buffer.slice(available, buffer.length); + + // get the character that was split + charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); + + // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character + var charCode = charStr.charCodeAt(charStr.length - 1); + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + this.charLength += this.surrogateSize; + charStr = ''; + continue; + } + this.charReceived = this.charLength = 0; + + // if there are no more bytes in this buffer, just emit our char + if (buffer.length === 0) { + return charStr; + } + break; + } + + // determine and set charLength / charReceived + this.detectIncompleteChar(buffer); + + var end = buffer.length; + if (this.charLength) { + // buffer the incomplete character bytes we got + buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); + end -= this.charReceived; + } + + charStr += buffer.toString(this.encoding, 0, end); + + var end = charStr.length - 1; + var charCode = charStr.charCodeAt(end); + // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + var size = this.surrogateSize; + this.charLength += size; + this.charReceived += size; + this.charBuffer.copy(this.charBuffer, size, 0, size); + buffer.copy(this.charBuffer, 0, 0, size); + return charStr.substring(0, end); + } + + // or just emit the charStr + return charStr; +}; + +// detectIncompleteChar determines if there is an incomplete UTF-8 character at +// the end of the given buffer. If so, it sets this.charLength to the byte +// length that character, and sets this.charReceived to the number of bytes +// that are available for this character. +StringDecoder.prototype.detectIncompleteChar = function(buffer) { + // determine how many bytes we have to check at the end of this buffer + var i = (buffer.length >= 3) ? 3 : buffer.length; + + // Figure out if one of the last i bytes of our buffer announces an + // incomplete char. + for (; i > 0; i--) { + var c = buffer[buffer.length - i]; + + // See http://en.wikipedia.org/wiki/UTF-8#Description + + // 110XXXXX + if (i == 1 && c >> 5 == 0x06) { + this.charLength = 2; + break; + } + + // 1110XXXX + if (i <= 2 && c >> 4 == 0x0E) { + this.charLength = 3; + break; + } + + // 11110XXX + if (i <= 3 && c >> 3 == 0x1E) { + this.charLength = 4; + break; + } + } + this.charReceived = i; +}; + +StringDecoder.prototype.end = function(buffer) { + var res = ''; + if (buffer && buffer.length) + res = this.write(buffer); + + if (this.charReceived) { + var cr = this.charReceived; + var buf = this.charBuffer; + var enc = this.encoding; + res += buf.slice(0, cr).toString(enc); + } + + return res; +}; + +function passThroughWrite(buffer) { + return buffer.toString(this.encoding); +} + +function utf16DetectIncompleteChar(buffer) { + this.charReceived = buffer.length % 2; + this.charLength = this.charReceived ? 2 : 0; +} + +function base64DetectIncompleteChar(buffer) { + this.charReceived = buffer.length % 3; + this.charLength = this.charReceived ? 3 : 0; +} + +},{"buffer":5}],54:[function(require,module,exports){ +var Buffer = require('buffer').Buffer + +module.exports = function (buf) { + // If the buffer is backed by a Uint8Array, a faster version will work + if (buf instanceof Uint8Array) { + // If the buffer isn't a subarray, return the underlying ArrayBuffer + if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) { + return buf.buffer + } else if (typeof buf.buffer.slice === 'function') { + // Otherwise we need to get a proper copy + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength) + } + } + + if (Buffer.isBuffer(buf)) { + // This is the slow version that will work with any Buffer + // implementation (even in old browsers) + var arrayCopy = new Uint8Array(buf.length) + var len = buf.length + for (var i = 0; i < len; i++) { + arrayCopy[i] = buf[i] + } + return arrayCopy.buffer + } else { + throw new Error('Argument must be a Buffer') + } +} + +},{"buffer":5}],55:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var punycode = require('punycode'); +var util = require('./util'); + +exports.parse = urlParse; +exports.resolve = urlResolve; +exports.resolveObject = urlResolveObject; +exports.format = urlFormat; + +exports.Url = Url; + +function Url() { + this.protocol = null; + this.slashes = null; + this.auth = null; + this.host = null; + this.port = null; + this.hostname = null; + this.hash = null; + this.search = null; + this.query = null; + this.pathname = null; + this.path = null; + this.href = null; +} + +// Reference: RFC 3986, RFC 1808, RFC 2396 + +// define these here so at least they only have to be +// compiled once on the first module load. +var protocolPattern = /^([a-z0-9.+-]+:)/i, + portPattern = /:[0-9]*$/, + + // Special case for a simple path URL + simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, + + // RFC 2396: characters reserved for delimiting URLs. + // We actually just auto-escape these. + delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], + + // RFC 2396: characters not allowed for various reasons. + unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), + + // Allowed by RFCs, but cause of XSS attacks. Always escape these. + autoEscape = ['\''].concat(unwise), + // Characters that are never ever allowed in a hostname. + // Note that any invalid chars are also handled, but these + // are the ones that are *expected* to be seen, so we fast-path + // them. + nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), + hostEndingChars = ['/', '?', '#'], + hostnameMaxLen = 255, + hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, + hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, + // protocols that can allow "unsafe" and "unwise" chars. + unsafeProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that never have a hostname. + hostlessProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that always contain a // bit. + slashedProtocol = { + 'http': true, + 'https': true, + 'ftp': true, + 'gopher': true, + 'file': true, + 'http:': true, + 'https:': true, + 'ftp:': true, + 'gopher:': true, + 'file:': true + }, + querystring = require('querystring'); + +function urlParse(url, parseQueryString, slashesDenoteHost) { + if (url && util.isObject(url) && url instanceof Url) return url; + + var u = new Url; + u.parse(url, parseQueryString, slashesDenoteHost); + return u; +} + +Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { + if (!util.isString(url)) { + throw new TypeError("Parameter 'url' must be a string, not " + typeof url); + } + + // Copy chrome, IE, opera backslash-handling behavior. + // Back slashes before the query string get converted to forward slashes + // See: https://code.google.com/p/chromium/issues/detail?id=25916 + var queryIndex = url.indexOf('?'), + splitter = + (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', + uSplit = url.split(splitter), + slashRegex = /\\/g; + uSplit[0] = uSplit[0].replace(slashRegex, '/'); + url = uSplit.join(splitter); + + var rest = url; + + // trim before proceeding. + // This is to support parse stuff like " http://foo.com \n" + rest = rest.trim(); + + if (!slashesDenoteHost && url.split('#').length === 1) { + // Try fast path regexp + var simplePath = simplePathPattern.exec(rest); + if (simplePath) { + this.path = rest; + this.href = rest; + this.pathname = simplePath[1]; + if (simplePath[2]) { + this.search = simplePath[2]; + if (parseQueryString) { + this.query = querystring.parse(this.search.substr(1)); + } else { + this.query = this.search.substr(1); + } + } else if (parseQueryString) { + this.search = ''; + this.query = {}; + } + return this; + } + } + + var proto = protocolPattern.exec(rest); + if (proto) { + proto = proto[0]; + var lowerProto = proto.toLowerCase(); + this.protocol = lowerProto; + rest = rest.substr(proto.length); + } + + // figure out if it's got a host + // user@server is *always* interpreted as a hostname, and url + // resolution will treat //foo/bar as host=foo,path=bar because that's + // how the browser resolves relative URLs. + if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { + var slashes = rest.substr(0, 2) === '//'; + if (slashes && !(proto && hostlessProtocol[proto])) { + rest = rest.substr(2); + this.slashes = true; + } + } + + if (!hostlessProtocol[proto] && + (slashes || (proto && !slashedProtocol[proto]))) { + + // there's a hostname. + // the first instance of /, ?, ;, or # ends the host. + // + // If there is an @ in the hostname, then non-host chars *are* allowed + // to the left of the last @ sign, unless some host-ending character + // comes *before* the @-sign. + // URLs are obnoxious. + // + // ex: + // http://a@b@c/ => user:a@b host:c + // http://a@b?@c => user:a host:c path:/?@c + + // v0.12 TODO(isaacs): This is not quite how Chrome does things. + // Review our test case against browsers more comprehensively. + + // find the first instance of any hostEndingChars + var hostEnd = -1; + for (var i = 0; i < hostEndingChars.length; i++) { + var hec = rest.indexOf(hostEndingChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + + // at this point, either we have an explicit point where the + // auth portion cannot go past, or the last @ char is the decider. + var auth, atSign; + if (hostEnd === -1) { + // atSign can be anywhere. + atSign = rest.lastIndexOf('@'); + } else { + // atSign must be in auth portion. + // http://a@b/c@d => host:b auth:a path:/c@d + atSign = rest.lastIndexOf('@', hostEnd); + } + + // Now we have a portion which is definitely the auth. + // Pull that off. + if (atSign !== -1) { + auth = rest.slice(0, atSign); + rest = rest.slice(atSign + 1); + this.auth = decodeURIComponent(auth); + } + + // the host is the remaining to the left of the first non-host char + hostEnd = -1; + for (var i = 0; i < nonHostChars.length; i++) { + var hec = rest.indexOf(nonHostChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + // if we still have not hit it, then the entire thing is a host. + if (hostEnd === -1) + hostEnd = rest.length; + + this.host = rest.slice(0, hostEnd); + rest = rest.slice(hostEnd); + + // pull out port. + this.parseHost(); + + // we've indicated that there is a hostname, + // so even if it's empty, it has to be present. + this.hostname = this.hostname || ''; + + // if hostname begins with [ and ends with ] + // assume that it's an IPv6 address. + var ipv6Hostname = this.hostname[0] === '[' && + this.hostname[this.hostname.length - 1] === ']'; + + // validate a little. + if (!ipv6Hostname) { + var hostparts = this.hostname.split(/\./); + for (var i = 0, l = hostparts.length; i < l; i++) { + var part = hostparts[i]; + if (!part) continue; + if (!part.match(hostnamePartPattern)) { + var newpart = ''; + for (var j = 0, k = part.length; j < k; j++) { + if (part.charCodeAt(j) > 127) { + // we replace non-ASCII char with a temporary placeholder + // we need this to make sure size of hostname is not + // broken by replacing non-ASCII by nothing + newpart += 'x'; + } else { + newpart += part[j]; + } + } + // we test again with ASCII char only + if (!newpart.match(hostnamePartPattern)) { + var validParts = hostparts.slice(0, i); + var notHost = hostparts.slice(i + 1); + var bit = part.match(hostnamePartStart); + if (bit) { + validParts.push(bit[1]); + notHost.unshift(bit[2]); + } + if (notHost.length) { + rest = '/' + notHost.join('.') + rest; + } + this.hostname = validParts.join('.'); + break; + } + } + } + } + + if (this.hostname.length > hostnameMaxLen) { + this.hostname = ''; + } else { + // hostnames are always lower case. + this.hostname = this.hostname.toLowerCase(); + } + + if (!ipv6Hostname) { + // IDNA Support: Returns a punycoded representation of "domain". + // It only converts parts of the domain name that + // have non-ASCII characters, i.e. it doesn't matter if + // you call it with a domain that already is ASCII-only. + this.hostname = punycode.toASCII(this.hostname); + } + + var p = this.port ? ':' + this.port : ''; + var h = this.hostname || ''; + this.host = h + p; + this.href += this.host; + + // strip [ and ] from the hostname + // the host field still retains them, though + if (ipv6Hostname) { + this.hostname = this.hostname.substr(1, this.hostname.length - 2); + if (rest[0] !== '/') { + rest = '/' + rest; + } + } + } + + // now rest is set to the post-host stuff. + // chop off any delim chars. + if (!unsafeProtocol[lowerProto]) { + + // First, make 100% sure that any "autoEscape" chars get + // escaped, even if encodeURIComponent doesn't think they + // need to be. + for (var i = 0, l = autoEscape.length; i < l; i++) { + var ae = autoEscape[i]; + if (rest.indexOf(ae) === -1) + continue; + var esc = encodeURIComponent(ae); + if (esc === ae) { + esc = escape(ae); + } + rest = rest.split(ae).join(esc); + } + } + + + // chop off from the tail first. + var hash = rest.indexOf('#'); + if (hash !== -1) { + // got a fragment string. + this.hash = rest.substr(hash); + rest = rest.slice(0, hash); + } + var qm = rest.indexOf('?'); + if (qm !== -1) { + this.search = rest.substr(qm); + this.query = rest.substr(qm + 1); + if (parseQueryString) { + this.query = querystring.parse(this.query); + } + rest = rest.slice(0, qm); + } else if (parseQueryString) { + // no query string, but parseQueryString still requested + this.search = ''; + this.query = {}; + } + if (rest) this.pathname = rest; + if (slashedProtocol[lowerProto] && + this.hostname && !this.pathname) { + this.pathname = '/'; + } + + //to support http.request + if (this.pathname || this.search) { + var p = this.pathname || ''; + var s = this.search || ''; + this.path = p + s; + } + + // finally, reconstruct the href based on what has been validated. + this.href = this.format(); + return this; +}; + +// format a parsed object into a url string +function urlFormat(obj) { + // ensure it's an object, and not a string url. + // If it's an obj, this is a no-op. + // this way, you can call url_format() on strings + // to clean up potentially wonky urls. + if (util.isString(obj)) obj = urlParse(obj); + if (!(obj instanceof Url)) return Url.prototype.format.call(obj); + return obj.format(); +} + +Url.prototype.format = function() { + var auth = this.auth || ''; + if (auth) { + auth = encodeURIComponent(auth); + auth = auth.replace(/%3A/i, ':'); + auth += '@'; + } + + var protocol = this.protocol || '', + pathname = this.pathname || '', + hash = this.hash || '', + host = false, + query = ''; + + if (this.host) { + host = auth + this.host; + } else if (this.hostname) { + host = auth + (this.hostname.indexOf(':') === -1 ? + this.hostname : + '[' + this.hostname + ']'); + if (this.port) { + host += ':' + this.port; + } + } + + if (this.query && + util.isObject(this.query) && + Object.keys(this.query).length) { + query = querystring.stringify(this.query); + } + + var search = this.search || (query && ('?' + query)) || ''; + + if (protocol && protocol.substr(-1) !== ':') protocol += ':'; + + // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. + // unless they had them to begin with. + if (this.slashes || + (!protocol || slashedProtocol[protocol]) && host !== false) { + host = '//' + (host || ''); + if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; + } else if (!host) { + host = ''; + } + + if (hash && hash.charAt(0) !== '#') hash = '#' + hash; + if (search && search.charAt(0) !== '?') search = '?' + search; + + pathname = pathname.replace(/[?#]/g, function(match) { + return encodeURIComponent(match); + }); + search = search.replace('#', '%23'); + + return protocol + host + pathname + search + hash; +}; + +function urlResolve(source, relative) { + return urlParse(source, false, true).resolve(relative); +} + +Url.prototype.resolve = function(relative) { + return this.resolveObject(urlParse(relative, false, true)).format(); +}; + +function urlResolveObject(source, relative) { + if (!source) return relative; + return urlParse(source, false, true).resolveObject(relative); +} + +Url.prototype.resolveObject = function(relative) { + if (util.isString(relative)) { + var rel = new Url(); + rel.parse(relative, false, true); + relative = rel; + } + + var result = new Url(); + var tkeys = Object.keys(this); + for (var tk = 0; tk < tkeys.length; tk++) { + var tkey = tkeys[tk]; + result[tkey] = this[tkey]; + } + + // hash is always overridden, no matter what. + // even href="" will remove it. + result.hash = relative.hash; + + // if the relative url is empty, then there's nothing left to do here. + if (relative.href === '') { + result.href = result.format(); + return result; + } + + // hrefs like //foo/bar always cut to the protocol. + if (relative.slashes && !relative.protocol) { + // take everything except the protocol from relative + var rkeys = Object.keys(relative); + for (var rk = 0; rk < rkeys.length; rk++) { + var rkey = rkeys[rk]; + if (rkey !== 'protocol') + result[rkey] = relative[rkey]; + } + + //urlParse appends trailing / to urls like http://www.example.com + if (slashedProtocol[result.protocol] && + result.hostname && !result.pathname) { + result.path = result.pathname = '/'; + } + + result.href = result.format(); + return result; + } + + if (relative.protocol && relative.protocol !== result.protocol) { + // if it's a known url protocol, then changing + // the protocol does weird things + // first, if it's not file:, then we MUST have a host, + // and if there was a path + // to begin with, then we MUST have a path. + // if it is file:, then the host is dropped, + // because that's known to be hostless. + // anything else is assumed to be absolute. + if (!slashedProtocol[relative.protocol]) { + var keys = Object.keys(relative); + for (var v = 0; v < keys.length; v++) { + var k = keys[v]; + result[k] = relative[k]; + } + result.href = result.format(); + return result; + } + + result.protocol = relative.protocol; + if (!relative.host && !hostlessProtocol[relative.protocol]) { + var relPath = (relative.pathname || '').split('/'); + while (relPath.length && !(relative.host = relPath.shift())); + if (!relative.host) relative.host = ''; + if (!relative.hostname) relative.hostname = ''; + if (relPath[0] !== '') relPath.unshift(''); + if (relPath.length < 2) relPath.unshift(''); + result.pathname = relPath.join('/'); + } else { + result.pathname = relative.pathname; + } + result.search = relative.search; + result.query = relative.query; + result.host = relative.host || ''; + result.auth = relative.auth; + result.hostname = relative.hostname || relative.host; + result.port = relative.port; + // to support http.request + if (result.pathname || result.search) { + var p = result.pathname || ''; + var s = result.search || ''; + result.path = p + s; + } + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; + } + + var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), + isRelAbs = ( + relative.host || + relative.pathname && relative.pathname.charAt(0) === '/' + ), + mustEndAbs = (isRelAbs || isSourceAbs || + (result.host && relative.pathname)), + removeAllDots = mustEndAbs, + srcPath = result.pathname && result.pathname.split('/') || [], + relPath = relative.pathname && relative.pathname.split('/') || [], + psychotic = result.protocol && !slashedProtocol[result.protocol]; + + // if the url is a non-slashed url, then relative + // links like ../.. should be able + // to crawl up to the hostname, as well. This is strange. + // result.protocol has already been set by now. + // Later on, put the first path part into the host field. + if (psychotic) { + result.hostname = ''; + result.port = null; + if (result.host) { + if (srcPath[0] === '') srcPath[0] = result.host; + else srcPath.unshift(result.host); + } + result.host = ''; + if (relative.protocol) { + relative.hostname = null; + relative.port = null; + if (relative.host) { + if (relPath[0] === '') relPath[0] = relative.host; + else relPath.unshift(relative.host); + } + relative.host = null; + } + mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); + } + + if (isRelAbs) { + // it's absolute. + result.host = (relative.host || relative.host === '') ? + relative.host : result.host; + result.hostname = (relative.hostname || relative.hostname === '') ? + relative.hostname : result.hostname; + result.search = relative.search; + result.query = relative.query; + srcPath = relPath; + // fall through to the dot-handling below. + } else if (relPath.length) { + // it's relative + // throw away the existing file, and take the new path instead. + if (!srcPath) srcPath = []; + srcPath.pop(); + srcPath = srcPath.concat(relPath); + result.search = relative.search; + result.query = relative.query; + } else if (!util.isNullOrUndefined(relative.search)) { + // just pull out the search. + // like href='?foo'. + // Put this after the other two cases because it simplifies the booleans + if (psychotic) { + result.hostname = result.host = srcPath.shift(); + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + result.search = relative.search; + result.query = relative.query; + //to support http.request + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.href = result.format(); + return result; + } + + if (!srcPath.length) { + // no path at all. easy. + // we've already handled the other stuff above. + result.pathname = null; + //to support http.request + if (result.search) { + result.path = '/' + result.search; + } else { + result.path = null; + } + result.href = result.format(); + return result; + } + + // if a url ENDs in . or .., then it must get a trailing slash. + // however, if it ends in anything else non-slashy, + // then it must NOT get a trailing slash. + var last = srcPath.slice(-1)[0]; + var hasTrailingSlash = ( + (result.host || relative.host || srcPath.length > 1) && + (last === '.' || last === '..') || last === ''); + + // strip single dots, resolve double dots to parent dir + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = srcPath.length; i >= 0; i--) { + last = srcPath[i]; + if (last === '.') { + srcPath.splice(i, 1); + } else if (last === '..') { + srcPath.splice(i, 1); + up++; + } else if (up) { + srcPath.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (!mustEndAbs && !removeAllDots) { + for (; up--; up) { + srcPath.unshift('..'); + } + } + + if (mustEndAbs && srcPath[0] !== '' && + (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { + srcPath.unshift(''); + } + + if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { + srcPath.push(''); + } + + var isAbsolute = srcPath[0] === '' || + (srcPath[0] && srcPath[0].charAt(0) === '/'); + + // put the host back + if (psychotic) { + result.hostname = result.host = isAbsolute ? '' : + srcPath.length ? srcPath.shift() : ''; + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + + mustEndAbs = mustEndAbs || (result.host && srcPath.length); + + if (mustEndAbs && !isAbsolute) { + srcPath.unshift(''); + } + + if (!srcPath.length) { + result.pathname = null; + result.path = null; + } else { + result.pathname = srcPath.join('/'); + } + + //to support request.http + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.auth = relative.auth || result.auth; + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; +}; + +Url.prototype.parseHost = function() { + var host = this.host; + var port = portPattern.exec(host); + if (port) { + port = port[0]; + if (port !== ':') { + this.port = port.substr(1); + } + host = host.substr(0, host.length - port.length); + } + if (host) this.hostname = host; +}; + +},{"./util":56,"punycode":38,"querystring":41}],56:[function(require,module,exports){ +'use strict'; + +module.exports = { + isString: function(arg) { + return typeof(arg) === 'string'; + }, + isObject: function(arg) { + return typeof(arg) === 'object' && arg !== null; + }, + isNull: function(arg) { + return arg === null; + }, + isNullOrUndefined: function(arg) { + return arg == null; + } +}; + +},{}],57:[function(require,module,exports){ +(function (global){ + +/** + * Module exports. + */ + +module.exports = deprecate; + +/** + * Mark that a method should not be used. + * Returns a modified function which warns once by default. + * + * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * + * If `localStorage.throwDeprecation = true` is set, then deprecated functions + * will throw an Error when invoked. + * + * If `localStorage.traceDeprecation = true` is set, then deprecated functions + * will invoke `console.trace()` instead of `console.error()`. + * + * @param {Function} fn - the function to deprecate + * @param {String} msg - the string to print to the console when `fn` is invoked + * @returns {Function} a new "deprecated" version of `fn` + * @api public + */ + +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (config('throwDeprecation')) { + throw new Error(msg); + } else if (config('traceDeprecation')) { + console.trace(msg); + } else { + console.warn(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +} + +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ + +function config (name) { + // accessing global.localStorage can trigger a DOMException in sandboxed iframes + try { + if (!global.localStorage) return false; + } catch (_) { + return false; + } + var val = global.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],58:[function(require,module,exports){ +module.exports = extend + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +function extend() { + var target = {} + + for (var i = 0; i < arguments.length; i++) { + var source = arguments[i] + + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + target[key] = source[key] + } + } + } + + return target +} + +},{}]},{},[1])(1) +}); +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.manifold = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o +/// + +var Manifold; +(function (Manifold) { + var Bootstrapper = (function () { + function Bootstrapper(options) { + this._options = options; + this._options.locale = this._options.locale || 'en-GB'; // default locale + } + Bootstrapper.prototype.bootstrap = function () { + var that = this; + return new Promise(function (resolve, reject) { + var msie = that._msieversion(); + // if not a recent version of IE + if (msie > 0 && msie < 11) { + if (msie === 9) { + // CORS not available, use jsonp + var settings = { + url: that._options.iiifResourceUri, + type: 'GET', + dataType: 'jsonp', + jsonp: 'callback', + jsonpCallback: 'manifestCallback' + }; + $.ajax(settings); + window.manifestCallback = function (json) { + that._loaded(that, JSON.stringify(json), resolve, reject); + }; + } + else if (msie === 10) { + $.getJSON(that._options.iiifResourceUri, function (json) { + that._loaded(that, JSON.stringify(json), resolve, reject); + }); + } + } + else { + manifesto.loadManifest(that._options.iiifResourceUri).then(function (json) { + that._loaded(that, json, resolve, reject); + }); + } + }); + }; + Bootstrapper.prototype._loaded = function (bootstrapper, json, resolve, reject) { + var iiifResource = manifesto.create(json, { + locale: bootstrapper._options.locale + }); + // only set the root IIIFResource on the first load + if (!bootstrapper._options.iiifResource) { + bootstrapper._options.iiifResource = iiifResource; + } + if (iiifResource.getIIIFResourceType().toString() === manifesto.IIIFResourceType.collection().toString()) { + // if it's a collection and has child collections, get the collection by index + var collections = iiifResource.getCollections(); + if (collections && collections.length) { + iiifResource.getCollectionByIndex(bootstrapper._options.collectionIndex).then(function (collection) { + if (!collection) { + reject('Collection index not found'); + } + // Special case: we're trying to load the first manifest of the + // collection, but the collection has no manifests but does have + // subcollections. Thus, we should dive in until we find something + // we can display! + if (collection.getTotalManifests() === 0 && bootstrapper._options.manifestIndex === 0 && collection.getTotalCollections() > 0) { + bootstrapper._options.collectionIndex = 0; + bootstrapper._options.iiifResourceUri = collection.id; + bootstrapper.bootstrap(); + } + collection.getManifestByIndex(bootstrapper._options.manifestIndex).then(function (manifest) { + bootstrapper._options.manifest = manifest; + var helper = new Manifold.Helper(bootstrapper._options); + resolve(helper); + }); + }); + } + else { + iiifResource.getManifestByIndex(bootstrapper._options.manifestIndex).then(function (manifest) { + bootstrapper._options.manifest = manifest; + var helper = new Manifold.Helper(bootstrapper._options); + resolve(helper); + }); + } + } + else { + bootstrapper._options.manifest = iiifResource; + var helper = new Manifold.Helper(bootstrapper._options); + resolve(helper); + } + }; + Bootstrapper.prototype._msieversion = function () { + var ua = window.navigator.userAgent; + var msie = ua.indexOf("MSIE "); + if (msie > 0) { + return parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))); + } + else { + return 0; + } + }; + return Bootstrapper; + }()); + Manifold.Bootstrapper = Bootstrapper; +})(Manifold || (Manifold = {})); + +var Manifold; +(function (Manifold) { + var ExternalResource = (function () { + function ExternalResource(resource, dataUriFunc) { + this.isResponseHandled = false; + resource.externalResource = this; + this.dataUri = dataUriFunc(resource); + this._parseAuthServices(resource); + } + ExternalResource.prototype._parseAuthServices = function (resource) { + this.clickThroughService = manifesto.Utils.getService(resource, manifesto.ServiceProfile.clickThrough().toString()); + this.loginService = manifesto.Utils.getService(resource, manifesto.ServiceProfile.login().toString()); + this.restrictedService = manifesto.Utils.getService(resource, manifesto.ServiceProfile.restricted().toString()); + // todo: create this.preferredService? + if (this.clickThroughService) { + this.logoutService = this.clickThroughService.getService(manifesto.ServiceProfile.logout().toString()); + this.tokenService = this.clickThroughService.getService(manifesto.ServiceProfile.token().toString()); + } + else if (this.loginService) { + this.logoutService = this.loginService.getService(manifesto.ServiceProfile.logout().toString()); + this.tokenService = this.loginService.getService(manifesto.ServiceProfile.token().toString()); + } + else if (this.restrictedService) { + this.logoutService = this.restrictedService.getService(manifesto.ServiceProfile.logout().toString()); + this.tokenService = this.restrictedService.getService(manifesto.ServiceProfile.token().toString()); + } + }; + ExternalResource.prototype.isAccessControlled = function () { + if (this.clickThroughService || this.loginService || this.restrictedService) { + return true; + } + return false; + }; + ExternalResource.prototype.hasServiceDescriptor = function () { + return this.dataUri.endsWith('info.json'); + }; + ExternalResource.prototype.getData = function (accessToken) { + var that = this; + that.data = {}; + return new Promise(function (resolve, reject) { + // check if dataUri ends with info.json + // if not issue a HEAD request. + var type = 'GET'; + if (!that.hasServiceDescriptor()) { + // If access control is unnecessary, short circuit the process. + // Note that isAccessControlled check for short-circuiting only + // works in the "binary resource" context, since in that case, + // we know about access control from the manifest. For image + // resources, we need to check info.json for details and can't + // short-circuit like this. + if (!that.isAccessControlled()) { + that.status = HTTPStatusCode.OK; + resolve(that); + return; + } + type = 'HEAD'; + } + $.ajax({ + url: that.dataUri, + type: type, + dataType: 'json', + beforeSend: function (xhr) { + if (accessToken) { + xhr.setRequestHeader("Authorization", "Bearer " + accessToken.accessToken); + } + } + }).done(function (data) { + // if it's a resource without an info.json + // todo: if resource doesn't have a @profile + if (!data) { + that.status = HTTPStatusCode.OK; + resolve(that); + } + else { + var uri = unescape(data['@id']); + that.data = data; + that._parseAuthServices(that.data); + // remove trailing /info.json + if (uri.endsWith('/info.json')) { + uri = uri.substr(0, uri.lastIndexOf('/')); + } + var dataUri = that.dataUri; + if (dataUri.endsWith('/info.json')) { + dataUri = dataUri.substr(0, dataUri.lastIndexOf('/')); + } + // if the request was redirected to a degraded version and there's a login service to get the full quality version + if (uri !== dataUri && that.loginService) { + that.status = HTTPStatusCode.MOVED_TEMPORARILY; + } + else { + that.status = HTTPStatusCode.OK; + } + resolve(that); + } + }).fail(function (error) { + that.status = error.status; + that.error = error; + if (error.responseJSON) { + that._parseAuthServices(error.responseJSON); + } + resolve(that); + }); + }); + }; + return ExternalResource; + }()); + Manifold.ExternalResource = ExternalResource; +})(Manifold || (Manifold = {})); + +var Manifold; +(function (Manifold) { + var Helper = (function () { + function Helper(options) { + this.options = options; + this.iiifResource = this.options.iiifResource; + this.iiifResourceUri = this.options.iiifResourceUri; + this.manifest = this.options.manifest; + this.collectionIndex = this.options.collectionIndex || 0; + this.manifestIndex = this.options.manifestIndex || 0; + this.sequenceIndex = this.options.sequenceIndex || 0; + this.canvasIndex = this.options.canvasIndex || 0; + } + // getters // + Helper.prototype.getAutoCompleteService = function () { + var service = this.getSearchWithinService(); + if (!service) + return null; + return service.getService(manifesto.ServiceProfile.autoComplete()); + }; + Helper.prototype.getAttribution = function () { + return Manifesto.TranslationCollection.getValue(this.manifest.getAttribution()); + }; + Helper.prototype.getCanvases = function () { + return this.getCurrentSequence().getCanvases(); + }; + Helper.prototype.getCanvasById = function (id) { + return this.getCurrentSequence().getCanvasById(id); + }; + Helper.prototype.getCanvasesById = function (ids) { + var canvases = []; + for (var i = 0; i < ids.length; i++) { + var id = ids[i]; + canvases.push(this.getCanvasById(id)); + } + return canvases; + }; + Helper.prototype.getCanvasByIndex = function (index) { + return this.getCurrentSequence().getCanvasByIndex(index); + }; + Helper.prototype.getCanvasIndexById = function (id) { + return this.getCurrentSequence().getCanvasIndexById(id); + }; + Helper.prototype.getCanvasIndexByLabel = function (label) { + var foliated = this.getManifestType().toString() === manifesto.ManifestType.manuscript().toString(); + return this.getCurrentSequence().getCanvasIndexByLabel(label, foliated); + }; + Helper.prototype.getCanvasRange = function (canvas, path) { + var ranges = this.getCanvasRanges(canvas); + if (path) { + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i]; + if (range.path === path) { + return range; + } + } + return null; + } + else { + return ranges[0]; // else return the first range + } + }; + Helper.prototype.getCanvasRanges = function (canvas) { + if (canvas.ranges) { + return canvas.ranges; // cache + } + else { + canvas.ranges = this.manifest.getAllRanges().en().where(function (range) { return (range.getCanvasIds().en().any(function (c) { return c === canvas.id; })); }).toArray(); + } + return canvas.ranges; + }; + Helper.prototype.getCollectionIndex = function (iiifResource) { + // todo: support nested collections. walk up parents adding to array and return csv string. + var index; + if (iiifResource.parentCollection) { + index = iiifResource.parentCollection.index; + } + return index; + }; + Helper.prototype.getCurrentCanvas = function () { + return this.getCurrentSequence().getCanvasByIndex(this.canvasIndex); + }; + Helper.prototype.getCurrentElement = function () { + return this.getCanvasByIndex(this.canvasIndex); + }; + Helper.prototype.getCurrentSequence = function () { + return this.getSequenceByIndex(this.sequenceIndex); + }; + Helper.prototype.getElementType = function (element) { + if (!element) { + element = this.getCurrentCanvas(); + } + return element.getType(); + }; + Helper.prototype.getFirstPageIndex = function () { + return 0; + }; + Helper.prototype.getInfoUri = function (canvas) { + var images = canvas.getImages(); + // if the canvas has images it's IIIF + if (images && images.length) { + var infoUri; + var firstImage = images[0]; + var resource = firstImage.getResource(); + var services = resource.getServices(); + for (var i = 0; i < services.length; i++) { + var service = services[i]; + var id = service.id; + if (!id.endsWith('/')) { + id += '/'; + } + if (manifesto.Utils.isImageProfile(service.getProfile())) { + infoUri = id + 'info.json'; + } + } + return infoUri; + } + else { + // IxIF + var service = canvas.getService(manifesto.ServiceProfile.ixif()); + if (service) { + return service.getInfoUri(); + } + // return the canvas id. + return canvas.id; + } + }; + Helper.prototype.getLabel = function () { + return Manifesto.TranslationCollection.getValue(this.manifest.getLabel()); + }; + Helper.prototype.getLastCanvasLabel = function (alphanumeric) { + return this.getCurrentSequence().getLastCanvasLabel(alphanumeric); + }; + Helper.prototype.getLastPageIndex = function () { + return this.getTotalCanvases() - 1; + }; + Helper.prototype.getLicense = function () { + return this.manifest.getLicense(); + }; + Helper.prototype.getLogo = function () { + return this.manifest.getLogo(); + }; + Helper.prototype.getManifestType = function () { + var manifestType = this.manifest.getManifestType(); + // default to monograph + if (manifestType.toString() === "") { + manifestType = manifesto.ManifestType.monograph(); + } + return manifestType; + }; + Helper.prototype.getMetadata = function (options) { + var metadataGroups = []; + var manifestMetadata = this.manifest.getMetadata(); + var manifestGroup = new Manifold.MetadataGroup(this.manifest); + if (manifestMetadata && manifestMetadata.length) { + manifestGroup.addMetadata(manifestMetadata, true); + } + if (this.manifest.getDescription().length) { + var metadataItem = new Manifesto.MetadataItem(this.options.locale); + metadataItem.label = [new Manifesto.Translation("description", this.options.locale)]; + metadataItem.value = this.manifest.getDescription(); + metadataItem.isRootLevel = true; + manifestGroup.addItem(metadataItem); + } + if (this.manifest.getAttribution().length) { + var metadataItem = new Manifesto.MetadataItem(this.options.locale); + metadataItem.label = [new Manifesto.Translation("attribution", this.options.locale)]; + metadataItem.value = this.manifest.getAttribution(); + metadataItem.isRootLevel = true; + manifestGroup.addItem(metadataItem); + } + if (this.manifest.getLicense()) { + var item = { + label: "license", + value: (options && options.licenseFormatter) ? options.licenseFormatter.format(this.manifest.getLicense()) : this.manifest.getLicense() + }; + var metadataItem = new Manifesto.MetadataItem(this.options.locale); + metadataItem.parse(item); + metadataItem.isRootLevel = true; + manifestGroup.addItem(metadataItem); + } + if (this.manifest.getLogo()) { + var item = { + label: "logo", + value: '' + }; + var metadataItem = new Manifesto.MetadataItem(this.options.locale); + metadataItem.parse(item); + metadataItem.isRootLevel = true; + manifestGroup.addItem(metadataItem); + } + metadataGroups.push(manifestGroup); + if (options) { + return this._parseMetadataOptions(options, metadataGroups); + } + else { + return metadataGroups; + } + }; + Helper.prototype._parseMetadataOptions = function (options, metadataGroups) { + // get sequence metadata + var sequence = this.getCurrentSequence(); + var sequenceMetadata = sequence.getMetadata(); + if (sequenceMetadata && sequenceMetadata.length) { + var sequenceGroup = new Manifold.MetadataGroup(sequence); + sequenceGroup.addMetadata(sequenceMetadata); + metadataGroups.push(sequenceGroup); + } + // get range metadata + if (options.range) { + var rangeGroups = this._getRangeMetadata([], options.range); + rangeGroups = rangeGroups.reverse(); + metadataGroups = metadataGroups.concat(rangeGroups); + } + // get canvas metadata + if (options.canvases && options.canvases.length) { + for (var i = 0; i < options.canvases.length; i++) { + var canvas = options.canvases[i]; + var canvasMetadata = canvas.getMetadata(); + if (canvasMetadata && canvasMetadata.length) { + var canvasGroup = new Manifold.MetadataGroup(canvas); + canvasGroup.addMetadata(canvas.getMetadata()); + metadataGroups.push(canvasGroup); + } + // add image metadata + var images = canvas.getImages(); + for (var j = 0; j < images.length; j++) { + var image = images[j]; + var imageMetadata = image.getMetadata(); + if (imageMetadata && imageMetadata.length) { + var imageGroup = new Manifold.MetadataGroup(image); + imageGroup.addMetadata(imageMetadata); + metadataGroups.push(imageGroup); + } + } + } + } + return metadataGroups; + }; + Helper.prototype._getRangeMetadata = function (metadataGroups, range) { + var rangeMetadata = range.getMetadata(); + if (rangeMetadata && rangeMetadata.length) { + var rangeGroup = new Manifold.MetadataGroup(range); + rangeGroup.addMetadata(rangeMetadata); + metadataGroups.push(rangeGroup); + } + if (range.parentRange) { + return this._getRangeMetadata(metadataGroups, range.parentRange); + } + else { + return metadataGroups; + } + }; + Helper.prototype.getMultiSelectState = function () { + if (!this._multiSelectState) { + this._multiSelectState = new Manifold.MultiSelectState(); + this._multiSelectState.ranges = this.getRanges().clone(); + this._multiSelectState.canvases = this.getCurrentSequence().getCanvases().clone(); + } + return this._multiSelectState; + }; + Helper.prototype.getRanges = function () { + return this.manifest.getAllRanges(); + }; + Helper.prototype.getRangeByPath = function (path) { + return this.manifest.getRangeByPath(path); + }; + Helper.prototype.getRangeCanvases = function (range) { + var ids = range.getCanvasIds(); + return this.getCanvasesById(ids); + }; + Helper.prototype.getRelated = function () { + return this.manifest.getRelated(); + }; + Helper.prototype.getResources = function () { + var element = this.getCurrentElement(); + return element.getResources(); + }; + Helper.prototype.getSearchWithinService = function () { + return this.manifest.getService(manifesto.ServiceProfile.searchWithin()); + }; + Helper.prototype.getSeeAlso = function () { + return this.manifest.getSeeAlso(); + }; + Helper.prototype.getSequenceByIndex = function (index) { + return this.manifest.getSequenceByIndex(index); + }; + Helper.prototype.getShareServiceUrl = function () { + var url; + var shareService = this.manifest.getService(manifesto.ServiceProfile.shareExtensions()); + if (shareService) { + if (shareService.length) { + shareService = shareService[0]; + } + url = shareService.__jsonld.shareUrl; + } + return url; + }; + Helper.prototype.getSortedTreeNodesByDate = function (sortedTree, tree) { + var all = tree.nodes.en().traverseUnique(function (node) { return node.nodes; }) + .where(function (n) { return n.data.type === manifesto.TreeNodeType.collection().toString() || + n.data.type === manifesto.TreeNodeType.manifest().toString(); }).toArray(); + //var collections: ITreeNode[] = tree.nodes.en().traverseUnique(n => n.nodes) + // .where((n) => n.data.type === ITreeNodeType.collection().toString()).toArray(); + var manifests = tree.nodes.en().traverseUnique(function (n) { return n.nodes; }) + .where(function (n) { return n.data.type === manifesto.TreeNodeType.manifest().toString(); }).toArray(); + this.createDecadeNodes(sortedTree, all); + this.sortDecadeNodes(sortedTree); + this.createYearNodes(sortedTree, all); + this.sortYearNodes(sortedTree); + this.createMonthNodes(sortedTree, manifests); + this.sortMonthNodes(sortedTree); + this.createDateNodes(sortedTree, manifests); + this.pruneDecadeNodes(sortedTree); + }; + Helper.prototype.getStartCanvasIndex = function () { + return this.getCurrentSequence().getStartCanvasIndex(); + }; + Helper.prototype.getThumbs = function (width, height) { + return this.getCurrentSequence().getThumbs(width, height); + }; + Helper.prototype.getTopRanges = function () { + return this.manifest.getTopRanges(); + }; + Helper.prototype.getTotalCanvases = function () { + return this.getCurrentSequence().getTotalCanvases(); + }; + Helper.prototype.getTrackingLabel = function () { + return this.manifest.getTrackingLabel(); + }; + Helper.prototype.getTree = function (topRangeIndex, sortType) { + // if it's a collection, use IIIFResource.getDefaultTree() + // otherwise, get the top range by index and use Range.getTree() + if (topRangeIndex === void 0) { topRangeIndex = 0; } + if (sortType === void 0) { sortType = Manifold.TreeSortType.NONE; } + var tree; + if (this.iiifResource.isCollection()) { + tree = this.iiifResource.getDefaultTree(); + } + else { + var topRanges = this.iiifResource.getTopRanges(); + var root = new manifesto.TreeNode(); + root.label = 'root'; + root.data = this.iiifResource; + if (topRanges.length) { + var range = topRanges[topRangeIndex]; + tree = range.getTree(root); + } + else { + return root; + } + } + var sortedTree = new manifesto.TreeNode(); + switch (sortType.toString()) { + case Manifold.TreeSortType.DATE.toString(): + // returns a list of treenodes for each decade. + // expanding a decade generates a list of years + // expanding a year gives a list of months containing issues + // expanding a month gives a list of issues. + if (this.treeHasNavDates(tree)) { + this.getSortedTreeNodesByDate(sortedTree, tree); + break; + } + default: + sortedTree = tree; + } + return sortedTree; + }; + Helper.prototype.treeHasNavDates = function (tree) { + var node = tree.nodes.en().traverseUnique(function (node) { return node.nodes; }).where(function (n) { return !isNaN(n.navDate); }).first(); + return (node) ? true : false; + }; + Helper.prototype.getViewingDirection = function () { + var viewingDirection = this.getCurrentSequence().getViewingDirection(); + if (!viewingDirection.toString()) { + viewingDirection = this.manifest.getViewingDirection(); + } + return viewingDirection; + }; + Helper.prototype.getViewingHint = function () { + var viewingHint = this.getCurrentSequence().getViewingHint(); + if (!viewingHint.toString()) { + viewingHint = this.manifest.getViewingHint(); + } + return viewingHint; + }; + // inquiries // + Helper.prototype.hasParentCollection = function () { + return !!this.manifest.parentCollection; + }; + Helper.prototype.hasRelatedPage = function () { + var related = this.getRelated(); + if (!related) + return false; + if (related.length) { + related = related[0]; + } + return related['format'] === 'text/html'; + }; + Helper.prototype.hasResources = function () { + return this.getResources().length > 0; + }; + Helper.prototype.isBottomToTop = function () { + return this.getViewingDirection().toString() === manifesto.ViewingDirection.bottomToTop().toString(); + }; + Helper.prototype.isCanvasIndexOutOfRange = function (index) { + return this.getCurrentSequence().isCanvasIndexOutOfRange(index); + }; + Helper.prototype.isContinuous = function () { + return this.getViewingHint().toString() === manifesto.ViewingHint.continuous().toString(); + }; + Helper.prototype.isFirstCanvas = function (index) { + if (typeof index !== 'undefined') { + return this.getCurrentSequence().isFirstCanvas(index); + } + return this.getCurrentSequence().isFirstCanvas(this.canvasIndex); + }; + Helper.prototype.isHorizontallyAligned = function () { + return this.isLeftToRight() || this.isRightToLeft(); + }; + Helper.prototype.isLastCanvas = function (index) { + if (typeof index !== 'undefined') { + return this.getCurrentSequence().isLastCanvas(index); + } + return this.getCurrentSequence().isLastCanvas(this.canvasIndex); + }; + Helper.prototype.isLeftToRight = function () { + return this.getViewingDirection().toString() === manifesto.ViewingDirection.leftToRight().toString(); + }; + Helper.prototype.isMultiCanvas = function () { + return this.getCurrentSequence().isMultiCanvas(); + }; + Helper.prototype.isMultiSequence = function () { + return this.manifest.isMultiSequence(); + }; + Helper.prototype.isPaged = function () { + return this.getViewingHint().toString() === manifesto.ViewingHint.paged().toString(); + }; + Helper.prototype.isPagingAvailable = function () { + // paged mode is useless unless you have at least 3 pages... + return this.isPagingEnabled() && this.getTotalCanvases() > 2; + }; + Helper.prototype.isPagingEnabled = function () { + return (this.manifest.isPagingEnabled() || this.getCurrentSequence().isPagingEnabled()); + }; + Helper.prototype.isRightToLeft = function () { + return this.getViewingDirection().toString() === manifesto.ViewingDirection.rightToLeft().toString(); + }; + Helper.prototype.isTopToBottom = function () { + return this.getViewingDirection().toString() === manifesto.ViewingDirection.topToBottom().toString(); + }; + Helper.prototype.isTotalCanvasesEven = function () { + return this.getCurrentSequence().isTotalCanvasesEven(); + }; + Helper.prototype.isUIEnabled = function (name) { + var uiExtensions = this.manifest.getService(manifesto.ServiceProfile.uiExtensions()); + if (uiExtensions) { + var disableUI = uiExtensions.getProperty('disableUI'); + if (disableUI) { + if (disableUI.contains(name) || disableUI.contains(name.toLowerCase())) { + return false; + } + } + } + return true; + }; + Helper.prototype.isVerticallyAligned = function () { + return this.isTopToBottom() || this.isBottomToTop(); + }; + // dates // + Helper.prototype.createDateNodes = function (rootNode, nodes) { + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var year = this.getNodeYear(node); + var month = this.getNodeMonth(node); + var dateNode = new manifesto.TreeNode(); + dateNode.id = node.id; + dateNode.label = this.getNodeDisplayDate(node); + dateNode.data = node.data; + dateNode.data.type = manifesto.TreeNodeType.manifest().toString(); + dateNode.data.year = year; + dateNode.data.month = month; + var decadeNode = this.getDecadeNode(rootNode, year); + if (decadeNode) { + var yearNode = this.getYearNode(decadeNode, year); + if (yearNode) { + var monthNode = this.getMonthNode(yearNode, month); + if (monthNode) { + monthNode.addNode(dateNode); + } + } + } + } + }; + Helper.prototype.createDecadeNodes = function (rootNode, nodes) { + var decadeNode; + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var year = this.getNodeYear(node); + var decade = Number(year.toString().substr(2, 1)); + var endYear = Number(year.toString().substr(0, 3) + "9"); + if (!this.getDecadeNode(rootNode, year)) { + decadeNode = new manifesto.TreeNode(); + decadeNode.label = year + " - " + endYear; + decadeNode.navDate = node.navDate; + decadeNode.data.startYear = year; + decadeNode.data.endYear = endYear; + rootNode.addNode(decadeNode); + } + } + }; + Helper.prototype.createMonthNodes = function (rootNode, nodes) { + var monthNode; + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var year = this.getNodeYear(node); + var month = this.getNodeMonth(node); + var decadeNode = this.getDecadeNode(rootNode, year); + var yearNode = this.getYearNode(decadeNode, year); + if (decadeNode && yearNode && !this.getMonthNode(yearNode, month)) { + monthNode = new manifesto.TreeNode(); + monthNode.label = this.getNodeDisplayMonth(node); + monthNode.navDate = node.navDate; + monthNode.data.year = year; + monthNode.data.month = month; + yearNode.addNode(monthNode); + } + } + }; + Helper.prototype.createYearNodes = function (rootNode, nodes) { + var yearNode; + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var year = this.getNodeYear(node); + var decadeNode = this.getDecadeNode(rootNode, year); + if (decadeNode && !this.getYearNode(decadeNode, year)) { + yearNode = new manifesto.TreeNode(); + yearNode.label = year.toString(); + yearNode.navDate = node.navDate; + yearNode.data.year = year; + decadeNode.addNode(yearNode); + } + } + }; + Helper.prototype.getDecadeNode = function (rootNode, year) { + for (var i = 0; i < rootNode.nodes.length; i++) { + var n = rootNode.nodes[i]; + if (year >= n.data.startYear && year <= n.data.endYear) + return n; + } + return null; + }; + Helper.prototype.getMonthNode = function (yearNode, month) { + for (var i = 0; i < yearNode.nodes.length; i++) { + var n = yearNode.nodes[i]; + if (month === this.getNodeMonth(n)) + return n; + } + return null; + }; + Helper.prototype.getNodeDisplayDate = function (node) { + return node.navDate.toDateString(); + }; + Helper.prototype.getNodeDisplayMonth = function (node) { + var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; + return months[node.navDate.getMonth()]; + }; + Helper.prototype.getNodeMonth = function (node) { + return node.navDate.getMonth(); + }; + Helper.prototype.getNodeYear = function (node) { + return node.navDate.getFullYear(); + }; + Helper.prototype.getYearNode = function (decadeNode, year) { + for (var i = 0; i < decadeNode.nodes.length; i++) { + var n = decadeNode.nodes[i]; + if (year === this.getNodeYear(n)) + return n; + } + return null; + }; + // delete any empty decades + Helper.prototype.pruneDecadeNodes = function (rootNode) { + var pruned = []; + for (var i = 0; i < rootNode.nodes.length; i++) { + var n = rootNode.nodes[i]; + if (!n.nodes.length) { + pruned.push(n); + } + } + for (var j = 0; j < pruned.length; j++) { + var p = pruned[j]; + rootNode.nodes.remove(p); + } + }; + Helper.prototype.sortDecadeNodes = function (rootNode) { + rootNode.nodes = rootNode.nodes.sort(function (a, b) { + return a.data.startYear - b.data.startYear; + }); + }; + Helper.prototype.sortMonthNodes = function (rootNode) { + var _this = this; + for (var i = 0; i < rootNode.nodes.length; i++) { + var decadeNode = rootNode.nodes[i]; + for (var j = 0; j < decadeNode.nodes.length; j++) { + var monthNode = decadeNode.nodes[j]; + monthNode.nodes = monthNode.nodes.sort(function (a, b) { + return _this.getNodeMonth(a) - _this.getNodeMonth(b); + }); + } + } + }; + Helper.prototype.sortYearNodes = function (rootNode) { + var _this = this; + for (var i = 0; i < rootNode.nodes.length; i++) { + var decadeNode = rootNode.nodes[i]; + decadeNode.nodes = decadeNode.nodes.sort(function (a, b) { + return (_this.getNodeYear(a) - _this.getNodeYear(b)); + }); + } + }; + return Helper; + }()); + Manifold.Helper = Helper; +})(Manifold || (Manifold = {})); + + + + + + + + + + + + + + + + + + + +var Manifold; +(function (Manifold) { + function loadManifest(options) { + var bootstrapper = new Manifold.Bootstrapper(options); + return bootstrapper.bootstrap(); + } + Manifold.loadManifest = loadManifest; +})(Manifold || (Manifold = {})); +(function (w) { + if (!w.Manifold) { + w.Manifold = Manifold; + } +})(window); + +var Manifold; +(function (Manifold) { + var MetadataGroup = (function () { + function MetadataGroup(resource, label) { + this.items = []; + this.resource = resource; + this.label = label; + } + MetadataGroup.prototype.addItem = function (item) { + this.items.push(item); + }; + MetadataGroup.prototype.addMetadata = function (metadata, isRootLevel) { + if (isRootLevel === void 0) { isRootLevel = false; } + for (var i = 0; i < metadata.length; i++) { + var item = metadata[i]; + item.isRootLevel = isRootLevel; + this.addItem(item); + } + }; + return MetadataGroup; + }()); + Manifold.MetadataGroup = MetadataGroup; +})(Manifold || (Manifold = {})); + +var Manifold; +(function (Manifold) { + var MetadataOptions = (function () { + function MetadataOptions() { + } + return MetadataOptions; + }()); + Manifold.MetadataOptions = MetadataOptions; +})(Manifold || (Manifold = {})); + +var Manifold; +(function (Manifold) { + var MultiSelectState = (function () { + function MultiSelectState() { + this.isEnabled = false; + this.ranges = []; + this.canvases = []; + } + MultiSelectState.prototype.allCanvasesSelected = function () { + return this.canvases.length > 0 && this.getAllSelectedCanvases().length === this.canvases.length; + }; + MultiSelectState.prototype.allRangesSelected = function () { + return this.ranges.length > 0 && this.getAllSelectedRanges().length === this.ranges.length; + }; + MultiSelectState.prototype.allSelected = function () { + return this.allRangesSelected() && this.allCanvasesSelected(); + }; + MultiSelectState.prototype.getAll = function () { + return this.canvases.concat(this.ranges); + }; + MultiSelectState.prototype.getAllSelectedCanvases = function () { + return this.canvases.en().where(function (c) { return c.multiSelected; }).toArray(); + }; + MultiSelectState.prototype.getAllSelectedRanges = function () { + return this.ranges.en().where(function (r) { return r.multiSelected; }).toArray(); + }; + MultiSelectState.prototype.getCanvasById = function (id) { + return this.canvases.en().where(function (c) { return c.id === id; }).first(); + }; + MultiSelectState.prototype.getCanvasesByIds = function (ids) { + var canvases = []; + for (var i = 0; i < ids.length; i++) { + var id = ids[i]; + canvases.push(this.getCanvasById(id)); + } + return canvases; + }; + MultiSelectState.prototype.getRangeCanvases = function (range) { + var ids = range.getCanvasIds(); + return this.getCanvasesByIds(ids); + }; + MultiSelectState.prototype.selectAll = function (selected) { + this.selectRanges(this.ranges, selected); + this.selectCanvases(this.canvases, selected); + }; + MultiSelectState.prototype.selectCanvas = function (canvas, selected) { + var c = this.canvases.en().where(function (c) { return c.id === canvas.id; }).first(); + c.multiSelected = selected; + }; + MultiSelectState.prototype.selectAllCanvases = function (selected) { + this.selectCanvases(this.canvases, selected); + }; + MultiSelectState.prototype.selectCanvases = function (canvases, selected) { + for (var j = 0; j < canvases.length; j++) { + var canvas = canvases[j]; + canvas.multiSelected = selected; + } + }; + MultiSelectState.prototype.selectRange = function (range, selected) { + var r = this.ranges.en().where(function (r) { return r.id === range.id; }).first(); + r.multiSelected = selected; + var canvases = this.getRangeCanvases(r); + this.selectCanvases(canvases, selected); + }; + MultiSelectState.prototype.selectAllRanges = function (selected) { + this.selectRanges(this.ranges, selected); + }; + MultiSelectState.prototype.selectRanges = function (ranges, selected) { + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i]; + range.multiSelected = selected; + var canvases = this.getCanvasesByIds(range.getCanvasIds()); + this.selectCanvases(canvases, selected); + } + }; + MultiSelectState.prototype.setEnabled = function (enabled) { + this.isEnabled = enabled; + var items = this.getAll(); + for (var i = 0; i < items.length; i++) { + var item = items[i]; + item.multiSelectEnabled = this.isEnabled; + if (!enabled) { + item.multiSelected = false; + } + } + }; + return MultiSelectState; + }()); + Manifold.MultiSelectState = MultiSelectState; +})(Manifold || (Manifold = {})); + +var Manifold; +(function (Manifold) { + var SearchResult = (function () { + function SearchResult(resource, canvasIndex) { + this.rects = []; + this.canvasIndex = canvasIndex; + this.addRect(resource); + } + SearchResult.prototype.addRect = function (resource) { + var rect = new Manifold.SearchResultRect(resource); + rect.canvasIndex = this.canvasIndex; + rect.index = this.rects.length; + this.rects.push(rect); + // sort ascending + this.rects.sort(function (a, b) { + return a.index - b.index; + }); + }; + return SearchResult; + }()); + Manifold.SearchResult = SearchResult; +})(Manifold || (Manifold = {})); + +var Manifold; +(function (Manifold) { + var SearchResultRect = (function () { + function SearchResultRect(result) { + this.isVisible = true; + var xywh = result.on.match(/.*xywh=(\d*),(\d*),(\d*),(\d*)/); + this.x = Number(xywh[1]); + this.y = Number(xywh[2]); + this.width = Number(xywh[3]); + this.height = Number(xywh[4]); + this.chars = result.resource.chars; + } + return SearchResultRect; + }()); + Manifold.SearchResultRect = SearchResultRect; +})(Manifold || (Manifold = {})); + +var Manifold; +(function (Manifold) { + var Translation = (function () { + function Translation(value, locale) { + this.value = value; + this.locale = locale; + } + return Translation; + }()); + Manifold.Translation = Translation; +})(Manifold || (Manifold = {})); + +var Manifold; +(function (Manifold) { + // This class formats URIs into HTML links, applying labels when available + var UriLabeller = (function () { + function UriLabeller(labels) { + this.labels = labels; + } + UriLabeller.prototype.format = function (url) { + // if already a link, do nothing. + if (url.indexOf('' + label + ''; + }; + return UriLabeller; + }()); + Manifold.UriLabeller = UriLabeller; +})(Manifold || (Manifold = {})); + +},{}]},{},[1])(1) }); -(function(t,e,o){"use strict";function r(t,e,r,p){r=r||"width";var n,l,m,c=(e.match(s)||[])[2],f="px"===c?1:d[c+"toPx"],u=/r?em/i;if(f||u.test(c)&&!p)t=f?t:"rem"===c?i:"fontSize"===r?t.parentNode||t:t,f=f||parseFloat(a(t,"fontSize")),m=parseFloat(e)*f;else{n=t.style,l=n[r];try{n[r]=e}catch(x){return 0}m=n[r]?parseFloat(a(t,r)):0,n[r]=l!==o?l:null}return m}function a(t,e){var o,n,i,l,d,c=/^top|bottom/,f=["paddingTop","paddingBottom","borderTop","borderBottom"],u=4;if(o=m?m(t)[e]:(n=t.style["pixel"+e.charAt(0).toUpperCase()+e.slice(1)])?n+"px":"fontSize"===e?r(t,"1em","left",1)+"px":t.currentStyle[e],i=(o.match(s)||[])[2],"%"===i&&p)if(c.test(e)){for(l=(d=t.parentNode||t).offsetHeight;u--;)l-=parseFloat(a(d,f[u]));o=parseFloat(o)/100*l+"px"}else o=r(t,o);else("auto"===o||i&&"px"!==i)&&m?o=0:i&&"px"!==i&&!m&&(o=r(t,o)+"px");return o}var p,n=e.createElement("test"),i=e.documentElement,l=e.defaultView,m=l&&l.getComputedStyle,s=/^(-?[\d+\.\-]+)([a-z]+|%)$/i,d={},c=[1/25.4,1/2.54,1/72,1/6],f=["mm","cm","pt","pc","in","mozmm"],u=6;for(i.appendChild(n),m&&(n.style.marginTop="1%",p="1%"===m(n).marginTop);u--;)d[f[u]+"toPx"]=c[u]?c[u]*d.inToPx:r(n,"1"+f[u]);i.removeChild(n),n=o,t.Length={toPx:r}})(this,this.document); -/* -//@ sourceMappingURL=Length.min.js.map +(function(t,e,o){"use strict";function r(t,e,r,p){r=r||"width";var n,l,m,c=(e.match(s)||[])[2],f="px"===c?1:d[c+"toPx"],u=/r?em/i;if(f||u.test(c)&&!p)t=f?t:"rem"===c?i:"fontSize"===r?t.parentNode||t:t,f=f||parseFloat(a(t,"fontSize")),m=parseFloat(e)*f;else{n=t.style,l=n[r];try{n[r]=e}catch(x){return 0}m=n[r]?parseFloat(a(t,r)):0,n[r]=l!==o?l:null}return m}function a(t,e){var o,n,i,l,d,c=/^top|bottom/,f=["paddingTop","paddingBottom","borderTop","borderBottom"],u=4;if(o=m?m(t)[e]:(n=t.style["pixel"+e.charAt(0).toUpperCase()+e.slice(1)])?n+"px":"fontSize"===e?r(t,"1em","left",1)+"px":t.currentStyle[e],i=(o.match(s)||[])[2],"%"===i&&p)if(c.test(e)){for(l=(d=t.parentNode||t).offsetHeight;u--;)l-=parseFloat(a(d,f[u]));o=parseFloat(o)/100*l+"px"}else o=r(t,o);else("auto"===o||i&&"px"!==i)&&m?o=0:i&&"px"!==i&&!m&&(o=r(t,o)+"px");return o}var p,n=e.createElement("test"),i=e.documentElement,l=e.defaultView,m=l&&l.getComputedStyle,s=/^(-?[\d+\.\-]+)([a-z]+|%)$/i,d={},c=[1/25.4,1/2.54,1/72,1/6],f=["mm","cm","pt","pc","in","mozmm"],u=6;for(i.appendChild(n),m&&(n.style.marginTop="1%",p="1%"===m(n).marginTop);u--;)d[f[u]+"toPx"]=c[u]?c[u]*d.inToPx:r(n,"1"+f[u]);i.removeChild(n),n=o,t.Length={toPx:r}})(this,this.document); +/* +//@ sourceMappingURL=Length.min.js.map */ -var Utils; -(function (Utils) { - var Async = (function () { - function Async() { - } - Async.waitFor = function (test, successCallback, failureCallback, interval, maxTries, numTries) { - if (!interval) - interval = 200; - if (!maxTries) - maxTries = 100; // try 100 times over 20 seconds - if (!numTries) - numTries = 0; - numTries += 1; - if (numTries > maxTries) { - if (failureCallback) - failureCallback(); - } - else if (test()) { - successCallback(); - } - else { - setTimeout(function () { - Async.waitFor(test, successCallback, failureCallback, interval, maxTries, numTries); - }, interval); - } - }; - return Async; - })(); - Utils.Async = Async; -})(Utils || (Utils = {})); -var Utils; -(function (Utils) { - var Bools = (function () { - function Bools() { - } - Bools.getBool = function (val, defaultVal) { - if (val === null || typeof (val) === 'undefined') { - return defaultVal; - } - return val; - }; - return Bools; - })(); - Utils.Bools = Bools; -})(Utils || (Utils = {})); -var Utils; -(function (Utils) { - var Clipboard = (function () { - function Clipboard() { - } - Clipboard.copy = function (text) { - var $tempDiv = $("
                          "); - var brRegex = //gi; - text = text.replace(brRegex, "\n"); - $("body").append($tempDiv); - $tempDiv.append(text); - var $tempInput = $("