tify
Version:
A slim and mobile-friendly IIIF document viewer
109 lines • 481 kB
JavaScript
/*!
TIFY v0.36.2
(c) 2017-2026 Göttingen State and University Library (https://www.sub.uni-goettingen.de/)
AGPL-3.0
https://tify.rocks/
*/
/**
* @vue/shared v3.5.41
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function Kn(t){const i=Object.create(null);for(const e of t.split(","))i[e]=1;return e=>e in i}const xe={},Yt=[],ft=()=>{},gr=()=>!1,$i=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),en=t=>t.startsWith("onUpdate:"),Ue=Object.assign,Xn=(t,i)=>{const e=t.indexOf(i);e>-1&&t.splice(e,1)},$o=Object.prototype.hasOwnProperty,_e=(t,i)=>$o.call(t,i),ue=Array.isArray,Jt=t=>Ei(t)==="[object Map]",mr=t=>Ei(t)==="[object Set]",bs=t=>Ei(t)==="[object Date]",he=t=>typeof t=="function",Re=t=>typeof t=="string",Je=t=>typeof t=="symbol",Te=t=>t!==null&&typeof t=="object",vr=t=>(Te(t)||he(t))&&he(t.then)&&he(t.catch),yr=Object.prototype.toString,Ei=t=>yr.call(t),ea=t=>Ei(t).slice(8,-1),wr=t=>Ei(t)==="[object Object]",tn=t=>Re(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,ci=Kn(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),nn=t=>{const i=Object.create(null);return e=>i[e]||(i[e]=t(e))},ta=/-\w/g,Ge=nn(t=>t.replace(ta,i=>i.slice(1).toUpperCase())),ia=/\B([A-Z])/g,At=nn(t=>t.replace(ia,"-$1").toLowerCase()),sn=nn(t=>t.charAt(0).toUpperCase()+t.slice(1)),wn=nn(t=>t?`on${sn(t)}`:""),dt=(t,i)=>!Object.is(t,i),Mi=(t,...i)=>{for(let e=0;e<t.length;e++)t[e](...i)},_r=(t,i,e,n=!1)=>{Object.defineProperty(t,i,{configurable:!0,enumerable:!1,writable:n,value:e})},Yn=t=>{const i=parseFloat(t);return isNaN(i)?t:i};let Es;const rn=()=>Es||(Es=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function It(t){if(ue(t)){const i={};for(let e=0;e<t.length;e++){const n=t[e],r=Re(n)?oa(n):It(n);if(r)for(const s in r)i[s]=r[s]}return i}else if(Re(t)||Te(t))return t}const na=/;(?![^(]*\))/g,sa=/:([^]+)/,ra=/\/\*[^]*?\*\//g;function oa(t){const i={};return t.replace(ra,"").split(na).forEach(e=>{if(e){const n=e.split(sa);n.length>1&&(i[n[0].trim()]=n[1].trim())}}),i}function Pe(t){let i="";if(Re(t))i=t;else if(ue(t))for(let e=0;e<t.length;e++){const n=Pe(t[e]);n&&(i+=n+" ")}else if(Te(t))for(const e in t)t[e]&&(i+=e+" ");return i.trim()}const aa="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",la=Kn(aa);function Tr(t){return!!t||t===""}function ua(t,i){if(t.length!==i.length)return!1;let e=!0;for(let n=0;e&&n<t.length;n++)e=Jn(t[n],i[n]);return e}function Jn(t,i){if(t===i)return!0;let e=bs(t),n=bs(i);if(e||n)return e&&n?t.getTime()===i.getTime():!1;if(e=Je(t),n=Je(i),e||n)return t===i;if(e=ue(t),n=ue(i),e||n)return e&&n?ua(t,i):!1;if(e=Te(t),n=Te(i),e||n){if(!e||!n)return!1;const r=Object.keys(t).length,s=Object.keys(i).length;if(r!==s)return!1;for(const o in t){const l=t.hasOwnProperty(o),a=i.hasOwnProperty(o);if(l&&!a||!l&&a||!Jn(t[o],i[o]))return!1}}return String(t)===String(i)}const xr=t=>!!(t&&t.__v_isRef===!0),z=t=>Re(t)?t:t==null?"":ue(t)||Te(t)&&(t.toString===yr||!he(t.toString))?xr(t)?z(t.value):JSON.stringify(t,br,2):String(t),br=(t,i)=>xr(i)?br(t,i.value):Jt(i)?{[`Map(${i.size})`]:[...i.entries()].reduce((e,[n,r],s)=>(e[_n(n,s)+" =>"]=r,e),{})}:mr(i)?{[`Set(${i.size})`]:[...i.values()].map(e=>_n(e))}:Je(i)?_n(i):Te(i)&&!ue(i)&&!wr(i)?String(i):i,_n=(t,i="")=>{var e;return Je(t)?`Symbol(${(e=t.description)!=null?e:i})`:t};/**
* @vue/reactivity v3.5.41
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/let Oe;class ca{constructor(i=!1){this.detached=i,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!i&&Oe&&(Oe.active?(this.parent=Oe,this.index=(Oe.scopes||(Oe.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let i,e;if(this.scopes){const n=this.scopes.slice();for(i=0,e=n.length;i<e;i++)n[i].pause()}for(i=0,e=this.effects.length;i<e;i++)this.effects[i].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let i,e;if(this.scopes){const r=this.scopes.slice();for(i=0,e=r.length;i<e;i++)r[i].resume()}const n=this.effects.slice();for(i=0,e=n.length;i<e;i++)n[i].resume()}}run(i){if(this._active){const e=Oe;try{return Oe=this,i()}finally{Oe=e}}}on(){++this._on===1&&(this.prevScope=Oe,Oe=this)}off(){if(this._on>0&&--this._on===0){if(Oe===this)Oe=this.prevScope;else{let i=Oe;for(;i;){if(i.prevScope===this){i.prevScope=this.prevScope;break}i=i.prevScope}}this.prevScope=void 0}}stop(i){if(this._active){this._active=!1;let e,n;for(e=0,n=this.effects.length;e<n;e++)this.effects[e].stop();for(this.effects.length=0,e=0,n=this.cleanups.length;e<n;e++)this.cleanups[e]();if(this.cleanups.length=0,this.scopes){const r=this.scopes.slice();for(e=0,n=r.length;e<n;e++)r[e].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!i){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}}function Er(){return Oe}function ha(t,i=!1){Oe&&Oe.cleanups.push(t)}let be;const Tn=new WeakSet;class Sr{constructor(i){this.fn=i,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Oe&&(Oe.active?Oe.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Tn.has(this)&&(Tn.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Pr(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Ss(this),Rr(this);const i=be,e=nt;be=this,nt=!0;try{return this.fn()}finally{Dr(this),be=i,nt=e,this.flags&=-3}}stop(){if(this.flags&1){for(let i=this.deps;i;i=i.nextDep)es(i);this.deps=this.depsTail=void 0,Ss(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Tn.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){kn(this)&&this.run()}get dirty(){return kn(this)}}let Cr=0,hi,di;function Pr(t,i=!1){if(t.flags|=8,i){t.next=di,di=t;return}t.next=hi,hi=t}function Qn(){Cr++}function $n(){if(--Cr>0)return;if(di){let i=di;for(di=void 0;i;){const e=i.next;i.next=void 0,i.flags&=-9,i=e}}let t;for(;hi;){let i=hi;for(hi=void 0;i;){const e=i.next;if(i.next=void 0,i.flags&=-9,i.flags&1)try{i.trigger()}catch(n){t||(t=n)}i=e}}if(t)throw t}function Rr(t){for(let i=t.deps;i;i=i.nextDep)i.version=-1,i.prevActiveLink=i.dep.activeLink,i.dep.activeLink=i}function Dr(t){let i,e=t.depsTail,n=e;for(;n;){const r=n.prevDep;n.version===-1?(n===e&&(e=r),es(n),da(n)):i=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=r}t.deps=i,t.depsTail=e}function kn(t){for(let i=t.deps;i;i=i.nextDep)if(i.dep.version!==i.version||i.dep.computed&&(Ir(i.dep.computed)||i.dep.version!==i.version))return!0;return!!t._dirty}function Ir(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===gi)||(t.globalVersion=gi,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!kn(t))))return;t.flags|=2;const i=t.dep,e=be,n=nt;be=t,nt=!0;try{Rr(t);const r=t.fn(t._value);(i.version===0||dt(r,t._value))&&(t.flags|=128,t._value=r,i.version++)}catch(r){throw i.version++,r}finally{be=e,nt=n,Dr(t),t.flags&=-3}}function es(t,i=!1){const{dep:e,prevSub:n,nextSub:r}=t;if(n&&(n.nextSub=r,t.prevSub=void 0),r&&(r.prevSub=n,t.nextSub=void 0),e.subs===t&&(e.subs=n,!n&&e.computed)){e.computed.flags&=-5;for(let s=e.computed.deps;s;s=s.nextDep)es(s,!0)}!i&&!--e.sc&&e.map&&e.map.delete(e.key)}function da(t){const{prevDep:i,nextDep:e}=t;i&&(i.nextDep=e,t.prevDep=void 0),e&&(e.prevDep=i,t.nextDep=void 0)}let nt=!0;const Ar=[];function xt(){Ar.push(nt),nt=!1}function bt(){const t=Ar.pop();nt=t===void 0?!0:t}function Ss(t){const{cleanup:i}=t;if(t.cleanup=void 0,i){const e=be;be=void 0;try{i()}finally{be=e}}}let gi=0;class fa{constructor(i,e){this.sub=i,this.dep=e,this.version=e.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class on{constructor(i){this.computed=i,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(i){if(!be||!nt||be===this.computed)return;let e=this.activeLink;if(e===void 0||e.sub!==be)e=this.activeLink=new fa(be,this),be.deps?(e.prevDep=be.depsTail,be.depsTail.nextDep=e,be.depsTail=e):be.deps=be.depsTail=e,Or(e);else if(e.version===-1&&(e.version=this.version,e.nextDep)){const n=e.nextDep;n.prevDep=e.prevDep,e.prevDep&&(e.prevDep.nextDep=n),e.prevDep=be.depsTail,e.nextDep=void 0,be.depsTail.nextDep=e,be.depsTail=e,be.deps===e&&(be.deps=n)}return e}trigger(i){this.version++,gi++,this.notify(i)}notify(i){Qn();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{$n()}}}function Or(t){if(t.dep.sc++,t.sub.flags&4){const i=t.dep.computed;if(i&&!t.dep.subs){i.flags|=20;for(let n=i.deps;n;n=n.nextDep)Or(n)}const e=t.dep.subs;e!==t&&(t.prevSub=e,e&&(e.nextSub=t)),t.dep.subs=t}}const zi=new WeakMap,Nt=Symbol(""),Hn=Symbol(""),mi=Symbol("");function ze(t,i,e){if(nt&&be){let n=zi.get(t);n||zi.set(t,n=new Map);let r=n.get(e);r||(n.set(e,r=new on),r.map=n,r.key=e),r.track()}}function wt(t,i,e,n,r,s){const o=zi.get(t);if(!o){gi++;return}const l=a=>{a&&a.trigger()};if(Qn(),i==="clear")o.forEach(l);else{const a=ue(t),u=a&&tn(e);if(a&&e==="length"){const c=Number(n);o.forEach((h,f)=>{(f==="length"||f===mi||!Je(f)&&f>=c)&&l(h)})}else switch((e!==void 0||o.has(void 0))&&l(o.get(e)),u&&l(o.get(mi)),i){case"add":a?u&&l(o.get("length")):(l(o.get(Nt)),Jt(t)&&l(o.get(Hn)));break;case"delete":a||(l(o.get(Nt)),Jt(t)&&l(o.get(Hn)));break;case"set":Jt(t)&&l(o.get(Nt));break}}$n()}function pa(t,i){const e=zi.get(t);return e&&e.get(i)}function Zt(t){const i=we(t);return i===t?i:(ze(i,"iterate",mi),Ye(t)?i:i.map(st))}function an(t){return ze(t=we(t),"iterate",mi),t}function ct(t,i){return Et(t)?ti(Ut(t)?st(i):i):st(i)}const ga={__proto__:null,[Symbol.iterator](){return xn(this,Symbol.iterator,t=>ct(this,t))},concat(...t){return Zt(this).concat(...t.map(i=>ue(i)?Zt(i):i))},entries(){return xn(this,"entries",t=>(t[1]=ct(this,t[1]),t))},every(t,i){return mt(this,"every",t,i,void 0,arguments)},filter(t,i){return mt(this,"filter",t,i,e=>e.map(n=>ct(this,n)),arguments)},find(t,i){return mt(this,"find",t,i,e=>ct(this,e),arguments)},findIndex(t,i){return mt(this,"findIndex",t,i,void 0,arguments)},findLast(t,i){return mt(this,"findLast",t,i,e=>ct(this,e),arguments)},findLastIndex(t,i){return mt(this,"findLastIndex",t,i,void 0,arguments)},forEach(t,i){return mt(this,"forEach",t,i,void 0,arguments)},includes(...t){return bn(this,"includes",t)},indexOf(...t){return bn(this,"indexOf",t)},join(t){return Zt(this).join(t)},lastIndexOf(...t){return bn(this,"lastIndexOf",t)},map(t,i){return mt(this,"map",t,i,void 0,arguments)},pop(){return ri(this,"pop")},push(...t){return ri(this,"push",t)},reduce(t,...i){return Cs(this,"reduce",t,i)},reduceRight(t,...i){return Cs(this,"reduceRight",t,i)},shift(){return ri(this,"shift")},some(t,i){return mt(this,"some",t,i,void 0,arguments)},splice(...t){return ri(this,"splice",t)},toReversed(){return Zt(this).toReversed()},toSorted(t){return Zt(this).toSorted(t)},toSpliced(...t){return Zt(this).toSpliced(...t)},unshift(...t){return ri(this,"unshift",t)},values(){return xn(this,"values",t=>ct(this,t))}};function xn(t,i,e){const n=an(t),r=n[i]();return n!==t&&!Ye(t)&&(r._next=r.next,r.next=()=>{const s=r._next();return s.done||(s.value=e(s.value)),s}),r}const ma=Array.prototype;function mt(t,i,e,n,r,s){const o=an(t),l=o!==t&&!Ye(t),a=o[i];if(a!==ma[i]){const h=a.apply(t,s);return l?st(h):h}let u=e;o!==t&&(l?u=function(h,f){return e.call(this,ct(t,h),f,t)}:e.length>2&&(u=function(h,f){return e.call(this,h,f,t)}));const c=a.call(o,u,n);return l&&r?r(c):c}function Cs(t,i,e,n){const r=an(t),s=r!==t&&!Ye(t);let o=e,l=!1;r!==t&&(s?(l=n.length===0,o=function(u,c,h){return l&&(l=!1,u=ct(t,u)),e.call(this,u,ct(t,c),h,t)}):e.length>3&&(o=function(u,c,h){return e.call(this,u,c,h,t)}));const a=r[i](o,...n);return l?ct(t,a):a}function bn(t,i,e){const n=we(t);ze(n,"iterate",mi);const r=n[i](...e);return(r===-1||r===!1)&&un(e[0])?(e[0]=we(e[0]),n[i](...e)):r}function ri(t,i,e=[]){xt(),Qn();const n=we(t)[i].apply(t,e);return $n(),bt(),n}const va=Kn("__proto__,__v_isRef,__isVue"),Mr=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Je));function ya(t){Je(t)||(t=String(t));const i=we(this);return ze(i,"has",t),i.hasOwnProperty(t)}class Fr{constructor(i=!1,e=!1){this._isReadonly=i,this._isShallow=e}get(i,e,n){if(e==="__v_skip")return i.__v_skip;const r=this._isReadonly,s=this._isShallow;if(e==="__v_isReactive")return!r;if(e==="__v_isReadonly")return r;if(e==="__v_isShallow")return s;if(e==="__v_raw")return n===(r?s?Ra:Br:s?Hr:kr).get(i)||Object.getPrototypeOf(i)===Object.getPrototypeOf(n)?i:void 0;const o=ue(i);if(!r){let a;if(o&&(a=ga[e]))return a;if(e==="hasOwnProperty")return ya}const l=Reflect.get(i,e,Me(i)?i:n);if((Je(e)?Mr.has(e):va(e))||(r||ze(i,"get",e),s))return l;if(Me(l)){const a=o&&tn(e)?l:l.value;return r&&Te(a)?Ni(a):a}return Te(l)?r?Ni(l):ln(l):l}}class Lr extends Fr{constructor(i=!1){super(!1,i)}set(i,e,n,r){let s=i[e];const o=ue(i)&&tn(e);if(!this._isShallow){const u=Et(s);if(!Ye(n)&&!Et(n)&&(s=we(s),n=we(n)),!o&&Me(s)&&!Me(n))return u||(s.value=n),!0}const l=o?Number(e)<i.length:_e(i,e),a=Reflect.set(i,e,n,Me(i)?i:r);return i===we(r)&&a&&(l?dt(n,s)&&wt(i,"set",e,n):wt(i,"add",e,n)),a}deleteProperty(i,e){const n=_e(i,e);i[e];const r=Reflect.deleteProperty(i,e);return r&&n&&wt(i,"delete",e,void 0),r}has(i,e){const n=Reflect.has(i,e);return(!Je(e)||!Mr.has(e))&&ze(i,"has",e),n}ownKeys(i){return ze(i,"iterate",ue(i)?"length":Nt),Reflect.ownKeys(i)}}class wa extends Fr{constructor(i=!1){super(!0,i)}set(i,e){return!0}deleteProperty(i,e){return!0}}const _a=new Lr,Ta=new wa,xa=new Lr(!0);const Bn=t=>t,Ri=t=>Reflect.getPrototypeOf(t);function ba(t,i,e){return function(...n){const r=this.__v_raw,s=we(r),o=Jt(s),l=t==="entries"||t===Symbol.iterator&&o,a=t==="keys"&&o,u=r[t](...n),c=e?Bn:i?ti:st;return!i&&ze(s,"iterate",a?Hn:Nt),Ue(Object.create(u),{next(){const{value:h,done:f}=u.next();return f?{value:h,done:f}:{value:l?[c(h[0]),c(h[1])]:c(h),done:f}}})}}function Di(t){return function(...i){return t==="delete"?!1:t==="clear"?void 0:this}}function Ea(t,i){const e={get(r){const s=this.__v_raw,o=we(s),l=we(r);t||(dt(r,l)&&ze(o,"get",r),ze(o,"get",l));const{has:a}=Ri(o),u=i?Bn:t?ti:st;if(a.call(o,r))return u(s.get(r));if(a.call(o,l))return u(s.get(l));s!==o&&s.get(r)},get size(){const r=this.__v_raw;return!t&&ze(we(r),"iterate",Nt),r.size},has(r){const s=this.__v_raw,o=we(s),l=we(r);return t||(dt(r,l)&&ze(o,"has",r),ze(o,"has",l)),r===l?s.has(r):s.has(r)||s.has(l)},forEach(r,s){const o=this,l=o.__v_raw,a=we(l),u=i?Bn:t?ti:st;return!t&&ze(a,"iterate",Nt),l.forEach((c,h)=>r.call(s,u(c),u(h),o))}};return Ue(e,t?{add:Di("add"),set:Di("set"),delete:Di("delete"),clear:Di("clear")}:{add(r){const s=we(this),o=Ri(s),l=we(r),a=!i&&!Ye(r)&&!Et(r)?l:r;return o.has.call(s,a)||dt(r,a)&&o.has.call(s,r)||dt(l,a)&&o.has.call(s,l)||(s.add(a),wt(s,"add",a,a)),this},set(r,s){!i&&!Ye(s)&&!Et(s)&&(s=we(s));const o=we(this),{has:l,get:a}=Ri(o);let u=l.call(o,r);u||(r=we(r),u=l.call(o,r));const c=a.call(o,r);return o.set(r,s),u?dt(s,c)&&wt(o,"set",r,s):wt(o,"add",r,s),this},delete(r){const s=we(this),{has:o,get:l}=Ri(s);let a=o.call(s,r);a||(r=we(r),a=o.call(s,r)),l&&l.call(s,r);const u=s.delete(r);return a&&wt(s,"delete",r,void 0),u},clear(){const r=we(this),s=r.size!==0,o=r.clear();return s&&wt(r,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(r=>{e[r]=ba(r,t,i)}),e}function ts(t,i){const e=Ea(t,i);return(n,r,s)=>r==="__v_isReactive"?!t:r==="__v_isReadonly"?t:r==="__v_raw"?n:Reflect.get(_e(e,r)&&r in n?e:n,r,s)}const Sa={get:ts(!1,!1)},Ca={get:ts(!1,!0)},Pa={get:ts(!0,!1)};const kr=new WeakMap,Hr=new WeakMap,Br=new WeakMap,Ra=new WeakMap;function Da(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function ln(t){return Et(t)?t:is(t,!1,_a,Sa,kr)}function Ia(t){return is(t,!1,xa,Ca,Hr)}function Ni(t){return is(t,!0,Ta,Pa,Br)}function is(t,i,e,n,r){if(!Te(t)||t.__v_raw&&!(i&&t.__v_isReactive)||t.__v_skip||!Object.isExtensible(t))return t;const s=r.get(t);if(s)return s;const o=Da(ea(t));if(o===0)return t;const l=new Proxy(t,o===2?n:e);return r.set(t,l),l}function Ut(t){return Et(t)?Ut(t.__v_raw):!!(t&&t.__v_isReactive)}function Et(t){return!!(t&&t.__v_isReadonly)}function Ye(t){return!!(t&&t.__v_isShallow)}function un(t){return t?!!t.__v_raw:!1}function we(t){const i=t&&t.__v_raw;return i?we(i):t}function de(t){return!_e(t,"__v_skip")&&Object.isExtensible(t)&&_r(t,"__v_skip",!0),t}const st=t=>Te(t)?ln(t):t,ti=t=>Te(t)?Ni(t):t;function Me(t){return t?t.__v_isRef===!0:!1}function vi(t){return zr(t,!1)}function We(t){return zr(t,!0)}function zr(t,i){return Me(t)?t:new Aa(t,i)}class Aa{constructor(i,e){this.dep=new on,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=e?i:we(i),this._value=e?i:st(i),this.__v_isShallow=e}get value(){return this.dep.track(),this._value}set value(i){const e=this._rawValue,n=this.__v_isShallow||Ye(i)||Et(i);i=n?i:we(i),dt(i,e)&&(this._rawValue=i,this._value=n?i:st(i),this.dep.trigger())}}function cn(t){return Me(t)?t.value:t}function Ce(t){return he(t)?t():cn(t)}const Oa={get:(t,i,e)=>i==="__v_raw"?t:cn(Reflect.get(t,i,e)),set:(t,i,e,n)=>{const r=t[i];return Me(r)&&!Me(e)?(r.value=e,!0):Reflect.set(t,i,e,n)}};function Nr(t){return Ut(t)?t:new Proxy(t,Oa)}class Ma{constructor(i){this.__v_isRef=!0,this._value=void 0;const e=this.dep=new on,{get:n,set:r}=i(e.track.bind(e),e.trigger.bind(e));this._get=n,this._set=r}get value(){return this._value=this._get()}set value(i){this._set(i)}}function Fa(t){return new Ma(t)}class La{constructor(i,e,n){this._object=i,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=Je(e)?e:String(e),this._raw=we(i);let r=!0,s=i;if(!ue(i)||Je(this._key)||!tn(this._key))do r=!un(s)||Ye(s);while(r&&(s=s.__v_raw));this._shallow=r}get value(){let i=this._object[this._key];return this._shallow&&(i=cn(i)),this._value=i===void 0?this._defaultValue:i}set value(i){if(this._shallow&&Me(this._raw[this._key])){const e=this._object[this._key];if(Me(e)){e.value=i;return}}this._object[this._key]=i}get dep(){return pa(this._raw,this._key)}}class ka{constructor(i){this._getter=i,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function Ha(t,i,e){return Me(t)?t:he(t)?new ka(t):Te(t)&&arguments.length>1?Ba(t,i,e):vi(t)}function Ba(t,i,e){return new La(t,i,e)}class za{constructor(i,e,n){this.fn=i,this.setter=e,this._value=void 0,this.dep=new on(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=gi-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!e,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&be!==this)return Pr(this,!0),!0}get value(){const i=this.dep.track();return Ir(this),i&&(i.version=this.dep.version),this._value}set value(i){this.setter&&this.setter(i)}}function Na(t,i,e=!1){let n,r;return he(t)?n=t:(n=t.get,r=t.set),new za(n,r,e)}const Ii={},Ui=new WeakMap;let Lt;function Ua(t,i=!1,e=Lt){if(e){let n=Ui.get(e);n||Ui.set(e,n=[]),n.push(t)}}function Va(t,i,e=xe){const{immediate:n,deep:r,once:s,scheduler:o,augmentJob:l,call:a}=e,u=L=>r?L:Ye(L)||r===!1||r===0?_t(L,1):_t(L);let c,h,f,m,v=!1,y=!1;if(Me(t)?(h=()=>t.value,v=Ye(t)):Ut(t)?(h=()=>u(t),v=!0):ue(t)?(y=!0,v=t.some(L=>Ut(L)||Ye(L)),h=()=>t.map(L=>{if(Me(L))return L.value;if(Ut(L))return u(L);if(he(L))return a?a(L,2):L()})):he(t)?i?h=a?()=>a(t,2):t:h=()=>{if(f){xt();try{f()}finally{bt()}}const L=Lt;Lt=c;try{return a?a(t,3,[m]):t(m)}finally{Lt=L}}:h=ft,i&&r){const L=h,U=r===!0?1/0:r;h=()=>_t(L(),U)}const T=Er(),x=()=>{c.stop(),T&&T.active&&Xn(T.effects,c)};if(s&&i){const L=i;i=(...U)=>{const K=L(...U);return x(),K}}let E=y?new Array(t.length).fill(Ii):Ii;const M=L=>{if(!(!(c.flags&1)||!c.dirty&&!L))if(i){const U=c.run();if(L||r||v||(y?U.some((K,q)=>dt(K,E[q])):dt(U,E))){f&&f();const K=Lt;Lt=c;try{const q=[U,E===Ii?void 0:y&&E[0]===Ii?[]:E,m];E=U,a?a(i,3,q):i(...q)}finally{Lt=K}}}else c.run()};return l&&l(M),c=new Sr(h),c.scheduler=o?()=>o(M,!1):M,m=L=>Ua(L,!1,c),f=c.onStop=()=>{const L=Ui.get(c);if(L){if(a)a(L,4);else for(const U of L)U();Ui.delete(c)}},i?n?M(!0):E=c.run():o?o(M.bind(null,!0),!0):c.run(),x.pause=c.pause.bind(c),x.resume=c.resume.bind(c),x.stop=x,x}function _t(t,i=1/0,e){if(i<=0||!Te(t)||t.__v_skip||(e=e||new Map,(e.get(t)||0)>=i))return t;if(e.set(t,i),i--,Me(t))_t(t.value,i,e);else if(ue(t))for(let n=0;n<t.length;n++)_t(t[n],i,e);else if(mr(t)||Jt(t))t.forEach(n=>{_t(n,i,e)});else if(wr(t)){for(const n in t)_t(t[n],i,e);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&_t(t[n],i,e)}return t}/**
* @vue/runtime-core v3.5.41
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function Si(t,i,e,n){try{return n?t(...n):t()}catch(r){hn(r,i,e)}}function rt(t,i,e,n){if(he(t)){const r=Si(t,i,e,n);return r&&vr(r)&&r.catch(s=>{hn(s,i,e)}),r}if(ue(t)){const r=[];for(let s=0;s<t.length;s++)r.push(rt(t[s],i,e,n));return r}}function hn(t,i,e,n=!0){const r=i?i.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=i&&i.appContext.config||xe;if(i){let l=i.parent;const a=i.proxy,u=`https://vuejs.org/error-reference/#runtime-${e}`;for(;l;){const c=l.ec;if(c){for(let h=0;h<c.length;h++)if(c[h](t,a,u)===!1)return}l=l.parent}if(s){xt(),Si(s,null,10,[t,a,u]),bt();return}}Wa(t,e,r,n,o)}function Wa(t,i,e,n=!0,r=!1){if(r)throw t;console.error(t)}const je=[];let ut=-1;const Qt=[];let Dt=null,Kt=0;const Ur=Promise.resolve();let Vi=null;function ns(t){const i=Vi||Ur;return t?i.then(this?t.bind(this):t):i}function ja(t){let i=ut+1,e=je.length;for(;i<e;){const n=i+e>>>1,r=je[n],s=yi(r);s<t||s===t&&r.flags&2?i=n+1:e=n}return i}function ss(t){if(!(t.flags&1)){const i=yi(t),e=je[je.length-1];!e||!(t.flags&2)&&i>=yi(e)?je.push(t):je.splice(ja(i),0,t),t.flags|=1,Vr()}}function Vr(){Vi||(Vi=Ur.then(jr))}function Ga(t){if(!ue(t))Dt&&t.id===-1?Dt.splice(Kt+1,0,t):t.flags&1||(Qt.push(t),t.flags|=1);else for(let i=0;i<t.length;i++)Qt.push(t[i]);Vr()}function Ps(t,i,e=ut+1){for(;e<je.length;e++){const n=je[e];if(n&&n.flags&2){if(t&&n.id!==t.uid)continue;je.splice(e,1),e--,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function Wr(t){if(Qt.length){const i=[...new Set(Qt)].sort((e,n)=>yi(e)-yi(n));if(Qt.length=0,Dt){for(let e=0;e<i.length;e++)Dt.push(i[e]);return}for(Dt=i,Kt=0;Kt<Dt.length;Kt++){const e=Dt[Kt];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}Dt=null,Kt=0}}const yi=t=>t.id==null?t.flags&2?-1:1/0:t.id;function jr(t){try{for(ut=0;ut<je.length;ut++){const i=je[ut];i&&!(i.flags&8)&&(i.flags&4&&(i.flags&=-2),Si(i,i.i,i.i?15:14),i.flags&4||(i.flags&=-2))}}finally{for(;ut<je.length;ut++){const i=je[ut];i&&(i.flags&=-2)}ut=-1,je.length=0,Wr(),Vi=null,(je.length||Qt.length)&&jr()}}let ke=null,Gr=null;function Wi(t){const i=ke;return ke=t,Gr=t&&t.type.__scopeId||null,i}function $e(t,i=ke,e){if(!i||t._n)return t;const n=(...r)=>{n._d&&Zi(-1);const s=Wi(i),o=Tt.length;let l;try{l=t(...r)}finally{for(let a=Tt.length;a>o;a--)hs();Wi(s),n._d&&Zi(1)}return l};return n._n=!0,n._c=!0,n._d=!0,n}function Be(t,i){if(ke===null)return t;const e=mn(ke),n=t.dirs||(t.dirs=[]);for(let r=0;r<i.length;r++){let[s,o,l,a=xe]=i[r];s&&(he(s)&&(s={mounted:s,updated:s}),s.deep&&_t(o),n.push({dir:s,instance:e,value:o,oldValue:void 0,arg:l,modifiers:a}))}return t}function Mt(t,i,e,n){const r=t.dirs,s=i&&i.dirs;for(let o=0;o<r.length;o++){const l=r[o];s&&(l.oldValue=s[o].value);let a=l.dir[n];a&&(xt(),rt(a,e,8,[t.el,l,t,i]),bt())}}function qa(t,i){if(Ne){let e=Ne.provides;const n=Ne.parent&&Ne.parent.provides;n===e&&(e=Ne.provides=Object.create(n)),e[t]=i}}function Fi(t,i,e=!1){const n=Ci();if(n||ei){let r=ei?ei._context.provides:n?n.parent==null||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(r&&t in r)return r[t];if(arguments.length>1)return e&&he(i)?i.call(n&&n.proxy):i}}const Za=Symbol.for("v-scx"),Ka=()=>Fi(Za);function Rs(t,i){return rs(t,null,i)}function it(t,i,e){return rs(t,i,e)}function rs(t,i,e=xe){const{immediate:n,deep:r,flush:s,once:o}=e,l=Ue({},e),a=i&&n||!i&&s!=="post";let u;if(xi){if(s==="sync"){const m=Ka();u=m.__watcherHandles||(m.__watcherHandles=[])}else if(!a){const m=()=>{};return m.stop=ft,m.resume=ft,m.pause=ft,m}}const c=Ne;l.call=(m,v,y)=>rt(m,c,v,y);let h=!1;s==="post"?l.scheduler=m=>{Ze(m,c&&c.suspense)}:s!=="sync"&&(h=!0,l.scheduler=(m,v)=>{v?m():ss(m)}),l.augmentJob=m=>{i&&(m.flags|=4),h&&(m.flags|=2,c&&(m.id=c.uid,m.i=c))};const f=Va(t,i,l);return xi&&(u?u.push(f):a&&f()),f}function Xa(t,i,e){const n=this.proxy,r=Re(t)?t.includes(".")?qr(n,t):()=>n[t]:t.bind(n,n);let s;he(i)?s=i:(s=i.handler,e=i);const o=Pi(this),l=rs(r,s.bind(n),e);return o(),l}function qr(t,i){const e=i.split(".");return()=>{let n=t;for(let r=0;r<e.length&&n;r++)n=n[e[r]];return n}}const Ya=Symbol("_vte"),dn=t=>t.__isTeleport,En=Symbol("_leaveCb");function Ja(t){let i=t[0];if(t.length>1){for(const e of t)if(e.type!==pt){i=e;break}}return i}function Zr(t){if(!as(t))return dn(t.type)&&t.children?Ja(t.children):t;if(t.component)return t.component.subTree;const{shapeFlag:i,children:e}=t;if(e){if(i&16)return e[0];if(i&32&&he(e.default))return e.default()}}function os(t,i){if(t.shapeFlag&6&&t.component){t.transition=i;const e=t.component.subTree;os(dn(e.type)&&Zr(e)||e,i)}else t.shapeFlag&128?(t.ssContent.transition=i.clone(t.ssContent),t.ssFallback.transition=i.clone(t.ssFallback)):t.transition=i}function ji(){const t=Ci();return t?(t.appContext.config.idPrefix||"v")+"-"+t.ids[0]+t.ids[1]++:""}function Kr(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Qa(t){const i=Ci(),e=We(null);if(i){const r=i.refs===xe?i.refs={}:i.refs;Object.defineProperty(r,t,{enumerable:!0,get:()=>e.value,set:s=>e.value=s})}return e}function Ds(t,i){let e;return!!((e=Object.getOwnPropertyDescriptor(t,i))&&!e.configurable)}const Gi=new WeakMap;function fi(t,i,e,n,r=!1){if(ue(t)){t.forEach((y,T)=>fi(y,i&&(ue(i)?i[T]:i),e,n,r));return}if($t(n)&&!r){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&fi(t,i,e,n.component.subTree);return}const s=n.shapeFlag&4?mn(n.component):n.el,o=r?null:s,{i:l,r:a}=t,u=i&&i.r,c=l.refs===xe?l.refs={}:l.refs,h=l.setupState,f=we(h),m=h===xe?gr:y=>Ds(c,y)?!1:_e(f,y),v=(y,T)=>!(T&&Ds(c,T));if(u!=null&&u!==a){if(Is(i),Re(u))c[u]=null,m(u)&&(h[u]=null);else if(Me(u)){const y=i;v(u,y.k)&&(u.value=null),y.k&&(c[y.k]=null)}}if(he(a))Si(a,l,12,[o,c]);else{const y=Re(a),T=Me(a);if(y||T){const x=()=>{if(t.f){const E=y?m(a)?h[a]:c[a]:v()||!t.k?a.value:c[t.k];if(r)ue(E)&&Xn(E,s);else if(ue(E))E.includes(s)||E.push(s);else if(y)c[a]=[s],m(a)&&(h[a]=c[a]);else{const M=[s];v(a,t.k)&&(a.value=M),t.k&&(c[t.k]=M)}}else y?(c[a]=o,m(a)&&(h[a]=o)):T&&(v(a,t.k)&&(a.value=o),t.k&&(c[t.k]=o))};if(o){const E=()=>{x(),Gi.delete(t)};E.id=-1,Gi.set(t,E),Ze(E,e)}else Is(t),x()}}}function Is(t){const i=Gi.get(t);i&&(i.flags|=8,Gi.delete(t))}rn().requestIdleCallback;rn().cancelIdleCallback;const $t=t=>!!t.type.__asyncLoader,as=t=>t.type.__isKeepAlive;function $a(t,i){Xr(t,"a",i)}function el(t,i){Xr(t,"da",i)}function Xr(t,i,e=Ne){const n=t.__wdc||(t.__wdc=()=>{let r=e;for(;r;){if(r.isDeactivated)return;r=r.parent}return t()});if(fn(i,n,e),e){let r=e.parent;for(;r&&r.parent;)as(r.parent.vnode)&&tl(n,i,e,r),r=r.parent}}function tl(t,i,e,n){const r=fn(i,t,n,!0);Yr(()=>{Xn(n[i],r)},e)}function fn(t,i,e=Ne,n=!1){if(e){const r=e[t]||(e[t]=[]),s=i.__weh||(i.__weh=(...o)=>{xt();const l=Pi(e),a=rt(i,e,t,o);return l(),bt(),a});return n?r.unshift(s):r.push(s),s}}const St=t=>(i,e=Ne)=>{(!xi||t==="sp")&&fn(t,(...n)=>i(...n),e)},il=St("bm"),ls=St("m"),nl=St("bu"),sl=St("u"),rl=St("bum"),Yr=St("um"),ol=St("sp"),al=St("rtg"),ll=St("rtc");function ul(t,i=Ne){fn("ec",t,i)}const Jr="components";function Qr(t,i){return eo(Jr,t,!0,i)||t}const $r=Symbol.for("v-ndc");function cl(t){return Re(t)?eo(Jr,t,!1)||t:t||$r}function eo(t,i,e=!0,n=!1){const r=ke||Ne;if(r){const s=r.type;{const l=Zl(s,!1);if(l&&(l===i||l===Ge(i)||l===sn(Ge(i))))return s}const o=As(r[t]||s[t],i)||As(r.appContext[t],i);return!o&&n?s:o}}function As(t,i){return t&&(t[i]||t[Ge(i)]||t[sn(Ge(i))])}function Ee(t,i,e,n){let r;const s=e,o=ue(t);if(o||Re(t)){const l=o&&Ut(t);let a=!1,u=!1;l&&(a=!Ye(t),u=Et(t),t=an(t)),r=new Array(t.length);for(let c=0,h=t.length;c<h;c++)r[c]=i(a?u?ti(st(t[c])):st(t[c]):t[c],c,void 0,s)}else if(typeof t=="number"){r=new Array(t);for(let l=0;l<t;l++)r[l]=i(l+1,l,void 0,s)}else if(Te(t))if(t[Symbol.iterator])r=Array.from(t,(l,a)=>i(l,a,void 0,s));else{const l=Object.keys(t);r=new Array(l.length);for(let a=0,u=l.length;a<u;a++){const c=l[a];r[a]=i(t[c],c,a,s)}}else r=[];return r}function Os(t,i,e,n,r,s){if(e==null&&(e={}),ke.ce||ke.parent&&$t(ke.parent)&&ke.parent.ce){const u=e,c=Object.keys(u).length>0;return i!=="default"&&(u.name=i),S(),le(se,null,[ee("slot",u,n)],c?-2:64)}let o=t[i];o&&o._c&&(o._d=!1);const l=Tt.length;S();let a;try{const u=o&&to(o(e)),c=e.key||s||u&&u.key;a=le(se,{key:(c&&!Je(c)?c:`_${i}`)+(!u&&n?"_fb":"")},u||(n?n():[]),u&&t._===1?64:-2)}catch(u){for(let c=Tt.length;c>l;c--)hs();throw u}finally{o&&o._c&&(o._d=!0)}return a.scopeId&&(a.slotScopeIds=[a.scopeId+"-s"]),a}function to(t){return t.some(i=>_i(i)?!(i.type===pt||i.type===se&&!to(i.children)):!0)?t:null}const zn=t=>t?xo(t)?mn(t):zn(t.parent):null,pi=Ue(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>zn(t.parent),$root:t=>zn(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>no(t),$forceUpdate:t=>t.f||(t.f=()=>{ss(t.update)}),$nextTick:t=>t.n||(t.n=ns.bind(t.proxy)),$watch:t=>Xa.bind(t)}),Sn=(t,i)=>t!==xe&&!t.__isScriptSetup&&_e(t,i),hl={get({_:t},i){if(i==="__v_skip")return!0;const{ctx:e,setupState:n,data:r,props:s,accessCache:o,type:l,appContext:a}=t;if(i[0]!=="$"){const f=o[i];if(f!==void 0)switch(f){case 1:return n[i];case 2:return r[i];case 4:return e[i];case 3:return s[i]}else{if(Sn(n,i))return o[i]=1,n[i];if(r!==xe&&_e(r,i))return o[i]=2,r[i];if(_e(s,i))return o[i]=3,s[i];if(e!==xe&&_e(e,i))return o[i]=4,e[i];Nn&&(o[i]=0)}}const u=pi[i];let c,h;if(u)return i==="$attrs"&&ze(t.attrs,"get",""),u(t);if((c=l.__cssModules)&&(c=c[i]))return c;if(e!==xe&&_e(e,i))return o[i]=4,e[i];if(h=a.config.globalProperties,_e(h,i))return h[i]},set({_:t},i,e){const{data:n,setupState:r,ctx:s}=t;return Sn(r,i)?(r[i]=e,!0):n!==xe&&_e(n,i)?(n[i]=e,!0):_e(t.props,i)||i[0]==="$"&&i.slice(1)in t?!1:(s[i]=e,!0)},has({_:{data:t,setupState:i,accessCache:e,ctx:n,appContext:r,props:s,type:o}},l){let a;return!!(e[l]||t!==xe&&l[0]!=="$"&&_e(t,l)||Sn(i,l)||_e(s,l)||_e(n,l)||_e(pi,l)||_e(r.config.globalProperties,l)||(a=o.__cssModules)&&a[l])},defineProperty(t,i,e){return e.get!=null?t._.accessCache[i]=0:_e(e,"value")&&this.set(t,i,e.value,null),Reflect.defineProperty(t,i,e)}};function Ms(t){return ue(t)?t.reduce((i,e)=>(i[e]=null,i),{}):t}let Nn=!0;function dl(t){const i=no(t),e=t.proxy,n=t.ctx;Nn=!1,i.beforeCreate&&Fs(i.beforeCreate,t,"bc");const{data:r,computed:s,methods:o,watch:l,provide:a,inject:u,created:c,beforeMount:h,mounted:f,beforeUpdate:m,updated:v,activated:y,deactivated:T,beforeDestroy:x,beforeUnmount:E,destroyed:M,unmounted:L,render:U,renderTracked:K,renderTriggered:q,errorCaptured:Y,serverPrefetch:te,expose:fe,inheritAttrs:$,components:j,directives:ie,filters:ce}=i;if(u&&fl(u,n,null),o)for(const pe in o){const oe=o[pe];he(oe)&&(n[pe]=oe.bind(e))}if(r){const pe=r.call(e,e);Te(pe)&&(t.data=ln(pe))}if(Nn=!0,s)for(const pe in s){const oe=s[pe],Ae=he(oe)?oe.bind(e,e):he(oe.get)?oe.get.bind(e,e):ft,De=!he(oe)&&he(oe.set)?oe.set.bind(e):ft,et=Le({get:Ae,set:De});Object.defineProperty(n,pe,{enumerable:!0,configurable:!0,get:()=>et.value,set:qe=>et.value=qe})}if(l)for(const pe in l)io(l[pe],n,e,pe);if(a){const pe=he(a)?a.call(e):a;Reflect.ownKeys(pe).forEach(oe=>{qa(oe,pe[oe])})}c&&Fs(c,t,"c");function me(pe,oe){ue(oe)?oe.forEach(Ae=>pe(Ae.bind(e))):oe&&pe(oe.bind(e))}if(me(il,h),me(ls,f),me(nl,m),me(sl,v),me($a,y),me(el,T),me(ul,Y),me(ll,K),me(al,q),me(rl,E),me(Yr,L),me(ol,te),ue(fe))if(fe.length){const pe=t.exposed||(t.exposed={});fe.forEach(oe=>{Object.defineProperty(pe,oe,{get:()=>e[oe],set:Ae=>e[oe]=Ae,enumerable:!0})})}else t.exposed||(t.exposed={});U&&t.render===ft&&(t.render=U),$!=null&&(t.inheritAttrs=$),j&&(t.components=j),ie&&(t.directives=ie),te&&Kr(t)}function fl(t,i,e=ft){ue(t)&&(t=Un(t));for(const n in t){const r=t[n];let s;Te(r)?"default"in r?s=Fi(r.from||n,r.default,!0):s=Fi(r.from||n):s=Fi(r),Me(s)?Object.defineProperty(i,n,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):i[n]=s}}function Fs(t,i,e){rt(ue(t)?t.map(n=>n.bind(i.proxy)):t.bind(i.proxy),i,e)}function io(t,i,e,n){let r=n.includes(".")?qr(e,n):()=>e[n];if(Re(t)){const s=i[t];he(s)&&it(r,s)}else if(he(t))it(r,t.bind(e));else if(Te(t))if(ue(t))t.forEach(s=>io(s,i,e,n));else{const s=he(t.handler)?t.handler.bind(e):i[t.handler];he(s)&&it(r,s,t)}}function no(t){const i=t.type,{mixins:e,extends:n}=i,{mixins:r,optionsCache:s,config:{optionMergeStrategies:o}}=t.appContext,l=s.get(i);let a;return l?a=l:!r.length&&!e&&!n?a=i:(a={},r.length&&r.forEach(u=>qi(a,u,o,!0)),qi(a,i,o)),Te(i)&&s.set(i,a),a}function qi(t,i,e,n=!1){const{mixins:r,extends:s}=i;s&&qi(t,s,e,!0),r&&r.forEach(o=>qi(t,o,e,!0));for(const o in i)if(!(n&&o==="expose")){const l=pl[o]||e&&e[o];t[o]=l?l(t[o],i[o]):i[o]}return t}const pl={data:Ls,props:ks,emits:ks,methods:li,computed:li,beforeCreate:Ve,created:Ve,beforeMount:Ve,mounted:Ve,beforeUpdate:Ve,updated:Ve,beforeDestroy:Ve,beforeUnmount:Ve,destroyed:Ve,unmounted:Ve,activated:Ve,deactivated:Ve,errorCaptured:Ve,serverPrefetch:Ve,components:li,directives:li,watch:ml,provide:Ls,inject:gl};function Ls(t,i){return i?t?function(){return Ue(he(t)?t.call(this,this):t,he(i)?i.call(this,this):i)}:i:t}function gl(t,i){return li(Un(t),Un(i))}function Un(t){if(ue(t)){const i={};for(let e=0;e<t.length;e++)i[t[e]]=t[e];return i}return t}function Ve(t,i){return t?[...new Set([].concat(t,i))]:i}function li(t,i){return t?Ue(Object.create(null),t,i):i}function ks(t,i){return t?ue(t)&&ue(i)?[...new Set([...t,...i])]:Ue(Object.create(null),Ms(t),Ms(i??{})):i}function ml(t,i){if(!t)return i;if(!i)return t;const e=Ue(Object.create(null),t);for(const n in i)e[n]=Ve(t[n],i[n]);return e}function so(){return{app:null,config:{isNativeTag:gr,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let vl=0;function yl(t,i){return function(n,r=null){he(n)||(n=Ue({},n)),r!=null&&!Te(r)&&(r=null);const s=so(),o=new WeakSet,l=[];let a=!1;const u=s.app={_uid:vl++,_component:n,_props:r,_container:null,_context:s,_instance:null,version:Yl,get config(){return s.config},set config(c){},use(c,...h){return o.has(c)||(c&&he(c.install)?(o.add(c),c.install(u,...h)):he(c)&&(o.add(c),c(u,...h))),u},mixin(c){return s.mixins.includes(c)||s.mixins.push(c),u},component(c,h){return h?(s.components[c]=h,u):s.components[c]},directive(c,h){return h?(s.directives[c]=h,u):s.directives[c]},mount(c,h,f){if(!a){const m=u._ceVNode||ee(n,r);return m.appContext=s,f===!0?f="svg":f===!1&&(f=void 0),t(m,c,f),a=!0,u._container=c,c.__vue_app__=u,mn(m.component)}},onUnmount(c){l.push(c)},unmount(){a&&(rt(l,u._instance,16),t(null,u._container),delete u._container.__vue_app__)},provide(c,h){return s.provides[c]=h,u},runWithContext(c){const h=ei;ei=u;try{return c()}finally{ei=h}}};return u}}let ei=null;const wl=(t,i)=>i==="modelValue"||i==="model-value"?t.modelModifiers:t[`${i}Modifiers`]||t[`${Ge(i)}Modifiers`]||t[`${At(i)}Modifiers`];function _l(t,i,...e){if(t.isUnmounted)return;const n=t.vnode.props||xe;let r=e;const s=i.startsWith("update:"),o=s&&wl(n,i.slice(7));o&&(o.trim&&(r=e.map(c=>Re(c)?c.trim():c)),o.number&&(r=e.map(Yn)));let l,a=n[l=wn(i)]||n[l=wn(Ge(i))];!a&&s&&(a=n[l=wn(At(i))]),a&&rt(a,t,6,r);const u=n[l+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[l])return;t.emitted[l]=!0,rt(u,t,6,r)}}const Tl=new WeakMap;function ro(t,i,e=!1){const n=e?Tl:i.emitsCache,r=n.get(t);if(r!==void 0)return r;const s=t.emits;let o={},l=!1;if(!he(t)){const a=u=>{const c=ro(u,i,!0);c&&(l=!0,Ue(o,c))};!e&&i.mixins.length&&i.mixins.forEach(a),t.extends&&a(t.extends),t.mixins&&t.mixins.forEach(a)}return!s&&!l?(Te(t)&&n.set(t,null),null):(ue(s)?s.forEach(a=>o[a]=null):Ue(o,s),Te(t)&&n.set(t,o),o)}function pn(t,i){return!t||!$i(i)?!1:(i=i.slice(2),i=i==="Once"?i:i.replace(/Once$/,""),_e(t,i[0].toLowerCase()+i.slice(1))||_e(t,At(i))||_e(t,i))}function Hs(t){const{type:i,vnode:e,proxy:n,withProxy:r,propsOptions:[s],slots:o,attrs:l,emit:a,render:u,renderCache:c,props:h,data:f,setupState:m,ctx:v,inheritAttrs:y}=t,T=Wi(t);let x,E;try{if(e.shapeFlag&4){const L=r||n,U=L;x=ht(u.call(U,L,c,h,m,f,v)),E=l}else{const L=i;x=ht(L.length>1?L(h,{attrs:l,slots:o,emit:a}):L(h,null)),E=i.props?l:xl(l)}}catch(L){Tt.length=0,hn(L,t,1),x=ee(pt)}let M=x;if(E&&y!==!1){const L=Object.keys(E),{shapeFlag:U}=M;L.length&&U&7&&(s&&L.some(en)&&(E=bl(E,s)),M=ii(M,E,!1,!0))}if(e.dirs&&(M=ii(M,null,!1,!0),M.dirs=M.dirs?M.dirs.concat(e.dirs):e.dirs),e.transition){const L=dn(M.type)&&Zr(M)||M;os(L,e.transition)}return x=M,Wi(T),x}const xl=t=>{let i;for(const e in t)(e==="class"||e==="style"||$i(e))&&((i||(i={}))[e]=t[e]);return i},bl=(t,i)=>{const e={};for(const n in t)(!en(n)||!(n.slice(9)in i))&&(e[n]=t[n]);return e};function El(t,i,e){const{props:n,children:r,component:s}=t,{props:o,children:l,patchFlag:a}=i,u=s.emitsOptions;if(i.dirs||i.transition)return!0;if(e&&a>=0){if(a&1024)return!0;if(a&16)return n?Bs(n,o,u):!!o;if(a&8){const c=i.dynamicProps;for(let h=0;h<c.length;h++){const f=c[h];if(oo(o,n,f)&&!pn(u,f))return!0}}}else return(r||l)&&(!l||!l.$stable)?!0:n===o?!1:n?o?Bs(n,o,u):!0:!!o;return!1}function Bs(t,i,e){const n=Object.keys(i);if(n.length!==Object.keys(t).length)return!0;for(let r=0;r<n.length;r++){const s=n[r];if(oo(i,t,s)&&!pn(e,s))return!0}return!1}function oo(t,i,e){const n=t[e],r=i[e];return e==="style"&&Te(n)&&Te(r)?!Jn(n,r):n!==r}function Sl({vnode:t,parent:i,suspense:e},n){for(;i;){const r=i.subTree;if(r.suspense&&r.suspense.activeBranch===t&&(r.suspense.vnode.el=r.el=n,t=r),r===t)(t=i.vnode).el=n,i=i.parent;else break}e&&e.activeBranch===t&&(e.vnode.el=n)}const ao={},lo=()=>Object.create(ao),uo=t=>Object.getPrototypeOf(t)===ao;function Cl(t,i,e,n=!1){const r={},s=lo();t.propsDefaults=Object.create(null),co(t,i,r,s);for(const o in t.propsOptions[0])o in r||(r[o]=void 0);e?t.props=n?r:Ia(r):t.type.props?t.props=r:t.props=s,t.attrs=s}function Pl(t,i,e,n){const{props:r,attrs:s,vnode:{patchFlag:o}}=t,l=we(r),[a]=t.propsOptions;let u=!1;if((n||o>0)&&!(o&16)){if(o&8){const c=t.vnode.dynamicProps;for(let h=0;h<c.length;h++){let f=c[h];if(pn(t.emitsOptions,f))continue;const m=i[f];if(a)if(_e(s,f))m!==s[f]&&(s[f]=m,u=!0);else{const v=Ge(f);r[v]=Vn(a,l,v,m,t,!1)}else m!==s[f]&&(s[f]=m,u=!0)}}}else{co(t,i,r,s)&&(u=!0);let c;for(const h in l)(!i||!_e(i,h)&&((c=At(h))===h||!_e(i,c)))&&(a?e&&(e[h]!==void 0||e[c]!==void 0)&&(r[h]=Vn(a,l,h,void 0,t,!0)):delete r[h]);if(s!==l)for(const h in s)(!i||!_e(i,h))&&(delete s[h],u=!0)}u&&wt(t.attrs,"set","")}function co(t,i,e,n){const[r,s]=t.propsOptions;let o=!1,l;if(i)for(let a in i){if(ci(a))continue;const u=i[a];let c;r&&_e(r,c=Ge(a))?!s||!s.includes(c)?e[c]=u:(l||(l={}))[c]=u:pn(t.emitsOptions,a)||(!(a in n)||u!==n[a])&&(n[a]=u,o=!0)}if(s){const a=we(e),u=l||xe;for(let c=0;c<s.length;c++){const h=s[c];e[h]=Vn(r,a,h,u[h],t,!_e(u,h))}}return o}function Vn(t,i,e,n,r,s){const o=t[e];if(o!=null){const l=_e(o,"default");if(l&&n===void 0){const a=o.default;if(o.type!==Function&&!o.skipFactory&&he(a)){const{propsDefaults:u}=r;if(e in u)n=u[e];else{const c=Pi(r);n=u[e]=a.call(null,i),c()}}else n=a;r.ce&&r.ce._setProp(e,n)}o[0]&&(s&&!l?n=!1:o[1]&&(n===""||n===At(e))&&(n=!0))}return n}const Rl=new WeakMap;function ho(t,i,e=!1){const n=e?Rl:i.propsCache,r=n.get(t);if(r)return r;const s=t.props,o={},l=[];let a=!1;if(!he(t)){const c=h=>{a=!0;const[f,m]=ho(h,i,!0);Ue(o,f),m&&l.push(...m)};!e&&i.mixins.length&&i.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}if(!s&&!a)return Te(t)&&n.set(t,Yt),Yt;if(ue(s))for(let c=0;c<s.length;c++){const h=Ge(s[c]);zs(h)&&(o[h]=xe)}else if(s)for(const c in s){const h=Ge(c);if(zs(h)){const f=s[c],m=o[h]=ue(f)||he(f)?{type:f}:Ue({},f),v=m.type;let y=!1,T=!0;if(ue(v))for(let x=0;x<v.length;++x){const E=v[x],M=he(E)&&E.name;if(M==="Boolean"){y=!0;break}else M==="String"&&(T=!1)}else y=he(v)&&v.name==="Boolean";m[0]=y,m[1]=T,(y||_e(m,"default"))&&l.push(h)}}const u=[o,l];return Te(t)&&n.set(t,u),u}function zs(t){return t[0]!=="$"&&!ci(t)}const us=t=>t==="_"||t==="_ctx"||t==="$stable",cs=t=>ue(t)?t.map(ht):[ht(t)],Dl=(t,i,e)=>{if(i._n)return i;const n=$e((...r)=>cs(i(...r)),e);return n._c=!1,n},fo=(t,i,e)=>{const n=t._ctx;for(const r in t){if(us(r))continue;const s=t[r];if(he(s))i[r]=Dl(r,s,n);else if(s!=null){const o=cs(s);i[r]=()=>o}}},po=(t,i)=>{const e=cs(i);t.slots.default=()=>e},go=(t,i,e)=>{for(const n in i)(e||!us(n))&&(t[n]=i[n])},Il=(t,i,e)=>{const n=t.slots=lo();if(t.vnode.shapeFlag&32){const r=i._;r?(go(n,i,e),e&&_r(n,"_",r,!0)):fo(i,n)}else i&&po(t,i)},Al=(t,i,e)=>{const{vnode:n,slots:r}=t;let s=!0,o=xe;if(n.shapeFlag&32){const l=i._;l?e&&l===1?s=!1:go(r,i,e):(s=!i.$stable,fo(i,r)),o=i}else i&&(po(t,i),o={default:1});if(s)for(const l in r)!us(l)&&o[l]==null&&delete r[l]},Ze=kl;function Ol(t){return Ml(t)}function Ml(t,i){const e=rn();e.__VUE__=!0;const{insert:n,remove:r,patchProp:s,createElement:o,createText:l,createComment:a,setText:u,setElementText:c,parentNode:h,nextSibling:f,setScopeId:m=ft,insertStaticContent:v}=t,y=(P,I,H,V=null,N=null,d=null,w=void 0,C=null,A=!!I.dynamicChildren)=>{if(P===I)return;P&&!oi(P,I)&&(V=tt(P),qe(P,N,d,!0),P=null),I.patchFlag===-2&&(A=!1,I.dynamicChildren=null);const{type:O,ref:B,shapeFlag:F}=I;switch(O){case gn:T(P,I,H,V);break;case pt:x(P,I,H,V);break;case Li:P==null&&E(I,H,V,w);break;case se:j(P,I,H,V,N,d,w,C,A);break;default:F&1?U(P,I,H,V,N,d,w,C,A):F&6?ie(P,I,H,V,N,d,w,C,A):(F&64||F&128)&&O.process(P,I,H,V,N,d,w,C,A,at)}B!=null&&N?fi(B,P&&P.ref,d,I||P,!I):B==null&&P&&P.ref!=null&&fi(P.ref,null,d,P,!0)},T=(P,I,H,V)=>{if(P==null)n(I.el=l(I.children),H,V);else{const N=I.el=P.el;I.children!==P.children&&u(N,I.children)}},x=(P,I,H,V)=>{P==null?n(I.el=a(I.children||""),H,V):I.el=P.el},E=(P,I,H,V)=>{[P.el,P.anchor]=v(P.children,I,H,V,P.el,P.anchor)},M=({el:P,anchor:I},H,V)=>{let N;for(;P&&P!==I;)N=f(P),n(P,H,V),P=N;n(I,H,V)},L=({el:P,anchor:I})=>{let H;for(;P&&P!==I;)H=f(P),r(P),P=H;r(I)},U=(P,I,H,V,N,d,w,C,A)=>{if(I.type==="svg"?w="svg":I.type==="math"&&(w="mathml"),P==null)K(I,H,V,N,d,w,C,A);else{const O=P.el&&P.el._isVueCE?P.el:null;try{O&&O._beginPatch(),te(P,I,N,d,w,C,A)}finally{O&&O._endPatch()}}},K=(P,I,H,V,N,d,w,C)=>{let A,O;const{props:B,shapeFlag:F,transition:W,dirs:Z}=P;if(A=P.el=o(P.type,d,B&&B.is,B),F&8?c(A,P.children):F&16&&Y(P.children,A,null,V,N,Cn(P,d),w,C),Z&&Mt(P,null,V,"created"),q(A,P,P.scopeId,w,V),B){for(const X in B)X!=="value"&&!ci(X)&&s(A,X,null,B[X],d,V);"value"in B&&s(A,"value",null,B.value,d),(O=B.onVnodeBeforeMount)&<(O,V,P)}Z&&Mt(P,null,V,"beforeMount");const ne=Fl(N,W);ne&&W.beforeEnter(A),n(A,I,H),((O=B&&B.onVnodeMounted)||ne||Z)&&Ze(()=>{try{O&<(O,V,P),ne&&W.enter(A),Z&&Mt(P,null,V,"mounted")}finally{}},N)},q=(P,I,H,V,N)=>{if(H&&m(P,H),V)for(let d=0;d<V.length;d++)m(P,V[d]);if(N){let d=N.subTree;if(I===d||wo(d.type)&&(d.ssContent===I||d.ssFallback===I)){const w=N.vnode;q(P,w,w.scopeId,w.slotScopeIds,N.parent)}}},Y=(P,I,H,V,N,d,w,C,A=0)=>{for(let O=A;O<P.length;O++){const B=P[O]=C?yt(P[O]):ht(P[O]);y(null,B,I,H,V,N,d,w,C)}},te=(P,I,H,V,N,d,w)=>{const C=I.el=P.el;let{patchFlag:A,dynamicChildren:O,dirs:B}=I;A|=P.patchFlag&16;const F=P.props||xe,W=I.props||xe;let Z;if(H&&Ft(H,!1),(Z=W.onVnodeBeforeUpdate)&<(Z,H,I,P),B&&Mt(I,P,H,"beforeUpdate"),H&&Ft(H,!0),O&&(!P.dynamicChildren||P.dynamicChildren.length!==O.length)&&(A=0,w=!1,O=null),(F.innerHTML&&W.innerHTML==null||F.textContent&&W.textContent==null)&&c(C,""),O?fe(P.dynamicChildren,O,C,H,V,Cn(I,N),d):w||oe(P,I,C,null,H,V,Cn(I,N),d,!1),A>0){if(A&16)$(C,F,W,H,N);else if(A&2&&F.class!==W.class&&s(C,"class",null,W.class,N),A&4&&s(C,"style",F.style,W.style,N),A&8){const ne=I.dynamicProps;for(let X=0;X<ne.length;X++){const ae=ne[X],g=F[ae],p=W[ae];(p!==g||ae==="value")&&s(C,ae,g,p,N,H)}}A&1&&P.children!==I.children&&c(C,I.children)}else!w&&O==null&&$(C,F,W,H,N);((Z=W.onVnodeUpdated)||B)&&Ze(()=>{Z&<(Z,H,I,P),B&&Mt(I,P,H,"updated")},V)},fe=(P,I,H,V,N,d,w)=>{for(let C=0;C<I.length;C++){const A=P[C],O=I[C],B=A.el&&(A.type===se||!oi(A,O)||A.shapeFlag&198)?h(A.el):H;y(A,O,B,null,V,N,d,w,!0)}},$=(P,I,H,V,N)=>{if(I!==H){if(I!==xe)for(const d in I)!ci(d)&&!(d in H)&&s(P,d,I[d],null,N,V);for(const d in H){if(ci(d))continue;const w=H[d],C=I[d];w!==C&&d!=="value"&&s(P,d,C,w,N,V)}"value"in H&&s(P,"value",I.value,H.value,N)}},j=(P,I,H,V,N,d,w,C,A)=>{const O=I.el=P?P.el:l(""),B=I.anchor=P?P.anchor:l("");let{patchFlag:F,dynamicChildren:W,slotScopeIds:Z}=I;Z&&(C=C?C.concat(Z):Z),P==null?(n(O,H,V),n(B,H,V),Y(I.children||[],H,B,N,d,w,C,A)):F>0&&F&64&&W&&P.dynamicChildren&&P.dynamicChildren.length===W.length?(fe(P.dynamicChildren,W,H,N,d,w,C),(I.key!=null||N&&I===N.subTree)&&mo(P,I,!0)):oe(P,I,H,B,N,d,w,C,A)},ie=(P,I,H,V,N,d,w,C,A)=>{I.slotScopeIds=C,P==null?I.shapeFlag&512?N.ctx.activate(I,H,V,w,A):ce(I,H,V,N,d,w,A):ye(P,I,A)},ce=(P,I,H,V,N,d,w)=>{const C=P.component=Vl(P,V,N);if(as(P)&&(C.ctx.renderer=at),Wl(C,!1,w),C.asyncDep){if(N&&N.registerDep(C,me,w),!P.el){const A=C.subTree=ee(pt);x(null,A,I,H),P.placeholder=A.el}}else me(C,P,I,H,N,d,w)},ye=(P,I,H)=>{const V=I.component=P.component;if(El(P,I,H))if(V.asyncDep&&!V.asyncResolved){pe(V,I,H);return}else V.next=I,V.update();else I.el=P.el,V.vnode=I},me=(P,I,H,V,N,d,w)=>{const C=()=>{if(P.isMounted){let{next:F,bu:W,u:Z,parent:ne,vnode:X}=P;{const b=vo(P);if(b){F&&(F.el=X.el,pe(P,F,w)),b.asyncDep.then(()=>{Ze(()=>{P.isUnmounted||O()},N)});return}}let ae=F,g;Ft(P,!1),F?(F.el=X.el,pe(P,F,w)):F=X,W&&Mi(W),(g=F.props&&F.props.onVnodeBeforeUpdate)&<(g,ne,F,X),Ft(P,!0);const p=Hs(P),_=P.subTree;P.subTree=p,y(_,p,h(_.el),tt(_),P,N,d),F.el=p.el,ae===null&&Sl(P,p.el),Z&&Ze(Z,N),(g=F.props&&F.props.onVnodeUpdated)&&Ze(()=>lt(g,ne,F,X),N)}else{let F;const{el:W,props:Z}=I,{bm:ne,m:X,parent:ae,root:g,type:p}=P,_=$t(I);Ft(P,!1),ne&&Mi(ne),!_&&(F=Z&&Z.onVnodeBeforeMount)&<(F,ae,I),Ft(P,!0);{g.ce&&g.ce._hasShadowRoot()&&g.ce._injectChildStyle(p,P.parent?P.parent.type:void 0);const b=P.subTree=Hs(P);y(null,b,H,V,P,N,d),I.el=b.el}if(X&&Ze(X,N),!_&&(F=Z&&Z.onVnodeMounted)){const b=I;Ze(()=>lt(F,ae,b),N)}(I.shapeFlag&256||ae&&$t(ae.vnode)&&ae.vnode.shapeFlag&256)&&P.a&&Ze(P.a,N),P.isMounted=!0,I=H=V=null}};P.scope.on();const A=P.effect=new Sr(C);P.scope.off();const O=P.update=A.run.bind(A),B=P.job=A.runIfDirty.bind(A);B.i=P,B.id=P.uid,A.scheduler=()=>ss(B),Ft(P,!0),O()},pe=(P,I,H)=>{I.component=P;const V=P.vnode.props;P.vnode=I,P.next=null,Pl(P,I.props,V,H),Al(P,I.children,H),xt(),Ps(P),bt()},oe=(P,I,H,V,N,d,w,C,A=!1)=>{const O=P&&P.children,B=P?P.shapeFlag:0,F=I.children,{patchFlag:W,shapeFlag:Z}=I;if(W>0){if(W&128){De(O,F,H,V,N,d,w,C,A);return}else if(W&256){Ae(O,F,H,V,N,d,w,C,A);return}}Z&8?(B&16&&ot(O,N,d),F!==O&&c(H,F)):B&16?Z&16?De(O,F,H,V,N,d,w,C,A):ot(O,N,d,!0):(B&8&&c(H,""),Z&16&&Y(F,H,V,N,d,w,C,A))},Ae=(P,I,H,V,N,d,w,C,A)=>{P=P||Yt,I=I||Yt;const O=P.length,B=I.length,F=Math.min(O,B);let W;for(W=0;W<F;W++){const Z=I[W]=A?yt(I[W]):ht(I[W]);y(P[W],Z,H,null,N,d,w,C,A)}O>B?ot(P,N,d,!0,!1,F):Y(I,H,V,N,d,w,C,A,F)},De=(P,I,H,V,N,d,w,C,A)=>{let O=0;const B=I.length;let F=P.length-1,W=B-1;for(;O<=F&&O<=W;){const Z=P[O],ne=I[O]=A?yt(I[O]):ht(I[O]);if(oi(Z,ne))y(Z,ne,H,null,N,d,w,C,A);else break;O++}for(;O<=F&&O<=W;){const Z=P[F],ne=I[W]=A?yt(I[W]):ht(I[W]);if(oi(Z,ne))y(Z,ne,H,null,N,d,w,C,A);else break;F--,W--}if(O>F){if(O<=W){const Z=W+1,ne=Z<B?I[Z].el:V;for(;O<=W;)y(null,I[O]=A?yt(I[O]):ht(I[O]),H,ne,N,d,w,C,A),O++}}else if(O>W)for(;O<=F;)qe(P[O],N,d,!0),O++;else{const Z=O,ne=O,X=new Map;for(O=ne;O<=W;O++){const J=I[O]=A?yt(I[O]):ht(I[O]);J.key!=null&&X.set(J.key,O)}let ae,g=0;const p=W-ne+1;let _=!1,b=0;const k=new Array(p);for(O=0;O<p;O++)k[O]=0;for(O=Z;O<=F;O++){const J=P[O];if(g>=p){qe(J,N,d,!0);continue}let ve;if(J.key!=null)ve=X.get(J.key);else for(ae=ne;ae<=W;ae++)if(k[ae-ne]===0&&oi(J,I[ae])){ve=ae;break}ve===void 0?qe(J,N,d,!0):(k[ve-ne]=O+1,ve>=b?b=ve:_=!0,y(J,I[ve],H,null,N,d,w,C,A),g++)}const G=_?Ll(k):Yt;for(ae=G.length-1,O=p-1;O>=0;O--){const J=ne+O,ve=I[J],re=I[J+1],He=J+1<B?re.el||yo(re):V;k[O]===0?y(null,ve,H,He,N,d,w,C,A):_&&(ae<0||O!==G[ae]?et(ve,H,He,2):ae--)}}},et=(P,I,H,V,N=null)=>{const{el:d,type:w,transition:C,children:A,shapeFlag:O}=P;if(O&6){et(P.component.subTree,I,H,V);return}if(O&128){P.suspense.move(I,H,V);return}if(O&64){w.move(P,I,H,at);return}if(w===se){n(d,I,H);for(let F=0;F<A.length;F++)et(A[F],I,H,V);n(P.anchor,I,H);return}if(w===Li){M(P,I,H);return}if(V!==2&&O&1&&C)if(V===0)C.persisted&&!d[En]?n(d,I,H):(C.beforeEnter(d),n(d,I,H),Ze(()=>C.enter(d),N));else{const{leave:F,delayLeave:W,afterLeave:Z}=C,ne=()=>{P.ctx.isUnmounted?r(d):n(d,I,H)},X=()=>{const ae=d._isLeaving||!!d[En];d._isLeaving&&d[En](!0),C.persisted&&!ae?ne():F(d,()=>{ne(),Z&&Z()})};W?W(d,ne,X):X()}else n(d,I,H)},qe=(P,I,H,V=!1,N=!1)=>{const{type:d,props:w,ref:C,children:A,dynamicChildren:O,shapeFlag:B,patchFlag:F,dirs:W,cacheIndex:Z,memo:ne}=P;if(F===-2&&(N=!1),C!=null&&(xt(),fi(C,null,H,P,!0),bt()),Z!=null&&(I.renderCache[Z]=void 0),B&256){I.ctx.deactivate(P);return}const X=B&1&&W,ae=!$t(P);let g;if(ae&&(g=w&&w.onVnodeBeforeUnmount)&<(g,I,P),B&6)jt(P.component,H,V);else{if(B&128){P.suspense.unmount(H,V);return}X&&Mt(P,null,I,"beforeUnmount"),B&64?P.type.remove(P,I,H,at,V):O&&!O.hasOnce&&(d!==se||F>0&&F&64)?ot(O,I,H,!1,!0):(d===se&&F&384||!N&&B&16)&&ot(A,I,H),V&&ge(P)}const p=ne!=null&&Z==null;(ae&&(g=w&&w.onVnodeUnmounted)||X||p)&&Ze(()=>{g&<(g,I,P),X&&Mt(P,null,I,"unmounted"),p&&(P.el=null)},H)},ge=P=>{const{type:I,el:H,anchor:V,transition:N}=P;if(I===se){Wt(H,V);return}if(I===Li){L(P);return}const d=()=>{r(H),N&&!N.persisted&&N.afterLeave&&N.afterLeave()};if(P.shapeFlag&1&&N&&!N.persisted){const{leave:w,delayLeave:C}=N,A=()=>w(H,d);C?C(P.el,d,A):A()}else d()},Wt=(P,I)=>{let H;for(;P!==I;)H=f(P),r(P),P=H;r(I)},jt=(P,I,H)=>{const{bum:V,scope:N,job:d,subTree:w,um:C,m:A,a:O}=P;Ns(A),Ns(O),V&&Mi(V),N.stop(),d&&(d.flags|=8,qe(w,P,I,H)),C&&Ze(C,I),Ze(()=>{P.isUnmounted=!0},I)},ot=(P,I,H,V=!1,N=!1,d=0)=>{for(let w=d;w<P.length;w++)qe(P[w],I,H,V,N)},tt=P=>{if(P.shapeFlag&6)return tt(P.component.subTree);if(P.shapeFlag&128)return P.suspense.next();const I=f(P.anchor||P.el),H=I&&I[Ya];return H?f(H):I};let Rt=!1;const Gt=(P,I,H)=>{let V;P==null?I._vnode&&(qe(I._vnode,null,null,!0),V=I._vnode.component):y(I._vnode||null,P,I,null,null,null,H),I._vnode=P,Rt||(Rt=!0,Ps(V),Wr(),Rt=!1)},at={p:y,um:qe,m:et,r:ge,mt:ce,mc:Y,pc:oe,pbc:fe,n:tt,o:t};return{render:Gt,hydrate:void 0,createApp:yl(Gt)}}function Cn({type:t,props:i},e){return e==="svg"&&t==="foreignObject"||e==="mathml"&&t==="annotation-xml"&&i&&i.encoding&&i.encoding.includes("html")?void 0:e}function Ft({effect:t,job:i},e){e?(t.flags|=32,i.flags|=4):(t.flags&=-33,i.flags&=-5)}function Fl(t,i){return(!t||t&&!t.pendingBranch)&&i&&!i.persisted}function mo(t,i,e=!1){const n=t.children,r=i.children;if(ue(n)&&ue(r))for(let s=0;s<n.length;s++){const o=n[s];let l=r[s];l.shapeFlag&1&&!l.dynamicChildren&&((l.patchFlag<=0||l.patchFlag===32)&&(l=r[s]=yt(r[s]),l.el=o.el),!e&&l.patchFlag!==-2&&mo(o,l)),l.type===gn&&(l.patchFlag===-1&&(l=r[s]=yt(l)),l.el=o.el),l.type===pt&&!l.el&&(l.el=o.el)}}function Ll(t){const i=t.slice(),e=[0];let n,r,s,o,l;const a=t.length;for(n=0;n<a;n++){const u=t[n];if(u!==0){if(r=e[e.length-1],t[r]<u){i[n]=r,e.push(n);continue}for(s=0,o=e.length-1;s<o;)l=s+o>>1,t[e[l]]<u?s=l+1:o=l;u<t[e[s]]&&(s>0&&(i[n]=e[s-1]),e[s]=n)}}for(s=e.length,o=e[s-1];s-- >0;)e[s]=o,o=i[o];return e}function vo(t){const i=t.subTree.component;if(i)return i.asyncDep&&!i.asyncResolved?i:vo(i)}function Ns(t){if(t)for(let i=0;i<t.length;i++)t[i].flags|=8}function yo(t){if(t.placeholder)return t.placeholder;const i=t.component;return i?yo(i.subTree):null}const wo=t=>t.__isSuspense;function kl(t,i){i&&i.pendingBranch?ue(t)?i.effects.push(...t):i.effects.push(t):Ga(t)}const se=Symbol.for("v-fgt"),gn=Symbol.for("v-txt"),pt=Symbol.for("v-cmt"),Li=Symbol.for("v-stc"),Tt=[];let Xe=null;function S(t=!1){Tt.push(Xe=t?null:[])}function hs(){Tt.pop(),Xe=Tt[Tt.length-1]||null}let wi=1;function Zi(t,i=!1){wi+=t,t<0&&Xe&&i&&(Xe.hasOnce=!0)}function _o(t){return t.dynamicChildren=wi>0?Xe||Yt:null,hs(),wi>0&&Xe&&Xe.push(t),t}function D(t,i,e,n,r,s){return _o(R(t,i,e,n,r,s,!0))}function le(t,i,e,n,r){return _o(ee(t,i,e,n,r,!0))}function _i(t){return t?t.__v_isVNode===!0:!1}function oi(t,i){return t.type===i.type&&t.key===i.key}const To=({key:t})=>t??null,ki=({ref:t,ref_key:i,ref_for:e})=>(typeof t=="number"&&(t=""+t),t!=null?Re(t)||Me(t)||he(t)?{i:ke,r:t,k:i,f:!!e}:t:null);function R(t,i=null,e=null,n=0,r=null,s=t===se?0:1,o=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:t,props:i,key:i&&To(i),ref:i&&ki(i),scopeId:Gr,slotScopeIds:null,children:e,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:n,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:ke};return l?(Ki(a,e),s&128&&t.normalize(a)):e&&(a.shapeFlag|=Re(e)?8:16),wi>0&&!o&&Xe&&(a.patchFlag>0||s&6)&&a.patchFlag!==32&&Xe.push(a),a}const ee=Hl;function Hl(t,i=null,e=null,n=0,r=null,s=!1){if((!t||t===$r)&&(t=pt),_i(t)){const l=ii(t,i,!0);return e&&Ki(l,e),wi>0&&!s&&Xe&&(l.shapeFlag&6?Xe[Xe.indexOf(t)]=l:Xe.push(l)),l.patchFlag=-2,l}if(Kl(t)&&(t=t.__vccOpts),i){i=Bl(i);let{class:l,style:a}=i;l&&!Re(l)&&(i.class=Pe(l)),Te(a)&&(un(a)&&!ue(a)&&(a=Ue({},a)),i.style=It(a))}const o=Re(t)?1:wo(t)?128:dn(t)?64:Te(t)?4:he(t)?2:0;return R(t,i,e,n,r,o,s,!0)}function Bl(t){return t?un(t)||uo(t)?Ue({},t):t:null}function ii(t,i,e=!1,n=!1){const{props:r,ref:s,patchFlag:o,children:l,transition:a}=t,u=i?zl(r||{},i):r,c={__v_isVNode:!0,__v_skip:!0,type:t.type,props:u,key:u&&To(u),ref:i&&i.ref?e&&s?ue(s)?s.concat(ki(i)):[s,ki(i)]:ki(i):s,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:l,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:i&&t.type!==se?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:a,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&ii(t.ssContent),ssFallback:t.ssFallback&&ii(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return a&&n&&os(c,a.clone(c)),c}function Ke(t=" ",i=0){return ee(gn,null,t,i)}function dy(t,i){const e=ee(Li,null,t);return e.staticCount=i,e}function Q(t="",i=!1){return i?(S(),le(pt,null,t)):ee(pt,null,t)}function ht(t){return t==null||typeof t=="boolean"?ee(pt):ue(t)?ee(se,null,t.slice()):_i(t)?yt(t):ee(gn,null,String(t))}function yt(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:ii(t)}function Ki(t,i){let e=0;const{shapeFlag:n}=t;if(i==null)i=null;else if(ue(i))e=16;else if(typeof i=="object")if(n&65){const r=i.default;r&&(r._c&&(r._d=!1),Ki(t,r()),r._c&&(r._d=!0));return}else{e=32;const r=i._;!r&&!uo(i)?i._ctx=ke:r===3&&ke&&(ke.slots._===1?i._=1:(i._=2,t.patchFlag|=1024))}else if(he(i)){if(n&65){Ki(t,{default:i});return}i={default:i,_ctx:ke},e=32}else i=String(i),n&64?(e=16,i=[Ke(i)]):e=8;t.children=i,t.shapeFlag|=e}function zl(...t){const i={};for(let e=0;e<t.length;e++){const n=t[e];for(const r in n)if(r==="class")i.class!==n.class&&(i.class=Pe([i.class,n.class]));else if(r==="style")i.style=It([i.style,n.style]);else if($i(r)){const s=i[r],o=n[r];o&&s!==o&&!(ue(s)&&s.includes(o))?i[r]=s?[].concat(s,o):o:o==null&&s==null&&!en(r)&&(i[r]=o)}else r!==""&&(i[r]=n[r])}return i}function lt(t,i,e,n=null){rt(t,i,7,[e,n])}const Nl=so();let Ul=0;function Vl(t,i,e){const n=t.type,r=(i?i.appContext:t.appContext)||Nl,s={uid:Ul++,vnode:t,type:n,parent:i,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new ca(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:i?i.provides:Object.create(r.provides),ids:i?i.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:ho(n,r),emitsOptions:ro(n,r),emit:null,emitted:null,propsDefaults:xe,inheritAttrs:n.inheritAttrs,ctx:xe,data:xe,props:xe,attrs:xe,slots:xe,refs:xe,setupState:xe,setupContext:null,suspense:e,suspenseId:e?e.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return s.ctx={_:s},s.root=i?i.root:s,s.emit=_l.bind(null,s),t.ce&&t.ce(s),s}let Ne=null;const Ci=()=>Ne||ke;let Xi,Ti;{const t=rn(),i=(e,n)=>{let r;return(r=t[e])||(r=t[e]=[]),r.push(n),s=>{r.length>1?r.forEach(o=>o(s)):r[0](s)}};Xi=i("__VUE_INSTANCE_SETTERS__",e=>Ne=e),Ti=i("__VUE_SSR_SETTERS__",e=>xi=e)}const Pi=t=>{const i=Ne;return Xi(t),t.scope.on(),()=>{t.scope.off(),Xi(i)}},Us=()=>{Ne&&Ne.scope.off(),Xi(null)};function xo(t){return t.vnode.shapeFlag&4}let xi=!1;function Wl(t,i=!1,e=!1){i&&Ti(i);const{props:n,children:r}=t.vnode,s=xo(t);Cl(t,n,s,i),Il(t,r,e||i);const o=s?jl(t,i):void 0;return i&&Ti(!1),o}function jl(t,i){const e=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,hl);const{setup:n}=e;if(n){xt();const r=t.setupContext=n.length>1?ql(t):null,s=Pi(t),o=Si(n,t,0,[t.props,r]),l=vr(o);if(bt(),s(),(l||t.sp)&&!$t(t)&&Kr(t),l){if(o.then(Us,Us),i)return o.then(a=>{Ti(!0);try{Vs(t,a,i)}finally{Ti(!1)}}).catch(a=>{hn(a,t,0)});t.asyncDep=o}else Vs(t,o)}else bo(t)}function Vs(t,i,e){he(i)?t.type.__ssrInlineRender?t.ssrRender=i:t.render=i:Te(i)&&(t.setupState=Nr(i)),bo(t)}function bo(t,i,e){const n=t.type;t.render||(t.render=n.render||ft);{const r=Pi(t);xt();try{dl(t)}finally{bt(),r()}}}const Gl={get(t,i){return ze(t,"get",""),t[i]}};function ql(t){const i=e=>{t.exposed=e||{}};return{attrs:new Proxy(t.attrs,Gl),slots:t.slots,emit:t.emit,expose:i}}function mn(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(Nr(de(t.exposed)),{get(i,e){if(e in i)return i[e];if(e in pi)return pi[e](t)},has(i,e){return e in i||e in pi}})):t.proxy}function Zl(t,i=!0){return he(t)?t.displayName||t.name:t.name||i&&t.__name}function Kl(t){return he(t)&&"__vccOpts"in t}const Le=(t,i)=>Na(t,i,xi);function Xl(t,i,e){try{Zi(-1);const n=arguments.length;return n===2?Te(i)&&!ue(i)?_i(i)?ee(t,null,[i]):ee(t,i):ee(t,null,i):(n>3?e=Array.prototype.slice.call(arguments,2):n===3&&_i(e)&&(e=[e]),ee(t,i,e))}finally{Zi(1)}}const Yl="3.5.41";/**
* @vue/runtime-dom v3.5.41
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/let Wn;const Ws=typeof window<"u"&&window.trustedTypes;if(Ws)try{Wn=Ws.createPolicy("vue",{createHTML:t=>t})}catch{}const Eo=Wn?t=>Wn.createHTML(t):t=>t,Jl="http://www.w3.org/2000/svg",Ql="http://www.w3.org/1998/Math/MathML",vt=typeof document<"u"?document:null,js=vt&&vt.createElement("template"),$l={insert:(t,i,e)=>{i.insertBefore(t,e||null)},remove:t=>{const i=t.parentNode;i&&i.removeChild(t)},createElement:(t,i,e,n)=>{const r=i==="svg"?vt.createElementNS(Jl,t):i==="mathml"?vt.createElementNS(Ql,t):e?vt.createElement(t,{is:e}):vt.createElement(t);return t==="select"&&n&&n.multiple!=null&&r.setAttribute("multiple",n.multiple),r},createText:t=>vt.createTextNode(t),createComment:t=>vt.createComment(t),setText:(t,i)=>{t.nodeValue=i},setElementText:(t,i)=>{t.textContent=i},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>vt.querySelector(t),setScopeId(t,i){t.setAttribute(i,"")},insertStaticContent(t,i,e,n,r,s){const o=e?e.previousSibling:i.lastChild;if(r&&(r===s||r.nextSibling))for(;i.insertBefore(r.cloneNode(!0),e),!(r===s||!(r=r.nextSibling)););else{js.innerHTML=Eo(n==="svg"?`<svg>${t}</svg>`:n==="mathml"?`<math>${t}</math>`:t);const l=js.content;if(n==="svg"||n==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}i.insertBefore(l,e)}return[o?o.nextSibling:i.firstChild,e?e.previousSibling:i.lastChild]}},eu=Symbol("_vtc");function tu(t,i,e){const n=t[eu];n&&(i=(i?[i,...n]:[...n]).join(" ")),i==null?t.removeAttribute("class"):e?t.setAttribute("class",i):t.className=i}const Yi=Symbol("_vod"),So=Symbol("_vsh"),Qe={name:"show",beforeMount(t,{value:i},{transition:e}){t[Yi]=t.style.display==="none"?"":t.style.display,e&&i?e.beforeEnter(t):ai(t,i)},mounted(t,{value:i},{transition:e}){e&&i&&e.enter(t)},updated(t,{value:i,oldValue:e},{transition:n}){!i!=!e&&(n?i?(n.beforeEnter(t),ai(t,!0),n.enter(t)):n.leave(t,()=>{ai(t,!1)}):ai(t,i))},beforeUnmount(t,{value:i}){ai(t,i)}};function ai(t,i){t.style.display=i?t[Yi]:"none",t[So]=!i}const iu=Symbol(""),nu=/(?:^|;)\s*display\s*:/;function su(t,i,e){const n=t.style,r=Re(e);let s=!1;if(e&&!r){if(i)if(Re(i))for(const o of i.split(";")){const l=o.slice(0,o.indexOf(":")).trim();e[l]==null&&ui(n,l,"")}else for(const o in i)e[o]==null&&ui(n,o,"");for(const o in e){o==="display"&&(s=!0);const l=e[o];l!=null?ou(t,o,!Re(i)&&i?i[o]:void 0,l)||ui(n,o,l):ui(n,o,"")}}else if(r){if(i!==e){const o=n[iu];o&&(e+=";"+o),n.cssText=e,s=nu.test(e)}}else i&&t.removeAttribute("style");Yi in t&&(t[Yi]=s?n.display:"",t[So]&&(n.display="none"))}const Gs=/\s*!important$/;function ui(t,i,e){if(ue(e))e.forEach(n=>ui(t,i,n));else if(e==null&&(e=""),i.startsWith("--"))t.setProperty(i,e);else{const n=ru(t,i);Gs.test(e)?t.setProperty(At(n),e.replace(Gs,""),"important"):t[n]=e}}const qs=["Webkit","Moz","ms"],Pn={};function ru(t,i){const e=Pn[i];if(e)return e;let n=Ge(i);if(n!=="filter"&&n in t)return Pn[i]=n;n=sn(n);for(let r=0;r<qs.length;r++){const s=qs[r]+n;if(s in t)return Pn[i]=s}return i}function ou(t,i,e,n){return t.tagName==="TEXTAREA"&&(i==="width"||i==="height")&&Re(n)&&e===n}const Zs="http://www.w3.org/1999/xlink";function Ks(t,i,e,n,r,s=la(i)){n&&i.startsWith("xlink:")?e==null?t.removeAttributeNS(Zs,i.slice(6,i.length)):t.setAttributeNS(Zs,i,e):e==null||s&&!Tr(e)?t.removeAttribute(i):t.setAttribute(i,s?"":Je(e)?String(e):e)}function Xs(t,i,e,n,r){if(i==="innerHTML"||i==="textContent"){e!=null&&(t[i]=i==="innerHTML"?Eo(e):e);return}const s=t.tagName;if(i==="value"&&s!=="PROGRESS"&&!s.includes("-")){const l=s==="OPTION"?t.getAttribute("value")||"":t.value,a=e==null?t.type==="checkbox"?"on":"":String(e);(l!==a||!("_value"in t))&&(t.value=a),e==null&&t.removeAttribute(i),t._value=e;return}let o=!1;if(e===""||e==null){const l=typeof t[i];l==="boolean"?e=Tr(e):e==null&&l==="string"?(e="",o=!0):l==="number"&&(e=0,o=!0)}try{t[i]=e}catch{}o&&t.removeAttribute(r||i)}function Xt(t,i,e,n){t.addEventListener(i,e,n)}function au(t,i,e,n){t.removeEventListener(i,e,n)}const Ys=Symbol("_vei");function lu(t,i,e,n,r=null){const s=t[Ys]||(t[Ys]={}),o=s[i];if(n&&o)o.value=n;else{const[l,a]=hu(i);if(n){const u=s[i]=pu(n,r);Xt(t,l,u,a)}else o&&(au(t,l,o,a),s[i]=void 0)}}const uu=/(Once|Passive|Capture)$/,cu=/^on:?(?:Once|Passive|Capture)$/;function hu(t){let i,e;for(;(e=t.match(uu))&&!cu.test(t);)i||(i={}),t=t.slice(0,t.length-e[1].length),i[e[1].toLowerCase()]=!0;return[t[2]===":"?t.slice(3):At(t.slice(2)),i]}let Rn=0;const du=Promise.resolve(),fu=()=>Rn||(du.then(()=>Rn=0),Rn=Date.now());function pu(t,i){const e=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=e.attached)return;const r=e.value;if(ue(r)){const s=n.stopImmediatePropagation;n.stopImmediatePropagation=()=>{s.call(n),n._stopped=!0};const o=r.slice(),l=[n];for(let a=0;a<o.length&&!n._stopped;a++){const u=o[a];u&&rt(u,i,5,l)}}else rt(r,i,5,[n])};return e.value=t,e.attached=fu(),e}const Js=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,gu=(t,i,e,n,r,s)=>{const o=r==="svg";i==="class"?tu(t,n,o):i==="style"?su(t,e,n):$i(i)?en(i)||lu(t,i,e,n,s):(i[0]==="."?(i=i.slice(1),!0):i[0]==="^"?(i=i.slice(1),!1):mu(t,i,n,o))?(Xs(t,i,n),!t.tagName.includes("-")&&(i==="value"||i==="checked"||i==="selected")&&Ks(t,i,n,o,s,i!=="value")):t._isVueCE&&(vu(t,i)||t._def.__asyncLoader&&(/[A-Z]/.test(i)||!Re(n)))?Xs(t,Ge(i),n,s,i):(i==="true-value"?t._trueValue=n:i==="false-value"&&(t._falseValue=n),Ks(t,i,n,o))};function mu(t,i,e,n){if(n)return!!(i==="innerHTML"||i==="textContent"||i in t&&Js(i)&&he(e));if(i==="spellcheck"||i==="draggable"||i==="translate"||i==="autocorrect"||i==="sandbox"&&t.tagName==="IFRAME"||i==="form"||i==="list"&&t.tagName==="INPUT"||i==="type"&&t.tagName==="TEXTAREA")return!1;if(i==="width"||i==="height"){const r=t.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return Js(i)&&Re(e)?!1:i in t}function vu(t,i){const e=t._def.props;if(!e)return!1;const n=Ge(i);return Array.isArray(e)?e.some(r=>Ge(r)===n):Object.keys(e).some(r=>Ge(r)===n)}const Qs=t=>{const i=t.props["onUpdate:modelValue"]||!1;return ue(i)?e=>Mi(i,e):i};function yu(t){t.target.composing=!0}function $s(t){const i=t.target;i.composing&&(i.composing=!1,i.dispatchEvent(new Event("input")))}const Ai=Symbol("_assign"),Oi=Symbol("_initialValue");function Dn(t,i,e){return i&&(t=t.trim()),e&&(t=Yn(t)),t}const Ji={created(t,{modifiers:{lazy:i,trim:e,number:n}},r){t.parentNode&&(t.type==="text"?t[Oi]=t.defaultValue.replace(/[\r\n]/g,""):t.type==="textarea"&&(t[Oi]=t.defaultValue.replace(/\r\n?/g,`
`))),t[Ai]=Qs(r);const s=n||r.props&&r.props.type==="number";Xt(t,i?"change":"input",o=>{o.target.composing||t[Ai](Dn(t.value,e,s))}),(e||s)&&Xt(t,"change",()=>{t.value=Dn(t.value,e,s)}),i||(Xt(t,"compositionstart",yu),Xt(t,"compositionend",$s),Xt(t,"change",$s))},mounted(t,{value:i,modifiers:{trim:e,number:n}}){const r=i??"",s=t[Oi];delete t[Oi],s!==void 0&&(t.type==="text"||t.type==="textarea")&&t.value!==s?t[Ai](Dn(t.value,e,n)):t.value=r},beforeUpdate(t,{value:i,oldValue:e,modifiers:{lazy:n,trim:r,number:s}},o){if(t[Ai]=Qs(o),t.composing)return;const l=(s||t.type==="number")&&!/^0\d/.test(t.value)?Yn(t.value):t.value,a=i??"";if(l===a)return;const u=t.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===t&&t.type!=="range"&&(n&&i===e||r&&t.value.trim()===a)||(t.value=a)}},wu=["ctrl","shift","alt","meta"],_u={stop:t=>t.stopPropagation(),prevent:t=>t.preventDefault(),self:t=>t.target!==t.currentTarget,ctrl:t=>!t.ctrlKey,shift:t=>!t.shiftKey,alt:t=>!t.altKey,meta:t=>!t.metaKey,left:t=>"button"in t&&t.button!==0,middle:t=>"button"in t&&t.button!==1,right:t=>"button"in t&&t.button!==2,exact:(t,i)=>wu.some(e=>t[`${e}Key`]&&!i.includes(e))},Vt=(t,i)=>{if(!t)return t;const e=t._withMods||(t._withMods={}),n=i.join(".");return e[n]||(e[n]=(r,...s)=>{for(let o=0;o<i.length;o++){const l=_u[i[o]];if(l&&l(r,i))return}return t(r,...s)})},Tu={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Ht=(t,i)=>{const e=t._withKeys||(t._withKeys={}),n=i.join(".");return e[n]||(e[n]=r=>{if(!("key"in r))return;const s=At(r.key);if(i.some(o=>o===s||Tu[o]===s))return t(r)})},xu=Ue({patchProp:gu},$l);let er;function bu(){return er||(er=Ol(xu))}const Eu=(...t)=>{const i=bu().createApp(...t),{mount:e}=i;return i.mount=n=>{const r=Cu(n);if(!r)return;const s=i._component;!he(s)&&!s.render&&!s.template&&(s.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const o=e(r,!1,Su(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},i};function Su(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Cu(t){return Re(t)?document.querySelector(t):t}const Pu={viewBox:"0 0 24 24",class:"tify-icon -close","aria-hidden":"true"};function Ru(t,i){return S(),D("svg",Pu,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z"},null,-1)])])}const Co=de({name:"mdi-Close",render:Ru}),Ie=(t,i)=>{const e=t.__vccOpts||t;for(const[n,r]of i)e[n]=r;return e};var Du={blobBaseUrl:"https://github.com/tify-iiif-viewer/tify/blob/v0.36.2",bugsUrl:"https://github.com/tify-iiif-viewer/tify/issues",license:"AGPL-3.0",repositoryUrl:"https://github.com/tify-iiif-viewer/tify",version:"0.36.2"};const Iu={computed:{env:()=>Du}},Au={class:"tify-help",tabindex:"0"},Ou={class:"tify-sr-only"},Mu=["innerHTML"],Fu={class:"tify-list"},Lu=["href"],ku=["href"],Hu=["href"],Bu={class:"tify-help-footer"},zu=["innerHTML"];function Nu(t,i,e,n,r,s){return S(),D("section",Au,[R("h2",Ou,z(t.$translate("Help")),1),R("h3",null,z(t.$translate("About TIFY")),1),R("p",{innerHTML:t.$translate("$info")},null,8,Mu),R("ul",Fu,[R("li",null,[R("a",{href:`${s.env.blobBaseUrl}/doc/index.md`,rel:"noopener noreferrer",target:"_blank"},z(t.$translate("Documentation")),9,Lu)]),R("li",null,[R("a",{href:s.env.bugsUrl,rel:"noopener noreferrer",target:"_blank"},z(t.$translate("Report a bug")),9,ku)]),R("li",null,[R("a",{href:s.env.repositoryUrl,rel:"noopener noreferrer",target:"_blank"},z(t.$translate("Source code")),9,Hu)])]),R("footer",Bu,[R("p",{innerHTML:t.$translate("$copyright")},null,8,zu),R("p",null,[Ke(z(t.$translate("Version"))+" ",1),R("b",null,z(s.env.version),1)])])])}const Uu=Ie(Iu,[["render",Nu]]),Vu={viewBox:"0 0 24 24",class:"tify-icon -plus","aria-hidden":"true"};function Wu(t,i){return S(),D("svg",Vu,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"},null,-1)])])}const ds=de({name:"mdi-Plus",render:Wu}),ju={viewBox:"0 0 24 24",class:"tify-icon -minus","aria-hidden":"true"};function Gu(t,i){return S(),D("svg",ju,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M19 13H5v-2h14z"},null,-1)])])}const fs=de({name:"mdi-Minus",render:Gu}),qu={name:"CollectionNode",props:{item:{type:Object,default:()=>{}}},data(){return{children:null,expanded:!1}},computed:{id(){return this.$getId(ji())}},methods:{toggleChildren(){if(this.expanded){this.expanded=!1;return}if(this.children){this.expanded=!0;return}if(this.item.children){this.children=this.item.children,this.expanded=!0;return}this.$store.fetchJson(this.item["@id"]||this.item.id).then(t=>{this.children=t.collections||t.items||t.manifests||[],this.expanded=!0},t=>{const i=t.response&&(t.response.statusText||t.response.data)||t.message;this.$store.addError(`Error loading IIIF manifest: ${i}`),this.children=!1})}}},Zu=["aria-controls","aria-expanded","aria-label"],Ku=["id"],Xu=["id"];function Yu(t,i,e,n,r,s){const o=fs,l=ds,a=Qr("CollectionNode",!0);return S(),D("li",{class:Pe(["tify-collection-item",{"-current":t.$store.manifest&&t.$store.manifest.id===(e.item["@id"]||e.item.id)}])},[e.item.type==="Collection"?(S(),D("button",{key:0,type:"button",class:"tify-collection-link -has-children","aria-controls":s.id,"aria-expanded":r.expanded,"aria-label":t.$translate(r.expanded?"Collapse":"Expand"),onClick:i[0]||(i[0]=u=>s.toggleChildren())},[r.expanded?(S(),le(o,{key:0})):(S(),le(l,{key:1})),Ke(" "+z(t.$store.localize(e.item.label)),1)],8,Zu)):(S(),D("a",{key:1,href:"javascript:;",class:"tify-collection-link",onClick:i[1]||(i[1]=u=>t.$store.loadManifest(e.item["@id"]||e.item.id,{expectedType:e.item.type,reset:!0}))},z(t.$store.localize(e.item.label)),1)),r.children!==!1?Be((S(),D("ol",{key:2,id:s.id,class:"tify-collection-list"},[(S(!0),D(se,null,Ee(r.children,u=>(S(),le(a,{key:u.id,item:u},null,8,["item"]))),128))],8,Ku)),[[Qe,r.expanded]]):Be((S(),D("p",{key:3,id:s.id,class:"tify-collection-error"},z(t.$translate("Could not load child manifest")),9,Xu)),[[Qe,r.expanded]])],2)}const Ju=Ie(qu,[["render",Yu]]),Qu={data(){return{filter:""}},computed:{filteredItems(){const t=this.filter.trim().toLowerCase().split(/\s+/);return this.$store.collection.items.filter(i=>{const e=this.$store.localize(i.label).toLowerCase();return t.every(n=>e.includes(n))})}}},$u={class:"tify-collection",tabindex:"0"},ec={class:"tify-collection-header"},tc={class:"tify-sr-only"},ic={key:0,class:"tify-collection-controls"},nc=["aria-label","placeholder"],sc=["disabled"],rc={key:0,class:"tify-collection-list"},oc={key:1,class:"tify-collection-no-results"};function ac(t,i,e,n,r,s){const o=Ju;return S(),D("section",$u,[R("header",ec,[R("h2",tc,z(t.$translate("Collection")),1),t.$store.collection.items.length>5?(S(),D("div",ic,[Be(R("input",{"onUpdate:modelValue":i[0]||(i[0]=l=>r.filter=l),"aria-label":t.$translate("Filter collection"),class:"tify-collection-filter",placeholder:t.$translate("Filter collection"),type:"text",onKeydown:[i[1]||(i[1]=Ht(Vt(l=>r.filter?r.filter="":l.target.blur(),["prevent"]),["esc"])),i[2]||(i[2]=Vt(()=>{},["stop"]))]},null,40,nc),[[Ji,r.filter]]),R("button",{type:"button",class:"tify-collection-reset",disabled:!r.filter,onClick:i[3]||(i[3]=l=>r.filter="")},z(t.$translate("Reset")),9,sc)])):Q("",!0)]),s.filteredItems.length?(S(),D("ol",rc,[(S(!0),D(se,null,Ee(s.filteredItems,l=>(S(),le(o,{key:l.id,item:l},null,8,["item"]))),128))])):(S(),D("p",oc,z(t.$translate("No results")),1))])}const lc=Ie(Qu,[["render",ac]]);function Po(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Hi={exports:{}},uc=Hi.exports,tr;function cc(){return tr||(tr=1,function(t){(function(i){if(typeof e!="function"){var e=function(v){return v};e.nonNative=!0}const n=e("plaintext"),r=e("html"),s=e("comment"),o=/<(\w*)>/g,l=/<\/?([^\s\/>]+)/;function a(v,y,T){v=v||"",y=y||[],T=T||"";let x=c(y,T);return h(v,x)}function u(v,y){v=v||[],y=y||"";let T=c(v,y);return function(E){return h(E||"",T)}}a.init_streaming_mode=u;function c(v,y){return v=f(v),{allowable_tags:v,tag_replacement:y,state:n,tag_buffer:"",depth:0,in_quote_char:""}}function h(v,y){if(typeof v!="string")throw new TypeError("'html' parameter must be a string");let T=y.allowable_tags,x=y.tag_replacement,E=y.state,M=y.tag_buffer,L=y.depth,U=y.in_quote_char,K="";for(let q=0,Y=v.length;q<Y;q++){let te=v[q];if(E===n)switch(te){case"<":E=r,M+=te;break;default:K+=te;break}else if(E===r)switch(te){case"<":if(U)break;L++;break;case">":if(U)break;if(L){L--;break}U="",E=n,M+=">",T.has(m(M))?K+=M:K+=x,M="";break;case'"':case"'":te===U?U="":U=U||te,M+=te;break;case"-":M==="<!-"&&(E=s),M+=te;break;case" ":case`
`:if(M==="<"){E=n,K+="< ",M="";break}M+=te;break;default:M+=te;break}else if(E===s)switch(te){case">":M.slice(-2)=="--"&&(E=n),M="";break;default:M+=te;break}}return y.state=E,y.tag_buffer=M,y.depth=L,y.in_quote_char=U,K}function f(v){let y=new Set;if(typeof v=="string"){let T;for(;T=o.exec(v);)y.add(T[1])}else!e.nonNative&&typeof v[e.iterator]=="function"?y=new Set(v):typeof v.forEach=="function"&&v.forEach(y.add,y);return y}function m(v){let y=l.exec(v);return y?y[1].toLowerCase():null}t.exports?t.exports=a:i.striptags=a})(uc)}(Hi)),Hi.exports}var hc=cc();const Ro=Po(hc),dc={props:{number:{type:Number,required:!0},wrap:{type:Boolean,default:!1}},computed:{label(){return Ro(this.$store.localize(this.$store.manifest.items[this.number-1].label))||this.$translate("$n/a")},html(){return`<span>${this.$store.options.pageLabelFormat}</span>`.replace("P",`${this.number}`).replace("T",`${this.$store.pageCount}`).replace("L",`</span>${this.label}<span>`).replace("<span></span>","")}}},fc=["innerHTML"];function pc(t,i,e,n,r,s){return S(),D("span",{class:Pe(["tify-page-name",{"-wrap":e.wrap}]),innerHTML:s.html},null,10,fc)}const ni=Ie(dc,[["render",pc]]),gc={viewBox:"0 0 24 24",class:"tify-icon -chevron-up","aria-hidden":"true"};function mc(t,i){return S(),D("svg",gc,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6l-6 6z"},null,-1)])])}const Do=de({name:"mdi-ChevronUp",render:mc}),vc={viewBox:"0 0 24 24",class:"tify-icon -chevron-down","aria-hidden":"true"};function yc(t,i){return S(),D("svg",vc,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6z"},null,-1)])])}const Io=de({name:"mdi-ChevronDown",render:yc});function vn(t){const i=["a","b","br","i","img","p","span"],e={a:["href"],img:["alt","src"]};let n=Ro(t,i);const r=/<(\w+)((\s+.+?(\s*=\s*(?:".*?"|'.*?'|.*?|[\^'">\s]+))?)+\s*|\s*)>/g;return n=n.replace(r,(s,o,l)=>{if(!l)return`<${o}>`;const a=/(?:([^\s"'=]+)(?:=(?:"(.*?)"|'(.*?)'|([^\s>]+)))?)/g,u=[];return l.replace(a,(c,h)=>{var f;(f=e[o])!=null&&f.includes(h)&&u.push(c)}),u.length>0?`<${o} ${u.join(" ")}>`:`<${o}>`}),n}function ir(t,i){if(!(t instanceof Array)||!i||new Set(t).size!==t.length)return!1;for(let e=0,n=t.length;e<n;e+=1)if(!Number.isInteger(t[e])||e>0&&t[e]>0&&t[e]<=t[e-1]||t[e]<-1||t[e]>i)return!1;return!0}function ps(t,i=["https:","http:"]){let e;try{e=new URL(t)}catch{return!1}return i.includes(e.protocol)}const wc={props:{metadata:{type:Array,default:()=>[]}},data(){return{infoItems:[]}},watch:{metadata(){this.init()},"$store.options.view":{handler(t){t==="info"&&this.init()},immediate:!0}},methods:{init(){this.$nextTick(()=>{var t;(t=this.$refs.contents)==null||t.forEach((i,e)=>{const n=i.offsetHeight;this.infoItems[e]={collapsed:!0,exceedsHeight:!0},this.$nextTick(()=>{const r=i.offsetHeight,s=n>=r;this.infoItems[e]={collapsed:s,exceedsHeight:s}})})})},filterHtml:vn,isValidUrl:ps}},_c={class:"tify-info-metadata"},Tc={key:0},xc={class:"tify-info-value"},bc=["href"],Ec=["innerHTML"],Sc=["onClick"];function Cc(t,i,e,n,r,s){const o=Io,l=Do;return S(),D("div",_c,[(S(!0),D(se,null,Ee(e.metadata,(a,u)=>(S(),D("div",{key:u},[a.label?(S(),D("h4",Tc,z(t.$store.localize(a.label)),1)):Q("",!0),R("div",{ref_for:!0,ref:"contents",class:Pe(["tify-info-content",{"-collapsed":r.infoItems[u]&&r.infoItems[u].collapsed}])},[R("div",xc,[s.isValidUrl(a.value)?(S(),D("p",{key:`url-${u}`},[R("a",{href:a.value},z(a.value),9,bc)])):(S(),D("div",{key:`html-${u}`,innerHTML:s.filterHtml(t.$store.localize(a.value))||t.$translate("$n/a")},null,8,Ec))]),r.infoItems[u]&&r.infoItems[u].exceedsHeight?(S(),D("button",{key:0,type:"button",class:"tify-info-toggle",onClick:c=>r.infoItems[u].collapsed=!r.infoItems[u].collapsed},[r.infoItems[u].collapsed?(S(),D(se,{key:0},[ee(o),Ke(" "+z(t.$translate("Expand")),1)],64)):(S(),D(se,{key:1},[ee(l),Ke(" "+z(t.$translate("Collapse")),1)],64))],8,Sc)):Q("",!0)],2)]))),128))])}const Pc=Ie(wc,[["render",Cc]]);function Rc(t,i){try{return new Date(t).toLocaleDateString(i,{month:"long",day:"numeric",year:"numeric"})}catch{return t}}const Dc={data(){return{collectionDataShown:!1}},computed:{hasProvider(){var t;return(t=this.manifestOrCollection.provider)==null?void 0:t.some(i=>{var e;return this.$store.localize(i.label)||((e=i.homepage)==null?void 0:e.length)})},homepages(){return[].concat(this.manifestOrCollection.homepage||[])},logos(){var i;let t=[].concat(this.manifestOrCollection.logo||[]);return(i=this.manifestOrCollection.provider)==null||i.forEach(e=>{e.logo&&(t=t.concat(e.logo))}),t=[...new Map(t.map(e=>[e.id,e])).values()],t=t.map(e=>{var n,r,s,o;return{id:e.id,link:((r=(n=e.service)==null?void 0:n[0])==null?void 0:r.id)||((o=(s=e.service)==null?void 0:s[0])==null?void 0:o["@id"])}}),t},manifestOrCollection(){return this.collectionDataShown?this.$store.collection:this.$store.manifest||this.$store.collection||{}},pages(){return this.$store.options.pages.filter(t=>t>0).map(t=>{var n,r;const i={page:t,media:[]},e=(r=(n=this.$store.manifest.items[t-1].items)==null?void 0:n[0])==null?void 0:r.items;return e==null||e.forEach(s=>{var l;const o=((l=s.body)==null?void 0:l.items)||[s.body];i.media.push(...o.filter(a=>a.label).map(a=>({label:a.label})))}),i})}},methods:{filterHtml:vn,formatDate:Rc,isValidUrl:ps}},Ic={class:"tify-info",tabindex:"0"},Ac={class:"tify-sr-only"},Oc={key:0,class:"tify-info-header"},Mc=["aria-pressed"],Fc=["aria-pressed"],Lc={key:1,class:"tify-info-section -title"},kc={key:2,class:"tify-info-section -time"},Hc={key:3,class:"tify-info-section -place"},Bc={key:4,class:"tify-info-section -metadata"},zc={key:5,class:"tify-info-section -description"},Nc={key:6,class:"tify-info-section -metadata -structure"},Uc={key:0,class:"tify-info-structure"},Vc={key:7,class:"tify-info-section -pages"},Wc={class:"tify-info-pages"},jc={key:0,class:"tify-info-image-labels"},Gc={key:8,class:"tify-info-section -related"},qc={class:"tify-list"},Zc=["href"],Kc=["href"],Xc={key:9,class:"tify-info-section -license"},Yc=["href"],Jc={key:10,class:"tify-info-section -attribution"},Qc=["innerHTML"],$c={key:11,class:"tify-info-section -provider"},eh={key:0},th={key:1,class:"tify-list"},ih=["href"],nh={key:12,class:"tify-info-section -logo"},sh=["href"],rh=["src","alt"],oh=["src","alt"];function ah(t,i,e,n,r,s){var a,u,c,h;const o=Pc,l=ni;return S(),D("section",Ic,[R("h2",Ac,z(t.$translate("Info")),1),t.$store.collection&&t.$store.manifest?(S(),D("div",Oc,[R("button",{type:"button",class:"tify-info-button","aria-pressed":!r.collectionDataShown,onClick:i[0]||(i[0]=f=>r.collectionDataShown=!1)},z(t.$translate("Document")),9,Mc),R("button",{type:"button",class:"tify-info-button","aria-pressed":r.collectionDataShown,onClick:i[1]||(i[1]=f=>r.collectionDataShown=!0)},z(t.$translate("Collection")),9,Fc)])):Q("",!0),s.manifestOrCollection.label?(S(),D("div",Lc,[R("h3",null,z(t.$translate("Title")),1),R("p",null,z(t.$store.localize(s.manifestOrCollection.label)),1)])):Q("",!0),s.manifestOrCollection.navDate?(S(),D("div",kc,[R("h3",null,z(t.$translate("Date")),1),R("p",null,z(s.formatDate(s.manifestOrCollection.navDate,t.$store.options.language)),1)])):Q("",!0),s.manifestOrCollection.navPlace?(S(),D("div",Hc,[R("h3",null,z(t.$translate("Place")),1),(S(!0),D(se,null,Ee(s.manifestOrCollection.navPlace.features,f=>(S(),D("p",{key:f.id},z(t.$store.localize(f.properties.label)),1))),128))])):Q("",!0),s.manifestOrCollection.metadata&&s.manifestOrCollection.metadata.length?(S(),D("div",Bc,[R("h3",null,z(t.$translate("Metadata")),1),t.$store.options.view==="info"?(S(),le(o,{key:0,metadata:s.manifestOrCollection.metadata},null,8,["metadata"])):Q("",!0)])):Q("",!0),s.manifestOrCollection.summary?(S(),D("div",zc,[R("h3",null,z(t.$translate("Description")),1),t.$store.options.view==="info"?(S(),le(o,{key:0,metadata:[{value:s.manifestOrCollection.summary}]},null,8,["metadata"])):Q("",!0)])):Q("",!0),s.manifestOrCollection.structures&&((a=t.$store.currentStructure)!=null&&a.label||(u=t.$store.currentStructure)!=null&&u.metadata)?(S(),D("div",Nc,[R("h3",null,z(t.$translate("Current Section")),1),(c=t.$store.currentStructure)!=null&&c.label?(S(),D("p",Uc,z(t.$store.localize(t.$store.currentStructure.label)),1)):Q("",!0),t.$store.options.view==="info"&&((h=t.$store.currentStructure)!=null&&h.metadata)?(S(),le(o,{key:1,class:"tify-info-section -metadata",metadata:t.$store.currentStructure.metadata},null,8,["metadata"])):Q("",!0)])):Q("",!0),s.manifestOrCollection.type==="Manifest"?(S(),D("div",Vc,[R("h3",null,z(t.$translate(s.pages.length>1?"Current Pages":"Current Page")),1),R("ol",Wc,[(S(!0),D(se,null,Ee(s.pages,f=>(S(),D("li",{key:f},[ee(l,{number:f.page,wrap:""},null,8,["number"]),f.media.length?(S(),D("ul",jc,[(S(!0),D(se,null,Ee(f.media,(m,v)=>(S(),D("li",{key:v},z(t.$store.localize(m.label)),1))),128))])):Q("",!0),t.$store.manifest.items[f.page-1].metadata?(S(),le(o,{key:1,class:"tify-info-section -metadata",metadata:t.$store.manifest.items[f.page-1].metadata},null,8,["metadata"])):Q("",!0)]))),128))])])):Q("",!0),s.homepages.length?(S(),D("div",Gc,[R("h3",null,z(t.$translate("Related Resources")),1),R("ul",qc,[(S(!0),D(se,null,Ee(s.homepages,(f,m)=>(S(),D("li",{key:m},[typeof f=="string"?(S(),D("a",{key:0,href:f},z(f),9,Zc)):(S(),D("a",{key:1,href:f.id},z(f.label?t.$store.localize(f.label):f.id),9,Kc))]))),128))])])):Q("",!0),s.manifestOrCollection.rights?(S(),D("div",Xc,[R("h3",null,z(t.$translate("License")),1),R("p",null,[R("a",{href:s.manifestOrCollection.rights},z(s.manifestOrCollection.rights),9,Yc)])])):Q("",!0),s.manifestOrCollection.requiredStatement?(S(),D("div",Jc,[R("h3",null,z(t.$store.localize(s.manifestOrCollection.requiredStatement.label)),1),R("div",{innerHTML:s.filterHtml(t.$store.localize(s.manifestOrCollection.requiredStatement.value))},null,8,Qc)])):Q("",!0),s.hasProvider?(S(),D("div",$c,[R("h3",null,z(t.$translate("Provided by")),1),(S(!0),D(se,null,Ee(s.manifestOrCollection.provider,f=>{var m,v;return S(),D("div",{key:f.id},[f.label?(S(),D("p",eh,z(t.$store.localize(f.label)),1)):Q("",!0),(m=f.homepage)!=null&&m.length||(v=f.seeAlso)!=null&&v.length?(S(),D("ul",th,[(S(!0),D(se,null,Ee([...f.homepage||[],...f.seeAlso||[]],y=>(S(),D("li",{key:y.id},[R("a",{href:y.id},z(y.label?t.$store.localize(y.label):y.id),9,ih)]))),128))])):Q("",!0)])}),128))])):Q("",!0),s.logos.length?(S(),D("div",nh,[(S(!0),D(se,null,Ee(s.logos,(f,m)=>(S(),D("p",{key:m},[f.link?(S(),D("a",{key:0,href:f.link},[R("img",{class:"tify-info-logo",src:f.id,alt:t.$translate("Logo")},null,8,rh)],8,sh)):(S(),D("img",{key:1,class:"tify-info-logo",src:f.id,alt:t.$translate("Logo")},null,8,oh))]))),128))])):Q("",!0)])}const lh=Ie(Dc,[["render",ah]]),uh={name:"TocList",props:{level:{type:Number,default:0},structures:{type:Array,default:()=>[]},purpose:{type:String,default:""}},data(){var t;return{expandedStructures:this.level===0&&this.structures.length===1&&((t=this.structures[0].items)!=null&&t.some(i=>i.items))?[!0]:[]}},computed:{id(){return this.$getId(ji())}},methods:{getFirstPage(t){if(t.items)return this.getFirstPage(t.items[0]);const i=this.$store.manifest.items.findIndex(e=>e.id===t.id);return i<0?1:i+1},getFirstPageLabel(t){var e;const i=this.getFirstPage(t);return this.$store.localize((e=this.$store.manifest.items[i-1])==null?void 0:e.label)},getLastPage(t){if(t.items)return this.getLastPage(t.items.at(-1));const i=this.$store.manifest.items.findLastIndex(e=>e.id===t.id);return i<0?this.$store.manifest.items.length:i+1},isCurrentPageInStructure(t){if(this.$store.manifest.items.filter((r,s)=>this.$store.options.pages.includes(s+1)).map(r=>r.id).some(r=>{var s;return(s=t.items)==null?void 0:s.some(o=>o.id===r)}))return!0;const e=t.firstPage||this.getFirstPage(t),n=t.lastPage||this.getLastPage(t);return this.$store.options.pages.some(r=>r>=e&&r<=n)},setPage(t){this.$store.setPage(t),this.$store.isContainerWidthAtLeast("medium")||this.$store.updateOptions({view:null})},toggleAllChildren(t=null){if(this.$refs.children){for(let i=this.structures.length-1;i>=0;i-=1)this.toggleChildren(i,t);this.$refs.children.forEach(i=>{i.toggleAllChildren(t)})}},toggleChildren(t,i=null){var n;(n=this.structures[t].items)!=null&&n.some(r=>r.items)&&(this.expandedStructures[t]=i!==null?i:!this.expandedStructures[t])}}},ch={class:"tify-toc-list"},hh=["aria-controls","aria-expanded","aria-label","title","onClick"],dh=["href"],fh=["onClick"],ph={class:"tify-toc-label"},gh={class:"tify-toc-page"},mh=["onClick"],vh={class:"tify-toc-label"};function yh(t,i,e,n,r,s){const o=fs,l=ds,a=Qr("TocList",!0);return S(),D("ul",ch,[(S(!0),D(se,null,Ee(e.structures,(u,c)=>{var h,f;return S(),D("li",{key:c,class:Pe(["tify-toc-structure",{"-current":s.isCurrentPageInStructure(u),"-expanded":r.expandedStructures[c]}])},[(h=u.items)!=null&&h.some(m=>m.items)?(S(),D("button",{key:0,type:"button",class:"tify-toc-toggle","aria-controls":`${s.id}-${c}`,"aria-expanded":!!r.expandedStructures[c],"aria-label":t.$translate(r.expandedStructures[c]?"Collapse":"Expand"),title:t.$translate(r.expandedStructures[c]?"Collapse":"Expand"),onClick:m=>s.toggleChildren(c)},[r.expandedStructures[c]?(S(),le(o,{key:0})):(S(),le(l,{key:1}))],8,hh)):Q("",!0),e.purpose==="pdf"?(S(),D("a",{key:1,class:"tify-toc-link",href:u.rendering[0].id,download:""},z(t.$store.localize(u.label))+" ("+z(u.items.length)+" "+z(t.$translate(u.items.length===1?"page":"pages"))+") ",9,dh)):u.label&&t.$store.localize(u.label)!==s.getFirstPageLabel(u)?(S(),D("a",{key:2,class:"tify-toc-link -dots",href:"javascript:;",onClick:m=>s.setPage(u.firstPage||s.getFirstPage(u))},[R("span",ph,z(t.$store.localize(u.label)),1),R("span",gh,z(s.getFirstPageLabel(u)||"—"),1)],8,fh)):(S(),D("a",{key:3,class:"tify-toc-link",href:"javascript:;",onClick:m=>s.setPage(u.firstPage||s.getFirstPage(u))},[R("span",vh,z(t.$store.localize(u.label,"string")||s.getFirstPageLabel(u)||t.$translate("$n/a")),1)],8,mh)),(f=u.items)!=null&&f.some(m=>m.items)?Be((S(),le(a,{key:4,id:`${s.id}-${c}`,ref_for:!0,ref:"children",level:e.level+1,purpose:e.purpose,structures:u.items},null,8,["id","level","purpose","structures"])),[[Qe,r.expandedStructures[c]]]):Q("",!0)],2)}),128))])}const Ao=Ie(uh,[["render",yh]]),wh={viewBox:"0 0 24 24",class:"tify-icon -filmstrip","aria-hidden":"true"};function _h(t,i){return S(),D("svg",wh,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M18 9h-2V7h2m0 6h-2v-2h2m0 6h-2v-2h2M8 9H6V7h2m0 6H6v-2h2m0 6H6v-2h2M18 3v2h-2V3H8v2H6V3H4v18h2v-2h2v2h8v-2h2v2h2V3z"},null,-1)])])}const Th=de({name:"mdi-Filmstrip",render:_h}),xh={viewBox:"0 0 24 24",class:"tify-icon -waveform","aria-hidden":"true"};function bh(t,i){return S(),D("svg",xh,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"m22 12l-2 1l-1 1l-1-1l-1 3l-1-3l-1 8l-1-8l-1 2l-1-2l-1 4l-1-4l-1 9l-1-9l-1 6l-1-6l-1 1l-1-1l-2-1l2-1l1-1l1 1l1-6l1 6l1-9l1 9l1-4l1 4l1-2l1 2l1-8l1 8l1-3l1 3l1-1l1 1z"},null,-1)])])}const Eh=de({name:"mdi-Waveform",render:bh}),Sh={data(){return{otherItems:[],perElementPdfLinksVisible:!1}},computed:{hasElementPdfLinks(){var i,e;return(e=(i=this.$store.manifest.structures)==null?void 0:i[0])!=null&&e.rendering?this.$store.manifest.structures[0].rendering.some(n=>n.format&&n.format==="application/pdf"):!1},media(){const t=[];return this.$store.options.pages.filter(i=>i>0).forEach(i=>{var n,r;const e=(r=(n=this.$store.manifest.items[i-1].items)==null?void 0:n[0])==null?void 0:r.items;e==null||e.forEach((s,o)=>{var a;(((a=s.body)==null?void 0:a.items)||[s.body]).forEach((u,c)=>{var m;const h=(m=u.format)==null?void 0:m.split("/")[1],f={fileName:u.id.split("/").at(-1),format:h==null?void 0:h.toUpperCase(),label:u.label,type:u.type,url:u.id,page:i,itemIndex:o,layerIndex:c};if(u.service){const v=[].concat(u.service)[0],y=["ImageService2","ImageService3"].includes(v.type||v["@type"])?"default":"native",T=v.type==="ImageService3"?"max":"full",x=v.id||v["@id"],E=x.at(-1)==="/"?"":"/";f.url=`${x}${E}full/${T}/0/${y}.${h==="jpeg"?"jpg":h}`}t.push(f)})})}),t},pages(){return this.$store.options.pages.filter(t=>t>0)},renderings(){return[].concat(this.$store.manifest.rendering||[])}}},Ch={class:"tify-export",tabindex:"0"},Ph={class:"tify-sr-only"},Rh={key:0,class:"tify-export-section -links"},Dh={class:"tify-export-list"},Ih=["href"],Ah={class:"tify-export-link-media"},Oh=["src"],Mh={class:"tify-export-link-text"},Fh={key:0,class:"tify-export-link-hint"},Lh={class:"tify-export-link-format"},kh={key:1,class:"tify-export-section -renderings"},Hh={class:"tify-list"},Bh=["href"],zh={key:0,class:"tify-export-container"},Nh=["aria-controls","aria-expanded","aria-label"],Uh=["id"],Vh={class:"tify-export-section -iiif"},Wh={class:"tify-list"},jh={key:0},Gh=["href"],qh=["href"],Zh={key:2,class:"tify-export-section -other"},Kh={class:"tify-list"},Xh=["href"];function Yh(t,i,e,n,r,s){var h,f,m;const o=Eh,l=Th,a=ni,u=Co,c=Ao;return S(),D("section",Ch,[R("h2",Ph,z(t.$translate("Export [noun]")),1),t.$store.manifest?(S(),D("div",Rh,[R("h3",null,z(t.$translate("Media Files")),1),R("ul",Dh,[(S(!0),D(se,null,Ee(s.media,v=>(S(),D("li",{key:v.url},[R("a",{href:v.url,class:"tify-export-link",download:"",rel:"noopener noreferrer",target:"_blank"},[R("span",Ah,[t.$store.getThumbnailUrl(v.page,96,v.itemIndex,v.layerIndex)?(S(),D("img",{key:0,src:t.$store.getThumbnailUrl(v.page,96,v.itemIndex,v.layerIndex),alt:""},null,8,Oh)):v.type==="Sound"?(S(),le(o,{key:1})):v.type==="Video"?(S(),le(l,{key:2})):Q("",!0)]),R("span",Mh,[ee(a,{number:v.page,wrap:!0},null,8,["number"]),v.label?(S(),D("span",Fh,z(t.$store.localize(v.label)),1)):Q("",!0),R("span",Lh,[v.type==="Sound"?(S(),D(se,{key:0},[Ke(z(t.$translate("Audio"))+" · ",1)],64)):v.type==="Video"?(S(),D(se,{key:1},[Ke(z(t.$translate("Video"))+" · ",1)],64)):v.type==="Image"?(S(),D(se,{key:2},[Ke(z(t.$translate("Image"))+" · ",1)],64)):Q("",!0),Ke(" "+z(v.format),1)])])],8,Ih)]))),128))])])):Q("",!0),(h=t.$store.manifest)!=null&&h.rendering?(S(),D("div",kh,[R("h3",null,z(t.$translate("Renderings")),1),R("ul",Hh,[(S(!0),D(se,null,Ee(s.renderings,v=>(S(),D("li",{key:v.id},[R("a",{href:v.id},z(t.$store.localize(v.label)),9,Bh)]))),128))]),s.hasElementPdfLinks?(S(),D("div",zh,[R("button",{type:"button",class:Pe(["tify-export-toggle",{"-close":r.perElementPdfLinksVisible}]),"aria-controls":t.$getId("export-pdf-list"),"aria-expanded":r.perElementPdfLinksVisible,"aria-label":r.perElementPdfLinksVisible?t.$translate("Close PDF list"):null,onClick:i[0]||(i[0]=v=>r.perElementPdfLinksVisible=!r.perElementPdfLinksVisible)},[r.perElementPdfLinksVisible?(S(),le(u,{key:1})):(S(),D(se,{key:0},[Ke(z(t.$translate("PDFs for each element")),1)],64))],10,Nh),Be(R("div",{id:t.$getId("export-pdf-list"),class:"tify-export-toc"},[R("h4",null,z(t.$translate("PDFs for each element")),1),ee(c,{ref:"children",purpose:"pdf",level:0,structures:t.$store.structures},null,8,["structures"])],8,Uh),[[Qe,r.perElementPdfLinksVisible]])])):Q("",!0)])):Q("",!0),R("div",Vh,[i[1]||(i[1]=R("h3",null,"IIIF",-1)),R("ul",Wh,[t.$store.options.childManifestUrl?(S(),D("li",jh,[R("a",{href:t.$store.options.childManifestUrl,download:"manifest.json"},z(t.$translate("IIIF manifest (current document)")),9,Gh)])):Q("",!0),R("li",null,[R("a",{href:t.$store.options.manifestUrl,download:"manifest.json"},z(t.$translate(t.$store.collection?"IIIF manifest (collection)":"IIIF manifest")),9,qh)])])]),(m=(f=t.$store.manifest)==null?void 0:f.seeAlso)!=null&&m.length?(S(),D("div",Zh,[R("h3",null,z(t.$translate("Other Formats")),1),R("ul",Kh,[(S(!0),D(se,null,Ee(t.$store.manifest.seeAlso,v=>(S(),D("li",{key:v.id},[R("a",{href:v.id,download:""},z(v.label?t.$store.localize(v.label):v.id),9,Xh)]))),128))])])):Q("",!0)])}const Jh=Ie(Sh,[["render",Yh]]);function Qi(t,i,e=120){const n=t,r=e===!0?120:e;if(!r||r<0){n.scrollTop=i;return}const o=(i-t.scrollTop)/r/.1;setTimeout(()=>{n.scrollTop+=o,n.scrollTop!==i&&Qi(n,i,r-10)},10)}function jn(t,i,e=!0){const n=i.querySelectorAll(t);if(!n.length)return;let r=n[0];const s=n[n.length-1];Array.prototype.forEach.call(n,u=>{u.dataset.level>=r.dataset.level&&(r=u)});const o=i.getBoundingClientRect(),l=r.getBoundingClientRect(),a=s.getBoundingClientRect();if(l.top<o.top){const u=l.top-o.top+i.scrollTop;Qi(i,u-50,e)}else if(a.bottom>o.bottom){const u=a.bottom-o.bottom+i.scrollTop;Qi(i,u+50,e)}}const nr=".tify-toc-structure.-current",Qh={data(){return{isInited:!1}},computed:{isNested(){return this.$store.structures.filter(t=>{var i;return(i=t.items)==null?void 0:i.some(e=>e.items)}).length}},watch:{"$store.options.pages":function(){this.$nextTick(()=>jn(nr,this.$el))},"$store.options.view":{handler(t){t==="toc"&&this.$nextTick(this.init)},immediate:!0}},methods:{init(){this.isInited=!0,this.$nextTick(()=>jn(nr,this.$el,!1))}}},$h={class:"tify-toc",tabindex:"0"},ed={class:"tify-sr-only"},td={key:0,class:"tify-toc-header"};function id(t,i,e,n,r,s){const o=Ao;return S(),D("section",$h,[R("h2",ed,z(t.$translate("Table of Contents")),1),s.isNested?(S(),D("div",td,[R("button",{type:"button",class:"tify-toc-toggle-all",onClick:i[0]||(i[0]=l=>t.$refs.children.toggleAllChildren(!0))},z(t.$translate("Expand all")),1),R("button",{type:"button",class:"tify-toc-toggle-all",onClick:i[1]||(i[1]=l=>t.$refs.children.toggleAllChildren(!1))},z(t.$translate("Collapse all")),1)])):Q("",!0),r.isInited?(S(),le(o,{key:1,ref:"children",level:0,structures:t.$store.structures},null,8,["structures"])):Q("",!0)])}const nd=Ie(Qh,[["render",id]]),sd={viewBox:"0 0 24 24",class:"tify-icon -broken-image","aria-hidden":"true"};function rd(t,i){return S(),D("svg",sd,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M21 5v6.59l-3-3.01l-4 4.01l-4-4l-4 4l-3-3.01V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2m-3 6.42l3 3.01V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6.58l3 2.99l4-4l4 4"},null,-1)])])}const od=de({name:"mdi-BrokenImage",render:rd}),ad=750,ld={data(){return{itemHeight:0,itemVerticalMargin:0,items:[{}],itemsPerRow:0,lastScrollTop:0,resizeObserver:null,resizeTimeout:null,style:{},thumbnailWidth:0,touchTimeout:null}},watch:{"$store.options.pages":function(t){this.$nextTick(()=>{const i=".tify-thumbnails-item.-current";t.length>2||t.length>1&&t[1]!==t[0]+1||(this.$refs.container.querySelector(i)?jn(i,this.$el):this.scrollToCurrentPage())})},"$store.options.view":{handler(t){t==="thumbnails"&&this.$nextTick(this.init)},immediate:!0}},mounted(){this.style.flex=this.$el.style.flex},unmounted(){var t;(t=this.resizeObserver)==null||t.disconnect(),clearTimeout(this.resizeTimeout)},methods:{init(){this.updateDimensions(),this.scrollToCurrentPage(!1),this.resizeObserver=new ResizeObserver(this.onResize),this.resizeObserver.observe(this.$el)},onResize(){clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{this.$store.options.view==="thumbnails"&&this.updateDimensions()},200)},updateDimensions(){if(!this.$refs.container)return;const t=this.$refs.container.querySelector(".tify-thumbnails-item"),i=t.currentStyle||window.getComputedStyle(t),e=parseInt(i.marginTop,10)+parseFloat(i.marginBottom,10);this.itemHeight=t.offsetHeight+e,this.itemVerticalMargin=e;const n=parseInt(i.marginLeft,10)+parseFloat(i.marginRight,10),r=t.offsetWidth+n;this.thumbnailWidth=t.querySelector(".tify-thumbnails-button").clientWidth,this.itemsPerRow=Math.floor(this.$refs.container.getBoundingClientRect().width/r);const o=Math.ceil(this.$store.manifest.items.length/this.itemsPerRow)*this.itemHeight;this.$refs.container.style.height=`${o}px`,this.redrawThumbnails(),this.scrollToCurrentPage(!1)},redrawThumbnails(){const t=this.$el.scrollTop,i=Math.floor(t/this.itemHeight)*this.itemsPerRow+1,n=Math.ceil(this.$el.offsetHeight/this.itemHeight)*this.itemsPerRow,r=i+this.itemsPerRow+n,s=Math.min(this.$store.manifest.items.length,r),o=[];for(let l=i;l<=s;l+=1)o.push({thumbnailUrl:this.$store.getThumbnailUrl(l,this.thumbnailWidth),page:l});this.items=o,this.$nextTick(()=>{const l=Math.floor(i/this.itemsPerRow);this.$refs.container.style.paddingTop=`${l*this.itemHeight}px`})},scrollToCurrentPage(t=!0){const e=Math.floor((this.$store.options.pages[0]-1)/this.itemsPerRow)*this.itemHeight+(this.itemVerticalMargin-50);t?Qi(this.$el,e):this.$el.scrollTop=e},setPageAndSwitchView(t,i=!1){if(i){const e=this.$store.options.pages.slice(0),n=e.indexOf(t);n<0?(e.push(t),e.sort((r,s)=>r-s),e[0]===0&&e.shift()):e.length>1&&e.splice(n,1),this.$store.updateOptions({pages:e});return}this.$store.setPage(t),this.$store.isContainerWidthAtLeast("medium")||this.$store.updateOptions({view:null})},touchStartTogglePage(t){this.lastScrollTop=this.$el.scrollTop,this.touchTimeout=setTimeout(()=>{this.$el.scrollTop===this.lastScrollTop&&this.setPageAndSwitchView(t,!0)},ad)},touchEnd(){clearTimeout(this.touchTimeout)}}},ud={class:"tify-sr-only"},cd={ref:"container",class:"tify-thumbnails-list"},hd=["onClick","onTouchstart"],dd=["src"],fd={key:1,class:"tify-thumbnails-image"},pd={class:"tify-sr-only"};function gd(t,i,e,n,r,s){const o=od,l=ni;return S(),D("section",{class:"tify-thumbnails",tabindex:"0",onScroll:i[1]||(i[1]=(...a)=>s.redrawThumbnails&&s.redrawThumbnails(...a))},[R("h2",ud,z(t.$translate("Pages")),1),R("ol",cd,[(S(!0),D(se,null,Ee(r.items,a=>(S(),D("li",{key:a.page,class:Pe(["tify-thumbnails-item",{"-current":t.$store.options.pages.includes(a.page)}])},[R("button",{type:"button",class:"tify-thumbnails-button",onClick:Vt(u=>s.setPageAndSwitchView(a.page,u.ctrlKey),["prevent"]),onTouchstart:u=>s.touchStartTogglePage(a.page),onTouchend:i[0]||(i[0]=(...u)=>s.touchEnd&&s.touchEnd(...u))},[a.thumbnailUrl?(S(),D("img",{key:0,class:"tify-thumbnails-image",alt:"",src:a.thumbnailUrl},null,8,dd)):(S(),D("span",fd,[ee(o),R("span",pd,z(t.$translate("Image missing")),1)])),ee(l,{number:a.page||1},null,8,["number"])],40,hd)],2))),128))],512)],32)}const md=Ie(ld,[["render",gd]]),vd={computed:{pages(){return this.$store.options.pages.filter(t=>t>0)}},watch:{"$store.options.annotationId":function(){this.scrollToCurrentAnnotation()},"$store.annotationsAvailable":function(){this.$store.options.annotationId&&this.scrollToCurrentAnnotation()}},mounted(){this.$store.options.annotationId&&this.$store.annotationsAvailable&&this.scrollToCurrentAnnotation()},methods:{filterHtml:vn,scrollToCurrentAnnotation(){this.$nextTick(()=>{var i;const t=(i=this.$refs.currentItem)==null?void 0:i[0];t&&t.scrollIntoView({behavior:"smooth",block:t.offsetHeight<this.$refs.panel.offsetHeight/2?"center":"start"})})}}},yd={ref:"panel",class:"tify-text",tabindex:"0"},wd={class:"tify-sr-only"},_d={key:0,class:"tify-text-pages"},Td={key:0},xd={class:"tify-text-list"},bd=["onClick","onKeydown","innerHTML"],Ed={key:1,class:"tify-text-none"};function Sd(t,i,e,n,r,s){const o=ni;return S(),D("section",yd,[R("h2",wd,z(t.$translate("Text")),1),t.$store.annotationsAvailable!==!1?(S(),D("div",_d,[(S(!0),D(se,null,Ee(s.pages,l=>(S(),D("div",{key:l,class:"tify-text-page"},[t.$store.pageCount>1?(S(),D("h3",Td,[ee(o,{number:l},null,8,["number"])])):Q("",!0),R("ul",xd,[(S(!0),D(se,null,Ee(t.$store.annotations[l],(a,u)=>(S(),D("li",{key:`${l}-${u}`,ref_for:!0,ref:t.$store.options.annotationId===a.id?"currentItem":"",class:Pe(["tify-text-item",{"-current":t.$store.options.annotationId===a.id}])},[R("div",{role:"button",tabindex:"0",class:"tify-text-toggle",onClick:c=>t.$store.toggleAnnotationId(a.id),onKeydown:Ht(c=>t.$store.toggleAnnotationId(a.id),["enter","space"]),innerHTML:s.filterHtml(a.html)},null,40,bd)],2))),128))])]))),128))])):(S(),D("p",Ed,z(t.$translate("Text not available for this page")),1))],512)}const Cd=Ie(vd,[["render",Sd]]),Pd={viewBox:"0 0 24 24",class:"tify-icon -volume-high","aria-hidden":"true"};function Rd(t,i){return S(),D("svg",Pd,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.84-5 6.7v2.07c4-.91 7-4.49 7-8.77s-3-7.86-7-8.77M16.5 12c0-1.77-1-3.29-2.5-4.03V16c1.5-.71 2.5-2.24 2.5-4M3 9v6h4l5 5V4L7 9z"},null,-1)])])}const Dd=de({name:"mdi-VolumeHigh",render:Rd}),Id={viewBox:"0 0 24 24",class:"tify-icon -volume-medium","aria-hidden":"true"};function Ad(t,i){return S(),D("svg",Id,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M5 9v6h4l5 5V4L9 9m9.5 3c0-1.77-1-3.29-2.5-4.03V16c1.5-.71 2.5-2.24 2.5-4"},null,-1)])])}const Od=de({name:"mdi-VolumeMedium",render:Ad}),Md={viewBox:"0 0 24 24",class:"tify-icon -volume-low","aria-hidden":"true"};function Fd(t,i){return S(),D("svg",Md,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M7 9v6h4l5 5V4l-5 5z"},null,-1)])])}const Ld=de({name:"mdi-VolumeLow",render:Fd}),kd={viewBox:"0 0 24 24",class:"tify-icon -volume-variant-off","aria-hidden":"true"};function Hd(t,i){return S(),D("svg",kd,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"m5.64 3.64l15.72 15.72l-1.41 1.42L16 16.83V20l-5-5H7V9h1.17L4.22 5.05zM16 4v7.17l-3.59-3.59z"},null,-1)])])}const Bd=de({name:"mdi-VolumeVariantOff",render:Hd}),zd={viewBox:"0 0 24 24",class:"tify-icon -closed-caption-outline","aria-hidden":"true"};function Nd(t,i){return S(),D("svg",zd,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M5 4c-.55 0-1 .18-1.41.57C3.2 4.96 3 5.44 3 6v12c0 .56.2 1.04.59 1.43c.41.39.86.57 1.41.57h14c.5 0 1-.19 1.39-.59c.41-.41.61-.88.61-1.41V6c0-.53-.2-1-.61-1.41C20 4.19 19.5 4 19 4zm-.5 1.5h15v13h-15zM7 9c-.3 0-.53.09-.72.28S6 9.7 6 10v4c0 .3.09.53.28.72S6.7 15 7 15h3c.27 0 .5-.09.71-.28c.2-.19.29-.42.29-.72v-1H9.5v.5h-2v-3h2v.5H11v-1c0-.3-.09-.53-.29-.72C10.5 9.09 10.27 9 10 9zm7 0c-.27 0-.5.09-.71.28c-.2.19-.29.42-.29.72v4c0 .3.09.53.29.72c.21.19.44.28.71.28h3c.3 0 .53-.09.72-.28S18 14.3 18 14v-1h-1.5v.5h-2v-3h2v.5H18v-1c0-.3-.09-.53-.28-.72S17.3 9 17 9z"},null,-1)])])}const Ud=de({name:"mdi-ClosedCaptionOutline",render:Nd}),Vd={viewBox:"0 0 24 24",class:"tify-icon -closed-caption","aria-hidden":"true"};function Wd(t,i){return S(),D("svg",Vd,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M18 11h-1.5v-.5h-2v3h2V13H18v1a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1m-7 1H9.5v-.5h-2v3h2V13H11v1a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1m8-6H5c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2"},null,-1)])])}const jd=de({name:"mdi-ClosedCaption",render:Wd});function yn(t){return Er()?(ha(t),!0):!1}function sr(){const t=new Set,i=s=>{t.delete(s)};return{on:s=>{t.add(s);const o=()=>i(s);return yn(o),{off:o}},off:i,trigger:(...s)=>Promise.all(Array.from(t).map(o=>o(...s))),clear:()=>{t.clear()}}}const gs=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Gd=Object.prototype.toString,Oo=t=>Gd.call(t)==="[object Object]",kt=()=>{},qd=Zd();function Zd(){var t,i;return gs&&((t=window==null?void 0:window.navigator)==null?void 0:t.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((i=window==null?void 0:window.navigator)==null?void 0:i.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function Kd(...t){if(t.length!==1)return Ha(...t);const i=t[0];return typeof i=="function"?Ni(Fa(()=>({get:i,set:kt}))):vi(i)}function Xd(t,i){function e(...n){return new Promise((r,s)=>{Promise.resolve(t(()=>i.apply(this,n),{fn:i,thisArg:this,args:n})).then(r).catch(s)})}return e}const Yd=t=>t();function In(t){return Array.isArray(t)?t:[t]}function Jd(t){return Ci()}function Qd(t,i=!0,e){Jd()?ls(t,e):i?t():ns(t)}function rr(t,i,e={}){const{eventFilter:n=Yd,...r}=e,s=Xd(n,i);let o,l,a;if(r.flush==="sync"){let u=!1;l=()=>{},o=c=>{u=!0,c(),u=!1},a=it(t,(...c)=>{u||s(...c)},r)}else{const u=[];let c=0,h=0;l=()=>{c=h},u.push(it(t,()=>{h++},{...r,flush:"sync"})),o=f=>{const m=h;f(),c+=h-m},u.push(it(t,(...f)=>{const m=c>0&&c===h;c=0,h=0,!m&&s(...f)},r)),a=()=>{u.forEach(f=>f())}}return{stop:a,ignoreUpdates:o,ignorePrevAsyncUpdates:l}}function $d(t,i,e){return it(t,i,{...e,immediate:!0})}const Mo=gs?window:void 0,Fo=gs?window.document:void 0;function Bt(t){var i;const e=Ce(t);return(i=e==null?void 0:e.$el)!=null?i:e}function Se(...t){const i=[],e=()=>{i.forEach(l=>l()),i.length=0},n=(l,a,u,c)=>(l.addEventListener(a,u,c),()=>l.removeEventListener(a,u,c)),r=Le(()=>{const l=In(Ce(t[0])).filter(a=>a!=null);return l.every(a=>typeof a!="string")?l:void 0}),s=$d(()=>{var l,a;return[(a=(l=r.value)==null?void 0:l.map(u=>Bt(u)))!=null?a:[Mo].filter(u=>u!=null),In(Ce(r.value?t[1]:t[0])),In(cn(r.value?t[2]:t[1])),Ce(r.value?t[3]:t[2])]},([l,a,u,c])=>{if(e(),!(l!=null&&l.length)||!(a!=null&&a.length)||!(u!=null&&u.length))return;const h=Oo(c)?{...c}:c;i.push(...l.flatMap(f=>a.flatMap(m=>u.map(v=>n(f,m,v,h)))))},{flush:"post"}),o=()=>{s(),e()};return yn(e),o}let or=!1;function Lo(t,i,e={}){const{window:n=Mo,ignore:r=[],capture:s=!0,detectIframe:o=!1,controls:l=!1}=e;if(!n)return l?{stop:kt,cancel:kt,trigger:kt}:kt;if(qd&&!or){or=!0;const T={passive:!0};Array.from(n.document.body.children).forEach(x=>x.addEventListener("click",kt,T)),n.document.documentElement.addEventListener("click",kt,T)}let a=!0;const u=T=>Ce(r).some(x=>{if(typeof x=="string")return Array.from(n.document.querySelectorAll(x)).some(E=>E===T.target||T.composedPath().includes(E));{const E=Bt(x);return E&&(T.target===E||T.composedPath().includes(E))}});function c(T){const x=Ce(T);return x&&x.$.subTree.shapeFlag===16}function h(T,x){const E=Ce(T),M=E.$.subTree&&E.$.subTree.children;return M==null||!Array.isArray(M)?!1:M.some(L=>L.el===x.target||x.composedPath().includes(L.el))}const f=T=>{const x=Bt(t);if(T.target!=null&&!(!(x instanceof Element)&&c(t)&&h(t,T))&&!(!x||x===T.target||T.composedPath().includes(x))){if("detail"in T&&T.detail===0&&(a=!u(T)),!a){a=!0;return}i(T)}};let m=!1;const v=[Se(n,"click",T=>{m||(m=!0,setTimeout(()=>{m=!1},0),f(T))},{passive:!0,capture:s}),Se(n,"pointerdown",T=>{const x=Bt(t);a=!u(T)&&!!(x&&!T.composedPath().includes(x))},{passive:!0}),o&&Se(n,"blur",T=>{setTimeout(()=>{var x;const E=Bt(t);((x=n.document.activeElement)==null?void 0:x.tagName)==="IFRAME"&&!(E!=null&&E.contains(n.document.activeElement))&&i(T)},0)},{passive:!0})].filter(Boolean),y=()=>v.forEach(T=>T());return l?{stop:y,cancel:()=>{a=!1},trigger:T=>{a=!0,f(T),a=!1}}:y}function ef(){const t=We(!1),i=Ci();return i&&ls(()=>{t.value=!0},i),t}function tf(t){const i=ef();return Le(()=>(i.value,!!t()))}const ar=["fullscreenchange","webkitfullscreenchange","webkitendfullscreen","mozfullscreenchange","MSFullscreenChange"];function nf(t,i={}){const{document:e=Fo,autoExit:n=!1}=i,r=Le(()=>{var E;return(E=Bt(t))!=null?E:e==null?void 0:e.documentElement}),s=We(!1),o=Le(()=>["requestFullscreen","webkitRequestFullscreen","webkitEnterFullscreen","webkitEnterFullScreen","webkitRequestFullScreen","mozRequestFullScreen","msRequestFullscreen"].find(E=>e&&E in e||r.value&&E in r.value)),l=Le(()=>["exitFullscreen","webkitExitFullscreen","webkitExitFullScreen","webkitCancelFullScreen","mozCancelFullScreen","msExitFullscreen"].find(E=>e&&E in e||r.value&&E in r.value)),a=Le(()=>["fullScreen","webkitIsFullScreen","webkitDisplayingFullscreen","mozFullScreen","msFullscreenElement"].find(E=>e&&E in e||r.value&&E in r.value)),u=["fullscreenElement","webkitFullscreenElement","mozFullScreenElement","msFullscreenElement"].find(E=>e&&E in e),c=tf(()=>r.value&&e&&o.value!==void 0&&l.value!==void 0&&a.value!==void 0),h=()=>u?(e==null?void 0:e[u])===r.value:!1,f=()=>{if(a.value){if(e&&e[a.value]!=null)return e[a.value];{const E=r.value;if((E==null?void 0:E[a.value])!=null)return!!E[a.value]}}return!1};async function m(){if(!(!c.value||!s.value)){if(l.value)if((e==null?void 0:e[l.value])!=null)await e[l.value]();else{const E=r.value;(E==null?void 0:E[l.value])!=null&&await E[l.value]()}s.value=!1}}async function v(){if(!c.value||s.value)return;f()&&await m();const E=r.value;o.value&&(E==null?void 0:E[o.value])!=null&&(await E[o.value](),s.value=!0)}async function y(){await(s.value?m():v())}const T=()=>{const E=f();(!E||E&&h())&&(s.value=E)},x={capture:!1,passive:!0};return Se(e,ar,T,x),Se(()=>Bt(r),ar,T,x),Qd(T,!1),n&&yn(m),{isSupported:c,isFullscreen:s,enter:v,exit:m,toggle:y}}function An(t,i){Ce(t)&&i(Ce(t))}function sf(t){let i=[];for(let e=0;e<t.length;++e)i=[...i,[t.start(e),t.end(e)]];return i}function On(t){return Array.from(t).map(({label:i,kind:e,language:n,mode:r,activeCues:s,cues:o,inBandMetadataTrackDispatchType:l},a)=>({id:a,label:i,kind:e,language:n,mode:r,activeCues:s,cues:o,inBandMetadataTrackDispatchType:l}))}const rf={src:"",tracks:[]};function of(t,i={}){t=Kd(t),i={...rf,...i};const{document:e=Fo}=i,n={passive:!0},r=We(0),s=We(0),o=We(!1),l=We(1),a=We(!1),u=We(!1),c=We(!1),h=We(1),f=We(!1),m=vi([]),v=vi([]),y=We(-1),T=We(!1),x=We(!1),E=e&&"pictureInPictureEnabled"in e,M=sr(),L=sr(),U=j=>{An(t,ie=>{if(j){const ce=typeof j=="number"?j:j.id;ie.textTracks[ce].mode="disabled"}else for(let ce=0;ce<ie.textTracks.length;++ce)ie.textTracks[ce].mode="disabled";y.value=-1})},K=(j,ie=!0)=>{An(t,ce=>{const ye=typeof j=="number"?j:j.id;ie&&U(),ce.textTracks[ye].mode="showing",y.value=ye})},q=()=>new Promise((j,ie)=>{An(t,async ce=>{E&&(T.value?e.exitPictureInPicture().then(j).catch(ie):ce.requestPictureInPicture().then(j).catch(ie))})});Rs(()=>{if(!e)return;const j=Ce(t);if(!j)return;const ie=Ce(i.src);let ce=[];ie&&(typeof ie=="string"?ce=[{src:ie}]:Array.isArray(ie)?ce=ie:Oo(ie)&&(ce=[ie]),j.querySelectorAll("source").forEach(ye=>{ye.remove()}),ce.forEach(({src:ye,type:me,media:pe})=>{const oe=e.createElement("source");oe.setAttribute("src",ye),oe.setAttribute("type",me||""),oe.setAttribute("media",pe||""),Se(oe,"error",M.trigger,n),j.appendChild(oe)}),j.load())}),it([t,l],()=>{const j=Ce(t);j&&(j.volume=l.value)}),it([t,x],()=>{const j=Ce(t);j&&(j.muted=x.value)}),it([t,h],()=>{const j=Ce(t);j&&(j.playbackRate=h.value)}),Rs(()=>{if(!e)return;const j=Ce(i.tracks),ie=Ce(t);!j||!j.length||!ie||(ie.querySelectorAll("track").forEach(ce=>ce.remove()),j.forEach(({default:ce,kind:ye,label:me,src:pe,srcLang:oe},Ae)=>{const De=e.createElement("track");De.default=ce||!1,De.kind=ye,De.label=me,De.src=pe,De.srclang=oe,De.default&&(y.value=Ae),ie.appendChild(De)}))});const{ignoreUpdates:Y}=rr(r,j=>{const ie=Ce(t);ie&&(ie.currentTime=j)}),{ignoreUpdates:te}=rr(c,j=>{const ie=Ce(t);ie&&(j?ie.play().catch(ce=>{throw L.trigger(ce),ce}):ie.pause())});Se(t,"timeupdate",()=>Y(()=>r.value=Ce(t).currentTime),n),Se(t,"durationchange",()=>s.value=Ce(t).duration,n),Se(t,"progress",()=>m.value=sf(Ce(t).buffered),n),Se(t,"seeking",()=>o.value=!0,n),Se(t,"seeked",()=>o.value=!1,n),Se(t,["waiting","loadstart"],()=>{a.value=!0,te(()=>c.value=!1)},n),Se(t,"loadeddata",()=>a.value=!1,n),Se(t,"playing",()=>{a.value=!1,u.value=!1,te(()=>c.value=!0)},n),Se(t,"ratechange",()=>h.value=Ce(t).playbackRate,n),Se(t,"stalled",()=>f.value=!0,n),Se(t,"ended",()=>u.value=!0,n),Se(t,"pause",()=>te(()=>c.value=!1),n),Se(t,"play",()=>te(()=>c.value=!0),n),Se(t,"enterpictureinpicture",()=>T.value=!0,n),Se(t,"leavepictureinpicture",()=>T.value=!1,n),Se(t,"volumechange",()=>{const j=Ce(t);j&&(l.value=j.volume,x.value=j.muted)},n);const fe=[],$=it([t],()=>{const j=Ce(t);j&&($(),fe[0]=Se(j.textTracks,"addtrack",()=>v.value=On(j.textTracks),n),fe[1]=Se(j.textTracks,"removetrack",()=>v.value=On(j.textTracks),n),fe[2]=Se(j.textTracks,"change",()=>v.value=On(j.textTracks),n))});return yn(()=>fe.forEach(j=>j())),{currentTime:r,duration:s,waiting:a,seeking:o,ended:u,stalled:f,buffered:m,playing:c,rate:h,volume:l,muted:x,tracks:v,selectedTrack:y,enableTrack:K,disableTrack:U,supportsPictureInPicture:E,togglePictureInPicture:q,isPictureInPicture:T,onSourceError:M.on,onPlaybackError:L.on}}function ms(t){return!!(t.altKey||t.ctrlKey||t.metaKey||["INPUT","SELECT","TEXTAREA"].includes(t.target.nodeName)&&t.target.type!=="range")}const af={props:{label:{default:null,type:String},position:{default:"bottom",type:String},shortcut:{default:null,type:String}},emits:["open"],data(){return{open:!1}},computed:{id(){return this.$.appContext.config.globalProperties.$getId?this.$getId(ji()):ji()}},mounted(){var t;(((t=this.$store)==null?void 0:t.rootElement)||document.documentElement).addEventListener("keydown",this.onKeydown),Lo(this.$el,()=>{this.open=!1})},beforeUnmount(){var t;(((t=this.$store)==null?void 0:t.rootElement)||document.documentElement).removeEventListener("keydown",this.onKeydown)},methods:{onKeydown(t){if(!ms(t)){if(t.key==="Escape"){this.open=!1;return}t.key===this.shortcut&&(this.open=!this.open,this.open&&this.$emit("open"),t.preventDefault())}}}},lf={class:"tify-dropdown"},uf=["aria-controls","aria-expanded","aria-label","title"],cf=["id"];function hf(t,i,e,n,r,s){return S(),D("div",lf,[R("button",{type:"button",class:"tify-dropdown-button","aria-controls":s.id,"aria-expanded":r.open,"aria-label":e.label,title:e.label,onClick:i[0]||(i[0]=o=>{r.open=!r.open,r.open&&t.$emit("open")})},[Os(t.$slots,"button")],8,uf),Be(R("div",{id:s.id,class:Pe(`tify-dropdown-content -${e.position}`),onClick:i[1]||(i[1]=o=>o.target.closest("a, button")&&(r.open=!1))},[Os(t.$slots,"default")],10,cf),[[Qe,r.open]])])}const vs=Ie(af,[["render",hf]]),df={viewBox:"0 0 24 24",class:"tify-icon -play-speed","aria-hidden":"true"};function ff(t,i){return S(),D("svg",df,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M13 2.05v2c4.39.54 7.5 4.53 6.96 8.92c-.46 3.64-3.32 6.53-6.96 6.96v2c5.5-.55 9.5-5.43 8.95-10.93c-.45-4.75-4.22-8.5-8.95-8.97zM5.67 19.74A10 10 0 0 0 11 22v-2a8 8 0 0 1-3.9-1.63zm1.43-14c1.12-.9 2.47-1.48 3.9-1.68v-2c-1.95.19-3.81.94-5.33 2.2zM5.69 7.1L4.26 5.67A9.9 9.9 0 0 0 2.05 11h2c.19-1.42.75-2.77 1.64-3.9M4.06 13h-2c.2 1.96.97 3.81 2.21 5.33l1.42-1.43A8 8 0 0 1 4.06 13M10 16.5l6-4.5l-6-4.5z"},null,-1)])])}const pf=de({name:"mdi-PlaySpeed",render:ff}),gf={viewBox:"0 0 24 24",class:"tify-icon -pause","aria-hidden":"true"};function mf(t,i){return S(),D("svg",gf,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M14 19h4V5h-4M6 19h4V5H6z"},null,-1)])])}const vf=de({name:"mdi-Pause",render:mf}),yf={viewBox:"0 0 24 24",class:"tify-icon -play","aria-hidden":"true"};function wf(t,i){return S(),D("svg",yf,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M8 5.14v14l11-7z"},null,-1)])])}const _f=de({name:"mdi-Play",render:wf}),Tf={viewBox:"0 0 24 24",class:"tify-icon -loading","aria-hidden":"true"};function xf(t,i){return S(),D("svg",Tf,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M12 4V2A10 10 0 0 0 2 12h2a8 8 0 0 1 8-8"},null,-1)])])}const bf=de({name:"mdi-Loading",render:xf}),Ef={props:{src:{required:!0,type:String},format:{required:!0,type:String},hasImage:{type:Boolean,default:!1}},data(){return{currentSubtitle:null,media:of(Qa("av")),mouseInterval:null,mouseMoving:!0,rates:[.5,.75,1,1.25,1.5,2]}},computed:{type(){var t;return(t=this.format)==null?void 0:t.split("/")[0]},subtitles(){var i,e;const t=(e=(i=this.$store.manifest.items[this.$store.options.pages[0]-1].annotations)==null?void 0:i[0].items)==null?void 0:e[0].body;return t?t.items||[t]:[]}},watch:{currentSubtitle(t){Object.values(this.$refs.av.textTracks).forEach(i=>{i.mode=i.language===(t==null?void 0:t.language)?"showing":"disabled"})}},beforeUnmount(){clearInterval(this.mouseInterval)},mounted(){window.addEventListener("mousemove",this.onMouseMove)},unmounted(){window.removeEventListener("mousemove",this.onMouseMove)},methods:{formatTime(t){const i=Math.floor(t/3600),e=Math.floor(t%3600/60),n=Math.floor(t%60);return[...this.media.duration>3600?[i.toString().padStart(2,"0")]:[],e.toString().padStart(2,"0"),n.toString().padStart(2,"0")].join(":")},onMouseMove(){clearTimeout(this.mouseInterval),this.mouseMoving=!0,this.mouseInterval=setInterval(()=>{this.mouseMoving=this.$store.options.view||this.media.paused},2e3)}}},Sf=["src","type"],Cf=["srclang","src"],Pf={class:"tify-player-controls"},Rf=["aria-label"],Df=["max","aria-label"],If={class:"tify-player-time"},Af={class:"tify-player-elapsed"},Of={class:"tify-player-duration"},Mf={class:"tify-sr-only"},Ff={key:0,class:"tify-player-select-badge"},Lf={class:"tify-player-select-title"},kf={class:"tify-button-list"},Hf=["aria-pressed","onClick"],Bf={class:"tify-sr-only"},zf={class:"tify-player-select-title"},Nf={class:"tify-button-list"},Uf=["aria-pressed","onClick"],Vf=["aria-pressed"],Wf=["aria-label","disabled"],jf=["aria-label"];function Gf(t,i,e,n,r,s){const o=bf,l=_f,a=vf,u=pf,c=vs,h=jd,f=Ud,m=Bd,v=Ld,y=Od,T=Dd;return S(),D("div",{class:Pe(["tify-player",`
-${s.type}
${r.mouseMoving||r.media.paused?"-mousing":""}
${r.media.playing||r.media.waiting?"-playing":""}
${e.hasImage&&(s.type==="audio"||!r.media.currentTime)?"-bottom":""}
`]),onKeydown:i[7]||(i[7]=Ht(Vt(x=>r.media.playing=!r.media.playing,["prevent"]),["space"]))},[(S(),le(cl(s.type),{ref:"av",class:"tify-player-av",poster:t.$store.getThumbnailUrl(t.$store.options.pages[0],0)||void 0,preload:"metadata",crossorigin:"anonymous",onClick:i[0]||(i[0]=x=>{r.media.playing=!r.media.playing,s.onMouseMove()})},{default:$e(()=>[R("source",{src:e.src,type:e.format},null,8,Sf),(S(!0),D(se,null,Ee(s.subtitles,x=>(S(),D("track",{key:x.id,kind:"captions",srclang:x.language,src:x.id},null,8,Cf))),128))]),_:1},8,["poster"])),s.type==="video"?(S(),D("div",{key:0,class:Pe(["tify-player-overlay",{"-hidden":r.media.playing||e.hasImage&&!r.media.currentTime}])},[r.media.waiting?(S(),le(o,{key:0,class:"-spin"})):r.media.currentTime?Q("",!0):(S(),le(l,{key:1}))],2)):Q("",!0),R("div",Pf,[R("div",null,[R("button",{type:"button",class:"tify-player-play-pause","aria-label":t.$translate(r.media.paused?"Play [verb]":"Pause [verb]"),onClick:i[1]||(i[1]=x=>r.media.playing=!r.media.playing)},[r.media.playing||r.media.seeking&&r.media.waiting?(S(),le(a,{key:0})):(S(),le(l,{key:1}))],8,Rf),Be(R("input",{"onUpdate:modelValue":i[2]||(i[2]=x=>r.media.currentTime=x),type:"range",class:"tify-player-seekbar",min:"0",max:r.media.duration,step:"any","aria-label":t.$translate("Current time"),style:It(`--value: ${r.media.currentTime/r.media.duration*100}%`)},null,12,Df),[[Ji,r.media.currentTime,void 0,{number:!0}]]),R("span",If,[R("span",Af,z(s.formatTime(r.media.currentTime)),1),R("span",Of," / "+z(s.formatTime(r.media.duration)),1)]),ee(c,{class:"tify-player-select -rate",alignment:"center",position:"top",shortcut:"r"},{button:$e(()=>[R("span",Mf,z(t.$translate("Playback rate")),1),ee(u),r.media.rate!==1?(S(),D("span",Ff,z(r.media.rate.toLocaleString(t.$store.options.language))+"x ",1)):Q("",!0)]),default:$e(()=>[R("h3",Lf,z(t.$translate("Playback rate")),1),R("ol",kf,[(S(!0),D(se,null,Ee(r.rates,x=>(S(),D("li",{key:x},[R("button",{type:"button","aria-pressed":x===r.media.rate,onClick:E=>r.media.rate=x},z(x===1?t.$translate("Normal"):`${x.toLocaleString(t.$store.options.language)}x`),9,Hf)]))),128))])]),_:1}),s.subtitles.length?(S(),le(c,{key:0,class:"tify-player-select -captions",alignment:"center",position:"top",shortcut:"c"},{button:$e(()=>[R("span",Bf,z(t.$translate("Closed Captions")),1),r.currentSubtitle?(S(),le(h,{key:0})):(S(),le(f,{key:1}))]),default:$e(()=>[R("h3",zf,z(t.$translate("Closed Captions")),1),R("ol",Nf,[(S(!0),D(se,null,Ee(s.subtitles,x=>(S(),D("li",{key:x.id},[R("button",{type:"button","aria-pressed":x===r.currentSubtitle,onClick:E=>r.currentSubtitle=x},z(t.$store.localize(x.label)||x.language),9,Uf)]))),128)),R("li",null,[R("button",{type:"button","aria-pressed":!r.currentSubtitle,onClick:i[3]||(i[3]=x=>r.currentSubtitle=null)},z(t.$translate("None")),9,Vf)])])]),_:1})):Q("",!0)]),R("div",null,[R("button",{type:"button",class:"tify-player-mute","aria-label":t.$translate("Toggle mute"),disabled:r.media.volume===0,onClick:i[4]||(i[4]=x=>r.media.muted=!r.media.muted)},[r.media.muted?(S(),le(m,{key:0})):r.media.volume<.34?(S(),le(v,{key:1})):r.media.volume<.67?(S(),le(y,{key:2})):(S(),le(T,{key:3}))],8,Wf),Be(R("input",{"onUpdate:modelValue":i[5]||(i[5]=x=>r.media.volume=x),type:"range",class:"tify-player-volume",min:"0",max:"1",step:"0.01","aria-label":t.$translate("Volume"),style:It(`--value: ${r.media.volume*100}%`),onInput:i[6]||(i[6]=x=>r.media.muted=r.media.volume===0)},null,44,jf),[[Ji,r.media.volume,void 0,{number:!0}]])])])],34)}const qf=Ie(Ef,[["render",Gf]]),Zf={viewBox:"0 0 24 24",class:"tify-icon -chevron-right","aria-hidden":"true"};function Kf(t,i){return S(),D("svg",Zf,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6z"},null,-1)])])}const ko=de({name:"mdi-ChevronRight",render:Kf}),Xf={viewBox:"0 0 24 24",class:"tify-icon -chevron-left","aria-hidden":"true"};function Yf(t,i){return S(),D("svg",Xf,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6z"},null,-1)])])}const Ho=de({name:"mdi-ChevronLeft",render:Yf}),Jf={viewBox:"0 0 24 24",class:"tify-icon -layers-outline","aria-hidden":"true"};function Qf(t,i){return S(),D("svg",Jf,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"m12 18.54l7.37-5.74L21 14.07l-9 7l-9-7l1.62-1.26zM12 16L3 9l9-7l9 7zm0-11.47L6.26 9L12 13.47L17.74 9z"},null,-1)])])}const $f=de({name:"mdi-LayersOutline",render:Qf}),ep={viewBox:"0 0 24 24",class:"tify-icon -comment-off-outline","aria-hidden":"true"};function tp(t,i){return S(),D("svg",ep,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"m7.2 4l-2-2H20a2 2 0 0 1 2 2v12c0 .76-.43 1.41-1.05 1.75L19.2 16h.8V4zm14.91 17.46l-1.27 1.27L16.11 18H13.9l-3.7 3.71c-.2.19-.45.29-.7.29H9c-.55 0-1-.45-1-1v-3H4a2 2 0 0 1-2-2V3.9L1.11 3l1.28-1.27zm-8-5.46L4 5.89V16h6v3.08L13.08 16z"},null,-1)])])}const ip=de({name:"mdi-CommentOffOutline",render:tp}),np={viewBox:"0 0 24 24",class:"tify-icon -comment-text-outline","aria-hidden":"true"};function sp(t,i){return S(),D("svg",np,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M9 22a1 1 0 0 1-1-1v-3H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6.1l-3.7 3.71c-.2.19-.45.29-.7.29zm1-6v3.08L13.08 16H20V4H4v12zM6 7h12v2H6zm0 4h9v2H6z"},null,-1)])])}const rp=de({name:"mdi-CommentTextOutline",render:sp}),op={viewBox:"0 0 24 24",class:"tify-icon -palette-outline","aria-hidden":"true"};function ap(t,i){return S(),D("svg",op,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M12 22A10 10 0 0 1 2 12A10 10 0 0 1 12 2c5.5 0 10 4 10 9a6 6 0 0 1-6 6h-1.8c-.3 0-.5.2-.5.5c0 .1.1.2.1.3c.4.5.6 1.1.6 1.7c.1 1.4-1 2.5-2.4 2.5m0-18a8 8 0 0 0-8 8a8 8 0 0 0 8 8c.3 0 .5-.2.5-.5c0-.2-.1-.3-.1-.4c-.4-.5-.6-1-.6-1.6c0-1.4 1.1-2.5 2.5-2.5H16a4 4 0 0 0 4-4c0-3.9-3.6-7-8-7m-5.5 6c.8 0 1.5.7 1.5 1.5S7.3 13 6.5 13S5 12.3 5 11.5S5.7 10 6.5 10m3-4c.8 0 1.5.7 1.5 1.5S10.3 9 9.5 9S8 8.3 8 7.5S8.7 6 9.5 6m5 0c.8 0 1.5.7 1.5 1.5S15.3 9 14.5 9S13 8.3 13 7.5S13.7 6 14.5 6m3 4c.8 0 1.5.7 1.5 1.5s-.7 1.5-1.5 1.5s-1.5-.7-1.5-1.5s.7-1.5 1.5-1.5"},null,-1)])])}const lp=de({name:"mdi-PaletteOutline",render:ap}),up={viewBox:"0 0 24 24",class:"tify-icon -circle-half-full","aria-hidden":"true"};function cp(t,i){return S(),D("svg",up,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 2a8 8 0 0 1 8 8a8 8 0 0 1-8 8z"},null,-1)])])}const hp=de({name:"mdi-CircleHalfFull",render:cp}),dp={viewBox:"0 0 24 24",class:"tify-icon -lightbulb-on-outline","aria-hidden":"true"};function fp(t,i){return S(),D("svg",dp,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M20 11h3v2h-3zM1 11h3v2H1zM13 1v3h-2V1zM4.92 3.5l2.13 2.14l-1.42 1.41L3.5 4.93zm12.03 2.13l2.12-2.13l1.43 1.43l-2.13 2.12zM12 6a6 6 0 0 1 6 6c0 2.22-1.21 4.16-3 5.2V19a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1v-1.8c-1.79-1.04-3-2.98-3-5.2a6 6 0 0 1 6-6m2 15v1a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-1zm-3-3h2v-2.13c1.73-.44 3-2.01 3-3.87a4 4 0 0 0-4-4a4 4 0 0 0-4 4c0 1.86 1.27 3.43 3 3.87z"},null,-1)])])}const pp=de({name:"mdi-LightbulbOnOutline",render:fp}),gp={emits:["update"],computed:{saturation(){const t=this.$store.options.filters.saturate;return typeof t=="number"?t:1}}},mp=["value"],vp=["value"],yp=["value"];function wp(t,i,e,n,r,s){const o=pp,l=hp,a=lp;return S(),D(se,null,[R("p",null,[R("label",null,[ee(o),Ke(" "+z(t.$translate("Brightness"))+" ",1),R("b",null,z(Math.round((t.$store.options.filters.brightness||1)*100))+" %",1),R("input",{ref:"firstSlider",max:"2",min:".5",step:".01",type:"range",value:t.$store.options.filters.brightness||1,style:It(`--value: ${((t.$store.options.filters.brightness||1)-.5)*.66667*100}%`),onInput:i[0]||(i[0]=u=>t.$emit("update","brightness",u))},null,44,mp)])]),R("p",null,[R("label",null,[ee(l),Ke(" "+z(t.$translate("Contrast"))+" ",1),R("b",null,z(Math.round((t.$store.options.filters.contrast||1)*100))+" %",1),R("input",{max:"2",min:".5",step:".01",type:"range",value:t.$store.options.filters.contrast||1,style:It(`--value: ${((t.$store.options.filters.contrast||1)-.5)*.66667*100}%`),onInput:i[1]||(i[1]=u=>t.$emit("update","contrast",u))},null,44,vp)])]),R("p",null,[R("label",null,[ee(a),Ke(" "+z(t.$translate("Saturation"))+" ",1),R("b",null,z(Math.round(s.saturation*100))+" %",1),R("input",{max:"3",min:"0",step:".01",type:"range",value:s.saturation,style:It(`--value: ${s.saturation/3*100}%`),onInput:i[2]||(i[2]=u=>t.$emit("update","saturate",u))},null,44,yp)])])],64)}const _p=Ie(gp,[["render",wp]]),Tp={viewBox:"0 0 24 24",class:"tify-icon -tune","aria-hidden":"true"};function xp(t,i){return S(),D("svg",Tp,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"},null,-1)])])}const bp=de({name:"mdi-Tune",render:xp}),Ep={viewBox:"0 0 24 24",class:"tify-icon -rotate-right","aria-hidden":"true"};function Sp(t,i){return S(),D("svg",Ep,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"m16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.9 7.9 0 0 0-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10z"},null,-1)])])}const Cp=de({name:"mdi-RotateRight",render:Sp}),Pp={viewBox:"0 0 24 24",class:"tify-icon -aspect-ratio","aria-hidden":"true"};function Rp(t,i){return S(),D("svg",Pp,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M19 12h-2v3h-3v2h5zM7 9h3V7H5v5h2zm14-6H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m0 16H3V5h18z"},null,-1)])])}const Dp=de({name:"mdi-AspectRatio",render:Rp});var Bi={exports:{}},Ip=Bi.exports,lr;function Ap(){return lr||(lr=1,function(t){//! openseadragon 5.0.1
//! Built on 2024-12-09
//! Git commit: v5.0.1-0-480de92d
//! http://openseadragon.github.io
//! License: http://openseadragon.github.io/license/
function i(e){return new i.Viewer(e)}(function(e){e.version={versionStr:"5.0.1",major:parseInt("5",10),minor:parseInt("0",10),revision:parseInt("1",10)};var n={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object AsyncFunction]":"function","[object Promise]":"promise","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"},r=Object.prototype.toString,s=Object.prototype.hasOwnProperty;e.isFunction=function(o){return e.type(o)==="function"},e.isArray=Array.isArray||function(o){return e.type(o)==="array"},e.isWindow=function(o){return o&&typeof o=="object"&&"setInterval"in o},e.type=function(o){return o==null?String(o):n[r.call(o)]||"object"},e.isPlainObject=function(o){if(!o||i.type(o)!=="object"||o.nodeType||e.isWindow(o)||o.constructor&&!s.call(o,"constructor")&&!s.call(o.constructor.prototype,"isPrototypeOf"))return!1;var l;for(var a in o)l=a;return l===void 0||s.call(o,l)},e.isEmptyObject=function(o){for(var l in o)return!1;return!0},e.freezeObject=function(o){return Object.freeze?e.freezeObject=Object.freeze:e.freezeObject=function(l){return l},e.freezeObject(o)},e.supportsCanvas=function(){var o=document.createElement("canvas");return!!(e.isFunction(o.getContext)&&o.getContext("2d"))}(),e.isCanvasTainted=function(o){var l=!1;try{o.getContext("2d").getImageData(0,0,1,1)}catch{l=!0}return l},e.supportsAddEventListener=function(){return!!(document.documentElement.addEventListener&&document.addEventListener)}(),e.supportsRemoveEventListener=function(){return!!(document.documentElement.removeEventListener&&document.removeEventListener)}(),e.supportsEventListenerOptions=function(){var o=0;if(e.supportsAddEventListener)try{var l={get capture(){return o++,!1},get once(){return o++,!1},get passive(){return o++,!1}};window.addEventListener("test",null,l),window.removeEventListener("test",null,l)}catch{o=0}return o>=3}(),e.getCurrentPixelDensityRatio=function(){if(e.supportsCanvas){var o=document.createElement("canvas").getContext("2d"),l=window.devicePixelRatio||1,a=o.webkitBackingStorePixelRatio||o.mozBackingStorePixelRatio||o.msBackingStorePixelRatio||o.oBackingStorePixelRatio||o.backingStorePixelRatio||1;return Math.max(l,1)/a}else return 1},e.pixelDensityRatio=e.getCurrentPixelDensityRatio()})(i),function(e){e.extend=function(){var a,u,c,h,f,m,v=arguments[0]||{},y=arguments.length,T=!1,x=1;for(typeof v=="boolean"&&(T=v,v=arguments[1]||{},x=2),typeof v!="object"&&!i.isFunction(v)&&(v={}),y===x&&(v=this,--x);x<y;x++)if(a=arguments[x],a!==null||a!==void 0)for(u in a){var E=Object.getOwnPropertyDescriptor(a,u);if(E!==void 0){if(E.get||E.set){Object.defineProperty(v,u,E);continue}h=E.value}else{e.console.warn('Could not copy inherited property "'+u+'".');continue}v!==h&&(T&&h&&(i.isPlainObject(h)||(f=i.isArray(h)))?(c=v[u],f?(f=!1,m=c&&i.isArray(c)?c:[]):m=c&&i.isPlainObject(c)?c:{},v[u]=i.extend(T,m,h)):h!==void 0&&(v[u]=h))}return v};var n=function(){if(typeof navigator!="object")return!1;var a=navigator.userAgent;return typeof a!="string"?!1:a.indexOf("iPhone")!==-1||a.indexOf("iPad")!==-1||a.indexOf("iPod")!==-1};e.extend(e,{DEFAULT_SETTINGS:{xmlPath:null,tileSources:null,tileHost:null,initialPage:0,crossOriginPolicy:!1,ajaxWithCredentials:!1,loadTilesWithAjax:!1,ajaxHeaders:{},splitHashDataForPost:!1,panHorizontal:!0,panVertical:!0,constrainDuringPan:!1,wrapHorizontal:!1,wrapVertical:!1,visibilityRatio:.5,minPixelRatio:.5,defaultZoomLevel:0,minZoomLevel:null,maxZoomLevel:null,homeFillsViewer:!1,clickTimeThreshold:300,clickDistThreshold:5,dblClickTimeThreshold:300,dblClickDistThreshold:20,springStiffness:6.5,animationTime:1.2,gestureSettingsMouse:{dragToPan:!0,scrollToZoom:!0,clickToZoom:!0,dblClickToZoom:!1,dblClickDragToZoom:!1,pinchToZoom:!1,zoomToRefPoint:!0,flickEnabled:!1,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsTouch:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!1,dblClickToZoom:!0,dblClickDragToZoom:!0,pinchToZoom:!0,zoomToRefPoint:!0,flickEnabled:!0,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsPen:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!0,dblClickToZoom:!1,dblClickDragToZoom:!1,pinchToZoom:!1,zoomToRefPoint:!0,flickEnabled:!1,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsUnknown:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!1,dblClickToZoom:!0,dblClickDragToZoom:!1,pinchToZoom:!0,zoomToRefPoint:!0,flickEnabled:!0,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},zoomPerClick:2,zoomPerScroll:1.2,zoomPerDblClickDrag:1.2,zoomPerSecond:1,blendTime:0,alwaysBlend:!1,autoHideControls:!0,immediateRender:!1,minZoomImageRatio:.9,maxZoomPixelRatio:1.1,smoothTileEdgesMinZoom:1.1,iOSDevice:n(),pixelsPerWheelLine:40,pixelsPerArrowPress:40,autoResize:!0,preserveImageSizeOnResize:!1,minScrollDeltaTime:50,rotationIncrement:90,maxTilesPerFrame:1,showSequenceControl:!0,sequenceControlAnchor:null,preserveViewport:!1,preserveOverlays:!1,navPrevNextWrap:!1,showNavigationControl:!0,navigationControlAnchor:null,showZoomControl:!0,showHomeControl:!0,showFullPageControl:!0,showRotationControl:!1,showFlipControl:!1,controlsFadeDelay:2e3,controlsFadeLength:1500,mouseNavEnabled:!0,showNavigator:!1,navigatorElement:null,navigatorId:null,navigatorPosition:null,navigatorSizeRatio:.2,navigatorMaintainSizeRatio:!1,navigatorTop:null,navigatorLeft:null,navigatorHeight:null,navigatorWidth:null,navigatorAutoResize:!0,navigatorAutoFade:!0,navigatorRotate:!0,navigatorBackground:"#000",navigatorOpacity:.8,navigatorBorderColor:"#555",navigatorDisplayRegionColor:"#900",degrees:0,flipped:!1,overlayPreserveContentDirection:!0,opacity:1,compositeOperation:null,drawer:["webgl","canvas","html"],drawerOptions:{webgl:{},canvas:{},html:{},custom:{}},preload:!1,imageSmoothingEnabled:!0,placeholderFillStyle:null,subPixelRoundingForTransparency:null,showReferenceStrip:!1,referenceStripScroll:"horizontal",referenceStripElement:null,referenceStripHeight:null,referenceStripWidth:null,referenceStripPosition:"BOTTOM_LEFT",referenceStripSizeRatio:.2,collectionRows:3,collectionColumns:0,collectionLayout:"horizontal",collectionMode:!1,collectionTileSize:800,collectionTileMargin:80,imageLoaderLimit:0,maxImageCacheCount:200,timeout:3e4,tileRetryMax:0,tileRetryDelay:2500,prefixUrl:"/images/",navImages:{zoomIn:{REST:"zoomin_rest.png",GROUP:"zoomin_grouphover.png",HOVER:"zoomin_hover.png",DOWN:"zoomin_pressed.png"},zoomOut:{REST:"zoomout_rest.png",GROUP:"zoomout_grouphover.png",HOVER:"zoomout_hover.png",DOWN:"zoomout_pressed.png"},home:{REST:"home_rest.png",GROUP:"home_grouphover.png",HOVER:"home_hover.png",DOWN:"home_pressed.png"},fullpage:{REST:"fullpage_rest.png",GROUP:"fullpage_grouphover.png",HOVER:"fullpage_hover.png",DOWN:"fullpage_pressed.png"},rotateleft:{REST:"rotateleft_rest.png",GROUP:"rotateleft_grouphover.png",HOVER:"rotateleft_hover.png",DOWN:"rotateleft_pressed.png"},rotateright:{REST:"rotateright_rest.png",GROUP:"rotateright_grouphover.png",HOVER:"rotateright_hover.png",DOWN:"rotateright_pressed.png"},flip:{REST:"flip_rest.png",GROUP:"flip_grouphover.png",HOVER:"flip_hover.png",DOWN:"flip_pressed.png"},previous:{REST:"previous_rest.png",GROUP:"previous_grouphover.png",HOVER:"previous_hover.png",DOWN:"previous_pressed.png"},next:{REST:"next_rest.png",GROUP:"next_grouphover.png",HOVER:"next_hover.png",DOWN:"next_pressed.png"}},debugMode:!1,debugGridColor:["#437AB2","#1B9E77","#D95F02","#7570B3","#E7298A","#66A61E","#E6AB02","#A6761D","#666666"],silenceMultiImageWarnings:!1},delegate:function(a,u){return function(){var c=arguments;return c===void 0&&(c=[]),u.apply(a,c)}},BROWSERS:{UNKNOWN:0,IE:1,FIREFOX:2,SAFARI:3,CHROME:4,OPERA:5,EDGE:6,CHROMEEDGE:7},SUBPIXEL_ROUNDING_OCCURRENCES:{NEVER:0,ONLY_AT_REST:1,ALWAYS:2},_viewers:new Map,getViewer:function(a){return e._viewers.get(this.getElement(a))},getElement:function(a){return typeof a=="string"&&(a=document.getElementById(a)),a},getElementPosition:function(a){var u=new e.Point,c,h;for(a=e.getElement(a),c=e.getElementStyle(a).position==="fixed",h=l(a,c);h;)u.x+=a.offsetLeft,u.y+=a.offsetTop,c&&(u=u.plus(e.getPageScroll())),a=h,c=e.getElementStyle(a).position==="fixed",h=l(a,c);return u},getElementOffset:function(a){a=e.getElement(a);var u=a&&a.ownerDocument,c,h,f={top:0,left:0};return u?(c=u.documentElement,typeof a.getBoundingClientRect<"u"&&(f=a.getBoundingClientRect()),h=u===u.window?u:u.nodeType===9?u.defaultView||u.parentWindow:!1,new e.Point(f.left+(h.pageXOffset||c.scrollLeft)-(c.clientLeft||0),f.top+(h.pageYOffset||c.scrollTop)-(c.clientTop||0))):new e.Point},getElementSize:function(a){return a=e.getElement(a),new e.Point(a.clientWidth,a.clientHeight)},getElementStyle:document.documentElement.currentStyle?function(a){return a=e.getElement(a),a.currentStyle}:function(a){return a=e.getElement(a),window.getComputedStyle(a,"")},getCssPropertyWithVendorPrefix:function(a){var u={};return e.getCssPropertyWithVendorPrefix=function(c){if(u[c]!==void 0)return u[c];var h=document.createElement("div").style,f=null;if(h[c]!==void 0)f=c;else for(var m=["Webkit","Moz","MS","O","webkit","moz","ms","o"],v=e.capitalizeFirstLetter(c),y=0;y<m.length;y++){var T=m[y]+v;if(h[T]!==void 0){f=T;break}}return u[c]=f,f},e.getCssPropertyWithVendorPrefix(a)},capitalizeFirstLetter:function(a){return a.charAt(0).toUpperCase()+a.slice(1)},positiveModulo:function(a,u){var c=a%u;return c<0&&(c+=u),c},pointInElement:function(a,u){a=e.getElement(a);var c=e.getElementOffset(a),h=e.getElementSize(a);return u.x>=c.x&&u.x<c.x+h.x&&u.y<c.y+h.y&&u.y>=c.y},getMousePosition:function(a){if(typeof a.pageX=="number")e.getMousePosition=function(u){var c=new e.Point;return c.x=u.pageX,c.y=u.pageY,c};else if(typeof a.clientX=="number")e.getMousePosition=function(u){var c=new e.Point;return c.x=u.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,c.y=u.clientY+document.body.scrollTop+document.documentElement.scrollTop,c};else throw new Error("Unknown event mouse position, no known technique.");return e.getMousePosition(a)},getPageScroll:function(){var a=document.documentElement||{},u=document.body||{};if(typeof window.pageXOffset=="number")e.getPageScroll=function(){return new e.Point(window.pageXOffset,window.pageYOffset)};else if(u.scrollLeft||u.scrollTop)e.getPageScroll=function(){return new e.Point(document.body.scrollLeft,document.body.scrollTop)};else if(a.scrollLeft||a.scrollTop)e.getPageScroll=function(){return new e.Point(document.documentElement.scrollLeft,document.documentElement.scrollTop)};else return new e.Point(0,0);return e.getPageScroll()},setPageScroll:function(a){if(typeof window.scrollTo<"u")e.setPageScroll=function(h){window.scrollTo(h.x,h.y)};else{var u=e.getPageScroll();if(u.x===a.x&&u.y===a.y)return;document.body.scrollLeft=a.x,document.body.scrollTop=a.y;var c=e.getPageScroll();if(c.x!==u.x&&c.y!==u.y){e.setPageScroll=function(h){document.body.scrollLeft=h.x,document.body.scrollTop=h.y};return}if(document.documentElement.scrollLeft=a.x,document.documentElement.scrollTop=a.y,c=e.getPageScroll(),c.x!==u.x&&c.y!==u.y){e.setPageScroll=function(h){document.documentElement.scrollLeft=h.x,document.documentElement.scrollTop=h.y};return}e.setPageScroll=function(h){}}e.setPageScroll(a)},getWindowSize:function(){var a=document.documentElement||{},u=document.body||{};if(typeof window.innerWidth=="number")e.getWindowSize=function(){return new e.Point(window.innerWidth,window.innerHeight)};else if(a.clientWidth||a.clientHeight)e.getWindowSize=function(){return new e.Point(document.documentElement.clientWidth,document.documentElement.clientHeight)};else if(u.clientWidth||u.clientHeight)e.getWindowSize=function(){return new e.Point(document.body.clientWidth,document.body.clientHeight)};else throw new Error("Unknown window size, no known technique.");return e.getWindowSize()},makeCenteredNode:function(a){a=e.getElement(a);var u=[e.makeNeutralElement("div"),e.makeNeutralElement("div"),e.makeNeutralElement("div")];return e.extend(u[0].style,{display:"table",height:"100%",width:"100%"}),e.extend(u[1].style,{display:"table-row"}),e.extend(u[2].style,{display:"table-cell",verticalAlign:"middle",textAlign:"center"}),u[0].appendChild(u[1]),u[1].appendChild(u[2]),u[2].appendChild(a),u[0]},makeNeutralElement:function(a){var u=document.createElement(a),c=u.style;return c.background="transparent none",c.border="none",c.margin="0px",c.padding="0px",c.position="static",u},now:function(){return Date.now?e.now=Date.now:e.now=function(){return new Date().getTime()},e.now()},makeTransparentImage:function(a){var u=e.makeNeutralElement("img");return u.src=a,u},setElementOpacity:function(a,u,c){var h,f;a=e.getElement(a),c&&!e.Browser.alpha&&(u=Math.round(u)),e.Browser.opacity?a.style.opacity=u<1?u:"":u<1?(h=Math.round(100*u),f="alpha(opacity="+h+")",a.style.filter=f):a.style.filter=""},setElementTouchActionNone:function(a){a=e.getElement(a),typeof a.style.touchAction<"u"?a.style.touchAction="none":typeof a.style.msTouchAction<"u"&&(a.style.msTouchAction="none")},setElementPointerEvents:function(a,u){a=e.getElement(a),typeof a.style<"u"&&typeof a.style.pointerEvents<"u"&&(a.style.pointerEvents=u)},setElementPointerEventsNone:function(a){e.setElementPointerEvents(a,"none")},addClass:function(a,u){a=e.getElement(a),a.className?(" "+a.className+" ").indexOf(" "+u+" ")===-1&&(a.className+=" "+u):a.className=u},indexOf:function(a,u,c){return Array.prototype.indexOf?this.indexOf=function(h,f,m){return h.indexOf(f,m)}:this.indexOf=function(h,f,m){var v,y=m||0,T;if(!h)throw new TypeError;if(T=h.length,T===0||y>=T)return-1;for(y<0&&(y=T-Math.abs(y)),v=y;v<T;v++)if(h[v]===f)return v;return-1},this.indexOf(a,u,c)},removeClass:function(a,u){var c,h=[],f;for(a=e.getElement(a),c=a.className.split(/\s+/),f=0;f<c.length;f++)c[f]&&c[f]!==u&&h.push(c[f]);a.className=h.join(" ")},normalizeEventListenerOptions:function(a){var u;return typeof a<"u"?typeof a=="boolean"?u=e.supportsEventListenerOptions?{capture:a}:a:u=e.supportsEventListenerOptions?a:typeof a.capture<"u"?a.capture:!1:u=e.supportsEventListenerOptions?{capture:!1}:!1,u},addEvent:function(){if(e.supportsAddEventListener)return function(a,u,c,h){h=e.normalizeEventListenerOptions(h),a=e.getElement(a),a.addEventListener(u,c,h)};if(document.documentElement.attachEvent&&document.attachEvent)return function(a,u,c){a=e.getElement(a),a.attachEvent("on"+u,c)};throw new Error("No known event model.")}(),removeEvent:function(){if(e.supportsRemoveEventListener)return function(a,u,c,h){h=e.normalizeEventListenerOptions(h),a=e.getElement(a),a.removeEventListener(u,c,h)};if(document.documentElement.detachEvent&&document.detachEvent)return function(a,u,c){a=e.getElement(a),a.detachEvent("on"+u,c)};throw new Error("No known event model.")}(),cancelEvent:function(a){a.preventDefault()},eventIsCanceled:function(a){return a.defaultPrevented},stopEvent:function(a){a.stopPropagation()},createCallback:function(a,u){console.error("The createCallback function is deprecated and will be removed in future versions. Please use alternativeFunction instead.");var c=[],h;for(h=2;h<arguments.length;h++)c.push(arguments[h]);return function(){var f=c.concat([]),m;for(m=0;m<arguments.length;m++)f.push(arguments[m]);return u.apply(a,f)}},getUrlParameter:function(a){var u=o[a];return u||null},getUrlProtocol:function(a){var u=a.match(/^([a-z]+:)\/\//i);return u===null?window.location.protocol:u[1].toLowerCase()},createAjaxRequest:function(){if(window.XMLHttpRequest)return e.createAjaxRequest=function(){return new XMLHttpRequest},new XMLHttpRequest;throw new Error("Browser doesn't support XMLHttpRequest.")},makeAjaxRequest:function(a,u,c){var h,f,m,v;e.isPlainObject(a)&&(u=a.success,c=a.error,h=a.withCredentials,f=a.headers,m=a.responseType||null,v=a.postData||null,a=a.url);var y=e.getUrlProtocol(a),T=e.createAjaxRequest();if(!e.isFunction(u))throw new Error("makeAjaxRequest requires a success callback");T.onreadystatechange=function(){T.readyState===4&&(T.onreadystatechange=function(){},T.status>=200&&T.status<300||T.status===0&&y!=="http:"&&y!=="https:"?u(T):e.isFunction(c)?c(T):e.console.error("AJAX request returned %d: %s",T.status,a))};var x=v?"POST":"GET";try{if(T.open(x,a,!0),m&&(T.responseType=m),f)for(var E in f)Object.prototype.hasOwnProperty.call(f,E)&&f[E]&&T.setRequestHeader(E,f[E]);h&&(T.withCredentials=!0),T.send(v)}catch(M){e.console.error("%s while making AJAX request: %s",M.name,M.message),T.onreadystatechange=function(){},e.isFunction(c)&&c(T,M)}return T},jsonp:function(a){var u,c=a.url,h=document.head||document.getElementsByTagName("head")[0]||document.documentElement,f=a.callbackName||"openseadragon"+e.now(),m=window[f],v="$1"+f+"$2",y=a.param||"callback",T=a.callback;c=c.replace(/(=)\?(&|$)|\?\?/i,v),c+=(/\?/.test(c)?"&":"?")+y+"="+f,window[f]=function(x){if(m)window[f]=m;else try{delete window[f]}catch{}T&&e.isFunction(T)&&T(x)},u=document.createElement("script"),(a.async!==void 0||a.async!==!1)&&(u.async="async"),a.scriptCharset&&(u.charset=a.scriptCharset),u.src=c,u.onload=u.onreadystatechange=function(x,E){(E||!u.readyState||/loaded|complete/.test(u.readyState))&&(u.onload=u.onreadystatechange=null,h&&u.parentNode&&h.removeChild(u),u=void 0)},h.insertBefore(u,h.firstChild)},createFromDZI:function(){throw"OpenSeadragon.createFromDZI is deprecated, use Viewer.open."},parseXml:function(a){if(window.DOMParser)e.parseXml=function(u){var c=null,h;return h=new DOMParser,c=h.parseFromString(u,"text/xml"),c};else throw new Error("Browser doesn't support XML DOM.");return e.parseXml(a)},parseJSON:function(a){return e.parseJSON=window.JSON.parse,e.parseJSON(a)},imageFormatSupported:function(a){return a=a||"",!!s[a.toLowerCase()]},setImageFormatsSupported:function(a){e.extend(s,a)}});var r=function(a){};e.console=window.console||{log:r,debug:r,info:r,warn:r,error:r,assert:r},e.Browser={vendor:e.BROWSERS.UNKNOWN,version:0,alpha:!0};var s={avif:!0,bmp:!1,jpeg:!0,jpg:!0,png:!0,tif:!1,wdp:!1,webp:!0},o={};(function(){var a=navigator.appVersion,u=navigator.userAgent,c;switch(navigator.appName){case"Microsoft Internet Explorer":window.attachEvent&&window.ActiveXObject&&(e.Browser.vendor=e.BROWSERS.IE,e.Browser.version=parseFloat(u.substring(u.indexOf("MSIE")+5,u.indexOf(";",u.indexOf("MSIE")))));break;case"Netscape":window.addEventListener&&(u.indexOf("Edge")>=0?(e.Browser.vendor=e.BROWSERS.EDGE,e.Browser.version=parseFloat(u.substring(u.indexOf("Edge")+5))):u.indexOf("Edg")>=0?(e.Browser.vendor=e.BROWSERS.CHROMEEDGE,e.Browser.version=parseFloat(u.substring(u.indexOf("Edg")+4))):u.indexOf("Firefox")>=0?(e.Browser.vendor=e.BROWSERS.FIREFOX,e.Browser.version=parseFloat(u.substring(u.indexOf("Firefox")+8))):u.indexOf("Safari")>=0?(e.Browser.vendor=u.indexOf("Chrome")>=0?e.BROWSERS.CHROME:e.BROWSERS.SAFARI,e.Browser.version=parseFloat(u.substring(u.substring(0,u.indexOf("Safari")).lastIndexOf("/")+1,u.indexOf("Safari")))):(c=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})"),c.exec(u)!==null&&(e.Browser.vendor=e.BROWSERS.IE,e.Browser.version=parseFloat(RegExp.$1))));break;case"Opera":e.Browser.vendor=e.BROWSERS.OPERA,e.Browser.version=parseFloat(a);break}var h=window.location.search.substring(1),f=h.split("&"),m,v,y;for(y=0;y<f.length;y++)if(m=f[y],v=m.indexOf("="),v>0){var T=m.substring(0,v),x=m.substring(v+1);try{o[T]=decodeURIComponent(x)}catch{e.console.error("Ignoring malformed URL parameter: %s=%s",T,x)}}e.Browser.alpha=!(e.Browser.vendor===e.BROWSERS.CHROME&&e.Browser.version<2),e.Browser.opacity=!0,e.Browser.vendor===e.BROWSERS.IE&&e.console.error("Internet Explorer is not supported by OpenSeadragon")})(),function(a){var u=a.requestAnimationFrame||a.mozRequestAnimationFrame||a.webkitRequestAnimationFrame||a.msRequestAnimationFrame,c=a.cancelAnimationFrame||a.mozCancelAnimationFrame||a.webkitCancelAnimationFrame||a.msCancelAnimationFrame;if(u&&c)e.requestAnimationFrame=function(){return u.apply(a,arguments)},e.cancelAnimationFrame=function(){return c.apply(a,arguments)};else{var h=[],f=[],m=0,v;e.requestAnimationFrame=function(y){return h.push([++m,y]),v||(v=setInterval(function(){if(h.length){var T=e.now(),x=f;for(f=h,h=x;f.length;)f.shift()[1](T)}else clearInterval(v),v=void 0},1e3/50)),m},e.cancelAnimationFrame=function(y){var T,x;for(T=0,x=h.length;T<x;T+=1)if(h[T][0]===y){h.splice(T,1);return}for(T=0,x=f.length;T<x;T+=1)if(f[T][0]===y){f.splice(T,1);return}}}}(window);function l(a,u){return u&&a!==document.body?document.body:a.offsetParent}}(i),function(e,n){t.exports?t.exports=n():e.OpenSeadragon=n()}(Ip,function(){return i}),function(e){class n{constructor(s){s||(s=[0,0,0,0,0,0,0,0,0]),this.values=s}static makeIdentity(){return new n([1,0,0,0,1,0,0,0,1])}static makeTranslation(s,o){return new n([1,0,0,0,1,0,s,o,1])}static makeRotation(s){var o=Math.cos(s),l=Math.sin(s);return new n([o,-l,0,l,o,0,0,0,1])}static makeScaling(s,o){return new n([s,0,0,0,o,0,0,0,1])}multiply(s){let o=this.values,l=s.values;var a=o[0],u=o[1],c=o[2],h=o[3],f=o[4],m=o[5],v=o[6],y=o[7],T=o[8],x=l[0],E=l[1],M=l[2],L=l[3],U=l[4],K=l[5],q=l[6],Y=l[7],te=l[8];return new n([x*a+E*h+M*v,x*u+E*f+M*y,x*c+E*m+M*T,L*a+U*h+K*v,L*u+U*f+K*y,L*c+U*m+K*T,q*a+Y*h+te*v,q*u+Y*f+te*y,q*c+Y*m+te*T])}}e.Mat3=n}(i),function(e){var n={supportsFullScreen:!1,isFullScreen:function(){return!1},getFullScreenElement:function(){return null},requestFullScreen:function(){},exitFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",fullScreenErrorEventName:""};document.exitFullscreen?(n.supportsFullScreen=!0,n.getFullScreenElement=function(){return document.fullscreenElement},n.requestFullScreen=function(r){return r.requestFullscreen().catch(function(s){e.console.error("Fullscreen request failed: ",s)})},n.exitFullScreen=function(){document.exitFullscreen().catch(function(r){e.console.error("Error while exiting fullscreen: ",r)})},n.fullScreenEventName="fullscreenchange",n.fullScreenErrorEventName="fullscreenerror"):document.msExitFullscreen?(n.supportsFullScreen=!0,n.getFullScreenElement=function(){return document.msFullscreenElement},n.requestFullScreen=function(r){return r.msRequestFullscreen()},n.exitFullScreen=function(){document.msExitFullscreen()},n.fullScreenEventName="MSFullscreenChange",n.fullScreenErrorEventName="MSFullscreenError"):document.webkitExitFullscreen?(n.supportsFullScreen=!0,n.getFullScreenElement=function(){return document.webkitFullscreenElement},n.requestFullScreen=function(r){return r.webkitRequestFullscreen()},n.exitFullScreen=function(){document.webkitExitFullscreen()},n.fullScreenEventName="webkitfullscreenchange",n.fullScreenErrorEventName="webkitfullscreenerror"):document.webkitCancelFullScreen?(n.supportsFullScreen=!0,n.getFullScreenElement=function(){return document.webkitCurrentFullScreenElement},n.requestFullScreen=function(r){return r.webkitRequestFullScreen()},n.exitFullScreen=function(){document.webkitCancelFullScreen()},n.fullScreenEventName="webkitfullscreenchange",n.fullScreenErrorEventName="webkitfullscreenerror"):document.mozCancelFullScreen&&(n.supportsFullScreen=!0,n.getFullScreenElement=function(){return document.mozFullScreenElement},n.requestFullScreen=function(r){return r.mozRequestFullScreen()},n.exitFullScreen=function(){document.mozCancelFullScreen()},n.fullScreenEventName="mozfullscreenchange",n.fullScreenErrorEventName="mozfullscreenerror"),n.isFullScreen=function(){return n.getFullScreenElement()!==null},n.cancelFullScreen=function(){e.console.error("cancelFullScreen is deprecated. Use exitFullScreen instead."),n.exitFullScreen()},e.extend(e,n)}(i),function(e){e.EventSource=function(){this.events={},this._rejectedEventList={}},e.EventSource.prototype={addOnceHandler:function(n,r,s,o,l){var a=this;o=o||1;var u=0,c=function(h){return u++,u===o&&a.removeHandler(n,c),r(h)};return this.addHandler(n,c,s,l)},addHandler:function(n,r,s,o){if(Object.prototype.hasOwnProperty.call(this._rejectedEventList,n))return e.console.error(`Error adding handler for ${n}. ${this._rejectedEventList[n]}`),!1;var l=this.events[n];if(l||(this.events[n]=l=[]),r&&e.isFunction(r)){var a=l.length,u={handler:r,userData:s||null,priority:o||0};for(l[a]=u;a>0&&l[a-1].priority<l[a].priority;)l[a]=l[a-1],l[a-1]=u,a--}return!0},removeHandler:function(n,r){var s=this.events[n],o=[],l;if(s&&e.isArray(s)){for(l=0;l<s.length;l++)s[l].handler!==r&&o.push(s[l]);this.events[n]=o}},numberOfHandlers:function(n){var r=this.events[n];return r?r.length:0},removeAllHandlers:function(n){if(n)this.events[n]=[];else for(var r in this.events)this.events[r]=[]},getHandler:function(n){var r=this.events[n];return!r||!r.length?null:(r=r.length===1?[r[0]]:Array.apply(null,r),function(s,o){var l,a=r.length;for(l=0;l<a;l++)r[l]&&(o.eventSource=s,o.userData=r[l].userData,r[l].handler(o))})},raiseEvent:function(n,r){if(Object.prototype.hasOwnProperty.call(this._rejectedEventList,n))return e.console.error(`Error adding handler for ${n}. ${this._rejectedEventList[n]}`),!1;var s=this.getHandler(n);return s&&s(this,r||{}),!0},rejectEventHandler(n,r=""){this._rejectedEventList[n]=r},allowEventHandler(n){delete this._rejectedEventList[n]}}}(i),function(e){var n={};e.MouseTracker=function(g){var p=arguments;e.isPlainObject(g)||(g={element:p[0],clickTimeThreshold:p[1],clickDistThreshold:p[2]}),this.hash=Math.random(),this.element=e.getElement(g.element),this.clickTimeThreshold=g.clickTimeThreshold||e.DEFAULT_SETTINGS.clickTimeThreshold,this.clickDistThreshold=g.clickDistThreshold||e.DEFAULT_SETTINGS.clickDistThreshold,this.dblClickTimeThreshold=g.dblClickTimeThreshold||e.DEFAULT_SETTINGS.dblClickTimeThreshold,this.dblClickDistThreshold=g.dblClickDistThreshold||e.DEFAULT_SETTINGS.dblClickDistThreshold,this.userData=g.userData||null,this.stopDelay=g.stopDelay||50,this.preProcessEventHandler=g.preProcessEventHandler||null,this.contextMenuHandler=g.contextMenuHandler||null,this.enterHandler=g.enterHandler||null,this.leaveHandler=g.leaveHandler||null,this.exitHandler=g.exitHandler||null,this.overHandler=g.overHandler||null,this.outHandler=g.outHandler||null,this.pressHandler=g.pressHandler||null,this.nonPrimaryPressHandler=g.nonPrimaryPressHandler||null,this.releaseHandler=g.releaseHandler||null,this.nonPrimaryReleaseHandler=g.nonPrimaryReleaseHandler||null,this.moveHandler=g.moveHandler||null,this.scrollHandler=g.scrollHandler||null,this.clickHandler=g.clickHandler||null,this.dblClickHandler=g.dblClickHandler||null,this.dragHandler=g.dragHandler||null,this.dragEndHandler=g.dragEndHandler||null,this.pinchHandler=g.pinchHandler||null,this.stopHandler=g.stopHandler||null,this.keyDownHandler=g.keyDownHandler||null,this.keyUpHandler=g.keyUpHandler||null,this.keyHandler=g.keyHandler||null,this.focusHandler=g.focusHandler||null,this.blurHandler=g.blurHandler||null;var _=this;n[this.hash]={click:function(b){M(_,b)},dblclick:function(b){L(_,b)},keydown:function(b){U(_,b)},keyup:function(b){K(_,b)},keypress:function(b){q(_,b)},focus:function(b){Y(_,b)},blur:function(b){te(_,b)},contextmenu:function(b){fe(_,b)},wheel:function(b){$(_,b)},mousewheel:function(b){j(_,b)},DOMMouseScroll:function(b){j(_,b)},MozMousePixelScroll:function(b){j(_,b)},losecapture:function(b){ce(_,b)},mouseenter:function(b){ge(_,b)},mouseleave:function(b){Wt(_,b)},mouseover:function(b){jt(_,b)},mouseout:function(b){ot(_,b)},mousedown:function(b){tt(_,b)},mouseup:function(b){Rt(_,b)},mousemove:function(b){si(_,b)},touchstart:function(b){ye(_,b)},touchend:function(b){me(_,b)},touchmove:function(b){pe(_,b)},touchcancel:function(b){oe(_,b)},gesturestart:function(b){Ae(_,b)},gesturechange:function(b){De(_,b)},gotpointercapture:function(b){et(_,b)},lostpointercapture:function(b){qe(_,b)},pointerenter:function(b){ge(_,b)},pointerleave:function(b){Wt(_,b)},pointerover:function(b){jt(_,b)},pointerout:function(b){ot(_,b)},pointerdown:function(b){tt(_,b)},pointerup:function(b){Rt(_,b)},pointermove:function(b){si(_,b)},pointercancel:function(b){H(_,b)},pointerupcaptured:function(b){Gt(_,b)},pointermovecaptured:function(b){P(_,b)},tracking:!1,activePointersLists:[],lastClickPos:null,dblClickTimeOut:null,pinchGPoints:[],lastPinchDist:0,currentPinchDist:0,lastPinchCenter:null,currentPinchCenter:null,sentDragEvent:!1},this.hasGestureHandlers=!!(this.pressHandler||this.nonPrimaryPressHandler||this.releaseHandler||this.nonPrimaryReleaseHandler||this.clickHandler||this.dblClickHandler||this.dragHandler||this.dragEndHandler||this.pinchHandler),this.hasScrollHandler=!!this.scrollHandler,e.MouseTracker.havePointerEvents&&e.setElementPointerEvents(this.element,"auto"),this.exitHandler&&e.console.error("MouseTracker.exitHandler is deprecated. Use MouseTracker.leaveHandler instead."),g.startDisabled||this.setTracking(!0)},e.MouseTracker.prototype={destroy:function(){a(this),this.element=null,n[this.hash]=null,delete n[this.hash]},isTracking:function(){return n[this.hash].tracking},setTracking:function(g){return g?l(this):a(this),this},getActivePointersListByType:function(g){var p=n[this.hash],_,b=p?p.activePointersLists.length:0,k;for(_=0;_<b;_++)if(p.activePointersLists[_].type===g)return p.activePointersLists[_];return k=new e.MouseTracker.GesturePointList(g),p&&p.activePointersLists.push(k),k},getActivePointerCount:function(){var g=n[this.hash],p,_=g.activePointersLists.length,b=0;for(p=0;p<_;p++)b+=g.activePointersLists[p].getLength();return b},preProcessEventHandler:function(){},contextMenuHandler:function(){},enterHandler:function(){},leaveHandler:function(){},exitHandler:function(){},overHandler:function(){},outHandler:function(){},pressHandler:function(){},nonPrimaryPressHandler:function(){},releaseHandler:function(){},nonPrimaryReleaseHandler:function(){},moveHandler:function(){},scrollHandler:function(){},clickHandler:function(){},dblClickHandler:function(){},dragHandler:function(){},dragEndHandler:function(){},pinchHandler:function(){},stopHandler:function(){},keyDownHandler:function(){},keyUpHandler:function(){},keyHandler:function(){},focusHandler:function(){},blurHandler:function(){}};var r=function(){try{return window.self!==window.top}catch{return!0}}();function s(g){try{return g.addEventListener&&g.removeEventListener}catch{return!1}}e.MouseTracker.gesturePointVelocityTracker=function(){var g=[],p=0,_=0,b=function(ve,re){return ve.hash.toString()+re.type+re.id.toString()},k=function(){var ve,re=g.length,He,Fe,qt=e.now(),_s,Ts,xs;for(_s=qt-_,_=qt,ve=0;ve<re;ve++)He=g[ve],Fe=He.gPoint,Fe.direction=Math.atan2(Fe.currentPos.y-He.lastPos.y,Fe.currentPos.x-He.lastPos.x),Ts=He.lastPos.distanceTo(Fe.currentPos),He.lastPos=Fe.currentPos,xs=1e3*Ts/(_s+1),Fe.speed=.75*xs+.25*Fe.speed},G=function(ve,re){var He=b(ve,re);g.push({guid:He,gPoint:re,lastPos:re.currentPos}),g.length===1&&(_=e.now(),p=window.setInterval(k,50))},J=function(ve,re){var He=b(ve,re),Fe,qt=g.length;for(Fe=0;Fe<qt;Fe++)if(g[Fe].guid===He){g.splice(Fe,1),qt--,qt===0&&window.clearInterval(p);break}};return{addPoint:G,removePoint:J}}(),e.MouseTracker.captureElement=document,e.MouseTracker.wheelEventName="onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll",e.MouseTracker.subscribeEvents=["click","dblclick","keydown","keyup","keypress","focus","blur","contextmenu",e.MouseTracker.wheelEventName],e.MouseTracker.wheelEventName==="DOMMouseScroll"&&e.MouseTracker.subscribeEvents.push("MozMousePixelScroll"),window.PointerEvent?(e.MouseTracker.havePointerEvents=!0,e.MouseTracker.subscribeEvents.push("pointerenter","pointerleave","pointerover","pointerout","pointerdown","pointerup","pointermove","pointercancel"),e.MouseTracker.havePointerCapture=function(){var g=document.createElement("div");return e.isFunction(g.setPointerCapture)&&e.isFunction(g.releasePointerCapture)}(),e.MouseTracker.havePointerCapture&&e.MouseTracker.subscribeEvents.push("gotpointercapture","lostpointercapture")):(e.MouseTracker.havePointerEvents=!1,e.MouseTracker.subscribeEvents.push("mouseenter","mouseleave","mouseover","mouseout","mousedown","mouseup","mousemove"),e.MouseTracker.mousePointerId="legacy-mouse",e.MouseTracker.havePointerCapture=function(){var g=document.createElement("div");return e.isFunction(g.setCapture)&&e.isFunction(g.releaseCapture)}(),e.MouseTracker.havePointerCapture&&e.MouseTracker.subscribeEvents.push("losecapture"),"ontouchstart"in window&&e.MouseTracker.subscribeEvents.push("touchstart","touchend","touchmove","touchcancel"),"ongesturestart"in window&&e.MouseTracker.subscribeEvents.push("gesturestart","gesturechange")),e.MouseTracker.GesturePointList=function(g){this._gPoints=[],this.type=g,this.buttons=0,this.contacts=0,this.clicks=0,this.captureCount=0},e.MouseTracker.GesturePointList.prototype={getLength:function(){return this._gPoints.length},asArray:function(){return this._gPoints},add:function(g){return this._gPoints.push(g)},removeById:function(g){var p,_=this._gPoints.length;for(p=0;p<_;p++)if(this._gPoints[p].id===g){this._gPoints.splice(p,1);break}return this._gPoints.length},getByIndex:function(g){return g<this._gPoints.length?this._gPoints[g]:null},getById:function(g){var p,_=this._gPoints.length;for(p=0;p<_;p++)if(this._gPoints[p].id===g)return this._gPoints[p];return null},getPrimary:function(g){var p,_=this._gPoints.length;for(p=0;p<_;p++)if(this._gPoints[p].isPrimary)return this._gPoints[p];return null},addContact:function(){++this.contacts,this.contacts>1&&(this.type==="mouse"||this.type==="pen")&&(e.console.warn("GesturePointList.addContact() Implausible contacts value"),this.contacts=1)},removeContact:function(){--this.contacts,this.contacts<0&&(this.contacts=0)}};function o(g){var p=n[g.hash],_,b,k,G,J,ve=p.activePointersLists.length;for(_=0;_<ve;_++)if(k=p.activePointersLists[_],k.getLength()>0){for(J=[],G=k.asArray(),b=0;b<G.length;b++)J.push(G[b]);for(b=0;b<J.length;b++)N(g,k,J[b])}for(_=0;_<ve;_++)p.activePointersLists.pop();p.sentDragEvent=!1}function l(g){var p=n[g.hash],_,b;if(!p.tracking){for(b=0;b<e.MouseTracker.subscribeEvents.length;b++)_=e.MouseTracker.subscribeEvents[b],e.addEvent(g.element,_,p[_],_===e.MouseTracker.wheelEventName?{passive:!1,capture:!1}:!1);o(g),p.tracking=!0}}function a(g){var p=n[g.hash],_,b;if(p.tracking){for(b=0;b<e.MouseTracker.subscribeEvents.length;b++)_=e.MouseTracker.subscribeEvents[b],e.removeEvent(g.element,_,p[_],!1);o(g),p.tracking=!1}}function u(g,p){var _=n[g.hash];if(p==="pointerevent")return{upName:"pointerup",upHandler:_.pointerupcaptured,moveName:"pointermove",moveHandler:_.pointermovecaptured};if(p==="mouse")return{upName:"pointerup",upHandler:_.pointerupcaptured,moveName:"pointermove",moveHandler:_.pointermovecaptured};if(p==="touch")return{upName:"touchend",upHandler:_.touchendcaptured,moveName:"touchmove",moveHandler:_.touchmovecaptured};throw new Error("MouseTracker.getCaptureEventParams: Unknown pointer type.")}function c(g,p){var _;if(e.MouseTracker.havePointerCapture)if(e.MouseTracker.havePointerEvents)try{g.element.setPointerCapture(p.id)}catch{e.console.warn("setPointerCapture() called on invalid pointer ID");return}else g.element.setCapture(!0);else _=u(g,e.MouseTracker.havePointerEvents?"pointerevent":p.type),r&&s(window.top)&&e.addEvent(window.top,_.upName,_.upHandler,!0),e.addEvent(e.MouseTracker.captureElement,_.upName,_.upHandler,!0),e.addEvent(e.MouseTracker.captureElement,_.moveName,_.moveHandler,!0);C(g,p,!0)}function h(g,p){var _,b,k;if(e.MouseTracker.havePointerCapture)if(e.MouseTracker.havePointerEvents){if(b=g.getActivePointersListByType(p.type),k=b.getById(p.id),!k||!k.captured)return;try{g.element.releasePointerCapture(p.id)}catch{}}else g.element.releaseCapture();else _=u(g,e.MouseTracker.havePointerEvents?"pointerevent":p.type),r&&s(window.top)&&e.removeEvent(window.top,_.upName,_.upHandler,!0),e.removeEvent(e.MouseTracker.captureElement,_.moveName,_.moveHandler,!0),e.removeEvent(e.MouseTracker.captureElement,_.upName,_.upHandler,!0);C(g,p,!1)}function f(g){return e.MouseTracker.havePointerEvents?g.pointerId:e.MouseTracker.mousePointerId}function m(g){return e.MouseTracker.havePointerEvents&&g.pointerType?g.pointerType:"mouse"}function v(g){return e.MouseTracker.havePointerEvents?g.isPrimary:!0}function y(g){return e.getMousePosition(g)}function T(g,p){return x(y(g),p)}function x(g,p){var _=e.getElementOffset(p);return g.minus(_)}function E(g,p){return new e.Point((g.x+p.x)/2,(g.y+p.y)/2)}function M(g,p){var _={originalEvent:p,eventType:"click",pointerType:"mouse",isEmulated:!1};w(g,_),_.preventDefault&&!_.defaultPrevented&&e.cancelEvent(p),_.stopPropagation&&e.stopEvent(p)}function L(g,p){var _={originalEvent:p,eventType:"dblclick",pointerType:"mouse",isEmulated:!1};w(g,_),_.preventDefault&&!_.defaultPrevented&&e.cancelEvent(p),_.stopPropagation&&e.stopEvent(p)}function U(g,p){var _=null,b={originalEvent:p,eventType:"keydown",pointerType:"",isEmulated:!1};w(g,b),g.keyDownHandler&&!b.preventGesture&&!b.defaultPrevented&&(_={eventSource:g,keyCode:p.keyCode?p.keyCode:p.charCode,ctrl:p.ctrlKey,shift:p.shiftKey,alt:p.altKey,meta:p.metaKey,originalEvent:p,preventDefault:b.preventDefault||b.defaultPrevented,userData:g.userData},g.keyDownHandler(_)),(_&&_.preventDefault||b.preventDefault&&!b.defaultPrevented)&&e.cancelEvent(p),b.stopPropagation&&e.stopEvent(p)}function K(g,p){var _=null,b={originalEvent:p,eventType:"keyup",pointerType:"",isEmulated:!1};w(g,b),g.keyUpHandler&&!b.preventGesture&&!b.defaultPrevented&&(_={eventSource:g,keyCode:p.keyCode?p.keyCode:p.charCode,ctrl:p.ctrlKey,shift:p.shiftKey,alt:p.altKey,meta:p.metaKey,originalEvent:p,preventDefault:b.preventDefault||b.defaultPrevented,userData:g.userData},g.keyUpHandler(_)),(_&&_.preventDefault||b.preventDefault&&!b.defaultPrevented)&&e.cancelEvent(p),b.stopPropagation&&e.stopEvent(p)}function q(g,p){var _=null,b={originalEvent:p,eventType:"keypress",pointerType:"",isEmulated:!1};w(g,b),g.keyHandler&&!b.preventGesture&&!b.defaultPrevented&&(_={eventSource:g,keyCode:p.keyCode?p.keyCode:p.charCode,ctrl:p.ctrlKey,shift:p.shiftKey,alt:p.altKey,meta:p.metaKey,originalEvent:p,preventDefault:b.preventDefault||b.defaultPrevented,userData:g.userData},g.keyHandler(_)),(_&&_.preventDefault||b.preventDefault&&!b.defaultPrevented)&&e.cancelEvent(p),b.stopPropagation&&e.stopEvent(p)}function Y(g,p){var _={originalEvent:p,eventType:"focus",pointerType:"",isEmulated:!1};w(g,_),g.focusHandler&&!_.preventGesture&&g.focusHandler({eventSource:g,originalEvent:p,userData:g.userData})}function te(g,p){var _={originalEvent:p,eventType:"blur",pointerType:"",isEmulated:!1};w(g,_),g.blurHandler&&!_.preventGesture&&g.blurHandler({eventSource:g,originalEvent:p,userData:g.userData})}function fe(g,p){var _=null,b={originalEvent:p,eventType:"contextmenu",pointerType:"mouse",isEmulated:!1};w(g,b),g.contextMenuHandler&&!b.preventGesture&&!b.defaultPrevented&&(_={eventSource:g,position:x(y(p),g.element),originalEvent:b.originalEvent,preventDefault:b.preventDefault||b.defaultPrevented,userData:g.userData},g.contextMenuHandler(_)),(_&&_.preventDefault||b.preventDefault&&!b.defaultPrevented)&&e.cancelEvent(p),b.stopPropagation&&e.stopEvent(p)}function $(g,p){ie(g,p,p)}function j(g,p){var _={target:p.target||p.srcElement,type:"wheel",shiftKey:p.shiftKey||!1,clientX:p.clientX,clientY:p.clientY,pageX:p.pageX?p.pageX:p.clientX,pageY:p.pageY?p.pageY:p.clientY,deltaMode:p.type==="MozMousePixelScroll"?0:1,deltaX:0,deltaZ:0};e.MouseTracker.wheelEventName==="mousewheel"?_.deltaY=-p.wheelDelta/e.DEFAULT_SETTINGS.pixelsPerWheelLine:_.deltaY=p.detail,ie(g,_,p)}function ie(g,p,_){var b=0,k,G=null;b=p.deltaY?p.deltaY<0?1:-1:0,k={originalEvent:p,eventType:"wheel",pointerType:"mouse",isEmulated:p!==_},w(g,k),g.scrollHandler&&!k.preventGesture&&!k.defaultPrevented&&(G={eventSource:g,pointerType:"mouse",position:T(p,g.element),scroll:b,shift:p.shiftKey,isTouchEvent:!1,originalEvent:_,preventDefault:k.preventDefault||k.defaultPrevented,userData:g.userData},g.scrollHandler(G)),k.stopPropagation&&e.stopEvent(_),(G&&G.preventDefault||k.preventDefault&&!k.defaultPrevented)&&e.cancelEvent(_)}function ce(g,p){var _={id:e.MouseTracker.mousePointerId,type:"mouse"},b={originalEvent:p,eventType:"lostpointercapture",pointerType:"mouse",isEmulated:!1};w(g,b),p.target===g.element&&C(g,_,!1),b.stopPropagation&&e.stopEvent(p)}function ye(g,p){var _,b,k=p.changedTouches.length,G,J=g.getActivePointersListByType("touch");_=e.now(),J.getLength()>p.touches.length-k&&e.console.warn("Tracked touch contact count doesn't match event.touches.length");var ve={originalEvent:p,eventType:"pointerdown",pointerType:"touch",isEmulated:!1};for(w(g,ve),b=0;b<k;b++)G={id:p.changedTouches[b].identifier,type:"touch",isPrimary:J.getLength()===0,currentPos:y(p.changedTouches[b]),currentTime:_},A(g,ve,G),W(g,ve,G,0),C(g,G,!0);ve.preventDefault&&!ve.defaultPrevented&&e.cancelEvent(p),ve.stopPropagation&&e.stopEvent(p)}function me(g,p){var _,b,k=p.changedTouches.length,G;_=e.now();var J={originalEvent:p,eventType:"pointerup",pointerType:"touch",isEmulated:!1};for(w(g,J),b=0;b<k;b++)G={id:p.changedTouches[b].identifier,type:"touch",currentPos:y(p.changedTouches[b]),currentTime:_},Z(g,J,G,0),C(g,G,!1),O(g,J,G);J.preventDefault&&!J.defaultPrevented&&e.cancelEvent(p),J.stopPropagation&&e.stopEvent(p)}function pe(g,p){var _,b,k=p.changedTouches.length,G;_=e.now();var J={originalEvent:p,eventType:"pointermove",pointerType:"touch",isEmulated:!1};for(w(g,J),b=0;b<k;b++)G={id:p.changedTouches[b].identifier,type:"touch",currentPos:y(p.changedTouches[b]),currentTime:_},ne(g,J,G);J.preventDefault&&!J.defaultPrevented&&e.cancelEvent(p),J.stopPropagation&&e.stopEvent(p)}function oe(g,p){var _=p.changedTouches.length,b,k,G={originalEvent:p,eventType:"pointercancel",pointerType:"touch",isEmulated:!1};for(w(g,G),b=0;b<_;b++)k={id:p.changedTouches[b].identifier,type:"touch"},X(g,G,k);G.stopPropagation&&e.stopEvent(p)}function Ae(g,p){return e.eventIsCanceled(p)||p.preventDefault(),!1}function De(g,p){return e.eventIsCanceled(p)||p.preventDefault(),!1}function et(g,p){var _={originalEvent:p,eventType:"gotpointercapture",pointerType:m(p),isEmulated:!1};w(g,_),p.target===g.element&&C(g,{id:p.pointerId,type:m(p)},!0),_.stopPropagation&&e.stopEvent(p)}function qe(g,p){var _={originalEvent:p,eventType:"lostpointercapture",pointerType:m(p),isEmulated:!1};w(g,_),p.target===g.element&&C(g,{id:p.pointerId,type:m(p)},!1),_.stopPropagation&&e.stopEvent(p)}function ge(g,p){var _={id:f(p),type:m(p),isPrimary:v(p),currentPos:y(p),currentTime:e.now()},b={originalEvent:p,eventType:"pointerenter",pointerType:_.type,isEmulated:!1};w(g,b),A(g,b,_)}function Wt(g,p){var _={id:f(p),type:m(p),isPrimary:v(p),currentPos:y(p),currentTime:e.now()},b={originalEvent:p,eventType:"pointerleave",pointerType:_.type,isEmulated:!1};w(g,b),O(g,b,_)}function jt(g,p){var _={id:f(p),type:m(p),isPrimary:v(p),currentPos:y(p),currentTime:e.now()},b={originalEvent:p,eventType:"pointerover",pointerType:_.type,isEmulated:!1};w(g,b),B(g,b,_),b.preventDefault&&!b.defaultPrevented&&e.cancelEvent(p),b.stopPropagation&&e.stopEvent(p)}function ot(g,p){var _={id:f(p),type:m(p),isPrimary:v(p),currentPos:y(p),currentTime:e.now()},b={originalEvent:p,eventType:"pointerout",pointerType:_.type,isEmulated:!1};w(g,b),F(g,b,_),b.preventDefault&&!b.defaultPrevented&&e.cancelEvent(p),b.stopPropagation&&e.stopEvent(p)}function tt(g,p){var _={id:f(p),type:m(p),isPrimary:v(p),currentPos:y(p),currentTime:e.now()},b=e.MouseTracker.havePointerEvents&&_.type==="touch",k={originalEvent:p,eventType:"pointerdown",pointerType:_.type,isEmulated:!1};w(g,k),W(g,k,_,p.button),k.preventDefault&&!k.defaultPrevented&&e.cancelEvent(p),k.stopPropagation&&e.stopEvent(p),k.shouldCapture&&(b?C(g,_,!0):c(g,_))}function Rt(g,p){at(g,p)}function Gt(g,p){var _=g.getActivePointersListByType(m(p));_.getById(p.pointerId)&&at(g,p),e.stopEvent(p)}function at(g,p){var _;_={id:f(p),type:m(p),isPrimary:v(p),currentPos:y(p),currentTime:e.now()};var b={originalEvent:p,eventType:"pointerup",pointerType:_.type,isEmulated:!1};w(g,b),Z(g,b,_,p.button),b.preventDefault&&!b.defaultPrevented&&e.cancelEvent(p),b.stopPropagation&&e.stopEvent(p),b.shouldReleaseCapture&&(p.target===g.element?h(g,_):C(g,_,!1))}function si(g,p){I(g,p)}function P(g,p){var _=g.getActivePointersListByType(m(p));_.getById(p.pointerId)&&I(g,p),e.stopEvent(p)}function I(g,p){var _={id:f(p),type:m(p),isPrimary:v(p),currentPos:y(p),currentTime:e.now()},b={originalEvent:p,eventType:"pointermove",pointerType:_.type,isEmulated:!1};w(g,b),ne(g,b,_),b.preventDefault&&!b.defaultPrevented&&e.cancelEvent(p),b.stopPropagation&&e.stopEvent(p)}function H(g,p){var _={id:p.pointerId,type:m(p)},b={originalEvent:p,eventType:"pointercancel",pointerType:_.type,isEmulated:!1};w(g,b),X(g,b,_),b.stopPropagation&&e.stopEvent(p)}function V(g,p){return p.speed=0,p.direction=0,p.contactPos=p.currentPos,p.contactTime=p.currentTime,p.lastPos=p.currentPos,p.lastTime=p.currentTime,g.add(p)}function N(g,p,_){var b,k=p.getById(_.id);return k?(k.captured&&(e.console.warn("stopTrackingPointer() called on captured pointer"),h(g,k)),p.removeContact(),b=p.removeById(_.id)):b=p.getLength(),b}function d(g,p){switch(p.eventType){case"pointermove":p.isStoppable=!0,p.isCancelable=!0,p.preventDefault=!1,p.preventGesture=!g.hasGestureHandlers,p.stopPropagation=!1;break;case"pointerover":case"pointerout":case"contextmenu":case"keydown":case"keyup":case"keypress":p.isStoppable=!0,p.isCancelable=!0,p.preventDefault=!1,p.preventGesture=!1,p.stopPropagation=!1;break;case"pointerdown":p.isStoppable=!0,p.isCancelable=!0,p.preventDefault=!1,p.preventGesture=!g.hasGestureHandlers,p.stopPropagation=!1;break;case"pointerup":p.isStoppable=!0,p.isCancelable=!0,p.preventDefault=!1,p.preventGesture=!g.hasGestureHandlers,p.stopPropagation=!1;break;case"wheel":p.isStoppable=!0,p.isCancelable=!0,p.preventDefault=!1,p.preventGesture=!g.hasScrollHandler,p.stopPropagation=!1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":p.isStoppable=!0,p.isCancelable=!1,p.preventDefault=!1,p.preventGesture=!1,p.stopPropagation=!1;break;case"click":p.isStoppable=!0,p.isCancelable=!0,p.preventDefault=!!g.clickHandler,p.preventGesture=!1,p.stopPropagation=!1;break;case"dblclick":p.isStoppable=!0,p.isCancelable=!0,p.preventDefault=!!g.dblClickHandler,p.preventGesture=!1,p.stopPropagation=!1;break;case"focus":case"blur":case"pointerenter":case"pointerleave":default:p.isStoppable=!1,p.isCancelable=!1,p.preventDefault=!1,p.preventGesture=!1,p.stopPropagation=!1;break}}function w(g,p){p.eventSource=g,p.eventPhase=p.originalEvent&&typeof p.originalEvent.eventPhase<"u"?p.originalEvent.eventPhase:0,p.defaultPrevented=e.eventIsCanceled(p.originalEvent),p.shouldCapture=!1,p.shouldReleaseCapture=!1,p.userData=g.userData,d(g,p),g.preProcessEventHandler&&g.preProcessEventHandler(p)}function C(g,p,_){var b=g.getActivePointersListByType(p.type),k=b.getById(p.id);k?_&&!k.captured?(k.captured=!0,b.captureCount++):!_&&k.captured&&(k.captured=!1,b.captureCount--,b.captureCount<0&&(b.captureCount=0,e.console.warn("updatePointerCaptured() - pointsList.captureCount went negative"))):e.console.warn("updatePointerCaptured() called on untracked pointer")}function A(g,p,_){var b=g.getActivePointersListByType(_.type),k;k=b.getById(_.id),k?(k.insideElement=!0,k.lastPos=k.currentPos,k.lastTime=k.currentTime,k.currentPos=_.currentPos,k.currentTime=_.currentTime,_=k):(_.captured=!1,_.insideElementPressed=!1,_.insideElement=!0,V(b,_)),g.enterHandler&&g.enterHandler({eventSource:g,pointerType:_.type,position:x(_.currentPos,g.element),buttons:b.buttons,pointers:g.getActivePointerCount(),insideElementPressed:_.insideElementPressed,buttonDownAny:b.buttons!==0,isTouchEvent:_.type==="touch",originalEvent:p.originalEvent,userData:g.userData})}function O(g,p,_){var b=g.getActivePointersListByType(_.type),k,G;k=b.getById(_.id),k?(k.captured?(k.insideElement=!1,k.lastPos=k.currentPos,k.lastTime=k.currentTime,k.currentPos=_.currentPos,k.currentTime=_.currentTime):N(g,b,k),_=k):(_.captured=!1,_.insideElementPressed=!1),(g.leaveHandler||g.exitHandler)&&(G={eventSource:g,pointerType:_.type,position:_.currentPos&&x(_.currentPos,g.element),buttons:b.buttons,pointers:g.getActivePointerCount(),insideElementPressed:_.insideElementPressed,buttonDownAny:b.buttons!==0,isTouchEvent:_.type==="touch",originalEvent:p.originalEvent,userData:g.userData},g.leaveHandler&&g.leaveHandler(G),g.exitHandler&&g.exitHandler(G))}function B(g,p,_){var b,k;b=g.getActivePointersListByType(_.type),k=b.getById(_.id),k?_=k:(_.captured=!1,_.insideElementPressed=!1),g.overHandler&&g.overHandler({eventSource:g,pointerType:_.type,position:x(_.currentPos,g.element),buttons:b.buttons,pointers:g.getActivePointerCount(),insideElementPressed:_.insideElementPressed,buttonDownAny:b.buttons!==0,isTouchEvent:_.type==="touch",originalEvent:p.originalEvent,userData:g.userData})}function F(g,p,_){var b,k;b=g.getActivePointersListByType(_.type),k=b.getById(_.id),k?_=k:(_.captured=!1,_.insideElementPressed=!1),g.outHandler&&g.outHandler({eventSource:g,pointerType:_.type,position:_.currentPos&&x(_.currentPos,g.element),buttons:b.buttons,pointers:g.getActivePointerCount(),insideElementPressed:_.insideElementPressed,buttonDownAny:b.buttons!==0,isTouchEvent:_.type==="touch",originalEvent:p.originalEvent,userData:g.userData})}function W(g,p,_,b){var k=n[g.hash],G=g.getActivePointersListByType(_.type),J;if(typeof p.originalEvent.buttons<"u"?G.buttons=p.originalEvent.buttons:b===0?G.buttons|=1:b===1?G.buttons|=4:b===2?G.buttons|=2:b===3?G.buttons|=8:b===4?G.buttons|=16:b===5&&(G.buttons|=32),b!==0){p.shouldCapture=!1,p.shouldReleaseCapture=!1,g.nonPrimaryPressHandler&&!p.preventGesture&&!p.defaultPrevented&&(p.preventDefault=!0,g.nonPrimaryPressHandler({eventSource:g,pointerType:_.type,position:x(_.currentPos,g.element),button:b,buttons:G.buttons,isTouchEvent:_.type==="touch",originalEvent:p.originalEvent,userData:g.userData}));return}J=G.getById(_.id),J?(J.insideElementPressed=!0,J.insideElement=!0,J.originalTarget=p.originalEvent.target,J.contactPos=_.currentPos,J.contactTime=_.currentTime,J.lastPos=J.currentPos,J.lastTime=J.currentTime,J.currentPos=_.currentPos,J.currentTime=_.currentTime,_=J):(_.captured=!1,_.insideElementPressed=!0,_.insideElement=!0,_.originalTarget=p.originalEvent.target,V(G,_)),G.addContact(),!p.preventGesture&&!p.defaultPrevented?(p.shouldCapture=!0,p.shouldReleaseCapture=!1,p.preventDefault=!0,(g.dragHandler||g.dragEndHandler||g.pinchHandler)&&e.MouseTracker.gesturePointVelocityTracker.addPoint(g,_),G.contacts===1?g.pressHandler&&!p.preventGesture&&g.pressHandler({eventSource:g,pointerType:_.type,position:x(_.contactPos,g.element),buttons:G.buttons,isTouchEvent:_.type==="touch",originalEvent:p.originalEvent,userData:g.userData}):G.contacts===2&&g.pinchHandler&&_.type==="touch"&&(k.pinchGPoints=G.asArray(),k.lastPinchDist=k.currentPinchDist=k.pinchGPoints[0].currentPos.distanceTo(k.pinchGPoints[1].currentPos),k.lastPinchCenter=k.currentPinchCenter=E(k.pinchGPoints[0].currentPos,k.pinchGPoints[1].currentPos))):(p.shouldCapture=!1,p.shouldReleaseCapture=!1)}function Z(g,p,_,b){var k=n[g.hash],G=g.getActivePointersListByType(_.type),J,ve,re,He=!1,Fe;if(typeof p.originalEvent.buttons<"u"?G.buttons=p.originalEvent.buttons:b===0?G.buttons^=-2:b===1?G.buttons^=-5:b===2?G.buttons^=-3:b===3?G.buttons^=-9:b===4?G.buttons^=-17:b===5&&(G.buttons^=-33),p.shouldCapture=!1,b!==0){p.shouldReleaseCapture=!1,g.nonPrimaryReleaseHandler&&!p.preventGesture&&!p.defaultPrevented&&(p.preventDefault=!0,g.nonPrimaryReleaseHandler({eventSource:g,pointerType:_.type,position:x(_.currentPos,g.element),button:b,buttons:G.buttons,isTouchEvent:_.type==="touch",originalEvent:p.originalEvent,userData:g.userData}));return}re=G.getById(_.id),re?(G.removeContact(),re.captured&&(He=!0),re.lastPos=re.currentPos,re.lastTime=re.currentTime,re.currentPos=_.currentPos,re.currentTime=_.currentTime,re.insideElement||N(g,G,re),J=re.currentPos,ve=re.currentTime):(_.captured=!1,_.insideElementPressed=!1,_.insideElement=!0,V(G,_),re=_),!p.preventGesture&&!p.defaultPrevented&&(He?(p.shouldReleaseCapture=!0,p.preventDefault=!0,(g.dragHandler||g.dragEndHandler||g.pinchHandler)&&e.MouseTracker.gesturePointVelocityTracker.removePoint(g,re),G.contacts===0?(g.releaseHandler&&J&&g.releaseHandler({eventSource:g,pointerType:re.type,position:x(J,g.element),buttons:G.buttons,insideElementPressed:re.insideElementPressed,insideElementReleased:re.insideElement,isTouchEvent:re.type==="touch",originalEvent:p.originalEvent,userData:g.userData}),g.dragEndHandler&&k.sentDragEvent&&g.dragEndHandler({eventSource:g,pointerType:re.type,position:x(re.currentPos,g.element),speed:re.speed,direction:re.direction,shift:p.originalEvent.shiftKey,isTouchEvent:re.type==="touch",originalEvent:p.originalEvent,userData:g.userData}),k.sentDragEvent=!1,(g.clickHandler||g.dblClickHandler)&&re.insideElement&&(Fe=ve-re.contactTime<=g.clickTimeThreshold&&re.contactPos.distanceTo(J)<=g.clickDistThreshold,g.clickHandler&&g.clickHandler({eventSource:g,pointerType:re.type,position:x(re.currentPos,g.element),quick:Fe,shift:p.originalEvent.shiftKey,isTouchEvent:re.type==="touch",originalEvent:p.originalEvent,originalTarget:re.originalTarget,userData:g.userData}),g.dblClickHandler&&Fe&&(G.clicks++,G.clicks===1?(k.lastClickPos=J,k.dblClickTimeOut=setTimeout(function(){G.clicks=0},g.dblClickTimeThreshold)):G.clicks===2&&(clearTimeout(k.dblClickTimeOut),G.clicks=0,k.lastClickPos.distanceTo(J)<=g.dblClickDistThreshold&&g.dblClickHandler({eventSource:g,pointerType:re.type,position:x(re.currentPos,g.element),shift:p.originalEvent.shiftKey,isTouchEvent:re.type==="touch",originalEvent:p.originalEvent,userData:g.userData}),k.lastClickPos=null)))):G.contacts===2&&g.pinchHandler&&re.type==="touch"&&(k.pinchGPoints=G.asArray(),k.lastPinchDist=k.currentPinchDist=k.pinchGPoints[0].currentPos.distanceTo(k.pinchGPoints[1].currentPos),k.lastPinchCenter=k.currentPinchCenter=E(k.pinchGPoints[0].currentPos,k.pinchGPoints[1].currentPos))):(p.shouldReleaseCapture=!1,g.releaseHandler&&J&&(g.releaseHandler({eventSource:g,pointerType:re.type,position:x(J,g.element),buttons:G.buttons,insideElementPressed:re.insideElementPressed,insideElementReleased:re.insideElement,isTouchEvent:re.type==="touch",originalEvent:p.originalEvent,userData:g.userData}),p.preventDefault=!0)))}function ne(g,p,_){var b=n[g.hash],k=g.getActivePointersListByType(_.type),G,J,ve;if(typeof p.originalEvent.buttons<"u"&&(k.buttons=p.originalEvent.buttons),G=k.getById(_.id),G)G.lastPos=G.currentPos,G.lastTime=G.currentTime,G.currentPos=_.currentPos,G.currentTime=_.currentTime;else return;p.shouldCapture=!1,p.shouldReleaseCapture=!1,g.stopHandler&&_.type==="mouse"&&(clearTimeout(g.stopTimeOut),g.stopTimeOut=setTimeout(function(){ae(g,p.originalEvent,_.type)},g.stopDelay)),k.contacts===0?g.moveHandler&&g.moveHandler({eventSource:g,pointerType:_.type,position:x(_.currentPos,g.element),buttons:k.buttons,isTouchEvent:_.type==="touch",originalEvent:p.originalEvent,userData:g.userData}):k.contacts===1?(g.moveHandler&&(G=k.asArray()[0],g.moveHandler({eventSource:g,pointerType:G.type,position:x(G.currentPos,g.element),buttons:k.buttons,isTouchEvent:G.type==="touch",originalEvent:p.originalEvent,userData:g.userData})),g.dragHandler&&!p.preventGesture&&!p.defaultPrevented&&(G=k.asArray()[0],ve=G.currentPos.minus(G.lastPos),g.dragHandler({eventSource:g,pointerType:G.type,position:x(G.currentPos,g.element),buttons:k.buttons,delta:ve,speed:G.speed,direction:G.direction,shift:p.originalEvent.shiftKey,isTouchEvent:G.type==="touch",originalEvent:p.originalEvent,userData:g.userData}),p.preventDefault=!0,b.sentDragEvent=!0)):k.contacts===2&&(g.moveHandler&&(J=k.asArray(),g.moveHandler({eventSource:g,pointerType:J[0].type,position:x(E(J[0].currentPos,J[1].currentPos),g.element),buttons:k.buttons,isTouchEvent:J[0].type==="touch",originalEvent:p.originalEvent,userData:g.userData})),g.pinchHandler&&_.type==="touch"&&!p.preventGesture&&!p.defaultPrevented&&(ve=b.pinchGPoints[0].currentPos.distanceTo(b.pinchGPoints[1].currentPos),ve!==b.currentPinchDist&&(b.lastPinchDist=b.currentPinchDist,b.currentPinchDist=ve,b.lastPinchCenter=b.currentPinchCenter,b.currentPinchCenter=E(b.pinchGPoints[0].currentPos,b.pinchGPoints[1].currentPos),g.pinchHandler({eventSource:g,pointerType:"touch",gesturePoints:b.pinchGPoints,lastCenter:x(b.lastPinchCenter,g.element),center:x(b.currentPinchCenter,g.element),lastDistance:b.lastPinchDist,distance:b.currentPinchDist,shift:p.originalEvent.shiftKey,originalEvent:p.originalEvent,userData:g.userData}),p.preventDefault=!0)))}function X(g,p,_){var b=g.getActivePointersListByType(_.type),k;k=b.getById(_.id),k&&N(g,b,k)}function ae(g,p,_){g.stopHandler&&g.stopHandler({eventSource:g,pointerType:_,position:T(p,g.element),buttons:g.getActivePointersListByType(_).buttons,isTouchEvent:_==="touch",originalEvent:p,userData:g.userData})}}(i),function(e){e.ControlAnchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4,ABSOLUTE:5},e.Control=function(n,r,s){var o=n.parentNode;typeof r=="number"&&(e.console.error("Passing an anchor directly into the OpenSeadragon.Control constructor is deprecated; please use an options object instead. Support for this deprecated variant is scheduled for removal in December 2013"),r={anchor:r}),r.attachToViewer=typeof r.attachToViewer>"u"?!0:r.attachToViewer,this.autoFade=typeof r.autoFade>"u"?!0:r.autoFade,this.element=n,this.anchor=r.anchor,this.container=s,this.anchor===e.ControlAnchor.ABSOLUTE?(this.wrapper=e.makeNeutralElement("div"),this.wrapper.style.position="absolute",this.wrapper.style.top=typeof r.top=="number"?r.top+"px":r.top,this.wrapper.style.left=typeof r.left=="number"?r.left+"px":r.left,this.wrapper.style.height=typeof r.height=="number"?r.height+"px":r.height,this.wrapper.style.width=typeof r.width=="number"?r.width+"px":r.width,this.wrapper.style.margin="0px",this.wrapper.style.padding="0px",this.element.style.position="relative",this.element.style.top="0px",this.element.style.left="0px",this.element.style.height="100%",this.element.style.width="100%"):(this.wrapper=e.makeNeutralElement("div"),this.wrapper.style.display="inline-block",this.anchor===e.ControlAnchor.NONE&&(this.wrapper.style.width=this.wrapper.style.height="100%")),this.wrapper.appendChild(this.element),r.attachToViewer?this.anchor===e.ControlAnchor.TOP_RIGHT||this.anchor===e.ControlAnchor.BOTTOM_RIGHT?this.container.insertBefore(this.wrapper,this.container.firstChild):this.container.appendChild(this.wrapper):o.appendChild(this.wrapper)},e.Control.prototype={destroy:function(){this.wrapper.removeChild(this.element),this.anchor!==e.ControlAnchor.NONE&&this.container.removeChild(this.wrapper)},isVisible:function(){return this.wrapper.style.display!=="none"},setVisible:function(n){this.wrapper.style.display=n?this.anchor===e.ControlAnchor.ABSOLUTE?"block":"inline-block":"none"},setOpacity:function(n){e.setElementOpacity(this.wrapper,n,!0)}}}(i),function(e){e.ControlDock=function(r){var s=["topleft","topright","bottomright","bottomleft"],o,l;for(e.extend(!0,this,{id:"controldock-"+e.now()+"-"+Math.floor(Math.random()*1e6),container:e.makeNeutralElement("div"),controls:[]},r),this.container.onsubmit=function(){return!1},this.element&&(this.element=e.getElement(this.element),this.element.appendChild(this.container),e.getElementStyle(this.element).position==="static"&&(this.element.style.position="relative"),this.container.style.width="100%",this.container.style.height="100%"),l=0;l<s.length;l++)o=s[l],this.controls[o]=e.makeNeutralElement("div"),this.controls[o].style.position="absolute",o.match("left")&&(this.controls[o].style.left="0px"),o.match("right")&&(this.controls[o].style.right="0px"),o.match("top")&&(this.controls[o].style.top="0px"),o.match("bottom")&&(this.controls[o].style.bottom="0px");this.container.appendChild(this.controls.topleft),this.container.appendChild(this.controls.topright),this.container.appendChild(this.controls.bottomright),this.container.appendChild(this.controls.bottomleft)},e.ControlDock.prototype={addControl:function(r,s){r=e.getElement(r);var o=null;if(!(n(this,r)>=0)){switch(s.anchor){case e.ControlAnchor.TOP_RIGHT:o=this.controls.topright,r.style.position="relative",r.style.paddingRight="0px",r.style.paddingTop="0px";break;case e.ControlAnchor.BOTTOM_RIGHT:o=this.controls.bottomright,r.style.position="relative",r.style.paddingRight="0px",r.style.paddingBottom="0px";break;case e.ControlAnchor.BOTTOM_LEFT:o=this.controls.bottomleft,r.style.position="relative",r.style.paddingLeft="0px",r.style.paddingBottom="0px";break;case e.ControlAnchor.TOP_LEFT:o=this.controls.topleft,r.style.position="relative",r.style.paddingLeft="0px",r.style.paddingTop="0px";break;case e.ControlAnchor.ABSOLUTE:o=this.container,r.style.margin="0px",r.style.padding="0px";break;default:case e.ControlAnchor.NONE:o=this.container,r.style.margin="0px",r.style.padding="0px";break}this.controls.push(new e.Control(r,s,o)),r.style.display="inline-block"}},removeControl:function(r){r=e.getElement(r);var s=n(this,r);return s>=0&&(this.controls[s].destroy(),this.controls.splice(s,1)),this},clearControls:function(){for(;this.controls.length>0;)this.controls.pop().destroy();return this},areControlsEnabled:function(){var r;for(r=this.controls.length-1;r>=0;r--)if(this.controls[r].isVisible())return!0;return!1},setControlsEnabled:function(r){var s;for(s=this.controls.length-1;s>=0;s--)this.controls[s].setVisible(r);return this}};function n(r,s){var o=r.controls,l;for(l=o.length-1;l>=0;l--)if(o[l].element===s)return l;return-1}}(i),function(e){e.Placement=e.freezeObject({CENTER:0,TOP_LEFT:1,TOP:2,TOP_RIGHT:3,RIGHT:4,BOTTOM_RIGHT:5,BOTTOM:6,BOTTOM_LEFT:7,LEFT:8,properties:{0:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!1,isVerticallyCentered:!0,isBottom:!1},1:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!0,isVerticallyCentered:!1,isBottom:!1},2:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!0,isVerticallyCentered:!1,isBottom:!1},3:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!0,isVerticallyCentered:!1,isBottom:!1},4:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!1,isVerticallyCentered:!0,isBottom:!1},5:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!1,isVerticallyCentered:!1,isBottom:!0},6:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!1,isVerticallyCentered:!1,isBottom:!0},7:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!1,isVerticallyCentered:!1,isBottom:!0},8:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!1,isVerticallyCentered:!0,isBottom:!1}}})}(i),function(e){var n={},r=1;e.Viewer=function(d){var w=arguments,C=this,A;e.isPlainObject(d)||(d={id:w[0],xmlPath:w.length>1?w[1]:void 0,prefixUrl:w.length>2?w[2]:void 0,controls:w.length>3?w[3]:void 0,overlays:w.length>4?w[4]:void 0}),d.config&&(e.extend(!0,d,d.config),delete d.config);let O=["useCanvas"];if(d.drawerOptions=Object.assign({},O.reduce((F,W)=>(F[W]=d[W],delete d[W],F),{}),d.drawerOptions),e.extend(!0,this,{id:d.id,hash:d.hash||r++,initialPage:0,element:null,container:null,canvas:null,overlays:[],overlaysContainer:null,previousBody:[],customControls:[],source:null,drawer:null,world:null,viewport:null,navigator:null,collectionViewport:null,collectionDrawer:null,navImages:null,buttonGroup:null,profiler:null},e.DEFAULT_SETTINGS,d),typeof this.hash>"u")throw new Error("A hash must be defined, either by specifying options.id or options.hash.");typeof n[this.hash]<"u"&&e.console.warn("Hash "+this.hash+" has already been used."),n[this.hash]={fsBoundsDelta:new e.Point(1,1),prevContainerSize:null,animating:!1,forceRedraw:!1,needsResize:!1,forceResize:!1,mouseInside:!1,group:null,zooming:!1,zoomFactor:null,lastZoomTime:null,fullPage:!1,onfullscreenchange:null,lastClickTime:null,draggingToZoom:!1},this._sequenceIndex=0,this._firstOpen=!0,this._updateRequestId=null,this._loadQueue=[],this.currentOverlays=[],this._updatePixelDensityRatioBind=null,this._lastScrollTime=e.now(),e.EventSource.call(this),this.addHandler("open-failed",function(F){var W=e.getString("Errors.OpenFailed",F.eventSource,F.message);C._showMessage(W)}),e.ControlDock.call(this,d),this.xmlPath&&(this.tileSources=[this.xmlPath]),this.element=this.element||document.getElementById(this.id),this.canvas=e.makeNeutralElement("div"),this.canvas.className="openseadragon-canvas",function(F){F.width="100%",F.height="100%",F.overflow="hidden",F.position="absolute",F.top="0px",F.left="0px"}(this.canvas.style),e.setElementTouchActionNone(this.canvas),d.tabIndex!==""&&(this.canvas.tabIndex=d.tabIndex===void 0?0:d.tabIndex),this.container.className="openseadragon-container",function(F){F.width="100%",F.height="100%",F.position="relative",F.overflow="hidden",F.left="0px",F.top="0px",F.textAlign="left"}(this.container.style),e.setElementTouchActionNone(this.container),this.container.insertBefore(this.canvas,this.container.firstChild),this.element.appendChild(this.container),this.bodyWidth=document.body.style.width,this.bodyHeight=document.body.style.height,this.bodyOverflow=document.body.style.overflow,this.docOverflow=document.documentElement.style.overflow,this.innerTracker=new e.MouseTracker({userData:"Viewer.innerTracker",element:this.canvas,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,contextMenuHandler:e.delegate(this,T),keyDownHandler:e.delegate(this,x),keyHandler:e.delegate(this,E),clickHandler:e.delegate(this,M),dblClickHandler:e.delegate(this,L),dragHandler:e.delegate(this,U),dragEndHandler:e.delegate(this,K),enterHandler:e.delegate(this,q),leaveHandler:e.delegate(this,Y),pressHandler:e.delegate(this,te),releaseHandler:e.delegate(this,fe),nonPrimaryPressHandler:e.delegate(this,$),nonPrimaryReleaseHandler:e.delegate(this,j),scrollHandler:e.delegate(this,me),pinchHandler:e.delegate(this,ie),focusHandler:e.delegate(this,ce),blurHandler:e.delegate(this,ye)}),this.outerTracker=new e.MouseTracker({userData:"Viewer.outerTracker",element:this.container,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,enterHandler:e.delegate(this,pe),leaveHandler:e.delegate(this,oe)}),this.toolbar&&(this.toolbar=new e.ControlDock({element:this.toolbar})),this.bindStandardControls(),n[this.hash].prevContainerSize=s(this.container),window.ResizeObserver?(this._autoResizePolling=!1,this._resizeObserver=new ResizeObserver(function(){n[C.hash].needsResize=!0}),this._resizeObserver.observe(this.container,{})):this._autoResizePolling=!0,this.world=new e.World({viewer:this}),this.world.addHandler("add-item",function(F){C.source=C.world.getItemAt(0).source,n[C.hash].forceRedraw=!0,C._updateRequestId||(C._updateRequestId=u(C,Ae))}),this.world.addHandler("remove-item",function(F){C.world.getItemCount()?C.source=C.world.getItemAt(0).source:C.source=null,n[C.hash].forceRedraw=!0}),this.world.addHandler("metrics-change",function(F){C.viewport&&C.viewport._setContentBounds(C.world.getHomeBounds(),C.world.getContentFactor())}),this.world.addHandler("item-index-change",function(F){C.source=C.world.getItemAt(0).source}),this.viewport=new e.Viewport({containerSize:n[this.hash].prevContainerSize,springStiffness:this.springStiffness,animationTime:this.animationTime,minZoomImageRatio:this.minZoomImageRatio,maxZoomPixelRatio:this.maxZoomPixelRatio,visibilityRatio:this.visibilityRatio,wrapHorizontal:this.wrapHorizontal,wrapVertical:this.wrapVertical,defaultZoomLevel:this.defaultZoomLevel,minZoomLevel:this.minZoomLevel,maxZoomLevel:this.maxZoomLevel,viewer:this,degrees:this.degrees,flipped:this.flipped,overlayPreserveContentDirection:this.overlayPreserveContentDirection,navigatorRotate:this.navigatorRotate,homeFillsViewer:this.homeFillsViewer,margins:this.viewportMargins,silenceMultiImageWarnings:this.silenceMultiImageWarnings}),this.viewport._setContentBounds(this.world.getHomeBounds(),this.world.getContentFactor()),this.imageLoader=new e.ImageLoader({jobLimit:this.imageLoaderLimit,timeout:d.timeout,tileRetryMax:this.tileRetryMax,tileRetryDelay:this.tileRetryDelay}),this.tileCache=new e.TileCache({maxImageCacheCount:this.maxImageCacheCount}),Object.prototype.hasOwnProperty.call(this.drawerOptions,"useCanvas")&&(e.console.error('useCanvas is deprecated, use the "drawer" option to indicate preferred drawer(s)'),this.drawerOptions.useCanvas||(this.drawer=e.HTMLDrawer),delete this.drawerOptions.useCanvas);let B=Array.isArray(this.drawer)?this.drawer:[this.drawer];B.length===0&&(B=[e.DEFAULT_SETTINGS.drawer].flat(),e.console.warn("No valid drawers were selected. Using the default value.")),this.drawer=null;for(const F of B)if(this.requestDrawer(F,{mainDrawer:!0,redrawImmediately:!1}))break;if(!this.drawer)throw e.console.error("No drawer could be created!"),"Error with creating the selected drawer(s)";for(this.drawer.setImageSmoothingEnabled(this.imageSmoothingEnabled),this.overlaysContainer=e.makeNeutralElement("div"),this.canvas.appendChild(this.overlaysContainer),this.drawer.canRotate()||(this.rotateLeft&&(A=this.buttonGroup.buttons.indexOf(this.rotateLeft),this.buttonGroup.buttons.splice(A,1),this.buttonGroup.element.removeChild(this.rotateLeft.element)),this.rotateRight&&(A=this.buttonGroup.buttons.indexOf(this.rotateRight),this.buttonGroup.buttons.splice(A,1),this.buttonGroup.element.removeChild(this.rotateRight.element))),this._addUpdatePixelDensityRatioEvent(),this.showNavigator&&(this.navigator=new e.Navigator({element:this.navigatorElement,id:this.navigatorId,position:this.navigatorPosition,sizeRatio:this.navigatorSizeRatio,maintainSizeRatio:this.navigatorMaintainSizeRatio,top:this.navigatorTop,left:this.navigatorLeft,width:this.navigatorWidth,height:this.navigatorHeight,autoResize:this.navigatorAutoResize,autoFade:this.navigatorAutoFade,prefixUrl:this.prefixUrl,viewer:this,navigatorRotate:this.navigatorRotate,background:this.navigatorBackground,opacity:this.navigatorOpacity,borderColor:this.navigatorBorderColor,displayRegionColor:this.navigatorDisplayRegionColor,crossOriginPolicy:this.crossOriginPolicy,animationTime:this.animationTime,drawer:this.drawer.getType(),loadTilesWithAjax:this.loadTilesWithAjax,ajaxHeaders:this.ajaxHeaders,ajaxWithCredentials:this.ajaxWithCredentials})),this.sequenceMode&&this.bindSequenceControls(),this.tileSources&&this.open(this.tileSources),A=0;A<this.customControls.length;A++)this.addControl(this.customControls[A].id,{anchor:this.customControls[A].anchor});e.requestAnimationFrame(function(){h(C)}),e._viewers.set(this.element,this)},e.extend(e.Viewer.prototype,e.EventSource.prototype,e.ControlDock.prototype,{isOpen:function(){return!!this.world.getItemCount()},openDzi:function(d){return e.console.error("[Viewer.openDzi] this function is deprecated; use Viewer.open() instead."),this.open(d)},openTileSource:function(d){return e.console.error("[Viewer.openTileSource] this function is deprecated; use Viewer.open() instead."),this.open(d)},get buttons(){return e.console.warn("Viewer.buttons is deprecated; Please use Viewer.buttonGroup"),this.buttonGroup},open:function(d,w){var C=this;if(this.close(),!d)return this;if(this.sequenceMode&&e.isArray(d))return this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null),typeof w<"u"&&!isNaN(w)&&(this.initialPage=w),this.tileSources=d,this._sequenceIndex=Math.max(0,Math.min(this.tileSources.length-1,this.initialPage)),this.tileSources.length&&(this.open(this.tileSources[this._sequenceIndex]),this.showReferenceStrip&&this.addReferenceStrip()),this._updateSequenceButtons(this._sequenceIndex),this;if(e.isArray(d)||(d=[d]),!d.length)return this;this._opening=!0;for(var A=d.length,O=0,B=0,F,W=function(){if(O+B===A)if(O){(C._firstOpen||!C.preserveViewport)&&(C.viewport.goHome(!0),C.viewport.update()),C._firstOpen=!1;var X=d[0];if(X.tileSource&&(X=X.tileSource),C.overlays&&!C.preserveOverlays)for(var ae=0;ae<C.overlays.length;ae++)C.currentOverlays[ae]=l(C,C.overlays[ae]);C._drawOverlays(),C._opening=!1,C.raiseEvent("open",{source:X})}else C._opening=!1,C.raiseEvent("open-failed",F)},Z=function(X){(!e.isPlainObject(X)||!X.tileSource)&&(X={tileSource:X}),X.index!==void 0&&(e.console.error("[Viewer.open] setting indexes here is not supported; use addTiledImage instead"),delete X.index),X.collectionImmediately===void 0&&(X.collectionImmediately=!0);var ae=X.success;X.success=function(p){if(O++,X.tileSource.overlays)for(var _=0;_<X.tileSource.overlays.length;_++)C.addOverlay(X.tileSource.overlays[_]);ae&&ae(p),W()};var g=X.error;X.error=function(p){B++,F||(F=p),g&&g(p),W()},C.addTiledImage(X)},ne=0;ne<d.length;ne++)Z(d[ne]);return this},close:function(){return n[this.hash]?(this._opening=!1,this.navigator&&this.navigator.close(),this.preserveOverlays||(this.clearOverlays(),this.overlaysContainer.innerHTML=""),n[this.hash].animating=!1,this.world.removeAll(),this.imageLoader.clear(),this.raiseEvent("close"),this):this},destroy:function(){if(n[this.hash]){if(this.raiseEvent("before-destroy"),this._removeUpdatePixelDensityRatioEvent(),this.close(),this.clearOverlays(),this.overlaysContainer.innerHTML="",this._resizeObserver&&this._resizeObserver.disconnect(),this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null),this._updateRequestId!==null&&(e.cancelAnimationFrame(this._updateRequestId),this._updateRequestId=null),this.drawer&&this.drawer.destroy(),this.navigator&&(this.navigator.destroy(),n[this.navigator.hash]=null,delete n[this.navigator.hash],this.navigator=null),this.buttonGroup)this.buttonGroup.destroy();else if(this.customButtons)for(;this.customButtons.length;)this.customButtons.pop().destroy();if(this.paging&&this.paging.destroy(),this.element)for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.container.onsubmit=null,this.clearControls(),this.innerTracker&&this.innerTracker.destroy(),this.outerTracker&&this.outerTracker.destroy(),n[this.hash]=null,delete n[this.hash],this.canvas=null,this.container=null,e._viewers.delete(this.element),this.element=null,this.raiseEvent("destroy"),this.removeAllHandlers()}},requestDrawer(d,w){const C={mainDrawer:!0,redrawImmediately:!0,drawerOptions:null};w=e.extend(!0,C,w);const A=w.mainDrawer,O=w.redrawImmediately,B=w.drawerOptions,F=this.drawer;let W=null;if(d&&d.prototype instanceof e.DrawerBase?(W=d,d="custom"):typeof d=="string"&&(W=e.determineDrawer(d)),W||e.console.warn("Unsupported drawer! Drawer must be an existing string type, or a class that extends OpenSeadragon.DrawerBase."),W&&W.isSupported()){F&&A&&F.destroy();const Z=new W({viewer:this,viewport:this.viewport,element:this.canvas,debugGridColor:this.debugGridColor,options:B||this.drawerOptions[d]});return A&&(this.drawer=Z,O&&this.forceRedraw()),Z}return!1},isMouseNavEnabled:function(){return this.innerTracker.isTracking()},setMouseNavEnabled:function(d){return this.innerTracker.setTracking(d),this.outerTracker.setTracking(d),this.raiseEvent("mouse-enabled",{enabled:d}),this},areControlsEnabled:function(){var d=this.controls.length,w;for(w=0;w<this.controls.length;w++)d=d&&this.controls[w].isVisible();return d},setControlsEnabled:function(d){return d?m(this):h(this),this.raiseEvent("controls-enabled",{enabled:d}),this},setDebugMode:function(d){for(var w=0;w<this.world.getItemCount();w++)this.world.getItemAt(w).debugMode=d;this.debugMode=d,this.forceRedraw()},setAjaxHeaders:function(d,w){if(d===null&&(d={}),!e.isPlainObject(d)){console.error("[Viewer.setAjaxHeaders] Ignoring invalid headers, must be a plain object");return}if(w===void 0&&(w=!0),this.ajaxHeaders=d,w){for(var C=0;C<this.world.getItemCount();C++)this.world.getItemAt(C)._updateAjaxHeaders(!0);if(this.navigator&&this.navigator.setAjaxHeaders(this.ajaxHeaders,!0),this.referenceStrip&&this.referenceStrip.miniViewers)for(var A in this.referenceStrip.miniViewers)this.referenceStrip.miniViewers[A].setAjaxHeaders(this.ajaxHeaders,!0)}},addButton:function(d){this.buttonGroup.addButton(d)},isFullPage:function(){return n[this.hash]&&n[this.hash].fullPage},setFullPage:function(d){var w=document.body,C=w.style,A=document.documentElement.style,O=this,B,F;if(d===this.isFullPage())return this;var W={fullPage:d,preventDefaultAction:!1};if(this.raiseEvent("pre-full-page",W),W.preventDefaultAction)return this;if(d&&this.element){for(this.elementSize=e.getElementSize(this.element),this.pageScroll=e.getPageScroll(),this.elementMargin=this.element.style.margin,this.element.style.margin="0",this.elementPadding=this.element.style.padding,this.element.style.padding="0",this.bodyMargin=C.margin,this.docMargin=A.margin,C.margin="0",A.margin="0",this.bodyPadding=C.padding,this.docPadding=A.padding,C.padding="0",A.padding="0",this.bodyWidth=C.width,this.docWidth=A.width,C.width="100%",A.width="100%",this.bodyHeight=C.height,this.docHeight=A.height,C.height="100%",A.height="100%",this.bodyDisplay=C.display,C.display="block",this.previousBody=[],n[this.hash].prevElementParent=this.element.parentNode,n[this.hash].prevNextSibling=this.element.nextSibling,n[this.hash].prevElementWidth=this.element.style.width,n[this.hash].prevElementHeight=this.element.style.height,B=w.childNodes.length,F=0;F<B;F++)this.previousBody.push(w.childNodes[0]),w.removeChild(w.childNodes[0]);this.toolbar&&this.toolbar.element&&(this.toolbar.parentNode=this.toolbar.element.parentNode,this.toolbar.nextSibling=this.toolbar.element.nextSibling,w.appendChild(this.toolbar.element),e.addClass(this.toolbar.element,"fullpage")),e.addClass(this.element,"fullpage"),w.appendChild(this.element),this.element.style.height="100vh",this.element.style.width="100vw",this.toolbar&&this.toolbar.element&&(this.element.style.height=e.getElementSize(this.element).y-e.getElementSize(this.toolbar.element).y+"px"),n[this.hash].fullPage=!0,e.delegate(this,pe)({})}else{for(this.element.style.margin=this.elementMargin,this.element.style.padding=this.elementPadding,C.margin=this.bodyMargin,A.margin=this.docMargin,C.padding=this.bodyPadding,A.padding=this.docPadding,C.width=this.bodyWidth,A.width=this.docWidth,C.height=this.bodyHeight,A.height=this.docHeight,C.display=this.bodyDisplay,w.removeChild(this.element),B=this.previousBody.length,F=0;F<B;F++)w.appendChild(this.previousBody.shift());e.removeClass(this.element,"fullpage"),n[this.hash].prevElementParent.insertBefore(this.element,n[this.hash].prevNextSibling),this.toolbar&&this.toolbar.element&&(w.removeChild(this.toolbar.element),e.removeClass(this.toolbar.element,"fullpage"),this.toolbar.parentNode.insertBefore(this.toolbar.element,this.toolbar.nextSibling),delete this.toolbar.parentNode,delete this.toolbar.nextSibling),this.element.style.width=n[this.hash].prevElementWidth,this.element.style.height=n[this.hash].prevElementHeight;var Z=0,ne=function(){e.setPageScroll(O.pageScroll);var X=e.getPageScroll();Z++,Z<10&&(X.x!==O.pageScroll.x||X.y!==O.pageScroll.y)&&e.requestAnimationFrame(ne)};e.requestAnimationFrame(ne),n[this.hash].fullPage=!1,e.delegate(this,oe)({})}return this.navigator&&this.viewport&&this.navigator.update(this.viewport),this.raiseEvent("full-page",{fullPage:d}),this},setFullScreen:function(d){var w=this;if(!e.supportsFullScreen)return this.setFullPage(d);if(e.isFullScreen()===d)return this;var C={fullScreen:d,preventDefaultAction:!1};if(this.raiseEvent("pre-full-screen",C),C.preventDefaultAction)return this;if(d){if(this.setFullPage(!0),!this.isFullPage())return this;this.fullPageStyleWidth=this.element.style.width,this.fullPageStyleHeight=this.element.style.height,this.element.style.width="100%",this.element.style.height="100%";var A=function(){var O=e.isFullScreen();O||(e.removeEvent(document,e.fullScreenEventName,A),e.removeEvent(document,e.fullScreenErrorEventName,A),w.setFullPage(!1),w.isFullPage()&&(w.element.style.width=w.fullPageStyleWidth,w.element.style.height=w.fullPageStyleHeight)),w.navigator&&w.viewport&&setTimeout(function(){w.navigator.update(w.viewport)}),w.raiseEvent("full-screen",{fullScreen:O})};e.addEvent(document,e.fullScreenEventName,A),e.addEvent(document,e.fullScreenErrorEventName,A),e.requestFullScreen(document.body)}else e.exitFullScreen();return this},isVisible:function(){return this.container.style.visibility!=="hidden"},isFullScreen:function(){return e.isFullScreen()&&this.isFullPage()},setVisible:function(d){return this.container.style.visibility=d?"":"hidden",this.raiseEvent("visible",{visible:d}),this},addTiledImage:function(d){e.console.assert(d,"[Viewer.addTiledImage] options is required"),e.console.assert(d.tileSource,"[Viewer.addTiledImage] options.tileSource is required"),e.console.assert(!d.replace||d.index>-1&&d.index<this.world.getItemCount(),"[Viewer.addTiledImage] if options.replace is used, options.index must be a valid index in Viewer.world");var w=this;d.replace&&(d.replaceItem=w.world.getItemAt(d.index)),this._hideMessage(),d.placeholderFillStyle===void 0&&(d.placeholderFillStyle=this.placeholderFillStyle),d.opacity===void 0&&(d.opacity=this.opacity),d.preload===void 0&&(d.preload=this.preload),d.compositeOperation===void 0&&(d.compositeOperation=this.compositeOperation),d.crossOriginPolicy===void 0&&(d.crossOriginPolicy=d.tileSource.crossOriginPolicy!==void 0?d.tileSource.crossOriginPolicy:this.crossOriginPolicy),d.ajaxWithCredentials===void 0&&(d.ajaxWithCredentials=this.ajaxWithCredentials),d.loadTilesWithAjax===void 0&&(d.loadTilesWithAjax=this.loadTilesWithAjax),e.isPlainObject(d.ajaxHeaders)||(d.ajaxHeaders={});var C={options:d};function A(F){for(var W=0;W<w._loadQueue.length;W++)if(w._loadQueue[W]===C){w._loadQueue.splice(W,1);break}w._loadQueue.length===0&&O(C),w.raiseEvent("add-item-failed",F),d.error&&d.error(F)}function O(F){w.collectionMode&&(w.world.arrange({immediately:F.options.collectionImmediately,rows:w.collectionRows,columns:w.collectionColumns,layout:w.collectionLayout,tileSize:w.collectionTileSize,tileMargin:w.collectionTileMargin}),w.world.setAutoRefigureSizes(!0))}if(e.isArray(d.tileSource)){setTimeout(function(){A({message:"[Viewer.addTiledImage] Sequences can not be added; add them one at a time instead.",source:d.tileSource,options:d})});return}this._loadQueue.push(C);function B(){for(var F,W,Z;w._loadQueue.length&&(F=w._loadQueue[0],!!F.tileSource);){if(w._loadQueue.splice(0,1),F.options.replace){var ne=w.world.getIndexOfItem(F.options.replaceItem);ne!==-1&&(F.options.index=ne),w.world.removeItem(F.options.replaceItem)}W=new e.TiledImage({viewer:w,source:F.tileSource,viewport:w.viewport,drawer:w.drawer,tileCache:w.tileCache,imageLoader:w.imageLoader,x:F.options.x,y:F.options.y,width:F.options.width,height:F.options.height,fitBounds:F.options.fitBounds,fitBoundsPlacement:F.options.fitBoundsPlacement,clip:F.options.clip,placeholderFillStyle:F.options.placeholderFillStyle,opacity:F.options.opacity,preload:F.options.preload,degrees:F.options.degrees,flipped:F.options.flipped,compositeOperation:F.options.compositeOperation,springStiffness:w.springStiffness,animationTime:w.animationTime,minZoomImageRatio:w.minZoomImageRatio,wrapHorizontal:w.wrapHorizontal,wrapVertical:w.wrapVertical,maxTilesPerFrame:w.maxTilesPerFrame,immediateRender:w.immediateRender,blendTime:w.blendTime,alwaysBlend:w.alwaysBlend,minPixelRatio:w.minPixelRatio,smoothTileEdgesMinZoom:w.smoothTileEdgesMinZoom,iOSDevice:w.iOSDevice,crossOriginPolicy:F.options.crossOriginPolicy,ajaxWithCredentials:F.options.ajaxWithCredentials,loadTilesWithAjax:F.options.loadTilesWithAjax,ajaxHeaders:F.options.ajaxHeaders,debugMode:w.debugMode,subPixelRoundingForTransparency:w.subPixelRoundingForTransparency}),w.collectionMode&&w.world.setAutoRefigureSizes(!1),w.navigator&&(Z=e.extend({},F.options,{replace:!1,originalTiledImage:W,tileSource:F.tileSource}),w.navigator.addTiledImage(Z)),w.world.addItem(W,{index:F.options.index}),w._loadQueue.length===0&&O(F),w.world.getItemCount()===1&&!w.preserveViewport&&w.viewport.goHome(!0),F.options.success&&F.options.success({item:W})}}o(this,d.tileSource,d,function(F){C.tileSource=F,B()},function(F){F.options=d,A(F),B()})},addSimpleImage:function(d){e.console.assert(d,"[Viewer.addSimpleImage] options is required"),e.console.assert(d.url,"[Viewer.addSimpleImage] options.url is required");var w=e.extend({},d,{tileSource:{type:"image",url:d.url}});delete w.url,this.addTiledImage(w)},addLayer:function(d){var w=this;e.console.error("[Viewer.addLayer] this function is deprecated; use Viewer.addTiledImage() instead.");var C=e.extend({},d,{success:function(A){w.raiseEvent("add-layer",{options:d,drawer:A.item})},error:function(A){w.raiseEvent("add-layer-failed",A)}});return this.addTiledImage(C),this},getLayerAtLevel:function(d){return e.console.error("[Viewer.getLayerAtLevel] this function is deprecated; use World.getItemAt() instead."),this.world.getItemAt(d)},getLevelOfLayer:function(d){return e.console.error("[Viewer.getLevelOfLayer] this function is deprecated; use World.getIndexOfItem() instead."),this.world.getIndexOfItem(d)},getLayersCount:function(){return e.console.error("[Viewer.getLayersCount] this function is deprecated; use World.getItemCount() instead."),this.world.getItemCount()},setLayerLevel:function(d,w){return e.console.error("[Viewer.setLayerLevel] this function is deprecated; use World.setItemIndex() instead."),this.world.setItemIndex(d,w)},removeLayer:function(d){return e.console.error("[Viewer.removeLayer] this function is deprecated; use World.removeItem() instead."),this.world.removeItem(d)},forceRedraw:function(){return n[this.hash].forceRedraw=!0,this},forceResize:function(){n[this.hash].needsResize=!0,n[this.hash].forceResize=!0},bindSequenceControls:function(){var d=e.delegate(this,v),w=e.delegate(this,y),C=e.delegate(this,this.goToNextPage),A=e.delegate(this,this.goToPreviousPage),O=this.navImages,B=!0;return this.showSequenceControl&&((this.previousButton||this.nextButton)&&(B=!1),this.previousButton=new e.Button({element:this.previousButton?e.getElement(this.previousButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.PreviousPage"),srcRest:ge(this.prefixUrl,O.previous.REST),srcGroup:ge(this.prefixUrl,O.previous.GROUP),srcHover:ge(this.prefixUrl,O.previous.HOVER),srcDown:ge(this.prefixUrl,O.previous.DOWN),onRelease:A,onFocus:d,onBlur:w}),this.nextButton=new e.Button({element:this.nextButton?e.getElement(this.nextButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.NextPage"),srcRest:ge(this.prefixUrl,O.next.REST),srcGroup:ge(this.prefixUrl,O.next.GROUP),srcHover:ge(this.prefixUrl,O.next.HOVER),srcDown:ge(this.prefixUrl,O.next.DOWN),onRelease:C,onFocus:d,onBlur:w}),this.navPrevNextWrap||this.previousButton.disable(),(!this.tileSources||!this.tileSources.length)&&this.nextButton.disable(),B&&(this.paging=new e.ButtonGroup({buttons:[this.previousButton,this.nextButton],clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold}),this.pagingControl=this.paging.element,this.toolbar?this.toolbar.addControl(this.pagingControl,{anchor:e.ControlAnchor.BOTTOM_RIGHT}):this.addControl(this.pagingControl,{anchor:this.sequenceControlAnchor||e.ControlAnchor.TOP_LEFT}))),this},bindStandardControls:function(){var d=e.delegate(this,Wt),w=e.delegate(this,ot),C=e.delegate(this,Gt),A=e.delegate(this,jt),O=e.delegate(this,at),B=e.delegate(this,P),F=e.delegate(this,I),W=e.delegate(this,H),Z=e.delegate(this,V),ne=e.delegate(this,N),X=e.delegate(this,v),ae=e.delegate(this,y),g=this.navImages,p=[],_=!0;return this.showNavigationControl&&((this.zoomInButton||this.zoomOutButton||this.homeButton||this.fullPageButton||this.rotateLeftButton||this.rotateRightButton||this.flipButton)&&(_=!1),this.showZoomControl&&(p.push(this.zoomInButton=new e.Button({element:this.zoomInButton?e.getElement(this.zoomInButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.ZoomIn"),srcRest:ge(this.prefixUrl,g.zoomIn.REST),srcGroup:ge(this.prefixUrl,g.zoomIn.GROUP),srcHover:ge(this.prefixUrl,g.zoomIn.HOVER),srcDown:ge(this.prefixUrl,g.zoomIn.DOWN),onPress:d,onRelease:w,onClick:C,onEnter:d,onExit:w,onFocus:X,onBlur:ae})),p.push(this.zoomOutButton=new e.Button({element:this.zoomOutButton?e.getElement(this.zoomOutButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.ZoomOut"),srcRest:ge(this.prefixUrl,g.zoomOut.REST),srcGroup:ge(this.prefixUrl,g.zoomOut.GROUP),srcHover:ge(this.prefixUrl,g.zoomOut.HOVER),srcDown:ge(this.prefixUrl,g.zoomOut.DOWN),onPress:A,onRelease:w,onClick:O,onEnter:A,onExit:w,onFocus:X,onBlur:ae}))),this.showHomeControl&&p.push(this.homeButton=new e.Button({element:this.homeButton?e.getElement(this.homeButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.Home"),srcRest:ge(this.prefixUrl,g.home.REST),srcGroup:ge(this.prefixUrl,g.home.GROUP),srcHover:ge(this.prefixUrl,g.home.HOVER),srcDown:ge(this.prefixUrl,g.home.DOWN),onRelease:B,onFocus:X,onBlur:ae})),this.showFullPageControl&&p.push(this.fullPageButton=new e.Button({element:this.fullPageButton?e.getElement(this.fullPageButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.FullPage"),srcRest:ge(this.prefixUrl,g.fullpage.REST),srcGroup:ge(this.prefixUrl,g.fullpage.GROUP),srcHover:ge(this.prefixUrl,g.fullpage.HOVER),srcDown:ge(this.prefixUrl,g.fullpage.DOWN),onRelease:F,onFocus:X,onBlur:ae})),this.showRotationControl&&(p.push(this.rotateLeftButton=new e.Button({element:this.rotateLeftButton?e.getElement(this.rotateLeftButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.RotateLeft"),srcRest:ge(this.prefixUrl,g.rotateleft.REST),srcGroup:ge(this.prefixUrl,g.rotateleft.GROUP),srcHover:ge(this.prefixUrl,g.rotateleft.HOVER),srcDown:ge(this.prefixUrl,g.rotateleft.DOWN),onRelease:W,onFocus:X,onBlur:ae})),p.push(this.rotateRightButton=new e.Button({element:this.rotateRightButton?e.getElement(this.rotateRightButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.RotateRight"),srcRest:ge(this.prefixUrl,g.rotateright.REST),srcGroup:ge(this.prefixUrl,g.rotateright.GROUP),srcHover:ge(this.prefixUrl,g.rotateright.HOVER),srcDown:ge(this.prefixUrl,g.rotateright.DOWN),onRelease:Z,onFocus:X,onBlur:ae}))),this.showFlipControl&&p.push(this.flipButton=new e.Button({element:this.flipButton?e.getElement(this.flipButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.Flip"),srcRest:ge(this.prefixUrl,g.flip.REST),srcGroup:ge(this.prefixUrl,g.flip.GROUP),srcHover:ge(this.prefixUrl,g.flip.HOVER),srcDown:ge(this.prefixUrl,g.flip.DOWN),onRelease:ne,onFocus:X,onBlur:ae})),_?(this.buttonGroup=new e.ButtonGroup({buttons:p,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold}),this.navControl=this.buttonGroup.element,this.addHandler("open",e.delegate(this,si)),this.toolbar?this.toolbar.addControl(this.navControl,{anchor:this.navigationControlAnchor||e.ControlAnchor.TOP_LEFT}):this.addControl(this.navControl,{anchor:this.navigationControlAnchor||e.ControlAnchor.TOP_LEFT})):this.customButtons=p),this},currentPage:function(){return this._sequenceIndex},goToPage:function(d){return this.tileSources&&d>=0&&d<this.tileSources.length&&(this._sequenceIndex=d,this._updateSequenceButtons(d),this.open(this.tileSources[d]),this.referenceStrip&&this.referenceStrip.setFocus(d),this.raiseEvent("page",{page:d})),this},addOverlay:function(d,w,C,A){var O;if(e.isPlainObject(d)?O=d:O={element:d,location:w,placement:C,onDraw:A},d=e.getElement(O.element),a(this.currentOverlays,d)>=0)return this;var B=l(this,O);return this.currentOverlays.push(B),B.drawHTML(this.overlaysContainer,this.viewport),this.raiseEvent("add-overlay",{element:d,location:O.location,placement:O.placement}),this},updateOverlay:function(d,w,C){var A;return d=e.getElement(d),A=a(this.currentOverlays,d),A>=0&&(this.currentOverlays[A].update(w,C),n[this.hash].forceRedraw=!0,this.raiseEvent("update-overlay",{element:d,location:w,placement:C})),this},removeOverlay:function(d){var w;return d=e.getElement(d),w=a(this.currentOverlays,d),w>=0&&(this.currentOverlays[w].destroy(),this.currentOverlays.splice(w,1),n[this.hash].forceRedraw=!0,this.raiseEvent("remove-overlay",{element:d})),this},clearOverlays:function(){for(;this.currentOverlays.length>0;)this.currentOverlays.pop().destroy();return n[this.hash].forceRedraw=!0,this.raiseEvent("clear-overlay",{}),this},getOverlayById:function(d){var w;return d=e.getElement(d),w=a(this.currentOverlays,d),w>=0?this.currentOverlays[w]:null},_updateSequenceButtons:function(d){this.nextButton&&(!this.tileSources||this.tileSources.length-1===d?this.navPrevNextWrap||this.nextButton.disable():this.nextButton.enable()),this.previousButton&&(d>0?this.previousButton.enable():this.navPrevNextWrap||this.previousButton.disable())},_showMessage:function(d){this._hideMessage();var w=e.makeNeutralElement("div");w.appendChild(document.createTextNode(d)),this.messageDiv=e.makeCenteredNode(w),e.addClass(this.messageDiv,"openseadragon-message"),this.container.appendChild(this.messageDiv)},_hideMessage:function(){var d=this.messageDiv;d&&(d.parentNode.removeChild(d),delete this.messageDiv)},gestureSettingsByDeviceType:function(d){switch(d){case"mouse":return this.gestureSettingsMouse;case"touch":return this.gestureSettingsTouch;case"pen":return this.gestureSettingsPen;default:return this.gestureSettingsUnknown}},_drawOverlays:function(){var d,w=this.currentOverlays.length;for(d=0;d<w;d++)this.currentOverlays[d].drawHTML(this.overlaysContainer,this.viewport)},_cancelPendingImages:function(){this._loadQueue=[]},removeReferenceStrip:function(){this.showReferenceStrip=!1,this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null)},addReferenceStrip:function(){if(this.showReferenceStrip=!0,this.sequenceMode){if(this.referenceStrip)return;this.tileSources.length&&this.tileSources.length>1&&(this.referenceStrip=new e.ReferenceStrip({id:this.referenceStripElement,position:this.referenceStripPosition,sizeRatio:this.referenceStripSizeRatio,scroll:this.referenceStripScroll,height:this.referenceStripHeight,width:this.referenceStripWidth,tileSources:this.tileSources,prefixUrl:this.prefixUrl,viewer:this}),this.referenceStrip.setFocus(this._sequenceIndex))}else e.console.warn('Attempting to display a reference strip while "sequenceMode" is off.')},_addUpdatePixelDensityRatioEvent:function(){this._updatePixelDensityRatioBind=this._updatePixelDensityRatio.bind(this),e.addEvent(window,"resize",this._updatePixelDensityRatioBind)},_removeUpdatePixelDensityRatioEvent:function(){e.removeEvent(window,"resize",this._updatePixelDensityRatioBind)},_updatePixelDensityRatio:function(){var d=e.pixelDensityRatio,w=e.getCurrentPixelDensityRatio();d!==w&&(e.pixelDensityRatio=w,this.forceResize())},goToPreviousPage:function(){var d=this._sequenceIndex-1;this.navPrevNextWrap&&d<0&&(d+=this.tileSources.length),this.goToPage(d)},goToNextPage:function(){var d=this._sequenceIndex+1;this.navPrevNextWrap&&d>=this.tileSources.length&&(d=0),this.goToPage(d)},isAnimating:function(){return n[this.hash].animating}});function s(d){return d=e.getElement(d),new e.Point(d.clientWidth===0?1:d.clientWidth,d.clientHeight===0?1:d.clientHeight)}function o(d,w,C,A,O){var B=d;if(e.type(w)==="string"){if(w.match(/^\s*<.*>\s*$/))w=e.parseXml(w);else if(w.match(/^\s*[{[].*[}\]]\s*$/))try{var F=e.parseJSON(w);w=F}catch{}}function W(Z,ne){Z.ready?A(Z):(Z.addHandler("ready",function(){A(Z)}),Z.addHandler("open-failed",function(X){O({message:X.message,source:ne})}))}setTimeout(function(){if(e.type(w)==="string")w=new e.TileSource({url:w,crossOriginPolicy:C.crossOriginPolicy!==void 0?C.crossOriginPolicy:d.crossOriginPolicy,ajaxWithCredentials:d.ajaxWithCredentials,ajaxHeaders:C.ajaxHeaders?C.ajaxHeaders:d.ajaxHeaders,splitHashDataForPost:d.splitHashDataForPost,success:function(ae){A(ae.tileSource)}}),w.addHandler("open-failed",function(ae){O(ae)});else if(e.isPlainObject(w)||w.nodeType)if(w.crossOriginPolicy===void 0&&(C.crossOriginPolicy!==void 0||d.crossOriginPolicy!==void 0)&&(w.crossOriginPolicy=C.crossOriginPolicy!==void 0?C.crossOriginPolicy:d.crossOriginPolicy),w.ajaxWithCredentials===void 0&&(w.ajaxWithCredentials=d.ajaxWithCredentials),e.isFunction(w.getTileUrl)){var Z=new e.TileSource(w);Z.getTileUrl=w.getTileUrl,A(Z)}else{var ne=e.TileSource.determineType(B,w);if(!ne){O({message:"Unable to load TileSource",source:w});return}var X=ne.prototype.configure.apply(B,[w]);W(new ne(X),w)}else W(w,w)})}function l(d,w){if(w instanceof e.Overlay)return w;var C=null;if(w.element)C=e.getElement(w.element);else{var A=w.id?w.id:"openseadragon-overlay-"+Math.floor(Math.random()*1e7);C=e.getElement(w.id),C||(C=document.createElement("a"),C.href="#/overlay/"+A),C.id=A,e.addClass(C,w.className?w.className:"openseadragon-overlay")}var O=w.location,B=w.width,F=w.height;if(!O){var W=w.x,Z=w.y;if(w.px!==void 0){var ne=d.viewport.imageToViewportRectangle(new e.Rect(w.px,w.py,B||0,F||0));W=ne.x,Z=ne.y,B=B!==void 0?ne.width:void 0,F=F!==void 0?ne.height:void 0}O=new e.Point(W,Z)}var X=w.placement;return X&&e.type(X)==="string"&&(X=e.Placement[w.placement.toUpperCase()]),new e.Overlay({element:C,location:O,placement:X,onDraw:w.onDraw,checkResize:w.checkResize,width:B,height:F,rotationMode:w.rotationMode})}function a(d,w){var C;for(C=d.length-1;C>=0;C--)if(d[C].element===w)return C;return-1}function u(d,w){return e.requestAnimationFrame(function(){w(d)})}function c(d){e.requestAnimationFrame(function(){f(d)})}function h(d){d.autoHideControls&&(d.controlsShouldFade=!0,d.controlsFadeBeginTime=e.now()+d.controlsFadeDelay,window.setTimeout(function(){c(d)},d.controlsFadeDelay))}function f(d){var w,C,A,O;if(d.controlsShouldFade){for(w=e.now(),C=w-d.controlsFadeBeginTime,A=1-C/d.controlsFadeLength,A=Math.min(1,A),A=Math.max(0,A),O=d.controls.length-1;O>=0;O--)d.controls[O].autoFade&&d.controls[O].setOpacity(A);A>0&&c(d)}}function m(d){var w;for(d.controlsShouldFade=!1,w=d.controls.length-1;w>=0;w--)d.controls[w].setOpacity(1)}function v(){m(this)}function y(){h(this)}function T(d){var w={tracker:d.eventSource,position:d.position,originalEvent:d.originalEvent,preventDefault:d.preventDefault};this.raiseEvent("canvas-contextmenu",w),d.preventDefault=w.preventDefault}function x(d){var w={originalEvent:d.originalEvent,preventDefaultAction:!1,preventVerticalPan:d.preventVerticalPan||!this.panVertical,preventHorizontalPan:d.preventHorizontalPan||!this.panHorizontal};if(this.raiseEvent("canvas-key",w),!w.preventDefaultAction&&!d.ctrl&&!d.alt&&!d.meta)switch(d.keyCode){case 38:w.preventVerticalPan||(d.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-this.pixelsPerArrowPress))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 40:w.preventVerticalPan||(d.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,this.pixelsPerArrowPress))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 37:w.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 39:w.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 187:this.viewport.zoomBy(1.1),this.viewport.applyConstraints(),d.preventDefault=!0;break;case 189:this.viewport.zoomBy(.9),this.viewport.applyConstraints(),d.preventDefault=!0;break;case 48:this.viewport.goHome(),this.viewport.applyConstraints(),d.preventDefault=!0;break;case 87:w.preventVerticalPan||(d.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-40))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 83:w.preventVerticalPan||(d.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,40))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 65:w.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-40,0))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 68:w.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(40,0))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 82:d.shift?this.viewport.flipped?this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement):this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement):this.viewport.flipped?this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement):this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement),this.viewport.applyConstraints(),d.preventDefault=!0;break;case 70:this.viewport.toggleFlip(),d.preventDefault=!0;break;case 74:this.goToPreviousPage();break;case 75:this.goToNextPage();break;default:d.preventDefault=!1;break}else d.preventDefault=!1}function E(d){var w={originalEvent:d.originalEvent};this.raiseEvent("canvas-key-press",w)}function M(d){var w,C=document.activeElement===this.canvas;C||this.canvas.focus(),this.viewport.flipped&&(d.position.x=this.viewport.getContainerSize().x-d.position.x);var A={tracker:d.eventSource,position:d.position,quick:d.quick,shift:d.shift,originalEvent:d.originalEvent,originalTarget:d.originalTarget,preventDefaultAction:!1};this.raiseEvent("canvas-click",A),!A.preventDefaultAction&&this.viewport&&d.quick&&(w=this.gestureSettingsByDeviceType(d.pointerType),w.clickToZoom===!0&&(this.viewport.zoomBy(d.shift?1/this.zoomPerClick:this.zoomPerClick,w.zoomToRefPoint?this.viewport.pointFromPixel(d.position,!0):null),this.viewport.applyConstraints()),w.dblClickDragToZoom&&(n[this.hash].draggingToZoom===!0?(n[this.hash].lastClickTime=null,n[this.hash].draggingToZoom=!1):n[this.hash].lastClickTime=e.now()))}function L(d){var w,C={tracker:d.eventSource,position:d.position,shift:d.shift,originalEvent:d.originalEvent,preventDefaultAction:!1};this.raiseEvent("canvas-double-click",C),!C.preventDefaultAction&&this.viewport&&(w=this.gestureSettingsByDeviceType(d.pointerType),w.dblClickToZoom&&(this.viewport.zoomBy(d.shift?1/this.zoomPerClick:this.zoomPerClick,w.zoomToRefPoint?this.viewport.pointFromPixel(d.position,!0):null),this.viewport.applyConstraints()))}function U(d){var w,C={tracker:d.eventSource,pointerType:d.pointerType,position:d.position,delta:d.delta,speed:d.speed,direction:d.direction,shift:d.shift,originalEvent:d.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag",C),w=this.gestureSettingsByDeviceType(d.pointerType),!C.preventDefaultAction&&this.viewport){if(w.dblClickDragToZoom&&n[this.hash].draggingToZoom){var A=Math.pow(this.zoomPerDblClickDrag,d.delta.y/50);this.viewport.zoomBy(A)}else if(w.dragToPan&&!n[this.hash].draggingToZoom){if(this.panHorizontal||(d.delta.x=0),this.panVertical||(d.delta.y=0),this.viewport.flipped&&(d.delta.x=-d.delta.x),this.constrainDuringPan){var O=this.viewport.deltaPointsFromPixels(d.delta.negate());this.viewport.centerSpringX.target.value+=O.x,this.viewport.centerSpringY.target.value+=O.y;var B=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=O.x,this.viewport.centerSpringY.target.value-=O.y,B.xConstrained&&(d.delta.x=0),B.yConstrained&&(d.delta.y=0)}this.viewport.panBy(this.viewport.deltaPointsFromPixels(d.delta.negate()),w.flickEnabled&&!this.constrainDuringPan)}}}function K(d){var w,C={tracker:d.eventSource,pointerType:d.pointerType,position:d.position,speed:d.speed,direction:d.direction,shift:d.shift,originalEvent:d.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag-end",C),w=this.gestureSettingsByDeviceType(d.pointerType),!C.preventDefaultAction&&this.viewport){if(!n[this.hash].draggingToZoom&&w.dragToPan&&w.flickEnabled&&d.speed>=w.flickMinSpeed){var A=0;this.panHorizontal&&(A=w.flickMomentum*d.speed*Math.cos(d.direction));var O=0;this.panVertical&&(O=w.flickMomentum*d.speed*Math.sin(d.direction));var B=this.viewport.pixelFromPoint(this.viewport.getCenter(!0)),F=this.viewport.pointFromPixel(new e.Point(B.x-A,B.y-O));this.viewport.panTo(F,!1)}this.viewport.applyConstraints()}w.dblClickDragToZoom&&n[this.hash].draggingToZoom===!0&&(n[this.hash].draggingToZoom=!1)}function q(d){this.raiseEvent("canvas-enter",{tracker:d.eventSource,pointerType:d.pointerType,position:d.position,buttons:d.buttons,pointers:d.pointers,insideElementPressed:d.insideElementPressed,buttonDownAny:d.buttonDownAny,originalEvent:d.originalEvent})}function Y(d){this.raiseEvent("canvas-exit",{tracker:d.eventSource,pointerType:d.pointerType,position:d.position,buttons:d.buttons,pointers:d.pointers,insideElementPressed:d.insideElementPressed,buttonDownAny:d.buttonDownAny,originalEvent:d.originalEvent})}function te(d){var w;if(this.raiseEvent("canvas-press",{tracker:d.eventSource,pointerType:d.pointerType,position:d.position,insideElementPressed:d.insideElementPressed,insideElementReleased:d.insideElementReleased,originalEvent:d.originalEvent}),w=this.gestureSettingsByDeviceType(d.pointerType),w.dblClickDragToZoom){var C=n[this.hash].lastClickTime,A=e.now();if(C===null)return;A-C<this.dblClickTimeThreshold&&(n[this.hash].draggingToZoom=!0),n[this.hash].lastClickTime=null}}function fe(d){this.raiseEvent("canvas-release",{tracker:d.eventSource,pointerType:d.pointerType,position:d.position,insideElementPressed:d.insideElementPressed,insideElementReleased:d.insideElementReleased,originalEvent:d.originalEvent})}function $(d){this.raiseEvent("canvas-nonprimary-press",{tracker:d.eventSource,position:d.position,pointerType:d.pointerType,button:d.button,buttons:d.buttons,originalEvent:d.originalEvent})}function j(d){this.raiseEvent("canvas-nonprimary-release",{tracker:d.eventSource,position:d.position,pointerType:d.pointerType,button:d.button,buttons:d.buttons,originalEvent:d.originalEvent})}function ie(d){var w,C,A,O,B={tracker:d.eventSource,pointerType:d.pointerType,gesturePoints:d.gesturePoints,lastCenter:d.lastCenter,center:d.center,lastDistance:d.lastDistance,distance:d.distance,shift:d.shift,originalEvent:d.originalEvent,preventDefaultPanAction:!1,preventDefaultZoomAction:!1,preventDefaultRotateAction:!1};if(this.raiseEvent("canvas-pinch",B),this.viewport&&(w=this.gestureSettingsByDeviceType(d.pointerType),w.pinchToZoom&&(!B.preventDefaultPanAction||!B.preventDefaultZoomAction)&&(C=this.viewport.pointFromPixel(d.center,!0),w.zoomToRefPoint&&!B.preventDefaultPanAction&&(A=this.viewport.pointFromPixel(d.lastCenter,!0),O=A.minus(C),this.panHorizontal||(O.x=0),this.panVertical||(O.y=0),this.viewport.panBy(O,!0)),B.preventDefaultZoomAction||this.viewport.zoomBy(d.distance/d.lastDistance,C,!0),this.viewport.applyConstraints()),w.pinchRotate&&!B.preventDefaultRotateAction)){var F=Math.atan2(d.gesturePoints[0].currentPos.y-d.gesturePoints[1].currentPos.y,d.gesturePoints[0].currentPos.x-d.gesturePoints[1].currentPos.x),W=Math.atan2(d.gesturePoints[0].lastPos.y-d.gesturePoints[1].lastPos.y,d.gesturePoints[0].lastPos.x-d.gesturePoints[1].lastPos.x);C=this.viewport.pointFromPixel(d.center,!0),this.viewport.rotateTo(this.viewport.getRotation(!0)+(F-W)*(180/Math.PI),C,!0)}}function ce(d){this.raiseEvent("canvas-focus",{tracker:d.eventSource,originalEvent:d.originalEvent})}function ye(d){this.raiseEvent("canvas-blur",{tracker:d.eventSource,originalEvent:d.originalEvent})}function me(d){var w,C,A,O,B;O=e.now(),B=O-this._lastScrollTime,B>this.minScrollDeltaTime?(this._lastScrollTime=O,w={tracker:d.eventSource,position:d.position,scroll:d.scroll,shift:d.shift,originalEvent:d.originalEvent,preventDefaultAction:!1,preventDefault:!0},this.raiseEvent("canvas-scroll",w),!w.preventDefaultAction&&this.viewport&&(this.viewport.flipped&&(d.position.x=this.viewport.getContainerSize().x-d.position.x),C=this.gestureSettingsByDeviceType(d.pointerType),C.scrollToZoom&&(A=Math.pow(this.zoomPerScroll,d.scroll),this.viewport.zoomBy(A,C.zoomToRefPoint?this.viewport.pointFromPixel(d.position,!0):null),this.viewport.applyConstraints())),d.preventDefault=w.preventDefault):d.preventDefault=!0}function pe(d){n[this.hash].mouseInside=!0,m(this),this.raiseEvent("container-enter",{tracker:d.eventSource,pointerType:d.pointerType,position:d.position,buttons:d.buttons,pointers:d.pointers,insideElementPressed:d.insideElementPressed,buttonDownAny:d.buttonDownAny,originalEvent:d.originalEvent})}function oe(d){d.pointers<1&&(n[this.hash].mouseInside=!1,n[this.hash].animating||h(this)),this.raiseEvent("container-exit",{tracker:d.eventSource,pointerType:d.pointerType,position:d.position,buttons:d.buttons,pointers:d.pointers,insideElementPressed:d.insideElementPressed,buttonDownAny:d.buttonDownAny,originalEvent:d.originalEvent})}function Ae(d){et(d),d.isOpen()?d._updateRequestId=u(d,Ae):d._updateRequestId=!1}function De(d,w){var C=d.viewport,A=C.getZoom(),O=C.getCenter();C.resize(w,d.preserveImageSizeOnResize),C.panTo(O,!0);var B;if(d.preserveImageSizeOnResize)B=n[d.hash].prevContainerSize.x/w.x;else{var F=new e.Point(0,0),W=new e.Point(n[d.hash].prevContainerSize.x,n[d.hash].prevContainerSize.y).distanceTo(F),Z=new e.Point(w.x,w.y).distanceTo(F);B=Z/W*n[d.hash].prevContainerSize.x/w.x}C.zoomTo(A*B,null,!0),n[d.hash].prevContainerSize=w,n[d.hash].forceRedraw=!0,n[d.hash].needsResize=!1,n[d.hash].forceResize=!1}function et(d){if(!(d._opening||!n[d.hash])){if(d.autoResize||n[d.hash].forceResize){var w;if(d._autoResizePolling){w=s(d.container);var C=n[d.hash].prevContainerSize;w.equals(C)||(n[d.hash].needsResize=!0)}n[d.hash].needsResize&&De(d,w||s(d.container))}var A=d.viewport.update(),O=d.world.update(A)||A;A&&d.raiseEvent("viewport-change"),d.referenceStrip&&(O=d.referenceStrip.update(d.viewport)||O);var B=n[d.hash].animating;!B&&O&&(d.raiseEvent("animation-start"),m(d));var F=B&&!O;F&&(n[d.hash].animating=!1),(O||F||n[d.hash].forceRedraw||d.world.needsDraw())&&(qe(d),d._drawOverlays(),d.navigator&&d.navigator.update(d.viewport),n[d.hash].forceRedraw=!1,O&&d.raiseEvent("animation")),F&&(d.raiseEvent("animation-finish"),n[d.hash].mouseInside||h(d)),n[d.hash].animating=O}}function qe(d){d.imageLoader.clear(),d.world.draw(),d.raiseEvent("update-viewport",{})}function ge(d,w){return d?d+w:w}function Wt(){n[this.hash].lastZoomTime=e.now(),n[this.hash].zoomFactor=this.zoomPerSecond,n[this.hash].zooming=!0,tt(this)}function jt(){n[this.hash].lastZoomTime=e.now(),n[this.hash].zoomFactor=1/this.zoomPerSecond,n[this.hash].zooming=!0,tt(this)}function ot(){n[this.hash].zooming=!1}function tt(d){e.requestAnimationFrame(e.delegate(d,Rt))}function Rt(){var d,w,C;n[this.hash].zooming&&this.viewport&&(d=e.now(),w=d-n[this.hash].lastZoomTime,C=Math.pow(n[this.hash].zoomFactor,w/1e3),this.viewport.zoomBy(C),this.viewport.applyConstraints(),n[this.hash].lastZoomTime=d,tt(this))}function Gt(){this.viewport&&(n[this.hash].zooming=!1,this.viewport.zoomBy(this.zoomPerClick/1),this.viewport.applyConstraints())}function at(){this.viewport&&(n[this.hash].zooming=!1,this.viewport.zoomBy(1/this.zoomPerClick),this.viewport.applyConstraints())}function si(){this.buttonGroup&&(this.buttonGroup.emulateEnter(),this.buttonGroup.emulateLeave())}function P(){this.viewport&&this.viewport.goHome()}function I(){this.isFullPage()&&!e.isFullScreen()?this.setFullPage(!1):this.setFullScreen(!this.isFullPage()),this.buttonGroup&&this.buttonGroup.emulateLeave(),this.fullPageButton.element.focus(),this.viewport&&this.viewport.applyConstraints()}function H(){if(this.viewport){var d=this.viewport.getRotation();this.viewport.flipped?d+=this.rotationIncrement:d-=this.rotationIncrement,this.viewport.setRotation(d)}}function V(){if(this.viewport){var d=this.viewport.getRotation();this.viewport.flipped?d-=this.rotationIncrement:d+=this.rotationIncrement,this.viewport.setRotation(d)}}function N(){this.viewport.toggleFlip()}e.determineDrawer=function(d){for(let w in i){const C=i[w],A=C.prototype;if(A&&A instanceof i.DrawerBase&&e.isFunction(A.getType)&&A.getType.call(C)===d)return C}return null}}(i),function(e){e.Navigator=function(u){var c=u.viewer,h=this,f,m;u.element||u.id?(u.element?(u.id&&e.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead."),u.element.id?u.id=u.element.id:u.id="navigator-"+e.now(),this.element=u.element):this.element=document.getElementById(u.id),u.controlOptions={anchor:e.ControlAnchor.NONE,attachToViewer:!1,autoFade:!1}):(u.id="navigator-"+e.now(),this.element=e.makeNeutralElement("div"),u.controlOptions={anchor:e.ControlAnchor.TOP_RIGHT,attachToViewer:!0,autoFade:u.autoFade},u.position&&(u.position==="BOTTOM_RIGHT"?u.controlOptions.anchor=e.ControlAnchor.BOTTOM_RIGHT:u.position==="BOTTOM_LEFT"?u.controlOptions.anchor=e.ControlAnchor.BOTTOM_LEFT:u.position==="TOP_RIGHT"?u.controlOptions.anchor=e.ControlAnchor.TOP_RIGHT:u.position==="TOP_LEFT"?u.controlOptions.anchor=e.ControlAnchor.TOP_LEFT:u.position==="ABSOLUTE"&&(u.controlOptions.anchor=e.ControlAnchor.ABSOLUTE,u.controlOptions.top=u.top,u.controlOptions.left=u.left,u.controlOptions.height=u.height,u.controlOptions.width=u.width))),this.element.id=u.id,this.element.className+=" navigator",u=e.extend(!0,{sizeRatio:e.DEFAULT_SETTINGS.navigatorSizeRatio},u,{element:this.element,tabIndex:-1,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:u.animationTime,autoResize:!1,minZoomImageRatio:1,background:u.background,opacity:u.opacity,borderColor:u.borderColor,displayRegionColor:u.displayRegionColor}),u.minPixelRatio=this.minPixelRatio=c.minPixelRatio,e.setElementTouchActionNone(this.element),this.borderWidth=2,this.fudge=new e.Point(1,1),this.totalBorderWidths=new e.Point(this.borderWidth*2,this.borderWidth*2).minus(this.fudge),u.controlOptions.anchor!==e.ControlAnchor.NONE&&function(T,x){T.margin="0px",T.border=x+"px solid "+u.borderColor,T.padding="0px",T.background=u.background,T.opacity=u.opacity,T.overflow="hidden"}(this.element.style,this.borderWidth),this.displayRegion=e.makeNeutralElement("div"),this.displayRegion.id=this.element.id+"-displayregion",this.displayRegion.className="displayregion",function(T,x){T.position="relative",T.top="0px",T.left="0px",T.fontSize="0px",T.overflow="hidden",T.border=x+"px solid "+u.displayRegionColor,T.margin="0px",T.padding="0px",T.background="transparent",T.float="left",T.cssFloat="left",T.zIndex=999999999,T.cursor="default",T.boxSizing="content-box"}(this.displayRegion.style,this.borderWidth),e.setElementPointerEventsNone(this.displayRegion),e.setElementTouchActionNone(this.displayRegion),this.displayRegionContainer=e.makeNeutralElement("div"),this.displayRegionContainer.id=this.element.id+"-displayregioncontainer",this.displayRegionContainer.className="displayregioncontainer",this.displayRegionContainer.style.width="100%",this.displayRegionContainer.style.height="100%",e.setElementPointerEventsNone(this.displayRegionContainer),e.setElementTouchActionNone(this.displayRegionContainer),c.addControl(this.element,u.controlOptions),this._resizeWithViewer=u.controlOptions.anchor!==e.ControlAnchor.ABSOLUTE&&u.controlOptions.anchor!==e.ControlAnchor.NONE,u.width&&u.height?(this.setWidth(u.width),this.setHeight(u.height)):this._resizeWithViewer&&(f=e.getElementSize(c.element),this.element.style.height=Math.round(f.y*u.sizeRatio)+"px",this.element.style.width=Math.round(f.x*u.sizeRatio)+"px",this.oldViewerSize=f,m=e.getElementSize(this.element),this.elementArea=m.x*m.y),this.oldContainerSize=new e.Point(0,0),e.Viewer.apply(this,[u]),this.displayRegionContainer.appendChild(this.displayRegion),this.element.getElementsByTagName("div")[0].appendChild(this.displayRegionContainer);function v(T,x){l(h.displayRegionContainer,T),l(h.displayRegion,-T),h.viewport.setRotation(T,x)}if(u.navigatorRotate){var y=u.viewer.viewport?u.viewer.viewport.getRotation():u.viewer.degrees||0;v(y,!0),u.viewer.addHandler("rotate",function(T){v(T.degrees,T.immediately)})}this.innerTracker.destroy(),this.innerTracker=new e.MouseTracker({userData:"Navigator.innerTracker",element:this.element,dragHandler:e.delegate(this,r),clickHandler:e.delegate(this,n),releaseHandler:e.delegate(this,s),scrollHandler:e.delegate(this,o),preProcessEventHandler:function(T){T.eventType==="wheel"&&(T.preventDefault=!0)}}),this.outerTracker.userData="Navigator.outerTracker",e.setElementPointerEventsNone(this.canvas),e.setElementPointerEventsNone(this.container),this.addHandler("reset-size",function(){h.viewport&&h.viewport.goHome(!0)}),c.world.addHandler("item-index-change",function(T){window.setTimeout(function(){var x=h.world.getItemAt(T.previousIndex);h.world.setItemIndex(x,T.newIndex)},1)}),c.world.addHandler("remove-item",function(T){var x=T.item,E=h._getMatchingItem(x);E&&h.world.removeItem(E)}),this.update(c.viewport)},e.extend(e.Navigator.prototype,e.EventSource.prototype,e.Viewer.prototype,{updateSize:function(){if(this.viewport){var u=new e.Point(this.container.clientWidth===0?1:this.container.clientWidth,this.container.clientHeight===0?1:this.container.clientHeight);u.equals(this.oldContainerSize)||(this.viewport.resize(u,!0),this.viewport.goHome(!0),this.oldContainerSize=u,this.world.update(),this.world.draw(),this.update(this.viewer.viewport))}},setWidth:function(u){this.width=u,this.element.style.width=typeof u=="number"?u+"px":u,this._resizeWithViewer=!1,this.updateSize()},setHeight:function(u){this.height=u,this.element.style.height=typeof u=="number"?u+"px":u,this._resizeWithViewer=!1,this.updateSize()},setFlip:function(u){return this.viewport.setFlip(u),this.setDisplayTransform(this.viewer.viewport.getFlip()?"scale(-1,1)":"scale(1,1)"),this},setDisplayTransform:function(u){a(this.canvas,u),a(this.element,u)},update:function(u){var c,h,f,m,v,y;if(u||(u=this.viewer.viewport),c=e.getElementSize(this.viewer.element),this._resizeWithViewer&&c.x&&c.y&&!c.equals(this.oldViewerSize)&&(this.oldViewerSize=c,this.maintainSizeRatio||!this.elementArea?(h=c.x*this.sizeRatio,f=c.y*this.sizeRatio):(h=Math.sqrt(this.elementArea*(c.x/c.y)),f=this.elementArea/h),this.element.style.width=Math.round(h)+"px",this.element.style.height=Math.round(f)+"px",this.elementArea||(this.elementArea=h*f),this.updateSize()),u&&this.viewport){if(m=u.getBoundsNoRotate(!0),v=this.viewport.pixelFromPointNoRotate(m.getTopLeft(),!1),y=this.viewport.pixelFromPointNoRotate(m.getBottomRight(),!1).minus(this.totalBorderWidths),!this.navigatorRotate){var T=u.getRotation(!0);l(this.displayRegion,-T)}var x=this.displayRegion.style;x.display=this.world.getItemCount()?"block":"none",x.top=v.y.toFixed(2)+"px",x.left=v.x.toFixed(2)+"px";var E=y.x-v.x,M=y.y-v.y;x.width=Math.round(Math.max(E,0))+"px",x.height=Math.round(Math.max(M,0))+"px"}},addTiledImage:function(u){var c=this,h=u.originalTiledImage;delete u.original;var f=e.extend({},u,{success:function(m){var v=m.item;v._originalForNavigator=h,c._matchBounds(v,h,!0),c._matchOpacity(v,h),c._matchCompositeOperation(v,h);function y(){c._matchBounds(v,h)}function T(){c._matchOpacity(v,h)}function x(){c._matchCompositeOperation(v,h)}h.addHandler("bounds-change",y),h.addHandler("clip-change",y),h.addHandler("opacity-change",T),h.addHandler("composite-operation-change",x)}});return e.Viewer.prototype.addTiledImage.apply(this,[f])},destroy:function(){return e.Viewer.prototype.destroy.apply(this)},_getMatchingItem:function(u){for(var c=this.world.getItemCount(),h,f=0;f<c;f++)if(h=this.world.getItemAt(f),h._originalForNavigator===u)return h;return null},_matchBounds:function(u,c,h){var f=c.getBoundsNoRotate();u.setPosition(f.getTopLeft(),h),u.setWidth(f.width,h),u.setRotation(c.getRotation(),h),u.setClip(c.getClip()),u.setFlip(c.getFlip())},_matchOpacity:function(u,c){u.setOpacity(c.opacity)},_matchCompositeOperation:function(u,c){u.setCompositeOperation(c.compositeOperation)}});function n(u){var c={tracker:u.eventSource,position:u.position,quick:u.quick,shift:u.shift,originalEvent:u.originalEvent,preventDefaultAction:!1};if(this.viewer.raiseEvent("navigator-click",c),!c.preventDefaultAction&&u.quick&&this.viewer.viewport&&(this.panVertical||this.panHorizontal)){this.viewer.viewport.flipped&&(u.position.x=this.viewport.getContainerSize().x-u.position.x);var h=this.viewport.pointFromPixel(u.position);this.panVertical?this.panHorizontal||(h.x=this.viewer.viewport.getCenter(!0).x):h.y=this.viewer.viewport.getCenter(!0).y,this.viewer.viewport.panTo(h),this.viewer.viewport.applyConstraints()}}function r(u){var c={tracker:u.eventSource,position:u.position,delta:u.delta,speed:u.speed,direction:u.direction,shift:u.shift,originalEvent:u.originalEvent,preventDefaultAction:!1};this.viewer.raiseEvent("navigator-drag",c),!c.preventDefaultAction&&this.viewer.viewport&&(this.panHorizontal||(u.delta.x=0),this.panVertical||(u.delta.y=0),this.viewer.viewport.flipped&&(u.delta.x=-u.delta.x),this.viewer.viewport.panBy(this.viewport.deltaPointsFromPixels(u.delta)),this.viewer.constrainDuringPan&&this.viewer.viewport.applyConstraints())}function s(u){u.insideElementPressed&&this.viewer.viewport&&this.viewer.viewport.applyConstraints()}function o(u){var c={tracker:u.eventSource,position:u.position,scroll:u.scroll,shift:u.shift,originalEvent:u.originalEvent,preventDefault:u.preventDefault};this.viewer.raiseEvent("navigator-scroll",c),u.preventDefault=c.preventDefault}function l(u,c){a(u,"rotate("+c+"deg)")}function a(u,c){u.style.webkitTransform=c,u.style.mozTransform=c,u.style.msTransform=c,u.style.oTransform=c,u.style.transform=c}}(i),function(e){var n={Errors:{Dzc:"Sorry, we don't support Deep Zoom Collections!",Dzi:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",Xml:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",ImageFormat:"Sorry, we don't support {0}-based Deep Zoom Images.",Security:"It looks like a security restriction stopped us from loading this Deep Zoom Image.",Status:"This space unintentionally left blank ({0} {1}).",OpenFailed:"Unable to open {0}: {1}"},Tooltips:{FullPage:"Toggle full page",Home:"Go home",ZoomIn:"Zoom in",ZoomOut:"Zoom out",NextPage:"Next page",PreviousPage:"Previous page",RotateLeft:"Rotate left",RotateRight:"Rotate right",Flip:"Flip Horizontally"}};e.extend(e,{getString:function(r){var s=r.split("."),o=null,l=arguments,a=n,u;for(u=0;u<s.length-1;u++)a=a[s[u]]||{};return o=a[s[u]],typeof o!="string"&&(e.console.error("Untranslated source string:",r),o=""),o.replace(/\{\d+\}/g,function(c){var h=parseInt(c.match(/\d+/),10)+1;return h<l.length?l[h]:""})},setString:function(r,s){var o=r.split("."),l=n,a;for(a=0;a<o.length-1;a++)l[o[a]]||(l[o[a]]={}),l=l[o[a]];l[o[a]]=s}})}(i),function(e){e.Point=function(n,r){this.x=typeof n=="number"?n:0,this.y=typeof r=="number"?r:0},e.Point.prototype={clone:function(){return new e.Point(this.x,this.y)},plus:function(n){return new e.Point(this.x+n.x,this.y+n.y)},minus:function(n){return new e.Point(this.x-n.x,this.y-n.y)},times:function(n){return new e.Point(this.x*n,this.y*n)},divide:function(n){return new e.Point(this.x/n,this.y/n)},negate:function(){return new e.Point(-this.x,-this.y)},distanceTo:function(n){return Math.sqrt(Math.pow(this.x-n.x,2)+Math.pow(this.y-n.y,2))},squaredDistanceTo:function(n){return Math.pow(this.x-n.x,2)+Math.pow(this.y-n.y,2)},apply:function(n){return new e.Point(n(this.x),n(this.y))},equals:function(n){return n instanceof e.Point&&this.x===n.x&&this.y===n.y},rotate:function(n,r){r=r||new e.Point(0,0);var s,o;if(n%90===0){var l=e.positiveModulo(n,360);switch(l){case 0:s=1,o=0;break;case 90:s=0,o=1;break;case 180:s=-1,o=0;break;case 270:s=0,o=-1;break}}else{var a=n*Math.PI/180;s=Math.cos(a),o=Math.sin(a)}var u=s*(this.x-r.x)-o*(this.y-r.y)+r.x,c=o*(this.x-r.x)+s*(this.y-r.y)+r.y;return new e.Point(u,c)},toString:function(){return"("+Math.round(this.x*100)/100+","+Math.round(this.y*100)/100+")"}}}(i),function(e){e.TileSource=function(r,s,o,l,a,u){var c=this,h=arguments,f,m;if(e.isPlainObject(r)?f=r:f={width:h[0],height:h[1],tileSize:h[2],tileOverlap:h[3],minLevel:h[4],maxLevel:h[5]},e.EventSource.call(this),e.extend(!0,this,f),!this.success){for(m=0;m<arguments.length;m++)if(e.isFunction(arguments[m])){this.success=arguments[m];break}}this.success&&this.addHandler("ready",function(v){c.success(v)}),e.type(arguments[0])==="string"&&(this.url=arguments[0]),this.url?(this.aspectRatio=1,this.dimensions=new e.Point(10,10),this._tileWidth=0,this._tileHeight=0,this.tileOverlap=0,this.minLevel=0,this.maxLevel=0,this.ready=!1,this.getImageInfo(this.url)):(this.ready=!0,this.aspectRatio=f.width&&f.height?f.width/f.height:1,this.dimensions=new e.Point(f.width,f.height),this.tileSize?(this._tileWidth=this._tileHeight=this.tileSize,delete this.tileSize):(this.tileWidth?(this._tileWidth=this.tileWidth,delete this.tileWidth):this._tileWidth=0,this.tileHeight?(this._tileHeight=this.tileHeight,delete this.tileHeight):this._tileHeight=0),this.tileOverlap=f.tileOverlap?f.tileOverlap:0,this.minLevel=f.minLevel?f.minLevel:0,this.maxLevel=f.maxLevel!==void 0&&f.maxLevel!==null?f.maxLevel:f.width&&f.height?Math.ceil(Math.log(Math.max(f.width,f.height))/Math.log(2)):0,this.success&&e.isFunction(this.success)&&this.success(this))},e.TileSource.prototype={getTileSize:function(r){return e.console.error("[TileSource.getTileSize] is deprecated. Use TileSource.getTileWidth() and TileSource.getTileHeight() instead"),this._tileWidth},getTileWidth:function(r){return this._tileWidth?this._tileWidth:this.getTileSize(r)},getTileHeight:function(r){return this._tileHeight?this._tileHeight:this.getTileSize(r)},setMaxLevel:function(r){this.maxLevel=r,this._memoizeLevelScale()},getLevelScale:function(r){return this._memoizeLevelScale(),this.getLevelScale(r)},_memoizeLevelScale:function(){var r={},s;for(s=0;s<=this.maxLevel;s++)r[s]=1/Math.pow(2,this.maxLevel-s);this.getLevelScale=function(o){return r[o]}},getNumTiles:function(r){var s=this.getLevelScale(r),o=Math.ceil(s*this.dimensions.x/this.getTileWidth(r)),l=Math.ceil(s*this.dimensions.y/this.getTileHeight(r));return new e.Point(o,l)},getPixelRatio:function(r){var s=this.dimensions.times(this.getLevelScale(r)),o=1/s.x*e.pixelDensityRatio,l=1/s.y*e.pixelDensityRatio;return new e.Point(o,l)},getClosestLevel:function(){var r,s;for(r=this.minLevel+1;r<=this.maxLevel&&(s=this.getNumTiles(r),!(s.x>1||s.y>1));r++);return r-1},getTileAtPoint:function(r,s){var o=s.x>=0&&s.x<=1&&s.y>=0&&s.y<=1/this.aspectRatio;e.console.assert(o,"[TileSource.getTileAtPoint] must be called with a valid point.");var l=this.dimensions.x*this.getLevelScale(r),a=s.x*l,u=s.y*l,c=Math.floor(a/this.getTileWidth(r)),h=Math.floor(u/this.getTileHeight(r));s.x>=1&&(c=this.getNumTiles(r).x-1);var f=1e-15;return s.y>=1/this.aspectRatio-f&&(h=this.getNumTiles(r).y-1),new e.Point(c,h)},getTileBounds:function(r,s,o,l){var a=this.dimensions.times(this.getLevelScale(r)),u=this.getTileWidth(r),c=this.getTileHeight(r),h=s===0?0:u*s-this.tileOverlap,f=o===0?0:c*o-this.tileOverlap,m=u+(s===0?1:2)*this.tileOverlap,v=c+(o===0?1:2)*this.tileOverlap,y=1/a.x;return m=Math.min(m,a.x-h),v=Math.min(v,a.y-f),l?new e.Rect(0,0,m,v):new e.Rect(h*y,f*y,m*y,v*y)},getImageInfo:function(r){var s=this,o,l,a,u,c,h,f;r&&(c=r.split("/"),h=c[c.length-1],f=h.lastIndexOf("."),f>-1&&(c[c.length-1]=h.slice(0,f)));var m=null;if(this.splitHashDataForPost){var v=r.indexOf("#");v!==-1&&(m=r.substring(v+1),r=r.substr(0,v))}l=function(y){typeof y=="string"&&(y=e.parseXml(y));var T=e.TileSource.determineType(s,y,r);if(!T){s.raiseEvent("open-failed",{message:"Unable to load TileSource",source:r});return}u=T.prototype.configure.apply(s,[y,r,m]),u.ajaxWithCredentials===void 0&&(u.ajaxWithCredentials=s.ajaxWithCredentials),a=new T(u),s.ready=!0,s.raiseEvent("ready",{tileSource:a})},r.match(/\.js$/)?(o=r.split("/").pop().replace(".js",""),e.jsonp({url:r,async:!1,callbackName:o,callback:l})):e.makeAjaxRequest({url:r,postData:m,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(y){var T=n(y);l(T)},error:function(y,T){var x;try{x="HTTP "+y.status+" attempting to load TileSource: "+r}catch{var E;typeof T>"u"||!T.toString?E="Unknown error":E=T.toString(),x=E+" attempting to load TileSource: "+r}e.console.error(x),s.raiseEvent("open-failed",{message:x,source:r,postData:m})}})},supports:function(r,s){return!1},configure:function(r,s,o){throw new Error("Method not implemented.")},getTileUrl:function(r,s,o){throw new Error("Method not implemented.")},getTilePostData:function(r,s,o){return null},getTileAjaxHeaders:function(r,s,o){return{}},getTileHashKey:function(r,s,o,l,a,u){function c(h){return a?h+"+"+JSON.stringify(a):h}return c(typeof l!="string"?r+"/"+s+"_"+o:l)},tileExists:function(r,s,o){var l=this.getNumTiles(r);return r>=this.minLevel&&r<=this.maxLevel&&s>=0&&o>=0&&s<l.x&&o<l.y},hasTransparency:function(r,s,o,l){return!!r||s.match(".png")},downloadTileStart:function(r){var s=r.userData,o=new Image;s.image=o,s.request=null;var l=function(a){if(!o){r.finish(null,s.request,"Image load failed: undefined Image instance.");return}o.onload=o.onerror=o.onabort=null,r.finish(a?null:o,s.request,a)};o.onload=function(){l()},o.onabort=o.onerror=function(){l("Image load aborted.")},r.loadWithAjax?s.request=e.makeAjaxRequest({url:r.src,withCredentials:r.ajaxWithCredentials,headers:r.ajaxHeaders,responseType:"arraybuffer",postData:r.postData,success:function(a){var u;try{u=new window.Blob([a.response])}catch(f){var c=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(f.name==="TypeError"&&c){var h=new c;h.append(a.response),u=h.getBlob()}}u.size===0?l("Empty image response."):o.src=(window.URL||window.webkitURL).createObjectURL(u)},error:function(a){l("Image load aborted - XHR error")}}):(r.crossOriginPolicy!==!1&&(o.crossOrigin=r.crossOriginPolicy),o.src=r.src)},downloadTileAbort:function(r){r.userData.request&&r.userData.request.abort();var s=r.userData.image;r.userData.image&&(s.onload=s.onerror=s.onabort=null)},createTileCache:function(r,s,o){r._data=s},destroyTileCache:function(r){r._data=null,r._renderedContext=null},getTileCacheData:function(r){return r._data},getTileCacheDataAsImage:function(r){return r._data},getTileCacheDataAsContext2D:function(r){if(!r._renderedContext){var s=document.createElement("canvas");s.width=r._data.width,s.height=r._data.height,r._renderedContext=s.getContext("2d"),r._renderedContext.drawImage(r._data,0,0),r._data=null}return r._renderedContext}},e.extend(!0,e.TileSource.prototype,e.EventSource.prototype);function n(r){var s=r.responseText,o=r.status,l,a;if(r){if(r.status!==200&&r.status!==0)throw o=r.status,l=o===404?"Not Found":r.statusText,new Error(e.getString("Errors.Status",o,l))}else throw new Error(e.getString("Errors.Security"));if(s.match(/^\s*<.*/))try{a=r.responseXML&&r.responseXML.documentElement?r.responseXML:e.parseXml(s)}catch{a=r.responseText}else if(s.match(/\s*[{[].*/))try{a=e.parseJSON(s)}catch{a=s}else a=s;return a}e.TileSource.determineType=function(r,s,o){var l;for(l in i)if(l.match(/.+TileSource$/)&&e.isFunction(i[l])&&e.isFunction(i[l].prototype.supports)&&i[l].prototype.supports.call(r,s,o))return i[l];return e.console.error("No TileSource was able to open %s %s",o,s),null}}(i),function(e){e.DziTileSource=function(s,o,l,a,u,c,h,f,m){var v,y,T,x;if(e.isPlainObject(s)?x=s:x={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4],fileFormat:arguments[5],displayRects:arguments[6],minLevel:arguments[7],maxLevel:arguments[8]},this._levelRects={},this.tilesUrl=x.tilesUrl,this.fileFormat=x.fileFormat,this.displayRects=x.displayRects,this.displayRects)for(v=this.displayRects.length-1;v>=0;v--)for(y=this.displayRects[v],T=y.minLevel;T<=y.maxLevel;T++)this._levelRects[T]||(this._levelRects[T]=[]),this._levelRects[T].push(y);e.TileSource.apply(this,[x])},e.extend(e.DziTileSource.prototype,e.TileSource.prototype,{supports:function(s,o){var l;return s.Image?l=s.Image.xmlns:s.documentElement&&(s.documentElement.localName==="Image"||s.documentElement.tagName==="Image")&&(l=s.documentElement.namespaceURI),l=(l||"").toLowerCase(),l.indexOf("schemas.microsoft.com/deepzoom/2008")!==-1||l.indexOf("schemas.microsoft.com/deepzoom/2009")!==-1},configure:function(s,o,l){var a;return e.isPlainObject(s)?a=r(this,s):a=n(this,s),o&&!a.tilesUrl&&(a.tilesUrl=o.replace(/([^/]+?)(\.(dzi|xml|js)?(\?[^/]*)?)?\/?$/,"$1_files/"),o.search(/\.(dzi|xml|js)\?/)!==-1?a.queryParams=o.match(/\?.*/):a.queryParams=""),a},getTileUrl:function(s,o,l){return[this.tilesUrl,s,"/",o,"_",l,".",this.fileFormat,this.queryParams].join("")},tileExists:function(s,o,l){var a=this._levelRects[s],u,c,h,f,m,v,y;if(this.minLevel&&s<this.minLevel||this.maxLevel&&s>this.maxLevel)return!1;if(!a||!a.length)return!0;for(y=a.length-1;y>=0;y--)if(u=a[y],!(s<u.minLevel||s>u.maxLevel)&&(c=this.getLevelScale(s),h=u.x*c,f=u.y*c,m=h+u.width*c,v=f+u.height*c,h=Math.floor(h/this._tileWidth),f=Math.floor(f/this._tileWidth),m=Math.ceil(m/this._tileWidth),v=Math.ceil(v/this._tileWidth),h<=o&&o<m&&f<=l&&l<v))return!0;return!1}});function n(s,o){if(!o||!o.documentElement)throw new Error(e.getString("Errors.Xml"));var l=o.documentElement,a=l.localName||l.tagName,u=o.documentElement.namespaceURI,c=null,h=[],f,m,v,y,T;if(a==="Image")try{if(y=l.getElementsByTagName("Size")[0],y===void 0&&(y=l.getElementsByTagNameNS(u,"Size")[0]),c={Image:{xmlns:"http://schemas.microsoft.com/deepzoom/2008",Url:l.getAttribute("Url"),Format:l.getAttribute("Format"),DisplayRect:null,Overlap:parseInt(l.getAttribute("Overlap"),10),TileSize:parseInt(l.getAttribute("TileSize"),10),Size:{Height:parseInt(y.getAttribute("Height"),10),Width:parseInt(y.getAttribute("Width"),10)}}},!e.imageFormatSupported(c.Image.Format))throw new Error(e.getString("Errors.ImageFormat",c.Image.Format.toUpperCase()));for(f=l.getElementsByTagName("DisplayRect"),f===void 0&&(f=l.getElementsByTagNameNS(u,"DisplayRect")[0]),T=0;T<f.length;T++)m=f[T],v=m.getElementsByTagName("Rect")[0],v===void 0&&(v=m.getElementsByTagNameNS(u,"Rect")[0]),h.push({Rect:{X:parseInt(v.getAttribute("X"),10),Y:parseInt(v.getAttribute("Y"),10),Width:parseInt(v.getAttribute("Width"),10),Height:parseInt(v.getAttribute("Height"),10),MinLevel:parseInt(m.getAttribute("MinLevel"),10),MaxLevel:parseInt(m.getAttribute("MaxLevel"),10)}});return h.length&&(c.Image.DisplayRect=h),r(s,c)}catch(M){throw M instanceof Error?M:new Error(e.getString("Errors.Dzi"))}else{if(a==="Collection")throw new Error(e.getString("Errors.Dzc"));if(a==="Error"){var x=l.getElementsByTagName("Message")[0],E=x.firstChild.nodeValue;throw new Error(E)}}throw new Error(e.getString("Errors.Dzi"))}function r(s,o){var l=o.Image,a=l.Url,u=l.Format,c=l.Size,h=l.DisplayRect||[],f=parseInt(c.Width,10),m=parseInt(c.Height,10),v=parseInt(l.TileSize,10),y=parseInt(l.Overlap,10),T=[],x,E;for(E=0;E<h.length;E++)x=h[E].Rect,T.push(new e.DisplayRect(parseInt(x.X,10),parseInt(x.Y,10),parseInt(x.Width,10),parseInt(x.Height,10),parseInt(x.MinLevel,10),parseInt(x.MaxLevel,10)));return e.extend(!0,{width:f,height:m,tileSize:v,tileOverlap:y,minLevel:null,maxLevel:null,tilesUrl:a,fileFormat:u,displayRects:T},o)}}(i),function(e){e.IIIFTileSource=function(l){if(e.extend(!0,this,l),this._id=this["@id"]||this.id||this.identifier||null,!(this.height&&this.width&&this._id))throw new Error("IIIF required parameters (width, height, or id) not provided.");if(l.tileSizePerScaleFactor={},this.tileFormat=this.tileFormat||"jpg",this.version=l.version,this.tile_width&&this.tile_height)l.tileWidth=this.tile_width,l.tileHeight=this.tile_height;else if(this.tile_width)l.tileSize=this.tile_width;else if(this.tile_height)l.tileSize=this.tile_height;else if(this.tiles)if(this.tiles.length===1)l.tileWidth=this.tiles[0].width,l.tileHeight=this.tiles[0].height||this.tiles[0].width,this.scale_factors=this.tiles[0].scaleFactors;else{this.scale_factors=[];for(var a=0;a<this.tiles.length;a++)for(var u=0;u<this.tiles[a].scaleFactors.length;u++){var c=this.tiles[a].scaleFactors[u];this.scale_factors.push(c),l.tileSizePerScaleFactor[c]={width:this.tiles[a].width,height:this.tiles[a].height||this.tiles[a].width}}}else if(n(l)){for(var h=Math.min(this.height,this.width),f=[256,512,1024],m=[],v=0;v<f.length;v++)f[v]<=h&&m.push(f[v]);m.length>0?l.tileSize=Math.max.apply(null,m):l.tileSize=h}else this.sizes&&this.sizes.length>0?(this.emulateLegacyImagePyramid=!0,l.levels=r(this),e.extend(!0,l,{width:l.levels[l.levels.length-1].width,height:l.levels[l.levels.length-1].height,tileSize:Math.max(l.height,l.width),tileOverlap:0,minLevel:0,maxLevel:l.levels.length-1}),this.levels=l.levels):e.console.error("Nothing in the info.json to construct image pyramids from");if(!l.maxLevel&&!this.emulateLegacyImagePyramid)if(!this.scale_factors)l.maxLevel=Number(Math.round(Math.log(Math.max(this.width,this.height),2)));else{var y=Math.max.apply(null,this.scale_factors);l.maxLevel=Math.round(Math.log(y)*Math.LOG2E)}if(this.sizes){var T=this.sizes.length;(T===l.maxLevel||T===l.maxLevel+1)&&(this.levelSizes=this.sizes.slice().sort((x,E)=>x.width-E.width),T===l.maxLevel&&this.levelSizes.push({width:this.width,height:this.height}))}e.TileSource.apply(this,[l])},e.extend(e.IIIFTileSource.prototype,e.TileSource.prototype,{supports:function(l,a){return l.protocol&&l.protocol==="http://iiif.io/api/image"||l["@context"]&&(l["@context"]==="http://library.stanford.edu/iiif/image-api/1.1/context.json"||l["@context"]==="http://iiif.io/api/image/1/context.json")||l.profile&&l.profile.indexOf("http://library.stanford.edu/iiif/image-api/compliance.html")===0||l.identifier&&l.width&&l.height?!0:!!(l.documentElement&&l.documentElement.tagName==="info"&&l.documentElement.namespaceURI==="http://library.stanford.edu/iiif/image-api/ns/")},configure:function(l,a,u){if(e.isPlainObject(l)){if(!l["@context"])l["@context"]="http://iiif.io/api/image/1.0/context.json",l["@id"]=a.replace("/info.json",""),l.version=1;else{var h=l["@context"];if(Array.isArray(h)){for(var f=0;f<h.length;f++)if(typeof h[f]=="string"&&(/^http:\/\/iiif\.io\/api\/image\/[1-3]\/context\.json$/.test(h[f])||h[f]==="http://library.stanford.edu/iiif/image-api/1.1/context.json")){h=h[f];break}}switch(h){case"http://iiif.io/api/image/1/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/context.json":l.version=1;break;case"http://iiif.io/api/image/2/context.json":l.version=2;break;case"http://iiif.io/api/image/3/context.json":l.version=3;break;default:e.console.error("Data has a @context property which contains no known IIIF context URI.")}}if(l.preferredFormats){for(var m=0;m<l.preferredFormats.length;m++)if(i.imageFormatSupported(l.preferredFormats[m])){l.tileFormat=l.preferredFormats[m];break}}return l}else{var c=s(l);return c["@context"]="http://iiif.io/api/image/1.0/context.json",c["@id"]=a.replace("/info.xml",""),c.version=1,c}},getTileWidth:function(l){if(this.emulateLegacyImagePyramid)return e.TileSource.prototype.getTileWidth.call(this,l);var a=Math.pow(2,this.maxLevel-l);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[a]?this.tileSizePerScaleFactor[a].width:this._tileWidth},getTileHeight:function(l){if(this.emulateLegacyImagePyramid)return e.TileSource.prototype.getTileHeight.call(this,l);var a=Math.pow(2,this.maxLevel-l);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[a]?this.tileSizePerScaleFactor[a].height:this._tileHeight},getLevelScale:function(l){if(this.emulateLegacyImagePyramid){var a=NaN;return this.levels.length>0&&l>=this.minLevel&&l<=this.maxLevel&&(a=this.levels[l].width/this.levels[this.maxLevel].width),a}return e.TileSource.prototype.getLevelScale.call(this,l)},getNumTiles:function(l){if(this.emulateLegacyImagePyramid){var a=this.getLevelScale(l);return a?new e.Point(1,1):new e.Point(0,0)}if(this.levelSizes){var u=this.levelSizes[l],c=Math.ceil(u.width/this.getTileWidth(l)),h=Math.ceil(u.height/this.getTileHeight(l));return new e.Point(c,h)}else return e.TileSource.prototype.getNumTiles.call(this,l)},getTileAtPoint:function(l,a){if(this.emulateLegacyImagePyramid)return new e.Point(0,0);if(this.levelSizes){var u=a.x>=0&&a.x<=1&&a.y>=0&&a.y<=1/this.aspectRatio;e.console.assert(u,"[TileSource.getTileAtPoint] must be called with a valid point.");var c=this.levelSizes[l].width,h=a.x*c,f=a.y*c,m=Math.floor(h/this.getTileWidth(l)),v=Math.floor(f/this.getTileHeight(l));a.x>=1&&(m=this.getNumTiles(l).x-1);var y=1e-15;return a.y>=1/this.aspectRatio-y&&(v=this.getNumTiles(l).y-1),new e.Point(m,v)}return e.TileSource.prototype.getTileAtPoint.call(this,l,a)},getTileUrl:function(l,a,u){if(this.emulateLegacyImagePyramid){var c=null;return this.levels.length>0&&l>=this.minLevel&&l<=this.maxLevel&&(c=this.levels[l].url),c}var h="0",f=Math.pow(.5,this.maxLevel-l),m,v,y,T,x,E,M,L,U,K,q,Y,te,fe,$,j;return this.levelSizes?(m=this.levelSizes[l].width,v=this.levelSizes[l].height):(m=Math.ceil(this.width*f),v=Math.ceil(this.height*f)),y=this.getTileWidth(l),T=this.getTileHeight(l),x=Math.round(y/f),E=Math.round(T/f),this.version===1?$="native."+this.tileFormat:$="default."+this.tileFormat,m<y&&v<T?(this.version===2&&m===this.width?Y="full":this.version===3&&m===this.width&&v===this.height?Y="max":this.version===3?Y=m+","+v:Y=m+",",M="full"):(L=a*x,U=u*E,K=Math.min(x,this.width-L),q=Math.min(E,this.height-U),a===0&&u===0&&K===this.width&&q===this.height?M="full":M=[L,U,K,q].join(","),te=Math.min(y,m-a*y),fe=Math.min(T,v-u*T),this.version===2&&te===this.width?Y="full":this.version===3&&te===this.width&&fe===this.height?Y="max":this.version===3?Y=te+","+fe:Y=te+","),j=[this._id,M,Y,h,$].join("/"),j},__testonly__:{canBeTiled:n,constructLevels:r}});function n(l){var a=["http://library.stanford.edu/iiif/image-api/compliance.html#level0","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0","http://iiif.io/api/image/2/level0.json","level0","https://iiif.io/api/image/3/level0.json"],u=Array.isArray(l.profile)?l.profile[0]:l.profile,c=a.indexOf(u)!==-1,h=!1;return l.version===2&&l.profile.length>1&&l.profile[1].supports&&(h=l.profile[1].supports.indexOf("sizeByW")!==-1),l.version===3&&l.extraFeatures&&(h=l.extraFeatures.indexOf("sizeByWh")!==-1),!c||h}function r(l){for(var a=[],u=0;u<l.sizes.length;u++)a.push({url:l._id+"/full/"+l.sizes[u].width+","+(l.version===3?l.sizes[u].height:"")+"/0/default."+l.tileFormat,width:l.sizes[u].width,height:l.sizes[u].height});return a.sort(function(c,h){return c.width-h.width})}function s(l){if(!l||!l.documentElement)throw new Error(e.getString("Errors.Xml"));var a=l.documentElement,u=a.tagName,c=null;if(u==="info")try{return c={},o(a,c),c}catch(h){throw h instanceof Error?h:new Error(e.getString("Errors.IIIF"))}throw new Error(e.getString("Errors.IIIF"))}function o(l,a,u){var c,h;if(l.nodeType===3&&u)h=l.nodeValue.trim(),h.match(/^\d*$/)&&(h=Number(h)),a[u]?(e.isArray(a[u])||(a[u]=[a[u]]),a[u].push(h)):a[u]=h;else if(l.nodeType===1)for(c=0;c<l.childNodes.length;c++)o(l.childNodes[c],a,l.nodeName)}}(i),function(e){e.OsmTileSource=function(n,r,s,o,l){var a;e.isPlainObject(n)?a=n:a={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]},(!a.width||!a.height)&&(a.width=65572864,a.height=65572864),a.tileSize||(a.tileSize=256,a.tileOverlap=0),a.tilesUrl||(a.tilesUrl="http://tile.openstreetmap.org/"),a.minLevel=8,e.TileSource.apply(this,[a])},e.extend(e.OsmTileSource.prototype,e.TileSource.prototype,{supports:function(n,r){return n.type&&n.type==="openstreetmaps"},configure:function(n,r,s){return n},getTileUrl:function(n,r,s){return this.tilesUrl+(n-8)+"/"+r+"/"+s+".png"}})}(i),function(e){e.TmsTileSource=function(n,r,s,o,l){var a;e.isPlainObject(n)?a=n:a={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]};var u=Math.ceil(a.width/256)*256,c=Math.ceil(a.height/256)*256,h;u>c?h=u/256:h=c/256,a.maxLevel=Math.ceil(Math.log(h)/Math.log(2))-1,a.tileSize=256,a.width=u,a.height=c,e.TileSource.apply(this,[a])},e.extend(e.TmsTileSource.prototype,e.TileSource.prototype,{supports:function(n,r){return n.type&&n.type==="tiledmapservice"},configure:function(n,r,s){return n},getTileUrl:function(n,r,s){var o=this.getNumTiles(n).y-1;return this.tilesUrl+n+"/"+r+"/"+(o-s)+".png"}})}(i),function(e){e.ZoomifyTileSource=function(n){typeof n.tileSize>"u"&&(n.tileSize=256),typeof n.fileFormat>"u"&&(n.fileFormat="jpg",this.fileFormat=n.fileFormat);var r={x:n.width,y:n.height};for(n.imageSizes=[{x:n.width,y:n.height}],n.gridSize=[this._getGridSize(n.width,n.height,n.tileSize)];parseInt(r.x,10)>n.tileSize||parseInt(r.y,10)>n.tileSize;)r.x=Math.floor(r.x/2),r.y=Math.floor(r.y/2),n.imageSizes.push({x:r.x,y:r.y}),n.gridSize.push(this._getGridSize(r.x,r.y,n.tileSize));n.imageSizes.reverse(),n.gridSize.reverse(),n.minLevel=0,n.maxLevel=n.gridSize.length-1,i.TileSource.apply(this,[n])},e.extend(e.ZoomifyTileSource.prototype,e.TileSource.prototype,{_getGridSize:function(n,r,s){return{x:Math.ceil(n/s),y:Math.ceil(r/s)}},_calculateAbsoluteTileNumber:function(n,r,s){for(var o=0,l={},a=0;a<n;a++)l=this.gridSize[a],o+=l.x*l.y;return l=this.gridSize[n],o+=l.x*s+r,o},supports:function(n,r){return n.type&&n.type==="zoomifytileservice"},configure:function(n,r,s){return n},getTileUrl:function(n,r,s){var o=0,l=this._calculateAbsoluteTileNumber(n,r,s);return o=Math.floor(l/256),this.tilesUrl+"TileGroup"+o+"/"+n+"-"+r+"-"+s+"."+this.fileFormat}})}(i),function(e){e.LegacyTileSource=function(o){var l,a,u;e.isArray(o)&&(l={type:"legacy-image-pyramid",levels:o}),l.levels=n(l.levels),l.levels.length>0?(a=l.levels[l.levels.length-1].width,u=l.levels[l.levels.length-1].height):(a=0,u=0,e.console.error("No supported image formats found")),e.extend(!0,l,{width:a,height:u,tileSize:Math.max(u,a),tileOverlap:0,minLevel:0,maxLevel:l.levels.length>0?l.levels.length-1:0}),e.TileSource.apply(this,[l]),this.levels=l.levels},e.extend(e.LegacyTileSource.prototype,e.TileSource.prototype,{supports:function(o,l){return o.type&&o.type==="legacy-image-pyramid"||o.documentElement&&o.documentElement.getAttribute("type")==="legacy-image-pyramid"},configure:function(o,l,a){var u;return e.isPlainObject(o)?u=s(this,o):u=r(this,o),u},getLevelScale:function(o){var l=NaN;return this.levels.length>0&&o>=this.minLevel&&o<=this.maxLevel&&(l=this.levels[o].width/this.levels[this.maxLevel].width),l},getNumTiles:function(o){var l=this.getLevelScale(o);return l?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(o,l,a){var u=null;return this.levels.length>0&&o>=this.minLevel&&o<=this.maxLevel&&(u=this.levels[o].url),u}});function n(o){var l=[],a,u;for(u=0;u<o.length;u++)a=o[u],a.height&&a.width&&a.url?l.push({url:a.url,width:Number(a.width),height:Number(a.height)}):e.console.error("Unsupported image format: %s",a.url?a.url:"<no URL>");return l.sort(function(c,h){return c.height-h.height})}function r(o,l){if(!l||!l.documentElement)throw new Error(e.getString("Errors.Xml"));var a=l.documentElement,u=a.tagName,c=null,h=[],f,m;if(u==="image")try{for(c={type:a.getAttribute("type"),levels:[]},h=a.getElementsByTagName("level"),m=0;m<h.length;m++)f=h[m],c.levels.push({url:f.getAttribute("url"),width:parseInt(f.getAttribute("width"),10),height:parseInt(f.getAttribute("height"),10)});return s(o,c)}catch(v){throw v instanceof Error?v:new Error("Unknown error parsing Legacy Image Pyramid XML.")}else{if(u==="collection")throw new Error("Legacy Image Pyramid Collections not yet supported.");if(u==="error")throw new Error("Error: "+l)}throw new Error("Unknown element "+u)}function s(o,l){return l.levels}}(i),function(e){e.ImageTileSource=function(n){n=e.extend({buildPyramid:!0,crossOriginPolicy:!1,ajaxWithCredentials:!1},n),e.TileSource.apply(this,[n])},e.extend(e.ImageTileSource.prototype,e.TileSource.prototype,{supports:function(n,r){return n.type&&n.type==="image"},configure:function(n,r,s){return n},getImageInfo:function(n){var r=this._image=new Image,s=this;this.crossOriginPolicy&&(r.crossOrigin=this.crossOriginPolicy),this.ajaxWithCredentials&&(r.useCredentials=this.ajaxWithCredentials),e.addEvent(r,"load",function(){s.width=r.naturalWidth,s.height=r.naturalHeight,s.aspectRatio=s.width/s.height,s.dimensions=new e.Point(s.width,s.height),s._tileWidth=s.width,s._tileHeight=s.height,s.tileOverlap=0,s.minLevel=0,s.levels=s._buildLevels(),s.maxLevel=s.levels.length-1,s.ready=!0,s.raiseEvent("ready",{tileSource:s})}),e.addEvent(r,"error",function(){s.raiseEvent("open-failed",{message:"Error loading image at "+n,source:n})}),r.src=n},getLevelScale:function(n){var r=NaN;return n>=this.minLevel&&n<=this.maxLevel&&(r=this.levels[n].width/this.levels[this.maxLevel].width),r},getNumTiles:function(n){var r=this.getLevelScale(n);return r?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(n,r,s){var o=null;return n>=this.minLevel&&n<=this.maxLevel&&(o=this.levels[n].url),o},getContext2D:function(n,r,s){var o=null;return n>=this.minLevel&&n<=this.maxLevel&&(o=this.levels[n].context2D),o},destroy:function(n){this._freeupCanvasMemory(n)},_buildLevels:function(){var n=[{url:this._image.src,width:this._image.naturalWidth,height:this._image.naturalHeight}];if(!this.buildPyramid||!e.supportsCanvas)return delete this._image,n;var r=this._image.naturalWidth,s=this._image.naturalHeight,o=document.createElement("canvas"),l=o.getContext("2d");if(o.width=r,o.height=s,l.drawImage(this._image,0,0,r,s),n[0].context2D=l,delete this._image,e.isCanvasTainted(o))return n;for(;r>=2&&s>=2;){r=Math.floor(r/2),s=Math.floor(s/2);var a=document.createElement("canvas"),u=a.getContext("2d");a.width=r,a.height=s,u.drawImage(o,0,0,r,s),n.splice(0,0,{context2D:u,width:r,height:s}),o=a,l=u}return n},_freeupCanvasMemory:function(n){for(var r=0;r<this.levels.length;r++)this.levels[r].context2D&&(this.levels[r].context2D.canvas.height=0,this.levels[r].context2D.canvas.width=0,n&&n.raiseEvent("image-unloaded",{context2D:this.levels[r].context2D}))}})}(i),function(e){e.TileSourceCollection=function(n,r,s,o){e.console.error("TileSourceCollection is deprecated; use World instead")}}(i),function(e){e.ButtonState={REST:0,GROUP:1,HOVER:2,DOWN:3},e.Button=function(u){var c=this;e.EventSource.call(this),e.extend(!0,this,{tooltip:null,srcRest:null,srcGroup:null,srcHover:null,srcDown:null,clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,fadeDelay:0,fadeLength:2e3,onPress:null,onRelease:null,onClick:null,onEnter:null,onExit:null,onFocus:null,onBlur:null,userData:null},u),this.element=u.element||e.makeNeutralElement("div"),u.element||(this.imgRest=e.makeTransparentImage(this.srcRest),this.imgGroup=e.makeTransparentImage(this.srcGroup),this.imgHover=e.makeTransparentImage(this.srcHover),this.imgDown=e.makeTransparentImage(this.srcDown),this.imgRest.alt=this.imgGroup.alt=this.imgHover.alt=this.imgDown.alt=this.tooltip,e.setElementPointerEventsNone(this.imgRest),e.setElementPointerEventsNone(this.imgGroup),e.setElementPointerEventsNone(this.imgHover),e.setElementPointerEventsNone(this.imgDown),this.element.style.position="relative",e.setElementTouchActionNone(this.element),this.imgGroup.style.position=this.imgHover.style.position=this.imgDown.style.position="absolute",this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top="0px",this.imgGroup.style.left=this.imgHover.style.left=this.imgDown.style.left="0px",this.imgHover.style.visibility=this.imgDown.style.visibility="hidden",this.element.appendChild(this.imgRest),this.element.appendChild(this.imgGroup),this.element.appendChild(this.imgHover),this.element.appendChild(this.imgDown)),this.addHandler("press",this.onPress),this.addHandler("release",this.onRelease),this.addHandler("click",this.onClick),this.addHandler("enter",this.onEnter),this.addHandler("exit",this.onExit),this.addHandler("focus",this.onFocus),this.addHandler("blur",this.onBlur),this.currentState=e.ButtonState.GROUP,this.fadeBeginTime=null,this.shouldFade=!1,this.element.style.display="inline-block",this.element.style.position="relative",this.element.title=this.tooltip,this.tracker=new e.MouseTracker({userData:"Button.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(h){h.insideElementPressed?(l(c,e.ButtonState.DOWN),c.raiseEvent("enter",{originalEvent:h.originalEvent})):h.buttonDownAny||l(c,e.ButtonState.HOVER)},focusHandler:function(h){c.tracker.enterHandler(h),c.raiseEvent("focus",{originalEvent:h.originalEvent})},leaveHandler:function(h){a(c,e.ButtonState.GROUP),h.insideElementPressed&&c.raiseEvent("exit",{originalEvent:h.originalEvent})},blurHandler:function(h){c.tracker.leaveHandler(h),c.raiseEvent("blur",{originalEvent:h.originalEvent})},pressHandler:function(h){l(c,e.ButtonState.DOWN),c.raiseEvent("press",{originalEvent:h.originalEvent})},releaseHandler:function(h){h.insideElementPressed&&h.insideElementReleased?(a(c,e.ButtonState.HOVER),c.raiseEvent("release",{originalEvent:h.originalEvent})):h.insideElementPressed?a(c,e.ButtonState.GROUP):l(c,e.ButtonState.HOVER)},clickHandler:function(h){h.quick&&c.raiseEvent("click",{originalEvent:h.originalEvent})},keyHandler:function(h){h.keyCode===13?(c.raiseEvent("click",{originalEvent:h.originalEvent}),c.raiseEvent("release",{originalEvent:h.originalEvent}),h.preventDefault=!0):h.preventDefault=!1}}),a(this,e.ButtonState.REST)},e.extend(e.Button.prototype,e.EventSource.prototype,{notifyGroupEnter:function(){l(this,e.ButtonState.GROUP)},notifyGroupExit:function(){a(this,e.ButtonState.REST)},disable:function(){this.notifyGroupExit(),this.element.disabled=!0,this.tracker.setTracking(!1),e.setElementOpacity(this.element,.2,!0)},enable:function(){this.element.disabled=!1,this.tracker.setTracking(!0),e.setElementOpacity(this.element,1,!0),this.notifyGroupEnter()},destroy:function(){this.imgRest&&(this.element.removeChild(this.imgRest),this.imgRest=null),this.imgGroup&&(this.element.removeChild(this.imgGroup),this.imgGroup=null),this.imgHover&&(this.element.removeChild(this.imgHover),this.imgHover=null),this.imgDown&&(this.element.removeChild(this.imgDown),this.imgDown=null),this.removeAllHandlers(),this.tracker.destroy(),this.element=null}});function n(u){e.requestAnimationFrame(function(){r(u)})}function r(u){var c,h,f;u.shouldFade&&(c=e.now(),h=c-u.fadeBeginTime,f=1-h/u.fadeLength,f=Math.min(1,f),f=Math.max(0,f),u.imgGroup&&e.setElementOpacity(u.imgGroup,f,!0),f>0&&n(u))}function s(u){u.shouldFade=!0,u.fadeBeginTime=e.now()+u.fadeDelay,window.setTimeout(function(){n(u)},u.fadeDelay)}function o(u){u.shouldFade=!1,u.imgGroup&&e.setElementOpacity(u.imgGroup,1,!0)}function l(u,c){u.element.disabled||(c>=e.ButtonState.GROUP&&u.currentState===e.ButtonState.REST&&(o(u),u.currentState=e.ButtonState.GROUP),c>=e.ButtonState.HOVER&&u.currentState===e.ButtonState.GROUP&&(u.imgHover&&(u.imgHover.style.visibility=""),u.currentState=e.ButtonState.HOVER),c>=e.ButtonState.DOWN&&u.currentState===e.ButtonState.HOVER&&(u.imgDown&&(u.imgDown.style.visibility=""),u.currentState=e.ButtonState.DOWN))}function a(u,c){u.element.disabled||(c<=e.ButtonState.HOVER&&u.currentState===e.ButtonState.DOWN&&(u.imgDown&&(u.imgDown.style.visibility="hidden"),u.currentState=e.ButtonState.HOVER),c<=e.ButtonState.GROUP&&u.currentState===e.ButtonState.HOVER&&(u.imgHover&&(u.imgHover.style.visibility="hidden"),u.currentState=e.ButtonState.GROUP),c<=e.ButtonState.REST&&u.currentState===e.ButtonState.GROUP&&(s(u),u.currentState=e.ButtonState.REST))}}(i),function(e){e.ButtonGroup=function(n){e.extend(!0,this,{buttons:[],clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},n);var r=this.buttons.concat([]),s=this,o;if(this.element=n.element||e.makeNeutralElement("div"),!n.group)for(this.element.style.display="inline-block",o=0;o<r.length;o++)this.element.appendChild(r[o].element);e.setElementTouchActionNone(this.element),this.tracker=new e.MouseTracker({userData:"ButtonGroup.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(l){var a;for(a=0;a<s.buttons.length;a++)s.buttons[a].notifyGroupEnter()},leaveHandler:function(l){var a;if(!l.insideElementPressed)for(a=0;a<s.buttons.length;a++)s.buttons[a].notifyGroupExit()}})},e.ButtonGroup.prototype={addButton:function(n){this.buttons.push(n),this.element.appendChild(n.element)},emulateEnter:function(){this.tracker.enterHandler({eventSource:this.tracker})},emulateLeave:function(){this.tracker.leaveHandler({eventSource:this.tracker})},destroy:function(){for(;this.buttons.length;){var n=this.buttons.pop();this.element.removeChild(n.element),n.destroy()}this.tracker.destroy(),this.element=null}}}(i),function(e){e.Rect=function(n,r,s,o,l){this.x=typeof n=="number"?n:0,this.y=typeof r=="number"?r:0,this.width=typeof s=="number"?s:0,this.height=typeof o=="number"?o:0,this.degrees=typeof l=="number"?l:0,this.degrees=e.positiveModulo(this.degrees,360);var a,u;this.degrees>=270?(a=this.getTopRight(),this.x=a.x,this.y=a.y,u=this.height,this.height=this.width,this.width=u,this.degrees-=270):this.degrees>=180?(a=this.getBottomRight(),this.x=a.x,this.y=a.y,this.degrees-=180):this.degrees>=90&&(a=this.getBottomLeft(),this.x=a.x,this.y=a.y,u=this.height,this.height=this.width,this.width=u,this.degrees-=90)},e.Rect.fromSummits=function(n,r,s){var o=n.distanceTo(r),l=n.distanceTo(s),a=r.minus(n),u=Math.atan(a.y/a.x);return a.x<0?u+=Math.PI:a.y<0&&(u+=2*Math.PI),new e.Rect(n.x,n.y,o,l,u/Math.PI*180)},e.Rect.prototype={clone:function(){return new e.Rect(this.x,this.y,this.width,this.height,this.degrees)},getAspectRatio:function(){return this.width/this.height},getTopLeft:function(){return new e.Point(this.x,this.y)},getBottomRight:function(){return new e.Point(this.x+this.width,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getTopRight:function(){return new e.Point(this.x+this.width,this.y).rotate(this.degrees,this.getTopLeft())},getBottomLeft:function(){return new e.Point(this.x,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getCenter:function(){return new e.Point(this.x+this.width/2,this.y+this.height/2).rotate(this.degrees,this.getTopLeft())},getSize:function(){return new e.Point(this.width,this.height)},equals:function(n){return n instanceof e.Rect&&this.x===n.x&&this.y===n.y&&this.width===n.width&&this.height===n.height&&this.degrees===n.degrees},times:function(n){return new e.Rect(this.x*n,this.y*n,this.width*n,this.height*n,this.degrees)},translate:function(n){return new e.Rect(this.x+n.x,this.y+n.y,this.width,this.height,this.degrees)},union:function(n){var r=this.getBoundingBox(),s=n.getBoundingBox(),o=Math.min(r.x,s.x),l=Math.min(r.y,s.y),a=Math.max(r.x+r.width,s.x+s.width),u=Math.max(r.y+r.height,s.y+s.height);return new e.Rect(o,l,a-o,u-l)},intersection:function(n){var r=1e-10,s=[],o=this.getTopLeft();n.containsPoint(o,r)&&s.push(o);var l=this.getTopRight();n.containsPoint(l,r)&&s.push(l);var a=this.getBottomLeft();n.containsPoint(a,r)&&s.push(a);var u=this.getBottomRight();n.containsPoint(u,r)&&s.push(u);var c=n.getTopLeft();this.containsPoint(c,r)&&s.push(c);var h=n.getTopRight();this.containsPoint(h,r)&&s.push(h);var f=n.getBottomLeft();this.containsPoint(f,r)&&s.push(f);var m=n.getBottomRight();this.containsPoint(m,r)&&s.push(m);for(var v=this._getSegments(),y=n._getSegments(),T=0;T<v.length;T++)for(var x=v[T],E=0;E<y.length;E++){var M=y[E],L=U(x[0],x[1],M[0],M[1]);L&&s.push(L)}function U(j,ie,ce,ye){var me=ie.minus(j),pe=ye.minus(ce),oe=-pe.x*me.y+me.x*pe.y;if(oe===0)return null;var Ae=(me.x*(j.y-ce.y)-me.y*(j.x-ce.x))/oe,De=(pe.x*(j.y-ce.y)-pe.y*(j.x-ce.x))/oe;return-r<=Ae&&Ae<=1-r&&-r<=De&&De<=1-r?new e.Point(j.x+De*me.x,j.y+De*me.y):null}if(s.length===0)return null;for(var K=s[0].x,q=s[0].x,Y=s[0].y,te=s[0].y,fe=1;fe<s.length;fe++){var $=s[fe];$.x<K&&(K=$.x),$.x>q&&(q=$.x),$.y<Y&&(Y=$.y),$.y>te&&(te=$.y)}return new e.Rect(K,Y,q-K,te-Y)},_getSegments:function(){var n=this.getTopLeft(),r=this.getTopRight(),s=this.getBottomLeft(),o=this.getBottomRight();return[[n,r],[r,o],[o,s],[s,n]]},rotate:function(n,r){if(n=e.positiveModulo(n,360),n===0)return this.clone();r=r||this.getCenter();var s=this.getTopLeft().rotate(n,r),o=this.getTopRight().rotate(n,r),l=o.minus(s);l=l.apply(function(u){var c=1e-15;return Math.abs(u)<c?0:u});var a=Math.atan(l.y/l.x);return l.x<0?a+=Math.PI:l.y<0&&(a+=2*Math.PI),new e.Rect(s.x,s.y,this.width,this.height,a/Math.PI*180)},getBoundingBox:function(){if(this.degrees===0)return this.clone();var n=this.getTopLeft(),r=this.getTopRight(),s=this.getBottomLeft(),o=this.getBottomRight(),l=Math.min(n.x,r.x,s.x,o.x),a=Math.max(n.x,r.x,s.x,o.x),u=Math.min(n.y,r.y,s.y,o.y),c=Math.max(n.y,r.y,s.y,o.y);return new e.Rect(l,u,a-l,c-u)},getIntegerBoundingBox:function(){var n=this.getBoundingBox(),r=Math.floor(n.x),s=Math.floor(n.y),o=Math.ceil(n.width+n.x-r),l=Math.ceil(n.height+n.y-s);return new e.Rect(r,s,o,l)},containsPoint:function(n,r){r=r||0;var s=this.getTopLeft(),o=this.getTopRight(),l=this.getBottomLeft(),a=o.minus(s),u=l.minus(s);return(n.x-s.x)*a.x+(n.y-s.y)*a.y>=-r&&(n.x-o.x)*a.x+(n.y-o.y)*a.y<=r&&(n.x-s.x)*u.x+(n.y-s.y)*u.y>=-r&&(n.x-l.x)*u.x+(n.y-l.y)*u.y<=r},toString:function(){return"["+Math.round(this.x*100)/100+", "+Math.round(this.y*100)/100+", "+Math.round(this.width*100)/100+"x"+Math.round(this.height*100)/100+", "+Math.round(this.degrees*100)/100+"deg]"}}}(i),function(e){var n={};e.ReferenceStrip=function(f){var m=this,v=f.viewer,y=e.getElementSize(v.element),T,x,E;for(f.id||(f.id="referencestrip-"+e.now(),this.element=e.makeNeutralElement("div"),this.element.id=f.id,this.element.className="referencestrip"),f=e.extend(!0,{sizeRatio:e.DEFAULT_SETTINGS.referenceStripSizeRatio,position:e.DEFAULT_SETTINGS.referenceStripPosition,scroll:e.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold},f,{element:this.element}),e.extend(this,f),n[this.id]={animating:!1},this.minPixelRatio=this.viewer.minPixelRatio,this.element.tabIndex=0,x=this.element.style,x.marginTop="0px",x.marginRight="0px",x.marginBottom="0px",x.marginLeft="0px",x.left="0px",x.bottom="0px",x.border="0px",x.background="#000",x.position="relative",e.setElementTouchActionNone(this.element),e.setElementOpacity(this.element,.8),this.viewer=v,this.tracker=new e.MouseTracker({userData:"ReferenceStrip.tracker",element:this.element,clickHandler:e.delegate(this,r),dragHandler:e.delegate(this,s),scrollHandler:e.delegate(this,o),enterHandler:e.delegate(this,a),leaveHandler:e.delegate(this,u),keyDownHandler:e.delegate(this,c),keyHandler:e.delegate(this,h),preProcessEventHandler:function(M){M.eventType==="wheel"&&(M.preventDefault=!0)}}),f.width&&f.height?(this.element.style.width=f.width+"px",this.element.style.height=f.height+"px",v.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})):f.scroll==="horizontal"?(this.element.style.width=y.x*f.sizeRatio*v.tileSources.length+12*v.tileSources.length+"px",this.element.style.height=y.y*f.sizeRatio+"px",v.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})):(this.element.style.height=y.y*f.sizeRatio*v.tileSources.length+12*v.tileSources.length+"px",this.element.style.width=y.x*f.sizeRatio+"px",v.addControl(this.element,{anchor:e.ControlAnchor.TOP_LEFT})),this.panelWidth=y.x*this.sizeRatio+8,this.panelHeight=y.y*this.sizeRatio+8,this.panels=[],this.miniViewers={},E=0;E<v.tileSources.length;E++)T=e.makeNeutralElement("div"),T.id=this.element.id+"-"+E,T.style.width=m.panelWidth+"px",T.style.height=m.panelHeight+"px",T.style.display="inline",T.style.float="left",T.style.cssFloat="left",T.style.padding="2px",e.setElementTouchActionNone(T),e.setElementPointerEventsNone(T),this.element.appendChild(T),T.activePanel=!1,this.panels.push(T);l(this,this.scroll==="vertical"?y.y:y.x,0),this.setFocus(0)},e.ReferenceStrip.prototype={setFocus:function(f){var m=this.element.querySelector("#"+this.element.id+"-"+f),v=e.getElementSize(this.viewer.canvas),y=Number(this.element.style.width.replace("px","")),T=Number(this.element.style.height.replace("px","")),x=-Number(this.element.style.marginLeft.replace("px","")),E=-Number(this.element.style.marginTop.replace("px","")),M;this.currentSelected!==m&&(this.currentSelected&&(this.currentSelected.style.background="#000"),this.currentSelected=m,this.currentSelected.style.background="#999",this.scroll==="horizontal"?(M=Number(f)*(this.panelWidth+3),M>x+v.x-this.panelWidth?(M=Math.min(M,y-v.x),this.element.style.marginLeft=-M+"px",l(this,v.x,-M)):M<x&&(M=Math.max(0,M-v.x/2),this.element.style.marginLeft=-M+"px",l(this,v.x,-M))):(M=Number(f)*(this.panelHeight+3),M>E+v.y-this.panelHeight?(M=Math.min(M,T-v.y),this.element.style.marginTop=-M+"px",l(this,v.y,-M)):M<E&&(M=Math.max(0,M-v.y/2),this.element.style.marginTop=-M+"px",l(this,v.y,-M))),this.currentPage=f,a.call(this,{eventSource:this.tracker}))},update:function(){return!!n[this.id].animating},destroy:function(){if(this.miniViewers)for(var f in this.miniViewers)this.miniViewers[f].destroy();this.tracker.destroy(),this.element&&this.viewer.removeControl(this.element)}};function r(f){if(f.quick){var m;this.scroll==="horizontal"?m=Math.floor(f.position.x/(this.panelWidth+4)):m=Math.floor(f.position.y/this.panelHeight),this.viewer.goToPage(m)}this.element.focus()}function s(f){if(this.dragging=!0,this.element){var m=Number(this.element.style.marginLeft.replace("px","")),v=Number(this.element.style.marginTop.replace("px","")),y=Number(this.element.style.width.replace("px","")),T=Number(this.element.style.height.replace("px","")),x=e.getElementSize(this.viewer.canvas);this.scroll==="horizontal"?-f.delta.x>0?m>-(y-x.x)&&(this.element.style.marginLeft=m+f.delta.x*2+"px",l(this,x.x,m+f.delta.x*2)):-f.delta.x<0&&m<0&&(this.element.style.marginLeft=m+f.delta.x*2+"px",l(this,x.x,m+f.delta.x*2)):-f.delta.y>0?v>-(T-x.y)&&(this.element.style.marginTop=v+f.delta.y*2+"px",l(this,x.y,v+f.delta.y*2)):-f.delta.y<0&&v<0&&(this.element.style.marginTop=v+f.delta.y*2+"px",l(this,x.y,v+f.delta.y*2))}}function o(f){if(this.element){var m=Number(this.element.style.marginLeft.replace("px","")),v=Number(this.element.style.marginTop.replace("px","")),y=Number(this.element.style.width.replace("px","")),T=Number(this.element.style.height.replace("px","")),x=e.getElementSize(this.viewer.canvas);this.scroll==="horizontal"?f.scroll>0?m>-(y-x.x)&&(this.element.style.marginLeft=m-f.scroll*60+"px",l(this,x.x,m-f.scroll*60)):f.scroll<0&&m<0&&(this.element.style.marginLeft=m-f.scroll*60+"px",l(this,x.x,m-f.scroll*60)):f.scroll<0?v>x.y-T&&(this.element.style.marginTop=v+f.scroll*60+"px",l(this,x.y,v+f.scroll*60)):f.scroll>0&&v<0&&(this.element.style.marginTop=v+f.scroll*60+"px",l(this,x.y,v+f.scroll*60)),f.preventDefault=!0}}function l(f,m,v){var y,T,x,E,M,L;for(f.scroll==="horizontal"?y=f.panelWidth:y=f.panelHeight,T=Math.ceil(m/y)+5,x=Math.ceil((Math.abs(v)+m)/y)+1,T=x-T,T=T<0?0:T,M=T;M<x&&M<f.panels.length;M++)if(L=f.panels[M],!L.activePanel){var U,K=f.viewer.tileSources[M];K.referenceStripThumbnailUrl?U={type:"image",url:K.referenceStripThumbnailUrl}:U=K,E=new e.Viewer({id:L.id,tileSources:[U],element:L,navigatorSizeRatio:f.sizeRatio,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:0,loadTilesWithAjax:f.viewer.loadTilesWithAjax,ajaxHeaders:f.viewer.ajaxHeaders,drawer:"canvas"}),e.setElementPointerEventsNone(E.canvas),e.setElementPointerEventsNone(E.container),E.innerTracker.setTracking(!1),E.outerTracker.setTracking(!1),f.miniViewers[L.id]=E,L.activePanel=!0}}function a(f){var m=f.eventSource.element;this.scroll==="horizontal"?m.style.marginBottom="0px":m.style.marginLeft="0px"}function u(f){var m=f.eventSource.element;this.scroll==="horizontal"?m.style.marginBottom="-"+e.getElementSize(m).y/2+"px":m.style.marginLeft="-"+e.getElementSize(m).x/2+"px"}function c(f){if(!f.ctrl&&!f.alt&&!f.meta)switch(f.keyCode){case 38:o.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),f.preventDefault=!0;break;case 40:o.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),f.preventDefault=!0;break;case 37:o.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),f.preventDefault=!0;break;case 39:o.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),f.preventDefault=!0;break;default:f.preventDefault=!1;break}else f.preventDefault=!1}function h(f){if(!f.ctrl&&!f.alt&&!f.meta)switch(f.keyCode){case 61:o.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),f.preventDefault=!0;break;case 45:o.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),f.preventDefault=!0;break;case 48:case 119:case 87:o.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),f.preventDefault=!0;break;case 115:case 83:o.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),f.preventDefault=!0;break;case 97:o.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),f.preventDefault=!0;break;case 100:o.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),f.preventDefault=!0;break;default:f.preventDefault=!1;break}else f.preventDefault=!1}}(i),function(e){e.DisplayRect=function(n,r,s,o,l,a){e.Rect.apply(this,[n,r,s,o]),this.minLevel=l,this.maxLevel=a},e.extend(e.DisplayRect.prototype,e.Rect.prototype)}(i),function(e){e.Spring=function(r){var s=arguments;typeof r!="object"&&(r={initial:s.length&&typeof s[0]=="number"?s[0]:void 0,springStiffness:s.length>1?s[1].springStiffness:5,animationTime:s.length>1?s[1].animationTime:1.5}),e.console.assert(typeof r.springStiffness=="number"&&r.springStiffness!==0,"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number"),e.console.assert(typeof r.animationTime=="number"&&r.animationTime>=0,"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0"),r.exponential&&(this._exponential=!0,delete r.exponential),e.extend(!0,this,r),this.current={value:typeof this.initial=="number"?this.initial:this._exponential?0:1,time:e.now()},e.console.assert(!this._exponential||this.current.value!==0,"[OpenSeadragon.Spring] value must be non-zero for exponential springs"),this.start={value:this.current.value,time:this.current.time},this.target={value:this.current.value,time:this.current.time},this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},e.Spring.prototype={resetTo:function(r){e.console.assert(!this._exponential||r!==0,"[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs"),this.start.value=this.target.value=this.current.value=r,this.start.time=this.target.time=this.current.time=e.now(),this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},springTo:function(r){e.console.assert(!this._exponential||r!==0,"[OpenSeadragon.Spring.springTo] target must be non-zero for exponential springs"),this.start.value=this.current.value,this.start.time=this.current.time,this.target.value=r,this.target.time=this.start.time+1e3*this.animationTime,this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value))},shiftBy:function(r){this.start.value+=r,this.target.value+=r,this._exponential&&(e.console.assert(this.target.value!==0&&this.start.value!==0,"[OpenSeadragon.Spring.shiftBy] spring value must be non-zero for exponential springs"),this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value))},setExponential:function(r){this._exponential=r,this._exponential&&(e.console.assert(this.current.value!==0&&this.target.value!==0&&this.start.value!==0,"[OpenSeadragon.Spring.setExponential] spring value must be non-zero for exponential springs"),this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},update:function(){this.current.time=e.now();let r,s;if(this._exponential?(r=this.start._logValue,s=this.target._logValue):(r=this.start.value,s=this.target.value),this.current.time>=this.target.time)this.current.value=this.target.value;else{let o=r+(s-r)*n(this.springStiffness,(this.current.time-this.start.time)/(this.target.time-this.start.time));this._exponential?this.current.value=Math.exp(o):this.current.value=o}return this.current.value!==this.target.value},isAtTargetValue:function(){return this.current.value===this.target.value}};function n(r,s){return(1-Math.exp(r*-s))/(1-Math.exp(-r))}}(i),function(e){e.ImageJob=function(r){e.extend(!0,this,{timeout:e.DEFAULT_SETTINGS.timeout,jobId:null,tries:0},r),this.data=null,this.userData={},this.errorMsg=null},e.ImageJob.prototype={start:function(){this.tries++;var r=this,s=this.abort;this.jobId=window.setTimeout(function(){r.finish(null,null,"Image load exceeded timeout ("+r.timeout+" ms)")},this.timeout),this.abort=function(){r.source.downloadTileAbort(r),typeof s=="function"&&s()},this.source.downloadTileStart(this)},finish:function(r,s,o){this.data=r,this.request=s,this.errorMsg=o,this.jobId&&window.clearTimeout(this.jobId),this.callback(this)}},e.ImageLoader=function(r){e.extend(!0,this,{jobLimit:e.DEFAULT_SETTINGS.imageLoaderLimit,timeout:e.DEFAULT_SETTINGS.timeout,jobQueue:[],failedTiles:[],jobsInProgress:0},r)},e.ImageLoader.prototype={addJob:function(r){if(!r.source){e.console.error("ImageLoader.prototype.addJob() requires [options.source]. TileSource since new API defines how images are fetched. Creating a dummy TileSource.");var s=e.TileSource.prototype;r.source={downloadTileStart:s.downloadTileStart,downloadTileAbort:s.downloadTileAbort}}var o=this,l=function(c){n(o,c,r.callback)},a={src:r.src,tile:r.tile||{},source:r.source,loadWithAjax:r.loadWithAjax,ajaxHeaders:r.loadWithAjax?r.ajaxHeaders:null,crossOriginPolicy:r.crossOriginPolicy,ajaxWithCredentials:r.ajaxWithCredentials,postData:r.postData,callback:l,abort:r.abort,timeout:this.timeout},u=new e.ImageJob(a);!this.jobLimit||this.jobsInProgress<this.jobLimit?(u.start(),this.jobsInProgress++):this.jobQueue.push(u)},clear:function(){for(var r=0;r<this.jobQueue.length;r++){var s=this.jobQueue[r];typeof s.abort=="function"&&s.abort()}this.jobQueue=[]}};function n(r,s,o){s.errorMsg!==""&&(s.data===null||s.data===void 0)&&s.tries<1+r.tileRetryMax&&r.failedTiles.push(s);var l;r.jobsInProgress--,(!r.jobLimit||r.jobsInProgress<r.jobLimit)&&r.jobQueue.length>0&&(l=r.jobQueue.shift(),l.start(),r.jobsInProgress++),r.tileRetryMax>0&&r.jobQueue.length===0&&(!r.jobLimit||r.jobsInProgress<r.jobLimit)&&r.failedTiles.length>0&&(l=r.failedTiles.shift(),setTimeout(function(){l.start()},r.tileRetryDelay),r.jobsInProgress++),o(s.data,s.errorMsg,s.request)}}(i),function(e){e.Tile=function(n,r,s,o,l,a,u,c,h,f,m,v){this.level=n,this.x=r,this.y=s,this.bounds=o,this.positionedBounds=new i.Rect(o.x,o.y,o.width,o.height),this.sourceBounds=f,this.exists=l,this._url=a,this.postData=m,this.context2D=u,this.loadWithAjax=c,this.ajaxHeaders=h,v===void 0&&(e.console.warn("Tile constructor needs 'cacheKey' variable: creation tile cache in Tile class is deprecated. TileSource.prototype.getTileHashKey will be used."),v=e.TileSource.prototype.getTileHashKey(n,r,s,a,h,m)),this.cacheKey=v,this.loaded=!1,this.loading=!1,this.element=null,this.imgElement=null,this.style=null,this.position=null,this.size=null,this.flipped=!1,this.blendStart=null,this.opacity=null,this.squaredDistance=null,this.visibility=null,this.hasTransparency=!1,this.beingDrawn=!1,this.lastTouchTime=0,this.isRightMost=!1,this.isBottomMost=!1},e.Tile.prototype={toString:function(){return this.level+"/"+this.x+"_"+this.y},_hasTransparencyChannel:function(){return console.warn("Tile.prototype._hasTransparencyChannel() has been deprecated and will be removed in the future. Use TileSource.prototype.hasTransparency() instead."),!!this.context2D||this.getUrl().match(".png")},get image(){return e.console.error("[Tile.image] property has been deprecated. Use [Tile.prototype.getImage] instead."),this.getImage()},get url(){return e.console.error("[Tile.url] property has been deprecated. Use [Tile.prototype.getUrl] instead."),this.getUrl()},getImage:function(){return this.cacheImageRecord.getImage()},getUrl:function(){return typeof this._url=="function"?this._url():this._url},getCanvasContext:function(){return this.context2D||this.cacheImageRecord&&this.cacheImageRecord.getRenderedContext()},getScaleForEdgeSmoothing:function(){var n;if(this.cacheImageRecord)n=this.cacheImageRecord.getRenderedContext();else if(this.context2D)n=this.context2D;else return e.console.warn("[Tile.drawCanvas] attempting to get tile scale %s when tile's not cached",this.toString()),1;return n.canvas.width/(this.size.x*e.pixelDensityRatio)},getTranslationForEdgeSmoothing:function(n,r,s){var o=Math.max(1,Math.ceil((s.x-r.x)/2)),l=Math.max(1,Math.ceil((s.y-r.y)/2));return new e.Point(o,l).minus(this.position.times(e.pixelDensityRatio).times(n||1).apply(function(a){return a%1}))},unload:function(){this.imgElement&&this.imgElement.parentNode&&this.imgElement.parentNode.removeChild(this.imgElement),this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null,this.imgElement=null,this.loaded=!1,this.loading=!1}}}(i),function(e){e.OverlayPlacement=e.Placement,e.OverlayRotationMode=e.freezeObject({NO_ROTATION:1,EXACT:2,BOUNDING_BOX:3}),e.Overlay=function(n,r,s){var o;e.isPlainObject(n)?o=n:o={element:n,location:r,placement:s},this.elementWrapper=document.createElement("div"),this.element=o.element,this.elementWrapper.appendChild(this.element),this.element.id?this.elementWrapper.id="overlay-wrapper-"+this.element.id:this.elementWrapper.id="overlay-wrapper",this.style=this.elementWrapper.style,this._init(o)},e.Overlay.prototype={_init:function(n){this.location=n.location,this.placement=n.placement===void 0?e.Placement.TOP_LEFT:n.placement,this.onDraw=n.onDraw,this.checkResize=n.checkResize===void 0?!0:n.checkResize,this.width=n.width===void 0?null:n.width,this.height=n.height===void 0?null:n.height,this.rotationMode=n.rotationMode||e.OverlayRotationMode.EXACT,this.location instanceof e.Rect&&(this.width=this.location.width,this.height=this.location.height,this.location=this.location.getTopLeft(),this.placement=e.Placement.TOP_LEFT),this.scales=this.width!==null&&this.height!==null,this.bounds=new e.Rect(this.location.x,this.location.y,this.width,this.height),this.position=this.location},adjust:function(n,r){var s=e.Placement.properties[this.placement];s&&(s.isHorizontallyCentered?n.x-=r.x/2:s.isRight&&(n.x-=r.x),s.isVerticallyCentered?n.y-=r.y/2:s.isBottom&&(n.y-=r.y))},destroy:function(){var n=this.elementWrapper,r=this.style;n.parentNode&&(n.parentNode.removeChild(n),n.prevElementParent&&(r.display="none",document.body.appendChild(n))),this.onDraw=null,r.top="",r.left="",r.position="",this.width!==null&&(r.width=""),this.height!==null&&(r.height="");var s=e.getCssPropertyWithVendorPrefix("transformOrigin"),o=e.getCssPropertyWithVendorPrefix("transform");s&&o&&(r[s]="",r[o]="")},drawHTML:function(n,r){var s=this.elementWrapper;s.parentNode!==n&&(s.prevElementParent=s.parentNode,s.prevNextSibling=s.nextSibling,n.appendChild(s),this.style.position="absolute",this.size=e.getElementSize(this.elementWrapper));var o=this._getOverlayPositionAndSize(r),l=o.position,a=this.size=o.size,u="";r.overlayPreserveContentDirection&&(u=r.flipped?" scaleX(-1)":" scaleX(1)");var c=r.flipped?-o.rotate:o.rotate,h=r.flipped?" scaleX(-1)":"";if(this.onDraw)this.onDraw(l,a,this.element);else{var f=this.style,m=this.element.style;m.display="block",f.left=l.x+"px",f.top=l.y+"px",this.width!==null&&(m.width=a.x+"px"),this.height!==null&&(m.height=a.y+"px");var v=e.getCssPropertyWithVendorPrefix("transformOrigin"),y=e.getCssPropertyWithVendorPrefix("transform");v&&y&&(c&&!r.flipped?(m[y]="",f[v]=this._getTransformOrigin(),f[y]="rotate("+c+"deg)"):!c&&r.flipped?(m[y]=u,f[v]=this._getTransformOrigin(),f[y]=h):c&&r.flipped?(m[y]=u,f[v]=this._getTransformOrigin(),f[y]="rotate("+c+"deg)"+h):(m[y]="",f[v]="",f[y]="")),f.display="flex"}},_getOverlayPositionAndSize:function(n){var r=n.pixelFromPoint(this.location,!0),s=this._getSizeInPixels(n);this.adjust(r,s);var o=0;if(n.getRotation(!0)&&this.rotationMode!==e.OverlayRotationMode.NO_ROTATION)if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX&&this.width!==null&&this.height!==null){var l=new e.Rect(r.x,r.y,s.x,s.y),a=this._getBoundingBox(l,n.getRotation(!0));r=a.getTopLeft(),s=a.getSize()}else o=n.getRotation(!0);return n.flipped&&(r.x=n.getContainerSize().x-r.x),{position:r,size:s,rotate:o}},_getSizeInPixels:function(n){var r=this.size.x,s=this.size.y;if(this.width!==null||this.height!==null){var o=n.deltaPixelsFromPointsNoRotate(new e.Point(this.width||0,this.height||0),!0);this.width!==null&&(r=o.x),this.height!==null&&(s=o.y)}if(this.checkResize&&(this.width===null||this.height===null)){var l=this.size=e.getElementSize(this.elementWrapper);this.width===null&&(r=l.x),this.height===null&&(s=l.y)}return new e.Point(r,s)},_getBoundingBox:function(n,r){var s=this._getPlacementPoint(n);return n.rotate(r,s).getBoundingBox()},_getPlacementPoint:function(n){var r=new e.Point(n.x,n.y),s=e.Placement.properties[this.placement];return s&&(s.isHorizontallyCentered?r.x+=n.width/2:s.isRight&&(r.x+=n.width),s.isVerticallyCentered?r.y+=n.height/2:s.isBottom&&(r.y+=n.height)),r},_getTransformOrigin:function(){var n="",r=e.Placement.properties[this.placement];return r&&(r.isLeft?n="left":r.isRight&&(n="right"),r.isTop?n+=" top":r.isBottom&&(n+=" bottom")),n},update:function(n,r){var s=e.isPlainObject(n)?n:{location:n,placement:r};this._init({location:s.location||this.location,placement:s.placement!==void 0?s.placement:this.placement,onDraw:s.onDraw||this.onDraw,checkResize:s.checkResize||this.checkResize,width:s.width!==void 0?s.width:this.width,height:s.height!==void 0?s.height:this.height,rotationMode:s.rotationMode||this.rotationMode})},getBounds:function(n){e.console.assert(n,"A viewport must now be passed to Overlay.getBounds.");var r=this.width,s=this.height;if(r===null||s===null){var o=n.deltaPointsFromPixelsNoRotate(this.size,!0);r===null&&(r=o.x),s===null&&(s=o.y)}var l=this.location.clone();return this.adjust(l,new e.Point(r,s)),this._adjustBoundsForRotation(n,new e.Rect(l.x,l.y,r,s))},_adjustBoundsForRotation:function(n,r){if(!n||n.getRotation(!0)===0||this.rotationMode===e.OverlayRotationMode.EXACT)return r;if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX){if(this.width===null||this.height===null)return r;var s=this._getOverlayPositionAndSize(n);return n.viewerElementToViewportRectangle(new e.Rect(s.position.x,s.position.y,s.size.x,s.size.y))}return r.rotate(-n.getRotation(!0),this._getPlacementPoint(r))}}}(i),function(e){const n=e;n.DrawerBase=class{constructor(s){e.console.assert(s.viewer,"[Drawer] options.viewer is required"),e.console.assert(s.viewport,"[Drawer] options.viewport is required"),e.console.assert(s.element,"[Drawer] options.element is required"),this.viewer=s.viewer,this.viewport=s.viewport,this.debugGridColor=typeof s.debugGridColor=="string"?[s.debugGridColor]:s.debugGridColor||e.DEFAULT_SETTINGS.debugGridColor,this.options=s.options||{},this.container=e.getElement(s.element),this._renderingTarget=this._createDrawingElement(),this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.position="absolute",this.canvas.style.left="0",e.setElementOpacity(this.canvas,this.viewer.opacity,!0),e.setElementPointerEventsNone(this.canvas),e.setElementTouchActionNone(this.canvas),this.container.style.textAlign="left",this.container.appendChild(this.canvas),this._checkForAPIOverrides()}get canvas(){return this._renderingTarget}get element(){return e.console.error("Drawer.element is deprecated. Use Drawer.container instead."),this.container}getType(){e.console.error("Drawer.getType must be implemented by child class")}static isSupported(){e.console.error("Drawer.isSupported must be implemented by child class")}_createDrawingElement(){return e.console.error("Drawer._createDrawingElement must be implemented by child class"),null}draw(s){e.console.error("Drawer.draw must be implemented by child class")}canRotate(){e.console.error("Drawer.canRotate must be implemented by child class")}destroy(){e.console.error("Drawer.destroy must be implemented by child class")}minimumOverlapRequired(s){return!1}setImageSmoothingEnabled(s){e.console.error("Drawer.setImageSmoothingEnabled must be implemented by child class")}drawDebuggingRect(s){e.console.warn("[drawer].drawDebuggingRect is not implemented by this drawer")}clear(){e.console.warn("[drawer].clear() is deprecated. The drawer is responsible for clearing itself as needed before drawing tiles.")}_checkForAPIOverrides(){if(this._createDrawingElement===e.DrawerBase.prototype._createDrawingElement)throw new Error("[drawer]._createDrawingElement must be implemented by child class");if(this.draw===e.DrawerBase.prototype.draw)throw new Error("[drawer].draw must be implemented by child class");if(this.canRotate===e.DrawerBase.prototype.canRotate)throw new Error("[drawer].canRotate must be implemented by child class");if(this.destroy===e.DrawerBase.prototype.destroy)throw new Error("[drawer].destroy must be implemented by child class");if(this.setImageSmoothingEnabled===e.DrawerBase.prototype.setImageSmoothingEnabled)throw new Error("[drawer].setImageSmoothingEnabled must be implemented by child class")}viewportToDrawerRectangle(s){var o=this.viewport.pixelFromPointNoRotate(s.getTopLeft(),!0),l=this.viewport.deltaPixelsFromPointsNoRotate(s.getSize(),!0);return new e.Rect(o.x*e.pixelDensityRatio,o.y*e.pixelDensityRatio,l.x*e.pixelDensityRatio,l.y*e.pixelDensityRatio)}viewportCoordToDrawerCoord(s){var o=this.viewport.pixelFromPointNoRotate(s,!0);return new e.Point(o.x*e.pixelDensityRatio,o.y*e.pixelDensityRatio)}_calculateCanvasSize(){var s=e.pixelDensityRatio,o=this.viewport.getContainerSize();return new n.Point(Math.round(o.x*s),Math.round(o.y*s))}_raiseTiledImageDrawnEvent(s,o){this.viewer&&this.viewer.raiseEvent("tiled-image-drawn",{tiledImage:s,tiles:o})}_raiseDrawerErrorEvent(s,o){this.viewer&&this.viewer.raiseEvent("drawer-error",{tiledImage:s,drawer:this,error:o})}}}(i),function(e){const n=e;class r extends n.DrawerBase{constructor(o){super(o),this.viewer.rejectEventHandler("tile-drawing","The HTMLDrawer does not raise the tile-drawing event"),this.viewer.allowEventHandler("tile-drawn")}static isSupported(){return!0}getType(){return"html"}minimumOverlapRequired(o){return!0}_createDrawingElement(){return e.makeNeutralElement("div")}draw(o){var l=this;this._prepareNewFrame(),o.forEach(function(a){a.opacity!==0&&l._drawTiles(a)})}canRotate(){return!1}destroy(){this.container.removeChild(this.canvas)}setImageSmoothingEnabled(){}_prepareNewFrame(){this.canvas.innerHTML=""}_drawTiles(o){var l=o.getTilesToDraw().map(c=>c.tile);if(!(o.opacity===0||l.length===0&&!o.placeholderFillStyle))for(var a=l.length-1;a>=0;a--){var u=l[a];this._drawTile(u),this.viewer&&this.viewer.raiseEvent("tile-drawn",{tiledImage:o,tile:u})}}_drawTile(o){e.console.assert(o,"[Drawer._drawTile] tile is required");let l=this.canvas;if(!o.cacheImageRecord){e.console.warn("[Drawer._drawTileToHTML] attempting to draw tile %s when it's not cached",o.toString());return}if(!o.loaded){e.console.warn("Attempting to draw tile %s when it's not yet loaded.",o.toString());return}if(!o.element){var a=o.getImage();if(!a)return;o.element=e.makeNeutralElement("div"),o.imgElement=a.cloneNode(),o.imgElement.style.msInterpolationMode="nearest-neighbor",o.imgElement.style.width="100%",o.imgElement.style.height="100%",o.style=o.element.style,o.style.position="absolute"}o.element.parentNode!==l&&l.appendChild(o.element),o.imgElement.parentNode!==o.element&&o.element.appendChild(o.imgElement),o.style.top=o.position.y+"px",o.style.left=o.position.x+"px",o.style.height=o.size.y+"px",o.style.width=o.size.x+"px",o.flipped&&(o.style.transform="scaleX(-1)"),e.setElementOpacity(o.element,o.opacity)}}e.HTMLDrawer=r}(i),function(e){const n=e;class r extends n.DrawerBase{constructor(c){super(c),this.context=this.canvas.getContext("2d"),this.sketchCanvas=null,this.sketchContext=null,this._imageSmoothingEnabled=!0,this.viewer.allowEventHandler("tile-drawn"),this.viewer.allowEventHandler("tile-drawing")}static isSupported(){return e.supportsCanvas}getType(){return"canvas"}_createDrawingElement(){let c=e.makeNeutralElement("canvas"),h=this._calculateCanvasSize();return c.width=h.x,c.height=h.y,c}draw(c){this._prepareNewFrame(),this.viewer.viewport.getFlip()!==this._viewportFlipped&&this._flip();for(const h of c)h.opacity!==0&&this._drawTiles(h)}canRotate(){return!0}destroy(){this.canvas.width=1,this.canvas.height=1,this.sketchCanvas=null,this.sketchContext=null,this.container.removeChild(this.canvas)}minimumOverlapRequired(c){return!0}setImageSmoothingEnabled(c){this._imageSmoothingEnabled=!!c,this._updateImageSmoothingEnabled(this.context),this.viewer.forceRedraw()}drawDebuggingRect(c){var h=this.context;h.save(),h.lineWidth=2*e.pixelDensityRatio,h.strokeStyle=this.debugGridColor[0],h.fillStyle=this.debugGridColor[0],h.strokeRect(c.x*e.pixelDensityRatio,c.y*e.pixelDensityRatio,c.width*e.pixelDensityRatio,c.height*e.pixelDensityRatio),h.restore()}get _viewportFlipped(){return this.context.getTransform().a<0}_raiseTileDrawingEvent(c,h,f,m){this.viewer.raiseEvent("tile-drawing",{tiledImage:c,context:h,tile:f,rendered:m})}_prepareNewFrame(){var c=this._calculateCanvasSize();if((this.canvas.width!==c.x||this.canvas.height!==c.y)&&(this.canvas.width=c.x,this.canvas.height=c.y,this._updateImageSmoothingEnabled(this.context),this.sketchCanvas!==null)){var h=this._calculateSketchCanvasSize();this.sketchCanvas.width=h.x,this.sketchCanvas.height=h.y,this._updateImageSmoothingEnabled(this.sketchContext)}this._clear()}_clear(c,h){var f=this._getContext(c);if(h)f.clearRect(h.x,h.y,h.width,h.height);else{var m=f.canvas;f.clearRect(0,0,m.width,m.height)}}_drawTiles(c){var h=c.getTilesToDraw().map(j=>j.tile);if(!(c.opacity===0||h.length===0&&!c.placeholderFillStyle)){var f=h[0],m;f&&(m=c.opacity<1||c.compositeOperation&&c.compositeOperation!=="source-over"||!c._isBottomItem()&&c.source.hasTransparency(f.context2D,f.getUrl(),f.ajaxHeaders,f.postData));var v,y,T=this.viewport.getZoom(!0),x=c.viewportToImageZoom(T);h.length>1&&x>c.smoothTileEdgesMinZoom&&!c.iOSDevice&&c.getRotation(!0)%360===0&&(m=!0,v=f.getScaleForEdgeSmoothing(),y=f.getTranslationForEdgeSmoothing(v,this._getCanvasSize(!1),this._getCanvasSize(!0)));var E;m&&(v||(E=this.viewport.viewportToViewerElementRectangle(c.getClippedBounds(!0)).getIntegerBoundingBox(),E=E.times(e.pixelDensityRatio)),this._clear(!0,E)),v||this._setRotations(c,m);var M=!1;if(c._clip){this._saveContext(m);var L=c.imageToViewportRectangle(c._clip,!0);L=L.rotate(-c.getRotation(!0),c._getRotationPoint(!0));var U=this.viewportToDrawerRectangle(L);v&&(U=U.times(v)),y&&(U=U.translate(y)),this._setClip(U,m),M=!0}if(c._croppingPolygons){var K=this;M||this._saveContext(m);try{var q=c._croppingPolygons.map(function(j){return j.map(function(ie){var ce=c.imageToViewportCoordinates(ie.x,ie.y,!0).rotate(-c.getRotation(!0),c._getRotationPoint(!0)),ye=K.viewportCoordToDrawerCoord(ce);return v&&(ye=ye.times(v)),y&&(ye=ye.plus(y)),ye})});this._clipWithPolygons(q,m)}catch(j){e.console.error(j)}M=!0}if(c._hasOpaqueTile=!1,c.placeholderFillStyle&&c._hasOpaqueTile===!1){let j=this.viewportToDrawerRectangle(c.getBoundsNoRotate(!0));v&&(j=j.times(v)),y&&(j=j.translate(y));let ie=null;typeof c.placeholderFillStyle=="function"?ie=c.placeholderFillStyle(c,this.context):ie=c.placeholderFillStyle,this._drawRectangle(j,ie,m)}var Y=a(c.subPixelRoundingForTransparency),te=!1;if(Y===e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS)te=!0;else if(Y===e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST){var fe=this.viewer&&this.viewer.isAnimating();te=!fe}for(var $=0;$<h.length;$++)f=h[$],this._drawTile(f,c,m,v,y,te,c.source),this.viewer&&this.viewer.raiseEvent("tile-drawn",{tiledImage:c,tile:f});M&&this._restoreContext(m),v||(c.getRotation(!0)%360!==0&&this._restoreRotationChanges(m),this.viewport.getRotation(!0)%360!==0&&this._restoreRotationChanges(m)),m&&(v&&this._setRotations(c),this.blendSketch({opacity:c.opacity,scale:v,translate:y,compositeOperation:c.compositeOperation,bounds:E}),v&&(c.getRotation(!0)%360!==0&&this._restoreRotationChanges(!1),this.viewport.getRotation(!0)%360!==0&&this._restoreRotationChanges(!1))),this._drawDebugInfo(c,h),this._raiseTiledImageDrawnEvent(c,h)}}_drawDebugInfo(c,h){if(c.debugMode)for(var f=h.length-1;f>=0;f--){var m=h[f];try{this._drawDebugInfoOnTile(m,h.length,f,c)}catch(v){e.console.error(v)}}}_clipWithPolygons(c,h){var f=this._getContext(h);f.beginPath();for(const m of c)for(const[v,y]of m.entries())f[v===0?"moveTo":"lineTo"](y.x,y.y);f.clip()}_drawTile(c,h,f,m,v,y,T){e.console.assert(c,"[Drawer._drawTile] tile is required"),e.console.assert(h,"[Drawer._drawTile] drawingHandler is required");var x=this._getContext(f);m=m||1,this._drawTileToCanvas(c,x,h,m,v,y,T)}_drawTileToCanvas(c,h,f,m,v,y,T){var x=c.position.times(e.pixelDensityRatio),E=c.size.times(e.pixelDensityRatio),M;if(!c.context2D&&!c.cacheImageRecord){e.console.warn("[Drawer._drawTileToCanvas] attempting to draw tile %s when it's not cached",c.toString());return}if(M=c.getCanvasContext(),!c.loaded||!M){e.console.warn("Attempting to draw tile %s when it's not yet loaded.",c.toString());return}h.save(),typeof m=="number"&&m!==1&&(x=x.times(m),E=E.times(m)),v instanceof e.Point&&(x=x.plus(v)),h.globalAlpha===1&&c.hasTransparency&&(y&&(x.x=Math.round(x.x),x.y=Math.round(x.y),E.x=Math.round(E.x),E.y=Math.round(E.y)),h.clearRect(x.x,x.y,E.x,E.y)),this._raiseTileDrawingEvent(f,h,c,M);var L,U;c.sourceBounds?(L=Math.min(c.sourceBounds.width,M.canvas.width),U=Math.min(c.sourceBounds.height,M.canvas.height)):(L=M.canvas.width,U=M.canvas.height),h.translate(x.x+E.x/2,0),c.flipped&&h.scale(-1,1),h.drawImage(M.canvas,0,0,L,U,-E.x/2,x.y,E.x,E.y),h.restore()}_getContext(c){var h=this.context;if(c){if(this.sketchCanvas===null){this.sketchCanvas=document.createElement("canvas");var f=this._calculateSketchCanvasSize();if(this.sketchCanvas.width=f.x,this.sketchCanvas.height=f.y,this.sketchContext=this.sketchCanvas.getContext("2d"),this.viewport.getRotation()===0){var m=this;this.viewer.addHandler("rotate",function v(){if(m.viewport.getRotation()!==0){m.viewer.removeHandler("rotate",v);var y=m._calculateSketchCanvasSize();m.sketchCanvas.width=y.x,m.sketchCanvas.height=y.y}})}this._updateImageSmoothingEnabled(this.sketchContext)}h=this.sketchContext}return h}_saveContext(c){this._getContext(c).save()}_restoreContext(c){this._getContext(c).restore()}_setClip(c,h){var f=this._getContext(h);f.beginPath(),f.rect(c.x,c.y,c.width,c.height),f.clip()}_drawRectangle(c,h,f){var m=this._getContext(f);m.save(),m.fillStyle=h,m.fillRect(c.x,c.y,c.width,c.height),m.restore()}blendSketch(c,h,f,m){var v=c;e.isPlainObject(v)||(v={opacity:c,scale:h,translate:f,compositeOperation:m}),c=v.opacity,m=v.compositeOperation;var y=v.bounds;if(this.context.save(),this.context.globalAlpha=c,m&&(this.context.globalCompositeOperation=m),y)y.x<0&&(y.width+=y.x,y.x=0),y.x+y.width>this.canvas.width&&(y.width=this.canvas.width-y.x),y.y<0&&(y.height+=y.y,y.y=0),y.y+y.height>this.canvas.height&&(y.height=this.canvas.height-y.y),this.context.drawImage(this.sketchCanvas,y.x,y.y,y.width,y.height,y.x,y.y,y.width,y.height);else{h=v.scale||1,f=v.translate;var T=f instanceof e.Point?f:new e.Point(0,0),x=0,E=0;if(f){var M=this.sketchCanvas.width-this.canvas.width,L=this.sketchCanvas.height-this.canvas.height;x=Math.round(M/2),E=Math.round(L/2)}this.context.drawImage(this.sketchCanvas,T.x-x*h,T.y-E*h,(this.canvas.width+2*x)*h,(this.canvas.height+2*E)*h,-x,-E,this.canvas.width+2*x,this.canvas.height+2*E)}this.context.restore()}_drawDebugInfoOnTile(c,h,f,m){var v=this.viewer.world.getIndexOfItem(m)%this.debugGridColor.length,y=this.context;y.save(),y.lineWidth=2*e.pixelDensityRatio,y.font="small-caps bold "+13*e.pixelDensityRatio+"px arial",y.strokeStyle=this.debugGridColor[v],y.fillStyle=this.debugGridColor[v],this._setRotations(m),this._viewportFlipped&&this._flip({point:c.position.plus(c.size.divide(2))}),y.strokeRect(c.position.x*e.pixelDensityRatio,c.position.y*e.pixelDensityRatio,c.size.x*e.pixelDensityRatio,c.size.y*e.pixelDensityRatio);var T=(c.position.x+c.size.x/2)*e.pixelDensityRatio,x=(c.position.y+c.size.y/2)*e.pixelDensityRatio;y.translate(T,x);const E=this.viewport.getRotation(!0);y.rotate(Math.PI/180*-E),y.translate(-T,-x),c.x===0&&c.y===0&&(y.fillText("Zoom: "+this.viewport.getZoom(),c.position.x*e.pixelDensityRatio,(c.position.y-30)*e.pixelDensityRatio),y.fillText("Pan: "+this.viewport.getBounds().toString(),c.position.x*e.pixelDensityRatio,(c.position.y-20)*e.pixelDensityRatio)),y.fillText("Level: "+c.level,(c.position.x+10)*e.pixelDensityRatio,(c.position.y+20)*e.pixelDensityRatio),y.fillText("Column: "+c.x,(c.position.x+10)*e.pixelDensityRatio,(c.position.y+30)*e.pixelDensityRatio),y.fillText("Row: "+c.y,(c.position.x+10)*e.pixelDensityRatio,(c.position.y+40)*e.pixelDensityRatio),y.fillText("Order: "+f+" of "+h,(c.position.x+10)*e.pixelDensityRatio,(c.position.y+50)*e.pixelDensityRatio),y.fillText("Size: "+c.size.toString(),(c.position.x+10)*e.pixelDensityRatio,(c.position.y+60)*e.pixelDensityRatio),y.fillText("Position: "+c.position.toString(),(c.position.x+10)*e.pixelDensityRatio,(c.position.y+70)*e.pixelDensityRatio),this.viewport.getRotation(!0)%360!==0&&this._restoreRotationChanges(),m.getRotation(!0)%360!==0&&this._restoreRotationChanges(),y.restore()}_updateImageSmoothingEnabled(c){c.msImageSmoothingEnabled=this._imageSmoothingEnabled,c.imageSmoothingEnabled=this._imageSmoothingEnabled}_getCanvasSize(c){var h=this._getContext(c).canvas;return new e.Point(h.width,h.height)}_getCanvasCenter(){return new e.Point(this.canvas.width/2,this.canvas.height/2)}_setRotations(c,h=!1){var f=!1;this.viewport.getRotation(!0)%360!==0&&(this._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:h,saveContext:f}),f=!1),c.getRotation(!0)%360!==0&&this._offsetForRotation({degrees:c.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(c._getRotationPoint(!0),!0),useSketch:h,saveContext:f})}_offsetForRotation(c){var h=c.point?c.point.times(e.pixelDensityRatio):this._getCanvasCenter(),f=this._getContext(c.useSketch);f.save(),f.translate(h.x,h.y),f.rotate(Math.PI/180*c.degrees),f.translate(-h.x,-h.y)}_flip(c){c=c||{};var h=c.point?c.point.times(e.pixelDensityRatio):this._getCanvasCenter(),f=this._getContext(c.useSketch);f.translate(h.x,0),f.scale(-1,1),f.translate(-h.x,0)}_restoreRotationChanges(c){var h=this._getContext(c);h.restore()}_calculateCanvasSize(){var c=e.pixelDensityRatio,h=this.viewport.getContainerSize();return{x:Math.round(h.x*c),y:Math.round(h.y*c)}}_calculateSketchCanvasSize(){var c=this._calculateCanvasSize();if(this.viewport.getRotation()===0)return c;var h=Math.ceil(Math.sqrt(c.x*c.x+c.y*c.y));return{x:h,y:h}}}e.CanvasDrawer=r;var s=e.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER;function o(u){return u!==e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS&&u!==e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST&&u!==e.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER}function l(u){return o(u)?s:u}function a(u){if(typeof u=="number")return l(u);if(!u||!e.Browser)return s;var c=u[e.Browser.vendor];return o(c)&&(c=u["*"]),l(c)}}(i),function(e){const n=e;n.WebGLDrawer=class extends n.DrawerBase{constructor(s){super(s),this._destroyed=!1,this._TextureMap=new Map,this._TileMap=new Map,this._gl=null,this._firstPass=null,this._secondPass=null,this._glFrameBuffer=null,this._renderToTexture=null,this._glFramebufferToCanvasTransform=null,this._outputCanvas=null,this._outputContext=null,this._clippingCanvas=null,this._clippingContext=null,this._renderingCanvas=null,this._backupCanvasDrawer=null,this._imageSmoothingEnabled=!0,this._boundToTileReady=o=>this._tileReadyHandler(o),this._boundToImageUnloaded=o=>this._imageUnloadedHandler(o),this.viewer.addHandler("tile-ready",this._boundToTileReady),this.viewer.addHandler("image-unloaded",this._boundToImageUnloaded),this.viewer.rejectEventHandler("tile-drawn","The WebGLDrawer does not raise the tile-drawn event"),this.viewer.rejectEventHandler("tile-drawing","The WebGLDrawer does not raise the tile-drawing event"),this._setupCanvases(),this._setupRenderer(),this.context=this._outputContext}destroy(){if(this._destroyed)return;let s=this._gl;var o=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS);for(let a=0;a<o;++a)s.activeTexture(s.TEXTURE0+a),s.bindTexture(s.TEXTURE_2D,null),s.bindTexture(s.TEXTURE_CUBE_MAP,null);s.bindBuffer(s.ARRAY_BUFFER,null),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,null),s.bindRenderbuffer(s.RENDERBUFFER,null),s.bindFramebuffer(s.FRAMEBUFFER,null),this._unloadTextures(),s.deleteBuffer(this._secondPass.bufferOutputPosition),s.deleteFramebuffer(this._glFrameBuffer),this._renderingCanvas.width=this._renderingCanvas.height=1,this._clippingCanvas.width=this._clippingCanvas.height=1,this._outputCanvas.width=this._outputCanvas.height=1,this._renderingCanvas=null,this._clippingCanvas=this._clippingContext=null,this._outputCanvas=this._outputContext=null;let l=s.getExtension("WEBGL_lose_context");l&&l.loseContext(),this.viewer.removeHandler("tile-ready",this._boundToTileReady),this.viewer.removeHandler("image-unloaded",this._boundToImageUnloaded),this.viewer.removeHandler("resize",this._resizeHandler),this._gl=null,this._backupCanvasDrawer&&(this._backupCanvasDrawer.destroy(),this._backupCanvasDrawer=null),this.container.removeChild(this.canvas),this.viewer.drawer===this&&(this.viewer.drawer=null),this._destroyed=!0}canRotate(){return!0}static isSupported(){let s=document.createElement("canvas"),o=e.isFunction(s.getContext)&&s.getContext("webgl"),l=o&&o.getExtension("WEBGL_lose_context");return l&&l.loseContext(),!!o}getType(){return"webgl"}minimumOverlapRequired(s){return s.isTainted()}_createDrawingElement(){let s=e.makeNeutralElement("canvas"),o=this._calculateCanvasSize();return s.width=o.x,s.height=o.y,s}_getBackupCanvasDrawer(){return this._backupCanvasDrawer||(this._backupCanvasDrawer=this.viewer.requestDrawer("canvas",{mainDrawer:!1}),this._backupCanvasDrawer.canvas.style.setProperty("visibility","hidden")),this._backupCanvasDrawer}draw(s){let o=this._gl;const l=this.viewport.getBoundsNoRotateWithMargins(!0);let a={bounds:l,center:new n.Point(l.x+l.width/2,l.y+l.height/2),rotation:this.viewport.getRotation(!0)*Math.PI/180},u=this.viewport.flipped?-1:1,c=e.Mat3.makeTranslation(-a.center.x,-a.center.y),h=e.Mat3.makeScaling(2/a.bounds.width*u,-2/a.bounds.height),f=e.Mat3.makeRotation(-a.rotation),m=h.multiply(f).multiply(c);o.bindFramebuffer(o.FRAMEBUFFER,null),o.clear(o.COLOR_BUFFER_BIT),this._outputContext.clearRect(0,0,this._outputCanvas.width,this._outputCanvas.height);let v=!1;s.forEach((y,T)=>{if(y.isTainted()){v&&(this._outputContext.drawImage(this._renderingCanvas,0,0),o.bindFramebuffer(o.FRAMEBUFFER,null),o.clear(o.COLOR_BUFFER_BIT),v=!1);const x=this._getBackupCanvasDrawer();x.draw([y]),this._outputContext.drawImage(x.canvas,0,0)}else{let x=y.getTilesToDraw();if(y.placeholderFillStyle&&y._hasOpaqueTile===!1&&this._drawPlaceholder(y),x.length===0||y.getOpacity()===0)return;let E=x[0],M=y.compositeOperation||this.viewer.compositeOperation||y._clip||y._croppingPolygons||y.debugMode,L=M||y.opacity<1||E.hasTransparency;M&&(v&&this._outputContext.drawImage(this._renderingCanvas,0,0),o.bindFramebuffer(o.FRAMEBUFFER,null),o.clear(o.COLOR_BUFFER_BIT)),o.useProgram(this._firstPass.shaderProgram),L?(o.bindFramebuffer(o.FRAMEBUFFER,this._glFrameBuffer),o.clear(o.COLOR_BUFFER_BIT)):o.bindFramebuffer(o.FRAMEBUFFER,null);let U=m,K=y.getRotation(!0);if(K%360!==0){let j=e.Mat3.makeRotation(-K*Math.PI/180),ie=y.getBoundsNoRotate(!0).getCenter(),ce=e.Mat3.makeTranslation(ie.x,ie.y),ye=e.Mat3.makeTranslation(-ie.x,-ie.y),me=ce.multiply(j).multiply(ye);U=m.multiply(me)}let q=this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS);if(q<=0)throw new Error(`WegGL error: bad value for gl parameter MAX_TEXTURE_IMAGE_UNITS (${q}). This could happen
if too many contexts have been created and not released, or there is another problem with the graphics card.`);let Y=new Float32Array(q*12),te=new Array(q),fe=new Array(q),$=new Array(q);for(let j=0;j<x.length;j++){let ie=x[j].tile,ce=j%q,ye=ce+1,me=ie.getCanvasContext(),pe=me?this._TextureMap.get(me.canvas):null;if(pe||(this._tileReadyHandler({tile:ie,tiledImage:y}),pe=me?this._TextureMap.get(me.canvas):null),pe&&this._getTileData(ie,y,pe,U,ce,Y,te,fe,$),ye===q||j===x.length-1){for(let oe=0;oe<=ye;oe++)o.activeTexture(o.TEXTURE0+oe),o.bindTexture(o.TEXTURE_2D,te[oe]);o.bindBuffer(o.ARRAY_BUFFER,this._firstPass.bufferTexturePosition),o.bufferData(o.ARRAY_BUFFER,Y,o.DYNAMIC_DRAW),fe.forEach((oe,Ae)=>{o.uniformMatrix3fv(this._firstPass.uTransformMatrices[Ae],!1,oe)}),o.uniform1fv(this._firstPass.uOpacities,new Float32Array($)),o.bindBuffer(o.ARRAY_BUFFER,this._firstPass.bufferOutputPosition),o.vertexAttribPointer(this._firstPass.aOutputPosition,2,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,this._firstPass.bufferTexturePosition),o.vertexAttribPointer(this._firstPass.aTexturePosition,2,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,this._firstPass.bufferIndex),o.vertexAttribPointer(this._firstPass.aIndex,1,o.FLOAT,!1,0,0),o.drawArrays(o.TRIANGLES,0,6*ye)}}L&&(o.useProgram(this._secondPass.shaderProgram),o.bindFramebuffer(o.FRAMEBUFFER,null),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,this._renderToTexture),this._gl.uniform1f(this._secondPass.uOpacityMultiplier,y.opacity),o.bindBuffer(o.ARRAY_BUFFER,this._secondPass.bufferTexturePosition),o.vertexAttribPointer(this._secondPass.aTexturePosition,2,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,this._secondPass.bufferOutputPosition),o.vertexAttribPointer(this._secondPass.aOutputPosition,2,o.FLOAT,!1,0,0),o.drawArrays(o.TRIANGLES,0,6)),v=!0,M&&(this._applyContext2dPipeline(y,x,T),v=!1,o.bindFramebuffer(o.FRAMEBUFFER,null),o.clear(o.COLOR_BUFFER_BIT)),T===0&&this._raiseTiledImageDrawnEvent(y,x.map(j=>j.tile))}}),v&&this._outputContext.drawImage(this._renderingCanvas,0,0)}setImageSmoothingEnabled(s){this._imageSmoothingEnabled!==s&&(this._imageSmoothingEnabled=s,this._unloadTextures(),this.viewer.world.draw())}drawDebuggingRect(s){let o=this._outputContext;o.save(),o.lineWidth=2*e.pixelDensityRatio,o.strokeStyle=this.debugGridColor[0],o.fillStyle=this.debugGridColor[0],o.strokeRect(s.x*e.pixelDensityRatio,s.y*e.pixelDensityRatio,s.width*e.pixelDensityRatio,s.height*e.pixelDensityRatio),o.restore()}_getTextureDataFromTile(s){return s.getCanvasContext().canvas}_applyContext2dPipeline(s,o,l){if(this._outputContext.save(),this._outputContext.globalCompositeOperation=l===0?null:s.compositeOperation||this.viewer.compositeOperation,s._croppingPolygons||s._clip?(this._renderToClippingCanvas(s),this._outputContext.drawImage(this._clippingCanvas,0,0)):this._outputContext.drawImage(this._renderingCanvas,0,0),this._outputContext.restore(),s.debugMode){const a=this.viewer.viewport.getFlip();a&&this._flip(),this._drawDebugInfo(o,s,a),a&&this._flip()}}_getTileData(s,o,l,a,u,c,h,f,m){let v=l.texture,y=l.position;c.set(y,u*12);let T=this._calculateOverlapFraction(s,o),x=s.positionedBounds.width*T.x,E=s.positionedBounds.height*T.y,M=s.positionedBounds.x+(s.x===0?0:x),L=s.positionedBounds.y+(s.y===0?0:E),U=s.positionedBounds.x+s.positionedBounds.width-(s.isRightMost?0:x),K=s.positionedBounds.y+s.positionedBounds.height-(s.isBottomMost?0:E),q=U-M,Y=K-L,te=new e.Mat3([q,0,0,0,Y,0,M,L,1]);if(s.flipped){let $=e.Mat3.makeTranslation(.5,0),j=e.Mat3.makeTranslation(-.5,0),ie=$.multiply(e.Mat3.makeScaling(-1,1)).multiply(j);te=te.multiply(ie)}let fe=a.multiply(te);m[u]=s.opacity,h[u]=v,f[u]=fe.values}_textureFilter(){return this._imageSmoothingEnabled?this._gl.LINEAR:this._gl.NEAREST}_setupRenderer(){let s=this._gl;s||e.console.error("_setupCanvases must be called before _setupRenderer"),this._unitQuad=this._makeQuadVertexBuffer(0,1,0,1),this._makeFirstPassShaderProgram(),this._makeSecondPassShaderProgram(),this._renderToTexture=s.createTexture(),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this._renderToTexture),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,this._renderingCanvas.width,this._renderingCanvas.height,0,s.RGBA,s.UNSIGNED_BYTE,null),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,this._textureFilter()),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),this._glFrameBuffer=s.createFramebuffer(),s.bindFramebuffer(s.FRAMEBUFFER,this._glFrameBuffer),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,this._renderToTexture,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)}_makeFirstPassShaderProgram(){let s=this._glNumTextures=this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),o=()=>[...Array(s).keys()].map(v=>`uniform mat3 u_matrix_${v};`).join(`
`),l=()=>[...Array(s).keys()].map(v=>`${v>0?"else ":""}if(int(a_index) == ${v}) { transform_matrix = u_matrix_${v}; }`).join(`
`);const a=`
attribute vec2 a_output_position;
attribute vec2 a_texture_position;
attribute float a_index;
${o()} // create a uniform mat3 for each potential tile to draw
varying vec2 v_texture_position;
varying float v_image_index;
void main() {
mat3 transform_matrix; // value will be set by the if/elses in makeConditional()
${l()}
gl_Position = vec4(transform_matrix * vec3(a_output_position, 1), 1);
v_texture_position = a_texture_position;
v_image_index = a_index;
}
`,u=`
precision mediump float;
// our textures
uniform sampler2D u_images[${s}];
// our opacities
uniform float u_opacities[${s}];
// the varyings passed in from the vertex shader.
varying vec2 v_texture_position;
varying float v_image_index;
void main() {
// can't index directly with a variable, need to use a loop iterator hack
for(int i = 0; i < ${s}; ++i){
if(i == int(v_image_index)){
gl_FragColor = texture2D(u_images[i], v_texture_position) * u_opacities[i];
}
}
}
`;let c=this._gl,h=this.constructor.initShaderProgram(c,a,u);c.useProgram(h),this._firstPass={shaderProgram:h,aOutputPosition:c.getAttribLocation(h,"a_output_position"),aTexturePosition:c.getAttribLocation(h,"a_texture_position"),aIndex:c.getAttribLocation(h,"a_index"),uTransformMatrices:[...Array(this._glNumTextures).keys()].map(v=>c.getUniformLocation(h,`u_matrix_${v}`)),uImages:c.getUniformLocation(h,"u_images"),uOpacities:c.getUniformLocation(h,"u_opacities"),bufferOutputPosition:c.createBuffer(),bufferTexturePosition:c.createBuffer(),bufferIndex:c.createBuffer()},c.uniform1iv(this._firstPass.uImages,[...Array(s).keys()]);let f=new Float32Array(s*12);for(let v=0;v<s;++v)f.set(Float32Array.from(this._unitQuad),v*12);c.bindBuffer(c.ARRAY_BUFFER,this._firstPass.bufferOutputPosition),c.bufferData(c.ARRAY_BUFFER,f,c.STATIC_DRAW),c.enableVertexAttribArray(this._firstPass.aOutputPosition),c.bindBuffer(c.ARRAY_BUFFER,this._firstPass.bufferTexturePosition),c.enableVertexAttribArray(this._firstPass.aTexturePosition),c.bindBuffer(c.ARRAY_BUFFER,this._firstPass.bufferIndex);let m=[...Array(this._glNumTextures).keys()].map(v=>Array(6).fill(v)).flat();c.bufferData(c.ARRAY_BUFFER,new Float32Array(m),c.STATIC_DRAW),c.enableVertexAttribArray(this._firstPass.aIndex)}_makeSecondPassShaderProgram(){const s=`
attribute vec2 a_output_position;
attribute vec2 a_texture_position;
uniform mat3 u_matrix;
varying vec2 v_texture_position;
void main() {
gl_Position = vec4(u_matrix * vec3(a_output_position, 1), 1);
v_texture_position = a_texture_position;
}
`,o=`
precision mediump float;
// our texture
uniform sampler2D u_image;
// the texCoords passed in from the vertex shader.
varying vec2 v_texture_position;
// the opacity multiplier for the image
uniform float u_opacity_multiplier;
void main() {
gl_FragColor = texture2D(u_image, v_texture_position);
gl_FragColor *= u_opacity_multiplier;
}
`;let l=this._gl,a=this.constructor.initShaderProgram(l,s,o);l.useProgram(a),this._secondPass={shaderProgram:a,aOutputPosition:l.getAttribLocation(a,"a_output_position"),aTexturePosition:l.getAttribLocation(a,"a_texture_position"),uMatrix:l.getUniformLocation(a,"u_matrix"),uImage:l.getUniformLocation(a,"u_image"),uOpacityMultiplier:l.getUniformLocation(a,"u_opacity_multiplier"),bufferOutputPosition:l.createBuffer(),bufferTexturePosition:l.createBuffer()},l.bindBuffer(l.ARRAY_BUFFER,this._secondPass.bufferOutputPosition),l.bufferData(l.ARRAY_BUFFER,this._unitQuad,l.STATIC_DRAW),l.enableVertexAttribArray(this._secondPass.aOutputPosition),l.bindBuffer(l.ARRAY_BUFFER,this._secondPass.bufferTexturePosition),l.bufferData(l.ARRAY_BUFFER,this._unitQuad,l.DYNAMIC_DRAW),l.enableVertexAttribArray(this._secondPass.aTexturePosition);let u=e.Mat3.makeScaling(2,2).multiply(e.Mat3.makeTranslation(-.5,-.5));l.uniformMatrix3fv(this._secondPass.uMatrix,!1,u.values)}_resizeRenderer(){let s=this._gl,o=this._renderingCanvas.width,l=this._renderingCanvas.height;s.viewport(0,0,o,l),s.deleteTexture(this._renderToTexture),this._renderToTexture=s.createTexture(),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this._renderToTexture),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,o,l,0,s.RGBA,s.UNSIGNED_BYTE,null),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,this._textureFilter()),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.bindFramebuffer(s.FRAMEBUFFER,this._glFrameBuffer),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,this._renderToTexture,0)}_setupCanvases(){let s=this;this._outputCanvas=this.canvas,this._outputContext=this._outputCanvas.getContext("2d"),this._renderingCanvas=document.createElement("canvas"),this._clippingCanvas=document.createElement("canvas"),this._clippingContext=this._clippingCanvas.getContext("2d"),this._renderingCanvas.width=this._clippingCanvas.width=this._outputCanvas.width,this._renderingCanvas.height=this._clippingCanvas.height=this._outputCanvas.height,this._gl=this._renderingCanvas.getContext("webgl"),this._resizeHandler=function(){s._outputCanvas!==s.viewer.drawer.canvas&&(s._outputCanvas.style.width=s.viewer.drawer.canvas.clientWidth+"px",s._outputCanvas.style.height=s.viewer.drawer.canvas.clientHeight+"px");let o=s._calculateCanvasSize();(s._outputCanvas.width!==o.x||s._outputCanvas.height!==o.y)&&(s._outputCanvas.width=o.x,s._outputCanvas.height=o.y),s._renderingCanvas.style.width=s._outputCanvas.clientWidth+"px",s._renderingCanvas.style.height=s._outputCanvas.clientHeight+"px",s._renderingCanvas.width=s._clippingCanvas.width=s._outputCanvas.width,s._renderingCanvas.height=s._clippingCanvas.height=s._outputCanvas.height,s._resizeRenderer()},this.viewer.addHandler("resize",this._resizeHandler)}_makeQuadVertexBuffer(s,o,l,a){return new Float32Array([s,a,o,a,s,l,s,l,o,a,o,l])}_tileReadyHandler(s){let o=s.tile,l=s.tiledImage;if(l.isTainted())return;let a=o.getCanvasContext(),u=a&&a.canvas;if(!u||e.isCanvasTainted(u)){l.isTainted()||(l.setTainted(!0),e.console.warn("WebGL cannot be used to draw this TiledImage because it has tainted data. Does crossOriginPolicy need to be set?"),this._raiseDrawerErrorEvent(l,"Tainted data cannot be used by the WebGLDrawer. Falling back to CanvasDrawer for this TiledImage."));return}if(!this._TextureMap.get(u)){let h=this._gl,f=h.createTexture(),m,v=l.source.tileOverlap,y,T;if(o.sourceBounds?(y=Math.min(o.sourceBounds.width,u.width)/u.width,T=Math.min(o.sourceBounds.height,u.height)/u.height):(y=1,T=1),v>0){let E=this._calculateOverlapFraction(o,l),M=(o.x===0?0:E.x)*y,L=(o.y===0?0:E.y)*T,U=(o.isRightMost?1:1-E.x)*y,K=(o.isBottomMost?1:1-E.y)*T;m=this._makeQuadVertexBuffer(M,U,L,K)}else y===1&&T===1?m=this._unitQuad:m=this._makeQuadVertexBuffer(0,y,0,T);let x={texture:f,position:m};this._TextureMap.set(u,x),h.activeTexture(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,f),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,this._textureFilter()),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,this._textureFilter()),this._uploadImageData(a)}}_calculateOverlapFraction(s,o){let l=o.source.tileOverlap,a=s.sourceBounds.width,u=s.sourceBounds.height,c=(s.x===0?0:l)+(s.isRightMost?0:l),h=(s.y===0?0:l)+(s.isBottomMost?0:l),f=l/(a+c),m=l/(u+h);return{x:f,y:m}}_unloadTextures(){Array.from(this._TextureMap.keys()).forEach(o=>{this._cleanupImageData(o)})}_uploadImageData(s){let o=this._gl,l=s.canvas;try{if(!l)throw s;o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,l)}catch(a){e.console.error("Error uploading image data to WebGL",a)}}_imageUnloadedHandler(s){let o=s.context2D.canvas;this._cleanupImageData(o)}_cleanupImageData(s){let o=this._TextureMap.get(s);this._TextureMap.delete(s),o&&this._gl.deleteTexture(o.texture)}_setClip(){}_renderToClippingCanvas(s){if(this._clippingContext.clearRect(0,0,this._clippingCanvas.width,this._clippingCanvas.height),this._clippingContext.save(),this.viewer.viewport.getFlip()){const o=new e.Point(this.canvas.width/2,this.canvas.height/2);this._clippingContext.translate(o.x,0),this._clippingContext.scale(-1,1),this._clippingContext.translate(-o.x,0)}if(s._clip){let l=[{x:s._clip.x,y:s._clip.y},{x:s._clip.x+s._clip.width,y:s._clip.y},{x:s._clip.x+s._clip.width,y:s._clip.y+s._clip.height},{x:s._clip.x,y:s._clip.y+s._clip.height}].map(a=>{let u=s.imageToViewportCoordinates(a.x,a.y,!0).rotate(this.viewer.viewport.getRotation(!0),this.viewer.viewport.getCenter(!0));return this.viewportCoordToDrawerCoord(u)});this._clippingContext.beginPath(),l.forEach((a,u)=>{this._clippingContext[u===0?"moveTo":"lineTo"](a.x,a.y)}),this._clippingContext.clip(),this._setClip()}if(s._croppingPolygons){let o=s._croppingPolygons.map(l=>l.map(a=>{let u=s.imageToViewportCoordinates(a.x,a.y,!0).rotate(this.viewer.viewport.getRotation(!0),this.viewer.viewport.getCenter(!0));return this.viewportCoordToDrawerCoord(u)}));this._clippingContext.beginPath(),o.forEach(l=>{l.forEach((a,u)=>{this._clippingContext[u===0?"moveTo":"lineTo"](a.x,a.y)})}),this._clippingContext.clip()}if(this.viewer.viewport.getFlip()){const o=new e.Point(this.canvas.width/2,this.canvas.height/2);this._clippingContext.translate(o.x,0),this._clippingContext.scale(-1,1),this._clippingContext.translate(-o.x,0)}this._clippingContext.drawImage(this._renderingCanvas,0,0),this._clippingContext.restore()}_setRotations(s){var o=!1;this.viewport.getRotation(!0)%360!==0&&(this._offsetForRotation({degrees:this.viewport.getRotation(!0),saveContext:o}),o=!1),s.getRotation(!0)%360!==0&&this._offsetForRotation({degrees:s.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(s._getRotationPoint(!0),!0),saveContext:o})}_offsetForRotation(s){var o=s.point?s.point.times(e.pixelDensityRatio):this._getCanvasCenter(),l=this._outputContext;l.save(),l.translate(o.x,o.y),l.rotate(Math.PI/180*s.degrees),l.translate(-o.x,-o.y)}_flip(s){s=s||{};var o=s.point?s.point.times(e.pixelDensityRatio):this._getCanvasCenter(),l=this._outputContext;l.translate(o.x,0),l.scale(-1,1),l.translate(-o.x,0)}_drawDebugInfo(s,o,l){for(var a=s.length-1;a>=0;a--){var u=s[a].tile;try{this._drawDebugInfoOnTile(u,s.length,a,o,l)}catch(c){e.console.error(c)}}}_drawDebugInfoOnTile(s,o,l,a,u){var c=this.viewer.world.getIndexOfItem(a)%this.debugGridColor.length,h=this.context;h.save(),h.lineWidth=2*e.pixelDensityRatio,h.font="small-caps bold "+13*e.pixelDensityRatio+"px arial",h.strokeStyle=this.debugGridColor[c],h.fillStyle=this.debugGridColor[c],this._setRotations(a),u&&this._flip({point:s.position.plus(s.size.divide(2))}),h.strokeRect(s.position.x*e.pixelDensityRatio,s.position.y*e.pixelDensityRatio,s.size.x*e.pixelDensityRatio,s.size.y*e.pixelDensityRatio);var f=(s.position.x+s.size.x/2)*e.pixelDensityRatio,m=(s.position.y+s.size.y/2)*e.pixelDensityRatio;h.translate(f,m);const v=this.viewport.getRotation(!0);h.rotate(Math.PI/180*-v),h.translate(-f,-m),s.x===0&&s.y===0&&(h.fillText("Zoom: "+this.viewport.getZoom(),s.position.x*e.pixelDensityRatio,(s.position.y-30)*e.pixelDensityRatio),h.fillText("Pan: "+this.viewport.getBounds().toString(),s.position.x*e.pixelDensityRatio,(s.position.y-20)*e.pixelDensityRatio)),h.fillText("Level: "+s.level,(s.position.x+10)*e.pixelDensityRatio,(s.position.y+20)*e.pixelDensityRatio),h.fillText("Column: "+s.x,(s.position.x+10)*e.pixelDensityRatio,(s.position.y+30)*e.pixelDensityRatio),h.fillText("Row: "+s.y,(s.position.x+10)*e.pixelDensityRatio,(s.position.y+40)*e.pixelDensityRatio),h.fillText("Order: "+l+" of "+o,(s.position.x+10)*e.pixelDensityRatio,(s.position.y+50)*e.pixelDensityRatio),h.fillText("Size: "+s.size.toString(),(s.position.x+10)*e.pixelDensityRatio,(s.position.y+60)*e.pixelDensityRatio),h.fillText("Position: "+s.position.toString(),(s.position.x+10)*e.pixelDensityRatio,(s.position.y+70)*e.pixelDensityRatio),this.viewport.getRotation(!0)%360!==0&&this._restoreRotationChanges(),a.getRotation(!0)%360!==0&&this._restoreRotationChanges(),h.restore()}_drawPlaceholder(s){const o=s.getBounds(!0),l=this.viewportToDrawerRectangle(s.getBounds(!0)),a=this._outputContext;let u;typeof s.placeholderFillStyle=="function"?u=s.placeholderFillStyle(s,a):u=s.placeholderFillStyle,this._offsetForRotation({degrees:this.viewer.viewport.getRotation(!0)}),a.fillStyle=u,a.translate(l.x,l.y),a.rotate(Math.PI/180*o.degrees),a.translate(-l.x,-l.y),a.fillRect(l.x,l.y,l.width,l.height),this._restoreRotationChanges()}_getCanvasCenter(){return new e.Point(this.canvas.width/2,this.canvas.height/2)}_restoreRotationChanges(){var s=this._outputContext;s.restore()}static initShaderProgram(s,o,l){function a(f,m,v){const y=f.createShader(m);return f.shaderSource(y,v),f.compileShader(y),f.getShaderParameter(y,f.COMPILE_STATUS)?y:(e.console.error(`An error occurred compiling the shaders: ${f.getShaderInfoLog(y)}`),f.deleteShader(y),null)}const u=a(s,s.VERTEX_SHADER,o),c=a(s,s.FRAGMENT_SHADER,l),h=s.createProgram();return s.attachShader(h,u),s.attachShader(h,c),s.linkProgram(h),s.getProgramParameter(h,s.LINK_STATUS)?h:(e.console.error(`Unable to initialize the shader program: ${s.getProgramInfoLog(h)}`),null)}}}(i),function(e){e.Viewport=function(n){var r=arguments;r.length&&r[0]instanceof e.Point&&(n={containerSize:r[0],contentSize:r[1],config:r[2]}),n.config&&(e.extend(!0,n,n.config),delete n.config),this._margins=e.extend({left:0,top:0,right:0,bottom:0},n.margins||{}),delete n.margins,n.initialDegrees=n.degrees,delete n.degrees,e.extend(!0,this,{containerSize:null,contentSize:null,zoomPoint:null,rotationPivot:null,viewer:null,springStiffness:e.DEFAULT_SETTINGS.springStiffness,animationTime:e.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:e.DEFAULT_SETTINGS.minZoomImageRatio,maxZoomPixelRatio:e.DEFAULT_SETTINGS.maxZoomPixelRatio,visibilityRatio:e.DEFAULT_SETTINGS.visibilityRatio,wrapHorizontal:e.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:e.DEFAULT_SETTINGS.wrapVertical,defaultZoomLevel:e.DEFAULT_SETTINGS.defaultZoomLevel,minZoomLevel:e.DEFAULT_SETTINGS.minZoomLevel,maxZoomLevel:e.DEFAULT_SETTINGS.maxZoomLevel,initialDegrees:e.DEFAULT_SETTINGS.degrees,flipped:e.DEFAULT_SETTINGS.flipped,homeFillsViewer:e.DEFAULT_SETTINGS.homeFillsViewer,silenceMultiImageWarnings:e.DEFAULT_SETTINGS.silenceMultiImageWarnings},n),this._updateContainerInnerSize(),this.centerSpringX=new e.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.centerSpringY=new e.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.zoomSpring=new e.Spring({exponential:!0,initial:1,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.degreesSpring=new e.Spring({initial:n.initialDegrees,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._oldCenterX=this.centerSpringX.current.value,this._oldCenterY=this.centerSpringY.current.value,this._oldZoom=this.zoomSpring.current.value,this._oldDegrees=this.degreesSpring.current.value,this._setContentBounds(new e.Rect(0,0,1,1),1),this.goHome(!0),this.update()},e.Viewport.prototype={get degrees(){return e.console.warn("Accessing [Viewport.degrees] is deprecated. Use viewport.getRotation instead."),this.getRotation()},set degrees(n){e.console.warn("Setting [Viewport.degrees] is deprecated. Use viewport.rotateTo, viewport.rotateBy, or viewport.setRotation instead."),this.rotateTo(n)},resetContentSize:function(n){return e.console.assert(n,"[Viewport.resetContentSize] contentSize is required"),e.console.assert(n instanceof e.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point"),e.console.assert(n.x>0,"[Viewport.resetContentSize] contentSize.x must be greater than 0"),e.console.assert(n.y>0,"[Viewport.resetContentSize] contentSize.y must be greater than 0"),this._setContentBounds(new e.Rect(0,0,1,n.y/n.x),n.x),this},setHomeBounds:function(n,r){e.console.error("[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually."),this._setContentBounds(n,r)},_setContentBounds:function(n,r){e.console.assert(n,"[Viewport._setContentBounds] bounds is required"),e.console.assert(n instanceof e.Rect,"[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect"),e.console.assert(n.width>0,"[Viewport._setContentBounds] bounds.width must be greater than 0"),e.console.assert(n.height>0,"[Viewport._setContentBounds] bounds.height must be greater than 0"),this._contentBoundsNoRotate=n.clone(),this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(r),this._contentBounds=n.rotate(this.getRotation()).getBoundingBox(),this._contentSize=this._contentBounds.getSize().times(r),this._contentAspectRatio=this._contentSize.x/this._contentSize.y,this.viewer&&this.viewer.raiseEvent("reset-size",{contentSize:this._contentSizeNoRotate.clone(),contentFactor:r,homeBounds:this._contentBoundsNoRotate.clone(),contentBounds:this._contentBounds.clone()})},getHomeZoom:function(){if(this.defaultZoomLevel)return this.defaultZoomLevel;var n=this._contentAspectRatio/this.getAspectRatio(),r;return this.homeFillsViewer?r=n>=1?n:1:r=n>=1?1:n,r/this._contentBounds.width},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation())},getHomeBoundsNoRotate:function(){var n=this._contentBounds.getCenter(),r=1/this.getHomeZoom(),s=r/this.getAspectRatio();return new e.Rect(n.x-r/2,n.y-s/2,r,s)},goHome:function(n){return this.viewer&&this.viewer.raiseEvent("home",{immediately:n}),this.fitBounds(this.getHomeBounds(),n)},getMinZoom:function(){var n=this.getHomeZoom(),r=this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*n;return r},getMaxZoom:function(){var n=this.maxZoomLevel;return n||(n=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x,n/=this._contentBounds.width),Math.max(n,this.getHomeZoom())},getAspectRatio:function(){return this._containerInnerSize.x/this._containerInnerSize.y},getContainerSize:function(){return new e.Point(this.containerSize.x,this.containerSize.y)},getMargins:function(){return e.extend({},this._margins)},setMargins:function(n){e.console.assert(e.type(n)==="object","[Viewport.setMargins] margins must be an object"),this._margins=e.extend({left:0,top:0,right:0,bottom:0},n),this._updateContainerInnerSize(),this.viewer&&this.viewer.forceRedraw()},getBounds:function(n){return this.getBoundsNoRotate(n).rotate(-this.getRotation(n))},getBoundsNoRotate:function(n){var r=this.getCenter(n),s=1/this.getZoom(n),o=s/this.getAspectRatio();return new e.Rect(r.x-s/2,r.y-o/2,s,o)},getBoundsWithMargins:function(n){return this.getBoundsNoRotateWithMargins(n).rotate(-this.getRotation(n),this.getCenter(n))},getBoundsNoRotateWithMargins:function(n){var r=this.getBoundsNoRotate(n),s=this._containerInnerSize.x*this.getZoom(n);return r.x-=this._margins.left/s,r.y-=this._margins.top/s,r.width+=(this._margins.left+this._margins.right)/s,r.height+=(this._margins.top+this._margins.bottom)/s,r},getCenter:function(n){var r=new e.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),s=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value),o,l,a,u,c,h,f,m;return n?r:this.zoomPoint?(o=this.pixelFromPoint(this.zoomPoint,!0),l=this.getZoom(),a=1/l,u=a/this.getAspectRatio(),c=new e.Rect(r.x-a/2,r.y-u/2,a,u),h=this._pixelFromPoint(this.zoomPoint,c),f=h.minus(o).rotate(-this.getRotation(!0)),m=f.divide(this._containerInnerSize.x*l),s.plus(m)):s},getZoom:function(n){return n?this.zoomSpring.current.value:this.zoomSpring.target.value},_applyZoomConstraints:function(n){return Math.max(Math.min(n,this.getMaxZoom()),this.getMinZoom())},_applyBoundaryConstraints:function(n){var r=this.viewportToViewerElementRectangle(n).getBoundingBox(),s=this.viewportToViewerElementRectangle(this._contentBoundsNoRotate).getBoundingBox(),o=!1,l=!1;if(!this.wrapHorizontal){var a=r.x+r.width,u=s.x+s.width,c,h,f;r.width>s.width?c=this.visibilityRatio*s.width:c=this.visibilityRatio*r.width,h=s.x-a+c,f=u-r.x-c,c>s.width?(r.x+=(h+f)/2,o=!0):f<0?(r.x+=f,o=!0):h>0&&(r.x+=h,o=!0)}if(!this.wrapVertical){var m=r.y+r.height,v=s.y+s.height,y,T,x;r.height>s.height?y=this.visibilityRatio*s.height:y=this.visibilityRatio*r.height,T=s.y-m+y,x=v-r.y-y,y>s.height?(r.y+=(T+x)/2,l=!0):x<0?(r.y+=x,l=!0):T>0&&(r.y+=T,l=!0)}var E=o||l,M=E?this.viewerElementToViewportRectangle(r):n.clone();return M.xConstrained=o,M.yConstrained=l,M.constraintApplied=E,M},_raiseConstraintsEvent:function(n){this.viewer&&this.viewer.raiseEvent("constrain",{immediately:n})},applyConstraints:function(n){var r=this.getZoom(),s=this._applyZoomConstraints(r);r!==s&&this.zoomTo(s,this.zoomPoint,n);var o=this.getConstrainedBounds(!1);return o.constraintApplied&&(this.fitBounds(o,n),this._raiseConstraintsEvent(n)),this},ensureVisible:function(n){return this.applyConstraints(n)},_fitBounds:function(n,r){r=r||{};var s=r.immediately||!1,o=r.constraints||!1,l=this.getAspectRatio(),a=n.getCenter(),u=new e.Rect(n.x,n.y,n.width,n.height,n.degrees+this.getRotation()).getBoundingBox();u.getAspectRatio()>=l?u.height=u.width/l:u.width=u.height*l,u.x=a.x-u.width/2,u.y=a.y-u.height/2;var c=1/u.width;if(s)return this.panTo(a,!0),this.zoomTo(c,null,!0),o&&this.applyConstraints(!0),this;var h=this.getCenter(!0),f=this.getZoom(!0);this.panTo(h,!0),this.zoomTo(f,null,!0);var m=this.getBounds(),v=this.getZoom();if(v===0||Math.abs(c/v-1)<1e-8)return this.zoomTo(c,null,!0),this.panTo(a,s),o&&this.applyConstraints(!1),this;if(o){this.panTo(a,!1),c=this._applyZoomConstraints(c),this.zoomTo(c,null,!1);var y=this.getConstrainedBounds();this.panTo(h,!0),this.zoomTo(f,null,!0),this.fitBounds(y)}else{var T=u.rotate(-this.getRotation()),x=T.getTopLeft().times(c).minus(m.getTopLeft().times(v)).divide(c-v);this.zoomTo(c,x,s)}return this},fitBounds:function(n,r){return this._fitBounds(n,{immediately:r,constraints:!1})},fitBoundsWithConstraints:function(n,r){return this._fitBounds(n,{immediately:r,constraints:!0})},fitVertically:function(n){var r=new e.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(r,n)},fitHorizontally:function(n){var r=new e.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(r,n)},getConstrainedBounds:function(n){var r,s;return r=this.getBounds(n),s=this._applyBoundaryConstraints(r),s},panBy:function(n,r){var s=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(s.plus(n),r)},panTo:function(n,r){return r?(this.centerSpringX.resetTo(n.x),this.centerSpringY.resetTo(n.y)):(this.centerSpringX.springTo(n.x),this.centerSpringY.springTo(n.y)),this.viewer&&this.viewer.raiseEvent("pan",{center:n,immediately:r}),this},zoomBy:function(n,r,s){return this.zoomTo(this.zoomSpring.target.value*n,r,s)},zoomTo:function(n,r,s){var o=this;return this.zoomPoint=r instanceof e.Point&&!isNaN(r.x)&&!isNaN(r.y)?r:null,s?this._adjustCenterSpringsForZoomPoint(function(){o.zoomSpring.resetTo(n)}):this.zoomSpring.springTo(n),this.viewer&&this.viewer.raiseEvent("zoom",{zoom:n,refPoint:r,immediately:s}),this},setRotation:function(n,r){return this.rotateTo(n,null,r)},getRotation:function(n){return n?this.degreesSpring.current.value:this.degreesSpring.target.value},setRotationWithPivot:function(n,r,s){return this.rotateTo(n,r,s)},rotateTo:function(n,r,s){if(!this.viewer||!this.viewer.drawer.canRotate())return this;if(this.degreesSpring.target.value===n&&this.degreesSpring.isAtTargetValue())return this;if(this.rotationPivot=r instanceof e.Point&&!isNaN(r.x)&&!isNaN(r.y)?r:null,s)if(this.rotationPivot){var o=n-this._oldDegrees;if(!o)return this.rotationPivot=null,this;this._rotateAboutPivot(n)}else this.degreesSpring.resetTo(n);else{var l=e.positiveModulo(this.degreesSpring.current.value,360),a=e.positiveModulo(n,360),u=a-l;u>180?a-=360:u<-180&&(a+=360);var c=l-a;this.degreesSpring.resetTo(n+c),this.degreesSpring.springTo(n)}return this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor()),this.viewer.forceRedraw(),this.viewer.raiseEvent("rotate",{degrees:n,immediately:!!s,pivot:this.rotationPivot||this.getCenter()}),this},rotateBy:function(n,r,s){return this.rotateTo(this.degreesSpring.target.value+n,r,s)},resize:function(n,r){var s=this.getBoundsNoRotate(),o=s,l;this.containerSize.x=n.x,this.containerSize.y=n.y,this._updateContainerInnerSize(),r&&(l=n.x/this.containerSize.x,o.width=s.width*l,o.height=o.width/this.getAspectRatio()),this.viewer&&this.viewer.raiseEvent("resize",{newContainerSize:n,maintain:r});var a=this.fitBounds(o,!0);return this.viewer&&this.viewer.raiseEvent("after-resize",{newContainerSize:n,maintain:r}),a},_updateContainerInnerSize:function(){this._containerInnerSize=new e.Point(Math.max(1,this.containerSize.x-(this._margins.left+this._margins.right)),Math.max(1,this.containerSize.y-(this._margins.top+this._margins.bottom)))},update:function(){var n=this;this._adjustCenterSpringsForZoomPoint(function(){n.zoomSpring.update()}),this.degreesSpring.isAtTargetValue()&&(this.rotationPivot=null),this.centerSpringX.update(),this.centerSpringY.update(),this.rotationPivot?this._rotateAboutPivot(!0):this.degreesSpring.update();var r=this.centerSpringX.current.value!==this._oldCenterX||this.centerSpringY.current.value!==this._oldCenterY||this.zoomSpring.current.value!==this._oldZoom||this.degreesSpring.current.value!==this._oldDegrees;this._oldCenterX=this.centerSpringX.current.value,this._oldCenterY=this.centerSpringY.current.value,this._oldZoom=this.zoomSpring.current.value,this._oldDegrees=this.degreesSpring.current.value;var s=r||!this.zoomSpring.isAtTargetValue()||!this.centerSpringX.isAtTargetValue()||!this.centerSpringY.isAtTargetValue()||!this.degreesSpring.isAtTargetValue();return s},_rotateAboutPivot:function(n){var r=n===!0,s=this.rotationPivot.minus(this.getCenter());this.centerSpringX.shiftBy(s.x),this.centerSpringY.shiftBy(s.y),r?this.degreesSpring.update():this.degreesSpring.resetTo(n);var o=this.degreesSpring.current.value-this._oldDegrees,l=s.rotate(o*-1).times(-1);this.centerSpringX.shiftBy(l.x),this.centerSpringY.shiftBy(l.y)},_adjustCenterSpringsForZoomPoint:function(n){if(this.zoomPoint){var r=this.pixelFromPoint(this.zoomPoint,!0);n();var s=this.pixelFromPoint(this.zoomPoint,!0),o=s.minus(r),l=this.deltaPointsFromPixels(o,!0);this.centerSpringX.shiftBy(l.x),this.centerSpringY.shiftBy(l.y),this.zoomSpring.isAtTargetValue()&&(this.zoomPoint=null)}else n()},deltaPixelsFromPointsNoRotate:function(n,r){return n.times(this._containerInnerSize.x*this.getZoom(r))},deltaPixelsFromPoints:function(n,r){return this.deltaPixelsFromPointsNoRotate(n.rotate(this.getRotation(r)),r)},deltaPointsFromPixelsNoRotate:function(n,r){return n.divide(this._containerInnerSize.x*this.getZoom(r))},deltaPointsFromPixels:function(n,r){return this.deltaPointsFromPixelsNoRotate(n,r).rotate(-this.getRotation(r))},pixelFromPointNoRotate:function(n,r){return this._pixelFromPointNoRotate(n,this.getBoundsNoRotate(r))},pixelFromPoint:function(n,r){return this._pixelFromPoint(n,this.getBoundsNoRotate(r))},_pixelFromPointNoRotate:function(n,r){return n.minus(r.getTopLeft()).times(this._containerInnerSize.x/r.width).plus(new e.Point(this._margins.left,this._margins.top))},_pixelFromPoint:function(n,r){return this._pixelFromPointNoRotate(n.rotate(this.getRotation(!0),this.getCenter(!0)),r)},pointFromPixelNoRotate:function(n,r){var s=this.getBoundsNoRotate(r);return n.minus(new e.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/s.width).plus(s.getTopLeft())},pointFromPixel:function(n,r){return this.pointFromPixelNoRotate(n,r).rotate(-this.getRotation(r),this.getCenter(r))},_viewportToImageDelta:function(n,r){var s=this._contentBoundsNoRotate.width;return new e.Point(n*this._contentSizeNoRotate.x/s,r*this._contentSizeNoRotate.x/s)},viewportToImageCoordinates:function(n,r){if(n instanceof e.Point)return this.viewportToImageCoordinates(n.x,n.y);if(this.viewer){var s=this.viewer.world.getItemCount();if(s>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.viewportToImageCoordinates] is not accurate with multi-image; use TiledImage.viewportToImageCoordinates instead.");else if(s===1){var o=this.viewer.world.getItemAt(0);return o.viewportToImageCoordinates(n,r,!0)}}return this._viewportToImageDelta(n-this._contentBoundsNoRotate.x,r-this._contentBoundsNoRotate.y)},_imageToViewportDelta:function(n,r){var s=this._contentBoundsNoRotate.width;return new e.Point(n/this._contentSizeNoRotate.x*s,r/this._contentSizeNoRotate.x*s)},imageToViewportCoordinates:function(n,r){if(n instanceof e.Point)return this.imageToViewportCoordinates(n.x,n.y);if(this.viewer){var s=this.viewer.world.getItemCount();if(s>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.imageToViewportCoordinates] is not accurate with multi-image; use TiledImage.imageToViewportCoordinates instead.");else if(s===1){var o=this.viewer.world.getItemAt(0);return o.imageToViewportCoordinates(n,r,!0)}}var l=this._imageToViewportDelta(n,r);return l.x+=this._contentBoundsNoRotate.x,l.y+=this._contentBoundsNoRotate.y,l},imageToViewportRectangle:function(n,r,s,o){var l=n;if(l instanceof e.Rect||(l=new e.Rect(n,r,s,o)),this.viewer){var a=this.viewer.world.getItemCount();if(a>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.imageToViewportRectangle] is not accurate with multi-image; use TiledImage.imageToViewportRectangle instead.");else if(a===1){var u=this.viewer.world.getItemAt(0);return u.imageToViewportRectangle(n,r,s,o,!0)}}var c=this.imageToViewportCoordinates(l.x,l.y),h=this._imageToViewportDelta(l.width,l.height);return new e.Rect(c.x,c.y,h.x,h.y,l.degrees)},viewportToImageRectangle:function(n,r,s,o){var l=n;if(l instanceof e.Rect||(l=new e.Rect(n,r,s,o)),this.viewer){var a=this.viewer.world.getItemCount();if(a>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.viewportToImageRectangle] is not accurate with multi-image; use TiledImage.viewportToImageRectangle instead.");else if(a===1){var u=this.viewer.world.getItemAt(0);return u.viewportToImageRectangle(n,r,s,o,!0)}}var c=this.viewportToImageCoordinates(l.x,l.y),h=this._viewportToImageDelta(l.width,l.height);return new e.Rect(c.x,c.y,h.x,h.y,l.degrees)},viewerElementToImageCoordinates:function(n){var r=this.pointFromPixel(n,!0);return this.viewportToImageCoordinates(r)},imageToViewerElementCoordinates:function(n){var r=this.imageToViewportCoordinates(n);return this.pixelFromPoint(r,!0)},windowToImageCoordinates:function(n){e.console.assert(this.viewer,"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");var r=n.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(r)},imageToWindowCoordinates:function(n){e.console.assert(this.viewer,"[Viewport.imageToWindowCoordinates] the viewport must have a viewer.");var r=this.imageToViewerElementCoordinates(n);return r.plus(e.getElementPosition(this.viewer.element))},viewerElementToViewportCoordinates:function(n){return this.pointFromPixel(n,!0)},viewportToViewerElementCoordinates:function(n){return this.pixelFromPoint(n,!0)},viewerElementToViewportRectangle:function(n){return e.Rect.fromSummits(this.pointFromPixel(n.getTopLeft(),!0),this.pointFromPixel(n.getTopRight(),!0),this.pointFromPixel(n.getBottomLeft(),!0))},viewportToViewerElementRectangle:function(n){return e.Rect.fromSummits(this.pixelFromPoint(n.getTopLeft(),!0),this.pixelFromPoint(n.getTopRight(),!0),this.pixelFromPoint(n.getBottomLeft(),!0))},windowToViewportCoordinates:function(n){e.console.assert(this.viewer,"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");var r=n.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(r)},viewportToWindowCoordinates:function(n){e.console.assert(this.viewer,"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer.");var r=this.viewportToViewerElementCoordinates(n);return r.plus(e.getElementPosition(this.viewer.element))},viewportToImageZoom:function(n){if(this.viewer){var r=this.viewer.world.getItemCount();if(r>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.viewportToImageZoom] is not accurate with multi-image.");else if(r===1){var s=this.viewer.world.getItemAt(0);return s.viewportToImageZoom(n)}}var o=this._contentSizeNoRotate.x,l=this._containerInnerSize.x,a=this._contentBoundsNoRotate.width,u=l/o*a;return n*u},imageToViewportZoom:function(n){if(this.viewer){var r=this.viewer.world.getItemCount();if(r>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.imageToViewportZoom] is not accurate with multi-image. Instead, use [TiledImage.imageToViewportZoom] for the specific image of interest");else if(r===1){var s=this.viewer.world.getItemAt(0);return s.imageToViewportZoom(n)}}var o=this._contentSizeNoRotate.x,l=this._containerInnerSize.x,a=this._contentBoundsNoRotate.width,u=o/l/a;return n*u},toggleFlip:function(){return this.setFlip(!this.getFlip()),this},getFlip:function(){return this.flipped},setFlip:function(n){return this.flipped===n?this:(this.flipped=n,this.viewer.navigator&&this.viewer.navigator.setFlip(this.getFlip()),this.viewer.forceRedraw(),this.viewer.raiseEvent("flip",{flipped:n}),this)},getMaxZoomPixelRatio:function(){return this.maxZoomPixelRatio},setMaxZoomPixelRatio:function(n,r=!0,s=!1){e.console.assert(!isNaN(n),"[Viewport.setMaxZoomPixelRatio] ratio must be a number"),!isNaN(n)&&(this.maxZoomPixelRatio=n,r&&this.getZoom()>this.getMaxZoom()&&this.applyConstraints(s))}}}(i),function(e){e.TiledImage=function(n){this._initialized=!1,e.console.assert(n.tileCache,"[TiledImage] options.tileCache is required"),e.console.assert(n.drawer,"[TiledImage] options.drawer is required"),e.console.assert(n.viewer,"[TiledImage] options.viewer is required"),e.console.assert(n.imageLoader,"[TiledImage] options.imageLoader is required"),e.console.assert(n.source,"[TiledImage] options.source is required"),e.console.assert(!n.clip||n.clip instanceof e.Rect,"[TiledImage] options.clip must be an OpenSeadragon.Rect if present"),e.EventSource.call(this),this._tileCache=n.tileCache,delete n.tileCache,this._drawer=n.drawer,delete n.drawer,this._imageLoader=n.imageLoader,delete n.imageLoader,n.clip instanceof e.Rect&&(this._clip=n.clip.clone()),delete n.clip;var r=n.x||0;delete n.x;var s=n.y||0;delete n.y,this.normHeight=n.source.dimensions.y/n.source.dimensions.x,this.contentAspectX=n.source.dimensions.x/n.source.dimensions.y;var o=1;n.width?(o=n.width,delete n.width,n.height&&(e.console.error("specifying both width and height to a tiledImage is not supported"),delete n.height)):n.height&&(o=n.height/this.normHeight,delete n.height);var l=n.fitBounds;delete n.fitBounds;var a=n.fitBoundsPlacement||i.Placement.CENTER;delete n.fitBoundsPlacement;var u=n.degrees||0;delete n.degrees;var c=n.ajaxHeaders;delete n.ajaxHeaders,e.extend(!0,this,{viewer:null,tilesMatrix:{},coverage:{},loadingCoverage:{},lastDrawn:[],lastResetTime:0,_needsDraw:!0,_needsUpdate:!0,_hasOpaqueTile:!1,_tilesLoading:0,_tilesToDraw:[],_lastDrawn:[],_isBlending:!1,_wasBlending:!1,_isTainted:!1,springStiffness:e.DEFAULT_SETTINGS.springStiffness,animationTime:e.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:e.DEFAULT_SETTINGS.minZoomImageRatio,wrapHorizontal:e.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:e.DEFAULT_SETTINGS.wrapVertical,immediateRender:e.DEFAULT_SETTINGS.immediateRender,blendTime:e.DEFAULT_SETTINGS.blendTime,alwaysBlend:e.DEFAULT_SETTINGS.alwaysBlend,minPixelRatio:e.DEFAULT_SETTINGS.minPixelRatio,smoothTileEdgesMinZoom:e.DEFAULT_SETTINGS.smoothTileEdgesMinZoom,iOSDevice:e.DEFAULT_SETTINGS.iOSDevice,debugMode:e.DEFAULT_SETTINGS.debugMode,crossOriginPolicy:e.DEFAULT_SETTINGS.crossOriginPolicy,ajaxWithCredentials:e.DEFAULT_SETTINGS.ajaxWithCredentials,placeholderFillStyle:e.DEFAULT_SETTINGS.placeholderFillStyle,opacity:e.DEFAULT_SETTINGS.opacity,preload:e.DEFAULT_SETTINGS.preload,compositeOperation:e.DEFAULT_SETTINGS.compositeOperation,subPixelRoundingForTransparency:e.DEFAULT_SETTINGS.subPixelRoundingForTransparency,maxTilesPerFrame:e.DEFAULT_SETTINGS.maxTilesPerFrame},n),this._preload=this.preload,delete this.preload,this._fullyLoaded=!1,this._xSpring=new e.Spring({initial:r,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._ySpring=new e.Spring({initial:s,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._scaleSpring=new e.Spring({initial:o,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._degreesSpring=new e.Spring({initial:u,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._updateForScale(),l&&this.fitBounds(l,a,!0),this._ownAjaxHeaders={},this.setAjaxHeaders(c,!1),this._initialized=!0},e.extend(e.TiledImage.prototype,e.EventSource.prototype,{needsDraw:function(){return this._needsDraw},redraw:function(){this._needsDraw=!0},getFullyLoaded:function(){return this._fullyLoaded},_setFullyLoaded:function(n){n!==this._fullyLoaded&&(this._fullyLoaded=n,this.raiseEvent("fully-loaded-change",{fullyLoaded:this._fullyLoaded}))},reset:function(){this._tileCache.clearTilesFor(this),this.lastResetTime=e.now(),this._needsDraw=!0},update:function(n){let r=this._xSpring.update(),s=this._ySpring.update(),o=this._scaleSpring.update(),l=this._degreesSpring.update(),a=r||s||o||l||this._needsUpdate;if(a||n||!this._fullyLoaded){let u=this._updateLevelsForViewport();this._setFullyLoaded(u)}return this._needsUpdate=!1,a?(this._updateForScale(),this._raiseBoundsChange(),this._needsDraw=!0,!0):!1},setDrawn:function(){return this._needsDraw=this._isBlending||this._wasBlending,this._needsDraw},setTainted(n){this._isTainted=n},isTainted(){return this._isTainted},destroy:function(){this.reset(),this.source.destroy&&this.source.destroy(this.viewer)},getBounds:function(n){return this.getBoundsNoRotate(n).rotate(this.getRotation(n),this._getRotationPoint(n))},getBoundsNoRotate:function(n){return n?new e.Rect(this._xSpring.current.value,this._ySpring.current.value,this._worldWidthCurrent,this._worldHeightCurrent):new e.Rect(this._xSpring.target.value,this._ySpring.target.value,this._worldWidthTarget,this._worldHeightTarget)},getWorldBounds:function(){return e.console.error("[TiledImage.getWorldBounds] is deprecated; use TiledImage.getBounds instead"),this.getBounds()},getClippedBounds:function(n){var r=this.getBoundsNoRotate(n);if(this._clip){var s=n?this._worldWidthCurrent:this._worldWidthTarget,o=s/this.source.dimensions.x,l=this._clip.times(o);r=new e.Rect(r.x+l.x,r.y+l.y,l.width,l.height)}return r.rotate(this.getRotation(n),this._getRotationPoint(n))},getTileBounds:function(n,r,s){var o=this.source.getNumTiles(n),l=(o.x+r%o.x)%o.x,a=(o.y+s%o.y)%o.y,u=this.source.getTileBounds(n,l,a);return this.getFlip()&&(u.x=Math.max(0,1-u.x-u.width)),u.x+=(r-l)/o.x,u.y+=this._worldHeightCurrent/this._worldWidthCurrent*((s-a)/o.y),u},getContentSize:function(){return new e.Point(this.source.dimensions.x,this.source.dimensions.y)},getSizeInWindowCoordinates:function(){var n=this.imageToWindowCoordinates(new e.Point(0,0)),r=this.imageToWindowCoordinates(this.getContentSize());return new e.Point(r.x-n.x,r.y-n.y)},_viewportToImageDelta:function(n,r,s){var o=s?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(n*(this.source.dimensions.x/o),r*(this.source.dimensions.y*this.contentAspectX/o))},viewportToImageCoordinates:function(n,r,s){var o;return n instanceof e.Point?(s=r,o=n):o=new e.Point(n,r),o=o.rotate(-this.getRotation(s),this._getRotationPoint(s)),s?this._viewportToImageDelta(o.x-this._xSpring.current.value,o.y-this._ySpring.current.value):this._viewportToImageDelta(o.x-this._xSpring.target.value,o.y-this._ySpring.target.value)},_imageToViewportDelta:function(n,r,s){var o=s?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(n/this.source.dimensions.x*o,r/this.source.dimensions.y/this.contentAspectX*o)},imageToViewportCoordinates:function(n,r,s){n instanceof e.Point&&(s=r,r=n.y,n=n.x);var o=this._imageToViewportDelta(n,r,s);return s?(o.x+=this._xSpring.current.value,o.y+=this._ySpring.current.value):(o.x+=this._xSpring.target.value,o.y+=this._ySpring.target.value),o.rotate(this.getRotation(s),this._getRotationPoint(s))},imageToViewportRectangle:function(n,r,s,o,l){var a=n;a instanceof e.Rect?l=r:a=new e.Rect(n,r,s,o);var u=this.imageToViewportCoordinates(a.getTopLeft(),l),c=this._imageToViewportDelta(a.width,a.height,l);return new e.Rect(u.x,u.y,c.x,c.y,a.degrees+this.getRotation(l))},viewportToImageRectangle:function(n,r,s,o,l){var a=n;n instanceof e.Rect?l=r:a=new e.Rect(n,r,s,o);var u=this.viewportToImageCoordinates(a.getTopLeft(),l),c=this._viewportToImageDelta(a.width,a.height,l);return new e.Rect(u.x,u.y,c.x,c.y,a.degrees-this.getRotation(l))},viewerElementToImageCoordinates:function(n){var r=this.viewport.pointFromPixel(n,!0);return this.viewportToImageCoordinates(r)},imageToViewerElementCoordinates:function(n){var r=this.imageToViewportCoordinates(n);return this.viewport.pixelFromPoint(r,!0)},windowToImageCoordinates:function(n){var r=n.minus(i.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(r)},imageToWindowCoordinates:function(n){var r=this.imageToViewerElementCoordinates(n);return r.plus(i.getElementPosition(this.viewer.element))},_viewportToTiledImageRectangle:function(n){var r=this._scaleSpring.current.value;return n=n.rotate(-this.getRotation(!0),this._getRotationPoint(!0)),new e.Rect((n.x-this._xSpring.current.value)/r,(n.y-this._ySpring.current.value)/r,n.width/r,n.height/r,n.degrees)},viewportToImageZoom:function(n){var r=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return r*n},imageToViewportZoom:function(n){var r=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return n/r},setPosition:function(n,r){var s=this._xSpring.target.value===n.x&&this._ySpring.target.value===n.y;if(r){if(s&&this._xSpring.current.value===n.x&&this._ySpring.current.value===n.y)return;this._xSpring.resetTo(n.x),this._ySpring.resetTo(n.y),this._needsDraw=!0,this._needsUpdate=!0}else{if(s)return;this._xSpring.springTo(n.x),this._ySpring.springTo(n.y),this._needsDraw=!0,this._needsUpdate=!0}s||this._raiseBoundsChange()},setWidth:function(n,r){this._setScale(n,r)},setHeight:function(n,r){this._setScale(n/this.normHeight,r)},setCroppingPolygons:function(n){var r=function(o){return o instanceof e.Point||typeof o.x=="number"&&typeof o.y=="number"},s=function(o){return o.map(function(l){try{if(r(l))return{x:l.x,y:l.y};throw new Error}catch{throw new Error("A Provided cropping polygon point is not supported")}})};try{if(!e.isArray(n))throw new Error("Provided cropping polygon is not an array");this._croppingPolygons=n.map(function(o){return s(o)}),this._needsDraw=!0}catch(o){e.console.error("[TiledImage.setCroppingPolygons] Cropping polygon format not supported"),e.console.error(o),this.resetCroppingPolygons()}},resetCroppingPolygons:function(){this._croppingPolygons=null,this._needsDraw=!0},fitBounds:function(n,r,s){r=r||e.Placement.CENTER;var o=e.Placement.properties[r],l=this.contentAspectX,a=0,u=0,c=1,h=1;if(this._clip&&(l=this._clip.getAspectRatio(),c=this._clip.width/this.source.dimensions.x,h=this._clip.height/this.source.dimensions.y,n.getAspectRatio()>l?(a=this._clip.x/this._clip.height*n.height,u=this._clip.y/this._clip.height*n.height):(a=this._clip.x/this._clip.width*n.width,u=this._clip.y/this._clip.width*n.width)),n.getAspectRatio()>l){var f=n.height/h,m=0;o.isHorizontallyCentered?m=(n.width-n.height*l)/2:o.isRight&&(m=n.width-n.height*l),this.setPosition(new e.Point(n.x-a+m,n.y-u),s),this.setHeight(f,s)}else{var v=n.width/c,y=0;o.isVerticallyCentered?y=(n.height-n.width/l)/2:o.isBottom&&(y=n.height-n.width/l),this.setPosition(new e.Point(n.x-a,n.y-u+y),s),this.setWidth(v,s)}},getClip:function(){return this._clip?this._clip.clone():null},setClip:function(n){e.console.assert(!n||n instanceof e.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null"),n instanceof e.Rect?this._clip=n.clone():this._clip=null,this._needsUpdate=!0,this._needsDraw=!0,this.raiseEvent("clip-change")},getFlip:function(){return this.flipped},setFlip:function(n){this.flipped=n},get flipped(){return this._flipped},set flipped(n){let r=this._flipped!==!!n;this._flipped=!!n,r&&(this.update(!0),this._needsDraw=!0,this._raiseBoundsChange())},get wrapHorizontal(){return this._wrapHorizontal},set wrapHorizontal(n){let r=this._wrapHorizontal!==!!n;this._wrapHorizontal=!!n,this._initialized&&r&&(this.update(!0),this._needsDraw=!0)},get wrapVertical(){return this._wrapVertical},set wrapVertical(n){let r=this._wrapVertical!==!!n;this._wrapVertical=!!n,this._initialized&&r&&(this.update(!0),this._needsDraw=!0)},get debugMode(){return this._debugMode},set debugMode(n){this._debugMode=!!n,this._needsDraw=!0},getOpacity:function(){return this.opacity},setOpacity:function(n){this.opacity=n},get opacity(){return this._opacity},set opacity(n){n!==this.opacity&&(this._opacity=n,this._needsDraw=!0,this.raiseEvent("opacity-change",{opacity:this.opacity}))},getPreload:function(){return this._preload},setPreload:function(n){this._preload=!!n,this._needsDraw=!0},getRotation:function(n){return n?this._degreesSpring.current.value:this._degreesSpring.target.value},setRotation:function(n,r){this._degreesSpring.target.value===n&&this._degreesSpring.isAtTargetValue()||(r?this._degreesSpring.resetTo(n):this._degreesSpring.springTo(n),this._needsDraw=!0,this._needsUpdate=!0,this._raiseBoundsChange())},getDrawArea:function(){if(this._opacity===0&&!this._preload)return!1;var n=this._viewportToTiledImageRectangle(this.viewport.getBoundsWithMargins(!0));if(!this.wrapHorizontal&&!this.wrapVertical){var r=this._viewportToTiledImageRectangle(this.getClippedBounds(!0));n=n.intersection(r)}return n},getTilesToDraw:function(){let n=this._tilesToDraw.flat();return this._updateTilesInViewport(n),n=this._tilesToDraw.flat(),n.forEach(r=>{r.tile.beingDrawn=!0}),this._lastDrawn=n,n},_getRotationPoint:function(n){return this.getBoundsNoRotate(n).getCenter()},get compositeOperation(){return this._compositeOperation},set compositeOperation(n){n!==this._compositeOperation&&(this._compositeOperation=n,this._needsDraw=!0,this.raiseEvent("composite-operation-change",{compositeOperation:this._compositeOperation}))},getCompositeOperation:function(){return this._compositeOperation},setCompositeOperation:function(n){this.compositeOperation=n},setAjaxHeaders:function(n,r){if(n===null&&(n={}),!e.isPlainObject(n)){console.error("[TiledImage.setAjaxHeaders] Ignoring invalid headers, must be a plain object");return}this._ownAjaxHeaders=n,this._updateAjaxHeaders(r)},_updateAjaxHeaders:function(n){if(n===void 0&&(n=!0),e.isPlainObject(this.viewer.ajaxHeaders)?this.ajaxHeaders=e.extend({},this.viewer.ajaxHeaders,this._ownAjaxHeaders):this.ajaxHeaders=this._ownAjaxHeaders,n){var r,s,o,l;for(var a in this.tilesMatrix){r=this.source.getNumTiles(a);for(var u in this.tilesMatrix[a]){s=(r.x+u%r.x)%r.x;for(var c in this.tilesMatrix[a][u])if(o=(r.y+c%r.y)%r.y,l=this.tilesMatrix[a][u][c],l.loadWithAjax=this.loadTilesWithAjax,l.loadWithAjax){var h=this.source.getTileAjaxHeaders(a,s,o);l.ajaxHeaders=e.extend({},this.ajaxHeaders,h)}else l.ajaxHeaders=null}}for(var f=0;f<this._imageLoader.jobQueue.length;f++){var m=this._imageLoader.jobQueue[f];m.loadWithAjax=m.tile.loadWithAjax,m.ajaxHeaders=m.tile.loadWithAjax?m.tile.ajaxHeaders:null}}},_setScale:function(n,r){var s=this._scaleSpring.target.value===n;if(r){if(s&&this._scaleSpring.current.value===n)return;this._scaleSpring.resetTo(n),this._updateForScale(),this._needsDraw=!0,this._needsUpdate=!0}else{if(s)return;this._scaleSpring.springTo(n),this._updateForScale(),this._needsDraw=!0,this._needsUpdate=!0}s||this._raiseBoundsChange()},_updateForScale:function(){this._worldWidthTarget=this._scaleSpring.target.value,this._worldHeightTarget=this.normHeight*this._scaleSpring.target.value,this._worldWidthCurrent=this._scaleSpring.current.value,this._worldHeightCurrent=this.normHeight*this._scaleSpring.current.value},_raiseBoundsChange:function(){this.raiseEvent("bounds-change")},_isBottomItem:function(){return this.viewer.world.getItemAt(0)===this},_getLevelsInterval:function(){var n=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2))),r=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),!0).x*this._scaleSpring.current.value,s=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(r/this.minPixelRatio)/Math.log(2))));return s=Math.max(s,this.source.minLevel||0),n=Math.min(n,s),{lowestLevel:n,highestLevel:s}},_updateLevelsForViewport:function(){var n=this._getLevelsInterval(),r=n.lowestLevel,s=n.highestLevel,o=[],l=this.getDrawArea(),a=e.now();if(this._lastDrawn.forEach(U=>{U.tile.beingDrawn=!1}),this._tilesToDraw=[],this._tilesLoading=0,this.loadingCoverage={},!l)return this._needsDraw=!1,this._fullyLoaded;var u=new Array(s-r+1);for(let U=0,K=s;K>=r;K--,U++)u[U]=K;for(let U=s+1;U<=this.source.maxLevel;U++){var c=this.tilesMatrix[U]&&this.tilesMatrix[U][0]&&this.tilesMatrix[U][0][0];if(c&&c.isBottomMost&&c.isRightMost&&c.loaded){u.push(U);break}}let h=!1;for(let U=0;U<u.length;U++){let K=u[U];var f=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(K),!0).x*this._scaleSpring.current.value;if(U===u.length-1||f>=this.minPixelRatio)h=!0;else if(!h)continue;var m=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(K),!1).x*this._scaleSpring.current.value,v=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),!1).x*this._scaleSpring.current.value,y=this.immediateRender?1:v,T=Math.min(1,(f-.5)/.5),x=y/Math.abs(y-m),E=this._updateLevel(K,T,x,l,a,o);o=E.bestTiles;var M=E.updatedTiles.filter(q=>q.loaded),L=function(q,Y,te){return function(fe){return{tile:fe,level:q,levelOpacity:Y,currentTime:te}}}(K,T,a);if(this._tilesToDraw[K]=M.map(L),this._providesCoverage(this.coverage,K))break}return o&&o.length>0?(o.forEach(function(U){U&&!U.context2D&&this._loadTile(U,a)},this),this._needsDraw=!0,!1):this._tilesLoading===0},_updateTilesInViewport:function(n){let r=e.now(),s=this;this._tilesLoading=0,this._wasBlending=this._isBlending,this._isBlending=!1,this.loadingCoverage={};let o=n.length?n[0].level:0;if(!this.getDrawArea())return;function a(c){let h=c.tile;if(h&&h.loaded){let f=s._blendTile(h,h.x,h.y,c.level,c.levelOpacity,r,o);s._isBlending=s._isBlending||f,s._needsDraw=s._needsDraw||f||s._wasBlending}}let u=0;for(let c=0;c<n.length;c++){let h=n[c];a(h),this._providesCoverage(this.coverage,h.level)&&(u=Math.max(u,h.level))}if(u>0)for(let c in this._tilesToDraw)c<u&&delete this._tilesToDraw[c]},_blendTile:function(n,r,s,o,l,a,u){let c=1e3*this.blendTime,h,f;return n.blendStart||(n.blendStart=a),h=a-n.blendStart,f=c?Math.min(1,h/c):1,o===u&&(f=1,h=c),this.alwaysBlend&&(f*=l),n.opacity=f,f===1&&(this._setCoverage(this.coverage,o,r,s,!0),this._hasOpaqueTile=!0),h<c},_updateLevel:function(n,r,s,o,l,a){var u=o.getBoundingBox().getTopLeft(),c=o.getBoundingBox().getBottomRight();this.viewer&&this.viewer.raiseEvent("update-level",{tiledImage:this,havedrawn:!0,level:n,opacity:r,visibility:s,drawArea:o,topleft:u,bottomright:c,currenttime:l,best:a}),this._resetCoverage(this.coverage,n),this._resetCoverage(this.loadingCoverage,n);var h=this._getCornerTiles(n,u,c),f=h.topLeft,m=h.bottomRight,v=this.source.getNumTiles(n),y=this.viewport.pixelFromPoint(this.viewport.getCenter());this.getFlip()&&(m.x+=1,this.wrapHorizontal||(m.x=Math.min(m.x,v.x-1)));for(var T=Math.max(0,(m.x-f.x)*(m.y-f.y)),x=new Array(T),E=0,M=f.x;M<=m.x;M++)for(var L=f.y;L<=m.y;L++){var U;if(this.getFlip()){var K=(v.x+M%v.x)%v.x;U=M+v.x-K-K-1}else U=M;if(o.intersection(this.getTileBounds(n,U,L))!==null){var q=this._updateTile(U,L,n,s,y,v,l,a);a=q.bestTiles,x[E]=q.tile,E+=1}}return{bestTiles:a,updatedTiles:x}},_positionTile:function(n,r,s,o,l){var a=n.bounds.getTopLeft();a.x*=this._scaleSpring.current.value,a.y*=this._scaleSpring.current.value,a.x+=this._xSpring.current.value,a.y+=this._ySpring.current.value;var u=n.bounds.getSize();u.x*=this._scaleSpring.current.value,u.y*=this._scaleSpring.current.value,n.positionedBounds.x=a.x,n.positionedBounds.y=a.y,n.positionedBounds.width=u.x,n.positionedBounds.height=u.y;var c=s.pixelFromPointNoRotate(a,!0),h=s.pixelFromPointNoRotate(a,!1),f=s.deltaPixelsFromPointsNoRotate(u,!0),m=s.deltaPixelsFromPointsNoRotate(u,!1),v=h.plus(m.divide(2)),y=o.squaredDistanceTo(v);this.viewer.drawer.minimumOverlapRequired(this)&&(r||(f=f.plus(new e.Point(1,1))),n.isRightMost&&this.wrapHorizontal&&(f.x+=.75),n.isBottomMost&&this.wrapVertical&&(f.y+=.75)),n.position=c,n.size=f,n.squaredDistance=y,n.visibility=l},_updateTile:function(n,r,s,o,l,a,u,c){var h=this._getTile(n,r,s,u,a);this.viewer&&this.viewer.raiseEvent("update-tile",{tiledImage:this,tile:h}),this._setCoverage(this.coverage,s,n,r,!1);var f=h.loaded||h.loading||this._isCovered(this.loadingCoverage,s,n,r);if(this._setCoverage(this.loadingCoverage,s,n,r,f),!h.exists)return{bestTiles:c,tile:h};if(h.loaded&&h.opacity===1&&this._setCoverage(this.coverage,s,n,r,!0),this._positionTile(h,this.source.tileOverlap,this.viewport,l,o),!h.loaded)if(h.context2D)this._setTileLoaded(h);else{var m=this._tileCache.getImageRecord(h.cacheKey);m&&this._setTileLoaded(h,m.getData())}return h.loading?this._tilesLoading++:f||(c=this._compareTiles(c,h,this.maxTilesPerFrame)),{bestTiles:c,tile:h}},_getCornerTiles:function(n,r,s){var o,l;this.wrapHorizontal?(o=e.positiveModulo(r.x,1),l=e.positiveModulo(s.x,1)):(o=Math.max(0,r.x),l=Math.min(1,s.x));var a,u,c=1/this.source.aspectRatio;this.wrapVertical?(a=e.positiveModulo(r.y,c),u=e.positiveModulo(s.y,c)):(a=Math.max(0,r.y),u=Math.min(c,s.y));var h=this.source.getTileAtPoint(n,new e.Point(o,a)),f=this.source.getTileAtPoint(n,new e.Point(l,u)),m=this.source.getNumTiles(n);return this.wrapHorizontal&&(h.x+=m.x*Math.floor(r.x),f.x+=m.x*Math.floor(s.x)),this.wrapVertical&&(h.y+=m.y*Math.floor(r.y/c),f.y+=m.y*Math.floor(s.y/c)),{topLeft:h,bottomRight:f}},_getTile:function(n,r,s,o,l){var a,u,c,h,f,m,v,y,T,x,E=this.tilesMatrix,M=this.source;return E[s]||(E[s]={}),E[s][n]||(E[s][n]={}),(!E[s][n][r]||!E[s][n][r].flipped!=!this.flipped)&&(a=(l.x+n%l.x)%l.x,u=(l.y+r%l.y)%l.y,c=this.getTileBounds(s,n,r),h=M.getTileBounds(s,a,u,!0),f=M.tileExists(s,a,u),m=M.getTileUrl(s,a,u),v=M.getTilePostData(s,a,u),this.loadTilesWithAjax?(y=M.getTileAjaxHeaders(s,a,u),e.isPlainObject(this.ajaxHeaders)&&(y=e.extend({},this.ajaxHeaders,y))):y=null,T=M.getContext2D?M.getContext2D(s,a,u):void 0,x=new e.Tile(s,n,r,c,f,m,T,this.loadTilesWithAjax,y,h,v,M.getTileHashKey(s,a,u,m,y,v)),this.getFlip()?a===0&&(x.isRightMost=!0):a===l.x-1&&(x.isRightMost=!0),u===l.y-1&&(x.isBottomMost=!0),x.flipped=this.flipped,E[s][n][r]=x),x=E[s][n][r],x.lastTouchTime=o,x},_loadTile:function(n,r){var s=this;n.loading=!0,this._imageLoader.addJob({src:n.getUrl(),tile:n,source:this.source,postData:n.postData,loadWithAjax:n.loadWithAjax,ajaxHeaders:n.ajaxHeaders,crossOriginPolicy:this.crossOriginPolicy,ajaxWithCredentials:this.ajaxWithCredentials,callback:function(o,l,a){s._onTileLoad(n,r,o,l,a)},abort:function(){n.loading=!1}})},_onTileLoad:function(n,r,s,o,l){if(s)n.exists=!0;else{e.console.error("Tile %s failed to load: %s - error: %s",n,n.getUrl(),o),this.viewer.raiseEvent("tile-load-failed",{tile:n,tiledImage:this,time:r,message:o,tileRequest:l}),n.loading=!1,n.exists=!1;return}if(r<this.lastResetTime){e.console.warn("Ignoring tile %s loaded before reset: %s",n,n.getUrl()),n.loading=!1;return}var a=this,u=function(){var c=a.source,h=c.getClosestLevel();a._setTileLoaded(n,s,h,l)};u()},_setTileLoaded:function(n,r,s,o){var l=0,a=!1,u=this;function c(){return a&&e.console.error("Event 'tile-loaded' argument getCompletionCallback must be called synchronously. Its return value should be called asynchronously."),l++,h}function h(){l--,l===0&&(n.loading=!1,n.loaded=!0,n.hasTransparency=u.source.hasTransparency(n.context2D,n.getUrl(),n.ajaxHeaders,n.postData),n.context2D||u._tileCache.cacheTile({data:r,tile:n,cutoff:s,tiledImage:u}),u.viewer.raiseEvent("tile-ready",{tile:n,tiledImage:u,tileRequest:o}),u._needsDraw=!0)}var f=c();this.viewer.raiseEvent("tile-loaded",{tile:n,tiledImage:this,tileRequest:o,get image(){return e.console.error("[tile-loaded] event 'image' has been deprecated. Use 'data' property instead."),r},data:r,getCompletionCallback:c}),a=!0,f()},_compareTiles:function(n,r,s){return n?(n.push(r),this._sortTiles(n),n.length>s&&n.pop(),n):[r]},_sortTiles:function(n){n.sort(function(r,s){return r===null?1:s===null?-1:r.visibility===s.visibility?r.squaredDistance-s.squaredDistance:s.visibility-r.visibility})},_providesCoverage:function(n,r,s,o){var l,a,u,c;if(!n[r])return!1;if(s===void 0||o===void 0){l=n[r];for(u in l)if(Object.prototype.hasOwnProperty.call(l,u)){a=l[u];for(c in a)if(Object.prototype.hasOwnProperty.call(a,c)&&!a[c])return!1}return!0}return n[r][s]===void 0||n[r][s][o]===void 0||n[r][s][o]===!0},_isCovered:function(n,r,s,o){return s===void 0||o===void 0?this._providesCoverage(n,r+1):this._providesCoverage(n,r+1,2*s,2*o)&&this._providesCoverage(n,r+1,2*s,2*o+1)&&this._providesCoverage(n,r+1,2*s+1,2*o)&&this._providesCoverage(n,r+1,2*s+1,2*o+1)},_setCoverage:function(n,r,s,o,l){if(!n[r]){e.console.warn("Setting coverage for a tile before its level's coverage has been reset: %s",r);return}n[r][s]||(n[r][s]={}),n[r][s][o]=l},_resetCoverage:function(n,r){n[r]={}}})}(i),function(e){var n=function(s){e.console.assert(s,"[TileCache.cacheTile] options is required"),e.console.assert(s.tile,"[TileCache.cacheTile] options.tile is required"),e.console.assert(s.tiledImage,"[TileCache.cacheTile] options.tiledImage is required"),this.tile=s.tile,this.tiledImage=s.tiledImage},r=function(s){e.console.assert(s,"[ImageRecord] options is required"),e.console.assert(s.data,"[ImageRecord] options.data is required"),this._tiles=[],s.create.apply(null,[this,s.data,s.ownerTile]),this._destroyImplementation=s.destroy.bind(null,this),this.getImage=s.getImage.bind(null,this),this.getData=s.getData.bind(null,this),this.getRenderedContext=s.getRenderedContext.bind(null,this)};r.prototype={destroy:function(){this._destroyImplementation(),this._tiles=null},addTile:function(s){e.console.assert(s,"[ImageRecord.addTile] tile is required"),this._tiles.push(s)},removeTile:function(s){for(var o=0;o<this._tiles.length;o++)if(this._tiles[o]===s){this._tiles.splice(o,1);return}e.console.warn("[ImageRecord.removeTile] trying to remove unknown tile",s)},getTileCount:function(){return this._tiles.length}},e.TileCache=function(s){s=s||{},this._maxImageCacheCount=s.maxImageCacheCount||e.DEFAULT_SETTINGS.maxImageCacheCount,this._tilesLoaded=[],this._imagesLoaded=[],this._imagesLoadedCount=0},e.TileCache.prototype={numTilesLoaded:function(){return this._tilesLoaded.length},cacheTile:function(s){e.console.assert(s,"[TileCache.cacheTile] options is required"),e.console.assert(s.tile,"[TileCache.cacheTile] options.tile is required"),e.console.assert(s.tile.cacheKey,"[TileCache.cacheTile] options.tile.cacheKey is required"),e.console.assert(s.tiledImage,"[TileCache.cacheTile] options.tiledImage is required");var o=s.cutoff||0,l=this._tilesLoaded.length,a=this._imagesLoaded[s.tile.cacheKey];if(a||(s.data||(e.console.error("[TileCache.cacheTile] options.image was renamed to options.data. '.image' attribute has been deprecated and will be removed in the future."),s.data=s.image),e.console.assert(s.data,"[TileCache.cacheTile] options.data is required to create an ImageRecord"),a=this._imagesLoaded[s.tile.cacheKey]=new r({data:s.data,ownerTile:s.tile,create:s.tiledImage.source.createTileCache,destroy:s.tiledImage.source.destroyTileCache,getImage:s.tiledImage.source.getTileCacheDataAsImage,getData:s.tiledImage.source.getTileCacheData,getRenderedContext:s.tiledImage.source.getTileCacheDataAsContext2D}),this._imagesLoadedCount++),a.addTile(s.tile),s.tile.cacheImageRecord=a,this._imagesLoadedCount>this._maxImageCacheCount){for(var u=null,c=-1,h=null,f,m,v,y,T,x,E=this._tilesLoaded.length-1;E>=0;E--)if(x=this._tilesLoaded[E],f=x.tile,!(f.level<=o||f.beingDrawn)){if(!u){u=f,c=E,h=x;continue}y=f.lastTouchTime,m=u.lastTouchTime,T=f.level,v=u.level,(y<m||y===m&&T>v)&&(u=f,c=E,h=x)}u&&c>=0&&(this._unloadTile(h),l=c)}this._tilesLoaded[l]=new n({tile:s.tile,tiledImage:s.tiledImage})},clearTilesFor:function(s){e.console.assert(s,"[TileCache.clearTilesFor] tiledImage is required");for(var o,l=0;l<this._tilesLoaded.length;++l)o=this._tilesLoaded[l],o.tiledImage===s&&(this._unloadTile(o),this._tilesLoaded.splice(l,1),l--)},getImageRecord:function(s){return e.console.assert(s,"[TileCache.getImageRecord] cacheKey is required"),this._imagesLoaded[s]},_unloadTile:function(s){e.console.assert(s,"[TileCache._unloadTile] tileRecord is required");var o=s.tile,l=s.tiledImage;let a=o.getCanvasContext&&o.getCanvasContext();o.unload(),o.cacheImageRecord=null;var u=this._imagesLoaded[o.cacheKey];u&&(u.removeTile(o),u.getTileCount()||(u.destroy(),delete this._imagesLoaded[o.cacheKey],this._imagesLoadedCount--,a&&(a.canvas.width=0,a.canvas.height=0,l.viewer.raiseEvent("image-unloaded",{context2D:a,tile:o}))),l.viewer.raiseEvent("tile-unloaded",{tile:o,tiledImage:l}))}}}(i),function(e){e.World=function(n){var r=this;e.console.assert(n.viewer,"[World] options.viewer is required"),e.EventSource.call(this),this.viewer=n.viewer,this._items=[],this._needsDraw=!1,this._autoRefigureSizes=!0,this._needsSizesFigured=!1,this._delegatedFigureSizes=function(s){r._autoRefigureSizes?r._figureSizes():r._needsSizesFigured=!0},this._figureSizes()},e.extend(e.World.prototype,e.EventSource.prototype,{addItem:function(n,r){if(e.console.assert(n,"[World.addItem] item is required"),e.console.assert(n instanceof e.TiledImage,"[World.addItem] only TiledImages supported at this time"),r=r||{},r.index!==void 0){var s=Math.max(0,Math.min(this._items.length,r.index));this._items.splice(s,0,n)}else this._items.push(n);this._autoRefigureSizes?this._figureSizes():this._needsSizesFigured=!0,this._needsDraw=!0,n.addHandler("bounds-change",this._delegatedFigureSizes),n.addHandler("clip-change",this._delegatedFigureSizes),this.raiseEvent("add-item",{item:n})},getItemAt:function(n){return e.console.assert(n!==void 0,"[World.getItemAt] index is required"),this._items[n]},getIndexOfItem:function(n){return e.console.assert(n,"[World.getIndexOfItem] item is required"),e.indexOf(this._items,n)},getItemCount:function(){return this._items.length},setItemIndex:function(n,r){e.console.assert(n,"[World.setItemIndex] item is required"),e.console.assert(r!==void 0,"[World.setItemIndex] index is required");var s=this.getIndexOfItem(n);if(r>=this._items.length)throw new Error("Index bigger than number of layers.");r===s||s===-1||(this._items.splice(s,1),this._items.splice(r,0,n),this._needsDraw=!0,this.raiseEvent("item-index-change",{item:n,previousIndex:s,newIndex:r}))},removeItem:function(n){e.console.assert(n,"[World.removeItem] item is required");var r=e.indexOf(this._items,n);r!==-1&&(n.removeHandler("bounds-change",this._delegatedFigureSizes),n.removeHandler("clip-change",this._delegatedFigureSizes),n.destroy(),this._items.splice(r,1),this._figureSizes(),this._needsDraw=!0,this._raiseRemoveItem(n))},removeAll:function(){this.viewer._cancelPendingImages();var n,r;for(r=0;r<this._items.length;r++)n=this._items[r],n.removeHandler("bounds-change",this._delegatedFigureSizes),n.removeHandler("clip-change",this._delegatedFigureSizes),n.destroy();var s=this._items;for(this._items=[],this._figureSizes(),this._needsDraw=!0,r=0;r<s.length;r++)n=s[r],this._raiseRemoveItem(n)},resetItems:function(){for(var n=0;n<this._items.length;n++)this._items[n].reset()},update:function(n){for(var r=!1,s=0;s<this._items.length;s++)r=this._items[s].update(n)||r;return r},draw:function(){this.viewer.drawer.draw(this._items),this._needsDraw=!1,this._items.forEach(n=>{this._needsDraw=n.setDrawn()||this._needsDraw})},needsDraw:function(){for(var n=0;n<this._items.length;n++)if(this._items[n].needsDraw())return!0;return this._needsDraw},getHomeBounds:function(){return this._homeBounds.clone()},getContentFactor:function(){return this._contentFactor},setAutoRefigureSizes:function(n){this._autoRefigureSizes=n,n&this._needsSizesFigured&&(this._figureSizes(),this._needsSizesFigured=!1)},arrange:function(n){n=n||{};var r=n.immediately||!1,s=n.layout||e.DEFAULT_SETTINGS.collectionLayout,o=n.rows||e.DEFAULT_SETTINGS.collectionRows,l=n.columns||e.DEFAULT_SETTINGS.collectionColumns,a=n.tileSize||e.DEFAULT_SETTINGS.collectionTileSize,u=n.tileMargin||e.DEFAULT_SETTINGS.collectionTileMargin,c=a+u,h;!n.rows&&l?h=l:h=Math.ceil(this._items.length/o);var f=0,m=0,v,y,T,x,E;this.setAutoRefigureSizes(!1);for(var M=0;M<this._items.length;M++)M&&M%h===0&&(s==="horizontal"?(m+=c,f=0):(f+=c,m=0)),v=this._items[M],y=v.getBounds(),y.width>y.height?T=a:T=a*(y.width/y.height),x=T*(y.height/y.width),E=new e.Point(f+(a-T)/2,m+(a-x)/2),v.setPosition(E,r),v.setWidth(T,r),s==="horizontal"?f+=c:m+=c;this.setAutoRefigureSizes(!0)},_figureSizes:function(){var n=this._homeBounds?this._homeBounds.clone():null,r=this._contentSize?this._contentSize.clone():null,s=this._contentFactor||0;if(!this._items.length)this._homeBounds=new e.Rect(0,0,1,1),this._contentSize=new e.Point(1,1),this._contentFactor=1;else{var o=this._items[0],l=o.getBounds();this._contentFactor=o.getContentSize().x/l.width;for(var a=o.getClippedBounds().getBoundingBox(),u=a.x,c=a.y,h=a.x+a.width,f=a.y+a.height,m=1;m<this._items.length;m++)o=this._items[m],l=o.getBounds(),this._contentFactor=Math.max(this._contentFactor,o.getContentSize().x/l.width),a=o.getClippedBounds().getBoundingBox(),u=Math.min(u,a.x),c=Math.min(c,a.y),h=Math.max(h,a.x+a.width),f=Math.max(f,a.y+a.height);this._homeBounds=new e.Rect(u,c,h-u,f-c),this._contentSize=new e.Point(this._homeBounds.width*this._contentFactor,this._homeBounds.height*this._contentFactor)}(this._contentFactor!==s||!this._homeBounds.equals(n)||!this._contentSize.equals(r))&&this.raiseEvent("metrics-change",{})},_raiseRemoveItem:function(n){this.raiseEvent("remove-item",{item:n})}})}(i)}(Bi)),Bi.exports}var Op=Ap();const Mn=Po(Op);function Bo(t){if(typeof t!="string")return null;const i=t.match(/xywh=(\d+),(\d+),(\d+),(\d+)$/);return i?i.slice(1).map(Number):null}function ys(){let t,i;const e=new Promise((n,r)=>{t=n,i=r});return e.resolve=t,e.reject=i,e}const Fn=.005,ur=1.5,Mp={data(){return{defaultCanvasCss:"",loadingTimeout:null,avResource:null,overlayElements:[],promise:ys(),tileSources:[],viewer:null,viewerState:{isReset:!0}}},computed:{filtersActive(){return Object.keys(this.$store.options.filters).length>0},paginationButtons(){var e;const t=((e=this.$store.manifest.viewingDirection)==null?void 0:e.split("-to-"))||["left","right"],i=[{hidden:this.$store.isFirstPage,title:this.$translate("Previous page"),onClick:this.$store.goToPreviousPage,position:t[0]},{hidden:this.$store.isLastPage,title:this.$translate("Next page"),onClick:this.$store.goToNextPage,position:t[1]}];return this.$store.isReversed&&i.reverse(),i.filter(n=>!n.hidden)},multiLayerResources(){return this.$store.options.pages.filter(t=>t>0).map((t,i)=>{var e,n,r,s,o;return{pageIndex:i,items:(o=(s=(r=(n=(e=this.$store.manifest.items[t-1].items)==null?void 0:e[0])==null?void 0:n.items)==null?void 0:r[0])==null?void 0:s.body)==null?void 0:o.items}}).filter(t=>{var i;return((i=t.items)==null?void 0:i.length)>1})}},watch:{"$store.annotations":{handler(){this.updateOverlays()},deep:!0},"$store.options.annotationId":function(t){var s;if(!this.viewer||((s=this.overlayElements.find(o=>o.classList.contains("-current")))==null||s.classList.remove("-current"),!t))return;const i=this.viewer.viewport.getBounds(),e=this.overlayElements.find(o=>o.id===t);if(!e)return;e.classList.add("-current");const r=this.viewer.getOverlayById(e).getBounds(this.viewer.viewport);i.intersection(r)||(r.x-=.03,r.y-=.03,r.width+=.06,r.height+=.06,this.viewer.viewport.fitBoundsWithConstraints(r))},"$store.options.pages":function(t,i){const e=t.length!==i.length;this.loadInfo(e)},"$store.options.view":function(){this.updateOverlays()}},mounted(){this.loadInfo(),this.$store.readyPromises.push(this.promise),this.$store.rootElement.addEventListener("keydown",this.onKeydown),this.$store.rootElement.addEventListener("keypress",this.onKeypress)},beforeUnmount(){this.viewer&&this.viewer.destroy(),this.$store.rootElement.removeEventListener("keydown",this.onKeydown),this.$store.rootElement.removeEventListener("keypress",this.onKeypress)},methods:{initViewer(t){const i=[];let e=0,n=0;const r=this.$store.isReversed?this.$store.options.pages.toReversed():this.$store.options.pages;if(r.filter(s=>s>0).forEach((s,o)=>{this.tileSources.filter(a=>a.$meta.page===s&&a.$meta.layerIndex===(this.$store.options.layers[o]||0)).forEach((a,u)=>{var v;e=e||a[this.$store.isVertical?"height":"width"];const c=a[this.$store.isVertical?"height":"width"]/e;this.$store.options.pages[0]===0&&(!this.$store.isReversed&&s===1||this.$store.isReversed&&s===this.$store.pageCount)&&(i.push({opacity:0,tileSource:a,[this.$store.isVertical?"y":"x"]:0,[this.$store.isVertical?"height":"width"]:c}),n+=1+Fn);const h={tileSource:a,[this.$store.isVertical?"y":"x"]:n,[this.$store.isVertical?"height":"width"]:c},{target:f}=((v=this.$store.manifest.items[s-1].items[0])==null?void 0:v.items[u])||{},m=Bo((f==null?void 0:f.id)||f);m?[h.x,h.y,h.width]=m.map(y=>y/e):n+=c+Fn,this.$store.options.pages[0]===0&&(!this.$store.isReversed&&s===this.$store.pageCount||this.$store.isReversed&&s===1)&&i.push({opacity:0,tileSource:a,[this.$store.isVertical?"y":"x"]:n,[this.$store.isVertical?"height":"width"]:c}),i.push(h)})}),this.viewer){this.viewer.addOnceHandler("open",()=>{if(this.viewerState.isReset||t)this.resetImage();else{if(this.viewer.viewport.applyConstraints(!0),!this.$store.options.optionsResetOnPageChange)return;this.$store.options.optionsResetOnPageChange.forEach(s=>{if(s==="filters")this.resetFilters();else if(s==="pan"){const o=this.viewer.viewport.getBounds();if(o.x<=0&&o.y<=0)return;const l=r[0]?0:1;this.viewer.viewport.panTo({x:o.x>0?o.width/2+l:this.$store.options.pan.x,y:o.y>0?o.height/2:this.$store.options.pan.y}),this.$store.updateOptions({pan:{}})}else s==="rotation"?(this.viewer.viewport.setRotation(0),this.$store.updateOptions({rotation:null})):s==="zoom"&&(this.viewer.viewport.goHome(),this.$store.updateOptions({zoom:null}))})}}),this.viewer.open(i);return}this.viewer=Mn({animationTime:.4,drawer:"canvas",element:this.$refs.image,immediateRender:this.$store.isContainerWidthAtLeast("small"),placeholderFillStyle:"grey",preserveImageSizeOnResize:!0,preserveViewport:!0,showNavigationControl:!1,showZoomControl:!1,tileSources:i,visibilityRatio:.2,...this.$store.options.viewer}),this.viewer.addHandler("canvas-key",s=>{var o;["f","F","r","R","S","W","+","=","-","_"].includes((o=s.originalEvent)==null?void 0:o.key)&&(s.preventDefaultAction=!0)}),this.viewer.gestureSettingsMouse.clickToZoom=!1,this.viewer.addHandler("animation-finish",()=>{if(this.viewerState.isReset){this.removeImageOptions();return}const s=this.viewer.viewport.getCenter();this.$store.updateOptions({pan:{x:Math.round(s.x*1e3)/1e3,y:Math.round(s.y*1e3)/1e3},zoom:Math.round(this.viewer.viewport.getZoom()*1e3)/1e3})}),this.viewer.addHandler("open",()=>{this.startLoadingWatch(),this.$store.options.pan.x!==void 0||this.$store.options.pan.y!==void 0||this.$store.options.zoom?((this.$store.options.pan.x!==void 0||this.$store.options.pan.y!==void 0)&&this.viewer.viewport.panTo({x:this.$store.options.pan.x,y:this.$store.options.pan.y},!0),this.$store.options.zoom&&this.viewer.viewport.zoomTo(this.$store.options.zoom,null,!0)):this.viewer.viewport.goHome(),this.$store.options.rotation!==null&&this.viewer.viewport.setRotation(this.$store.options.rotation),this.updateOverlays()}),this.viewer.addHandler("pan",this.updateViewerState),this.viewer.addHandler("resize",()=>{this.viewerState.isReset&&this.$nextTick(()=>this.viewer.viewport.goHome(!0)),this.updateViewerState()}),this.viewer.addHandler("rotate",this.updateViewerState),this.viewer.addHandler("zoom",this.updateViewerState),this.viewer.addHandler("tile-load-failed",s=>{this.$store.addError(`Error loading image: ${s.message}`)}),this.defaultCanvasCss=this.viewer.drawer.canvas.style.cssText,this.updateFilterStyle(),this.$api.expose(this.resetImage),this.$api.expose(this.viewer,"viewer"),this.promise.resolve()},loadInfo(t=!1){this.stopLoadingWatch(),this.avResource=null;let i,e;const n=[];this.$store.options.pages.filter(r=>r>0).forEach((r,s)=>{var a,u,c;const o=this.$store.manifest.items[r-1],l=this.$store.options.layers[s]||0;(c=(u=(a=o.items)==null?void 0:a[0])==null?void 0:u.items)==null||c.forEach((h,f)=>{var y,T,x,E,M,L,U,K;const m=((T=(y=h.body)==null?void 0:y.items)==null?void 0:T[l])||h.body;if(!m){this.$store.addError(`Resource missing for page ${r}`);return}if(["Sound","Video"].includes(m==null?void 0:m.type)){if(this.$store.options.pages[1]>-1){this.$store.updateOptions({pages:[r]});return}this.avResource={},e={format:m.format,type:m.type,url:m.id},this.$nextTick(()=>{this.avResource=e});const q=o.accompanyingCanvas||o.placeholderCanvas,Y=(L=(M=(E=(x=q==null?void 0:q.items)==null?void 0:x[0])==null?void 0:E.items)==null?void 0:M[0])==null?void 0:L.body;i=((U=Y==null?void 0:Y.items)==null?void 0:U[l])||Y}else i=m;if(i&&this.tileSources.find(q=>q.$meta.page===r&&q.$meta.itemIndex===f&&q.$meta.layerIndex===l))return;const v=((K=i==null?void 0:i.source)==null?void 0:K.service)||(i==null?void 0:i.service);if(v){const q=[].concat(v)[0],Y=q.id||q["@id"],te=`${Y}${Y.at(-1)==="/"?"":"/"}info.json`;n.push(this.$store.fetchJson(te).then(fe=>({...fe,$meta:{page:r,itemIndex:f,layerIndex:l}}),fe=>{let $;fe.response&&fe.response.statusText?$=fe.response.statusText:fe.message&&($=fe.message),this.$store.addError(`Error loading info file for page ${r}${$?`: ${$}`:""}`)}))}else i!=null&&i.id&&this.tileSources.push({$meta:{page:r,itemIndex:f,layerIndex:l},type:"image",url:i.id,width:i.width,height:i.height})}),!i&&!e&&this.$store.addError(`Image missing for page ${r}`)}),n.length?Promise.all(n).then(r=>{r.filter(Boolean).forEach(o=>{var l,a;if(this.$store.options.preferredImageFormat){const u=o.extraFormats||((a=(l=o.profile)==null?void 0:l[1])==null?void 0:a.formats);u!=null&&u.includes(this.$store.options.preferredImageFormat)&&(o.tileFormat=this.$store.options.preferredImageFormat)}this.tileSources.push(o)});const s=this.$store.options.pages.filter(o=>o>0);r.some(o=>s.includes(o==null?void 0:o.$meta.page))&&this.initViewer(t)}):i&&this.initViewer(t)},onKeydown(t){t.key==="Escape"&&this.$store.rootElement.focus(),t.key==="Home"&&this.resetImage()},onKeypress(t){if(!ms(t))switch(t.key){case"I":this.resetFilters();break;case"r":case"R":this.rotate(t);break;case"+":case"=":case"W":this.zoomIn();break;case"-":case"_":case"S":this.zoomOut();break}},removeImageOptions(){this.$store.updateOptions({pan:{},zoom:null})},resetFilters(){this.viewer.drawer.canvas.style.cssText=this.defaultCanvasCss,this.$store.updateOptions({filters:{}})},resetImage(){this.viewer.viewport.setRotation(0),this.$store.updateOptions({rotation:null}),this.viewer.viewport.goHome(),this.removeImageOptions()},rotate(t){const{viewport:i}=this.viewer,e=(i.getRotation()+90*(t&&t.shiftKey?-1:1))%360;i.setRotation(e),this.$store.updateOptions({rotation:e||null})},setFilter(t,i){const e=i.target.valueAsNumber;e===1?delete this.$store.options.filters[t]:this.$store.options.filters[t]=e,this.$store.updateOptions({filters:this.$store.options.filters}),this.updateFilterStyle()},startLoadingWatch(){this.$store.loading=0;for(let t=this.viewer.world.getItemCount()-1;t>=0;t-=1){const i=this.viewer.world.getItemAt(t);if(i&&i._tilesLoading){this.$store.loading=1;break}}this.loadingTimeout=setTimeout(this.startLoadingWatch,200)},stopLoadingWatch(){clearTimeout(this.loadingTimeout)},toggleOverlays(){this.$store.updateOptions({annotationsVisible:this.$store.options.annotationsVisible!==!1?!1:null})},updateFilterStyle(){if(!this.filtersActive)return;const t=[];Object.keys(this.$store.options.filters).forEach(e=>{t.push(`${e}(${this.$store.options.filters[e]})`)});const i=t.join(" ");this.viewer.drawer.canvas.style.cssText=`${this.defaultCanvasCss} filter: ${i}`},updateOverlays(){if(!this.viewer||!this.$store.options.pages.filter(e=>e>0).every(e=>this.tileSources.some(n=>n.$meta.page===e))||(this.viewer.clearOverlays(),this.overlayElements=[],!this.$store.annotationsActive))return;let t,i=0;this.$store.options.pages.filter(e=>e>-1).forEach((e,n)=>{var s,o,l,a;const r=this.tileSources.find(u=>u.$meta.page===(e===0?1:e)&&u.$meta.layerIndex===(this.$store.options.layers[n]||0));if(n===0){if(t=r[this.$store.isVertical?"height":"width"],e===0)return}else{const u=this.$store.options.pages[n-1],c=((s=this.$store.manifest.items[u-1])==null?void 0:s[this.$store.isVertical?"height":"width"])||t;i+=(Fn+c/t)*(this.$store.isReversed?-1:1)}(l=(o=this.$store.annotations[e])==null?void 0:o[0])!=null&&l.coords&&((a=this.$store.annotations[e])==null||a.forEach((u,c)=>{const h=document.createElement("button");h.ariaLabel=`${e}/${c}`,h.className=`tify-media-overlay${this.$store.options.annotationId===u.id?" -current":""}`,h.id=u.id,h.type="button",new Mn.MouseTracker({element:h,clickHandler:f=>{f.quick&&setTimeout(()=>this.$store.toggleAnnotationId(u.id),5)},keyDownHandler:f=>f.keyCode===13&&this.$store.toggleAnnotationId(u.id)}),this.viewer.addOverlay({element:h,location:new Mn.Rect(u.coords[0]/t+(this.$store.isVertical?0:i),u.coords[1]/t+(this.$store.isVertical?i:0),u.coords[2]/t,u.coords[3]/t)}),this.overlayElements.push(h)}))})},updateViewerState(){const t=this.viewer.viewport.getZoom();this.viewerState.isMaxZoom=t>=this.viewer.viewport.getMaxZoom(),this.viewerState.isMinZoom=t<=this.viewer.viewport.getMinZoom();const i=this.viewer.viewport.getHomeBounds(),e=this.viewer.viewport.getBounds();this.viewerState.isReset=Math.abs(i.height-e.height)<1e-9&&Math.abs(i.width-e.width)<1e-9&&Math.abs(i.x-e.x)<1e-9&&Math.abs(i.y-e.y)<1e-9},zoomIn(){this.viewer.viewport.zoomBy(ur),this.viewer.viewport.applyConstraints()},zoomOut(){this.viewer.viewport.zoomBy(1/ur),this.viewer.viewport.applyConstraints()}}},Fp={class:"tify-media","aria-live":"polite"},Lp={class:"tify-sr-only"},kp={key:0,class:"tify-media-buttons -controls"},Hp=["disabled","title","aria-label"],Bp=["disabled","title","aria-label"],zp=["disabled","title","aria-label"],Np=["title","aria-label"],Up={class:"tify-sr-only"},Vp=["disabled"],Wp=["title","aria-label"],jp={class:"tify-sr-only"},Gp={key:0},qp={class:"tify-button-list"},Zp=["aria-pressed","onClick"],Kp={class:"tify-media-buttons -pagination"},Xp=["title","aria-label","onClick"];function Yp(t,i,e,n,r,s){var K;const o=ds,l=fs,a=Dp,u=Cp,c=bp,h=_p,f=vs,m=rp,v=ip,y=$f,T=ni,x=Ho,E=ko,M=Do,L=Io,U=qf;return S(),D("section",Fp,[R("h2",Lp,z(t.$translate("Media")),1),R("div",{ref:"image",class:Pe(["tify-media-image",{"-annotations-hidden":t.$store.options.annotationsVisible===!1}])},null,2),r.viewer?(S(),D("div",kp,[R("button",{type:"button",class:"tify-media-button",disabled:r.viewerState.isMaxZoom,title:t.$translate("Zoom in"),"aria-label":t.$translate("Zoom in"),onClick:i[0]||(i[0]=q=>s.zoomIn())},[ee(o)],8,Hp),R("button",{type:"button",class:"tify-media-button",disabled:r.viewerState.isMinZoom,title:t.$translate("Zoom out"),"aria-label":t.$translate("Zoom out"),onClick:i[1]||(i[1]=q=>s.zoomOut())},[ee(l)],8,Bp),R("button",{type:"button",class:"tify-media-button",disabled:r.viewerState.isReset,title:t.$translate("Reset"),"aria-label":t.$translate("Reset"),onClick:i[2]||(i[2]=q=>s.resetImage())},[ee(a)],8,zp),R("button",{type:"button",class:Pe(["tify-media-button",{"-active":!!t.$store.options.rotation}]),title:t.$translate("Rotate"),"aria-label":t.$translate("Rotate"),onClick:i[3]||(i[3]=q=>s.rotate(q))},[ee(u)],10,Np),ee(f,{class:Pe(["tify-media-dropdown -filters",{"-active":s.filtersActive}]),alignment:"center",position:"right",label:t.$translate("Toggle image filters"),shortcut:"i"},{button:$e(()=>[ee(c)]),default:$e(()=>[R("h3",Up,z(t.$translate("Image filters")),1),ee(h,{onUpdate:i[4]||(i[4]=(q,Y)=>s.setFilter(q,Y))}),R("p",null,[R("button",{type:"button",class:"tify-media-reset",disabled:!s.filtersActive,onClick:i[5]||(i[5]=Vt(q=>s.resetFilters(),["stop"]))},z(t.$translate("Reset")),9,Vp)])]),_:1},8,["class","label"]),t.$store.annotations.length&&(t.$store.options.view==="text"||!t.$store.isContainerWidthAtLeast("medium"))?(S(),D("button",{key:0,type:"button",class:"tify-media-button",title:t.$translate("Toggle annotations"),"aria-label":t.$translate("Toggle annotations"),onClick:i[6]||(i[6]=q=>s.toggleOverlays())},[t.$store.options.annotationsVisible!==!1?(S(),le(m,{key:0})):(S(),le(v,{key:1}))],8,Wp)):Q("",!0),s.multiLayerResources.length?(S(),le(f,{key:1,class:Pe(["tify-media-dropdown -layers",{"-active":t.$store.options.layers.some(Boolean)}]),alignment:"center",position:"right",label:t.$translate("Toggle image layer select"),shortcut:"c"},{button:$e(()=>[ee(y)]),default:$e(()=>[R("h3",jp,z(t.$translate("Layer")),1),(S(!0),D(se,null,Ee(s.multiLayerResources,q=>(S(),D(se,{key:q.pageIndex},[t.$store.options.pages.filter(Y=>Y>0).length>1?(S(),D("h4",Gp,[ee(T,{number:t.$store.options.pages[q.pageIndex],wrap:!0},null,8,["number"])])):Q("",!0),R("ol",qp,[(S(!0),D(se,null,Ee(q.items,(Y,te)=>(S(),D("li",{key:Y.id},[R("button",{type:"button","aria-pressed":te===(t.$store.options.layers[q.pageIndex]||0),onClick:fe=>{t.$store.options.layers[q.pageIndex]=te,s.loadInfo()}},z(t.$store.localize(Y.label)),9,Zp)]))),128))])],64))),128))]),_:1},8,["class","label"])):Q("",!0)])):Q("",!0),R("div",Kp,[(S(!0),D(se,null,Ee(s.paginationButtons,q=>(S(),D("button",{key:q.position,type:"button",class:Pe(["tify-media-button",`-${q.position}`]),title:q.title,"aria-label":q.title,onClick:q.onClick},[q.position==="left"?(S(),le(x,{key:0})):q.position==="right"?(S(),le(E,{key:1})):q.position==="top"?(S(),le(M,{key:2})):q.position==="bottom"?(S(),le(L,{key:3})):Q("",!0)],10,Xp))),128))]),(K=r.avResource)!=null&&K.url?(S(),le(U,{key:1,src:r.avResource.url,format:r.avResource.format,hasImage:!!r.viewer},null,8,["src","format","hasImage"])):Q("",!0)])}const Jp=Ie(Mp,[["render",Yp]]),Qp={viewBox:"0 0 24 24",class:"tify-icon -fullscreen-exit","aria-hidden":"true"};function $p(t,i){return S(),D("svg",Qp,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M14 14h5v2h-3v3h-2zm-9 0h5v5H8v-3H5zm3-9h2v5H5V8h3zm11 3v2h-5V5h2v3z"},null,-1)])])}const eg=de({name:"mdi-FullscreenExit",render:$p}),tg={viewBox:"0 0 24 24",class:"tify-icon -fullscreen","aria-hidden":"true"};function ig(t,i){return S(),D("svg",tg,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M5 5h5v2H7v3H5zm9 0h5v5h-2V7h-3zm3 9h2v5h-5v-2h3zm-7 3v2H5v-5h2v3z"},null,-1)])])}const ng=de({name:"mdi-Fullscreen",render:ig}),sg={viewBox:"0 0 24 24",class:"tify-icon -help-circle-outline","aria-hidden":"true"};function rg(t,i){return S(),D("svg",sg,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M11 18h2v-2h-2zm1-16A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8s8 3.59 8 8s-3.59 8-8 8m0-14a4 4 0 0 0-4 4h2a2 2 0 0 1 2-2a2 2 0 0 1 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5a4 4 0 0 0-4-4"},null,-1)])])}const og=de({name:"mdi-HelpCircleOutline",render:rg}),ag={viewBox:"0 0 24 24",class:"tify-icon -list-box-outline","aria-hidden":"true"};function lg(t,i){return S(),D("svg",ag,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M11 15h6v2h-6zM9 7H7v2h2zm2 6h6v-2h-6zm0-4h6V7h-6zm-2 2H7v2h2zm12-6v14c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2h14c1.1 0 2 .9 2 2m-2 0H5v14h14zM9 15H7v2h2z"},null,-1)])])}const ug=de({name:"mdi-ListBoxOutline",render:lg}),cg={viewBox:"0 0 24 24",class:"tify-icon -tray-arrow-down","aria-hidden":"true"};function hg(t,i){return S(),D("svg",cg,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M2 12h2v5h16v-5h2v5c0 1.11-.89 2-2 2H4a2 2 0 0 1-2-2zm10 3l5.55-5.46l-1.42-1.41L13 11.25V2h-2v9.25L7.88 8.13L6.46 9.55z"},null,-1)])])}const dg=de({name:"mdi-TrayArrowDown",render:hg}),fg={viewBox:"0 0 24 24",class:"tify-icon -information-variant","aria-hidden":"true"};function pg(t,i){return S(),D("svg",fg,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M13.5 4A1.5 1.5 0 0 0 12 5.5A1.5 1.5 0 0 0 13.5 7A1.5 1.5 0 0 0 15 5.5A1.5 1.5 0 0 0 13.5 4m-.36 4.77c-1.19.1-4.44 2.69-4.44 2.69c-.2.15-.14.14.02.42c.16.27.14.29.33.16c.2-.13.53-.34 1.08-.68c2.12-1.36.34 1.78-.57 7.07c-.36 2.62 2 1.27 2.61.87c.6-.39 2.21-1.5 2.37-1.61c.22-.15.06-.27-.11-.52c-.12-.17-.24-.05-.24-.05c-.65.43-1.84 1.33-2 .76c-.19-.57 1.03-4.48 1.7-7.17c.11-.64.41-2.04-.75-1.94"},null,-1)])])}const gg=de({name:"mdi-InformationVariant",render:pg}),mg={viewBox:"0 0 24 24",class:"tify-icon -toc","aria-hidden":"true"};function vg(t,i){return S(),D("svg",mg,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M3 9h14V7H3zm0 4h14v-2H3zm0 4h14v-2H3zm16 0h2v-2h-2zm0-10v2h2V7zm0 6h2v-2h-2z"},null,-1)])])}const yg=de({name:"mdi-Toc",render:vg}),wg={viewBox:"0 0 24 24",class:"tify-icon -text","aria-hidden":"true"};function _g(t,i){return S(),D("svg",wg,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M21 6v2H3V6zM3 18h9v-2H3zm0-5h18v-2H3z"},null,-1)])])}const Tg=de({name:"mdi-Text",render:_g}),xg={viewBox:"0 0 24 24",class:"tify-icon -image-area","aria-hidden":"true"};function bg(t,i){return S(),D("svg",xg,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M20 5a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V7c0-1.11.89-2 2-2zM5 16h14l-4.5-6l-3.5 4.5l-2.5-3z"},null,-1)])])}const Eg=de({name:"mdi-ImageArea",render:bg}),Sg={viewBox:"0 0 24 24",class:"tify-icon -dots-grid","aria-hidden":"true"};function Cg(t,i){return S(),D("svg",Sg,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M12 16c1.1 0 2 .9 2 2s-.9 2-2 2s-2-.9-2-2s.9-2 2-2m0-6c1.1 0 2 .9 2 2s-.9 2-2 2s-2-.9-2-2s.9-2 2-2m0-6c1.1 0 2 .9 2 2s-.9 2-2 2s-2-.9-2-2s.9-2 2-2M6 16c1.1 0 2 .9 2 2s-.9 2-2 2s-2-.9-2-2s.9-2 2-2m0-6c1.1 0 2 .9 2 2s-.9 2-2 2s-2-.9-2-2s.9-2 2-2m0-6c1.1 0 2 .9 2 2s-.9 2-2 2s-2-.9-2-2s.9-2 2-2m12 12c1.1 0 2 .9 2 2s-.9 2-2 2s-2-.9-2-2s.9-2 2-2m0-6c1.1 0 2 .9 2 2s-.9 2-2 2s-2-.9-2-2s.9-2 2-2m0-6c1.1 0 2 .9 2 2s-.9 2-2 2s-2-.9-2-2s.9-2 2-2"},null,-1)])])}const Pg=de({name:"mdi-DotsGrid",render:Cg}),Rg={viewBox:"0 0 24 24",class:"tify-icon -page-last","aria-hidden":"true"};function Dg(t,i){return S(),D("svg",Rg,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6l-6-6zM16 6h2v12h-2z"},null,-1)])])}const Ig=de({name:"mdi-PageLast",render:Dg}),Ag={viewBox:"0 0 24 24",class:"tify-icon -skip-next","aria-hidden":"true"};function Og(t,i){return S(),D("svg",Ag,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M16 18h2V6h-2M6 18l8.5-6L6 6z"},null,-1)])])}const Mg=de({name:"mdi-SkipNext",render:Og}),Fg={viewBox:"0 0 24 24",class:"tify-icon -skip-previous","aria-hidden":"true"};function Lg(t,i){return S(),D("svg",Fg,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M6 18V6h2v12zm3.5-6L18 6v12z"},null,-1)])])}const kg=de({name:"mdi-SkipPrevious",render:Lg}),Hg={viewBox:"0 0 24 24",class:"tify-icon -page-first","aria-hidden":"true"};function Bg(t,i){return S(),D("svg",Hg,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6l6 6zM6 6h2v12H6z"},null,-1)])])}const zg=de({name:"mdi-PageFirst",render:Bg}),Ng={},Ug=["disabled","title","aria-label"],Vg=["disabled","title","aria-label"],Wg=["disabled","title","aria-label"],jg=["disabled","title","aria-label"],Gg=["disabled","title","aria-label"],qg=["disabled","title","aria-label"];function Zg(t,i){const e=zg,n=kg,r=Ho,s=ko,o=Mg,l=Ig;return S(),D("div",{class:Pe(["tify-header-button-group -pagination",{"-reversed":t.$store.isReversed,"-vertical":t.$store.isVertical}])},[R("button",{type:"button",class:"tify-header-button",disabled:t.$store.isFirstPage,title:t.$translate("First page"),"aria-label":t.$translate("First page"),onClick:i[0]||(i[0]=a=>t.$store.goToFirstPage())},[ee(e)],8,Ug),t.$store.sections.length>1?(S(),D("button",{key:0,type:"button",class:"tify-header-button",disabled:t.$store.isFirstPage,title:t.$translate("Previous section"),"aria-label":t.$translate("Previous section"),onClick:i[1]||(i[1]=a=>t.$store.goToPreviousSection())},[ee(n)],8,Vg)):Q("",!0),R("button",{type:"button",class:"tify-header-button",disabled:t.$store.isFirstPage,title:t.$translate("Previous page"),"aria-label":t.$translate("Previous page"),onClick:i[2]||(i[2]=a=>t.$store.goToPreviousPage())},[ee(r)],8,Wg),R("button",{type:"button",class:"tify-header-button",disabled:t.$store.isLastPage,title:t.$translate("Next page"),"aria-label":t.$translate("Next page"),onClick:i[3]||(i[3]=a=>t.$store.goToNextPage())},[ee(s)],8,jg),t.$store.sections.length>1?(S(),D("button",{key:1,type:"button",class:"tify-header-button",disabled:t.$store.isLastSection,title:t.$translate("Next section"),"aria-label":t.$translate("Next section"),onClick:i[4]||(i[4]=a=>t.$store.goToNextSection())},[ee(o)],8,Gg)):Q("",!0),R("button",{type:"button",class:"tify-header-button",disabled:t.$store.isLastPage,title:t.$translate("Last page"),"aria-label":t.$translate("Last page"),onClick:i[5]||(i[5]=a=>t.$store.goToLastPage())},[ee(l)],8,qg)],2)}const Kg=Ie(Ng,[["render",Zg]]),Xg={},Yg={class:"tify-icon -book-open-blank-outline","aria-hidden":"true",fill:"currentColor",viewBox:"0 0 24 24"};function Jg(t,i){return S(),D("svg",Yg,[...i[0]||(i[0]=[R("path",{d:"M21,4H3A2,2 0 0,0 1,6V19A2,2 0 0,0 3,21H21A2,2 0 0,0 23,19V6A2,2 0 0,0 21,4M3,19V6H11V19H3M21,19H13V6H21V19Z"},null,-1)])])}const Qg=Ie(Xg,[["render",Jg]]),$g={viewBox:"0 0 24 24",class:"tify-icon -view-module","aria-hidden":"true"};function em(t,i){return S(),D("svg",$g,[...i[0]||(i[0]=[R("path",{fill:"currentColor",d:"M16 5v6h5V5m-11 6h5V5h-5m6 13h5v-6h-5m-6 6h5v-6h-5m-6 6h5v-6H4m0-1h5V5H4z"},null,-1)])])}const tm=de({name:"mdi-ViewModule",render:em}),im={data(){return{filter:"",filteredCanvases:[],highlightIndex:0}},watch:{filter(){this.updateFilteredCanvases(),this.$nextTick(()=>this.updateScroll())}},mounted(){this.updateFilteredCanvases()},methods:{onKeyDownArrow(){this.highlightIndex<this.filteredCanvases.length-1&&(this.highlightIndex+=1,this.updateScroll())},onKeyUpArrow(){this.highlightIndex>0&&(this.highlightIndex-=1,this.updateScroll())},onOpen(){this.filter="",this.highlightIndex=this.$store.options.pages.at(-1)-1,this.$nextTick(()=>{window.matchMedia("(pointer: coarse)").matches||this.$refs.search.focus(),this.updateScroll()})},resetFilter(t){this.filter&&(this.filter="",t.stopPropagation())},setPage(t){this.$store.setPage(t),this.$store.isContainerWidthAtLeast("medium")||this.$store.updateOptions({view:null})},updateFilteredCanvases(){const t=[],i=this.filter.toLowerCase();let e=-1;this.$store.manifest.items.forEach((n,r)=>{const o=this.$store.localize(n.label).toLowerCase().includes(i),l=(r+1).toFixed().includes(i);if(o||l){const a=n;a.page=r+1,a.page===this.$store.options.pages[0]&&(e=t.length),t.push(a)}}),this.highlightIndex=e<0?0:e,this.filteredCanvases=t},updateScroll(){const{list:t}=this.$refs,i=t.children[this.highlightIndex];t&&i&&(t.scrollTop=i.offsetTop-t.offsetHeight/2+i.offsetHeight/2)}}},nm={class:"tify-sr-only"},sm={class:"tify-sr-only"},rm={class:"tify-page-select-filter"},om=["aria-label"],am={ref:"list",class:"tify-button-list tify-page-select-list"},lm=["onClick"];function um(t,i,e,n,r,s){const o=ni,l=vs;return S(),le(l,{class:"tify-page-select",shortcut:"x",onOpen:s.onOpen},{button:$e(()=>[R("span",nm,z(`${t.$translate("Current Page")} `),1),ee(o,{number:t.$store.options.pages.find(a=>a>0)},null,8,["number"]),R("span",sm," / "+z(t.$translate("Toggle page select")),1)]),default:$e(()=>[R("div",rm,[Be(R("input",{ref:"search","onUpdate:modelValue":i[0]||(i[0]=a=>r.filter=a),"aria-label":t.$translate("Filter pages"),type:"text",class:"tify-page-select-input",onKeyup:i[1]||(i[1]=Ht(a=>{var u;return(u=t.$refs.list.querySelectorAll("a")[r.highlightIndex])==null?void 0:u.click()},["enter"])),onKeydown:[i[2]||(i[2]=Ht(a=>s.resetFilter(),["esc"])),i[3]||(i[3]=Ht(Vt(a=>s.onKeyUpArrow(),["prevent"]),["up"])),i[4]||(i[4]=Ht(Vt(a=>s.onKeyDownArrow(),["prevent"]),["down"]))]},null,40,om),[[Ji,r.filter]])]),R("ol",am,[(S(!0),D(se,null,Ee(r.filteredCanvases,(a,u)=>(S(),D("li",{key:u},[R("a",{href:"javascript:;",class:Pe({"-current":t.$store.options.pages.includes(a.page),"-highlighted":r.highlightIndex===u}),onClick:c=>s.setPage(a.page)},[ee(o,{number:a.page,wrap:!0},null,8,["number"])],10,lm)]))),128))],512)]),_:1},8,["onOpen"])}const cm=Ie(im,[["render",um]]),hm={props:{textEnabled:Boolean,tocEnabled:Boolean},data(){return{controlsVisible:!1,fullscreen:nf(this.$store.rootElement.parentNode)}},computed:{availableViews(){return[null,...this.$store.options.views].filter(t=>{switch(t){case null:return!!this.$store.manifest;case"text":return this.textEnabled;case"thumbnails":return!!this.$store.manifest;case"toc":return this.tocEnabled;case"export":return!!this.$store.collection||!!this.$store.manifest;case"collection":return!!this.$store.collection;default:return!0}})},doublePageEnabled(){var t;return(t=this.$store.manifest.behavior)!=null&&t.some(i=>["continuous","individuals"].includes(i))?!1:this.$store.manifest.items.some(i=>{var e,n,r,s,o;return((o=(s=(r=(n=(e=i.items)==null?void 0:e[0])==null?void 0:n.items)==null?void 0:r[0])==null?void 0:s.body)==null?void 0:o.type)==="Image"})},title(){return this.$store.localize((this.$store.manifest||this.$store.collection||{}).label).replace(/(\S{1,10})\s+(\S{1,10})$/,"$1 $2")}},created(){this.$api.expose(this.setView),this.$api.expose(this.toggleDoublePage),this.$api.expose(this.fullscreen.toggle,"toggleFullscreen")},mounted(){this.$store.rootElement.addEventListener("keydown",this.onKeyDown),Lo(this.$refs.controls,()=>{this.closeControlsPopup()})},beforeUnmount(){this.$store.rootElement.removeEventListener("keydown",this.onKeyDown)},methods:{closeControlsPopup(){this.controlsVisible=!1},onKeyDown(t){if(ms(t))return;if(t.key==="Escape"){this.controlsVisible=!1;return}const i=Number(t.key);switch(i<=this.availableViews.length&&this.toggleView(this.availableViews[i]),t.key){case"b":this.$store.manifest&&this.toggleDoublePage();break;case"f":this.fullscreen.toggle();break;case"h":this.toggleView("help");break}if(this.$store.manifest)switch(t.key){case"q":case",":this.$store.goToPreviousPage();break;case"e":case".":this.$store.goToNextPage();break;case"Q":this.$store.goToFirstPage();break;case"E":this.$store.goToLastPage();break}},setView(t){this.$store.updateOptions({view:t})},toggleControlsPopup(){this.controlsVisible=!this.controlsVisible},toggleDoublePage(t){const{pages:i}=this.$store.options;if(!this.doublePageEnabled)return i[0];let e;return i.length>1&&t!==!0||t===!1?e=[i[1]>0?i[1]:i[0]]:e=[i[0],this.$store.getFacingPage(i[0])].sort(),this.$store.updateOptions({pages:e}),e},toggleView(t){if(this.closeControlsPopup(),t!=="help"&&!this.availableViews.includes(t))return!1;const i=t===this.$store.options.view&&this.$store.manifest&&this.$store.isContainerWidthAtLeast("medium")?null:t;return this.$store.updateOptions({view:i}),i}}},dm={class:"tify-header"},fm={class:"tify-header-column -title"},pm=["title"],gm={key:0,class:"tify-header-column -pagination"},mm={class:"tify-sr-only"},vm={class:"tify-header-button-group -page-select"},ym=["title","aria-label","aria-pressed"],wm={ref:"controls",class:"tify-header-column -controls"},_m={class:"tify-sr-only"},Tm={ref:"switchViewSmall",class:"tify-header-button-group -toggle"},xm=["aria-controls","aria-expanded","title","aria-label"],bm=["id"],Em={class:"tify-header-button-group -view"},Sm=["aria-controls","aria-expanded","onClick"],Cm={class:"tify-header-button-label"},Pm={class:"tify-header-button-label"},Rm={class:"tify-header-button-label"},Dm={class:"tify-header-button-label"},Im={class:"tify-header-button-label"},Am={class:"tify-header-button-label"},Om={class:"tify-header-button-label"},Mm={class:"tify-header-button-group -view"},Fm=["aria-controls","aria-expanded","title","aria-label"],Lm={class:"tify-header-button-label"},km=["title","aria-label"],Hm={class:"tify-header-button-label"},Bm=["title","aria-label"],zm={class:"tify-header-button-label"};function Nm(t,i,e,n,r,s){const o=cm,l=tm,a=Qg,u=Kg,c=Pg,h=Eg,f=Tg,m=yg,v=gg,y=dg,T=ug,x=og,E=ng,M=eg;return S(),D("header",dm,[R("div",fm,[R("h1",{class:"tify-header-title",title:s.title},z(s.title),9,pm)]),t.$store.pageCount>1?(S(),D("div",gm,[R("h2",mm,z(t.$translate("Page")),1),R("div",vm,[ee(o),s.doublePageEnabled?(S(),D("button",{key:0,type:"button",class:Pe(["tify-header-button",{"-vertical":t.$store.isVertical}]),title:t.$translate("Toggle double-page"),"aria-label":t.$translate("Toggle double-page"),"aria-pressed":t.$store.options.pages.length>1,onClick:i[0]||(i[0]=(...L)=>s.toggleDoublePage&&s.toggleDoublePage(...L))},[t.$store.isCustomPageView?(S(),le(l,{key:0})):(S(),le(a,{key:1}))],10,ym)):Q("",!0)]),t.$store.pageCount>1?(S(),le(u,{key:0})):Q("",!0)])):Q("",!0),R("div",wm,[R("h2",_m,z(t.$translate("View [noun]")),1),R("div",Tm,[R("button",{type:"button","aria-controls":t.$getId("controls"),"aria-expanded":r.controlsVisible,class:"tify-header-button",title:t.$translate("View [noun]"),"aria-label":t.$translate("View [noun]"),onClick:i[1]||(i[1]=(...L)=>s.toggleControlsPopup&&s.toggleControlsPopup(...L))},[ee(c)],8,xm)],512),R("div",{id:t.$getId("controls"),class:Pe(["tify-dropdown-content -bottom -mobile-only",{"-visible":r.controlsVisible}])},[R("div",Em,[(S(!0),D(se,null,Ee(s.availableViews,L=>(S(),D("button",{key:L,type:"button",class:Pe(`tify-header-button -${L||"media"}`),"aria-controls":t.$getId(L||"media"),"aria-expanded":t.$store.options.view===L,onClick:U=>s.toggleView(L)},[L?Q("",!0):(S(),D(se,{key:0},[ee(h),R("span",Cm,z(t.$translate("Media")),1)],64)),L==="text"?(S(),D(se,{key:1},[ee(f),R("span",Pm,z(t.$translate("Text")),1)],64)):L==="thumbnails"?(S(),D(se,{key:2},[ee(l),R("span",Rm,z(t.$translate("Pages")),1)],64)):L==="toc"?(S(),D(se,{key:3},[ee(m),R("span",Dm,z(t.$translate("Contents")),1)],64)):L==="info"?(S(),D(se,{key:4},[ee(v),R("span",Im,z(t.$translate("Info")),1)],64)):L==="export"?(S(),D(se,{key:5},[ee(y),R("span",Am,z(t.$translate("Export [noun]")),1)],64)):L==="collection"?(S(),D(se,{key:6},[ee(T),R("span",Om,z(t.$translate("Collection")),1)],64)):Q("",!0)],10,Sm))),128))]),R("div",Mm,[R("button",{type:"button",class:"tify-header-button -icon-only","aria-controls":t.$getId("help"),"aria-expanded":t.$store.options.view==="help",title:t.$translate("Help"),"aria-label":t.$translate("Help"),onClick:i[2]||(i[2]=L=>s.toggleView("help"))},[ee(x),R("span",Lm,z(t.$translate("Help")),1)],8,Fm),r.fullscreen.isFullscreen?(S(),D("button",{key:1,type:"button",class:"tify-header-button -icon-only",title:t.$translate("Exit fullscreen"),"aria-label":t.$translate("Exit fullscreen"),onClick:i[4]||(i[4]=L=>r.fullscreen.toggle())},[ee(M),R("span",zm,z(t.$translate("Exit fullscreen")),1)],8,Bm)):(S(),D("button",{key:0,type:"button",class:"tify-header-button -icon-only",title:t.$translate("Fullscreen"),"aria-label":t.$translate("Fullscreen"),onClick:i[3]||(i[3]=L=>r.fullscreen.toggle())},[ee(E),R("span",Hm,z(t.$translate("Fullscreen")),1)],8,km))]),t.$store.pageCount>1?(S(),le(u,{key:0})):Q("",!0)],10,bm)],512)])}const Um=Ie(hm,[["render",Nm]]);var Vm={version:"0.36.2"};const Wm={props:{readyPromise:{type:Object,default:null,required:!0}},data(){return{readyToRender:!1}},computed:{hasText(){var t,i;return(i=(t=this.$store.manifest)==null?void 0:t.items)==null?void 0:i.some(e=>"annotations"in e)},hasToc(){return this.$store.structures.length>0}},watch:{"$store.options.pages":function(t,i){i&&(this.$store.options.layers=[]),this.$store.annotationsActive&&this.$store.loadAnnotations()},"$store.options.view":function(){this.$store.annotationsActive&&this.$store.loadAnnotations()}},created(){this.$api.expose(this.setLanguage),this.$api.expose(this.$store.setPage),this.$api.expose(this.$store.updateOptions)},mounted(){if(this.$store.rootElement=this.$el,!this.$store.options.manifestUrl){if(this.$store.options.contentStateEnabled){const t=new URLSearchParams(window.location.search);this.$store.options.manifestUrl=t.get("iiif-content")||""}if(!this.$store.options.manifestUrl){this.$store.addError("Missing IIIF manifest URL");return}}Promise.all([this.$store.loadManifest(this.$store.options.manifestUrl),this.setLanguage(this.$store.options.language)]).then(()=>{this.readyToRender=!0,this.$nextTick(()=>{Promise.all(this.$store.readyPromises).then(()=>{setTimeout(this.readyPromise.resolve)})})},t=>{this.readyPromise.reject(t)})},beforeUnmount(){clearTimeout(this.$store.urlUpdateTimeout),window.removeEventListener("popstate",this.$store.initOptions)},methods:{setLanguage(t){const i=ys();if(t==="en")return this.$store.options.language="en",this.$translate.setTranslation(null),i.resolve(t),i;if(this.$store.options.translationsDirUrl===null)return i.reject(new Error("Could not determine translationsDirUrl")),i;const e=`${this.$store.options.translationsDirUrl}/${t}.json?${Vm.version}`;return this.$store.fetchJson(e).then(n=>{this.$store.options.language=t,this.$translate.setTranslation(n),i.resolve(t)},n=>{const r=n.response?n.response.statusText:n.message;this.$store.addError(`Error loading translation “${t}”: ${r}`),i.resolve(this.$store.options.language)}),i}}},jm={key:1,class:"tify-main"},Gm={key:2,class:"tify-loading",role:"status"},qm={class:"tify-sr-only"},Zm={key:3,class:"tify-error"},Km=["aria-label"],Xm={class:"tify-error-messages"};function Ym(t,i,e,n,r,s){const o=Um,l=Jp,a=Cd,u=md,c=nd,h=Jh,f=lh,m=lc,v=Uu,y=Co;return S(),D("article",{class:Pe(["tify",t.$store.options.colorMode==="auto"?"":`-${t.$store.options.colorMode}`]),tabindex:"-1"},[r.readyToRender&&(t.$store.collection||t.$store.manifest)?(S(),le(o,{key:0,textEnabled:s.hasText,tocEnabled:s.hasToc},null,8,["textEnabled","tocEnabled"])):Q("",!0),r.readyToRender?(S(),D("div",jm,[t.$store.manifest?(S(),D(se,{key:0},[ee(l,{id:t.$getId("media")},null,8,["id"]),s.hasText?Be((S(),le(a,{key:0,id:t.$getId("text")},null,8,["id"])),[[Qe,t.$store.options.view==="text"]]):Q("",!0),Be(ee(u,{id:t.$getId("thumbnails")},null,8,["id"]),[[Qe,t.$store.options.view==="thumbnails"]]),s.hasToc?Be((S(),le(c,{key:1,id:t.$getId("toc")},null,8,["id"])),[[Qe,t.$store.options.view==="toc"]]):Q("",!0)],64)):Q("",!0),t.$store.collection||t.$store.manifest?Be((S(),le(h,{key:1,id:t.$getId("export")},null,8,["id"])),[[Qe,t.$store.options.view==="export"]]):Q("",!0),t.$store.collection||t.$store.manifest?Be((S(),le(f,{key:2,id:t.$getId("info")},null,8,["id"])),[[Qe,t.$store.options.view==="info"]]):Q("",!0),t.$store.collection?Be((S(),le(m,{key:3,id:t.$getId("collection")},null,8,["id"])),[[Qe,t.$store.options.view==="collection"]]):Q("",!0),Be(ee(v,{id:t.$getId("help")},null,8,["id"]),[[Qe,t.$store.options.view==="help"]])])):Q("",!0),t.$store.loading?(S(),D("div",Gm,[R("span",qm,z(t.$translate("Loading")),1)])):Q("",!0),t.$store.errors.size?(S(),D("section",Zm,[R("button",{type:"button",class:"tify-error-close","aria-label":t.$translate("Dismiss"),onClick:i[0]||(i[0]=T=>t.$store.clearErrors())},[ee(y)],8,Km),R("div",Xm,[(S(!0),D(se,null,Ee(t.$store.errors,T=>(S(),D("p",{key:T},z(T),1))),128))])])):Q("",!0)],2)}const Jm=Ie(Wm,[["render",Ym]]),Qm={annotationId:null,annotationsVisible:null,childManifestAutoloaded:!0,childManifestUrl:null,colorMode:"auto",container:null,contentStateEnabled:!1,fallbackLanguage:"en",filters:{},language:"en",layers:[],manifestUrl:null,optionsResetOnPageChange:["pan"],pageLabelFormat:"P · L",pages:null,pan:{},preferredImageFormat:null,rotation:null,translationsDirUrl:null,urlQueryKey:null,urlQueryParams:["annotationId","annotationsVisible","childManifestUrl","layers","filters","pages","pan","rotation","view","zoom"],view:null,viewer:{},views:["text","thumbnails","toc","info","export","collection"],zoom:null};function $m(t){return{expose(i,e){t[e||i.name.replace("bound ","")]=i}}}const ev={install:(t,i)=>{t.config.globalProperties.$api=new $m(i.instance)}},tv="TIFY is a slim and mobile-friendly IIIF document viewer, released under the <a href='https://www.gnu.org/licenses/agpl-3.0.html.en'>GNU Affero General Public License 3.0</a>.",iv="Copyright © 2017–2026 <a href='https://www.uni-goettingen.de/en/'>Göttingen University</a> / <a href='https://www.sub.uni-goettingen.de/en/'>Göttingen State and University Library</a>",nv={$info:tv,$copyright:iv,"$n/a":"‒"},sv={install:t=>{const i=vi(null);t.config.globalProperties.$translate=e=>{var s,o,l;const{language:n}=t.config.globalProperties.$store.options,r=(o=(s=t.config.globalProperties.$store.options.translations)==null?void 0:s[n])==null?void 0:o[e];return r||((l=i.value)!=null&&l[e]?i.value[e]:nv[e]||e.replace(/\s*\[.+?\]/g,""))},t.config.globalProperties.$translate.setTranslation=e=>{i.value=e}}},rv={install:t=>{const i=crypto!=null&&crypto.randomUUID?crypto.randomUUID():Math.random().toString().slice(2);t.config.globalProperties.$getId=e=>`${i}-${e}`}};function bi(t){"@babel/helpers - typeof";return bi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},bi(t)}function ov(t,i){if(bi(t)!="object"||!t)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var n=e.call(t,i);if(bi(n)!="object")return n;throw TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(t)}function av(t){var i=ov(t,"string");return bi(i)=="symbol"?i:i+""}function cr(t,i,e){return(i=av(i))in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}function lv(t){return Array.isArray(t)?t:t?[t]:[]}function gt(t){for(let i in t)(t[i]===void 0||t[i]===null)&&delete t[i];return t}const uv="http://library.stanford.edu/iiif/image-api/compliance.html#level0",cv="http://library.stanford.edu/iiif/image-api/compliance.html#level1",zo="http://library.stanford.edu/iiif/image-api/compliance.html#level2",hv="http://library.stanford.edu/iiif/image-api/conformance.html#level0",dv="http://library.stanford.edu/iiif/image-api/conformance.html#level1",No="http://library.stanford.edu/iiif/image-api/conformance.html#level2",fv="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",pv="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",Uo="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",gv="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",mv="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",Vo="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",vv="http://iiif.io/api/image/1/level0.json",yv="http://iiif.io/api/image/1/profiles/level0.json",wv="http://iiif.io/api/image/1/level1.json",_v="http://iiif.io/api/image/1/profiles/level1.json",Wo="http://iiif.io/api/image/1/level2.json",jo="http://iiif.io/api/image/1/profiles/level2.json",Tv="http://iiif.io/api/image/2/level0.json",xv="http://iiif.io/api/image/2/profiles/level0.json",bv="http://iiif.io/api/image/2/level1.json",Ev="http://iiif.io/api/image/2/profiles/level1.json",Go="http://iiif.io/api/image/2/level2.json",qo="http://iiif.io/api/image/2/profiles/level2.json",Sv="level0",Cv="level1",Zo="level2",Pv="http://iiif.io/api/image/2/level0",Rv="http://iiif.io/api/image/2/level1",Ko="http://iiif.io/api/image/2/level2",Dv=[Ko,zo,No,Uo,Vo,Wo,jo,Go,qo,Zo],Iv=[Pv,Rv,Ko,uv,cv,zo,hv,dv,No,fv,pv,Uo,gv,mv,Vo,vv,yv,wv,_v,Wo,jo,Tv,xv,bv,Ev,Go,qo,Sv,Cv,Zo],Av=Iv,hr=["sc:Collection","sc:Manifest","sc:Canvas","sc:AnnotationList","oa:Annotation","sc:Range","sc:Layer","sc:Sequence","oa:Choice","Service","ContentResource"];function Ov(t){if(t==null)throw Error("Null or undefined is not a valid entity.");if(Array.isArray(t))throw Error("Array is not a valid entity");if(typeof t!="object")throw Error(`${typeof t} is not a valid entity`);if(typeof t["@type"]=="string"){let i=hr.indexOf(t["@type"]);if(i!==-1)return hr[i]}if(t.profile)return"Service";if(t.format||t["@type"])return"ContentResource";throw Error("Resource type is not known")}var Mv=class Xo{constructor(i,e={}){cr(this,"traversals",void 0),cr(this,"options",void 0),this.traversals={collection:[],manifest:[],canvas:[],annotationList:[],sequence:[],annotation:[],contentResource:[],choice:[],range:[],service:[],layer:[],...i},this.options={convertPropsToArray:!0,mergeMemberProperties:!0,allowUndefinedReturn:!1,...e}}static all(i){return new Xo({collection:[i],manifest:[i],canvas:[i],annotationList:[i],sequence:[i],annotation:[i],contentResource:[i],choice:[i],range:[i],service:[i],layer:[i]})}traverseCollection(i){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCollectionItems(i))),this.traversals.collection)}traverseCollectionItems(i){if(this.options.mergeMemberProperties){let e=[...(i.manifests||[]).map(s=>typeof s=="string"?{"@id":s,"@type":"sc:Manifest"}:(s["@type"]||(s["@type"]="sc:Manifest"),s)),...(i.collections||[]).map(s=>typeof s=="string"?{"@id":s,"@type":"sc:Collection"}:s),...i.members||[]],n=[],r=e.filter(s=>n.includes(s["@id"])?!1:(n.push(s["@id"]),!0));delete i.collections,delete i.manifests,i.members=r}return i.manifests&&(i.manifests=i.manifests.map(e=>{let n=e;return typeof e=="string"&&(n={"@id":e,"@type":"sc:Manifest"}),n["@type"]||(n["@type"]="sc:Manifest"),this.traverseManifest(n)})),i.collections&&(i.collections=i.collections.map(e=>this.traverseCollection(typeof e=="string"?{"@id":e,"@type":"sc:Collection"}:e))),i.members&&(i.members=i.members.map(e=>typeof e=="string"?e:e["@type"]==="sc:Collection"?this.traverseCollection(e):e["@type"]==="sc:Manifest"?this.traverseManifest(e):this.traverseUnknown(e))),i}traverseManifest(i){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseManifestItems(i))),this.traversals.manifest)}traverseManifestItems(i){return i.sequences&&(i.sequences=i.sequences.map(e=>this.traverseSequence(e))),i.structures&&(i.structures=i.structures.map(e=>this.traverseRange(e))),i}traverseSequence(i){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseSequenceItems(i))),this.traversals.sequence)}traverseSequenceItems(i){return i.canvases&&(i.canvases=i.canvases.map(e=>this.traverseCanvas(e))),i}traverseCanvas(i){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCanvasItems(i))),this.traversals.canvas)}traverseCanvasItems(i){return i.images&&(i.images=i.images.map(e=>(e.on&&e["@type"]!=="oa:Annotation"&&e["@type"]!=="Annotation"&&(e["@type"]="oa:Annotation"),this.traverseAnnotation(e)))),i.otherContent&&(i.otherContent=i.otherContent.map(e=>this.traverseAnnotationList(e))),i}traverseRange(i){return i["@type"]!=="sc:Range"&&(i["@type"]="sc:Range"),this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseRangeItems(i))),this.traversals.range)}traverseRangeItems(i){if(this.options.mergeMemberProperties){let e=[...(i.ranges||[]).map(n=>typeof n=="string"?{"@id":n,"@type":"sc:Range"}:n),...(i.canvases||[]).map(n=>typeof n=="string"?{"@id":n,"@type":"sc:Canvas"}:n),...i.members||[]];delete i.ranges,delete i.canvases,i.members=e.length?e.map(n=>this.traverseUnknown(n)):void 0}return i}traverseAnnotationList(i){let e=typeof i=="string"?{"@id":i,"@type":"sc:AnnotationList"}:i;return this.traverseType(this.traverseDescriptive(this.traverseAnnotationListItems(e)),this.traversals.annotationList)}traverseAnnotationListItems(i){return i.resources&&(i.resources=i.resources.map(e=>this.traverseAnnotation(e))),i}traverseAnnotation(i){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseAnnotationItems(i))),this.traversals.annotation)}traverseAnnotationItems(i){return i.resource&&(Array.isArray(i.resource)?i.resource=i.resource.map(e=>this.traverseContentResource(e)):i.resource=this.traverseContentResource(i.resource)),i.on,i}traverseLayer(i){return this.traverseType(this.traverseLinking(this.traverseLayerItems(i)),this.traversals.layer)}traverseLayerItems(i){return i.otherContent&&(i.otherContent=i.otherContent.map(e=>this.traverseAnnotationList(e))),i}traverseChoice(i){return this.traverseType(this.traverseChoiceItems(i),this.traversals.choice)}traverseChoiceItems(i){return i.default&&i.default!=="rdf:nil"&&(i.default=this.traverseContentResource(i.default)),i.item&&i.item!=="rdf:nil"&&(i.item=i.item.map(e=>this.traverseContentResource(e))),i}traverseService(i){return this.traverseType(this.traverseLinking(i),this.traversals.service)}traverseContentResource(i){return i["@type"]==="oa:Choice"?this.traverseChoice(i):this.traverseType(this.traverseDescriptive(this.traverseLinking(i)),this.traversals.contentResource)}traverseUnknown(i){if(!i["@type"]||typeof i=="string")return i;switch(Ov(i)){case"sc:Collection":return this.traverseCollection(i);case"sc:Manifest":return this.traverseManifest(i);case"sc:Canvas":return this.traverseCanvas(i);case"sc:Sequence":return this.traverseSequence(i);case"sc:Range":return this.traverseRange(i);case"oa:Annotation":return this.traverseAnnotation(i);case"sc:AnnotationList":return this.traverseAnnotationList(i);case"sc:Layer":return this.traverseLayer(i);case"Service":return this.traverseService(i);case"oa:Choice":return this.traverseChoice(i);case"ContentResource":return this.traverseContentResource(i)}return i.profile?this.traverseService(i):i}traverseImageResource(i){let e=Array.isArray(i),n=Array.isArray(i)?i:[i],r=[];for(let s of n)typeof s=="string"?r.push(this.traverseContentResource({"@id":s,"@type":"dctypes:Image"})):r.push(this.traverseContentResource(s));return!e&&!this.options.convertPropsToArray?r[0]:r}traverseDescriptive(i){return i.thumbnail&&(i.thumbnail=this.traverseImageResource(i.thumbnail)),i.logo&&(i.logo=this.traverseImageResource(i.logo)),i}traverseOneOrMoreServices(i){let e=Array.isArray(i),n=Array.isArray(i)?i:[i],r=[];for(let s of n)r.push(this.traverseService(s));return!e&&!this.options.convertPropsToArray?r[0]:r}traverseLinking(i){return i.related&&(i.related=this.traverseOneOrManyType(i.related,this.traversals.contentResource)),i.rendering&&(i.rendering=this.traverseOneOrManyType(i.rendering,this.traversals.contentResource)),i.service&&(i.service=this.traverseOneOrMoreServices(i.service)),i.seeAlso&&(i.seeAlso=this.traverseOneOrManyType(i.seeAlso,this.traversals.contentResource)),i.within&&(typeof i.within=="string"||(i.within=this.traverseOneOrManyType(i.within,this.traversals.contentResource))),i.startCanvas&&(typeof i.startCanvas=="string"?i.startCanvas=this.traverseType({"@id":i.startCanvas,"@type":"sc:Canvas"},this.traversals.canvas):i.startCanvas&&this.traverseType(i.startCanvas,this.traversals.canvas)),i.contentLayer&&(typeof i.contentLayer=="string"?i.contentLayer=this.traverseLayer({"@id":i.contentLayer,"@type":"sc:Layer"}):i.contentLayer=this.traverseLayer(i.contentLayer)),i}traverseOneOrManyType(i,e){if(!Array.isArray(i))if(this.options.convertPropsToArray)i=[i];else return this.traverseType(i,e);return i.map(n=>this.traverseType(n,e))}traverseType(i,e){return e.reduce((n,r)=>{let s=r(n);return s===void 0&&!this.options.allowUndefinedReturn?n:s},i)}};const Fv=["http://iiif.io/api/image/2/level1","http://iiif.io/api/image/2/level2","http://library.stanford.edu/iiif/image-api/compliance.html#level1","http://library.stanford.edu/iiif/image-api/compliance.html#level2","http://library.stanford.edu/iiif/image-api/conformance.html#level1","http://library.stanford.edu/iiif/image-api/conformance.html#level2","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2","http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1","http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2","http://iiif.io/api/image/1/level1.json","http://iiif.io/api/image/1/profiles/level1.json","http://iiif.io/api/image/1/level2.json","http://iiif.io/api/image/1/profiles/level2.json","http://iiif.io/api/image/2/level1.json","http://iiif.io/api/image/2/profiles/level1.json","http://iiif.io/api/image/2/level2.json","http://iiif.io/api/image/2/profiles/level2.json","level1","level2"],Gn={attributionLabel:"Attribution",providerId:"http://example.org/provider",providerName:""};function Lv(t){if(typeof t=="string")return[t];if(!t)return[];let i=Array.isArray(t)?t:[t],e=[];for(let n of i){if(typeof n=="string"){e.push(n);continue}e.push({"@language":n["@language"]||n.language,"@value":n["@value"]||n.value})}return e}function zt(t,i="none"){if(!t)return{none:[""]};let e=Lv(t),n={};for(let r of e){if(typeof r=="string"){n[i]=n[i]?n[i]:[],n[i].push(r||"");continue}if(!r["@language"]){n[i]=n[i]?n[i]:[],n[i].push(r["@value"]||"");continue}let s=r["@language"];n[s]=n[s]?n[s]:[],n[s].push(r["@value"]||"")}return Object.keys(n).length===0?{none:[""]}:n}function Yo(t){if(Array.isArray(t))return Yo(t.find(i=>typeof i=="string"));if(Dv.indexOf(t)!==-1)return"level2";if(Fv.indexOf(t)!==-1)return"level1";if(Av.indexOf(t)!==-1)return"level0";if(typeof t=="string")return t}function kv(t){let i=Array.isArray(t)?t:[t];for(let e of i)switch(e){case"http://iiif.io/api/image/2/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2":return"ImageService2";case"http://iiif.io/api/image/1/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/context.json":return"ImageService1";case"http://iiif.io/api/annex/openannotation/context.json":return"ImageApiSelector"}}function Hv(t){switch(t){case"http://iiif.io/api/image/2/level0.json":case"http://iiif.io/api/image/2/level1.json":case"http://iiif.io/api/image/2/level2.json":return"ImageService2";case"http://iiif.io/api/auth/1/kiosk":case"http://iiif.io/api/auth/1/login":case"http://iiif.io/api/auth/1/clickthrough":case"http://iiif.io/api/auth/1/external":case"http://iiif.io/api/auth/0/kiosk":case"http://iiif.io/api/auth/0/login":case"http://iiif.io/api/auth/0/clickthrough":case"http://iiif.io/api/auth/0/external":return"AuthCookieService1";case"http://iiif.io/api/auth/1/token":case"http://iiif.io/api/auth/0/token":return"AuthTokenService1";case"http://iiif.io/api/auth/1/logout":case"http://iiif.io/api/auth/0/logout":return"AuthLogoutService1";case"http://iiif.io/api/search/1/search":case"http://iiif.io/api/search/0/search":return"SearchService1";case"http://iiif.io/api/search/1/autocomplete":case"http://iiif.io/api/search/0/autocomplete":return"AutoCompleteService1"}}function dr(t){for(let i of["sc","oa","dcterms","dctypes","iiif"])if(t.startsWith(`${i}:`))return t.slice(i.length+1);return t}const Bv=["Collection","Manifest","Annotation","AnnotationPage","Range","Service"];function ws(t){let i=t["@id"]||t.id,e=t["@type"]||t.type,n=t.profile||void 0,r=t["@context"]||void 0;if(n){let s=Hv(n);if(s)return s}if(r){let s=kv(r);if(s)return s}if(e){if(Array.isArray(e)){if(e.indexOf("oa:CssStylesheet")!==-1)return"CssStylesheet";if(e.indexOf("cnt:ContentAsText")!==-1)return"TextualBody";e=e[0]}for(let s of["sc","oa","dcterms","dctypes","iiif"])if(e.startsWith(`${s}:`)){e=e.slice(s.length+1);break}switch(e){case"Layer":return"AnnotationCollection";case"AnnotationList":return"AnnotationPage";case"cnt:ContentAsText":return"TextualBody"}}if(e&&Bv.indexOf(e)!==-1)return e;if(t.format){if(t.format.startsWith("image/"))return"Image";if(t.format.startsWith("text/")||t.format==="application/pdf")return"Text";if(t.format.startsWith("application/"))return"Dataset"}return i&&(i.endsWith(".jpg")||i.endsWith(".png")||i.endsWith(".jpeg"))?"Image":e||"unknown"}const zv=/^|["'\\>]http(s)?:\/\/(creativecommons.org|rightsstatements.org)\/[^"'\\<\n]+/gm;function Nv(t){let i=t.match(zv);return i?i[0]:t}function Uv(t,i="Rights/License",e="none"){let n=null,r=[],s=Array.isArray(t)?t:[t];for(let o of s){let l=o?Nv(o):void 0;if(l&&(l.indexOf("creativecommons.org")!==-1||l.indexOf("rightsstatements.org")!==-1)){n=l.startsWith("https://")?`http://${l.slice(8)}`:l;continue}l&&r.push({label:{[e]:[i]},value:{[e]:[l]}})}return[n,r]}const Vv=["http://iiif.io/api/presentation/2/context.json","http://iiif.io/api/image/2/context.json","http://iiif.io/api/image/1/context.json","http://library.stanford.edu/iiif/image-api/1.1/context.json","http://iiif.io/api/search/1/context.json","http://iiif.io/api/search/0/context.json","http://iiif.io/api/auth/1/context.json","http://iiif.io/api/auth/0/context.json","http://iiif.io/api/annex/openannotation/context.json"];function Wv(t){if(t){let i=Array.isArray(t)?t:[t],e=[];for(let n of i)n==="http://iiif.io/api/presentation/2/context.json"&&e.push("http://iiif.io/api/presentation/3/context.json"),Vv.indexOf(n)===-1&&e.push(n);if(i.length)return e.length===1?e[0]:e}}function jv(t){return t?t.map(i=>({label:zt(i.label),value:zt(i.value)})):[]}let fr=0;function Jo(t,i){let e=encodeURI(t.id||t["@id"]||"").trim();return e&&i?`${e}/${i}`:e||(fr++,`http://example.org/${t["@type"]}${i?`/${i}`:""}/${fr}`)}function Ct(t){let i=[...t.behavior||[]];t.viewingHint&&i.push(t.viewingHint);let e;return Array.isArray(t.motivation)?e=t.motivation.map(dr):t.motivation&&(e=dr(t.motivation)),{"@context":t["@context"]?Wv(t["@context"]):void 0,id:(t["@id"]||Jo(t)).trim(),type:ws(t),behavior:i.length?i:void 0,height:t.height?t.height:void 0,width:t.width?t.width:void 0,motivation:e,viewingDirection:t.viewingDirection,profile:t.profile,format:t.format?t.format:void 0,duration:void 0,timeMode:void 0}}function Pt(t){let[i,e]=Uv(t.license),n=[...t.metadata?jv(t.metadata):[],...e];return{rights:i,metadata:n.length?n:void 0,label:t.label?zt(t.label):void 0,requiredStatement:t.attribution?{label:zt(Gn.attributionLabel),value:zt(t.attribution)}:void 0,navDate:t.navDate,summary:t.description?zt(t.description):void 0,thumbnail:Gv(t.thumbnail)}}function Gv(t){return t&&(Array.isArray(t)?t:[t]).map(e=>typeof e=="string"?{id:e,type:"Image"}:(e.type==="unknown"&&(e.type="Image"),e))}function qv(t){if(!t.within)return;let i=Array.isArray(t.within)?t.within:[t.within],e=[];for(let n of i)if(typeof n=="string"){if(n)switch(t["@type"]){case"sc:Manifest":e.push({id:n,type:"Collection"});break}}else n["@id"]&&e.push({id:n["@id"],type:ws(n)});return e.length?e:void 0}function Ot(t){let i=t.related?Array.isArray(t.related)?t.related:[t.related]:[],e=t.contentLayer;return{provider:t.logo||i.length?[{id:Gn.providerId,type:"Agent",homepage:i.length?[i[0]]:void 0,logo:t.logo?Array.isArray(t.logo)?t.logo:[t.logo]:void 0,label:zt(Gn.providerName)}]:void 0,partOf:qv(t),rendering:t.rendering,seeAlso:t.seeAlso,start:t.startCanvas,service:t.service?lv(t.service):void 0,supplementary:e?[e]:void 0}}function Zv(t){return{chars:t.chars,format:t.format?t.format:void 0,language:t.language}}function Ln(t,i){return t?typeof t=="string"?{id:t,type:i}:typeof(t==null?void 0:t["@id"])=="string"?{id:t["@id"],type:i}:typeof t.id=="string"?{id:t.id,type:i}:null:null}function Kv(t){let i={};if(t.first){let e=Ln(t.first,"Collection");e&&(i.first=e)}if((t.total||t.total===0)&&(i.total=t.total),t.prev){let e=Ln(t.prev,"Collection");e&&(i.prev=e)}if(t.next){let e=Ln(t.next,"Collection");e&&(i.next=e)}return i}function Xv(t){let i=[];for(let e of t){let n={...e};n.items&&n.items.length===0&&delete n.items,i.push(n)}return i}function Yv(t){return gt({...Ct(t),...Pt(t),...Ot(t),...Kv(t),items:Xv(t.members)})}function Jv(t){let i=[],e=[],n,r;for(let o of t.sequences||[])o.canvases.length&&i.push(...o.canvases),o.behavior&&e.push(...o.behavior),o.viewingDirection&&(r=o.viewingDirection),o.startCanvas&&(n=o.startCanvas);let s=Ct(t);return e.length&&(s.behavior?s.behavior.push(...e):s.behavior=e),gt({...s,...Pt(t),...Ot(t),viewingDirection:r,start:n,items:i,structures:Qv(t.structures)})}function Qv(t){if(!t)return t;let i=new Map;for(let n of t)i.set(n.id,n);let e=[];for(let n of t)if(n.items){let r=n.items.map(s=>typeof s=="string"?(e.push(s),i.get(s)||s):s&&s.id?(e.push(s.id),i.get(s.id)||s):s);n.items=r}return t.filter(n=>e.indexOf(n.id)===-1)}function $v(t){return gt({...Ct(t),...Pt(t),...Ot(t),annotations:t.otherContent&&t.otherContent.length?t.otherContent:void 0,items:t.images&&t.images.length?[{id:Jo(t,"annotation-page"),type:"AnnotationPage",items:t.images}]:void 0})}function ey(t){return gt({...Ct(t),...Pt(t),...Ot(t),items:t.resources&&t.resources.length?t.resources:void 0})}function ty(t){return!t.canvases||t.canvases.length===0?{canvases:[],behavior:[]}:{canvases:t.canvases,behavior:t.viewingHint?[t.viewingHint]:[],viewingDirection:t.viewingDirection,startCanvas:t.startCanvas}}function iy(t){function i(e){if(Array.isArray(e)){if(e.length>1)return{type:"List",items:e.map(i)};e=e[0]}if(typeof e=="string")return encodeURI(e).trim();if("@type"in e){let n;if(typeof e.full=="string")n=e.full;else if(e.full["@type"]==="dctypes:Image")n={id:e.full["@id"],type:"Image"};else if(e.full["@type"]==="sc:Canvas")n={id:e.full["@id"],type:"Canvas"};else throw Error(`Unsupported source type on annotation: ${e.full["@type"]}`);return{type:"SpecificResource",source:n,selector:qn(e.selector)}}else return encodeURI(e["@id"]).trim()}return gt({...Ct(t),...Pt(t),...Ot(t),target:i(t.on),body:Array.isArray(t.resource)?t.resource.map(pr):pr(t.resource)})}function pr(t){return t.type==="Choice"?t:Qo(t)}function Qo(t){let i=t;return gt({...Ct(i),...Pt(i),...Ot(i),...Zv(i)})}function ny(t){let i=[];return t.default&&t.default!=="rdf:nil"&&i.push(t.default),t.item&&t.item!=="rdf:nil"&&i.push(...t.item),gt({...Ct(t),...Pt(t),items:i})}function sy(t){return gt({...Ct(t),...Pt(t),...Ot(t),items:t.members})}function ry(t){let{"@id":i,"@type":e,"@context":n,profile:r,...s}=t,o={};return i&&(o["@id"]=i),o["@type"]=ws(t),o["@type"]==="unknown"&&(n&&n.length&&(o["@context"]=n),o["@type"]="Service"),r&&(o.profile=Yo(r)),gt({...o,...s})}function oy(t){return gt({...Ct(t),...Pt(t),...Ot(t)})}const ay=new Mv({collection:[Yv],manifest:[Jv],canvas:[$v],annotationList:[ey],sequence:[ty],annotation:[iy],contentResource:[Qo],choice:[ny],range:[sy],service:[ry],layer:[oy]});function ly(t){return t&&t["@context"]&&(t["@context"]==="http://iiif.io/api/presentation/2/context.json"||Array.isArray(t["@context"])&&t["@context"].indexOf("http://iiif.io/api/presentation/2/context.json")!==-1||t["@context"]==="http://www.shared-canvas.org/ns/context.json")||t["@context"]==="http://iiif.io/api/image/2/context.json"||t["@id"]&&t["@type"]==="sc:Collection"||t["@id"]&&t["@type"]==="sc:Manifest"?(t["@context"]||(t["@context"]="http://iiif.io/api/presentation/2/context.json"),ay.traverseUnknown(t)):t}function qn(t){if((Array.isArray(t["@type"])&&t["@type"].includes("oa:SvgSelector")||t["@type"]=="oa:SvgSelector")&&("chars"in t||"value"in t))return{type:"SvgSelector",value:"chars"in t?t.chars:t.value};if(t["@type"]==="oa:FragmentSelector")return{type:"FragmentSelector",value:t.value};if(t["@type"]==="oa:Choice")return[qn(t.default),...(Array.isArray(t.item)?t.item:[t.item]).map(qn)];if(t["@type"]=="iiif:ImageApiSelector")return{type:"ImageApiSelector",region:"region"in t?t.region:void 0,rotation:"rotation"in t?t.rotation:void 0};throw Error(`Unsupported selector type: ${t["@type"]}`)}const uy=ly;function Zn(t){var o,l,a,u,c;const{license:i,related:e,requiredStatement:n,viewingDirection:r}=t,s=uy(t);return t["@context"]==="http://iiif.io/api/presentation/2/context.json"&&([].concat(e||[]).forEach(h=>{s.homepage=s.homepage||[],s.homepage.push(typeof h=="string"?h:{id:h["@id"],label:h.label,format:h.format})}),(o=s.provider)==null||o.forEach((h,f)=>{h.homepage&&(s.provider[f].homepage=h.homepage.filter(m=>m.id!=="http://example.org/undefined/1"&&!s.homepage.find(v=>v.id===m.id)))}),((c=(u=(a=(l=s.provider)==null?void 0:l[0])==null?void 0:a.label)==null?void 0:u.none)==null?void 0:c[0])==="Unknown"&&(delete s.provider[0].label,n&&!s.requiredStatement&&(s.requiredStatement=n)),i&&!s.rights&&(s.rights=i),s.viewingDirection=r),s}function cy(t={}){const i=ln({annotations:[],annotationsAvailable:null,collection:null,errors:new Set,loading:0,manifest:t.manifest?Zn(t.manifest):null,options:t.options||{},readyPromises:[],rootElement:t.rootElement||null,urlUpdateTimeout:null,annotationsActive:Le(()=>i.options.view==="text"||!i.options.view&&!i.isContainerWidthAtLeast("medium")),currentStructure:Le(()=>{if(!(i.manifest.structures instanceof Array))return!1;const e=[];i.options.pages.filter(o=>o>0).forEach(o=>{e.push(i.manifest.items[o-1].id)});const{length:n}=i.manifest.structures;let r,s;for(let o=n-1;o>=0;o-=1){const l=i.manifest.structures[o],{items:a}=l;if(a!=null&&a.some(u=>e.includes(u.id))){const u=l.items.length;if((u<s||!s)&&(r=o,s=u,s===0))break}}return typeof r=="number"&&r>=0?i.manifest.structures[r]:!1}),isCustomPageView:Le(()=>{const{pages:e}=i.options;return e.length===1?!1:e.length>2?!0:e[0]<1||e[1]<1?!1:e[1]-e[0]!==1}),isFirstPage:Le(()=>i.options.pages[0]===1||i.options.pages[1]===1),isLastPage:Le(()=>i.options.pages.at(-1)===i.pageCount),isLastSection:Le(()=>{var s;const{pages:e}=i.options,n=e.length-1;return(e[n]?e[n]:e[n-1])>=((s=i.sections[i.sections.length-1])==null?void 0:s.firstPage)}),isReversed:Le(()=>["right-to-left","bottom-to-top"].includes(i.manifest.viewingDirection)),isVertical:Le(()=>["top-to-bottom","bottom-to-top"].includes(i.manifest.viewingDirection)),pageCount:Le(()=>{var e,n;return(n=(e=i.manifest)==null?void 0:e.items)==null?void 0:n.length}),sections:Le(()=>{if(!i.manifest.structures)return[];const e=[];return i.manifest.structures.forEach(n=>{if(!n.items){e.push({firstPage:1,lastPage:i.pageCount});return}const r=n.items[0].id,s=i.manifest.items.findIndex(a=>a.id===r)+1,o=n.items[n.items.length-1].id,l=i.manifest.items.findIndex(a=>a.id===o)+1;e.push({firstPage:s,lastPage:l})}),e}),structures:Le(()=>{var a,u,c;if(!((a=i.manifest)!=null&&a.structures))return[];const e=(c=(u=i.manifest.structures[0])==null?void 0:u.behavior)!=null&&c.includes("top")?i.manifest.structures[0].items||[]:i.manifest.structures,n=[],r=i.manifest.items,s=e.length;for(let h=0;h<s;h+=1){const f={...e[h]};if(f.items){const m=f.items[0].id;f.firstPage=r.findIndex(y=>y.id===m)+1;const v=f.items.at(-1).id;f.lastPage=r.findIndex(y=>y.id===v)+1}f.level=0,n.push(f)}let o=0;for(let h=0;h<n.length;h+=1){const f=n[h];for(let m=h+1;m<n.length;m+=1){const v=n[m];v.firstPage>=f.firstPage&&v.lastPage<=f.lastPage&&(f.items=(f.items||[]).filter(y=>y.label),f.items.push(v),v.level+=1,o=Math.max(o,v.level))}}const l=(h,f=0)=>{for(let m=0;m<h.length;m+=1){const v=h[m];v.level>f?h.splice(m,1):v.items&&l(v.items,f+1)}};for(let h=0;h<o;h+=1)l(n);return n}),addError(e){i.errors.add(e),console.warn(e)},clearErrors(){i.errors.clear()},async fetchJson(e){i.loading+=1;const n=await fetch(e).catch(s=>(i.loading=0,Promise.reject(s)));if(!n.ok)return i.loading=0,Promise.reject(new Error(n.status));const r=await n.json().catch(s=>(i.loading=0,Promise.reject(s)));return i.loading>0&&(i.loading-=1),r},async fetchText(e){i.loading+=1;const n=await fetch(e).catch(s=>(i.loading=0,Promise.reject(s)));if(!n.ok)return i.loading=0,console.warn("Error loading annotation"),"";const r=await n.text().catch(s=>(i.loading=0,Promise.reject(s)));return i.loading>0&&(i.loading-=1),r},getFacingPage(e){var s,o,l,a,u;if((s=i.manifest.items[e-1].behavior)!=null&&s.includes("non-paged"))return-1;if(e===1)return 0;const n=i.manifest.items.slice(0,e-1).filter(c=>{var h;return(h=c.behavior)==null?void 0:h.includes("non-paged")});return(e+n.length%2)%2===1?(l=(o=i.manifest.items[e-1-1])==null?void 0:o.behavior)!=null&&l.includes("non-paged")?-1:e-1:(u=(a=i.manifest.items[e-1+1])==null?void 0:a.behavior)!=null&&u.includes("non-paged")?-1:e<i.pageCount?e+1:0},getStartPages(){var n;let e=1;if(i.manifest.items&&i.manifest.start){const r=i.manifest.items.findIndex(s=>s.id===i.manifest.start.id);e=r>=0?r+1:1}return i.isContainerWidthAtLeast("medium")&&((n=i.manifest.behavior)!=null&&n.includes("paged"))?[e,i.getFacingPage(e)].sort():[e]},getThumbnailUrl(e,n,r=0,s=0){var h,f,m,v,y,T,x;const o=i.manifest.items[e-1],l=(h=o.thumbnail)==null?void 0:h[0];if(l!=null&&l.id&&(l==null?void 0:l.width)>=n)return l.id;const a=(y=(v=(m=(f=o.items)==null?void 0:f[0])==null?void 0:m.items)==null?void 0:v[r])==null?void 0:y.body,u=a!=null&&a.items?a.items[s]:a,c=(l==null?void 0:l.service)||((T=u==null?void 0:u.source)==null?void 0:T.service)||(u==null?void 0:u.service);if(c){const E=[].concat(c)[0],M=["ImageService2","ImageService3"].includes(E.type||E["@type"])?"default":"native",L=E.id||E["@id"];let U=n;l!=null&&l.service&&((x=E.sizes)==null||x.forEach(Y=>{Y.width>=U&&Y.width<=U*2&&(U=Y.width)}));const K="jpg",q=L.at(-1)==="/"?"":"/";return`${L}${q}full/${U},/0/${M}.${K}`}return(u==null?void 0:u.type)==="Image"?(l==null?void 0:l.id)||(u==null?void 0:u.id):""},goToFirstPage(){i.isFirstPage||i.setPage(1)},goToNextPage(){if(i.isLastPage)return;const e=i.options.pages.at(-1);i.setPage(e+1)},goToNextSection(){if(i.isLastSection)return;const{pages:e}=i.options,n=e.length-1,r=e[n]?e[n]:e[n-1];let s=0;for(;r>=i.sections[s].firstPage||r&&r>=i.sections[s].firstPage;)s+=1;i.setPage(i.sections[s].firstPage)},goToLastPage(){i.isLastPage||i.setPage(i.pageCount)},goToPreviousPage(){if(i.isFirstPage)return;const e=i.options.pages.find(n=>n>0);e>1&&i.setPage(e-1)},goToPreviousSection(){if(i.isFirstPage)return;const{pages:e}=i.options,n=e[0]?e[0]:e[1];let r=i.sections.length-1;for(;n<=i.sections[r].firstPage||n&&n<=i.sections[r].firstPage;)r-=1;i.setPage(i.sections[r].firstPage)},isContainerWidthAtLeast(e){return i.rootElement&&window.getComputedStyle(i.rootElement,"::after").content.includes(e)},loadAnnotations(){var e;i.annotationsAvailable=null,(e=i.options.pages)==null||e.filter(n=>n>0).forEach(async n=>{if(i.annotations[n])return;const r=i.manifest.items[n-1];if(!("annotations"in r)){i.annotationsAvailable=!1;return}i.annotations[n]=[];let s=r.annotations[0].items;if(!s){const o=r.annotations[0].id;try{const l=await i.fetchJson(o);s=l.resources||l.items}catch(l){const a=l.response?l.response.statusText:l.message;console.warn(`Could not load annotations: ${a}`),i.annotationsAvailable=!1;return}}s instanceof Array&&s.forEach(async(o,l)=>{var m,v,y,T,x,E,M,L,U,K,q,Y;let a;const u=o.id||o["@id"]||((m=o.resource)==null?void 0:m.id)||((v=o.resource)==null?void 0:v["@id"]);if((y=o.resource)!=null&&y.chars)a=o.resource.chars;else if((x=(T=o.resource)==null?void 0:T[0])!=null&&x.chars)a=(M=(E=o.resource)==null?void 0:E[0])==null?void 0:M.chars;else if((L=o.resource)!=null&&L.label)a=`<i>${o.resource.label}</i>`;else{const te=[].concat(o.body);a=(await Promise.all(te.map(async $=>{var ie,ce,ye,me;if(($==null?void 0:$.type)==="Image")return`<img src="${$.id}" alt="">`;if($!=null&&$.value)return $.value;if((ie=$==null?void 0:$.body)!=null&&ie.value)return $.body.value;const j=((ce=$==null?void 0:$.items)==null?void 0:ce[0].id)||((ye=$==null?void 0:$.body)==null?void 0:ye.id)||((me=$==null?void 0:$.body)==null?void 0:me["@id"])||($==null?void 0:$.id)||u;return ps(j)?i.fetchText(j):""}))).join("<br>")}if(!a)return;(o.format||((U=o.body)==null?void 0:U.format))==="text/plain"&&(a=a.replace(/\n/g," <br>")),i.annotationsAvailable=!0;const c={id:u,html:vn(a)},h=((q=(K=o.on)==null?void 0:K.selector)==null?void 0:q.value)||(typeof o.on=="string"?o.on:null)||((Y=o.target)==null?void 0:Y.id)||o.target,f=Bo(h);f&&(c.coords=f),i.annotations[n][l]=c})})},initOptions(e){let n={};if(i.options.urlQueryKey)try{const r=new URLSearchParams(window.location.search);n=JSON.parse(r.get(i.options.urlQueryKey))||{}}catch{}n.view==="fulltext"?n.view="text":["scan",""].includes(n.view)&&(n.view=null),n.pages&&!ir(n.pages,i.pageCount)&&(i.addError("Invalid pages, reset to start page"),n.pages=null),i.options.urlQueryParams.forEach(r=>{i.options[r]=n[r]??i.options[r]}),i.options.pages=e&&e.type==="popstate"?n.pages||i.getStartPages():n.pages||i.options.pages||i.getStartPages(),i.options.pan=n.panX||n.panY?{x:n.panX,y:n.panY}:n.pan||i.options.pan,i.options.rotation=parseInt(n.rotation,10)||i.options.rotation,i.options.view=n.view||n.view===""?n.view:i.options.view,i.options.zoom=parseFloat(n.zoom)||i.options.zoom},loadManifest(e,n={}){const r=ys();return i.fetchJson(e).then(async s=>{const o=Zn(s);if(n.expectedType&&o.type!==n.expectedType){const a=`Expected manifest of type ${n.expectedType}, but got ${o.type}`;return i.addError(a),r.reject(a),r}if(i.manifest=null,await ns(),o.type==="Manifest")return i.manifest=o,i.initOptions(),window.addEventListener("popstate",i.initOptions),n.reset&&i.updateOptions({childManifestUrl:e,pages:i.getStartPages(),pan:{},rotation:null,view:i.isContainerWidthAtLeast("medium")?"collection":null,zoom:null}),r.resolve(),r;if(o.type==="Collection"){i.collection=o;const a=new URLSearchParams(window.location.search);let u={};try{u=JSON.parse(a.get(i.options.urlQueryKey))||{}}catch{}let c="";if(i.options.urlQueryParams.includes("childManifestUrl")&&u.childManifestUrl?c=u.childManifestUrl:i.collection.manifests&&i.options.childManifestAutoloaded&&(c=i.collection.manifests[0].id),c)await i.loadManifest(c,{expectedType:"Manifest"}),i.updateOptions({childManifestUrl:c});else{const h=u.view||i.options.view;i.updateOptions({view:["collection","help","info"].includes(h)?h:"collection"})}return r.resolve(),r}const l="Please provide a valid IIIF Presentation API manifest";return i.addError(l),r.reject(l),r},s=>{const l=`Error loading IIIF manifest: ${s.response&&(s.response.statusText||s.response.data)||s.message}`;return i.addError(l),r.reject(l),r})},localize(e){if(!i.options.language)throw new Error("language not set");if(!e)return"";if(typeof e=="string")return e;const s=e[i.options.language]||e[i.options.fallbackLanguage]||Object.values(e)[0]||"";return([].concat(s).join(" · ")||"").trim()},setPage(e){var r;let n=[].concat(e);if(!ir(n,i.pageCount))throw new RangeError("Invalid pages");return n.length===1&&((r=i.options.pages)==null?void 0:r.length)===2&&!this.isCustomPageView&&(n=[n[0],i.getFacingPage(n[0])].sort()),i.updateOptions({pages:n}),n},toggleAnnotationId(e){const n={annotationId:i.options.annotationId===e?null:e,annotationsVisible:i.options.annotationId?null:i.annotationsVisible};n.annotationId&&!i.isContainerWidthAtLeast("medium")&&(n.view=i.options.view?null:"text"),i.updateOptions(n)},updateOptions(e){clearTimeout(i.urlUpdateTimeout),Object.assign(i.options,e),e.pages&&i.clearErrors(),i.options.urlQueryKey&&(i.urlUpdateTimeout=setTimeout(()=>{const n={};i.options.urlQueryParams.forEach(s=>{const o=i.options[s];o===null||s==="layers"&&!o.some(Boolean)||s==="pages"&&o.toString()===i.getStartPages().toString()||typeof o=="object"&&!Object.keys(o).length?delete n[s]:n[s]=i.options[s]});const r=new URL(window.location);Object.keys(n).length?r.searchParams.set(i.options.urlQueryKey,JSON.stringify(n)):r.searchParams.delete(i.options.urlQueryKey),window.history&&(e.pages||e.view?window.history.pushState({},"",r):window.history.replaceState({},"",r))},100))}});return i}const hy={convertManifest:Zn,install:(t,i={})=>{t.config.globalProperties.$store=new cy(i)}};window.Tify=function(i={}){if(this.options={...JSON.parse(JSON.stringify(Qm)),...i},!this.options.translationsDirUrl)try{const{url:s}=import.meta;this.options.translationsDirUrl=`${s.slice(0,s.lastIndexOf("/"))}/translations`}catch{}let e=null;this.ready=new Promise((s,o)=>{e={resolve:s,reject:o}});const n=this;this.app=Eu({render:()=>Xl(Jm,{readyPromise:e})}).use(ev,{instance:n}).use(sv).use(rv).use(hy,{options:this.options});let r=!1;this.mount=s=>{if(r)throw new Error("TIFY is already mounted");const o=typeof s=="string"?document.querySelector(s):s;if(!o)throw new Error("Container element not found");this.app.mount(o),r=!0},this.destroy=()=>{this.app.unmount()},this.options.container&&this.mount(this.options.container)};const gy=window.Tify;export{se as F,Ie as _,R as a,le as b,D as c,ee as d,gy as default,Ke as e,Q as f,Co as g,Vt as h,$e as i,vs as j,dy as k,Qr as l,de as m,Pe as n,S as o,ln as p,It as q,Ee as r,Eu as s,z as t,Xl as u,Qe as v,Be as w};