triiiceratops 0.3.4 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,95 +0,0 @@
1
- var Lp=Object.defineProperty;var Bo=Be=>{throw TypeError(Be)};var Mp=(Be,ze,Je)=>ze in Be?Lp(Be,ze,{enumerable:!0,configurable:!0,writable:!0,value:Je}):Be[ze]=Je;var Qe=(Be,ze,Je)=>Mp(Be,typeof ze!="symbol"?ze+"":ze,Je),ba=(Be,ze,Je)=>ze.has(Be)||Bo("Cannot "+Je);var L=(Be,ze,Je)=>(ba(Be,ze,"read from private field"),Je?Je.call(Be):ze.get(Be)),ge=(Be,ze,Je)=>ze.has(Be)?Bo("Cannot add the same private member more than once"):ze instanceof WeakSet?ze.add(Be):ze.set(Be,Je),_e=(Be,ze,Je,sr)=>(ba(Be,ze,"write to private field"),sr?sr.call(Be,Je):ze.set(Be,Je),Je),Ne=(Be,ze,Je)=>(ba(Be,ze,"access private method"),Je);(function(){"use strict";var Mo,tr,ir,Fi,Ni,Sr,rr,nr,$e,Sa,Gi,Pa,zo,ko,Nt,Rt,Pr,Qt,Bi,Jt,Bt,_t,$t,li,mi,zi,_i,ki,yi,_n,Ye,Vo,Uo,Ca,wn,Tn,Ra,Zt,ei,At,Vi,Cr,Rr,yn,ui,zt,Ar,Ir,Dr,Or,Lr,Mr,Hr,Fr,Nr,Br,zr,kr,Vr,Ur,Gr,jr;typeof window<"u"&&((Mo=window.__svelte??(window.__svelte={})).v??(Mo.v=new Set)).add("5");const ze=1,Je=2,sr=4,Go=8,jo=16,Aa=1,Zo=2,Ia="[",Zr="[!",En="]",Ti={},it=Symbol(),Wo="http://www.w3.org/1999/xhtml",qo="@attach",xn=!1;var bn=Array.isArray,Xo=Array.prototype.indexOf,Wr=Array.from,qr=Object.keys,Xr=Object.defineProperty,ji=Object.getOwnPropertyDescriptor,Da=Object.getOwnPropertyDescriptors,Yo=Object.prototype,Ko=Array.prototype,Sn=Object.getPrototypeOf,Oa=Object.isExtensible;function Qo(a){return a()}function Pn(a){for(var r=0;r<a.length;r++)a[r]()}function La(){var a,r,e=new Promise((t,i)=>{a=t,r=i});return{promise:e,resolve:a,reject:r}}const rt=2,Cn=4,Yr=8,Ma=1<<24,ti=16,ii=32,hi=64,Kr=128,Vt=512,at=1024,ft=2048,ri=4096,wt=8192,ni=16384,Qr=32768,Ei=65536,Ha=1<<17,Fa=1<<18,xi=1<<19,Na=1<<20,ai=1<<25,bi=32768,Rn=1<<21,An=1<<22,ci=1<<23,fi=Symbol("$state"),Jo=Symbol("legacy props"),$o=Symbol(""),Zi=new class extends Error{constructor(){super(...arguments);Qe(this,"name","StaleReactionError");Qe(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},Jr=3,Si=8;function Ba(a){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function el(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function tl(a){throw new Error("https://svelte.dev/e/effect_in_teardown")}function il(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function rl(a){throw new Error("https://svelte.dev/e/effect_orphan")}function nl(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function al(){throw new Error("https://svelte.dev/e/hydration_failed")}function sl(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function ol(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function ll(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function ul(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function or(a){console.warn("https://svelte.dev/e/hydration_mismatch")}function hl(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function cl(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let Te=!1;function Ut(a){Te=a}let Ee;function st(a){if(a===null)throw or(),Ti;return Ee=a}function Pi(){return st(jt(Ee))}function Y(a){if(Te){if(jt(Ee)!==null)throw or(),Ti;Ee=a}}function dt(a=1){if(Te){for(var r=a,e=Ee;r--;)e=jt(e);Ee=e}}function $r(a=!0){for(var r=0,e=Ee;;){if(e.nodeType===Si){var t=e.data;if(t===En){if(r===0)return e;r-=1}else(t===Ia||t===Zr)&&(r+=1)}var i=jt(e);a&&e.remove(),e=i}}function za(a){if(!a||a.nodeType!==Si)throw or(),Ti;return a.data}function ka(a){return a===this.v}function fl(a,r){return a!=a?r==r:a!==r||a!==null&&typeof a=="object"||typeof a=="function"}function Va(a){return!fl(a,this.v)}let lr=!1,dl=!1;function pl(){lr=!0}let He=null;function Wi(a){He=a}function qi(a){return In().get(a)}function gl(a,r){return In().set(a,r),r}function vl(a){return In().has(a)}function Ve(a,r=!1,e){He={p:He,i:!1,c:null,e:null,s:a,x:null,l:lr&&!r?{s:null,u:null,$:[]}:null}}function Ue(a){var r=He,e=r.e;if(e!==null){r.e=null;for(var t of e)cs(t)}return a!==void 0&&(r.x=a),r.i=!0,He=r.p,a??{}}function Xi(){return!lr||He!==null&&He.l===null}function In(a){return He===null&&Ba(),He.c??(He.c=new Map(ml(He)||void 0))}function ml(a){let r=a.p;for(;r!==null;){const e=r.c;if(e!==null)return e;r=r.p}return null}let Ci=[];function Ua(){var a=Ci;Ci=[],Pn(a)}function di(a){if(Ci.length===0&&!ur){var r=Ci;queueMicrotask(()=>{r===Ci&&Ua()})}Ci.push(a)}function _l(){for(;Ci.length>0;)Ua()}function Ga(a){var r=Ie;if(r===null)return Ce.f|=ci,a;if((r.f&Qr)===0){if((r.f&Kr)===0)throw a;r.b.error(a)}else Yi(a,r)}function Yi(a,r){for(;r!==null;){if((r.f&Kr)!==0)try{r.b.error(a);return}catch(e){a=e}r=r.parent}throw a}const en=new Set;let Se=null,tn=null,Xe=null,Ot=[],rn=null,Dn=!1,ur=!1;const mn=class mn{constructor(){ge(this,$e);Qe(this,"committed",!1);Qe(this,"current",new Map);Qe(this,"previous",new Map);ge(this,tr,new Set);ge(this,ir,new Set);ge(this,Fi,0);ge(this,Ni,0);ge(this,Sr,null);ge(this,rr,[]);ge(this,nr,[]);Qe(this,"skipped_effects",new Set);Qe(this,"is_fork",!1)}is_deferred(){return this.is_fork||L(this,Ni)>0}process(r){var t;Ot=[],tn=null,this.apply();var e={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const i of r)Ne(this,$e,Sa).call(this,i,e);this.is_fork||Ne(this,$e,zo).call(this),this.is_deferred()?(Ne(this,$e,Gi).call(this,e.effects),Ne(this,$e,Gi).call(this,e.render_effects),Ne(this,$e,Gi).call(this,e.block_effects)):(tn=this,Se=null,Za(e.render_effects),Za(e.effects),tn=null,(t=L(this,Sr))==null||t.resolve()),Xe=null}capture(r,e){this.previous.has(r)||this.previous.set(r,e),(r.f&ci)===0&&(this.current.set(r,r.v),Xe==null||Xe.set(r,r.v))}activate(){Se=this,this.apply()}deactivate(){Se===this&&(Se=null,Xe=null)}flush(){if(this.activate(),Ot.length>0){if(ja(),Se!==null&&Se!==this)return}else L(this,Fi)===0&&this.process([]);this.deactivate()}discard(){for(const r of L(this,ir))r(this);L(this,ir).clear()}increment(r){_e(this,Fi,L(this,Fi)+1),r&&_e(this,Ni,L(this,Ni)+1)}decrement(r){_e(this,Fi,L(this,Fi)-1),r&&_e(this,Ni,L(this,Ni)-1),this.revive()}revive(){for(const r of L(this,rr))lt(r,ft),Ri(r);for(const r of L(this,nr))lt(r,ri),Ri(r);_e(this,rr,[]),_e(this,nr,[]),this.flush()}oncommit(r){L(this,tr).add(r)}ondiscard(r){L(this,ir).add(r)}settled(){return(L(this,Sr)??_e(this,Sr,La())).promise}static ensure(){if(Se===null){const r=Se=new mn;en.add(Se),ur||mn.enqueue(()=>{Se===r&&r.flush()})}return Se}static enqueue(r){di(r)}apply(){}};tr=new WeakMap,ir=new WeakMap,Fi=new WeakMap,Ni=new WeakMap,Sr=new WeakMap,rr=new WeakMap,nr=new WeakMap,$e=new WeakSet,Sa=function(r,e){var l;r.f^=at;for(var t=r.first;t!==null;){var i=t.f,n=(i&(ii|hi))!==0,s=n&&(i&at)!==0,h=s||(i&wt)!==0||this.skipped_effects.has(t);if((t.f&Kr)!==0&&((l=t.b)!=null&&l.is_pending())&&(e={parent:e,effect:t,effects:[],render_effects:[],block_effects:[]}),!h&&t.fn!==null){n?t.f^=at:(i&Cn)!==0?e.effects.push(t):gr(t)&&((t.f&ti)!==0&&e.block_effects.push(t),vr(t));var u=t.first;if(u!==null){t=u;continue}}var o=t.parent;for(t=t.next;t===null&&o!==null;)o===e.effect&&(Ne(this,$e,Gi).call(this,e.effects),Ne(this,$e,Gi).call(this,e.render_effects),Ne(this,$e,Gi).call(this,e.block_effects),e=e.parent),t=o.next,o=o.parent}},Gi=function(r){for(const e of r)((e.f&ft)!==0?L(this,rr):L(this,nr)).push(e),Ne(this,$e,Pa).call(this,e.deps),lt(e,at)},Pa=function(r){if(r!==null)for(const e of r)(e.f&rt)===0||(e.f&bi)===0||(e.f^=bi,Ne(this,$e,Pa).call(this,e.deps))},zo=function(){if(L(this,Ni)===0){for(const r of L(this,tr))r();L(this,tr).clear()}L(this,Fi)===0&&Ne(this,$e,ko).call(this)},ko=function(){var n;if(en.size>1){this.previous.clear();var r=Xe,e=!0,t={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const s of en){if(s===this){e=!1;continue}const h=[];for(const[o,l]of this.current){if(s.current.has(o))if(e&&l!==s.current.get(o))s.current.set(o,l);else continue;h.push(o)}if(h.length===0)continue;const u=[...s.current.keys()].filter(o=>!this.current.has(o));if(u.length>0){var i=Ot;Ot=[];const o=new Set,l=new Map;for(const f of h)Wa(f,u,o,l);if(Ot.length>0){Se=s,s.apply();for(const f of Ot)Ne(n=s,$e,Sa).call(n,f,t);s.deactivate()}Ot=i}}Se=null,Xe=r}this.committed=!0,en.delete(this)};let qt=mn;function On(a){var r=ur;ur=!0;try{for(var e;;){if(_l(),Ot.length===0&&(Se==null||Se.flush(),Ot.length===0))return rn=null,e;ja()}}finally{ur=r}}function ja(){var a=Di;Dn=!0;var r=null;try{var e=0;for(on(!0);Ot.length>0;){var t=qt.ensure();if(e++>1e3){var i,n;yl()}t.process(Ot),pi.clear()}}finally{Dn=!1,on(a),rn=null}}function yl(){try{nl()}catch(a){Yi(a,rn)}}let Gt=null;function Za(a){var r=a.length;if(r!==0){for(var e=0;e<r;){var t=a[e++];if((t.f&(ni|wt))===0&&gr(t)&&(Gt=new Set,vr(t),t.deps===null&&t.first===null&&t.nodes===null&&(t.teardown===null&&t.ac===null?vs(t):t.fn=null),(Gt==null?void 0:Gt.size)>0)){pi.clear();for(const i of Gt){if((i.f&(ni|wt))!==0)continue;const n=[i];let s=i.parent;for(;s!==null;)Gt.has(s)&&(Gt.delete(s),n.push(s)),s=s.parent;for(let h=n.length-1;h>=0;h--){const u=n[h];(u.f&(ni|wt))===0&&vr(u)}}Gt.clear()}}Gt=null}}function Wa(a,r,e,t){if(!e.has(a)&&(e.add(a),a.reactions!==null))for(const i of a.reactions){const n=i.f;(n&rt)!==0?Wa(i,r,e,t):(n&(An|ti))!==0&&(n&ft)===0&&qa(i,r,t)&&(lt(i,ft),Ri(i))}}function qa(a,r,e){const t=e.get(a);if(t!==void 0)return t;if(a.deps!==null)for(const i of a.deps){if(r.includes(i))return!0;if((i.f&rt)!==0&&qa(i,r,e))return e.set(i,!0),!0}return e.set(a,!1),!1}function Ri(a){for(var r=rn=a;r.parent!==null;){r=r.parent;var e=r.f;if(Dn&&r===Ie&&(e&ti)!==0&&(e&Fa)===0)return;if((e&(hi|ii))!==0){if((e&at)===0)return;r.f^=at}}Ot.push(r)}function wl(a){let r=0,e=Ai(0),t;return()=>{fr()&&(T(e),sn(()=>(r===0&&(t=mr(()=>a(()=>cr(e)))),r+=1,()=>{di(()=>{r-=1,r===0&&(t==null||t(),t=void 0,cr(e))})})))}}var Tl=Ei|xi|Kr;function El(a,r,e){new xl(a,r,e)}class xl{constructor(r,e,t){ge(this,Ye);Qe(this,"parent");ge(this,Nt,!1);ge(this,Rt);ge(this,Pr,Te?Ee:null);ge(this,Qt);ge(this,Bi);ge(this,Jt);ge(this,Bt,null);ge(this,_t,null);ge(this,$t,null);ge(this,li,null);ge(this,mi,null);ge(this,zi,0);ge(this,_i,0);ge(this,ki,!1);ge(this,yi,null);ge(this,_n,wl(()=>(_e(this,yi,Ai(L(this,zi))),()=>{_e(this,yi,null)})));_e(this,Rt,r),_e(this,Qt,e),_e(this,Bi,t),this.parent=Ie.b,_e(this,Nt,!!L(this,Qt).pending),_e(this,Jt,dr(()=>{if(Ie.b=this,Te){const n=L(this,Pr);Pi(),n.nodeType===Si&&n.data===Zr?Ne(this,Ye,Uo).call(this):Ne(this,Ye,Vo).call(this)}else{var i=Ne(this,Ye,Ca).call(this);try{_e(this,Bt,gt(()=>t(i)))}catch(n){this.error(n)}L(this,_i)>0?Ne(this,Ye,Tn).call(this):_e(this,Nt,!1)}return()=>{var n;(n=L(this,mi))==null||n.remove()}},Tl)),Te&&_e(this,Rt,Ee)}is_pending(){return L(this,Nt)||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!L(this,Qt).pending}update_pending_count(r){Ne(this,Ye,Ra).call(this,r),_e(this,zi,L(this,zi)+r),L(this,yi)&&Ki(L(this,yi),L(this,zi))}get_effect_pending(){return L(this,_n).call(this),T(L(this,yi))}error(r){var e=L(this,Qt).onerror;let t=L(this,Qt).failed;if(L(this,ki)||!e&&!t)throw r;L(this,Bt)&&(et(L(this,Bt)),_e(this,Bt,null)),L(this,_t)&&(et(L(this,_t)),_e(this,_t,null)),L(this,$t)&&(et(L(this,$t)),_e(this,$t,null)),Te&&(st(L(this,Pr)),dt(),st($r()));var i=!1,n=!1;const s=()=>{if(i){cl();return}i=!0,n&&ul(),qt.ensure(),_e(this,zi,0),L(this,$t)!==null&&Ii(L(this,$t),()=>{_e(this,$t,null)}),_e(this,Nt,this.has_pending_snippet()),_e(this,Bt,Ne(this,Ye,wn).call(this,()=>(_e(this,ki,!1),gt(()=>L(this,Bi).call(this,L(this,Rt)))))),L(this,_i)>0?Ne(this,Ye,Tn).call(this):_e(this,Nt,!1)};var h=Ce;try{vt(null),n=!0,e==null||e(r,s),n=!1}catch(u){Yi(u,L(this,Jt)&&L(this,Jt).parent)}finally{vt(h)}t&&di(()=>{_e(this,$t,Ne(this,Ye,wn).call(this,()=>{qt.ensure(),_e(this,ki,!0);try{return gt(()=>{t(L(this,Rt),()=>r,()=>s)})}catch(u){return Yi(u,L(this,Jt).parent),null}finally{_e(this,ki,!1)}}))})}}Nt=new WeakMap,Rt=new WeakMap,Pr=new WeakMap,Qt=new WeakMap,Bi=new WeakMap,Jt=new WeakMap,Bt=new WeakMap,_t=new WeakMap,$t=new WeakMap,li=new WeakMap,mi=new WeakMap,zi=new WeakMap,_i=new WeakMap,ki=new WeakMap,yi=new WeakMap,_n=new WeakMap,Ye=new WeakSet,Vo=function(){try{_e(this,Bt,gt(()=>L(this,Bi).call(this,L(this,Rt))))}catch(r){this.error(r)}_e(this,Nt,!1)},Uo=function(){const r=L(this,Qt).pending;r&&(_e(this,_t,gt(()=>r(L(this,Rt)))),qt.enqueue(()=>{var e=Ne(this,Ye,Ca).call(this);_e(this,Bt,Ne(this,Ye,wn).call(this,()=>(qt.ensure(),gt(()=>L(this,Bi).call(this,e))))),L(this,_i)>0?Ne(this,Ye,Tn).call(this):(Ii(L(this,_t),()=>{_e(this,_t,null)}),_e(this,Nt,!1))}))},Ca=function(){var r=L(this,Rt);return L(this,Nt)&&(_e(this,mi,pt()),L(this,Rt).before(L(this,mi)),r=L(this,mi)),r},wn=function(r){var e=Ie,t=Ce,i=He;Yt(L(this,Jt)),vt(L(this,Jt)),Wi(L(this,Jt).ctx);try{return r()}catch(n){return Ga(n),null}finally{Yt(e),vt(t),Wi(i)}},Tn=function(){const r=L(this,Qt).pending;L(this,Bt)!==null&&(_e(this,li,document.createDocumentFragment()),L(this,li).append(L(this,mi)),ys(L(this,Bt),L(this,li))),L(this,_t)===null&&_e(this,_t,gt(()=>r(L(this,Rt))))},Ra=function(r){var e;if(!this.has_pending_snippet()){this.parent&&Ne(e=this.parent,Ye,Ra).call(e,r);return}_e(this,_i,L(this,_i)+r),L(this,_i)===0&&(_e(this,Nt,!1),L(this,_t)&&Ii(L(this,_t),()=>{_e(this,_t,null)}),L(this,li)&&(L(this,Rt).before(L(this,li)),_e(this,li,null)))};function Xa(a,r,e,t){const i=Xi()?hr:Ya;if(e.length===0&&a.length===0){t(r.map(i));return}var n=Se,s=Ie,h=bl();function u(){Promise.all(e.map(o=>Sl(o))).then(o=>{h();try{t([...r.map(i),...o])}catch(l){(s.f&ni)===0&&Yi(l,s)}n==null||n.deactivate(),nn()}).catch(o=>{Yi(o,s)})}a.length>0?Promise.all(a).then(()=>{h();try{return u()}finally{n==null||n.deactivate(),nn()}}):u()}function bl(){var a=Ie,r=Ce,e=He,t=Se;return function(n=!0){Yt(a),vt(r),Wi(e),n&&(t==null||t.activate())}}function nn(){Yt(null),vt(null),Wi(null)}function hr(a){var r=rt|ft,e=Ce!==null&&(Ce.f&rt)!==0?Ce:null;return Ie!==null&&(Ie.f|=xi),{ctx:He,deps:null,effects:null,equals:ka,f:r,fn:a,reactions:null,rv:0,v:it,wv:0,parent:e??Ie,ac:null}}function Sl(a,r){let e=Ie;e===null&&el();var t=e.b,i=void 0,n=Ai(it),s=!Ce,h=new Map;return Fl(()=>{var c;var u=La();i=u.promise;try{Promise.resolve(a()).then(u.resolve,u.reject).then(()=>{o===Se&&o.committed&&o.deactivate(),nn()})}catch(p){u.reject(p),nn()}var o=Se;if(s){var l=!t.is_pending();t.update_pending_count(1),o.increment(l),(c=h.get(o))==null||c.reject(Zi),h.delete(o),h.set(o,u)}const f=(p,_=void 0)=>{if(o.activate(),_)_!==Zi&&(n.f|=ci,Ki(n,_));else{(n.f&ci)!==0&&(n.f^=ci),Ki(n,p);for(const[d,v]of h){if(h.delete(d),d===o)break;v.reject(Zi)}}s&&(t.update_pending_count(-1),o.decrement(l))};u.promise.then(f,p=>f(null,p||"unknown"))}),Fn(()=>{for(const u of h.values())u.reject(Zi)}),new Promise(u=>{function o(l){function f(){l===i?u(n):o(i)}l.then(f,f)}o(i)})}function le(a){const r=hr(a);return Ts(r),r}function Ya(a){const r=hr(a);return r.equals=Va,r}function Ka(a){var r=a.effects;if(r!==null){a.effects=null;for(var e=0;e<r.length;e+=1)et(r[e])}}function Pl(a){for(var r=a.parent;r!==null;){if((r.f&rt)===0)return(r.f&ni)===0?r:null;r=r.parent}return null}function Ln(a){var r,e=Ie;Yt(Pl(a));try{a.f&=~bi,Ka(a),r=Ps(a)}finally{Yt(e)}return r}function Qa(a){var r=Ln(a);if(a.equals(r)||(Se!=null&&Se.is_fork||(a.v=r),a.wv=bs()),!Oi)if(Xe!==null)(fr()||Se!=null&&Se.is_fork)&&Xe.set(a,r);else{var e=(a.f&Vt)===0?ri:at;lt(a,e)}}let Mn=new Set;const pi=new Map;let Ja=!1;function Ai(a,r){var e={f:0,v:a,reactions:null,equals:ka,rv:0,wv:0};return e}function Pe(a,r){const e=Ai(a);return Ts(e),e}function $a(a,r=!1,e=!0){var i;const t=Ai(a);return r||(t.equals=Va),lr&&e&&He!==null&&He.l!==null&&((i=He.l).s??(i.s=[])).push(t),t}function me(a,r,e=!1){Ce!==null&&(!Xt||(Ce.f&Ha)!==0)&&Xi()&&(Ce.f&(rt|ti|An|Ha))!==0&&!(ut!=null&&ut.includes(a))&&ll();let t=e?Tt(r):r;return Ki(a,t)}function Ki(a,r){if(!a.equals(r)){var e=a.v;Oi?pi.set(a,r):pi.set(a,e),a.v=r;var t=qt.ensure();t.capture(a,e),(a.f&rt)!==0&&((a.f&ft)!==0&&Ln(a),lt(a,(a.f&Vt)!==0?at:ri)),a.wv=bs(),es(a,ft),Xi()&&Ie!==null&&(Ie.f&at)!==0&&(Ie.f&(ii|hi))===0&&(Mt===null?Bl([a]):Mt.push(a)),!t.is_fork&&Mn.size>0&&!Ja&&Cl()}return r}function Cl(){Ja=!1;var a=Di;on(!0);const r=Array.from(Mn);try{for(const e of r)(e.f&at)!==0&&lt(e,ri),gr(e)&&vr(e)}finally{on(a)}Mn.clear()}function Rl(a,r=1){var e=T(a),t=r===1?e++:e--;return me(a,e),t}function cr(a){me(a,a.v+1)}function es(a,r){var e=a.reactions;if(e!==null)for(var t=Xi(),i=e.length,n=0;n<i;n++){var s=e[n],h=s.f;if(!(!t&&s===Ie)){var u=(h&ft)===0;if(u&&lt(s,r),(h&rt)!==0){var o=s;Xe==null||Xe.delete(o),(h&bi)===0&&(h&Vt&&(s.f|=bi),es(o,ri))}else u&&((h&ti)!==0&&Gt!==null&&Gt.add(s),Ri(s))}}}function Tt(a){if(typeof a!="object"||a===null||fi in a)return a;const r=Sn(a);if(r!==Yo&&r!==Ko)return a;var e=new Map,t=bn(a),i=Pe(0),n=Li,s=h=>{if(Li===n)return h();var u=Ce,o=Li;vt(null),xs(n);var l=h();return vt(u),xs(o),l};return t&&e.set("length",Pe(a.length)),new Proxy(a,{defineProperty(h,u,o){(!("value"in o)||o.configurable===!1||o.enumerable===!1||o.writable===!1)&&sl();var l=e.get(u);return l===void 0?l=s(()=>{var f=Pe(o.value);return e.set(u,f),f}):me(l,o.value,!0),!0},deleteProperty(h,u){var o=e.get(u);if(o===void 0){if(u in h){const l=s(()=>Pe(it));e.set(u,l),cr(i)}}else me(o,it),cr(i);return!0},get(h,u,o){var p;if(u===fi)return a;var l=e.get(u),f=u in h;if(l===void 0&&(!f||(p=ji(h,u))!=null&&p.writable)&&(l=s(()=>{var _=Tt(f?h[u]:it),d=Pe(_);return d}),e.set(u,l)),l!==void 0){var c=T(l);return c===it?void 0:c}return Reflect.get(h,u,o)},getOwnPropertyDescriptor(h,u){var o=Reflect.getOwnPropertyDescriptor(h,u);if(o&&"value"in o){var l=e.get(u);l&&(o.value=T(l))}else if(o===void 0){var f=e.get(u),c=f==null?void 0:f.v;if(f!==void 0&&c!==it)return{enumerable:!0,configurable:!0,value:c,writable:!0}}return o},has(h,u){var c;if(u===fi)return!0;var o=e.get(u),l=o!==void 0&&o.v!==it||Reflect.has(h,u);if(o!==void 0||Ie!==null&&(!l||(c=ji(h,u))!=null&&c.writable)){o===void 0&&(o=s(()=>{var p=l?Tt(h[u]):it,_=Pe(p);return _}),e.set(u,o));var f=T(o);if(f===it)return!1}return l},set(h,u,o,l){var R;var f=e.get(u),c=u in h;if(t&&u==="length")for(var p=o;p<f.v;p+=1){var _=e.get(p+"");_!==void 0?me(_,it):p in h&&(_=s(()=>Pe(it)),e.set(p+"",_))}if(f===void 0)(!c||(R=ji(h,u))!=null&&R.writable)&&(f=s(()=>Pe(void 0)),me(f,Tt(o)),e.set(u,f));else{c=f.v!==it;var d=s(()=>Tt(o));me(f,d)}var v=Reflect.getOwnPropertyDescriptor(h,u);if(v!=null&&v.set&&v.set.call(l,o),!c){if(t&&typeof u=="string"){var w=e.get("length"),S=Number(u);Number.isInteger(S)&&S>=w.v&&me(w,S+1)}cr(i)}return!0},ownKeys(h){T(i);var u=Reflect.ownKeys(h).filter(f=>{var c=e.get(f);return c===void 0||c.v!==it});for(var[o,l]of e)l.v!==it&&!(o in h)&&u.push(o);return u},setPrototypeOf(){ol()}})}function ts(a){try{if(a!==null&&typeof a=="object"&&fi in a)return a[fi]}catch{}return a}function Al(a,r){return Object.is(ts(a),ts(r))}var is,rs,ns,as;function Hn(){if(is===void 0){is=window,rs=/Firefox/.test(navigator.userAgent);var a=Element.prototype,r=Node.prototype,e=Text.prototype;ns=ji(r,"firstChild").get,as=ji(r,"nextSibling").get,Oa(a)&&(a.__click=void 0,a.__className=void 0,a.__attributes=null,a.__style=void 0,a.__e=void 0),Oa(e)&&(e.__t=void 0)}}function pt(a=""){return document.createTextNode(a)}function ot(a){return ns.call(a)}function jt(a){return as.call(a)}function Q(a,r){if(!Te)return ot(a);var e=ot(Ee);if(e===null)e=Ee.appendChild(pt());else if(r&&e.nodeType!==Jr){var t=pt();return e==null||e.before(t),st(t),t}return st(e),e}function K(a,r=!1){if(!Te){var e=ot(a);return e instanceof Comment&&e.data===""?jt(e):e}if(r&&(Ee==null?void 0:Ee.nodeType)!==Jr){var t=pt();return Ee==null||Ee.before(t),st(t),t}return Ee}function ue(a,r=1,e=!1){let t=Te?Ee:a;for(var i;r--;)i=t,t=jt(t);if(!Te)return t;if(e&&(t==null?void 0:t.nodeType)!==Jr){var n=pt();return t===null?i==null||i.after(n):t.before(n),st(n),n}return st(t),t}function ss(a){a.textContent=""}function os(){return!1}function Il(a,r){if(r){const e=document.body;a.autofocus=!0,di(()=>{document.activeElement===e&&a.focus()})}}let ls=!1;function us(){ls||(ls=!0,document.addEventListener("reset",a=>{Promise.resolve().then(()=>{var r;if(!a.defaultPrevented)for(const e of a.target.elements)(r=e.__on_r)==null||r.call(e)})},{capture:!0}))}function an(a){var r=Ce,e=Ie;vt(null),Yt(null);try{return a()}finally{vt(r),Yt(e)}}function Dl(a,r,e,t=e){a.addEventListener(r,()=>an(e));const i=a.__on_r;i?a.__on_r=()=>{i(),t(!0)}:a.__on_r=()=>t(!0),us()}function hs(a){Ie===null&&(Ce===null&&rl(),il()),Oi&&tl()}function Ol(a,r){var e=r.last;e===null?r.last=r.first=a:(e.next=a,a.prev=e,r.last=a)}function Lt(a,r,e){var t=Ie;t!==null&&(t.f&wt)!==0&&(a|=wt);var i={ctx:He,deps:null,nodes:null,f:a|ft|Vt,first:null,fn:r,last:null,next:null,parent:t,b:t&&t.b,prev:null,teardown:null,wv:0,ac:null};if(e)try{vr(i),i.f|=Qr}catch(h){throw et(i),h}else r!==null&&Ri(i);var n=i;if(e&&n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&xi)===0&&(n=n.first,(a&ti)!==0&&(a&Ei)!==0&&n!==null&&(n.f|=Ei)),n!==null&&(n.parent=t,t!==null&&Ol(n,t),Ce!==null&&(Ce.f&rt)!==0&&(a&hi)===0)){var s=Ce;(s.effects??(s.effects=[])).push(n)}return i}function fr(){return Ce!==null&&!Xt}function Fn(a){const r=Lt(Yr,null,!1);return lt(r,at),r.teardown=a,r}function si(a){hs();var r=Ie.f,e=!Ce&&(r&ii)!==0&&(r&Qr)===0;if(e){var t=He;(t.e??(t.e=[])).push(a)}else return cs(a)}function cs(a){return Lt(Cn|Na,a,!1)}function Ll(a){return hs(),Lt(Yr|Na,a,!0)}function Ml(a){qt.ensure();const r=Lt(hi|xi,a,!0);return()=>{et(r)}}function Hl(a){qt.ensure();const r=Lt(hi|xi,a,!0);return(e={})=>new Promise(t=>{e.outro?Ii(r,()=>{et(r),t(void 0)}):(et(r),t(void 0))})}function Nn(a){return Lt(Cn,a,!1)}function Fl(a){return Lt(An|xi,a,!0)}function sn(a,r=0){return Lt(Yr|r,a,!0)}function ke(a,r=[],e=[],t=[]){Xa(t,r,e,i=>{Lt(Yr,()=>a(...i.map(T)),!0)})}function dr(a,r=0){var e=Lt(ti|r,a,!0);return e}function fs(a,r=0){var e=Lt(Ma|r,a,!0);return e}function gt(a){return Lt(ii|xi,a,!0)}function ds(a){var r=a.teardown;if(r!==null){const e=Oi,t=Ce;ws(!0),vt(null);try{r.call(null)}finally{ws(e),vt(t)}}}function ps(a,r=!1){var e=a.first;for(a.first=a.last=null;e!==null;){const i=e.ac;i!==null&&an(()=>{i.abort(Zi)});var t=e.next;(e.f&hi)!==0?e.parent=null:et(e,r),e=t}}function Nl(a){for(var r=a.first;r!==null;){var e=r.next;(r.f&ii)===0&&et(r),r=e}}function et(a,r=!0){var e=!1;(r||(a.f&Fa)!==0)&&a.nodes!==null&&a.nodes.end!==null&&(gs(a.nodes.start,a.nodes.end),e=!0),ps(a,r&&!e),ln(a,0),lt(a,ni);var t=a.nodes&&a.nodes.t;if(t!==null)for(const n of t)n.stop();ds(a);var i=a.parent;i!==null&&i.first!==null&&vs(a),a.next=a.prev=a.teardown=a.ctx=a.deps=a.fn=a.nodes=a.ac=null}function gs(a,r){for(;a!==null;){var e=a===r?null:jt(a);a.remove(),a=e}}function vs(a){var r=a.parent,e=a.prev,t=a.next;e!==null&&(e.next=t),t!==null&&(t.prev=e),r!==null&&(r.first===a&&(r.first=t),r.last===a&&(r.last=e))}function Ii(a,r,e=!0){var t=[];ms(a,t,!0);var i=()=>{e&&et(a),r&&r()},n=t.length;if(n>0){var s=()=>--n||i();for(var h of t)h.out(s)}else i()}function ms(a,r,e){if((a.f&wt)===0){a.f^=wt;var t=a.nodes&&a.nodes.t;if(t!==null)for(const h of t)(h.is_global||e)&&r.push(h);for(var i=a.first;i!==null;){var n=i.next,s=(i.f&Ei)!==0||(i.f&ii)!==0&&(a.f&ti)!==0;ms(i,r,s?e:!1),i=n}}}function Bn(a){_s(a,!0)}function _s(a,r){if((a.f&wt)!==0){a.f^=wt,(a.f&at)===0&&(lt(a,ft),Ri(a));for(var e=a.first;e!==null;){var t=e.next,i=(e.f&Ei)!==0||(e.f&ii)!==0;_s(e,i?r:!1),e=t}var n=a.nodes&&a.nodes.t;if(n!==null)for(const s of n)(s.is_global||r)&&s.in()}}function ys(a,r){if(a.nodes)for(var e=a.nodes.start,t=a.nodes.end;e!==null;){var i=e===t?null:jt(e);r.append(e),e=i}}let Di=!1;function on(a){Di=a}let Oi=!1;function ws(a){Oi=a}let Ce=null,Xt=!1;function vt(a){Ce=a}let Ie=null;function Yt(a){Ie=a}let ut=null;function Ts(a){Ce!==null&&(ut===null?ut=[a]:ut.push(a))}let ht=null,Et=0,Mt=null;function Bl(a){Mt=a}let Es=1,pr=0,Li=pr;function xs(a){Li=a}function bs(){return++Es}function gr(a){var r=a.f;if((r&ft)!==0)return!0;if(r&rt&&(a.f&=~bi),(r&ri)!==0){var e=a.deps;if(e!==null)for(var t=e.length,i=0;i<t;i++){var n=e[i];if(gr(n)&&Qa(n),n.wv>a.wv)return!0}(r&Vt)!==0&&Xe===null&&lt(a,at)}return!1}function Ss(a,r,e=!0){var t=a.reactions;if(t!==null&&!(ut!=null&&ut.includes(a)))for(var i=0;i<t.length;i++){var n=t[i];(n.f&rt)!==0?Ss(n,r,!1):r===n&&(e?lt(n,ft):(n.f&at)!==0&&lt(n,ri),Ri(n))}}function Ps(a){var _;var r=ht,e=Et,t=Mt,i=Ce,n=ut,s=He,h=Xt,u=Li,o=a.f;ht=null,Et=0,Mt=null,Ce=(o&(ii|hi))===0?a:null,ut=null,Wi(a.ctx),Xt=!1,Li=++pr,a.ac!==null&&(an(()=>{a.ac.abort(Zi)}),a.ac=null);try{a.f|=Rn;var l=a.fn,f=l(),c=a.deps;if(ht!==null){var p;if(ln(a,Et),c!==null&&Et>0)for(c.length=Et+ht.length,p=0;p<ht.length;p++)c[Et+p]=ht[p];else a.deps=c=ht;if(fr()&&(a.f&Vt)!==0)for(p=Et;p<c.length;p++)((_=c[p]).reactions??(_.reactions=[])).push(a)}else c!==null&&Et<c.length&&(ln(a,Et),c.length=Et);if(Xi()&&Mt!==null&&!Xt&&c!==null&&(a.f&(rt|ri|ft))===0)for(p=0;p<Mt.length;p++)Ss(Mt[p],a);return i!==null&&i!==a&&(pr++,Mt!==null&&(t===null?t=Mt:t.push(...Mt))),(a.f&ci)!==0&&(a.f^=ci),f}catch(d){return Ga(d)}finally{a.f^=Rn,ht=r,Et=e,Mt=t,Ce=i,ut=n,Wi(s),Xt=h,Li=u}}function zl(a,r){let e=r.reactions;if(e!==null){var t=Xo.call(e,a);if(t!==-1){var i=e.length-1;i===0?e=r.reactions=null:(e[t]=e[i],e.pop())}}e===null&&(r.f&rt)!==0&&(ht===null||!ht.includes(r))&&(lt(r,ri),(r.f&Vt)!==0&&(r.f^=Vt,r.f&=~bi),Ka(r),ln(r,0))}function ln(a,r){var e=a.deps;if(e!==null)for(var t=r;t<e.length;t++)zl(a,e[t])}function vr(a){var r=a.f;if((r&ni)===0){lt(a,at);var e=Ie,t=Di;Ie=a,Di=!0;try{(r&(ti|Ma))!==0?Nl(a):ps(a),ds(a);var i=Ps(a);a.teardown=typeof i=="function"?i:null,a.wv=Es;var n;xn&&dl&&(a.f&ft)!==0&&a.deps}finally{Di=t,Ie=e}}}async function kl(){await Promise.resolve(),On()}function T(a){var r=a.f,e=(r&rt)!==0;if(Ce!==null&&!Xt){var t=Ie!==null&&(Ie.f&ni)!==0;if(!t&&!(ut!=null&&ut.includes(a))){var i=Ce.deps;if((Ce.f&Rn)!==0)a.rv<pr&&(a.rv=pr,ht===null&&i!==null&&i[Et]===a?Et++:ht===null?ht=[a]:ht.includes(a)||ht.push(a));else{(Ce.deps??(Ce.deps=[])).push(a);var n=a.reactions;n===null?a.reactions=[Ce]:n.includes(Ce)||n.push(Ce)}}}if(Oi){if(pi.has(a))return pi.get(a);if(e){var s=a,h=s.v;return((s.f&at)===0&&s.reactions!==null||Rs(s))&&(h=Ln(s)),pi.set(s,h),h}}else e&&(!(Xe!=null&&Xe.has(a))||Se!=null&&Se.is_fork&&!fr())&&(s=a,gr(s)&&Qa(s),Di&&fr()&&(s.f&Vt)===0&&Cs(s));if(Xe!=null&&Xe.has(a))return Xe.get(a);if((a.f&ci)!==0)throw a.v;return a.v}function Cs(a){if(a.deps!==null){a.f^=Vt;for(const r of a.deps)(r.reactions??(r.reactions=[])).push(a),(r.f&rt)!==0&&(r.f&Vt)===0&&Cs(r)}}function Rs(a){if(a.v===it)return!0;if(a.deps===null)return!1;for(const r of a.deps)if(pi.has(r)||(r.f&rt)!==0&&Rs(r))return!0;return!1}function mr(a){var r=Xt;try{return Xt=!0,a()}finally{Xt=r}}const Vl=-7169;function lt(a,r){a.f=a.f&Vl|r}function Ul(a){if(!(typeof a!="object"||!a||a instanceof EventTarget)){if(fi in a)zn(a);else if(!Array.isArray(a))for(let r in a){const e=a[r];typeof e=="object"&&e&&fi in e&&zn(e)}}}function zn(a,r=new Set){if(typeof a=="object"&&a!==null&&!(a instanceof EventTarget)&&!r.has(a)){r.add(a),a instanceof Date&&a.getTime();for(let t in a)try{zn(a[t],r)}catch{}const e=Sn(a);if(e!==Object.prototype&&e!==Array.prototype&&e!==Map.prototype&&e!==Set.prototype&&e!==Date.prototype){const t=Da(e);for(let i in t){const n=t[i].get;if(n)try{n.call(a)}catch{}}}}}const As=new Set,kn=new Set;function Is(a,r,e,t={}){function i(n){if(t.capture||_r.call(r,n),!n.cancelBubble)return an(()=>e==null?void 0:e.call(this,n))}return a.startsWith("pointer")||a.startsWith("touch")||a==="wheel"?di(()=>{r.addEventListener(a,i,t)}):r.addEventListener(a,i,t),i}function gi(a,r,e,t,i){var n={capture:t,passive:i},s=Is(a,r,e,n);(r===document.body||r===window||r===document||r instanceof HTMLMediaElement)&&Fn(()=>{r.removeEventListener(a,s,n)})}function Mi(a){for(var r=0;r<a.length;r++)As.add(a[r]);for(var e of kn)e(a)}let Ds=null;function _r(a){var v;var r=this,e=r.ownerDocument,t=a.type,i=((v=a.composedPath)==null?void 0:v.call(a))||[],n=i[0]||a.target;Ds=a;var s=0,h=Ds===a&&a.__root;if(h){var u=i.indexOf(h);if(u!==-1&&(r===document||r===window)){a.__root=r;return}var o=i.indexOf(r);if(o===-1)return;u<=o&&(s=u)}if(n=i[s]||a.target,n!==r){Xr(a,"currentTarget",{configurable:!0,get(){return n||e}});var l=Ce,f=Ie;vt(null),Yt(null);try{for(var c,p=[];n!==null;){var _=n.assignedSlot||n.parentNode||n.host||null;try{var d=n["__"+t];d!=null&&(!n.disabled||a.target===n)&&d.call(n,a)}catch(w){c?p.push(w):c=w}if(a.cancelBubble||_===r||_===null)break;n=_}if(c){for(let w of p)queueMicrotask(()=>{throw w});throw c}}finally{a.__root=r,delete a.currentTarget,vt(l),Yt(f)}}}function Vn(a){var r=document.createElement("template");return r.innerHTML=a.replaceAll("<!>","<!---->"),r.content}function xt(a,r){var e=Ie;e.nodes===null&&(e.nodes={start:a,end:r,a:null,t:null})}function Ae(a,r){var e=(r&Aa)!==0,t=(r&Zo)!==0,i,n=!a.startsWith("<!>");return()=>{if(Te)return xt(Ee,null),Ee;i===void 0&&(i=Vn(n?a:"<!>"+a),e||(i=ot(i)));var s=t||rs?document.importNode(i,!0):i.cloneNode(!0);if(e){var h=ot(s),u=s.lastChild;xt(h,u)}else xt(s,s);return s}}function Gl(a,r,e="svg"){var t=!a.startsWith("<!>"),i=(r&Aa)!==0,n=`<${e}>${t?a:"<!>"+a}</${e}>`,s;return()=>{if(Te)return xt(Ee,null),Ee;if(!s){var h=Vn(n),u=ot(h);if(i)for(s=document.createDocumentFragment();ot(u);)s.appendChild(ot(u));else s=ot(u)}var o=s.cloneNode(!0);if(i){var l=ot(o),f=o.lastChild;xt(l,f)}else xt(o,o);return o}}function J(a,r){return Gl(a,r,"svg")}function mt(a=""){if(!Te){var r=pt(a+"");return xt(r,r),r}var e=Ee;return e.nodeType!==Jr&&(e.before(e=pt()),st(e)),xt(e,e),e}function ie(){if(Te)return xt(Ee,null),Ee;var a=document.createDocumentFragment(),r=document.createComment(""),e=pt();return a.append(r,e),xt(r,e),a}function C(a,r){if(Te){var e=Ie;((e.f&Qr)===0||e.nodes.end===null)&&(e.nodes.end=Ee),Pi();return}a!==null&&a.before(r)}function jl(a){return a.endsWith("capture")&&a!=="gotpointercapture"&&a!=="lostpointercapture"}const Zl=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Wl(a){return Zl.includes(a)}const ql={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function Xl(a){return a=a.toLowerCase(),ql[a]??a}const Yl=["touchstart","touchmove"];function Kl(a){return Yl.includes(a)}function Ge(a,r){var e=r==null?"":typeof r=="object"?r+"":r;e!==(a.__t??(a.__t=a.nodeValue))&&(a.__t=e,a.nodeValue=e+"")}function Os(a,r){return Ls(a,r)}function Ql(a,r){Hn(),r.intro=r.intro??!1;const e=r.target,t=Te,i=Ee;try{for(var n=ot(e);n&&(n.nodeType!==Si||n.data!==Ia);)n=jt(n);if(!n)throw Ti;Ut(!0),st(n);const s=Ls(a,{...r,anchor:n});return Ut(!1),s}catch(s){if(s instanceof Error&&s.message.split(`
2
- `).some(h=>h.startsWith("https://svelte.dev/e/")))throw s;return s!==Ti&&console.warn("Failed to hydrate: ",s),r.recover===!1&&al(),Hn(),ss(e),Ut(!1),Os(a,r)}finally{Ut(t),st(i)}}const Qi=new Map;function Ls(a,{target:r,anchor:e,props:t={},events:i,context:n,intro:s=!0}){Hn();var h=new Set,u=f=>{for(var c=0;c<f.length;c++){var p=f[c];if(!h.has(p)){h.add(p);var _=Kl(p);r.addEventListener(p,_r,{passive:_});var d=Qi.get(p);d===void 0?(document.addEventListener(p,_r,{passive:_}),Qi.set(p,1)):Qi.set(p,d+1)}}};u(Wr(As)),kn.add(u);var o=void 0,l=Hl(()=>{var f=e??r.appendChild(pt());return El(f,{pending:()=>{}},c=>{if(n){Ve({});var p=He;p.c=n}if(i&&(t.$$events=i),Te&&xt(c,null),o=a(c,t)||{},Te&&(Ie.nodes.end=Ee,Ee===null||Ee.nodeType!==Si||Ee.data!==En))throw or(),Ti;n&&Ue()}),()=>{var _;for(var c of h){r.removeEventListener(c,_r);var p=Qi.get(c);--p===0?(document.removeEventListener(c,_r),Qi.delete(c)):Qi.set(c,p)}kn.delete(u),f!==e&&((_=f.parentNode)==null||_.removeChild(f))}});return Un.set(o,l),o}let Un=new WeakMap;function Jl(a,r){const e=Un.get(a);return e?(Un.delete(a),e(r)):Promise.resolve()}class Gn{constructor(r,e=!0){Qe(this,"anchor");ge(this,Zt,new Map);ge(this,ei,new Map);ge(this,At,new Map);ge(this,Vi,new Set);ge(this,Cr,!0);ge(this,Rr,()=>{var r=Se;if(L(this,Zt).has(r)){var e=L(this,Zt).get(r),t=L(this,ei).get(e);if(t)Bn(t),L(this,Vi).delete(e);else{var i=L(this,At).get(e);i&&(L(this,ei).set(e,i.effect),L(this,At).delete(e),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),t=i.effect)}for(const[n,s]of L(this,Zt)){if(L(this,Zt).delete(n),n===r)break;const h=L(this,At).get(s);h&&(et(h.effect),L(this,At).delete(s))}for(const[n,s]of L(this,ei)){if(n===e||L(this,Vi).has(n))continue;const h=()=>{if(Array.from(L(this,Zt).values()).includes(n)){var o=document.createDocumentFragment();ys(s,o),o.append(pt()),L(this,At).set(n,{effect:s,fragment:o})}else et(s);L(this,Vi).delete(n),L(this,ei).delete(n)};L(this,Cr)||!t?(L(this,Vi).add(n),Ii(s,h,!1)):h()}}});ge(this,yn,r=>{L(this,Zt).delete(r);const e=Array.from(L(this,Zt).values());for(const[t,i]of L(this,At))e.includes(t)||(et(i.effect),L(this,At).delete(t))});this.anchor=r,_e(this,Cr,e)}ensure(r,e){var t=Se,i=os();if(e&&!L(this,ei).has(r)&&!L(this,At).has(r))if(i){var n=document.createDocumentFragment(),s=pt();n.append(s),L(this,At).set(r,{effect:gt(()=>e(s)),fragment:n})}else L(this,ei).set(r,gt(()=>e(this.anchor)));if(L(this,Zt).set(t,r),i){for(const[h,u]of L(this,ei))h===r?t.skipped_effects.delete(u):t.skipped_effects.add(u);for(const[h,u]of L(this,At))h===r?t.skipped_effects.delete(u.effect):t.skipped_effects.add(u.effect);t.oncommit(L(this,Rr)),t.ondiscard(L(this,yn))}else Te&&(this.anchor=Ee),L(this,Rr).call(this)}}Zt=new WeakMap,ei=new WeakMap,At=new WeakMap,Vi=new WeakMap,Cr=new WeakMap,Rr=new WeakMap,yn=new WeakMap;function bt(a,r,...e){var t=new Gn(a);dr(()=>{const i=r()??null;t.ensure(i,i&&(n=>i(n,...e)))},Ei)}function $l(a){He===null&&Ba(),lr&&He.l!==null?eu(He).m.push(a):si(()=>{const r=mr(a);if(typeof r=="function")return r})}function eu(a){var r=a.l;return r.u??(r.u={a:[],b:[],m:[]})}function G(a,r,e=!1){Te&&Pi();var t=new Gn(a),i=e?Ei:0;function n(s,h){if(Te){const o=za(a)===Zr;if(s===o){var u=$r();st(u),t.anchor=u,Ut(!1),t.ensure(s,h),Ut(!0);return}}t.ensure(s,h)}dr(()=>{var s=!1;r((h,u=!0)=>{s=!0,n(u,h)}),s||n(!1,null)},i)}function tu(a,r,e){Te&&Pi();var t=new Gn(a),i=!Xi();dr(()=>{var n=r();i&&n!==null&&typeof n=="object"&&(n={}),t.ensure(n,e)})}function un(a,r){return r}function iu(a,r,e){for(var t=[],i=r.length,n,s=r.length,h=0;h<i;h++){let f=r[h];Ii(f,()=>{if(n){if(n.pending.delete(f),n.done.add(f),n.pending.size===0){var c=a.outrogroups;jn(Wr(n.done)),c.delete(n),c.size===0&&(a.outrogroups=null)}}else s-=1},!1)}if(s===0){var u=t.length===0&&e!==null;if(u){var o=e,l=o.parentNode;ss(l),l.append(o),a.items.clear()}jn(r,!u)}else n={pending:new Set(r),done:new Set},(a.outrogroups??(a.outrogroups=new Set)).add(n)}function jn(a,r=!0){for(var e=0;e<a.length;e++)et(a[e],r)}var Ms;function yr(a,r,e,t,i,n=null){var s=a,h=new Map,u=(r&sr)!==0;if(u){var o=a;s=Te?st(ot(o)):o.appendChild(pt())}Te&&Pi();var l=null,f=Ya(()=>{var w=e();return bn(w)?w:w==null?[]:Wr(w)}),c,p=!0;function _(){v.fallback=l,ru(v,c,s,r,t),l!==null&&(c.length===0?(l.f&ai)===0?Bn(l):(l.f^=ai,wr(l,null,s)):Ii(l,()=>{l=null}))}var d=dr(()=>{c=T(f);var w=c.length;let S=!1;if(Te){var R=za(s)===Zr;R!==(w===0)&&(s=$r(),st(s),Ut(!1),S=!0)}for(var P=new Set,A=Se,F=os(),N=0;N<w;N+=1){Te&&Ee.nodeType===Si&&Ee.data===En&&(s=Ee,S=!0,Ut(!1));var z=c[N],I=t(z,N),D=p?null:h.get(I);D?(D.v&&Ki(D.v,z),D.i&&Ki(D.i,N),F&&A.skipped_effects.delete(D.e)):(D=nu(h,p?s:Ms??(Ms=pt()),z,I,N,i,r,e),p||(D.e.f|=ai),h.set(I,D)),P.add(I)}if(w===0&&n&&!l&&(p?l=gt(()=>n(s)):(l=gt(()=>n(Ms??(Ms=pt()))),l.f|=ai)),Te&&w>0&&st($r()),!p)if(F){for(const[H,k]of h)P.has(H)||A.skipped_effects.add(k.e);A.oncommit(_),A.ondiscard(()=>{})}else _();S&&Ut(!0),T(f)}),v={effect:d,items:h,outrogroups:null,fallback:l};p=!1,Te&&(s=Ee)}function ru(a,r,e,t,i){var D,H,k,q,O,U,te,$,ne;var n=(t&Go)!==0,s=r.length,h=a.items,u=a.effect.first,o,l=null,f,c=[],p=[],_,d,v,w;if(n)for(w=0;w<s;w+=1)_=r[w],d=i(_,w),v=h.get(d).e,(v.f&ai)===0&&((H=(D=v.nodes)==null?void 0:D.a)==null||H.measure(),(f??(f=new Set)).add(v));for(w=0;w<s;w+=1){if(_=r[w],d=i(_,w),v=h.get(d).e,a.outrogroups!==null)for(const B of a.outrogroups)B.pending.delete(v),B.done.delete(v);if((v.f&ai)!==0)if(v.f^=ai,v===u)wr(v,null,e);else{var S=l?l.next:u;v===a.effect.last&&(a.effect.last=v.prev),v.prev&&(v.prev.next=v.next),v.next&&(v.next.prev=v.prev),vi(a,l,v),vi(a,v,S),wr(v,S,e),l=v,c=[],p=[],u=l.next;continue}if((v.f&wt)!==0&&(Bn(v),n&&((q=(k=v.nodes)==null?void 0:k.a)==null||q.unfix(),(f??(f=new Set)).delete(v))),v!==u){if(o!==void 0&&o.has(v)){if(c.length<p.length){var R=p[0],P;l=R.prev;var A=c[0],F=c[c.length-1];for(P=0;P<c.length;P+=1)wr(c[P],R,e);for(P=0;P<p.length;P+=1)o.delete(p[P]);vi(a,A.prev,F.next),vi(a,l,A),vi(a,F,R),u=R,l=F,w-=1,c=[],p=[]}else o.delete(v),wr(v,u,e),vi(a,v.prev,v.next),vi(a,v,l===null?a.effect.first:l.next),vi(a,l,v),l=v;continue}for(c=[],p=[];u!==null&&u!==v;)(o??(o=new Set)).add(u),p.push(u),u=u.next;if(u===null)continue}(v.f&ai)===0&&c.push(v),l=v,u=v.next}if(a.outrogroups!==null){for(const B of a.outrogroups)B.pending.size===0&&(jn(Wr(B.done)),(O=a.outrogroups)==null||O.delete(B));a.outrogroups.size===0&&(a.outrogroups=null)}if(u!==null||o!==void 0){var N=[];if(o!==void 0)for(v of o)(v.f&wt)===0&&N.push(v);for(;u!==null;)(u.f&wt)===0&&u!==a.fallback&&N.push(u),u=u.next;var z=N.length;if(z>0){var I=(t&sr)!==0&&s===0?e:null;if(n){for(w=0;w<z;w+=1)(te=(U=N[w].nodes)==null?void 0:U.a)==null||te.measure();for(w=0;w<z;w+=1)(ne=($=N[w].nodes)==null?void 0:$.a)==null||ne.fix()}iu(a,N,I)}}n&&di(()=>{var B,W;if(f!==void 0)for(v of f)(W=(B=v.nodes)==null?void 0:B.a)==null||W.apply()})}function nu(a,r,e,t,i,n,s,h){var u=(s&ze)!==0?(s&jo)===0?$a(e,!1,!1):Ai(e):null,o=(s&Je)!==0?Ai(i):null;return{v:u,i:o,e:gt(()=>(n(r,u??e,o??i,h),()=>{a.delete(t)}))}}function wr(a,r,e){if(a.nodes)for(var t=a.nodes.start,i=a.nodes.end,n=r&&(r.f&ai)===0?r.nodes.start:e;t!==null;){var s=jt(t);if(n.before(t),t===i)return;t=s}}function vi(a,r,e){r===null?a.effect.first=e:r.next=e,e===null?a.effect.last=r:e.prev=r}function Hi(a,r,e=!1,t=!1,i=!1){var n=a,s="";ke(()=>{var h=Ie;if(s===(s=r()??"")){Te&&Pi();return}if(h.nodes!==null&&(gs(h.nodes.start,h.nodes.end),h.nodes=null),s!==""){if(Te){Ee.data;for(var u=Pi(),o=u;u!==null&&(u.nodeType!==Si||u.data!=="");)o=u,u=jt(u);if(u===null)throw or(),Ti;xt(Ee,o),n=st(u);return}var l=s+"";e?l=`<svg>${l}</svg>`:t&&(l=`<math>${l}</math>`);var f=Vn(l);if((e||t)&&(f=ot(f)),xt(ot(f),f.lastChild),e||t)for(;ot(f);)n.before(ot(f));else n.before(f)}})}function au(a,r){var e=void 0,t;fs(()=>{e!==(e=r())&&(t&&(et(t),t=null),e&&(t=gt(()=>{Nn(()=>e(a))})))})}function Hs(a){var r,e,t="";if(typeof a=="string"||typeof a=="number")t+=a;else if(typeof a=="object")if(Array.isArray(a)){var i=a.length;for(r=0;r<i;r++)a[r]&&(e=Hs(a[r]))&&(t&&(t+=" "),t+=e)}else for(e in a)a[e]&&(t&&(t+=" "),t+=e);return t}function su(){for(var a,r,e=0,t="",i=arguments.length;e<i;e++)(a=arguments[e])&&(r=Hs(a))&&(t&&(t+=" "),t+=r);return t}function Zn(a){return typeof a=="object"?su(a):a??""}const Fs=[...`
3
- \r\f \v\uFEFF`];function ou(a,r,e){var t=a==null?"":""+a;if(e){for(var i in e)if(e[i])t=t?t+" "+i:i;else if(t.length)for(var n=i.length,s=0;(s=t.indexOf(i,s))>=0;){var h=s+n;(s===0||Fs.includes(t[s-1]))&&(h===t.length||Fs.includes(t[h]))?t=(s===0?"":t.substring(0,s))+t.substring(h+1):s=h}}return t===""?null:t}function Ns(a,r=!1){var e=r?" !important;":";",t="";for(var i in a){var n=a[i];n!=null&&n!==""&&(t+=" "+i+": "+n+e)}return t}function Wn(a){return a[0]!=="-"||a[1]!=="-"?a.toLowerCase():a}function lu(a,r){if(r){var e="",t,i;if(Array.isArray(r)?(t=r[0],i=r[1]):t=r,a){a=String(a).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var n=!1,s=0,h=!1,u=[];t&&u.push(...Object.keys(t).map(Wn)),i&&u.push(...Object.keys(i).map(Wn));var o=0,l=-1;const d=a.length;for(var f=0;f<d;f++){var c=a[f];if(h?c==="/"&&a[f-1]==="*"&&(h=!1):n?n===c&&(n=!1):c==="/"&&a[f+1]==="*"?h=!0:c==='"'||c==="'"?n=c:c==="("?s++:c===")"&&s--,!h&&n===!1&&s===0){if(c===":"&&l===-1)l=f;else if(c===";"||f===d-1){if(l!==-1){var p=Wn(a.substring(o,l).trim());if(!u.includes(p)){c!==";"&&f++;var _=a.substring(o,f).trim();e+=" "+_+";"}}o=f+1,l=-1}}}}return t&&(e+=Ns(t)),i&&(e+=Ns(i,!0)),e=e.trim(),e===""?null:e}return a==null?null:String(a)}function je(a,r,e,t,i,n){var s=a.__className;if(Te||s!==e||s===void 0){var h=ou(e,t,n);(!Te||h!==a.getAttribute("class"))&&(h==null?a.removeAttribute("class"):r?a.className=h:a.setAttribute("class",h)),a.__className=e}else if(n&&i!==n)for(var u in n){var o=!!n[u];(i==null||o!==!!i[u])&&a.classList.toggle(u,o)}return n}function qn(a,r={},e,t){for(var i in e){var n=e[i];r[i]!==n&&(e[i]==null?a.style.removeProperty(i):a.style.setProperty(i,n,t))}}function Tr(a,r,e,t){var i=a.__style;if(Te||i!==r){var n=lu(r,t);(!Te||n!==a.getAttribute("style"))&&(n==null?a.removeAttribute("style"):a.style.cssText=n),a.__style=r}else t&&(Array.isArray(t)?(qn(a,e==null?void 0:e[0],t[0]),qn(a,e==null?void 0:e[1],t[1],"important")):qn(a,e,t));return t}function Xn(a,r,e=!1){if(a.multiple){if(r==null)return;if(!bn(r))return hl();for(var t of a.options)t.selected=r.includes(Bs(t));return}for(t of a.options){var i=Bs(t);if(Al(i,r)){t.selected=!0;return}}(!e||r!==void 0)&&(a.selectedIndex=-1)}function uu(a){var r=new MutationObserver(()=>{Xn(a,a.__value)});r.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Fn(()=>{r.disconnect()})}function Bs(a){return"__value"in a?a.__value:a.value}const Er=Symbol("class"),xr=Symbol("style"),zs=Symbol("is custom element"),ks=Symbol("is html");function Vs(a){if(Te){var r=!1,e=()=>{if(!r){if(r=!0,a.hasAttribute("value")){var t=a.value;Me(a,"value",null),a.value=t}if(a.hasAttribute("checked")){var i=a.checked;Me(a,"checked",null),a.checked=i}}};a.__on_r=e,di(e),us()}}function hu(a,r){r?a.hasAttribute("selected")||a.setAttribute("selected",""):a.removeAttribute("selected")}function Me(a,r,e,t){var i=Us(a);Te&&(i[r]=a.getAttribute(r),r==="src"||r==="srcset"||r==="href"&&a.nodeName==="LINK")||i[r]!==(i[r]=e)&&(r==="loading"&&(a[$o]=e),e==null?a.removeAttribute(r):typeof e!="string"&&js(a).includes(r)?a[r]=e:a.setAttribute(r,e))}function cu(a,r,e,t,i=!1,n=!1){if(Te&&i&&a.tagName==="INPUT"){var s=a,h=s.type==="checkbox"?"defaultChecked":"defaultValue";h in e||Vs(s)}var u=Us(a),o=u[zs],l=!u[ks];let f=Te&&o;f&&Ut(!1);var c=r||{},p=a.tagName==="OPTION";for(var _ in r)_ in e||(e[_]=null);e.class?e.class=Zn(e.class):e[Er]&&(e.class=null),e[xr]&&(e.style??(e.style=null));var d=js(a);for(const F in e){let N=e[F];if(p&&F==="value"&&N==null){a.value=a.__value="",c[F]=N;continue}if(F==="class"){var v=a.namespaceURI==="http://www.w3.org/1999/xhtml";je(a,v,N,t,r==null?void 0:r[Er],e[Er]),c[F]=N,c[Er]=e[Er];continue}if(F==="style"){Tr(a,N,r==null?void 0:r[xr],e[xr]),c[F]=N,c[xr]=e[xr];continue}var w=c[F];if(!(N===w&&!(N===void 0&&a.hasAttribute(F)))){c[F]=N;var S=F[0]+F[1];if(S!=="$$")if(S==="on"){const z={},I="$$"+F;let D=F.slice(2);var R=Wl(D);if(jl(D)&&(D=D.slice(0,-7),z.capture=!0),!R&&w){if(N!=null)continue;a.removeEventListener(D,c[I],z),c[I]=null}if(N!=null)if(R)a[`__${D}`]=N,Mi([D]);else{let H=function(k){c[F].call(this,k)};c[I]=Is(D,a,H,z)}else R&&(a[`__${D}`]=void 0)}else if(F==="style")Me(a,F,N);else if(F==="autofocus")Il(a,!!N);else if(!o&&(F==="__value"||F==="value"&&N!=null))a.value=a.__value=N;else if(F==="selected"&&p)hu(a,N);else{var P=F;l||(P=Xl(P));var A=P==="defaultValue"||P==="defaultChecked";if(N==null&&!o&&!A)if(u[F]=null,P==="value"||P==="checked"){let z=a;const I=r===void 0;if(P==="value"){let D=z.defaultValue;z.removeAttribute(P),z.defaultValue=D,z.value=z.__value=I?D:null}else{let D=z.defaultChecked;z.removeAttribute(P),z.defaultChecked=D,z.checked=I?D:!1}}else a.removeAttribute(F);else A||d.includes(P)&&(o||typeof N!="string")?(a[P]=N,P in u&&(u[P]=it)):typeof N!="function"&&Me(a,P,N)}}}return f&&Ut(!0),c}function St(a,r,e=[],t=[],i=[],n,s=!1,h=!1){Xa(i,e,t,u=>{var o=void 0,l={},f=a.nodeName==="SELECT",c=!1;if(fs(()=>{var _=r(...u.map(T)),d=cu(a,o,_,n,s,h);c&&f&&"value"in _&&Xn(a,_.value);for(let w of Object.getOwnPropertySymbols(l))_[w]||et(l[w]);for(let w of Object.getOwnPropertySymbols(_)){var v=_[w];w.description===qo&&(!o||v!==o[w])&&(l[w]&&et(l[w]),l[w]=gt(()=>au(a,()=>v))),d[w]=v}o=d}),f){var p=a;Nn(()=>{Xn(p,o.value,!0),uu(p)})}c=!0})}function Us(a){return a.__attributes??(a.__attributes={[zs]:a.nodeName.includes("-"),[ks]:a.namespaceURI===Wo})}var Gs=new Map;function js(a){var r=a.getAttribute("is")||a.nodeName,e=Gs.get(r);if(e)return e;Gs.set(r,e=[]);for(var t,i=a,n=Element.prototype;n!==i;){t=Da(i);for(var s in t)t[s].set&&e.push(s);i=Sn(i)}return e}function fu(a,r,e=r){var t=new WeakSet;Dl(a,"input",async i=>{var n=i?a.defaultValue:a.value;if(n=Yn(a)?Kn(n):n,e(n),Se!==null&&t.add(Se),await kl(),n!==(n=r())){var s=a.selectionStart,h=a.selectionEnd,u=a.value.length;if(a.value=n??"",h!==null){var o=a.value.length;s===h&&h===u&&o>u?(a.selectionStart=o,a.selectionEnd=o):(a.selectionStart=s,a.selectionEnd=Math.min(h,o))}}}),(Te&&a.defaultValue!==a.value||mr(r)==null&&a.value)&&(e(Yn(a)?Kn(a.value):a.value),Se!==null&&t.add(Se)),sn(()=>{var i=r();if(a===document.activeElement){var n=tn??Se;if(t.has(n))return}Yn(a)&&i===Kn(a.value)||a.type==="date"&&!i&&!a.value||i!==a.value&&(a.value=i??"")})}function Yn(a){var r=a.type;return r==="number"||r==="range"}function Kn(a){return a===""?null:+a}function Zs(a,r){return a===r||(a==null?void 0:a[fi])===r}function Ws(a={},r,e,t){return Nn(()=>{var i,n;return sn(()=>{i=n,n=[],mr(()=>{a!==e(...n)&&(r(a,...n),i&&Zs(e(...i),a)&&r(null,...i))})}),()=>{di(()=>{n&&Zs(e(...n),a)&&r(null,...n)})}}),a}function du(a=!1){const r=He,e=r.l.u;if(!e)return;let t=()=>Ul(r.s);if(a){let i=0,n={};const s=hr(()=>{let h=!1;const u=r.s;for(const o in u)u[o]!==n[o]&&(n[o]=u[o],h=!0);return h&&i++,i});t=()=>T(s)}e.b.length&&Ll(()=>{qs(r,t),Pn(e.b)}),si(()=>{const i=mr(()=>e.m.map(Qo));return()=>{for(const n of i)typeof n=="function"&&n()}}),e.a.length&&si(()=>{qs(r,t),Pn(e.a)})}function qs(a,r){if(a.l.s)for(const e of a.l.s)T(e);r()}const pu={get(a,r){if(!a.exclude.includes(r))return a.props[r]},set(a,r){return!1},getOwnPropertyDescriptor(a,r){if(!a.exclude.includes(r)&&r in a.props)return{enumerable:!0,configurable:!0,value:a.props[r]}},has(a,r){return a.exclude.includes(r)?!1:r in a.props},ownKeys(a){return Reflect.ownKeys(a.props).filter(r=>!a.exclude.includes(r))}};function Pt(a,r,e){return new Proxy({props:a,exclude:r},pu)}function gu(a,r,e,t){var i=t,n=!0,s=()=>(n&&(n=!1,i=t),i),h;h=a[r],h===void 0&&t!==void 0&&(h=s());var u;u=()=>{var c=a[r];return c===void 0?s():(n=!0,c)};var o=!1,l=hr(()=>(o=!1,u())),f=Ie;return(function(c,p){if(arguments.length>0){const _=p?T(l):c;return me(l,_),o=!0,i!==void 0&&(i=_),c}return Oi&&o||(f.f&ni)!==0?l.v:T(l)})}function vu(a){return new mu(a)}class mu{constructor(r){ge(this,ui);ge(this,zt);var n;var e=new Map,t=(s,h)=>{var u=$a(h,!1,!1);return e.set(s,u),u};const i=new Proxy({...r.props||{},$$events:{}},{get(s,h){return T(e.get(h)??t(h,Reflect.get(s,h)))},has(s,h){return h===Jo?!0:(T(e.get(h)??t(h,Reflect.get(s,h))),Reflect.has(s,h))},set(s,h,u){return me(e.get(h)??t(h,u),u),Reflect.set(s,h,u)}});_e(this,zt,(r.hydrate?Ql:Os)(r.component,{target:r.target,anchor:r.anchor,props:i,context:r.context,intro:r.intro??!1,recover:r.recover})),(!((n=r==null?void 0:r.props)!=null&&n.$$host)||r.sync===!1)&&On(),_e(this,ui,i.$$events);for(const s of Object.keys(L(this,zt)))s==="$set"||s==="$destroy"||s==="$on"||Xr(this,s,{get(){return L(this,zt)[s]},set(h){L(this,zt)[s]=h},enumerable:!0});L(this,zt).$set=s=>{Object.assign(i,s)},L(this,zt).$destroy=()=>{Jl(L(this,zt))}}$set(r){L(this,zt).$set(r)}$on(r,e){L(this,ui)[r]=L(this,ui)[r]||[];const t=(...i)=>e.call(this,...i);return L(this,ui)[r].push(t),()=>{L(this,ui)[r]=L(this,ui)[r].filter(i=>i!==t)}}$destroy(){L(this,zt).$destroy()}}ui=new WeakMap,zt=new WeakMap;let Xs;typeof HTMLElement=="function"&&(Xs=class extends HTMLElement{constructor(r,e,t){super();Qe(this,"$$ctor");Qe(this,"$$s");Qe(this,"$$c");Qe(this,"$$cn",!1);Qe(this,"$$d",{});Qe(this,"$$r",!1);Qe(this,"$$p_d",{});Qe(this,"$$l",{});Qe(this,"$$l_u",new Map);Qe(this,"$$me");this.$$ctor=r,this.$$s=e,t&&this.attachShadow({mode:"open"})}addEventListener(r,e,t){if(this.$$l[r]=this.$$l[r]||[],this.$$l[r].push(e),this.$$c){const i=this.$$c.$on(r,e);this.$$l_u.set(e,i)}super.addEventListener(r,e,t)}removeEventListener(r,e,t){if(super.removeEventListener(r,e,t),this.$$c){const i=this.$$l_u.get(e);i&&(i(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let r=function(i){return n=>{const s=document.createElement("slot");i!=="default"&&(s.name=i),C(n,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const e={},t=_u(this);for(const i of this.$$s)i in t&&(i==="default"&&!this.$$d.children?(this.$$d.children=r(i),e.default=!0):e[i]=r(i));for(const i of this.attributes){const n=this.$$g_p(i.name);n in this.$$d||(this.$$d[n]=hn(n,i.value,this.$$p_d,"toProp"))}for(const i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=vu({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=Ml(()=>{sn(()=>{var i;this.$$r=!0;for(const n of qr(this.$$c)){if(!((i=this.$$p_d[n])!=null&&i.reflect))continue;this.$$d[n]=this.$$c[n];const s=hn(n,this.$$d[n],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[n].attribute||n):this.setAttribute(this.$$p_d[n].attribute||n,s)}this.$$r=!1})});for(const i in this.$$l)for(const n of this.$$l[i]){const s=this.$$c.$on(i,n);this.$$l_u.set(n,s)}this.$$l={}}}attributeChangedCallback(r,e,t){var i;this.$$r||(r=this.$$g_p(r),this.$$d[r]=hn(r,t,this.$$p_d,"toProp"),(i=this.$$c)==null||i.$set({[r]:this.$$d[r]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(r){return qr(this.$$p_d).find(e=>this.$$p_d[e].attribute===r||!this.$$p_d[e].attribute&&e.toLowerCase()===r)||r}});function hn(a,r,e,t){var n;const i=(n=e[a])==null?void 0:n.type;if(r=i==="Boolean"&&typeof r!="boolean"?r!=null:r,!t||!e[a])return r;if(t==="toAttribute")switch(i){case"Object":case"Array":return r==null?null:JSON.stringify(r);case"Boolean":return r?"":null;case"Number":return r??null;default:return r}else switch(i){case"Object":case"Array":return r&&JSON.parse(r);case"Boolean":return r;case"Number":return r!=null?+r:r;default:return r}}function _u(a){const r={};return a.childNodes.forEach(e=>{r[e.slot||"default"]=!0}),r}function yu(a,r,e,t,i,n){let s=class extends Xs{constructor(){super(a,e,i),this.$$p_d=r}static get observedAttributes(){return qr(r).map(h=>(r[h].attribute||h).toLowerCase())}};return qr(r).forEach(h=>{Xr(s.prototype,h,{get(){return this.$$c&&h in this.$$c?this.$$c[h]:this.$$d[h]},set(u){var f;u=hn(h,u,r),this.$$d[h]=u;var o=this.$$c;if(o){var l=(f=ji(o,h))==null?void 0:f.get;l?o[h]=u:o.$set({[h]:u})}}})}),t.forEach(h=>{Xr(s.prototype,h,{get(){var u;return(u=this.$$c)==null?void 0:u[h]}})}),a.element=s,s}var Ys=(function(){function a(r){this.__jsonld=r,this.context=this.getProperty("context"),this.id=this.getProperty("id")}return a.prototype.getProperty=function(r){var e=null;return this.__jsonld&&(e=this.__jsonld[r],e||(e=this.__jsonld["@"+r])),e},a})(),cn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qn(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}function wu(a){if(Object.prototype.hasOwnProperty.call(a,"__esModule"))return a;var r=a.default;if(typeof r=="function"){var e=function t(){return this instanceof t?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};e.prototype=r.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(a).forEach(function(t){var i=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return a[t]}})}),e}var Ze={},Ks;function Tu(){if(Ks)return Ze;Ks=1,Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.ViewingHint=Ze.ViewingDirection=Ze.ServiceType=Ze.ServiceProfile=Ze.RenderingFormat=Ze.MediaType=Ze.IIIFResourceType=Ze.ExternalResourceType=Ze.Behavior=Ze.AnnotationMotivation=void 0;var a;(function(l){l.BOOKMARKING="oa:bookmarking",l.CLASSIFYING="oa:classifying",l.COMMENTING="oa:commenting",l.DESCRIBING="oa:describing",l.EDITING="oa:editing",l.HIGHLIGHTING="oa:highlighting",l.IDENTIFYING="oa:identifying",l.LINKING="oa:linking",l.MODERATING="oa:moderating",l.PAINTING="sc:painting",l.QUESTIONING="oa:questioning",l.REPLYING="oa:replying",l.TAGGING="oa:tagging",l.TRANSCRIBING="oad:transcribing"})(a||(Ze.AnnotationMotivation=a={}));var r;(function(l){l.AUTO_ADVANCE="auto-advance",l.CONTINUOUS="continuous",l.FACING_PAGES="facing-pages",l.HIDDEN="hidden",l.INDIVIDUALS="individuals",l.MULTI_PART="multi-part",l.NO_NAV="no-nav",l.NON_PAGED="non-paged",l.PAGED="paged",l.REPEAT="repeat",l.SEQUENCE="sequence",l.THUMBNAIL_NAV="thumbnail-nav",l.TOGETHER="together",l.UNORDERED="unordered"})(r||(Ze.Behavior=r={}));var e;(function(l){l.CANVAS="canvas",l.CHOICE="choice",l.OA_CHOICE="oa:choice",l.CONTENT_AS_TEXT="contentastext",l.DATASET="dataset",l.DOCUMENT="document",l.IMAGE="image",l.MODEL="model",l.MOVING_IMAGE="movingimage",l.PDF="pdf",l.PHYSICAL_OBJECT="physicalobject",l.SOUND="sound",l.TEXT="text",l.TEXTUALBODY="textualbody",l.VIDEO="video"})(e||(Ze.ExternalResourceType=e={}));var t;(function(l){l.ANNOTATION="annotation",l.ANNOTATION_COLLECTION="annotationcollection",l.ANNOTATION_PAGE="annotationpage",l.CANVAS="canvas",l.COLLECTION="collection",l.MANIFEST="manifest",l.RANGE="range",l.SEQUENCE="sequence"})(t||(Ze.IIIFResourceType=t={}));var i;(function(l){l.APNG="image/apng",l.AUDIO_MP4="audio/mp4",l.AUDIO_OGG="audio/ogg",l.AVIF="audio/avif",l.CORTO="application/corto",l.DICOM="application/dicom",l.DRACO="application/draco",l.EPUB="application/epub+zip",l.GIF="image/gif",l.GIRDER="image/vnd.kitware.girder",l.GLB="model/gltf-binary",l.GLTF="model/gltf+json",l.IIIF_PRESENTATION_2='application/ld+json;profile="http://iiif.io/api/presentation/2/context.json"',l.IIIF_PRESENTATION_3='application/ld+json;profile="http://iiif.io/api/presentation/3/context.json"',l.JPG="image/jpeg",l.M3U8="application/vnd.apple.mpegurl",l.MP3="audio/mp3",l.MPEG="audio/mpeg",l.MPEG_DASH="application/dash+xml",l.OBJ="model/obj",l.OPF="application/oebps-package+xml",l.PDF="application/pdf",l.PLY="application/ply",l.PNG="image/png",l.SVG="image/svg+xml",l.THREEJS="application/vnd.threejs+json",l.USDZ="model/vnd.usd+zip",l.VIDEO_MP4="video/mp4",l.VIDEO_OGG="video/ogg",l.WAV="audio/wav",l.WEBM="video/webm",l.WEBP="image/webp"})(i||(Ze.MediaType=i={}));var n;(function(l){l.DOC="application/msword",l.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",l.ODT="application/vnd.oasis.opendocument.text",l.PDF="application/pdf"})(n||(Ze.RenderingFormat=n={}));var s;(function(l){l.IMAGE_0_COMPLIANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/compliance.html#level0",l.IMAGE_0_COMPLIANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/compliance.html#level1",l.IMAGE_0_COMPLIANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/compliance.html#level2",l.IMAGE_0_CONFORMANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/conformance.html#level0",l.IMAGE_0_CONFORMANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/conformance.html#level1",l.IMAGE_0_CONFORMANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/conformance.html#level2",l.IMAGE_1_COMPLIANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",l.IMAGE_1_COMPLIANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",l.IMAGE_1_COMPLIANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",l.IMAGE_1_CONFORMANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",l.IMAGE_1_CONFORMANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",l.IMAGE_1_CONFORMANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",l.IMAGE_1_LEVEL_0="http://iiif.io/api/image/1/level0.json",l.IMAGE_1_PROFILE_LEVEL_0="http://iiif.io/api/image/1/profiles/level0.json",l.IMAGE_1_LEVEL_1="http://iiif.io/api/image/1/level1.json",l.IMAGE_1_PROFILE_LEVEL_1="http://iiif.io/api/image/1/profiles/level1.json",l.IMAGE_1_LEVEL_2="http://iiif.io/api/image/1/level2.json",l.IMAGE_1_PROFILE_LEVEL_2="http://iiif.io/api/image/1/profiles/level2.json",l.IMAGE_2_LEVEL_0="http://iiif.io/api/image/2/level0.json",l.IMAGE_2_PROFILE_LEVEL_0="http://iiif.io/api/image/2/profiles/level0.json",l.IMAGE_2_LEVEL_1="http://iiif.io/api/image/2/level1.json",l.IMAGE_2_PROFILE_LEVEL_1="http://iiif.io/api/image/2/profiles/level1.json",l.IMAGE_2_LEVEL_2="http://iiif.io/api/image/2/level2.json",l.IMAGE_2_PROFILE_LEVEL_2="http://iiif.io/api/image/2/profiles/level2.json",l.AUTH_0_CLICK_THROUGH="http://iiif.io/api/auth/0/login/clickthrough",l.AUTH_0_LOGIN="http://iiif.io/api/auth/0/login",l.AUTH_0_LOGOUT="http://iiif.io/api/auth/0/logout",l.AUTH_0_RESTRICTED="http://iiif.io/api/auth/0/login/restricted",l.AUTH_0_TOKEN="http://iiif.io/api/auth/0/token",l.AUTH_1_CLICK_THROUGH="http://iiif.io/api/auth/1/clickthrough",l.AUTH_1_EXTERNAL="http://iiif.io/api/auth/1/external",l.AUTH_1_KIOSK="http://iiif.io/api/auth/1/kiosk",l.AUTH_1_LOGIN="http://iiif.io/api/auth/1/login",l.AUTH_1_LOGOUT="http://iiif.io/api/auth/1/logout",l.AUTH_1_PROBE="http://iiif.io/api/auth/1/probe",l.AUTH_1_TOKEN="http://iiif.io/api/auth/1/token",l.SEARCH_0="http://iiif.io/api/search/0/search",l.SEARCH_0_AUTO_COMPLETE="http://iiif.io/api/search/0/autocomplete",l.SEARCH_1="http://iiif.io/api/search/1/search",l.SEARCH_1_AUTO_COMPLETE="http://iiif.io/api/search/1/autocomplete",l.SEARCH_2="http://iiif.io/api/search/2/search",l.SEARCH_2_AUTO_COMPLETE="http://iiif.io/api/search/2/autocomplete",l.TRACKING_EXTENSIONS="http://universalviewer.io/tracking-extensions-profile",l.UI_EXTENSIONS="http://universalviewer.io/ui-extensions-profile",l.PRINT_EXTENSIONS="http://universalviewer.io/print-extensions-profile",l.SHARE_EXTENSIONS="http://universalviewer.io/share-extensions-profile",l.DOWNLOAD_EXTENSIONS="http://universalviewer.io/download-extensions-profile",l.OTHER_MANIFESTATIONS="http://iiif.io/api/otherManifestations.json",l.IXIF="http://wellcomelibrary.org/ld/ixif/0/alpha.json"})(s||(Ze.ServiceProfile=s={}));var h;(function(l){l.IMAGE_SERVICE_2="ImageService2",l.IMAGE_SERVICE_3="ImageService3",l.SEARCH_SERVICE_2="SearchService2",l.AUTO_COMPLETE_SERVICE_2="AutoCompleteService2"})(h||(Ze.ServiceType=h={}));var u;(function(l){l.BOTTOM_TO_TOP="bottom-to-top",l.LEFT_TO_RIGHT="left-to-right",l.RIGHT_TO_LEFT="right-to-left",l.TOP_TO_BOTTOM="top-to-bottom"})(u||(Ze.ViewingDirection=u={}));var o;return(function(l){l.CONTINUOUS="continuous",l.INDIVIDUALS="individuals",l.NON_PAGED="non-paged",l.PAGED="paged",l.TOP="top"})(o||(Ze.ViewingHint=o={})),Ze}var ae=Tu(),Eu=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})(),oi=(function(a){Eu(r,a);function r(e,t){var i=a.call(this,e)||this;return i.options=t,i}return r.prototype.getIIIFResourceType=function(){return xe.normaliseType(this.getProperty("type"))},r.prototype.getLabel=function(){var e=this.getProperty("label");return e?Ft.parse(e,this.options.locale):new Ft([],this.options.locale)},r.prototype.getDefaultLabel=function(){return this.getLabel().getValue(this.options.locale)},r.prototype.getMetadata=function(){var e=this.getProperty("metadata"),t=[];if(!e)return t;for(var i=0;i<e.length;i++){var n=e[i],s=new gn(this.options.locale);s.parse(n),t.push(s)}return t},r.prototype.getRendering=function(e){for(var t=this.getRenderings(),i=0;i<t.length;i++){var n=t[i];if(n.getFormat()===e)return n}return null},r.prototype.getRenderings=function(){var e;this.__jsonld?e=this.__jsonld.rendering:e=this.rendering;var t=[];if(!e)return t;Array.isArray(e)||(e=[e]);for(var i=0;i<e.length;i++){var n=e[i];t.push(new rh(n,this.options))}return t},r.prototype.getRequiredStatement=function(){var e=null,t=this.getProperty("requiredStatement");return t&&(e=new gn(this.options.locale),e.parse(t)),e},r.prototype.getService=function(e){return xe.getService(this,e)},r.prototype.getServices=function(){return xe.getServices(this)},r.prototype.getThumbnail=function(){var e=this.getProperty("thumbnail");return Array.isArray(e)&&(e=e[0]),e?new uh(e,this.options):null},r.prototype.isAnnotation=function(){return this.getIIIFResourceType()===ae.IIIFResourceType.ANNOTATION},r.prototype.isCanvas=function(){return this.getIIIFResourceType()===ae.IIIFResourceType.CANVAS},r.prototype.isCollection=function(){return this.getIIIFResourceType()===ae.IIIFResourceType.COLLECTION},r.prototype.isManifest=function(){return this.getIIIFResourceType()===ae.IIIFResourceType.MANIFEST},r.prototype.isRange=function(){return this.getIIIFResourceType()===ae.IIIFResourceType.RANGE},r.prototype.isSequence=function(){return this.getIIIFResourceType()===ae.IIIFResourceType.SEQUENCE},r})(Ys),xu=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})(),Jn=(function(a){xu(r,a);function r(e,t){return a.call(this,e,t)||this}return r.prototype.getFormat=function(){var e=this.getProperty("format");return e?e.toLowerCase():null},r.prototype.getResources=function(){var e=[];if(!this.__jsonld.resources)return e;for(var t=0;t<this.__jsonld.resources.length;t++){var i=this.__jsonld.resources[t],n=new fn(i,this.options);e.push(n)}return e},r.prototype.getType=function(){var e=this.getProperty("type");return e?xe.normaliseType(e):null},r.prototype.getWidth=function(){return this.getProperty("width")},r.prototype.getHeight=function(){return this.getProperty("height")},r.prototype.getMaxWidth=function(){return this.getProperty("maxWidth")},r.prototype.getMaxHeight=function(){var e=this.getProperty("maxHeight");return e?null:this.getMaxWidth()},r})(oi),bu=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})(),Qs=(function(a){bu(r,a);function r(e,t){var i=a.call(this,e,t)||this;i.index=-1,i.isLoaded=!1;var n={defaultLabel:"-",locale:"en-GB",resource:i,pessimisticAccessControl:!1};return i.options=Object.assign(n,t),i}return r.prototype.getAttribution=function(){var e=this.getProperty("attribution");return e?Ft.parse(e,this.options.locale):new Ft([],this.options.locale)},r.prototype.getDescription=function(){var e=this.getProperty("description");return e===void 0&&(e=this.getProperty("summary")),e?Ft.parse(e,this.options.locale):new Ft([],this.options.locale)},r.prototype.getSummary=function(){var e=this.getProperty("summary");return e===void 0&&(e=this.getProperty("description")),e?Ft.parse(e,this.options.locale):new Ft([],this.options.locale)},r.prototype.getHomepage=function(){var e=this.getProperty("homepage");return e?typeof e=="string"?e:(Array.isArray(e)&&e.length&&(e=e[0]),e["@id"]||e.id):null},r.prototype.getIIIFResourceType=function(){return xe.normaliseType(this.getProperty("type"))},r.prototype.getLogo=function(){var e=this.getProperty("logo");if(!e){var t=this.getProperty("provider");if(!t)return null;var i=t.find(function(n){return n.logo!==void 0});i&&i.logo!==void 0?e=i.logo:e=null}return e?typeof e=="string"?e:(Array.isArray(e)&&e.length&&(e=e[0]),e["@id"]||(e==null?void 0:e.id)):null},r.prototype.getLicense=function(){return xe.getLocalisedValue(this.getProperty("license"),this.options.locale)},r.prototype.getRights=function(){var e=this.getProperty("rights");return e?typeof e=="string"?e:(Array.isArray(e)&&e.length&&(e=e[0]),e["@id"]||e.id):null},r.prototype.getNavDate=function(){return new Date(this.getProperty("navDate"))},r.prototype.getRelated=function(){return this.getProperty("related")},r.prototype.getSeeAlso=function(){return this.getProperty("seeAlso")},r.prototype.getTrackingLabel=function(){var e=this.getService(ae.ServiceProfile.TRACKING_EXTENSIONS);return e?e.getProperty("trackingLabel"):""},r.prototype.getDefaultTree=function(){return this.defaultTree=new Ta("root"),this.defaultTree.data=this,this.defaultTree},r.prototype.getRequiredStatement=function(){var e=null,t=this.getProperty("requiredStatement");if(t)e=new gn(this.options.locale),e.parse(t);else{var i=this.getAttribution();i&&i.length&&(e=new gn(this.options.locale),e.value=i)}return e},r.prototype.isCollection=function(){return this.getIIIFResourceType()===ae.IIIFResourceType.COLLECTION},r.prototype.isManifest=function(){return this.getIIIFResourceType()===ae.IIIFResourceType.MANIFEST},r.prototype.load=function(){var e=this;return new Promise(function(t){if(e.isLoaded)t(e);else{var i=e.options;i.navDate=e.getNavDate();var n=e.__jsonld.id;n||(n=e.__jsonld["@id"]),xe.loadManifest(n).then(function(s){e.parentLabel=e.getLabel().getValue(i.locale);var h=Eo.parse(s,i);e=Object.assign(e,h),e.index=i.index,t(e)})}})},r})(oi),Su=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})(),fn=(function(a){Su(r,a);function r(e,t){return a.call(this,e,t)||this}return r.prototype.getBody=function(){var e=[],t=this.getProperty("body");if(t)if(Array.isArray(t))for(var i=0;i<t.length;i++){var n=t[i];if(n.items)for(var s=0;s<n.items.length;s++){var h=n.items[s];e.push(new dn(h,this.options))}else e.push(new dn(n,this.options))}else if(t.items)for(var i=0;i<t.items.length;i++){var n=t.items[i];e.push(new dn(n,this.options))}else e.push(new dn(t,this.options));return e},r.prototype.getMotivation=function(){var e=this.getProperty("motivation");return e||null},r.prototype.getOn=function(){return this.getProperty("on")},r.prototype.getTarget=function(){return this.getProperty("target")},r.prototype.getResource=function(){return new Jn(this.getProperty("resource"),this.options)},r})(oi),Pu=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})(),dn=(function(a){Pu(r,a);function r(e,t){return a.call(this,e,t)||this}return r.prototype.getFormat=function(){var e=this.getProperty("format");return e?xe.getMediaType(e):null},r.prototype.getType=function(){var e=this.getProperty("type");return e?xe.normaliseType(this.getProperty("type")):null},r.prototype.getValue=function(){return this.getProperty("value")},r.prototype.getLanguage=function(){return this.getProperty("language")},r.prototype.getWidth=function(){return this.getProperty("width")},r.prototype.getHeight=function(){return this.getProperty("height")},r})(oi),Cu=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})(),Ru=(function(a){Cu(r,a);function r(e,t,i){var n=a.call(this,t)||this;return n.label=e,n.options=i,n}return r.prototype.getIIIFResourceType=function(){return xe.normaliseType(this.getProperty("type"))},r.prototype.getLabel=function(){return this.label},r.prototype.getResources=function(){var e=this,t=this.getProperty("resources");return t.map(function(i){return new fn(i,e.options)})},r.prototype.load=function(){var e=this;return new Promise(function(t,i){if(e.isLoaded)t(e);else{var n=e.__jsonld.id;n||(n=e.__jsonld["@id"]),xe.loadManifest(n).then(function(s){e.__jsonld=s,e.context=e.getProperty("context"),e.id=e.getProperty("id"),e.isLoaded=!0,t(e)}).catch(i)}})},r})(Ys),Au=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})(),Js=(function(a){Au(r,a);function r(e,t){return a.call(this,e,t)||this}return r.prototype.getItems=function(){return this.getProperty("items")},r.prototype.getAnnotations=function(){var e=[],t=this.getProperty("items");if(!t||!Array.isArray(t))return e;for(var i=0;i<t.length;i++){var n=new fn(t[i],this.options);e.push(n)}return e},r})(oi),$n,$s;function Iu(){if($s)return $n;$s=1;function a(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}return $n=a,$n}var ea,eo;function Du(){if(eo)return ea;eo=1;var a=typeof cn=="object"&&cn&&cn.Object===Object&&cn;return ea=a,ea}var ta,to;function Ou(){if(to)return ta;to=1;var a=Du(),r=typeof self=="object"&&self&&self.Object===Object&&self,e=a||r||Function("return this")();return ta=e,ta}var ia,io;function ra(){if(io)return ia;io=1;var a=Ou(),r=a.Symbol;return ia=r,ia}var na,ro;function Lu(){if(ro)return na;ro=1;var a=ra(),r=Object.prototype,e=r.hasOwnProperty,t=r.toString,i=a?a.toStringTag:void 0;function n(s){var h=e.call(s,i),u=s[i];try{s[i]=void 0;var o=!0}catch{}var l=t.call(s);return o&&(h?s[i]=u:delete s[i]),l}return na=n,na}var aa,no;function Mu(){if(no)return aa;no=1;var a=Object.prototype,r=a.toString;function e(t){return r.call(t)}return aa=e,aa}var sa,ao;function Hu(){if(ao)return sa;ao=1;var a=ra(),r=Lu(),e=Mu(),t="[object Null]",i="[object Undefined]",n=a?a.toStringTag:void 0;function s(h){return h==null?h===void 0?i:t:n&&n in Object(h)?r(h):e(h)}return sa=s,sa}var oa,so;function oo(){if(so)return oa;so=1;function a(r){return r!=null&&typeof r=="object"}return oa=a,oa}var la,lo;function Fu(){if(lo)return la;lo=1;var a=Hu(),r=oo(),e="[object Arguments]";function t(i){return r(i)&&a(i)==e}return la=t,la}var ua,uo;function Nu(){if(uo)return ua;uo=1;var a=Fu(),r=oo(),e=Object.prototype,t=e.hasOwnProperty,i=e.propertyIsEnumerable,n=a((function(){return arguments})())?a:function(s){return r(s)&&t.call(s,"callee")&&!i.call(s,"callee")};return ua=n,ua}var ha,ho;function Bu(){if(ho)return ha;ho=1;var a=Array.isArray;return ha=a,ha}var ca,co;function zu(){if(co)return ca;co=1;var a=ra(),r=Nu(),e=Bu(),t=a?a.isConcatSpreadable:void 0;function i(n){return e(n)||r(n)||!!(t&&n&&n[t])}return ca=i,ca}var fa,fo;function po(){if(fo)return fa;fo=1;var a=Iu(),r=zu();function e(t,i,n,s,h){var u=-1,o=t.length;for(n||(n=r),h||(h=[]);++u<o;){var l=t[u];i>0&&n(l)?i>1?e(l,i-1,n,s,h):a(h,l):s||(h[h.length]=l)}return h}return fa=e,fa}var da,go;function ku(){if(go)return da;go=1;var a=po();function r(e){var t=e==null?0:e.length;return t?a(e,1):[]}return da=r,da}var Vu=ku();const pa=Qn(Vu);var ga,vo;function Uu(){if(vo)return ga;vo=1;var a=po(),r=1/0;function e(t){var i=t==null?0:t.length;return i?a(t,r):[]}return ga=e,ga}var Gu=Uu();const mo=Qn(Gu);var ju=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})(),pn=(function(a){ju(r,a);function r(e,t){return a.call(this,e,t)||this}return r.prototype.getCanonicalImageUri=function(e){var t=null,i="full",n=0,s="default",h=e,u=h+",";if(this.externalResource&&this.externalResource.data&&this.externalResource.data["@id"])t=this.externalResource.data["@id"],h||(h=this.externalResource.data.width),this.externalResource.data["@context"]&&(this.externalResource.data["@context"].indexOf("/1.0/context.json")>-1||this.externalResource.data["@context"].indexOf("/1.1/context.json")>-1||this.externalResource.data["@context"].indexOf("/1/context.json")>-1)&&(s="native");else{var o=void 0;if(o=this.getImages(),o&&o.length){var l=o[0],f=l.getResource(),c=f.getServices();h||(h=f.getWidth());var p=c?c.find(function(S){return xe.isImageProfile(S.getProfile())||xe.isImageServiceType(S.getIIIFResourceType())}):null;if(p)t=p.id,s=xe.getImageQuality(p.getProfile());else if(h===f.getWidth())return f.id}if(o=this.getContent(),o&&o.length){var l=o[0],_=l.getBody(),d=_[0],c=d.getServices();h||(h=d.getWidth());var p=c?c.find(function(A){return xe.isImageServiceType(A.getIIIFResourceType())}):null;if(p)t=p.id,s=xe.getImageQuality(p.getProfile());else if(h===d.getWidth())return d.id}if(!t){var v=this.getProperty("thumbnail");if(v){if(typeof v=="string")return v;if(v["@id"])return v["@id"];if(v.length)return v[0].id}}}t&&t.endsWith("/")&&(t=t.substr(0,t.length-1));var w=[t,i,u,n,s+".jpg"].join("/");return w},r.prototype.getMaxDimensions=function(){var e=null,t;return this.externalResource&&this.externalResource.data&&this.externalResource.data.profile&&(t=this.externalResource.data.profile,Array.isArray(t)&&(t=t.filter(function(i){var n;return(n=i.maxWidth)!==null&&n!==void 0?n:i.maxwidth})[0],t&&(e=new sh(t.maxWidth,t.maxHeight?t.maxHeight:t.maxWidth)))),e},r.prototype.getContent=function(){var e=[],t=this.__jsonld.items||this.__jsonld.content;if(!t)return e;var i=null;if(t.length&&(i=new Js(t[0],this.options)),!i)return e;for(var n=i.getAnnotations(),s=0;s<n.length;s++){var h=n[s];e.push(h)}return e},r.prototype.getAnnotations=function(){var e=[],t=this.__jsonld.annotations;if(!t||!Array.isArray(t))return e;for(var i=0;i<t.length;i++){var n=new Js(t[i],this.options);e.push(n)}return e},r.prototype.getDuration=function(){return this.getProperty("duration")},r.prototype.getImages=function(){var e=[];if(!this.__jsonld.images)return e;for(var t=0;t<this.__jsonld.images.length;t++){var i=this.__jsonld.images[t],n=new fn(i,this.options);e.push(n)}return e},r.prototype.getIndex=function(){return this.getProperty("index")},r.prototype.getOtherContent=function(){var e=this,t=Array.isArray(this.getProperty("otherContent"))?this.getProperty("otherContent"):[this.getProperty("otherContent")],i=function(s,h){return typeof s!="string"?!1:s.toLowerCase()===s.toLowerCase()},n=t.filter(function(s){return s&&i(s["@type"])}).map(function(s,h){return new Ru(s.label||"Annotation list ".concat(h),s,e.options)}).map(function(s){return s.load()});return Promise.all(n)},r.prototype.getWidth=function(){return this.getProperty("width")},r.prototype.getHeight=function(){return this.getProperty("height")},r.prototype.getViewingHint=function(){var e=this.getProperty("viewingHint");return Array.isArray(e)&&(e=e[0]),e||null},Object.defineProperty(r.prototype,"imageResources",{get:function(){var e=this,t=mo([this.getImages().map(function(i){return i.getResource()}),this.getContent().map(function(i){return i.getBody()})]);return pa(t.map(function(i){switch(i.getProperty("type").toLowerCase()){case ae.ExternalResourceType.CHOICE:case ae.ExternalResourceType.OA_CHOICE:return new r({images:pa([i.getProperty("default"),i.getProperty("item")]).map(function(n){return{resource:n}})},e.options).getImages().map(function(n){return n.getResource()});default:return i}}))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"resourceAnnotations",{get:function(){return mo([this.getImages(),this.getContent()])},enumerable:!1,configurable:!0}),r.prototype.resourceAnnotation=function(e){return this.resourceAnnotations.find(function(t){return t.getResource().id===e||pa(new Array(t.getBody())).some(function(i){return i.id===e})})},r.prototype.onFragment=function(e){var t=this.resourceAnnotation(e);if(t){var i=t.getProperty("on"),n=t.getProperty("target");if(!(!i||!n)){var s=(i||n).match(/xywh=(.*)$/);if(s)return s[1].split(",").map(function(h){return parseInt(h,10)})}}},Object.defineProperty(r.prototype,"iiifImageResources",{get:function(){return this.imageResources.filter(function(e){return e&&e.getServices()[0]&&e.getServices()[0].id})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"imageServiceIds",{get:function(){return this.iiifImageResources.map(function(e){return e.getServices()[0].id})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"aspectRatio",{get:function(){return this.getWidth()/this.getHeight()},enumerable:!1,configurable:!0}),r})(Jn),Zu=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})(),Wu=(function(a){Zu(r,a);function r(e,t){var i=a.call(this,e,t)||this;return i.items=[],i._collections=null,i._manifests=null,e.__collection=i,i}return r.prototype.getCollections=function(){return this._collections?this._collections:this._collections=this.items.filter(function(e){return e.isCollection()})},r.prototype.getManifests=function(){return this._manifests?this._manifests:this._manifests=this.items.filter(function(e){return e.isManifest()})},r.prototype.getCollectionByIndex=function(e){for(var t=this.getCollections(),i,n=0;n<t.length;n++){var s=t[n];s.index===e&&(i=s)}if(i)return i.options.index=e,i.load();throw new Error("Collection index not found")},r.prototype.getManifestByIndex=function(e){for(var t=this.getManifests(),i,n=0;n<t.length;n++){var s=t[n];s.index===e&&(i=s)}if(i)return i.options.index=e,i.load();throw new Error("Manifest index not found")},r.prototype.getTotalCollections=function(){return this.getCollections().length},r.prototype.getTotalManifests=function(){return this.getManifests().length},r.prototype.getTotalItems=function(){return this.items.length},r.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")?this.getProperty("viewingDirection"):ae.ViewingDirection.LEFT_TO_RIGHT},r.prototype.getBehavior=function(){var e=this.getProperty("behavior");return Array.isArray(e)&&(e=e[0]),e||null},r.prototype.getViewingHint=function(){var e=this.getProperty("viewingHint");return Array.isArray(e)&&(e=e[0]),e||null},r.prototype.getDefaultTree=function(){return a.prototype.getDefaultTree.call(this),this.defaultTree.data.type=xe.normaliseType(Kt.COLLECTION),this._parseManifests(this),this._parseCollections(this),xe.generateTreeNodeIds(this.defaultTree),this.defaultTree},r.prototype._parseManifests=function(e){if(e.getManifests()&&e.getManifests().length)for(var t=0;t<e.getManifests().length;t++){var i=e.getManifests()[t],n=i.getDefaultTree();n.label=i.parentLabel||i.getLabel().getValue(this.options.locale)||"manifest "+(t+1),n.navDate=i.getNavDate(),n.data.id=i.id,n.data.type=xe.normaliseType(Kt.MANIFEST),e.defaultTree.addNode(n)}},r.prototype._parseCollections=function(e){if(e.getCollections()&&e.getCollections().length)for(var t=0;t<e.getCollections().length;t++){var i=e.getCollections()[t],n=i.getDefaultTree();n.label=i.parentLabel||i.getLabel().getValue(this.options.locale)||"collection "+(t+1),n.navDate=i.getNavDate(),n.data.id=i.id,n.data.type=xe.normaliseType(Kt.COLLECTION),e.defaultTree.addNode(n)}},r})(Qs),va=(function(){function a(r,e){this.start=r,this.end=e}return a.prototype.getLength=function(){return this.end-this.start},a})(),gn=(function(){function a(r){this.defaultLocale=r}return a.prototype.parse=function(r){this.resource=r,this.label=Ft.parse(this.resource.label,this.defaultLocale),this.value=Ft.parse(this.resource.value,this.defaultLocale)},a.prototype.getLabel=function(r){return this.label===null?null:(Array.isArray(r)&&!r.length&&(r=void 0),this.label.getValue(r||this.defaultLocale))},a.prototype.setLabel=function(r){this.label===null&&(this.label=new Ft([])),this.label.setValue(r,this.defaultLocale)},a.prototype.getValue=function(r,e){return e===void 0&&(e="<br/>"),this.value===null?null:(Array.isArray(r)&&!r.length&&(r=void 0),this.value.getValue(r||this.defaultLocale,e))},a.prototype.getValues=function(r){return this.value===null?[]:(Array.isArray(r)&&!r.length&&(r=void 0),this.value.getValues(r||this.defaultLocale))},a.prototype.setValue=function(r){this.value===null&&(this.value=new Ft([])),this.value.setValue(r,this.defaultLocale)},a})(),qu=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})();(function(a){qu(r,a);function r(){return a!==null&&a.apply(this,arguments)||this}return r.getValue=function(e,t){return e.getValue(t,"<br/>")},r.getValues=function(e,t){return e.getValues(t)},r})(Array);var he={},_o;function Xu(){return _o||(_o=1,Object.defineProperty(he,"__esModule",{value:!0}),he.CONTINUE=100,he.SWITCHING_PROTOCOLS=101,he.PROCESSING=102,he.OK=200,he.CREATED=201,he.ACCEPTED=202,he.NON_AUTHORITATIVE_INFORMATION=203,he.NO_CONTENT=204,he.RESET_CONTENT=205,he.PARTIAL_CONTENT=206,he.MULTI_STATUS=207,he.MULTIPLE_CHOICES=300,he.MOVED_PERMANENTLY=301,he.MOVED_TEMPORARILY=302,he.SEE_OTHER=303,he.NOT_MODIFIED=304,he.USE_PROXY=305,he.TEMPORARY_REDIRECT=307,he.BAD_REQUEST=400,he.UNAUTHORIZED=401,he.PAYMENT_REQUIRED=402,he.FORBIDDEN=403,he.NOT_FOUND=404,he.METHOD_NOT_ALLOWED=405,he.NOT_ACCEPTABLE=406,he.PROXY_AUTHENTICATION_REQUIRED=407,he.REQUEST_TIME_OUT=408,he.CONFLICT=409,he.GONE=410,he.LENGTH_REQUIRED=411,he.PRECONDITION_FAILED=412,he.REQUEST_ENTITY_TOO_LARGE=413,he.REQUEST_URI_TOO_LARGE=414,he.UNSUPPORTED_MEDIA_TYPE=415,he.REQUESTED_RANGE_NOT_SATISFIABLE=416,he.EXPECTATION_FAILED=417,he.IM_A_TEAPOT=418,he.UNPROCESSABLE_ENTITY=422,he.LOCKED=423,he.FAILED_DEPENDENCY=424,he.UNORDERED_COLLECTION=425,he.UPGRADE_REQUIRED=426,he.PRECONDITION_REQUIRED=428,he.TOO_MANY_REQUESTS=429,he.REQUEST_HEADER_FIELDS_TOO_LARGE=431,he.INTERNAL_SERVER_ERROR=500,he.NOT_IMPLEMENTED=501,he.BAD_GATEWAY=502,he.SERVICE_UNAVAILABLE=503,he.GATEWAY_TIME_OUT=504,he.HTTP_VERSION_NOT_SUPPORTED=505,he.VARIANT_ALSO_NEGOTIATES=506,he.INSUFFICIENT_STORAGE=507,he.BANDWIDTH_LIMIT_EXCEEDED=509,he.NOT_EXTENDED=510,he.NETWORK_AUTHENTICATION_REQUIRED=511),he}var Ht=Xu();function Yu(a,r){return r=r||{},new Promise(function(e,t){var i=new XMLHttpRequest,n=[],s=[],h={},u=function(){return{ok:(i.status/100|0)==2,statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return n},entries:function(){return s},get:function(l){return h[l.toLowerCase()]},has:function(l){return l.toLowerCase()in h}}}};for(var o in i.open(r.method||"get",a,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(l,f,c){n.push(f=f.toLowerCase()),s.push([f,c]),h[f]=h[f]?h[f]+","+c:c}),e(u())},i.onerror=t,i.withCredentials=r.credentials=="include",r.headers)i.setRequestHeader(o,r.headers[o]);i.send(r.body||null)})}const yo=wu(Object.freeze(Object.defineProperty({__proto__:null,default:Yu},Symbol.toStringTag,{value:"Module"})));var ma,wo;function Ku(){return wo||(wo=1,ma=self.fetch||(self.fetch=yo.default||yo)),ma}Ku();var _a=function(a,r,e,t){function i(n){return n instanceof e?n:new e(function(s){s(n)})}return new(e||(e=Promise))(function(n,s){function h(l){try{o(t.next(l))}catch(f){s(f)}}function u(l){try{o(t.throw(l))}catch(f){s(f)}}function o(l){l.done?n(l.value):i(l.value).then(h,u)}o((t=t.apply(a,r||[])).next())})},ya=function(a,r){var e={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},t,i,n,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=h(0),s.throw=h(1),s.return=h(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function h(o){return function(l){return u([o,l])}}function u(o){if(t)throw new TypeError("Generator is already executing.");for(;s&&(s=0,o[0]&&(e=0)),e;)try{if(t=1,i&&(n=o[0]&2?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[o[0]&2,n.value]),o[0]){case 0:case 1:n=o;break;case 4:return e.label++,{value:o[1],done:!1};case 5:e.label++,i=o[1],o=[0];continue;case 7:o=e.ops.pop(),e.trys.pop();continue;default:if(n=e.trys,!(n=n.length>0&&n[n.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]<n[3])){e.label=o[1];break}if(o[0]===6&&e.label<n[1]){e.label=n[1],n=o;break}if(n&&e.label<n[2]){e.label=n[2],e.ops.push(o);break}n[2]&&e.ops.pop(),e.trys.pop();continue}o=r.call(a,e)}catch(l){o=[6,l],i=0}finally{t=n=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},xe=(function(){function a(){}return a.getMediaType=function(r){return r=r.toLowerCase(),r=r.split(";")[0],r.trim()},a.getImageQuality=function(r){return r===ae.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_1||r===ae.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_2||r===ae.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_1||r===ae.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_2||r===ae.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_1||r===ae.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_2||r===ae.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_1||r===ae.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_2||r===ae.ServiceProfile.IMAGE_1_LEVEL_1||r===ae.ServiceProfile.IMAGE_1_PROFILE_LEVEL_1||r===ae.ServiceProfile.IMAGE_1_LEVEL_2||r===ae.ServiceProfile.IMAGE_1_PROFILE_LEVEL_2?"native":"default"},a.getInexactLocale=function(r){return r.indexOf("-")!==-1?r.substr(0,r.indexOf("-")):r},a.getLocalisedValue=function(r,e){if(!Array.isArray(r))return r;for(var t=0;t<r.length;t++){var i=r[t],n=i["@language"];if(e===n)return i["@value"]}for(var s=e.substr(0,e.indexOf("-")),t=0;t<r.length;t++){var h=r[t],u=h["@language"];if(u===s)return h["@value"]}return null},a.generateTreeNodeIds=function(r,e){e===void 0&&(e=0);var t;r.parentNode?t=r.parentNode.id+"-"+e:t="0",r.id=t;for(var i=0;i<r.nodes.length;i++){var n=r.nodes[i];a.generateTreeNodeIds(n,i)}},a.normaliseType=function(r){if(r=(r||"").toLowerCase(),r.indexOf(":")!==-1){var e=r.split(":");return e[1]}return r},a.normaliseUrl=function(r){return r=r.substr(r.indexOf("://")),r.indexOf("#")!==-1&&(r=r.split("#")[0]),r},a.normalisedUrlsMatch=function(r,e){return a.normaliseUrl(r)===a.normaliseUrl(e)},a.isImageProfile=function(r){return!!(a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_0)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_1)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_2)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_0)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_2)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_0)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_1)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_2)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_1)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_2)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_LEVEL_0)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_PROFILE_LEVEL_0)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_LEVEL_1)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_PROFILE_LEVEL_1)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_LEVEL_2)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_PROFILE_LEVEL_2)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_2_LEVEL_0)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_2_PROFILE_LEVEL_0)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_2_LEVEL_1)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_2_PROFILE_LEVEL_1)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_2_LEVEL_2)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_2_PROFILE_LEVEL_2))},a.isImageServiceType=function(r){return r!==null&&r.toLowerCase()===ae.ServiceType.IMAGE_SERVICE_2.toLowerCase()||r===ae.ServiceType.IMAGE_SERVICE_3.toLowerCase()},a.isLevel0ImageProfile=function(r){return!!(a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_0)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_0)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_0)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_0)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_LEVEL_0)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_PROFILE_LEVEL_0)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_2_LEVEL_0)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_2_PROFILE_LEVEL_0))},a.isLevel1ImageProfile=function(r){return!!(a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_1)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_1)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_1)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_1)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_LEVEL_1)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_PROFILE_LEVEL_1)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_2_LEVEL_1)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_2_PROFILE_LEVEL_1))},a.isLevel2ImageProfile=function(r){return!!(a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_2)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_2)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_2)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_2)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_LEVEL_2)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_1_PROFILE_LEVEL_2)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_2_LEVEL_2)||a.normalisedUrlsMatch(r,ae.ServiceProfile.IMAGE_2_PROFILE_LEVEL_2))},a.parseManifest=function(r,e){return Eo.parse(r,e)},a.checkStatus=function(r){if(r.ok)return r;var e=new Error(r.statusText);return e.response=r,Promise.reject(e)},a.loadManifest=function(r){return new Promise(function(e,t){fetch(r).then(a.checkStatus).then(function(i){return i.json()}).then(function(i){e(i)}).catch(function(i){t()})})},a.loadExternalResourcesAuth1=function(r,e,t,i,n,s,h,u){return new Promise(function(o,l){var f=r.map(function(c){return a.loadExternalResourceAuth1(c,e,t,i,n,s,h,u)});Promise.all(f).then(function(){o(r)}).catch(function(c){l(c)})})},a.loadExternalResourceAuth1=function(r,e,t,i,n,s,h,u){return _a(this,void 0,void 0,function(){var o;return ya(this,function(l){switch(l.label){case 0:return[4,i(r)];case 1:return o=l.sent(),o?[4,r.getData(o)]:[3,6];case 2:return l.sent(),r.status!==Ht.OK?[3,3]:[2,r];case 3:return[4,a.doAuthChain(r,e,t,n,s,h,u)];case 4:l.sent(),l.label=5;case 5:if(r.status===Ht.OK||r.status===Ht.MOVED_TEMPORARILY)return[2,r];throw a.createAuthorizationFailedError();case 6:return[4,r.getData()];case 7:return l.sent(),r.status===Ht.MOVED_TEMPORARILY||r.status===Ht.UNAUTHORIZED?[4,a.doAuthChain(r,e,t,n,s,h,u)]:[3,9];case 8:l.sent(),l.label=9;case 9:if(r.status===Ht.OK||r.status===Ht.MOVED_TEMPORARILY)return[2,r];throw a.createAuthorizationFailedError()}})})},a.doAuthChain=function(r,e,t,i,n,s,h){return _a(this,void 0,void 0,function(){var u,o,l,f,c,p,_,d,d;return ya(this,function(v){switch(v.label){case 0:return r.isAccessControlled()?(u=r.externalService,u&&(u.options=r.options),o=r.kioskService,o&&(o.options=r.options),l=r.clickThroughService,l&&(l.options=r.options),f=r.loginService,f&&(f.options=r.options),!r.isResponseHandled&&r.status===Ht.MOVED_TEMPORARILY?[4,s(r)]:[3,2]):[2,r];case 1:return v.sent(),[2,r];case 2:return c=null,p=null,c=u,c?(p=c,[4,a.attemptResourceWithToken(r,t,c)]):[3,4];case 3:return v.sent(),[2,r];case 4:return c=o,c?(p=c,_=e(c),_?[4,i(_)]:[3,7]):[3,7];case 5:return v.sent(),[4,a.attemptResourceWithToken(r,t,c)];case 6:return v.sent(),[2,r];case 7:return c=l,c?(p=c,[4,n(r,c)]):[3,11];case 8:return d=v.sent(),d?[4,i(d)]:[3,11];case 9:return v.sent(),[4,a.attemptResourceWithToken(r,t,c)];case 10:return v.sent(),[2,r];case 11:return c=f,c?(p=c,[4,n(r,c)]):[3,15];case 12:return d=v.sent(),d?[4,i(d)]:[3,15];case 13:return v.sent(),[4,a.attemptResourceWithToken(r,t,c)];case 14:return v.sent(),[2,r];case 15:return p&&h(r,p),[2]}})})},a.attemptResourceWithToken=function(r,e,t){return _a(this,void 0,void 0,function(){var i,n;return ya(this,function(s){switch(s.label){case 0:return i=t.getService(ae.ServiceProfile.AUTH_1_TOKEN),i?[4,e(r,i)]:[3,3];case 1:return n=s.sent(),n&&n.accessToken?[4,r.getData(n)]:[3,3];case 2:return s.sent(),[2,r];case 3:return[2]}})})},a.loadExternalResourcesAuth09=function(r,e,t,i,n,s,h,u,o,l){return new Promise(function(f,c){var p=r.map(function(_){return a.loadExternalResourceAuth09(_,e,t,i,n,s,h,u,o,l)});Promise.all(p).then(function(){f(r)}).catch(function(_){c(_)})})},a.loadExternalResourceAuth09=function(r,e,t,i,n,s,h,u,o,l){return new Promise(function(f,c){l&&l.pessimisticAccessControl?r.getData().then(function(){r.isAccessControlled()?r.clickThroughService?(f(t(r)),f(i(r))):n(r).then(function(){s(r,!0).then(function(p){r.getData(p).then(function(){f(o(r))}).catch(function(_){c(a.createInternalServerError(_))})}).catch(function(p){c(a.createInternalServerError(p))})}).catch(function(p){c(a.createInternalServerError(p))}):f(r)}).catch(function(p){c(a.createInternalServerError(p))}):u(r,e).then(function(p){p?r.getData(p).then(function(){r.status===Ht.OK?f(o(r)):a.authorize(r,e,t,i,n,s,h,u).then(function(){f(o(r))}).catch(function(_){c(a.createAuthorizationFailedError())})}).catch(function(_){c(a.createAuthorizationFailedError())}):a.authorize(r,e,t,i,n,s,h,u).then(function(){f(o(r))}).catch(function(_){c(a.createAuthorizationFailedError())})}).catch(function(p){c(a.createAuthorizationFailedError())})})},a.createError=function(r,e){var t=new Error;return t.message=e,t.name=String(r),t},a.createAuthorizationFailedError=function(){return a.createError(br.AUTHORIZATION_FAILED,"Authorization failed")},a.createRestrictedError=function(){return a.createError(br.RESTRICTED,"Restricted")},a.createInternalServerError=function(r){return a.createError(br.INTERNAL_SERVER_ERROR,r)},a.authorize=function(r,e,t,i,n,s,h,u){return new Promise(function(o,l){r.getData().then(function(){r.isAccessControlled()?u(r,e).then(function(f){f?r.getData(f).then(function(){r.status===Ht.OK?o(r):a.showAuthInteraction(r,e,t,i,n,s,h,o,l)}).catch(function(c){l(a.createInternalServerError(c))}):s(r,!1).then(function(c){c?h(r,c,e).then(function(){r.getData(c).then(function(){r.status===Ht.OK?o(r):a.showAuthInteraction(r,e,t,i,n,s,h,o,l)}).catch(function(p){l(a.createInternalServerError(p))})}).catch(function(p){l(a.createInternalServerError(p))}):a.showAuthInteraction(r,e,t,i,n,s,h,o,l)})}).catch(function(f){l(a.createInternalServerError(f))}):o(r)})})},a.showAuthInteraction=function(r,e,t,i,n,s,h,u,o){r.status===Ht.MOVED_TEMPORARILY&&!r.isResponseHandled?u(r):r.clickThroughService&&!r.isResponseHandled?t(r).then(function(){s(r,!0).then(function(l){h(r,l,e).then(function(){r.getData(l).then(function(){u(r)}).catch(function(f){o(a.createInternalServerError(f))})}).catch(function(f){o(a.createInternalServerError(f))})}).catch(function(l){o(a.createInternalServerError(l))})}):n(r).then(function(){s(r,!0).then(function(l){h(r,l,e).then(function(){r.getData(l).then(function(){u(r)}).catch(function(f){o(a.createInternalServerError(f))})}).catch(function(f){o(a.createInternalServerError(f))})}).catch(function(l){o(a.createInternalServerError(l))})})},a.getService=function(r,e){for(var t=this.getServices(r),i=0;i<t.length;i++){var n=t[i];if(n.getProfile()===e)return n}return null},a.getResourceById=function(r,e){return a.traverseAndFind(r.__jsonld,"@id",e)},a.traverseAndFind=function(r,e,t){if(r.hasOwnProperty(e)&&r[e]===t)return r;for(var i=0;i<Object.keys(r).length;i++)if(typeof r[Object.keys(r)[i]]=="object"){var n=a.traverseAndFind(r[Object.keys(r)[i]],e,t);if(n!=null)return n}},a.getServices=function(r,e){var t=e===void 0?{}:e,i=t.onlyService,n=i===void 0?!1:i,s=t.onlyServices,h=s===void 0?!1:s,u=t.skipParentResources,o=u===void 0?!1:u,l=[];!o&&r&&r.options&&r.options.resource&&r.options.resource!==r&&l.push.apply(l,a.getServices(r.options.resource,{onlyServices:!0}));var f=h?[]:(r.__jsonld||r).service||[];if(Array.isArray(f)||(f=[f]),n||f.push.apply(f,(r.__jsonld||r).services||[]),f.length===0)return l;for(var c=0;c<f.length;c++){var p=f[c];if(typeof p=="string"){var _=this.getResourceById(r.options.resource,p);_&&l.push(new xo(_.__jsonld||_,r.options))}else l.push(new xo(p,r.options))}return l},a.getTemporalComponent=function(r){var e=/t=([^&]+)/g.exec(r),t=null;return e&&e[1]&&(t=e[1].split(",")),t},a})(),Qu=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})(),Ji=(function(){function a(r,e,t){t===void 0&&(t="none"),Array.isArray(r)&&r.length===1?this._value=r[0]:this._value=r,(e==="none"||e==="@none")&&(e=void 0),this._locale=e,this._defaultLocale=t}return a.parseV2Value=function(r,e){return typeof r=="string"?new a(r,void 0,e):r["@value"]?new a(r["@value"],r["@language"],e):null},Object.defineProperty(a.prototype,"value",{get:function(){return Array.isArray(this._value)?this._value.join("<br/>"):this._value},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"locale",{get:function(){return this._locale===void 0?this._defaultLocale:this._locale},enumerable:!1,configurable:!0}),a.prototype.addValue=function(r){Array.isArray(this._value)||(this._value=[this._value]),Array.isArray(r)?this._value=this._value.concat(r):this._value.push(r)},a})(),Ft=(function(a){Qu(r,a);function r(e,t){e===void 0&&(e=[]);var i=a.apply(this,e)||this;return i.__proto__=r.prototype,i._defaultLocale=t,i}return r.parse=function(e,t){if(!e)return new r([],t);if(Array.isArray(e)){var i=e.map(function(s){return Ji.parseV2Value(s,t)}).filter(function(s){return s!==null}),n=i.reduce(function(s,h){var u=h._locale;return u||(u="none"),s[u]?s[u].addValue(h._value):s[u]=h,s},{});return new r(Object.values(n),t)}else{if(typeof e=="string")return new r([new Ji(e,void 0,t)],t);if(e["@language"]){var i=Ji.parseV2Value(e);return new r(i!==null?[i]:[],t)}else if(e["@value"]){var i=Ji.parseV2Value(e);return new r(i!==null?[i]:[],t)}else return new r(Object.keys(e).map(function(s){var h=e[s];if(!Array.isArray(h))throw new Error("A IIIF v3 localized property value must have an array as the value for a given language.");return new Ji(h,s,t)}),t)}},r.prototype.getSuitableLocale=function(e){for(var t=Array.from(this.values()).map(function(p){return p._locale}).filter(function(p){return p!==void 0}),i=function(p){var _=t.find(function(d){return d===p});if(_)return{value:_}},n=0,s=e;n<s.length;n++){var h=s[n],u=i(h);if(typeof u=="object")return u.value}for(var o=function(p){var _=t.find(function(d){return xe.getInexactLocale(d)===xe.getInexactLocale(p)});if(_)return{value:_}},l=0,f=e;l<f.length;l++){var h=f[l],c=o(h);if(typeof c=="object")return c.value}},r.prototype.setValue=function(e,t){var i=void 0;if(!t)i=this.find(function(s){return s._locale===void 0});else{var n=this.getSuitableLocale([t]);n&&(i=this.find(function(s){return s._locale===n}))}i?i._value=e:this.push(new Ji(e,t,this._defaultLocale))},r.prototype.getValue=function(e,t){var i=this.getValues(e);return i.length===0?null:t?i.join(t):i[0]},r.prototype.getValues=function(e){if(!this.length)return[];var t;if(e?Array.isArray(e)?t=e:t=[e]:t=[],this.length===1&&this[0]._locale===void 0){var i=this[0]._value;return Array.isArray(i)?i:[i]}var n=this.getSuitableLocale(t);if(n){var i=this.find(function(o){return o._locale===n})._value;return Array.isArray(i)?i:[i]}var s=!this.find(function(u){return u._locale===void 0});if(s){var i=this[0]._value;return Array.isArray(i)?i:[i]}var h=this.find(function(u){return u._locale===void 0});return h?Array.isArray(h._value)?h._value:[h._value]:[]},r})(Array),Ju=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})(),$u=(function(a){Ju(r,a);function r(e,t){var i=a.call(this,e,t)||this;if(i.index=0,i._allRanges=null,i.items=[],i._topRanges=[],i.__jsonld.structures&&i.__jsonld.structures.length)for(var n=i._getTopRanges(),s=0;s<n.length;s++){var h=n[s];i._parseRanges(h,String(s))}return i}return r.prototype.getPosterCanvas=function(){var e=this.getProperty("posterCanvas");return e&&(e=new pn(e,this.options)),e},r.prototype.getAccompanyingCanvas=function(){var e=this.getProperty("accompanyingCanvas");return e&&(e=new pn(e,this.options)),e},r.prototype.getBehavior=function(){var e=this.getProperty("behavior");return Array.isArray(e)&&(e=e[0]),e||null},r.prototype.getDefaultTree=function(){if(a.prototype.getDefaultTree.call(this),this.defaultTree.data.type=xe.normaliseType(Kt.MANIFEST),!this.isLoaded)return this.defaultTree;var e=this.getTopRanges();return e.length&&e[0].getTree(this.defaultTree),xe.generateTreeNodeIds(this.defaultTree),this.defaultTree},r.prototype._getTopRanges=function(){var e=[];if(this.__jsonld.structures&&this.__jsonld.structures.length){for(var t=0;t<this.__jsonld.structures.length;t++){var i=this.__jsonld.structures[t];i.viewingHint===ae.ViewingHint.TOP&&e.push(i)}if(!e.length){var n={};n.ranges=this.__jsonld.structures,e.push(n)}}return e},r.prototype.getTopRanges=function(){return this._topRanges},r.prototype._getRangeById=function(e){if(this.__jsonld.structures&&this.__jsonld.structures.length)for(var t=0;t<this.__jsonld.structures.length;t++){var i=this.__jsonld.structures[t];if(i["@id"]===e||i.id===e)return i}return null},r.prototype._parseRanges=function(e,t,i){var n=null;if(typeof e=="string"&&(n=e,e=this._getRangeById(n)),!e){console.warn("Range:",n,"does not exist");return}var s=new th(e,this.options);s.parentRange=i,s.path=t,i?i.items.push(s):this._topRanges.push(s);var h=e.items||e.members;if(h)for(var u=0;u<h.length;u++){var o=h[u];if(o["@type"]&&o["@type"].toLowerCase()==="sc:range"||o.type&&o.type.toLowerCase()==="range")this._parseRanges(o,t+"/"+u,s);else if(o["@type"]&&o["@type"].toLowerCase()==="sc:canvas"||o.type&&o.type.toLowerCase()==="canvas"){s.canvases||(s.canvases=[]);var l=o.id||o["@id"];s.canvases.push(l)}}else if(e.ranges)for(var u=0;u<e.ranges.length;u++)this._parseRanges(e.ranges[u],t+"/"+u,s)},r.prototype.getAllRanges=function(){if(this._allRanges!=null)return this._allRanges;this._allRanges=[];for(var e=this.getTopRanges(),t=function(s){var h=e[s];h.id&&i._allRanges.push(h);var u=function(l,f){l.add(f);var c=f.getRanges();return c.length?c.reduce(u,l):l},o=Array.from(h.getRanges().reduce(u,new Set));i._allRanges=i._allRanges.concat(o)},i=this,n=0;n<e.length;n++)t(n);return this._allRanges},r.prototype.getRangeById=function(e){for(var t=this.getAllRanges(),i=0;i<t.length;i++){var n=t[i];if(n.id===e)return n}return null},r.prototype.getRangeByPath=function(e){for(var t=this.getAllRanges(),i=0;i<t.length;i++){var n=t[i];if(n.path===e)return n}return null},r.prototype.getSequences=function(){if(this.items.length)return this.items;var e=this.__jsonld.mediaSequences||this.__jsonld.sequences;if(e)for(var t=0;t<e.length;t++){var i=e[t],n=new To(i,this.options);this.items.push(n)}else if(this.__jsonld.items){var n=new To(this.__jsonld.items,this.options);this.items.push(n)}return this.items},r.prototype.getSequenceByIndex=function(e){return this.getSequences()[e]},r.prototype.getTotalSequences=function(){return this.getSequences().length},r.prototype.getManifestType=function(){var e=this.getService(ae.ServiceProfile.UI_EXTENSIONS);return e?e.getProperty("manifestType"):wa.EMPTY},r.prototype.isMultiSequence=function(){return this.getTotalSequences()>1},r.prototype.isPagingEnabled=function(){var e=this.getViewingHint();if(e)return e===ae.ViewingHint.PAGED;var t=this.getBehavior();return t?t===ae.Behavior.PAGED:!1},r.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")},r.prototype.getViewingHint=function(){var e=this.getProperty("viewingHint");return Array.isArray(e)&&(e=e[0]),e||null},r})(Qs),wa;(function(a){a.EMPTY="",a.MANUSCRIPT="manuscript",a.MONOGRAPH="monograph"})(wa||(wa={}));var eh=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})(),th=(function(a){eh(r,a);function r(e,t){var i=a.call(this,e,t)||this;return i._ranges=null,i.canvases=null,i.items=[],i}return r.prototype.getCanvasIds=function(){return this.__jsonld.canvases?this.__jsonld.canvases:this.canvases?this.canvases:[]},r.prototype.getDuration=function(){if(this.canvases&&this.canvases.length){for(var e=[],t=[],i=0,n=this.canvases;i<n.length;i++){var s=n[i];if(s){var h=s.match(/(.*)#t=([0-9.]+),?([0-9.]+)?/)||[void 0,s],u=h[1],o=h[2],l=h[3];u&&(e.push(parseFloat(o)),t.push(parseFloat(l)))}}if(e.length&&t.length)return new va(Math.min.apply(Math,e),Math.max.apply(Math,t))}else{for(var f=this.getRanges(),e=[],t=[],c=0,p=f;c<p.length;c++){var _=p[c],d=_.getDuration();d&&(e.push(d.start),t.push(d.end))}if(e.length&&t.length)return new va(Math.min.apply(Math,e),Math.max.apply(Math,t))}var v,w;if(this.canvases&&this.canvases.length)for(var S=0;S<this.canvases.length;S++){var s=this.canvases[S],R=xe.getTemporalComponent(s);R&&R.length>1&&(S===0&&(v=Number(R[0])),S===this.canvases.length-1&&(w=Number(R[1])))}else for(var f=this.getRanges(),S=0;S<f.length;S++){var _=f[S],d=_.getDuration();d&&(S===0&&(v=d.start),S===f.length-1&&(w=d.end))}if(v!==void 0&&w!==void 0)return new va(v,w)},r.prototype.getRanges=function(){return this._ranges?this._ranges:this._ranges=this.items.filter(function(e){return e.isRange()})},r.prototype.getBehavior=function(){var e=this.getProperty("behavior");return Array.isArray(e)&&(e=e[0]),e||null},r.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")},r.prototype.getViewingHint=function(){var e=this.getProperty("viewingHint");return Array.isArray(e)&&(e=e[0]),e||null},r.prototype.getTree=function(e){e.data=this,this.treeNode=e;var t=this.getRanges();if(t&&t.length)for(var i=0;i<t.length;i++){var n=t[i],s=new Ta;e.addNode(s),this._parseTreeNode(s,n)}return xe.generateTreeNodeIds(e),e},r.prototype.spansTime=function(e){var t=this.getDuration();return!!(t&&e>=t.start&&e<=t.end)},r.prototype._parseTreeNode=function(e,t){e.label=t.getLabel().getValue(this.options.locale),e.data=t,e.data.type=xe.normaliseType(Kt.RANGE),t.treeNode=e;var i=t.getRanges();if(i&&i.length)for(var n=0;n<i.length;n++){var s=i[n],h=s.getBehavior();if(h!==ae.Behavior.NO_NAV){var u=new Ta;e.addNode(u),this._parseTreeNode(u,s)}}},r})(oi),ih=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})(),rh=(function(a){ih(r,a);function r(e,t){return a.call(this,e,t)||this}return r.prototype.getFormat=function(){return this.getProperty("format")},r})(oi),nh=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})(),To=(function(a){nh(r,a);function r(e,t){var i=a.call(this,e,t)||this;return i.items=[],i._thumbnails=null,i}return r.prototype.getCanvases=function(){if(this.items.length)return this.items;var e=this.__jsonld.canvases||this.__jsonld.elements;if(e)for(var t=0;t<e.length;t++){var i=e[t],n=new pn(i,this.options);n.index=t,this.items.push(n)}else if(this.__jsonld)for(var t=0;t<this.__jsonld.length;t++){var i=this.__jsonld[t],n=new pn(i,this.options);n.index=t,this.items.push(n)}return this.items},r.prototype.getCanvasById=function(e){for(var t=0;t<this.getTotalCanvases();t++){var i=this.getCanvasByIndex(t),n=xe.normaliseUrl(i.id);if(xe.normaliseUrl(e)===n)return i}return null},r.prototype.getCanvasByIndex=function(e){return this.getCanvases()[e]},r.prototype.getCanvasIndexById=function(e){for(var t=0;t<this.getTotalCanvases();t++){var i=this.getCanvasByIndex(t);if(i.id===e)return t}return null},r.prototype.getCanvasIndexByLabel=function(e,t){e=e.trim(),isNaN(e)||(e=parseInt(e,10).toString(),t&&(e+="r"));for(var i=/(\d*)\D+(\d*)/,n,s,h,u,o,l=0;l<this.getTotalCanvases();l++){var f=this.getCanvasByIndex(l);if(f.getLabel().getValue(this.options.locale)===e)return l;if(n=i.exec(e),!!n&&(u=n[1],o=n[2],!!o&&(h="^"+u+"\\D+"+o+"$",s=new RegExp(h),s.test(f.getLabel().toString()))))return l}return-1},r.prototype.getLastCanvasLabel=function(e){for(var t=this.getTotalCanvases()-1;t>=0;t--){var i=this.getCanvasByIndex(t),n=i.getLabel().getValue(this.options.locale);if(e){var s=/^[a-zA-Z0-9]*$/;if(s.test(n))return n}else if(n)return n}return this.options.defaultLabel},r.prototype.getLastPageIndex=function(){return this.getTotalCanvases()-1},r.prototype.getNextPageIndex=function(e,t){var i;if(t){var n=this.getPagedIndices(e),s=this.getViewingDirection();s&&s===ae.ViewingDirection.RIGHT_TO_LEFT?i=n[0]+1:i=n[n.length-1]+1}else i=e+1;return i>this.getLastPageIndex()?-1:i},r.prototype.getPagedIndices=function(e,t){var i=[];if(!t)i.push(e);else{this.isFirstCanvas(e)||this.isLastCanvas(e)?i=[e]:e%2?i=[e,e+1]:i=[e-1,e];var n=this.getViewingDirection();n&&n===ae.ViewingDirection.RIGHT_TO_LEFT&&(i=i.reverse())}return i},r.prototype.getPrevPageIndex=function(e,t){var i;if(t){var n=this.getPagedIndices(e),s=this.getViewingDirection();s&&s===ae.ViewingDirection.RIGHT_TO_LEFT?i=n[n.length-1]-1:i=n[0]-1}else i=e-1;return i},r.prototype.getStartCanvasIndex=function(){var e=this.getStartCanvas();if(e)for(var t=0;t<this.getTotalCanvases();t++){var i=this.getCanvasByIndex(t);if(i.id===e)return t}return 0},r.prototype.getThumbs=function(e,t){for(var i=[],n=this.getTotalCanvases(),s=0;s<n;s++){var h=this.getCanvasByIndex(s),u=new oh(e,h);i.push(u)}return i},r.prototype.getThumbnails=function(){if(this._thumbnails!=null)return this._thumbnails;this._thumbnails=[];for(var e=this.getCanvases(),t=0;t<e.length;t++){var i=e[t].getThumbnail();i&&this._thumbnails.push(i)}return this._thumbnails},r.prototype.getStartCanvas=function(){return this.getProperty("startCanvas")},r.prototype.getTotalCanvases=function(){return this.getCanvases().length},r.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")?this.getProperty("viewingDirection"):this.options.resource.getViewingDirection?this.options.resource.getViewingDirection():null},r.prototype.getViewingHint=function(){var e=this.getProperty("viewingHint");return Array.isArray(e)&&(e=e[0]),e||null},r.prototype.isCanvasIndexOutOfRange=function(e){return e>this.getTotalCanvases()-1},r.prototype.isFirstCanvas=function(e){return e===0},r.prototype.isLastCanvas=function(e){return e===this.getTotalCanvases()-1},r.prototype.isMultiCanvas=function(){return this.getTotalCanvases()>1},r.prototype.isPagingEnabled=function(){var e=this.getViewingHint();return e?e===ae.ViewingHint.PAGED:!1},r.prototype.isTotalCanvasesEven=function(){return this.getTotalCanvases()%2===0},r})(oi),Eo=(function(){function a(){}return a.parse=function(r,e){return typeof r=="string"&&(r=JSON.parse(r)),this.parseJson(r,e)},a.parseJson=function(r,e){var t;if(e&&e.navDate&&!isNaN(e.navDate.getTime())&&(r.navDate=e.navDate.toString()),r["@type"])switch(r["@type"]){case"sc:Collection":t=this.parseCollection(r,e);break;case"sc:Manifest":t=this.parseManifest(r,e);break;default:return null}else switch(r.type){case"Collection":t=this.parseCollection(r,e);break;case"Manifest":t=this.parseManifest(r,e);break;default:return null}return t.isLoaded=!0,t},a.parseCollection=function(r,e){var t=new Wu(r,e);return e?(t.index=e.index||0,e.resource&&(t.parentCollection=e.resource.parentCollection)):t.index=0,this.parseCollections(t,e),this.parseManifests(t,e),this.parseItems(t,e),t},a.parseCollections=function(r,e){var t;if(r.__jsonld.collections?t=r.__jsonld.collections:r.__jsonld.items&&(t=r.__jsonld.items.filter(function(s){return s.type.toLowerCase()==="collection"})),t)for(var i=0;i<t.length;i++){e&&(e.index=i);var n=this.parseCollection(t[i],e);n.index=i,n.parentCollection=r,r.items.push(n)}},a.parseManifest=function(r,e){var t=new $u(r,e);return t},a.parseManifests=function(r,e){var t;if(r.__jsonld.manifests?t=r.__jsonld.manifests:r.__jsonld.items&&(t=r.__jsonld.items.filter(function(s){return s.type.toLowerCase()==="manifest"})),t)for(var i=0;i<t.length;i++){var n=this.parseManifest(t[i],e);n.index=i,n.parentCollection=r,r.items.push(n)}},a.parseItem=function(r,e){if(r["@type"]){if(r["@type"].toLowerCase()==="sc:manifest")return this.parseManifest(r,e);if(r["@type"].toLowerCase()==="sc:collection")return this.parseCollection(r,e)}else if(r.type){if(r.type.toLowerCase()==="manifest")return this.parseManifest(r,e);if(r.type.toLowerCase()==="collection")return this.parseCollection(r,e)}return null},a.parseItems=function(r,e){var t=r.__jsonld.members||r.__jsonld.items;if(t)for(var i=function(u){e&&(e.index=u);var o=n.parseItem(t[u],e);if(!o)return{value:void 0};if(r.items.filter(function(l){return l.id===o.id})[0])return"continue";o.index=u,o.parentCollection=r,r.items.push(o)},n=this,s=0;s<t.length;s++){var h=i(s);if(typeof h=="object")return h.value}},a})(),ah=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})(),xo=(function(a){ah(r,a);function r(e,t){return a.call(this,e,t)||this}return r.prototype.getProfile=function(){var e=this.getProperty("profile");return e||(e=this.getProperty("dcterms:conformsTo")),Array.isArray(e)?e[0]:e},r.prototype.getConfirmLabel=function(){return xe.getLocalisedValue(this.getProperty("confirmLabel"),this.options.locale)},r.prototype.getDescription=function(){return xe.getLocalisedValue(this.getProperty("description"),this.options.locale)},r.prototype.getFailureDescription=function(){return xe.getLocalisedValue(this.getProperty("failureDescription"),this.options.locale)},r.prototype.getFailureHeader=function(){return xe.getLocalisedValue(this.getProperty("failureHeader"),this.options.locale)},r.prototype.getHeader=function(){return xe.getLocalisedValue(this.getProperty("header"),this.options.locale)},r.prototype.getServiceLabel=function(){return xe.getLocalisedValue(this.getProperty("label"),this.options.locale)},r.prototype.getInfoUri=function(){var e=this.id;return e.endsWith("/")||(e+="/"),e+="info.json",e},r})(oi),sh=(function(){function a(r,e){this.width=r,this.height=e}return a})(),br;(function(a){a[a.AUTHORIZATION_FAILED=1]="AUTHORIZATION_FAILED",a[a.FORBIDDEN=2]="FORBIDDEN",a[a.INTERNAL_SERVER_ERROR=3]="INTERNAL_SERVER_ERROR",a[a.RESTRICTED=4]="RESTRICTED"})(br||(br={}));var oh=(function(){function a(r,e){this.data=e,this.index=e.index,this.width=r;var t=e.getHeight()/e.getWidth();t?this.height=Math.floor(this.width*t):this.height=r,this.uri=e.getCanonicalImageUri(r),this.label=e.getLabel().getValue(),this.viewingHint=e.getViewingHint()}return a})(),lh=(function(){var a=function(r,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},a(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");a(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}})(),uh=(function(a){lh(r,a);function r(e,t){return a.call(this,e,t)||this}return r})(Jn),Ta=(function(){function a(r,e){this.label=r,this.data=e||{},this.nodes=[]}return a.prototype.addNode=function(r){this.nodes.push(r),r.parentNode=this},a.prototype.isCollection=function(){return this.data.type===xe.normaliseType(Kt.COLLECTION)},a.prototype.isManifest=function(){return this.data.type===xe.normaliseType(Kt.MANIFEST)},a.prototype.isRange=function(){return this.data.type===xe.normaliseType(Kt.RANGE)},a})(),Kt;(function(a){a.COLLECTION="collection",a.MANIFEST="manifest",a.RANGE="range"})(Kt||(Kt={}));var hh=function(a,r){return xe.parseManifest(a,r)};class ch{constructor(){ge(this,Ar,Pe(Tt({})))}get manifests(){return T(L(this,Ar))}set manifests(r){me(L(this,Ar),r,!0)}async fetchManifest(r){if(!this.manifests[r]){this.manifests[r]={isFetching:!0};try{const e=await fetch(r);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const t=await e.json(),i=hh(t);this.manifests[r]={json:t,manifesto:i,isFetching:!1}}catch(e){this.manifests[r]={error:e.message,isFetching:!1}}}}getManifest(r){const e=this.manifests[r];return e==null?void 0:e.manifesto}async fetchAnnotationList(r){if(!this.manifests[r])try{const e=await fetch(r);if(e.ok){const t=await e.json();this.manifests[r]={json:t}}else console.error(`Failed to fetch annotation list: ${r}`)}catch(e){console.error(`Error fetching annotation list: ${r}`,e)}}getCanvases(r){const e=this.getManifest(r);if(!e)return[];const t=e.getSequences();return!t||!t.length?[]:t[0].getCanvases()}getAnnotations(r,e){const t=this.getManifest(r);return t?t.getSequences()[0].getCanvasById(e)?this.manualGetAnnotations(r,e):[]:[]}manualGetAnnotations(r,e){const t=this.getManifest(r);if(!t)return[];const i=t.getSequences()[0].getCanvasById(e);if(!i)return[];const n=i.__jsonld;let s=[];const h=u=>u.resources||u.items||[];return n.otherContent&&n.otherContent.forEach(u=>{const o=u["@id"]||u.id;if(o&&!u.resources){const l=this.manifests[o];if(l){if(l.json){const f=h(l.json);s.push(...f)}}else this.fetchAnnotationList(o)}else u.resources&&s.push(...u.resources)}),n.annotations&&n.annotations.forEach(u=>{const o=u.id||u["@id"];if(o&&!u.items){const l=this.manifests[o];if(l){if(l.json){const f=h(l.json);s.push(...f)}}else this.fetchAnnotationList(o)}else u.items&&s.push(...u.items)}),s}}Ar=new WeakMap;const $i=new ch;class fh{constructor(r){ge(this,Ir,Pe(null));ge(this,Dr,Pe(null));ge(this,Or,Pe(!1));ge(this,Lr,Pe(!1));ge(this,Mr,Pe(!1));ge(this,Hr,Pe(!1));ge(this,Fr,Pe(!1));ge(this,Nr,Pe(!1));ge(this,Br,Pe("none"));ge(this,zr,Pe(Tt(new Set)));ge(this,kr,Pe(""));ge(this,Vr,Pe(Tt([])));ge(this,Ur,Pe(!1));ge(this,Gr,Pe(!1));ge(this,jr,Pe(Tt([])));this.manifestId=r||null,this.manifestId&&$i.fetchManifest(this.manifestId)}get manifestId(){return T(L(this,Ir))}set manifestId(r){me(L(this,Ir),r,!0)}get canvasId(){return T(L(this,Dr))}set canvasId(r){me(L(this,Dr),r,!0)}get showAnnotations(){return T(L(this,Or))}set showAnnotations(r){me(L(this,Or),r,!0)}get showThumbnailGallery(){return T(L(this,Lr))}set showThumbnailGallery(r){me(L(this,Lr),r,!0)}get isGalleryDockedBottom(){return T(L(this,Mr))}set isGalleryDockedBottom(r){me(L(this,Mr),r,!0)}get isGalleryDockedRight(){return T(L(this,Hr))}set isGalleryDockedRight(r){me(L(this,Hr),r,!0)}get isFullScreen(){return T(L(this,Fr))}set isFullScreen(r){me(L(this,Fr),r,!0)}get showMetadataDialog(){return T(L(this,Nr))}set showMetadataDialog(r){me(L(this,Nr),r,!0)}get dockSide(){return T(L(this,Br))}set dockSide(r){me(L(this,Br),r,!0)}get visibleAnnotationIds(){return T(L(this,zr))}set visibleAnnotationIds(r){me(L(this,zr),r,!0)}get manifest(){return this.manifestId?$i.getManifest(this.manifestId):null}get canvases(){if(!this.manifestId)return[];const r=$i.getCanvases(this.manifestId);return r.length>0&&!this.canvasId&&setTimeout(()=>{!this.canvasId&&r.length>0&&(this.canvasId=r[0].id)},0),r}get currentCanvasIndex(){return this.canvasId?this.canvases.findIndex(r=>r.id===this.canvasId):this.canvases.length>0?0:-1}get hasNext(){return this.currentCanvasIndex<this.canvases.length-1}get hasPrevious(){return this.currentCanvasIndex>0}nextCanvas(){if(this.hasNext){const r=this.currentCanvasIndex+1,e=this.canvases[r];this.canvasId=e.id}}previousCanvas(){if(this.hasPrevious){const r=this.currentCanvasIndex-1,e=this.canvases[r];this.canvasId=e.id}}setManifest(r){this.manifestId=r,this.canvasId=null,$i.fetchManifest(r)}setCanvas(r){this.canvasId=r}toggleAnnotations(){this.showAnnotations=!this.showAnnotations}toggleThumbnailGallery(){this.showThumbnailGallery=!this.showThumbnailGallery}toggleFullScreen(){if(document.fullscreenElement)document.exitFullscreen();else{const r=document.getElementById("triiiceratops-viewer");r&&r.requestFullscreen().catch(e=>{console.warn("Fullscreen request failed",e)})}}toggleMetadataDialog(){this.showMetadataDialog=!this.showMetadataDialog}get searchQuery(){return T(L(this,kr))}set searchQuery(r){me(L(this,kr),r,!0)}get searchResults(){return T(L(this,Vr))}set searchResults(r){me(L(this,Vr),r,!0)}get isSearching(){return T(L(this,Ur))}set isSearching(r){me(L(this,Ur),r,!0)}get showSearchPanel(){return T(L(this,Gr))}set showSearchPanel(r){me(L(this,Gr),r,!0)}toggleSearchPanel(){this.showSearchPanel=!this.showSearchPanel,this.showSearchPanel||(this.searchAnnotations=[])}get searchAnnotations(){return T(L(this,jr))}set searchAnnotations(r){me(L(this,jr),r,!0)}get currentCanvasSearchAnnotations(){return this.canvasId?this.searchAnnotations.filter(r=>r.canvasId===this.canvasId):[]}async search(r){var e,t;if(r.trim()){this.isSearching=!0,this.searchQuery=r,this.searchResults=[];try{const i=this.manifest;if(!i)throw new Error("No manifest loaded");let n=i.getService("http://iiif.io/api/search/1/search")||i.getService("http://iiif.io/api/search/0/search");if(n||i.__jsonld&&i.__jsonld.service&&(n=(Array.isArray(i.__jsonld.service)?i.__jsonld.service:[i.__jsonld.service]).find(_=>_.profile==="http://iiif.io/api/search/1/search"||_.profile==="http://iiif.io/api/search/0/search")),!n){console.warn("No IIIF search service found in manifest"),this.isSearching=!1;return}const h=`${n.id||n["@id"]}?q=${encodeURIComponent(r)}`,u=await fetch(h);if(!u.ok)throw new Error("Search request failed");const o=await u.json(),l=o.resources||[],f=[],c=p=>{const _=typeof p=="string"?p:p["@id"]||p.id;if(!_)return null;const d=_.split("#xywh=");if(d.length<2)return null;const v=d[1].split(",").map(Number);return v.length===4?v:null};if(o.hits)for(const p of o.hits){const _=p.annotations||[];for(const d of _){const v=l.find(w=>w["@id"]===d||w.id===d);if(v&&v.on){const w=typeof v.on=="string"?v.on:v.on["@id"]||v.on.id,S=w.split("#")[0],R=c(w),P=this.canvases.findIndex(A=>A.id===S);if(P>=0){const A=this.canvases[P];let F="Canvas "+(P+1);try{if(A.getLabel){const N=A.getLabel();Array.isArray(N)&&N.length>0?F=N[0].value:typeof N=="string"&&(F=N)}else A.label&&(typeof A.label=="string"?F=A.label:Array.isArray(A.label)&&(F=(e=A.label[0])==null?void 0:e.value))}catch{}f.push({type:"hit",before:p.before,match:p.match,after:p.after,canvasIndex:P,canvasLabel:String(F),bounds:R})}}}}else if(l.length>0)for(const p of l){const _=typeof p.on=="string"?p.on:p.on["@id"]||p.on.id,d=_.split("#")[0],v=c(_),w=this.canvases.findIndex(S=>S.id===d);if(w>=0){const S=this.canvases[w];let R="Canvas "+(w+1);try{if(S.getLabel){const P=S.getLabel();Array.isArray(P)&&P.length>0?R=P[0].value:typeof P=="string"&&(R=P)}else S.label&&(typeof S.label=="string"?R=S.label:Array.isArray(S.label)&&(R=(t=S.label[0])==null?void 0:t.value))}catch{}f.push({type:"resource",match:p.resource&&p.resource.chars?p.resource.chars:p.chars||"",canvasIndex:w,canvasLabel:String(R),bounds:v})}}this.searchResults=f,this.searchAnnotations=f.filter(p=>p.bounds).map((p,_)=>{const d=this.canvases[p.canvasIndex],v=`${d.id}#xywh=${p.bounds.join(",")}`;return{"@id":`urn:search-hit:${_}`,"@type":"oa:Annotation",motivation:"sc:painting",on:v,canvasId:d.id,resource:{"@type":"cnt:ContentAsText",chars:p.match},isSearchHit:!0}})}catch(i){console.error("Search error:",i)}finally{this.isSearching=!1}}}}Ir=new WeakMap,Dr=new WeakMap,Or=new WeakMap,Lr=new WeakMap,Mr=new WeakMap,Hr=new WeakMap,Fr=new WeakMap,Nr=new WeakMap,Br=new WeakMap,zr=new WeakMap,kr=new WeakMap,Vr=new WeakMap,Ur=new WeakMap,Gr=new WeakMap,jr=new WeakMap;const er="triiiceratops:viewerState";var vn={exports:{}},dh=vn.exports,bo;function ph(){return bo||(bo=1,(function(a){//! openseadragon 5.0.1
4
- //! Built on 2024-12-09
5
- //! Git commit: v5.0.1-0-480de92d
6
- //! http://openseadragon.github.io
7
- //! License: http://openseadragon.github.io/license/
8
- function r(e){return new r.Viewer(e)}(function(e){e.version={versionStr:"5.0.1",major:parseInt("5",10),minor:parseInt("0",10),revision:parseInt("1",10)};var t={"[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"},i=Object.prototype.toString,n=Object.prototype.hasOwnProperty;e.isFunction=function(s){return e.type(s)==="function"},e.isArray=Array.isArray||function(s){return e.type(s)==="array"},e.isWindow=function(s){return s&&typeof s=="object"&&"setInterval"in s},e.type=function(s){return s==null?String(s):t[i.call(s)]||"object"},e.isPlainObject=function(s){if(!s||r.type(s)!=="object"||s.nodeType||e.isWindow(s)||s.constructor&&!n.call(s,"constructor")&&!n.call(s.constructor.prototype,"isPrototypeOf"))return!1;var h;for(var u in s)h=u;return h===void 0||n.call(s,h)},e.isEmptyObject=function(s){for(var h in s)return!1;return!0},e.freezeObject=function(s){return Object.freeze?e.freezeObject=Object.freeze:e.freezeObject=function(h){return h},e.freezeObject(s)},e.supportsCanvas=(function(){var s=document.createElement("canvas");return!!(e.isFunction(s.getContext)&&s.getContext("2d"))})(),e.isCanvasTainted=function(s){var h=!1;try{s.getContext("2d").getImageData(0,0,1,1)}catch{h=!0}return h},e.supportsAddEventListener=(function(){return!!(document.documentElement.addEventListener&&document.addEventListener)})(),e.supportsRemoveEventListener=(function(){return!!(document.documentElement.removeEventListener&&document.removeEventListener)})(),e.supportsEventListenerOptions=(function(){var s=0;if(e.supportsAddEventListener)try{var h={get capture(){return s++,!1},get once(){return s++,!1},get passive(){return s++,!1}};window.addEventListener("test",null,h),window.removeEventListener("test",null,h)}catch{s=0}return s>=3})(),e.getCurrentPixelDensityRatio=function(){if(e.supportsCanvas){var s=document.createElement("canvas").getContext("2d"),h=window.devicePixelRatio||1,u=s.webkitBackingStorePixelRatio||s.mozBackingStorePixelRatio||s.msBackingStorePixelRatio||s.oBackingStorePixelRatio||s.backingStorePixelRatio||1;return Math.max(h,1)/u}else return 1},e.pixelDensityRatio=e.getCurrentPixelDensityRatio()})(r),(function(e){e.extend=function(){var u,o,l,f,c,p,_=arguments[0]||{},d=arguments.length,v=!1,w=1;for(typeof _=="boolean"&&(v=_,_=arguments[1]||{},w=2),typeof _!="object"&&!r.isFunction(_)&&(_={}),d===w&&(_=this,--w);w<d;w++)if(u=arguments[w],u!==null||u!==void 0)for(o in u){var S=Object.getOwnPropertyDescriptor(u,o);if(S!==void 0){if(S.get||S.set){Object.defineProperty(_,o,S);continue}f=S.value}else{e.console.warn('Could not copy inherited property "'+o+'".');continue}_!==f&&(v&&f&&(r.isPlainObject(f)||(c=r.isArray(f)))?(l=_[o],c?(c=!1,p=l&&r.isArray(l)?l:[]):p=l&&r.isPlainObject(l)?l:{},_[o]=r.extend(v,p,f)):f!==void 0&&(_[o]=f))}return _};var t=function(){if(typeof navigator!="object")return!1;var u=navigator.userAgent;return typeof u!="string"?!1:u.indexOf("iPhone")!==-1||u.indexOf("iPad")!==-1||u.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:t(),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(u,o){return function(){var l=arguments;return l===void 0&&(l=[]),o.apply(u,l)}},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(u){return e._viewers.get(this.getElement(u))},getElement:function(u){return typeof u=="string"&&(u=document.getElementById(u)),u},getElementPosition:function(u){var o=new e.Point,l,f;for(u=e.getElement(u),l=e.getElementStyle(u).position==="fixed",f=h(u,l);f;)o.x+=u.offsetLeft,o.y+=u.offsetTop,l&&(o=o.plus(e.getPageScroll())),u=f,l=e.getElementStyle(u).position==="fixed",f=h(u,l);return o},getElementOffset:function(u){u=e.getElement(u);var o=u&&u.ownerDocument,l,f,c={top:0,left:0};return o?(l=o.documentElement,typeof u.getBoundingClientRect<"u"&&(c=u.getBoundingClientRect()),f=o===o.window?o:o.nodeType===9?o.defaultView||o.parentWindow:!1,new e.Point(c.left+(f.pageXOffset||l.scrollLeft)-(l.clientLeft||0),c.top+(f.pageYOffset||l.scrollTop)-(l.clientTop||0))):new e.Point},getElementSize:function(u){return u=e.getElement(u),new e.Point(u.clientWidth,u.clientHeight)},getElementStyle:document.documentElement.currentStyle?function(u){return u=e.getElement(u),u.currentStyle}:function(u){return u=e.getElement(u),window.getComputedStyle(u,"")},getCssPropertyWithVendorPrefix:function(u){var o={};return e.getCssPropertyWithVendorPrefix=function(l){if(o[l]!==void 0)return o[l];var f=document.createElement("div").style,c=null;if(f[l]!==void 0)c=l;else for(var p=["Webkit","Moz","MS","O","webkit","moz","ms","o"],_=e.capitalizeFirstLetter(l),d=0;d<p.length;d++){var v=p[d]+_;if(f[v]!==void 0){c=v;break}}return o[l]=c,c},e.getCssPropertyWithVendorPrefix(u)},capitalizeFirstLetter:function(u){return u.charAt(0).toUpperCase()+u.slice(1)},positiveModulo:function(u,o){var l=u%o;return l<0&&(l+=o),l},pointInElement:function(u,o){u=e.getElement(u);var l=e.getElementOffset(u),f=e.getElementSize(u);return o.x>=l.x&&o.x<l.x+f.x&&o.y<l.y+f.y&&o.y>=l.y},getMousePosition:function(u){if(typeof u.pageX=="number")e.getMousePosition=function(o){var l=new e.Point;return l.x=o.pageX,l.y=o.pageY,l};else if(typeof u.clientX=="number")e.getMousePosition=function(o){var l=new e.Point;return l.x=o.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,l.y=o.clientY+document.body.scrollTop+document.documentElement.scrollTop,l};else throw new Error("Unknown event mouse position, no known technique.");return e.getMousePosition(u)},getPageScroll:function(){var u=document.documentElement||{},o=document.body||{};if(typeof window.pageXOffset=="number")e.getPageScroll=function(){return new e.Point(window.pageXOffset,window.pageYOffset)};else if(o.scrollLeft||o.scrollTop)e.getPageScroll=function(){return new e.Point(document.body.scrollLeft,document.body.scrollTop)};else if(u.scrollLeft||u.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(u){if(typeof window.scrollTo<"u")e.setPageScroll=function(f){window.scrollTo(f.x,f.y)};else{var o=e.getPageScroll();if(o.x===u.x&&o.y===u.y)return;document.body.scrollLeft=u.x,document.body.scrollTop=u.y;var l=e.getPageScroll();if(l.x!==o.x&&l.y!==o.y){e.setPageScroll=function(f){document.body.scrollLeft=f.x,document.body.scrollTop=f.y};return}if(document.documentElement.scrollLeft=u.x,document.documentElement.scrollTop=u.y,l=e.getPageScroll(),l.x!==o.x&&l.y!==o.y){e.setPageScroll=function(f){document.documentElement.scrollLeft=f.x,document.documentElement.scrollTop=f.y};return}e.setPageScroll=function(f){}}e.setPageScroll(u)},getWindowSize:function(){var u=document.documentElement||{},o=document.body||{};if(typeof window.innerWidth=="number")e.getWindowSize=function(){return new e.Point(window.innerWidth,window.innerHeight)};else if(u.clientWidth||u.clientHeight)e.getWindowSize=function(){return new e.Point(document.documentElement.clientWidth,document.documentElement.clientHeight)};else if(o.clientWidth||o.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(u){u=e.getElement(u);var o=[e.makeNeutralElement("div"),e.makeNeutralElement("div"),e.makeNeutralElement("div")];return e.extend(o[0].style,{display:"table",height:"100%",width:"100%"}),e.extend(o[1].style,{display:"table-row"}),e.extend(o[2].style,{display:"table-cell",verticalAlign:"middle",textAlign:"center"}),o[0].appendChild(o[1]),o[1].appendChild(o[2]),o[2].appendChild(u),o[0]},makeNeutralElement:function(u){var o=document.createElement(u),l=o.style;return l.background="transparent none",l.border="none",l.margin="0px",l.padding="0px",l.position="static",o},now:function(){return Date.now?e.now=Date.now:e.now=function(){return new Date().getTime()},e.now()},makeTransparentImage:function(u){var o=e.makeNeutralElement("img");return o.src=u,o},setElementOpacity:function(u,o,l){var f,c;u=e.getElement(u),l&&!e.Browser.alpha&&(o=Math.round(o)),e.Browser.opacity?u.style.opacity=o<1?o:"":o<1?(f=Math.round(100*o),c="alpha(opacity="+f+")",u.style.filter=c):u.style.filter=""},setElementTouchActionNone:function(u){u=e.getElement(u),typeof u.style.touchAction<"u"?u.style.touchAction="none":typeof u.style.msTouchAction<"u"&&(u.style.msTouchAction="none")},setElementPointerEvents:function(u,o){u=e.getElement(u),typeof u.style<"u"&&typeof u.style.pointerEvents<"u"&&(u.style.pointerEvents=o)},setElementPointerEventsNone:function(u){e.setElementPointerEvents(u,"none")},addClass:function(u,o){u=e.getElement(u),u.className?(" "+u.className+" ").indexOf(" "+o+" ")===-1&&(u.className+=" "+o):u.className=o},indexOf:function(u,o,l){return Array.prototype.indexOf?this.indexOf=function(f,c,p){return f.indexOf(c,p)}:this.indexOf=function(f,c,p){var _,d=p||0,v;if(!f)throw new TypeError;if(v=f.length,v===0||d>=v)return-1;for(d<0&&(d=v-Math.abs(d)),_=d;_<v;_++)if(f[_]===c)return _;return-1},this.indexOf(u,o,l)},removeClass:function(u,o){var l,f=[],c;for(u=e.getElement(u),l=u.className.split(/\s+/),c=0;c<l.length;c++)l[c]&&l[c]!==o&&f.push(l[c]);u.className=f.join(" ")},normalizeEventListenerOptions:function(u){var o;return typeof u<"u"?typeof u=="boolean"?o=e.supportsEventListenerOptions?{capture:u}:u:o=e.supportsEventListenerOptions?u:typeof u.capture<"u"?u.capture:!1:o=e.supportsEventListenerOptions?{capture:!1}:!1,o},addEvent:(function(){if(e.supportsAddEventListener)return function(u,o,l,f){f=e.normalizeEventListenerOptions(f),u=e.getElement(u),u.addEventListener(o,l,f)};if(document.documentElement.attachEvent&&document.attachEvent)return function(u,o,l){u=e.getElement(u),u.attachEvent("on"+o,l)};throw new Error("No known event model.")})(),removeEvent:(function(){if(e.supportsRemoveEventListener)return function(u,o,l,f){f=e.normalizeEventListenerOptions(f),u=e.getElement(u),u.removeEventListener(o,l,f)};if(document.documentElement.detachEvent&&document.detachEvent)return function(u,o,l){u=e.getElement(u),u.detachEvent("on"+o,l)};throw new Error("No known event model.")})(),cancelEvent:function(u){u.preventDefault()},eventIsCanceled:function(u){return u.defaultPrevented},stopEvent:function(u){u.stopPropagation()},createCallback:function(u,o){console.error("The createCallback function is deprecated and will be removed in future versions. Please use alternativeFunction instead.");var l=[],f;for(f=2;f<arguments.length;f++)l.push(arguments[f]);return function(){var c=l.concat([]),p;for(p=0;p<arguments.length;p++)c.push(arguments[p]);return o.apply(u,c)}},getUrlParameter:function(u){var o=s[u];return o||null},getUrlProtocol:function(u){var o=u.match(/^([a-z]+:)\/\//i);return o===null?window.location.protocol:o[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(u,o,l){var f,c,p,_;e.isPlainObject(u)&&(o=u.success,l=u.error,f=u.withCredentials,c=u.headers,p=u.responseType||null,_=u.postData||null,u=u.url);var d=e.getUrlProtocol(u),v=e.createAjaxRequest();if(!e.isFunction(o))throw new Error("makeAjaxRequest requires a success callback");v.onreadystatechange=function(){v.readyState===4&&(v.onreadystatechange=function(){},v.status>=200&&v.status<300||v.status===0&&d!=="http:"&&d!=="https:"?o(v):e.isFunction(l)?l(v):e.console.error("AJAX request returned %d: %s",v.status,u))};var w=_?"POST":"GET";try{if(v.open(w,u,!0),p&&(v.responseType=p),c)for(var S in c)Object.prototype.hasOwnProperty.call(c,S)&&c[S]&&v.setRequestHeader(S,c[S]);f&&(v.withCredentials=!0),v.send(_)}catch(R){e.console.error("%s while making AJAX request: %s",R.name,R.message),v.onreadystatechange=function(){},e.isFunction(l)&&l(v,R)}return v},jsonp:function(u){var o,l=u.url,f=document.head||document.getElementsByTagName("head")[0]||document.documentElement,c=u.callbackName||"openseadragon"+e.now(),p=window[c],_="$1"+c+"$2",d=u.param||"callback",v=u.callback;l=l.replace(/(=)\?(&|$)|\?\?/i,_),l+=(/\?/.test(l)?"&":"?")+d+"="+c,window[c]=function(w){if(p)window[c]=p;else try{delete window[c]}catch{}v&&e.isFunction(v)&&v(w)},o=document.createElement("script"),(u.async!==void 0||u.async!==!1)&&(o.async="async"),u.scriptCharset&&(o.charset=u.scriptCharset),o.src=l,o.onload=o.onreadystatechange=function(w,S){(S||!o.readyState||/loaded|complete/.test(o.readyState))&&(o.onload=o.onreadystatechange=null,f&&o.parentNode&&f.removeChild(o),o=void 0)},f.insertBefore(o,f.firstChild)},createFromDZI:function(){throw"OpenSeadragon.createFromDZI is deprecated, use Viewer.open."},parseXml:function(u){if(window.DOMParser)e.parseXml=function(o){var l=null,f;return f=new DOMParser,l=f.parseFromString(o,"text/xml"),l};else throw new Error("Browser doesn't support XML DOM.");return e.parseXml(u)},parseJSON:function(u){return e.parseJSON=window.JSON.parse,e.parseJSON(u)},imageFormatSupported:function(u){return u=u||"",!!n[u.toLowerCase()]},setImageFormatsSupported:function(u){e.extend(n,u)}});var i=function(u){};e.console=window.console||{log:i,debug:i,info:i,warn:i,error:i,assert:i},e.Browser={vendor:e.BROWSERS.UNKNOWN,version:0,alpha:!0};var n={avif:!0,bmp:!1,jpeg:!0,jpg:!0,png:!0,tif:!1,wdp:!1,webp:!0},s={};(function(){var u=navigator.appVersion,o=navigator.userAgent,l;switch(navigator.appName){case"Microsoft Internet Explorer":window.attachEvent&&window.ActiveXObject&&(e.Browser.vendor=e.BROWSERS.IE,e.Browser.version=parseFloat(o.substring(o.indexOf("MSIE")+5,o.indexOf(";",o.indexOf("MSIE")))));break;case"Netscape":window.addEventListener&&(o.indexOf("Edge")>=0?(e.Browser.vendor=e.BROWSERS.EDGE,e.Browser.version=parseFloat(o.substring(o.indexOf("Edge")+5))):o.indexOf("Edg")>=0?(e.Browser.vendor=e.BROWSERS.CHROMEEDGE,e.Browser.version=parseFloat(o.substring(o.indexOf("Edg")+4))):o.indexOf("Firefox")>=0?(e.Browser.vendor=e.BROWSERS.FIREFOX,e.Browser.version=parseFloat(o.substring(o.indexOf("Firefox")+8))):o.indexOf("Safari")>=0?(e.Browser.vendor=o.indexOf("Chrome")>=0?e.BROWSERS.CHROME:e.BROWSERS.SAFARI,e.Browser.version=parseFloat(o.substring(o.substring(0,o.indexOf("Safari")).lastIndexOf("/")+1,o.indexOf("Safari")))):(l=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})"),l.exec(o)!==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(u);break}var f=window.location.search.substring(1),c=f.split("&"),p,_,d;for(d=0;d<c.length;d++)if(p=c[d],_=p.indexOf("="),_>0){var v=p.substring(0,_),w=p.substring(_+1);try{s[v]=decodeURIComponent(w)}catch{e.console.error("Ignoring malformed URL parameter: %s=%s",v,w)}}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(u){var o=u.requestAnimationFrame||u.mozRequestAnimationFrame||u.webkitRequestAnimationFrame||u.msRequestAnimationFrame,l=u.cancelAnimationFrame||u.mozCancelAnimationFrame||u.webkitCancelAnimationFrame||u.msCancelAnimationFrame;if(o&&l)e.requestAnimationFrame=function(){return o.apply(u,arguments)},e.cancelAnimationFrame=function(){return l.apply(u,arguments)};else{var f=[],c=[],p=0,_;e.requestAnimationFrame=function(d){return f.push([++p,d]),_||(_=setInterval(function(){if(f.length){var v=e.now(),w=c;for(c=f,f=w;c.length;)c.shift()[1](v)}else clearInterval(_),_=void 0},1e3/50)),p},e.cancelAnimationFrame=function(d){var v,w;for(v=0,w=f.length;v<w;v+=1)if(f[v][0]===d){f.splice(v,1);return}for(v=0,w=c.length;v<w;v+=1)if(c[v][0]===d){c.splice(v,1);return}}}})(window);function h(u,o){return o&&u!==document.body?document.body:u.offsetParent}})(r),(function(e,t){a.exports?a.exports=t():e.OpenSeadragon=t()})(dh,function(){return r}),(function(e){class t{constructor(n){n||(n=[0,0,0,0,0,0,0,0,0]),this.values=n}static makeIdentity(){return new t([1,0,0,0,1,0,0,0,1])}static makeTranslation(n,s){return new t([1,0,0,0,1,0,n,s,1])}static makeRotation(n){var s=Math.cos(n),h=Math.sin(n);return new t([s,-h,0,h,s,0,0,0,1])}static makeScaling(n,s){return new t([n,0,0,0,s,0,0,0,1])}multiply(n){let s=this.values,h=n.values;var u=s[0],o=s[1],l=s[2],f=s[3],c=s[4],p=s[5],_=s[6],d=s[7],v=s[8],w=h[0],S=h[1],R=h[2],P=h[3],A=h[4],F=h[5],N=h[6],z=h[7],I=h[8];return new t([w*u+S*f+R*_,w*o+S*c+R*d,w*l+S*p+R*v,P*u+A*f+F*_,P*o+A*c+F*d,P*l+A*p+F*v,N*u+z*f+I*_,N*o+z*c+I*d,N*l+z*p+I*v])}}e.Mat3=t})(r),(function(e){var t={supportsFullScreen:!1,isFullScreen:function(){return!1},getFullScreenElement:function(){return null},requestFullScreen:function(){},exitFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",fullScreenErrorEventName:""};document.exitFullscreen?(t.supportsFullScreen=!0,t.getFullScreenElement=function(){return document.fullscreenElement},t.requestFullScreen=function(i){return i.requestFullscreen().catch(function(n){e.console.error("Fullscreen request failed: ",n)})},t.exitFullScreen=function(){document.exitFullscreen().catch(function(i){e.console.error("Error while exiting fullscreen: ",i)})},t.fullScreenEventName="fullscreenchange",t.fullScreenErrorEventName="fullscreenerror"):document.msExitFullscreen?(t.supportsFullScreen=!0,t.getFullScreenElement=function(){return document.msFullscreenElement},t.requestFullScreen=function(i){return i.msRequestFullscreen()},t.exitFullScreen=function(){document.msExitFullscreen()},t.fullScreenEventName="MSFullscreenChange",t.fullScreenErrorEventName="MSFullscreenError"):document.webkitExitFullscreen?(t.supportsFullScreen=!0,t.getFullScreenElement=function(){return document.webkitFullscreenElement},t.requestFullScreen=function(i){return i.webkitRequestFullscreen()},t.exitFullScreen=function(){document.webkitExitFullscreen()},t.fullScreenEventName="webkitfullscreenchange",t.fullScreenErrorEventName="webkitfullscreenerror"):document.webkitCancelFullScreen?(t.supportsFullScreen=!0,t.getFullScreenElement=function(){return document.webkitCurrentFullScreenElement},t.requestFullScreen=function(i){return i.webkitRequestFullScreen()},t.exitFullScreen=function(){document.webkitCancelFullScreen()},t.fullScreenEventName="webkitfullscreenchange",t.fullScreenErrorEventName="webkitfullscreenerror"):document.mozCancelFullScreen&&(t.supportsFullScreen=!0,t.getFullScreenElement=function(){return document.mozFullScreenElement},t.requestFullScreen=function(i){return i.mozRequestFullScreen()},t.exitFullScreen=function(){document.mozCancelFullScreen()},t.fullScreenEventName="mozfullscreenchange",t.fullScreenErrorEventName="mozfullscreenerror"),t.isFullScreen=function(){return t.getFullScreenElement()!==null},t.cancelFullScreen=function(){e.console.error("cancelFullScreen is deprecated. Use exitFullScreen instead."),t.exitFullScreen()},e.extend(e,t)})(r),(function(e){e.EventSource=function(){this.events={},this._rejectedEventList={}},e.EventSource.prototype={addOnceHandler:function(t,i,n,s,h){var u=this;s=s||1;var o=0,l=function(f){return o++,o===s&&u.removeHandler(t,l),i(f)};return this.addHandler(t,l,n,h)},addHandler:function(t,i,n,s){if(Object.prototype.hasOwnProperty.call(this._rejectedEventList,t))return e.console.error(`Error adding handler for ${t}. ${this._rejectedEventList[t]}`),!1;var h=this.events[t];if(h||(this.events[t]=h=[]),i&&e.isFunction(i)){var u=h.length,o={handler:i,userData:n||null,priority:s||0};for(h[u]=o;u>0&&h[u-1].priority<h[u].priority;)h[u]=h[u-1],h[u-1]=o,u--}return!0},removeHandler:function(t,i){var n=this.events[t],s=[],h;if(n&&e.isArray(n)){for(h=0;h<n.length;h++)n[h].handler!==i&&s.push(n[h]);this.events[t]=s}},numberOfHandlers:function(t){var i=this.events[t];return i?i.length:0},removeAllHandlers:function(t){if(t)this.events[t]=[];else for(var i in this.events)this.events[i]=[]},getHandler:function(t){var i=this.events[t];return!i||!i.length?null:(i=i.length===1?[i[0]]:Array.apply(null,i),function(n,s){var h,u=i.length;for(h=0;h<u;h++)i[h]&&(s.eventSource=n,s.userData=i[h].userData,i[h].handler(s))})},raiseEvent:function(t,i){if(Object.prototype.hasOwnProperty.call(this._rejectedEventList,t))return e.console.error(`Error adding handler for ${t}. ${this._rejectedEventList[t]}`),!1;var n=this.getHandler(t);return n&&n(this,i||{}),!0},rejectEventHandler(t,i=""){this._rejectedEventList[t]=i},allowEventHandler(t){delete this._rejectedEventList[t]}}})(r),(function(e){var t={};e.MouseTracker=function(y){var m=arguments;e.isPlainObject(y)||(y={element:m[0],clickTimeThreshold:m[1],clickDistThreshold:m[2]}),this.hash=Math.random(),this.element=e.getElement(y.element),this.clickTimeThreshold=y.clickTimeThreshold||e.DEFAULT_SETTINGS.clickTimeThreshold,this.clickDistThreshold=y.clickDistThreshold||e.DEFAULT_SETTINGS.clickDistThreshold,this.dblClickTimeThreshold=y.dblClickTimeThreshold||e.DEFAULT_SETTINGS.dblClickTimeThreshold,this.dblClickDistThreshold=y.dblClickDistThreshold||e.DEFAULT_SETTINGS.dblClickDistThreshold,this.userData=y.userData||null,this.stopDelay=y.stopDelay||50,this.preProcessEventHandler=y.preProcessEventHandler||null,this.contextMenuHandler=y.contextMenuHandler||null,this.enterHandler=y.enterHandler||null,this.leaveHandler=y.leaveHandler||null,this.exitHandler=y.exitHandler||null,this.overHandler=y.overHandler||null,this.outHandler=y.outHandler||null,this.pressHandler=y.pressHandler||null,this.nonPrimaryPressHandler=y.nonPrimaryPressHandler||null,this.releaseHandler=y.releaseHandler||null,this.nonPrimaryReleaseHandler=y.nonPrimaryReleaseHandler||null,this.moveHandler=y.moveHandler||null,this.scrollHandler=y.scrollHandler||null,this.clickHandler=y.clickHandler||null,this.dblClickHandler=y.dblClickHandler||null,this.dragHandler=y.dragHandler||null,this.dragEndHandler=y.dragEndHandler||null,this.pinchHandler=y.pinchHandler||null,this.stopHandler=y.stopHandler||null,this.keyDownHandler=y.keyDownHandler||null,this.keyUpHandler=y.keyUpHandler||null,this.keyHandler=y.keyHandler||null,this.focusHandler=y.focusHandler||null,this.blurHandler=y.blurHandler||null;var E=this;t[this.hash]={click:function(b){R(E,b)},dblclick:function(b){P(E,b)},keydown:function(b){A(E,b)},keyup:function(b){F(E,b)},keypress:function(b){N(E,b)},focus:function(b){z(E,b)},blur:function(b){I(E,b)},contextmenu:function(b){D(E,b)},wheel:function(b){H(E,b)},mousewheel:function(b){k(E,b)},DOMMouseScroll:function(b){k(E,b)},MozMousePixelScroll:function(b){k(E,b)},losecapture:function(b){O(E,b)},mouseenter:function(b){re(E,b)},mouseleave:function(b){j(E,b)},mouseover:function(b){se(E,b)},mouseout:function(b){nt(E,b)},mousedown:function(b){We(E,b)},mouseup:function(b){De(E,b)},mousemove:function(b){wi(E,b)},touchstart:function(b){U(E,b)},touchend:function(b){te(E,b)},touchmove:function(b){$(E,b)},touchcancel:function(b){ne(E,b)},gesturestart:function(b){B(E,b)},gesturechange:function(b){W(E,b)},gotpointercapture:function(b){de(E,b)},lostpointercapture:function(b){ce(E,b)},pointerenter:function(b){re(E,b)},pointerleave:function(b){j(E,b)},pointerover:function(b){se(E,b)},pointerout:function(b){nt(E,b)},pointerdown:function(b){We(E,b)},pointerup:function(b){De(E,b)},pointermove:function(b){wi(E,b)},pointercancel:function(b){Wt(E,b)},pointerupcaptured:function(b){Ke(E,b)},pointermovecaptured:function(b){Ui(E,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."),y.startDisabled||this.setTracking(!0)},e.MouseTracker.prototype={destroy:function(){u(this),this.element=null,t[this.hash]=null,delete t[this.hash]},isTracking:function(){return t[this.hash].tracking},setTracking:function(y){return y?h(this):u(this),this},getActivePointersListByType:function(y){var m=t[this.hash],E,b=m?m.activePointersLists.length:0,V;for(E=0;E<b;E++)if(m.activePointersLists[E].type===y)return m.activePointersLists[E];return V=new e.MouseTracker.GesturePointList(y),m&&m.activePointersLists.push(V),V},getActivePointerCount:function(){var y=t[this.hash],m,E=y.activePointersLists.length,b=0;for(m=0;m<E;m++)b+=y.activePointersLists[m].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 i=(function(){try{return window.self!==window.top}catch{return!0}})();function n(y){try{return y.addEventListener&&y.removeEventListener}catch{return!1}}e.MouseTracker.gesturePointVelocityTracker=(function(){var y=[],m=0,E=0,b=function(Le,ve){return Le.hash.toString()+ve.type+ve.id.toString()},V=function(){var Le,ve=y.length,Dt,tt,ar=e.now(),Ho,Fo,No;for(Ho=ar-E,E=ar,Le=0;Le<ve;Le++)Dt=y[Le],tt=Dt.gPoint,tt.direction=Math.atan2(tt.currentPos.y-Dt.lastPos.y,tt.currentPos.x-Dt.lastPos.x),Fo=Dt.lastPos.distanceTo(tt.currentPos),Dt.lastPos=tt.currentPos,No=1e3*Fo/(Ho+1),tt.speed=.75*No+.25*tt.speed},ee=function(Le,ve){var Dt=b(Le,ve);y.push({guid:Dt,gPoint:ve,lastPos:ve.currentPos}),y.length===1&&(E=e.now(),m=window.setInterval(V,50))},pe=function(Le,ve){var Dt=b(Le,ve),tt,ar=y.length;for(tt=0;tt<ar;tt++)if(y[tt].guid===Dt){y.splice(tt,1),ar--,ar===0&&window.clearInterval(m);break}};return{addPoint:ee,removePoint:pe}})(),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 y=document.createElement("div");return e.isFunction(y.setPointerCapture)&&e.isFunction(y.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 y=document.createElement("div");return e.isFunction(y.setCapture)&&e.isFunction(y.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(y){this._gPoints=[],this.type=y,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(y){return this._gPoints.push(y)},removeById:function(y){var m,E=this._gPoints.length;for(m=0;m<E;m++)if(this._gPoints[m].id===y){this._gPoints.splice(m,1);break}return this._gPoints.length},getByIndex:function(y){return y<this._gPoints.length?this._gPoints[y]:null},getById:function(y){var m,E=this._gPoints.length;for(m=0;m<E;m++)if(this._gPoints[m].id===y)return this._gPoints[m];return null},getPrimary:function(y){var m,E=this._gPoints.length;for(m=0;m<E;m++)if(this._gPoints[m].isPrimary)return this._gPoints[m];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 s(y){var m=t[y.hash],E,b,V,ee,pe,Le=m.activePointersLists.length;for(E=0;E<Le;E++)if(V=m.activePointersLists[E],V.getLength()>0){for(pe=[],ee=V.asArray(),b=0;b<ee.length;b++)pe.push(ee[b]);for(b=0;b<pe.length;b++)yt(y,V,pe[b])}for(E=0;E<Le;E++)m.activePointersLists.pop();m.sentDragEvent=!1}function h(y){var m=t[y.hash],E,b;if(!m.tracking){for(b=0;b<e.MouseTracker.subscribeEvents.length;b++)E=e.MouseTracker.subscribeEvents[b],e.addEvent(y.element,E,m[E],E===e.MouseTracker.wheelEventName?{passive:!1,capture:!1}:!1);s(y),m.tracking=!0}}function u(y){var m=t[y.hash],E,b;if(m.tracking){for(b=0;b<e.MouseTracker.subscribeEvents.length;b++)E=e.MouseTracker.subscribeEvents[b],e.removeEvent(y.element,E,m[E],!1);s(y),m.tracking=!1}}function o(y,m){var E=t[y.hash];if(m==="pointerevent")return{upName:"pointerup",upHandler:E.pointerupcaptured,moveName:"pointermove",moveHandler:E.pointermovecaptured};if(m==="mouse")return{upName:"pointerup",upHandler:E.pointerupcaptured,moveName:"pointermove",moveHandler:E.pointermovecaptured};if(m==="touch")return{upName:"touchend",upHandler:E.touchendcaptured,moveName:"touchmove",moveHandler:E.touchmovecaptured};throw new Error("MouseTracker.getCaptureEventParams: Unknown pointer type.")}function l(y,m){var E;if(e.MouseTracker.havePointerCapture)if(e.MouseTracker.havePointerEvents)try{y.element.setPointerCapture(m.id)}catch{e.console.warn("setPointerCapture() called on invalid pointer ID");return}else y.element.setCapture(!0);else E=o(y,e.MouseTracker.havePointerEvents?"pointerevent":m.type),i&&n(window.top)&&e.addEvent(window.top,E.upName,E.upHandler,!0),e.addEvent(e.MouseTracker.captureElement,E.upName,E.upHandler,!0),e.addEvent(e.MouseTracker.captureElement,E.moveName,E.moveHandler,!0);M(y,m,!0)}function f(y,m){var E,b,V;if(e.MouseTracker.havePointerCapture)if(e.MouseTracker.havePointerEvents){if(b=y.getActivePointersListByType(m.type),V=b.getById(m.id),!V||!V.captured)return;try{y.element.releasePointerCapture(m.id)}catch{}}else y.element.releaseCapture();else E=o(y,e.MouseTracker.havePointerEvents?"pointerevent":m.type),i&&n(window.top)&&e.removeEvent(window.top,E.upName,E.upHandler,!0),e.removeEvent(e.MouseTracker.captureElement,E.moveName,E.moveHandler,!0),e.removeEvent(e.MouseTracker.captureElement,E.upName,E.upHandler,!0);M(y,m,!1)}function c(y){return e.MouseTracker.havePointerEvents?y.pointerId:e.MouseTracker.mousePointerId}function p(y){return e.MouseTracker.havePointerEvents&&y.pointerType?y.pointerType:"mouse"}function _(y){return e.MouseTracker.havePointerEvents?y.isPrimary:!0}function d(y){return e.getMousePosition(y)}function v(y,m){return w(d(y),m)}function w(y,m){var E=e.getElementOffset(m);return y.minus(E)}function S(y,m){return new e.Point((y.x+m.x)/2,(y.y+m.y)/2)}function R(y,m){var E={originalEvent:m,eventType:"click",pointerType:"mouse",isEmulated:!1};x(y,E),E.preventDefault&&!E.defaultPrevented&&e.cancelEvent(m),E.stopPropagation&&e.stopEvent(m)}function P(y,m){var E={originalEvent:m,eventType:"dblclick",pointerType:"mouse",isEmulated:!1};x(y,E),E.preventDefault&&!E.defaultPrevented&&e.cancelEvent(m),E.stopPropagation&&e.stopEvent(m)}function A(y,m){var E=null,b={originalEvent:m,eventType:"keydown",pointerType:"",isEmulated:!1};x(y,b),y.keyDownHandler&&!b.preventGesture&&!b.defaultPrevented&&(E={eventSource:y,keyCode:m.keyCode?m.keyCode:m.charCode,ctrl:m.ctrlKey,shift:m.shiftKey,alt:m.altKey,meta:m.metaKey,originalEvent:m,preventDefault:b.preventDefault||b.defaultPrevented,userData:y.userData},y.keyDownHandler(E)),(E&&E.preventDefault||b.preventDefault&&!b.defaultPrevented)&&e.cancelEvent(m),b.stopPropagation&&e.stopEvent(m)}function F(y,m){var E=null,b={originalEvent:m,eventType:"keyup",pointerType:"",isEmulated:!1};x(y,b),y.keyUpHandler&&!b.preventGesture&&!b.defaultPrevented&&(E={eventSource:y,keyCode:m.keyCode?m.keyCode:m.charCode,ctrl:m.ctrlKey,shift:m.shiftKey,alt:m.altKey,meta:m.metaKey,originalEvent:m,preventDefault:b.preventDefault||b.defaultPrevented,userData:y.userData},y.keyUpHandler(E)),(E&&E.preventDefault||b.preventDefault&&!b.defaultPrevented)&&e.cancelEvent(m),b.stopPropagation&&e.stopEvent(m)}function N(y,m){var E=null,b={originalEvent:m,eventType:"keypress",pointerType:"",isEmulated:!1};x(y,b),y.keyHandler&&!b.preventGesture&&!b.defaultPrevented&&(E={eventSource:y,keyCode:m.keyCode?m.keyCode:m.charCode,ctrl:m.ctrlKey,shift:m.shiftKey,alt:m.altKey,meta:m.metaKey,originalEvent:m,preventDefault:b.preventDefault||b.defaultPrevented,userData:y.userData},y.keyHandler(E)),(E&&E.preventDefault||b.preventDefault&&!b.defaultPrevented)&&e.cancelEvent(m),b.stopPropagation&&e.stopEvent(m)}function z(y,m){var E={originalEvent:m,eventType:"focus",pointerType:"",isEmulated:!1};x(y,E),y.focusHandler&&!E.preventGesture&&y.focusHandler({eventSource:y,originalEvent:m,userData:y.userData})}function I(y,m){var E={originalEvent:m,eventType:"blur",pointerType:"",isEmulated:!1};x(y,E),y.blurHandler&&!E.preventGesture&&y.blurHandler({eventSource:y,originalEvent:m,userData:y.userData})}function D(y,m){var E=null,b={originalEvent:m,eventType:"contextmenu",pointerType:"mouse",isEmulated:!1};x(y,b),y.contextMenuHandler&&!b.preventGesture&&!b.defaultPrevented&&(E={eventSource:y,position:w(d(m),y.element),originalEvent:b.originalEvent,preventDefault:b.preventDefault||b.defaultPrevented,userData:y.userData},y.contextMenuHandler(E)),(E&&E.preventDefault||b.preventDefault&&!b.defaultPrevented)&&e.cancelEvent(m),b.stopPropagation&&e.stopEvent(m)}function H(y,m){q(y,m,m)}function k(y,m){var E={target:m.target||m.srcElement,type:"wheel",shiftKey:m.shiftKey||!1,clientX:m.clientX,clientY:m.clientY,pageX:m.pageX?m.pageX:m.clientX,pageY:m.pageY?m.pageY:m.clientY,deltaMode:m.type==="MozMousePixelScroll"?0:1,deltaX:0,deltaZ:0};e.MouseTracker.wheelEventName==="mousewheel"?E.deltaY=-m.wheelDelta/e.DEFAULT_SETTINGS.pixelsPerWheelLine:E.deltaY=m.detail,q(y,E,m)}function q(y,m,E){var b=0,V,ee=null;b=m.deltaY?m.deltaY<0?1:-1:0,V={originalEvent:m,eventType:"wheel",pointerType:"mouse",isEmulated:m!==E},x(y,V),y.scrollHandler&&!V.preventGesture&&!V.defaultPrevented&&(ee={eventSource:y,pointerType:"mouse",position:v(m,y.element),scroll:b,shift:m.shiftKey,isTouchEvent:!1,originalEvent:E,preventDefault:V.preventDefault||V.defaultPrevented,userData:y.userData},y.scrollHandler(ee)),V.stopPropagation&&e.stopEvent(E),(ee&&ee.preventDefault||V.preventDefault&&!V.defaultPrevented)&&e.cancelEvent(E)}function O(y,m){var E={id:e.MouseTracker.mousePointerId,type:"mouse"},b={originalEvent:m,eventType:"lostpointercapture",pointerType:"mouse",isEmulated:!1};x(y,b),m.target===y.element&&M(y,E,!1),b.stopPropagation&&e.stopEvent(m)}function U(y,m){var E,b,V=m.changedTouches.length,ee,pe=y.getActivePointersListByType("touch");E=e.now(),pe.getLength()>m.touches.length-V&&e.console.warn("Tracked touch contact count doesn't match event.touches.length");var Le={originalEvent:m,eventType:"pointerdown",pointerType:"touch",isEmulated:!1};for(x(y,Le),b=0;b<V;b++)ee={id:m.changedTouches[b].identifier,type:"touch",isPrimary:pe.getLength()===0,currentPos:d(m.changedTouches[b]),currentTime:E},X(y,Le,ee),ye(y,Le,ee,0),M(y,ee,!0);Le.preventDefault&&!Le.defaultPrevented&&e.cancelEvent(m),Le.stopPropagation&&e.stopEvent(m)}function te(y,m){var E,b,V=m.changedTouches.length,ee;E=e.now();var pe={originalEvent:m,eventType:"pointerup",pointerType:"touch",isEmulated:!1};for(x(y,pe),b=0;b<V;b++)ee={id:m.changedTouches[b].identifier,type:"touch",currentPos:d(m.changedTouches[b]),currentTime:E},Oe(y,pe,ee,0),M(y,ee,!1),oe(y,pe,ee);pe.preventDefault&&!pe.defaultPrevented&&e.cancelEvent(m),pe.stopPropagation&&e.stopEvent(m)}function $(y,m){var E,b,V=m.changedTouches.length,ee;E=e.now();var pe={originalEvent:m,eventType:"pointermove",pointerType:"touch",isEmulated:!1};for(x(y,pe),b=0;b<V;b++)ee={id:m.changedTouches[b].identifier,type:"touch",currentPos:d(m.changedTouches[b]),currentTime:E},Fe(y,pe,ee);pe.preventDefault&&!pe.defaultPrevented&&e.cancelEvent(m),pe.stopPropagation&&e.stopEvent(m)}function ne(y,m){var E=m.changedTouches.length,b,V,ee={originalEvent:m,eventType:"pointercancel",pointerType:"touch",isEmulated:!1};for(x(y,ee),b=0;b<E;b++)V={id:m.changedTouches[b].identifier,type:"touch"},we(y,ee,V);ee.stopPropagation&&e.stopEvent(m)}function B(y,m){return e.eventIsCanceled(m)||m.preventDefault(),!1}function W(y,m){return e.eventIsCanceled(m)||m.preventDefault(),!1}function de(y,m){var E={originalEvent:m,eventType:"gotpointercapture",pointerType:p(m),isEmulated:!1};x(y,E),m.target===y.element&&M(y,{id:m.pointerId,type:p(m)},!0),E.stopPropagation&&e.stopEvent(m)}function ce(y,m){var E={originalEvent:m,eventType:"lostpointercapture",pointerType:p(m),isEmulated:!1};x(y,E),m.target===y.element&&M(y,{id:m.pointerId,type:p(m)},!1),E.stopPropagation&&e.stopEvent(m)}function re(y,m){var E={id:c(m),type:p(m),isPrimary:_(m),currentPos:d(m),currentTime:e.now()},b={originalEvent:m,eventType:"pointerenter",pointerType:E.type,isEmulated:!1};x(y,b),X(y,b,E)}function j(y,m){var E={id:c(m),type:p(m),isPrimary:_(m),currentPos:d(m),currentTime:e.now()},b={originalEvent:m,eventType:"pointerleave",pointerType:E.type,isEmulated:!1};x(y,b),oe(y,b,E)}function se(y,m){var E={id:c(m),type:p(m),isPrimary:_(m),currentPos:d(m),currentTime:e.now()},b={originalEvent:m,eventType:"pointerover",pointerType:E.type,isEmulated:!1};x(y,b),fe(y,b,E),b.preventDefault&&!b.defaultPrevented&&e.cancelEvent(m),b.stopPropagation&&e.stopEvent(m)}function nt(y,m){var E={id:c(m),type:p(m),isPrimary:_(m),currentPos:d(m),currentTime:e.now()},b={originalEvent:m,eventType:"pointerout",pointerType:E.type,isEmulated:!1};x(y,b),Z(y,b,E),b.preventDefault&&!b.defaultPrevented&&e.cancelEvent(m),b.stopPropagation&&e.stopEvent(m)}function We(y,m){var E={id:c(m),type:p(m),isPrimary:_(m),currentPos:d(m),currentTime:e.now()},b=e.MouseTracker.havePointerEvents&&E.type==="touch",V={originalEvent:m,eventType:"pointerdown",pointerType:E.type,isEmulated:!1};x(y,V),ye(y,V,E,m.button),V.preventDefault&&!V.defaultPrevented&&e.cancelEvent(m),V.stopPropagation&&e.stopEvent(m),V.shouldCapture&&(b?M(y,E,!0):l(y,E))}function De(y,m){ct(y,m)}function Ke(y,m){var E=y.getActivePointersListByType(p(m));E.getById(m.pointerId)&&ct(y,m),e.stopEvent(m)}function ct(y,m){var E;E={id:c(m),type:p(m),isPrimary:_(m),currentPos:d(m),currentTime:e.now()};var b={originalEvent:m,eventType:"pointerup",pointerType:E.type,isEmulated:!1};x(y,b),Oe(y,b,E,m.button),b.preventDefault&&!b.defaultPrevented&&e.cancelEvent(m),b.stopPropagation&&e.stopEvent(m),b.shouldReleaseCapture&&(m.target===y.element?f(y,E):M(y,E,!1))}function wi(y,m){It(y,m)}function Ui(y,m){var E=y.getActivePointersListByType(p(m));E.getById(m.pointerId)&&It(y,m),e.stopEvent(m)}function It(y,m){var E={id:c(m),type:p(m),isPrimary:_(m),currentPos:d(m),currentTime:e.now()},b={originalEvent:m,eventType:"pointermove",pointerType:E.type,isEmulated:!1};x(y,b),Fe(y,b,E),b.preventDefault&&!b.defaultPrevented&&e.cancelEvent(m),b.stopPropagation&&e.stopEvent(m)}function Wt(y,m){var E={id:m.pointerId,type:p(m)},b={originalEvent:m,eventType:"pointercancel",pointerType:E.type,isEmulated:!1};x(y,b),we(y,b,E),b.stopPropagation&&e.stopEvent(m)}function kt(y,m){return m.speed=0,m.direction=0,m.contactPos=m.currentPos,m.contactTime=m.currentTime,m.lastPos=m.currentPos,m.lastTime=m.currentTime,y.add(m)}function yt(y,m,E){var b,V=m.getById(E.id);return V?(V.captured&&(e.console.warn("stopTrackingPointer() called on captured pointer"),f(y,V)),m.removeContact(),b=m.removeById(E.id)):b=m.getLength(),b}function g(y,m){switch(m.eventType){case"pointermove":m.isStoppable=!0,m.isCancelable=!0,m.preventDefault=!1,m.preventGesture=!y.hasGestureHandlers,m.stopPropagation=!1;break;case"pointerover":case"pointerout":case"contextmenu":case"keydown":case"keyup":case"keypress":m.isStoppable=!0,m.isCancelable=!0,m.preventDefault=!1,m.preventGesture=!1,m.stopPropagation=!1;break;case"pointerdown":m.isStoppable=!0,m.isCancelable=!0,m.preventDefault=!1,m.preventGesture=!y.hasGestureHandlers,m.stopPropagation=!1;break;case"pointerup":m.isStoppable=!0,m.isCancelable=!0,m.preventDefault=!1,m.preventGesture=!y.hasGestureHandlers,m.stopPropagation=!1;break;case"wheel":m.isStoppable=!0,m.isCancelable=!0,m.preventDefault=!1,m.preventGesture=!y.hasScrollHandler,m.stopPropagation=!1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":m.isStoppable=!0,m.isCancelable=!1,m.preventDefault=!1,m.preventGesture=!1,m.stopPropagation=!1;break;case"click":m.isStoppable=!0,m.isCancelable=!0,m.preventDefault=!!y.clickHandler,m.preventGesture=!1,m.stopPropagation=!1;break;case"dblclick":m.isStoppable=!0,m.isCancelable=!0,m.preventDefault=!!y.dblClickHandler,m.preventGesture=!1,m.stopPropagation=!1;break;case"focus":case"blur":case"pointerenter":case"pointerleave":default:m.isStoppable=!1,m.isCancelable=!1,m.preventDefault=!1,m.preventGesture=!1,m.stopPropagation=!1;break}}function x(y,m){m.eventSource=y,m.eventPhase=m.originalEvent&&typeof m.originalEvent.eventPhase<"u"?m.originalEvent.eventPhase:0,m.defaultPrevented=e.eventIsCanceled(m.originalEvent),m.shouldCapture=!1,m.shouldReleaseCapture=!1,m.userData=y.userData,g(y,m),y.preProcessEventHandler&&y.preProcessEventHandler(m)}function M(y,m,E){var b=y.getActivePointersListByType(m.type),V=b.getById(m.id);V?E&&!V.captured?(V.captured=!0,b.captureCount++):!E&&V.captured&&(V.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 X(y,m,E){var b=y.getActivePointersListByType(E.type),V;V=b.getById(E.id),V?(V.insideElement=!0,V.lastPos=V.currentPos,V.lastTime=V.currentTime,V.currentPos=E.currentPos,V.currentTime=E.currentTime,E=V):(E.captured=!1,E.insideElementPressed=!1,E.insideElement=!0,kt(b,E)),y.enterHandler&&y.enterHandler({eventSource:y,pointerType:E.type,position:w(E.currentPos,y.element),buttons:b.buttons,pointers:y.getActivePointerCount(),insideElementPressed:E.insideElementPressed,buttonDownAny:b.buttons!==0,isTouchEvent:E.type==="touch",originalEvent:m.originalEvent,userData:y.userData})}function oe(y,m,E){var b=y.getActivePointersListByType(E.type),V,ee;V=b.getById(E.id),V?(V.captured?(V.insideElement=!1,V.lastPos=V.currentPos,V.lastTime=V.currentTime,V.currentPos=E.currentPos,V.currentTime=E.currentTime):yt(y,b,V),E=V):(E.captured=!1,E.insideElementPressed=!1),(y.leaveHandler||y.exitHandler)&&(ee={eventSource:y,pointerType:E.type,position:E.currentPos&&w(E.currentPos,y.element),buttons:b.buttons,pointers:y.getActivePointerCount(),insideElementPressed:E.insideElementPressed,buttonDownAny:b.buttons!==0,isTouchEvent:E.type==="touch",originalEvent:m.originalEvent,userData:y.userData},y.leaveHandler&&y.leaveHandler(ee),y.exitHandler&&y.exitHandler(ee))}function fe(y,m,E){var b,V;b=y.getActivePointersListByType(E.type),V=b.getById(E.id),V?E=V:(E.captured=!1,E.insideElementPressed=!1),y.overHandler&&y.overHandler({eventSource:y,pointerType:E.type,position:w(E.currentPos,y.element),buttons:b.buttons,pointers:y.getActivePointerCount(),insideElementPressed:E.insideElementPressed,buttonDownAny:b.buttons!==0,isTouchEvent:E.type==="touch",originalEvent:m.originalEvent,userData:y.userData})}function Z(y,m,E){var b,V;b=y.getActivePointersListByType(E.type),V=b.getById(E.id),V?E=V:(E.captured=!1,E.insideElementPressed=!1),y.outHandler&&y.outHandler({eventSource:y,pointerType:E.type,position:E.currentPos&&w(E.currentPos,y.element),buttons:b.buttons,pointers:y.getActivePointerCount(),insideElementPressed:E.insideElementPressed,buttonDownAny:b.buttons!==0,isTouchEvent:E.type==="touch",originalEvent:m.originalEvent,userData:y.userData})}function ye(y,m,E,b){var V=t[y.hash],ee=y.getActivePointersListByType(E.type),pe;if(typeof m.originalEvent.buttons<"u"?ee.buttons=m.originalEvent.buttons:b===0?ee.buttons|=1:b===1?ee.buttons|=4:b===2?ee.buttons|=2:b===3?ee.buttons|=8:b===4?ee.buttons|=16:b===5&&(ee.buttons|=32),b!==0){m.shouldCapture=!1,m.shouldReleaseCapture=!1,y.nonPrimaryPressHandler&&!m.preventGesture&&!m.defaultPrevented&&(m.preventDefault=!0,y.nonPrimaryPressHandler({eventSource:y,pointerType:E.type,position:w(E.currentPos,y.element),button:b,buttons:ee.buttons,isTouchEvent:E.type==="touch",originalEvent:m.originalEvent,userData:y.userData}));return}pe=ee.getById(E.id),pe?(pe.insideElementPressed=!0,pe.insideElement=!0,pe.originalTarget=m.originalEvent.target,pe.contactPos=E.currentPos,pe.contactTime=E.currentTime,pe.lastPos=pe.currentPos,pe.lastTime=pe.currentTime,pe.currentPos=E.currentPos,pe.currentTime=E.currentTime,E=pe):(E.captured=!1,E.insideElementPressed=!0,E.insideElement=!0,E.originalTarget=m.originalEvent.target,kt(ee,E)),ee.addContact(),!m.preventGesture&&!m.defaultPrevented?(m.shouldCapture=!0,m.shouldReleaseCapture=!1,m.preventDefault=!0,(y.dragHandler||y.dragEndHandler||y.pinchHandler)&&e.MouseTracker.gesturePointVelocityTracker.addPoint(y,E),ee.contacts===1?y.pressHandler&&!m.preventGesture&&y.pressHandler({eventSource:y,pointerType:E.type,position:w(E.contactPos,y.element),buttons:ee.buttons,isTouchEvent:E.type==="touch",originalEvent:m.originalEvent,userData:y.userData}):ee.contacts===2&&y.pinchHandler&&E.type==="touch"&&(V.pinchGPoints=ee.asArray(),V.lastPinchDist=V.currentPinchDist=V.pinchGPoints[0].currentPos.distanceTo(V.pinchGPoints[1].currentPos),V.lastPinchCenter=V.currentPinchCenter=S(V.pinchGPoints[0].currentPos,V.pinchGPoints[1].currentPos))):(m.shouldCapture=!1,m.shouldReleaseCapture=!1)}function Oe(y,m,E,b){var V=t[y.hash],ee=y.getActivePointersListByType(E.type),pe,Le,ve,Dt=!1,tt;if(typeof m.originalEvent.buttons<"u"?ee.buttons=m.originalEvent.buttons:b===0?ee.buttons^=-2:b===1?ee.buttons^=-5:b===2?ee.buttons^=-3:b===3?ee.buttons^=-9:b===4?ee.buttons^=-17:b===5&&(ee.buttons^=-33),m.shouldCapture=!1,b!==0){m.shouldReleaseCapture=!1,y.nonPrimaryReleaseHandler&&!m.preventGesture&&!m.defaultPrevented&&(m.preventDefault=!0,y.nonPrimaryReleaseHandler({eventSource:y,pointerType:E.type,position:w(E.currentPos,y.element),button:b,buttons:ee.buttons,isTouchEvent:E.type==="touch",originalEvent:m.originalEvent,userData:y.userData}));return}ve=ee.getById(E.id),ve?(ee.removeContact(),ve.captured&&(Dt=!0),ve.lastPos=ve.currentPos,ve.lastTime=ve.currentTime,ve.currentPos=E.currentPos,ve.currentTime=E.currentTime,ve.insideElement||yt(y,ee,ve),pe=ve.currentPos,Le=ve.currentTime):(E.captured=!1,E.insideElementPressed=!1,E.insideElement=!0,kt(ee,E),ve=E),!m.preventGesture&&!m.defaultPrevented&&(Dt?(m.shouldReleaseCapture=!0,m.preventDefault=!0,(y.dragHandler||y.dragEndHandler||y.pinchHandler)&&e.MouseTracker.gesturePointVelocityTracker.removePoint(y,ve),ee.contacts===0?(y.releaseHandler&&pe&&y.releaseHandler({eventSource:y,pointerType:ve.type,position:w(pe,y.element),buttons:ee.buttons,insideElementPressed:ve.insideElementPressed,insideElementReleased:ve.insideElement,isTouchEvent:ve.type==="touch",originalEvent:m.originalEvent,userData:y.userData}),y.dragEndHandler&&V.sentDragEvent&&y.dragEndHandler({eventSource:y,pointerType:ve.type,position:w(ve.currentPos,y.element),speed:ve.speed,direction:ve.direction,shift:m.originalEvent.shiftKey,isTouchEvent:ve.type==="touch",originalEvent:m.originalEvent,userData:y.userData}),V.sentDragEvent=!1,(y.clickHandler||y.dblClickHandler)&&ve.insideElement&&(tt=Le-ve.contactTime<=y.clickTimeThreshold&&ve.contactPos.distanceTo(pe)<=y.clickDistThreshold,y.clickHandler&&y.clickHandler({eventSource:y,pointerType:ve.type,position:w(ve.currentPos,y.element),quick:tt,shift:m.originalEvent.shiftKey,isTouchEvent:ve.type==="touch",originalEvent:m.originalEvent,originalTarget:ve.originalTarget,userData:y.userData}),y.dblClickHandler&&tt&&(ee.clicks++,ee.clicks===1?(V.lastClickPos=pe,V.dblClickTimeOut=setTimeout(function(){ee.clicks=0},y.dblClickTimeThreshold)):ee.clicks===2&&(clearTimeout(V.dblClickTimeOut),ee.clicks=0,V.lastClickPos.distanceTo(pe)<=y.dblClickDistThreshold&&y.dblClickHandler({eventSource:y,pointerType:ve.type,position:w(ve.currentPos,y.element),shift:m.originalEvent.shiftKey,isTouchEvent:ve.type==="touch",originalEvent:m.originalEvent,userData:y.userData}),V.lastClickPos=null)))):ee.contacts===2&&y.pinchHandler&&ve.type==="touch"&&(V.pinchGPoints=ee.asArray(),V.lastPinchDist=V.currentPinchDist=V.pinchGPoints[0].currentPos.distanceTo(V.pinchGPoints[1].currentPos),V.lastPinchCenter=V.currentPinchCenter=S(V.pinchGPoints[0].currentPos,V.pinchGPoints[1].currentPos))):(m.shouldReleaseCapture=!1,y.releaseHandler&&pe&&(y.releaseHandler({eventSource:y,pointerType:ve.type,position:w(pe,y.element),buttons:ee.buttons,insideElementPressed:ve.insideElementPressed,insideElementReleased:ve.insideElement,isTouchEvent:ve.type==="touch",originalEvent:m.originalEvent,userData:y.userData}),m.preventDefault=!0)))}function Fe(y,m,E){var b=t[y.hash],V=y.getActivePointersListByType(E.type),ee,pe,Le;if(typeof m.originalEvent.buttons<"u"&&(V.buttons=m.originalEvent.buttons),ee=V.getById(E.id),ee)ee.lastPos=ee.currentPos,ee.lastTime=ee.currentTime,ee.currentPos=E.currentPos,ee.currentTime=E.currentTime;else return;m.shouldCapture=!1,m.shouldReleaseCapture=!1,y.stopHandler&&E.type==="mouse"&&(clearTimeout(y.stopTimeOut),y.stopTimeOut=setTimeout(function(){qe(y,m.originalEvent,E.type)},y.stopDelay)),V.contacts===0?y.moveHandler&&y.moveHandler({eventSource:y,pointerType:E.type,position:w(E.currentPos,y.element),buttons:V.buttons,isTouchEvent:E.type==="touch",originalEvent:m.originalEvent,userData:y.userData}):V.contacts===1?(y.moveHandler&&(ee=V.asArray()[0],y.moveHandler({eventSource:y,pointerType:ee.type,position:w(ee.currentPos,y.element),buttons:V.buttons,isTouchEvent:ee.type==="touch",originalEvent:m.originalEvent,userData:y.userData})),y.dragHandler&&!m.preventGesture&&!m.defaultPrevented&&(ee=V.asArray()[0],Le=ee.currentPos.minus(ee.lastPos),y.dragHandler({eventSource:y,pointerType:ee.type,position:w(ee.currentPos,y.element),buttons:V.buttons,delta:Le,speed:ee.speed,direction:ee.direction,shift:m.originalEvent.shiftKey,isTouchEvent:ee.type==="touch",originalEvent:m.originalEvent,userData:y.userData}),m.preventDefault=!0,b.sentDragEvent=!0)):V.contacts===2&&(y.moveHandler&&(pe=V.asArray(),y.moveHandler({eventSource:y,pointerType:pe[0].type,position:w(S(pe[0].currentPos,pe[1].currentPos),y.element),buttons:V.buttons,isTouchEvent:pe[0].type==="touch",originalEvent:m.originalEvent,userData:y.userData})),y.pinchHandler&&E.type==="touch"&&!m.preventGesture&&!m.defaultPrevented&&(Le=b.pinchGPoints[0].currentPos.distanceTo(b.pinchGPoints[1].currentPos),Le!==b.currentPinchDist&&(b.lastPinchDist=b.currentPinchDist,b.currentPinchDist=Le,b.lastPinchCenter=b.currentPinchCenter,b.currentPinchCenter=S(b.pinchGPoints[0].currentPos,b.pinchGPoints[1].currentPos),y.pinchHandler({eventSource:y,pointerType:"touch",gesturePoints:b.pinchGPoints,lastCenter:w(b.lastPinchCenter,y.element),center:w(b.currentPinchCenter,y.element),lastDistance:b.lastPinchDist,distance:b.currentPinchDist,shift:m.originalEvent.shiftKey,originalEvent:m.originalEvent,userData:y.userData}),m.preventDefault=!0)))}function we(y,m,E){var b=y.getActivePointersListByType(E.type),V;V=b.getById(E.id),V&&yt(y,b,V)}function qe(y,m,E){y.stopHandler&&y.stopHandler({eventSource:y,pointerType:E,position:v(m,y.element),buttons:y.getActivePointersListByType(E).buttons,isTouchEvent:E==="touch",originalEvent:m,userData:y.userData})}})(r),(function(e){e.ControlAnchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4,ABSOLUTE:5},e.Control=function(t,i,n){var s=t.parentNode;typeof i=="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"),i={anchor:i}),i.attachToViewer=typeof i.attachToViewer>"u"?!0:i.attachToViewer,this.autoFade=typeof i.autoFade>"u"?!0:i.autoFade,this.element=t,this.anchor=i.anchor,this.container=n,this.anchor===e.ControlAnchor.ABSOLUTE?(this.wrapper=e.makeNeutralElement("div"),this.wrapper.style.position="absolute",this.wrapper.style.top=typeof i.top=="number"?i.top+"px":i.top,this.wrapper.style.left=typeof i.left=="number"?i.left+"px":i.left,this.wrapper.style.height=typeof i.height=="number"?i.height+"px":i.height,this.wrapper.style.width=typeof i.width=="number"?i.width+"px":i.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),i.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):s.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(t){this.wrapper.style.display=t?this.anchor===e.ControlAnchor.ABSOLUTE?"block":"inline-block":"none"},setOpacity:function(t){e.setElementOpacity(this.wrapper,t,!0)}}})(r),(function(e){e.ControlDock=function(i){var n=["topleft","topright","bottomright","bottomleft"],s,h;for(e.extend(!0,this,{id:"controldock-"+e.now()+"-"+Math.floor(Math.random()*1e6),container:e.makeNeutralElement("div"),controls:[]},i),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%"),h=0;h<n.length;h++)s=n[h],this.controls[s]=e.makeNeutralElement("div"),this.controls[s].style.position="absolute",s.match("left")&&(this.controls[s].style.left="0px"),s.match("right")&&(this.controls[s].style.right="0px"),s.match("top")&&(this.controls[s].style.top="0px"),s.match("bottom")&&(this.controls[s].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(i,n){i=e.getElement(i);var s=null;if(!(t(this,i)>=0)){switch(n.anchor){case e.ControlAnchor.TOP_RIGHT:s=this.controls.topright,i.style.position="relative",i.style.paddingRight="0px",i.style.paddingTop="0px";break;case e.ControlAnchor.BOTTOM_RIGHT:s=this.controls.bottomright,i.style.position="relative",i.style.paddingRight="0px",i.style.paddingBottom="0px";break;case e.ControlAnchor.BOTTOM_LEFT:s=this.controls.bottomleft,i.style.position="relative",i.style.paddingLeft="0px",i.style.paddingBottom="0px";break;case e.ControlAnchor.TOP_LEFT:s=this.controls.topleft,i.style.position="relative",i.style.paddingLeft="0px",i.style.paddingTop="0px";break;case e.ControlAnchor.ABSOLUTE:s=this.container,i.style.margin="0px",i.style.padding="0px";break;default:case e.ControlAnchor.NONE:s=this.container,i.style.margin="0px",i.style.padding="0px";break}this.controls.push(new e.Control(i,n,s)),i.style.display="inline-block"}},removeControl:function(i){i=e.getElement(i);var n=t(this,i);return n>=0&&(this.controls[n].destroy(),this.controls.splice(n,1)),this},clearControls:function(){for(;this.controls.length>0;)this.controls.pop().destroy();return this},areControlsEnabled:function(){var i;for(i=this.controls.length-1;i>=0;i--)if(this.controls[i].isVisible())return!0;return!1},setControlsEnabled:function(i){var n;for(n=this.controls.length-1;n>=0;n--)this.controls[n].setVisible(i);return this}};function t(i,n){var s=i.controls,h;for(h=s.length-1;h>=0;h--)if(s[h].element===n)return h;return-1}})(r),(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}}})})(r),(function(e){var t={},i=1;e.Viewer=function(g){var x=arguments,M=this,X;e.isPlainObject(g)||(g={id:x[0],xmlPath:x.length>1?x[1]:void 0,prefixUrl:x.length>2?x[2]:void 0,controls:x.length>3?x[3]:void 0,overlays:x.length>4?x[4]:void 0}),g.config&&(e.extend(!0,g,g.config),delete g.config);let oe=["useCanvas"];if(g.drawerOptions=Object.assign({},oe.reduce((Z,ye)=>(Z[ye]=g[ye],delete g[ye],Z),{}),g.drawerOptions),e.extend(!0,this,{id:g.id,hash:g.hash||i++,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,g),typeof this.hash>"u")throw new Error("A hash must be defined, either by specifying options.id or options.hash.");typeof t[this.hash]<"u"&&e.console.warn("Hash "+this.hash+" has already been used."),t[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(Z){var ye=e.getString("Errors.OpenFailed",Z.eventSource,Z.message);M._showMessage(ye)}),e.ControlDock.call(this,g),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(Z){Z.width="100%",Z.height="100%",Z.overflow="hidden",Z.position="absolute",Z.top="0px",Z.left="0px"})(this.canvas.style),e.setElementTouchActionNone(this.canvas),g.tabIndex!==""&&(this.canvas.tabIndex=g.tabIndex===void 0?0:g.tabIndex),this.container.className="openseadragon-container",(function(Z){Z.width="100%",Z.height="100%",Z.position="relative",Z.overflow="hidden",Z.left="0px",Z.top="0px",Z.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,v),keyDownHandler:e.delegate(this,w),keyHandler:e.delegate(this,S),clickHandler:e.delegate(this,R),dblClickHandler:e.delegate(this,P),dragHandler:e.delegate(this,A),dragEndHandler:e.delegate(this,F),enterHandler:e.delegate(this,N),leaveHandler:e.delegate(this,z),pressHandler:e.delegate(this,I),releaseHandler:e.delegate(this,D),nonPrimaryPressHandler:e.delegate(this,H),nonPrimaryReleaseHandler:e.delegate(this,k),scrollHandler:e.delegate(this,te),pinchHandler:e.delegate(this,q),focusHandler:e.delegate(this,O),blurHandler:e.delegate(this,U)}),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,$),leaveHandler:e.delegate(this,ne)}),this.toolbar&&(this.toolbar=new e.ControlDock({element:this.toolbar})),this.bindStandardControls(),t[this.hash].prevContainerSize=n(this.container),window.ResizeObserver?(this._autoResizePolling=!1,this._resizeObserver=new ResizeObserver(function(){t[M.hash].needsResize=!0}),this._resizeObserver.observe(this.container,{})):this._autoResizePolling=!0,this.world=new e.World({viewer:this}),this.world.addHandler("add-item",function(Z){M.source=M.world.getItemAt(0).source,t[M.hash].forceRedraw=!0,M._updateRequestId||(M._updateRequestId=o(M,B))}),this.world.addHandler("remove-item",function(Z){M.world.getItemCount()?M.source=M.world.getItemAt(0).source:M.source=null,t[M.hash].forceRedraw=!0}),this.world.addHandler("metrics-change",function(Z){M.viewport&&M.viewport._setContentBounds(M.world.getHomeBounds(),M.world.getContentFactor())}),this.world.addHandler("item-index-change",function(Z){M.source=M.world.getItemAt(0).source}),this.viewport=new e.Viewport({containerSize:t[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:g.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 fe=Array.isArray(this.drawer)?this.drawer:[this.drawer];fe.length===0&&(fe=[e.DEFAULT_SETTINGS.drawer].flat(),e.console.warn("No valid drawers were selected. Using the default value.")),this.drawer=null;for(const Z of fe)if(this.requestDrawer(Z,{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&&(X=this.buttonGroup.buttons.indexOf(this.rotateLeft),this.buttonGroup.buttons.splice(X,1),this.buttonGroup.element.removeChild(this.rotateLeft.element)),this.rotateRight&&(X=this.buttonGroup.buttons.indexOf(this.rotateRight),this.buttonGroup.buttons.splice(X,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),X=0;X<this.customControls.length;X++)this.addControl(this.customControls[X].id,{anchor:this.customControls[X].anchor});e.requestAnimationFrame(function(){f(M)}),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(g){return e.console.error("[Viewer.openDzi] this function is deprecated; use Viewer.open() instead."),this.open(g)},openTileSource:function(g){return e.console.error("[Viewer.openTileSource] this function is deprecated; use Viewer.open() instead."),this.open(g)},get buttons(){return e.console.warn("Viewer.buttons is deprecated; Please use Viewer.buttonGroup"),this.buttonGroup},open:function(g,x){var M=this;if(this.close(),!g)return this;if(this.sequenceMode&&e.isArray(g))return this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null),typeof x<"u"&&!isNaN(x)&&(this.initialPage=x),this.tileSources=g,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(g)||(g=[g]),!g.length)return this;this._opening=!0;for(var X=g.length,oe=0,fe=0,Z,ye=function(){if(oe+fe===X)if(oe){(M._firstOpen||!M.preserveViewport)&&(M.viewport.goHome(!0),M.viewport.update()),M._firstOpen=!1;var we=g[0];if(we.tileSource&&(we=we.tileSource),M.overlays&&!M.preserveOverlays)for(var qe=0;qe<M.overlays.length;qe++)M.currentOverlays[qe]=h(M,M.overlays[qe]);M._drawOverlays(),M._opening=!1,M.raiseEvent("open",{source:we})}else M._opening=!1,M.raiseEvent("open-failed",Z)},Oe=function(we){(!e.isPlainObject(we)||!we.tileSource)&&(we={tileSource:we}),we.index!==void 0&&(e.console.error("[Viewer.open] setting indexes here is not supported; use addTiledImage instead"),delete we.index),we.collectionImmediately===void 0&&(we.collectionImmediately=!0);var qe=we.success;we.success=function(m){if(oe++,we.tileSource.overlays)for(var E=0;E<we.tileSource.overlays.length;E++)M.addOverlay(we.tileSource.overlays[E]);qe&&qe(m),ye()};var y=we.error;we.error=function(m){fe++,Z||(Z=m),y&&y(m),ye()},M.addTiledImage(we)},Fe=0;Fe<g.length;Fe++)Oe(g[Fe]);return this},close:function(){return t[this.hash]?(this._opening=!1,this.navigator&&this.navigator.close(),this.preserveOverlays||(this.clearOverlays(),this.overlaysContainer.innerHTML=""),t[this.hash].animating=!1,this.world.removeAll(),this.imageLoader.clear(),this.raiseEvent("close"),this):this},destroy:function(){if(t[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(),t[this.navigator.hash]=null,delete t[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(),t[this.hash]=null,delete t[this.hash],this.canvas=null,this.container=null,e._viewers.delete(this.element),this.element=null,this.raiseEvent("destroy"),this.removeAllHandlers()}},requestDrawer(g,x){const M={mainDrawer:!0,redrawImmediately:!0,drawerOptions:null};x=e.extend(!0,M,x);const X=x.mainDrawer,oe=x.redrawImmediately,fe=x.drawerOptions,Z=this.drawer;let ye=null;if(g&&g.prototype instanceof e.DrawerBase?(ye=g,g="custom"):typeof g=="string"&&(ye=e.determineDrawer(g)),ye||e.console.warn("Unsupported drawer! Drawer must be an existing string type, or a class that extends OpenSeadragon.DrawerBase."),ye&&ye.isSupported()){Z&&X&&Z.destroy();const Oe=new ye({viewer:this,viewport:this.viewport,element:this.canvas,debugGridColor:this.debugGridColor,options:fe||this.drawerOptions[g]});return X&&(this.drawer=Oe,oe&&this.forceRedraw()),Oe}return!1},isMouseNavEnabled:function(){return this.innerTracker.isTracking()},setMouseNavEnabled:function(g){return this.innerTracker.setTracking(g),this.outerTracker.setTracking(g),this.raiseEvent("mouse-enabled",{enabled:g}),this},areControlsEnabled:function(){var g=this.controls.length,x;for(x=0;x<this.controls.length;x++)g=g&&this.controls[x].isVisible();return g},setControlsEnabled:function(g){return g?p(this):f(this),this.raiseEvent("controls-enabled",{enabled:g}),this},setDebugMode:function(g){for(var x=0;x<this.world.getItemCount();x++)this.world.getItemAt(x).debugMode=g;this.debugMode=g,this.forceRedraw()},setAjaxHeaders:function(g,x){if(g===null&&(g={}),!e.isPlainObject(g)){console.error("[Viewer.setAjaxHeaders] Ignoring invalid headers, must be a plain object");return}if(x===void 0&&(x=!0),this.ajaxHeaders=g,x){for(var M=0;M<this.world.getItemCount();M++)this.world.getItemAt(M)._updateAjaxHeaders(!0);if(this.navigator&&this.navigator.setAjaxHeaders(this.ajaxHeaders,!0),this.referenceStrip&&this.referenceStrip.miniViewers)for(var X in this.referenceStrip.miniViewers)this.referenceStrip.miniViewers[X].setAjaxHeaders(this.ajaxHeaders,!0)}},addButton:function(g){this.buttonGroup.addButton(g)},isFullPage:function(){return t[this.hash]&&t[this.hash].fullPage},setFullPage:function(g){var x=document.body,M=x.style,X=document.documentElement.style,oe=this,fe,Z;if(g===this.isFullPage())return this;var ye={fullPage:g,preventDefaultAction:!1};if(this.raiseEvent("pre-full-page",ye),ye.preventDefaultAction)return this;if(g&&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=M.margin,this.docMargin=X.margin,M.margin="0",X.margin="0",this.bodyPadding=M.padding,this.docPadding=X.padding,M.padding="0",X.padding="0",this.bodyWidth=M.width,this.docWidth=X.width,M.width="100%",X.width="100%",this.bodyHeight=M.height,this.docHeight=X.height,M.height="100%",X.height="100%",this.bodyDisplay=M.display,M.display="block",this.previousBody=[],t[this.hash].prevElementParent=this.element.parentNode,t[this.hash].prevNextSibling=this.element.nextSibling,t[this.hash].prevElementWidth=this.element.style.width,t[this.hash].prevElementHeight=this.element.style.height,fe=x.childNodes.length,Z=0;Z<fe;Z++)this.previousBody.push(x.childNodes[0]),x.removeChild(x.childNodes[0]);this.toolbar&&this.toolbar.element&&(this.toolbar.parentNode=this.toolbar.element.parentNode,this.toolbar.nextSibling=this.toolbar.element.nextSibling,x.appendChild(this.toolbar.element),e.addClass(this.toolbar.element,"fullpage")),e.addClass(this.element,"fullpage"),x.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"),t[this.hash].fullPage=!0,e.delegate(this,$)({})}else{for(this.element.style.margin=this.elementMargin,this.element.style.padding=this.elementPadding,M.margin=this.bodyMargin,X.margin=this.docMargin,M.padding=this.bodyPadding,X.padding=this.docPadding,M.width=this.bodyWidth,X.width=this.docWidth,M.height=this.bodyHeight,X.height=this.docHeight,M.display=this.bodyDisplay,x.removeChild(this.element),fe=this.previousBody.length,Z=0;Z<fe;Z++)x.appendChild(this.previousBody.shift());e.removeClass(this.element,"fullpage"),t[this.hash].prevElementParent.insertBefore(this.element,t[this.hash].prevNextSibling),this.toolbar&&this.toolbar.element&&(x.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=t[this.hash].prevElementWidth,this.element.style.height=t[this.hash].prevElementHeight;var Oe=0,Fe=function(){e.setPageScroll(oe.pageScroll);var we=e.getPageScroll();Oe++,Oe<10&&(we.x!==oe.pageScroll.x||we.y!==oe.pageScroll.y)&&e.requestAnimationFrame(Fe)};e.requestAnimationFrame(Fe),t[this.hash].fullPage=!1,e.delegate(this,ne)({})}return this.navigator&&this.viewport&&this.navigator.update(this.viewport),this.raiseEvent("full-page",{fullPage:g}),this},setFullScreen:function(g){var x=this;if(!e.supportsFullScreen)return this.setFullPage(g);if(e.isFullScreen()===g)return this;var M={fullScreen:g,preventDefaultAction:!1};if(this.raiseEvent("pre-full-screen",M),M.preventDefaultAction)return this;if(g){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 X=function(){var oe=e.isFullScreen();oe||(e.removeEvent(document,e.fullScreenEventName,X),e.removeEvent(document,e.fullScreenErrorEventName,X),x.setFullPage(!1),x.isFullPage()&&(x.element.style.width=x.fullPageStyleWidth,x.element.style.height=x.fullPageStyleHeight)),x.navigator&&x.viewport&&setTimeout(function(){x.navigator.update(x.viewport)}),x.raiseEvent("full-screen",{fullScreen:oe})};e.addEvent(document,e.fullScreenEventName,X),e.addEvent(document,e.fullScreenErrorEventName,X),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(g){return this.container.style.visibility=g?"":"hidden",this.raiseEvent("visible",{visible:g}),this},addTiledImage:function(g){e.console.assert(g,"[Viewer.addTiledImage] options is required"),e.console.assert(g.tileSource,"[Viewer.addTiledImage] options.tileSource is required"),e.console.assert(!g.replace||g.index>-1&&g.index<this.world.getItemCount(),"[Viewer.addTiledImage] if options.replace is used, options.index must be a valid index in Viewer.world");var x=this;g.replace&&(g.replaceItem=x.world.getItemAt(g.index)),this._hideMessage(),g.placeholderFillStyle===void 0&&(g.placeholderFillStyle=this.placeholderFillStyle),g.opacity===void 0&&(g.opacity=this.opacity),g.preload===void 0&&(g.preload=this.preload),g.compositeOperation===void 0&&(g.compositeOperation=this.compositeOperation),g.crossOriginPolicy===void 0&&(g.crossOriginPolicy=g.tileSource.crossOriginPolicy!==void 0?g.tileSource.crossOriginPolicy:this.crossOriginPolicy),g.ajaxWithCredentials===void 0&&(g.ajaxWithCredentials=this.ajaxWithCredentials),g.loadTilesWithAjax===void 0&&(g.loadTilesWithAjax=this.loadTilesWithAjax),e.isPlainObject(g.ajaxHeaders)||(g.ajaxHeaders={});var M={options:g};function X(Z){for(var ye=0;ye<x._loadQueue.length;ye++)if(x._loadQueue[ye]===M){x._loadQueue.splice(ye,1);break}x._loadQueue.length===0&&oe(M),x.raiseEvent("add-item-failed",Z),g.error&&g.error(Z)}function oe(Z){x.collectionMode&&(x.world.arrange({immediately:Z.options.collectionImmediately,rows:x.collectionRows,columns:x.collectionColumns,layout:x.collectionLayout,tileSize:x.collectionTileSize,tileMargin:x.collectionTileMargin}),x.world.setAutoRefigureSizes(!0))}if(e.isArray(g.tileSource)){setTimeout(function(){X({message:"[Viewer.addTiledImage] Sequences can not be added; add them one at a time instead.",source:g.tileSource,options:g})});return}this._loadQueue.push(M);function fe(){for(var Z,ye,Oe;x._loadQueue.length&&(Z=x._loadQueue[0],!!Z.tileSource);){if(x._loadQueue.splice(0,1),Z.options.replace){var Fe=x.world.getIndexOfItem(Z.options.replaceItem);Fe!==-1&&(Z.options.index=Fe),x.world.removeItem(Z.options.replaceItem)}ye=new e.TiledImage({viewer:x,source:Z.tileSource,viewport:x.viewport,drawer:x.drawer,tileCache:x.tileCache,imageLoader:x.imageLoader,x:Z.options.x,y:Z.options.y,width:Z.options.width,height:Z.options.height,fitBounds:Z.options.fitBounds,fitBoundsPlacement:Z.options.fitBoundsPlacement,clip:Z.options.clip,placeholderFillStyle:Z.options.placeholderFillStyle,opacity:Z.options.opacity,preload:Z.options.preload,degrees:Z.options.degrees,flipped:Z.options.flipped,compositeOperation:Z.options.compositeOperation,springStiffness:x.springStiffness,animationTime:x.animationTime,minZoomImageRatio:x.minZoomImageRatio,wrapHorizontal:x.wrapHorizontal,wrapVertical:x.wrapVertical,maxTilesPerFrame:x.maxTilesPerFrame,immediateRender:x.immediateRender,blendTime:x.blendTime,alwaysBlend:x.alwaysBlend,minPixelRatio:x.minPixelRatio,smoothTileEdgesMinZoom:x.smoothTileEdgesMinZoom,iOSDevice:x.iOSDevice,crossOriginPolicy:Z.options.crossOriginPolicy,ajaxWithCredentials:Z.options.ajaxWithCredentials,loadTilesWithAjax:Z.options.loadTilesWithAjax,ajaxHeaders:Z.options.ajaxHeaders,debugMode:x.debugMode,subPixelRoundingForTransparency:x.subPixelRoundingForTransparency}),x.collectionMode&&x.world.setAutoRefigureSizes(!1),x.navigator&&(Oe=e.extend({},Z.options,{replace:!1,originalTiledImage:ye,tileSource:Z.tileSource}),x.navigator.addTiledImage(Oe)),x.world.addItem(ye,{index:Z.options.index}),x._loadQueue.length===0&&oe(Z),x.world.getItemCount()===1&&!x.preserveViewport&&x.viewport.goHome(!0),Z.options.success&&Z.options.success({item:ye})}}s(this,g.tileSource,g,function(Z){M.tileSource=Z,fe()},function(Z){Z.options=g,X(Z),fe()})},addSimpleImage:function(g){e.console.assert(g,"[Viewer.addSimpleImage] options is required"),e.console.assert(g.url,"[Viewer.addSimpleImage] options.url is required");var x=e.extend({},g,{tileSource:{type:"image",url:g.url}});delete x.url,this.addTiledImage(x)},addLayer:function(g){var x=this;e.console.error("[Viewer.addLayer] this function is deprecated; use Viewer.addTiledImage() instead.");var M=e.extend({},g,{success:function(X){x.raiseEvent("add-layer",{options:g,drawer:X.item})},error:function(X){x.raiseEvent("add-layer-failed",X)}});return this.addTiledImage(M),this},getLayerAtLevel:function(g){return e.console.error("[Viewer.getLayerAtLevel] this function is deprecated; use World.getItemAt() instead."),this.world.getItemAt(g)},getLevelOfLayer:function(g){return e.console.error("[Viewer.getLevelOfLayer] this function is deprecated; use World.getIndexOfItem() instead."),this.world.getIndexOfItem(g)},getLayersCount:function(){return e.console.error("[Viewer.getLayersCount] this function is deprecated; use World.getItemCount() instead."),this.world.getItemCount()},setLayerLevel:function(g,x){return e.console.error("[Viewer.setLayerLevel] this function is deprecated; use World.setItemIndex() instead."),this.world.setItemIndex(g,x)},removeLayer:function(g){return e.console.error("[Viewer.removeLayer] this function is deprecated; use World.removeItem() instead."),this.world.removeItem(g)},forceRedraw:function(){return t[this.hash].forceRedraw=!0,this},forceResize:function(){t[this.hash].needsResize=!0,t[this.hash].forceResize=!0},bindSequenceControls:function(){var g=e.delegate(this,_),x=e.delegate(this,d),M=e.delegate(this,this.goToNextPage),X=e.delegate(this,this.goToPreviousPage),oe=this.navImages,fe=!0;return this.showSequenceControl&&((this.previousButton||this.nextButton)&&(fe=!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:re(this.prefixUrl,oe.previous.REST),srcGroup:re(this.prefixUrl,oe.previous.GROUP),srcHover:re(this.prefixUrl,oe.previous.HOVER),srcDown:re(this.prefixUrl,oe.previous.DOWN),onRelease:X,onFocus:g,onBlur:x}),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:re(this.prefixUrl,oe.next.REST),srcGroup:re(this.prefixUrl,oe.next.GROUP),srcHover:re(this.prefixUrl,oe.next.HOVER),srcDown:re(this.prefixUrl,oe.next.DOWN),onRelease:M,onFocus:g,onBlur:x}),this.navPrevNextWrap||this.previousButton.disable(),(!this.tileSources||!this.tileSources.length)&&this.nextButton.disable(),fe&&(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 g=e.delegate(this,j),x=e.delegate(this,nt),M=e.delegate(this,Ke),X=e.delegate(this,se),oe=e.delegate(this,ct),fe=e.delegate(this,Ui),Z=e.delegate(this,It),ye=e.delegate(this,Wt),Oe=e.delegate(this,kt),Fe=e.delegate(this,yt),we=e.delegate(this,_),qe=e.delegate(this,d),y=this.navImages,m=[],E=!0;return this.showNavigationControl&&((this.zoomInButton||this.zoomOutButton||this.homeButton||this.fullPageButton||this.rotateLeftButton||this.rotateRightButton||this.flipButton)&&(E=!1),this.showZoomControl&&(m.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:re(this.prefixUrl,y.zoomIn.REST),srcGroup:re(this.prefixUrl,y.zoomIn.GROUP),srcHover:re(this.prefixUrl,y.zoomIn.HOVER),srcDown:re(this.prefixUrl,y.zoomIn.DOWN),onPress:g,onRelease:x,onClick:M,onEnter:g,onExit:x,onFocus:we,onBlur:qe})),m.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:re(this.prefixUrl,y.zoomOut.REST),srcGroup:re(this.prefixUrl,y.zoomOut.GROUP),srcHover:re(this.prefixUrl,y.zoomOut.HOVER),srcDown:re(this.prefixUrl,y.zoomOut.DOWN),onPress:X,onRelease:x,onClick:oe,onEnter:X,onExit:x,onFocus:we,onBlur:qe}))),this.showHomeControl&&m.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:re(this.prefixUrl,y.home.REST),srcGroup:re(this.prefixUrl,y.home.GROUP),srcHover:re(this.prefixUrl,y.home.HOVER),srcDown:re(this.prefixUrl,y.home.DOWN),onRelease:fe,onFocus:we,onBlur:qe})),this.showFullPageControl&&m.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:re(this.prefixUrl,y.fullpage.REST),srcGroup:re(this.prefixUrl,y.fullpage.GROUP),srcHover:re(this.prefixUrl,y.fullpage.HOVER),srcDown:re(this.prefixUrl,y.fullpage.DOWN),onRelease:Z,onFocus:we,onBlur:qe})),this.showRotationControl&&(m.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:re(this.prefixUrl,y.rotateleft.REST),srcGroup:re(this.prefixUrl,y.rotateleft.GROUP),srcHover:re(this.prefixUrl,y.rotateleft.HOVER),srcDown:re(this.prefixUrl,y.rotateleft.DOWN),onRelease:ye,onFocus:we,onBlur:qe})),m.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:re(this.prefixUrl,y.rotateright.REST),srcGroup:re(this.prefixUrl,y.rotateright.GROUP),srcHover:re(this.prefixUrl,y.rotateright.HOVER),srcDown:re(this.prefixUrl,y.rotateright.DOWN),onRelease:Oe,onFocus:we,onBlur:qe}))),this.showFlipControl&&m.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:re(this.prefixUrl,y.flip.REST),srcGroup:re(this.prefixUrl,y.flip.GROUP),srcHover:re(this.prefixUrl,y.flip.HOVER),srcDown:re(this.prefixUrl,y.flip.DOWN),onRelease:Fe,onFocus:we,onBlur:qe})),E?(this.buttonGroup=new e.ButtonGroup({buttons:m,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold}),this.navControl=this.buttonGroup.element,this.addHandler("open",e.delegate(this,wi)),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=m),this},currentPage:function(){return this._sequenceIndex},goToPage:function(g){return this.tileSources&&g>=0&&g<this.tileSources.length&&(this._sequenceIndex=g,this._updateSequenceButtons(g),this.open(this.tileSources[g]),this.referenceStrip&&this.referenceStrip.setFocus(g),this.raiseEvent("page",{page:g})),this},addOverlay:function(g,x,M,X){var oe;if(e.isPlainObject(g)?oe=g:oe={element:g,location:x,placement:M,onDraw:X},g=e.getElement(oe.element),u(this.currentOverlays,g)>=0)return this;var fe=h(this,oe);return this.currentOverlays.push(fe),fe.drawHTML(this.overlaysContainer,this.viewport),this.raiseEvent("add-overlay",{element:g,location:oe.location,placement:oe.placement}),this},updateOverlay:function(g,x,M){var X;return g=e.getElement(g),X=u(this.currentOverlays,g),X>=0&&(this.currentOverlays[X].update(x,M),t[this.hash].forceRedraw=!0,this.raiseEvent("update-overlay",{element:g,location:x,placement:M})),this},removeOverlay:function(g){var x;return g=e.getElement(g),x=u(this.currentOverlays,g),x>=0&&(this.currentOverlays[x].destroy(),this.currentOverlays.splice(x,1),t[this.hash].forceRedraw=!0,this.raiseEvent("remove-overlay",{element:g})),this},clearOverlays:function(){for(;this.currentOverlays.length>0;)this.currentOverlays.pop().destroy();return t[this.hash].forceRedraw=!0,this.raiseEvent("clear-overlay",{}),this},getOverlayById:function(g){var x;return g=e.getElement(g),x=u(this.currentOverlays,g),x>=0?this.currentOverlays[x]:null},_updateSequenceButtons:function(g){this.nextButton&&(!this.tileSources||this.tileSources.length-1===g?this.navPrevNextWrap||this.nextButton.disable():this.nextButton.enable()),this.previousButton&&(g>0?this.previousButton.enable():this.navPrevNextWrap||this.previousButton.disable())},_showMessage:function(g){this._hideMessage();var x=e.makeNeutralElement("div");x.appendChild(document.createTextNode(g)),this.messageDiv=e.makeCenteredNode(x),e.addClass(this.messageDiv,"openseadragon-message"),this.container.appendChild(this.messageDiv)},_hideMessage:function(){var g=this.messageDiv;g&&(g.parentNode.removeChild(g),delete this.messageDiv)},gestureSettingsByDeviceType:function(g){switch(g){case"mouse":return this.gestureSettingsMouse;case"touch":return this.gestureSettingsTouch;case"pen":return this.gestureSettingsPen;default:return this.gestureSettingsUnknown}},_drawOverlays:function(){var g,x=this.currentOverlays.length;for(g=0;g<x;g++)this.currentOverlays[g].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 g=e.pixelDensityRatio,x=e.getCurrentPixelDensityRatio();g!==x&&(e.pixelDensityRatio=x,this.forceResize())},goToPreviousPage:function(){var g=this._sequenceIndex-1;this.navPrevNextWrap&&g<0&&(g+=this.tileSources.length),this.goToPage(g)},goToNextPage:function(){var g=this._sequenceIndex+1;this.navPrevNextWrap&&g>=this.tileSources.length&&(g=0),this.goToPage(g)},isAnimating:function(){return t[this.hash].animating}});function n(g){return g=e.getElement(g),new e.Point(g.clientWidth===0?1:g.clientWidth,g.clientHeight===0?1:g.clientHeight)}function s(g,x,M,X,oe){var fe=g;if(e.type(x)==="string"){if(x.match(/^\s*<.*>\s*$/))x=e.parseXml(x);else if(x.match(/^\s*[{[].*[}\]]\s*$/))try{var Z=e.parseJSON(x);x=Z}catch{}}function ye(Oe,Fe){Oe.ready?X(Oe):(Oe.addHandler("ready",function(){X(Oe)}),Oe.addHandler("open-failed",function(we){oe({message:we.message,source:Fe})}))}setTimeout(function(){if(e.type(x)==="string")x=new e.TileSource({url:x,crossOriginPolicy:M.crossOriginPolicy!==void 0?M.crossOriginPolicy:g.crossOriginPolicy,ajaxWithCredentials:g.ajaxWithCredentials,ajaxHeaders:M.ajaxHeaders?M.ajaxHeaders:g.ajaxHeaders,splitHashDataForPost:g.splitHashDataForPost,success:function(qe){X(qe.tileSource)}}),x.addHandler("open-failed",function(qe){oe(qe)});else if(e.isPlainObject(x)||x.nodeType)if(x.crossOriginPolicy===void 0&&(M.crossOriginPolicy!==void 0||g.crossOriginPolicy!==void 0)&&(x.crossOriginPolicy=M.crossOriginPolicy!==void 0?M.crossOriginPolicy:g.crossOriginPolicy),x.ajaxWithCredentials===void 0&&(x.ajaxWithCredentials=g.ajaxWithCredentials),e.isFunction(x.getTileUrl)){var Oe=new e.TileSource(x);Oe.getTileUrl=x.getTileUrl,X(Oe)}else{var Fe=e.TileSource.determineType(fe,x);if(!Fe){oe({message:"Unable to load TileSource",source:x});return}var we=Fe.prototype.configure.apply(fe,[x]);ye(new Fe(we),x)}else ye(x,x)})}function h(g,x){if(x instanceof e.Overlay)return x;var M=null;if(x.element)M=e.getElement(x.element);else{var X=x.id?x.id:"openseadragon-overlay-"+Math.floor(Math.random()*1e7);M=e.getElement(x.id),M||(M=document.createElement("a"),M.href="#/overlay/"+X),M.id=X,e.addClass(M,x.className?x.className:"openseadragon-overlay")}var oe=x.location,fe=x.width,Z=x.height;if(!oe){var ye=x.x,Oe=x.y;if(x.px!==void 0){var Fe=g.viewport.imageToViewportRectangle(new e.Rect(x.px,x.py,fe||0,Z||0));ye=Fe.x,Oe=Fe.y,fe=fe!==void 0?Fe.width:void 0,Z=Z!==void 0?Fe.height:void 0}oe=new e.Point(ye,Oe)}var we=x.placement;return we&&e.type(we)==="string"&&(we=e.Placement[x.placement.toUpperCase()]),new e.Overlay({element:M,location:oe,placement:we,onDraw:x.onDraw,checkResize:x.checkResize,width:fe,height:Z,rotationMode:x.rotationMode})}function u(g,x){var M;for(M=g.length-1;M>=0;M--)if(g[M].element===x)return M;return-1}function o(g,x){return e.requestAnimationFrame(function(){x(g)})}function l(g){e.requestAnimationFrame(function(){c(g)})}function f(g){g.autoHideControls&&(g.controlsShouldFade=!0,g.controlsFadeBeginTime=e.now()+g.controlsFadeDelay,window.setTimeout(function(){l(g)},g.controlsFadeDelay))}function c(g){var x,M,X,oe;if(g.controlsShouldFade){for(x=e.now(),M=x-g.controlsFadeBeginTime,X=1-M/g.controlsFadeLength,X=Math.min(1,X),X=Math.max(0,X),oe=g.controls.length-1;oe>=0;oe--)g.controls[oe].autoFade&&g.controls[oe].setOpacity(X);X>0&&l(g)}}function p(g){var x;for(g.controlsShouldFade=!1,x=g.controls.length-1;x>=0;x--)g.controls[x].setOpacity(1)}function _(){p(this)}function d(){f(this)}function v(g){var x={tracker:g.eventSource,position:g.position,originalEvent:g.originalEvent,preventDefault:g.preventDefault};this.raiseEvent("canvas-contextmenu",x),g.preventDefault=x.preventDefault}function w(g){var x={originalEvent:g.originalEvent,preventDefaultAction:!1,preventVerticalPan:g.preventVerticalPan||!this.panVertical,preventHorizontalPan:g.preventHorizontalPan||!this.panHorizontal};if(this.raiseEvent("canvas-key",x),!x.preventDefaultAction&&!g.ctrl&&!g.alt&&!g.meta)switch(g.keyCode){case 38:x.preventVerticalPan||(g.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-this.pixelsPerArrowPress))),this.viewport.applyConstraints()),g.preventDefault=!0;break;case 40:x.preventVerticalPan||(g.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,this.pixelsPerArrowPress))),this.viewport.applyConstraints()),g.preventDefault=!0;break;case 37:x.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),g.preventDefault=!0;break;case 39:x.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),g.preventDefault=!0;break;case 187:this.viewport.zoomBy(1.1),this.viewport.applyConstraints(),g.preventDefault=!0;break;case 189:this.viewport.zoomBy(.9),this.viewport.applyConstraints(),g.preventDefault=!0;break;case 48:this.viewport.goHome(),this.viewport.applyConstraints(),g.preventDefault=!0;break;case 87:x.preventVerticalPan||(g.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-40))),this.viewport.applyConstraints()),g.preventDefault=!0;break;case 83:x.preventVerticalPan||(g.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,40))),this.viewport.applyConstraints()),g.preventDefault=!0;break;case 65:x.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-40,0))),this.viewport.applyConstraints()),g.preventDefault=!0;break;case 68:x.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(40,0))),this.viewport.applyConstraints()),g.preventDefault=!0;break;case 82:g.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(),g.preventDefault=!0;break;case 70:this.viewport.toggleFlip(),g.preventDefault=!0;break;case 74:this.goToPreviousPage();break;case 75:this.goToNextPage();break;default:g.preventDefault=!1;break}else g.preventDefault=!1}function S(g){var x={originalEvent:g.originalEvent};this.raiseEvent("canvas-key-press",x)}function R(g){var x,M=document.activeElement===this.canvas;M||this.canvas.focus(),this.viewport.flipped&&(g.position.x=this.viewport.getContainerSize().x-g.position.x);var X={tracker:g.eventSource,position:g.position,quick:g.quick,shift:g.shift,originalEvent:g.originalEvent,originalTarget:g.originalTarget,preventDefaultAction:!1};this.raiseEvent("canvas-click",X),!X.preventDefaultAction&&this.viewport&&g.quick&&(x=this.gestureSettingsByDeviceType(g.pointerType),x.clickToZoom===!0&&(this.viewport.zoomBy(g.shift?1/this.zoomPerClick:this.zoomPerClick,x.zoomToRefPoint?this.viewport.pointFromPixel(g.position,!0):null),this.viewport.applyConstraints()),x.dblClickDragToZoom&&(t[this.hash].draggingToZoom===!0?(t[this.hash].lastClickTime=null,t[this.hash].draggingToZoom=!1):t[this.hash].lastClickTime=e.now()))}function P(g){var x,M={tracker:g.eventSource,position:g.position,shift:g.shift,originalEvent:g.originalEvent,preventDefaultAction:!1};this.raiseEvent("canvas-double-click",M),!M.preventDefaultAction&&this.viewport&&(x=this.gestureSettingsByDeviceType(g.pointerType),x.dblClickToZoom&&(this.viewport.zoomBy(g.shift?1/this.zoomPerClick:this.zoomPerClick,x.zoomToRefPoint?this.viewport.pointFromPixel(g.position,!0):null),this.viewport.applyConstraints()))}function A(g){var x,M={tracker:g.eventSource,pointerType:g.pointerType,position:g.position,delta:g.delta,speed:g.speed,direction:g.direction,shift:g.shift,originalEvent:g.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag",M),x=this.gestureSettingsByDeviceType(g.pointerType),!M.preventDefaultAction&&this.viewport){if(x.dblClickDragToZoom&&t[this.hash].draggingToZoom){var X=Math.pow(this.zoomPerDblClickDrag,g.delta.y/50);this.viewport.zoomBy(X)}else if(x.dragToPan&&!t[this.hash].draggingToZoom){if(this.panHorizontal||(g.delta.x=0),this.panVertical||(g.delta.y=0),this.viewport.flipped&&(g.delta.x=-g.delta.x),this.constrainDuringPan){var oe=this.viewport.deltaPointsFromPixels(g.delta.negate());this.viewport.centerSpringX.target.value+=oe.x,this.viewport.centerSpringY.target.value+=oe.y;var fe=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=oe.x,this.viewport.centerSpringY.target.value-=oe.y,fe.xConstrained&&(g.delta.x=0),fe.yConstrained&&(g.delta.y=0)}this.viewport.panBy(this.viewport.deltaPointsFromPixels(g.delta.negate()),x.flickEnabled&&!this.constrainDuringPan)}}}function F(g){var x,M={tracker:g.eventSource,pointerType:g.pointerType,position:g.position,speed:g.speed,direction:g.direction,shift:g.shift,originalEvent:g.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag-end",M),x=this.gestureSettingsByDeviceType(g.pointerType),!M.preventDefaultAction&&this.viewport){if(!t[this.hash].draggingToZoom&&x.dragToPan&&x.flickEnabled&&g.speed>=x.flickMinSpeed){var X=0;this.panHorizontal&&(X=x.flickMomentum*g.speed*Math.cos(g.direction));var oe=0;this.panVertical&&(oe=x.flickMomentum*g.speed*Math.sin(g.direction));var fe=this.viewport.pixelFromPoint(this.viewport.getCenter(!0)),Z=this.viewport.pointFromPixel(new e.Point(fe.x-X,fe.y-oe));this.viewport.panTo(Z,!1)}this.viewport.applyConstraints()}x.dblClickDragToZoom&&t[this.hash].draggingToZoom===!0&&(t[this.hash].draggingToZoom=!1)}function N(g){this.raiseEvent("canvas-enter",{tracker:g.eventSource,pointerType:g.pointerType,position:g.position,buttons:g.buttons,pointers:g.pointers,insideElementPressed:g.insideElementPressed,buttonDownAny:g.buttonDownAny,originalEvent:g.originalEvent})}function z(g){this.raiseEvent("canvas-exit",{tracker:g.eventSource,pointerType:g.pointerType,position:g.position,buttons:g.buttons,pointers:g.pointers,insideElementPressed:g.insideElementPressed,buttonDownAny:g.buttonDownAny,originalEvent:g.originalEvent})}function I(g){var x;if(this.raiseEvent("canvas-press",{tracker:g.eventSource,pointerType:g.pointerType,position:g.position,insideElementPressed:g.insideElementPressed,insideElementReleased:g.insideElementReleased,originalEvent:g.originalEvent}),x=this.gestureSettingsByDeviceType(g.pointerType),x.dblClickDragToZoom){var M=t[this.hash].lastClickTime,X=e.now();if(M===null)return;X-M<this.dblClickTimeThreshold&&(t[this.hash].draggingToZoom=!0),t[this.hash].lastClickTime=null}}function D(g){this.raiseEvent("canvas-release",{tracker:g.eventSource,pointerType:g.pointerType,position:g.position,insideElementPressed:g.insideElementPressed,insideElementReleased:g.insideElementReleased,originalEvent:g.originalEvent})}function H(g){this.raiseEvent("canvas-nonprimary-press",{tracker:g.eventSource,position:g.position,pointerType:g.pointerType,button:g.button,buttons:g.buttons,originalEvent:g.originalEvent})}function k(g){this.raiseEvent("canvas-nonprimary-release",{tracker:g.eventSource,position:g.position,pointerType:g.pointerType,button:g.button,buttons:g.buttons,originalEvent:g.originalEvent})}function q(g){var x,M,X,oe,fe={tracker:g.eventSource,pointerType:g.pointerType,gesturePoints:g.gesturePoints,lastCenter:g.lastCenter,center:g.center,lastDistance:g.lastDistance,distance:g.distance,shift:g.shift,originalEvent:g.originalEvent,preventDefaultPanAction:!1,preventDefaultZoomAction:!1,preventDefaultRotateAction:!1};if(this.raiseEvent("canvas-pinch",fe),this.viewport&&(x=this.gestureSettingsByDeviceType(g.pointerType),x.pinchToZoom&&(!fe.preventDefaultPanAction||!fe.preventDefaultZoomAction)&&(M=this.viewport.pointFromPixel(g.center,!0),x.zoomToRefPoint&&!fe.preventDefaultPanAction&&(X=this.viewport.pointFromPixel(g.lastCenter,!0),oe=X.minus(M),this.panHorizontal||(oe.x=0),this.panVertical||(oe.y=0),this.viewport.panBy(oe,!0)),fe.preventDefaultZoomAction||this.viewport.zoomBy(g.distance/g.lastDistance,M,!0),this.viewport.applyConstraints()),x.pinchRotate&&!fe.preventDefaultRotateAction)){var Z=Math.atan2(g.gesturePoints[0].currentPos.y-g.gesturePoints[1].currentPos.y,g.gesturePoints[0].currentPos.x-g.gesturePoints[1].currentPos.x),ye=Math.atan2(g.gesturePoints[0].lastPos.y-g.gesturePoints[1].lastPos.y,g.gesturePoints[0].lastPos.x-g.gesturePoints[1].lastPos.x);M=this.viewport.pointFromPixel(g.center,!0),this.viewport.rotateTo(this.viewport.getRotation(!0)+(Z-ye)*(180/Math.PI),M,!0)}}function O(g){this.raiseEvent("canvas-focus",{tracker:g.eventSource,originalEvent:g.originalEvent})}function U(g){this.raiseEvent("canvas-blur",{tracker:g.eventSource,originalEvent:g.originalEvent})}function te(g){var x,M,X,oe,fe;oe=e.now(),fe=oe-this._lastScrollTime,fe>this.minScrollDeltaTime?(this._lastScrollTime=oe,x={tracker:g.eventSource,position:g.position,scroll:g.scroll,shift:g.shift,originalEvent:g.originalEvent,preventDefaultAction:!1,preventDefault:!0},this.raiseEvent("canvas-scroll",x),!x.preventDefaultAction&&this.viewport&&(this.viewport.flipped&&(g.position.x=this.viewport.getContainerSize().x-g.position.x),M=this.gestureSettingsByDeviceType(g.pointerType),M.scrollToZoom&&(X=Math.pow(this.zoomPerScroll,g.scroll),this.viewport.zoomBy(X,M.zoomToRefPoint?this.viewport.pointFromPixel(g.position,!0):null),this.viewport.applyConstraints())),g.preventDefault=x.preventDefault):g.preventDefault=!0}function $(g){t[this.hash].mouseInside=!0,p(this),this.raiseEvent("container-enter",{tracker:g.eventSource,pointerType:g.pointerType,position:g.position,buttons:g.buttons,pointers:g.pointers,insideElementPressed:g.insideElementPressed,buttonDownAny:g.buttonDownAny,originalEvent:g.originalEvent})}function ne(g){g.pointers<1&&(t[this.hash].mouseInside=!1,t[this.hash].animating||f(this)),this.raiseEvent("container-exit",{tracker:g.eventSource,pointerType:g.pointerType,position:g.position,buttons:g.buttons,pointers:g.pointers,insideElementPressed:g.insideElementPressed,buttonDownAny:g.buttonDownAny,originalEvent:g.originalEvent})}function B(g){de(g),g.isOpen()?g._updateRequestId=o(g,B):g._updateRequestId=!1}function W(g,x){var M=g.viewport,X=M.getZoom(),oe=M.getCenter();M.resize(x,g.preserveImageSizeOnResize),M.panTo(oe,!0);var fe;if(g.preserveImageSizeOnResize)fe=t[g.hash].prevContainerSize.x/x.x;else{var Z=new e.Point(0,0),ye=new e.Point(t[g.hash].prevContainerSize.x,t[g.hash].prevContainerSize.y).distanceTo(Z),Oe=new e.Point(x.x,x.y).distanceTo(Z);fe=Oe/ye*t[g.hash].prevContainerSize.x/x.x}M.zoomTo(X*fe,null,!0),t[g.hash].prevContainerSize=x,t[g.hash].forceRedraw=!0,t[g.hash].needsResize=!1,t[g.hash].forceResize=!1}function de(g){if(!(g._opening||!t[g.hash])){if(g.autoResize||t[g.hash].forceResize){var x;if(g._autoResizePolling){x=n(g.container);var M=t[g.hash].prevContainerSize;x.equals(M)||(t[g.hash].needsResize=!0)}t[g.hash].needsResize&&W(g,x||n(g.container))}var X=g.viewport.update(),oe=g.world.update(X)||X;X&&g.raiseEvent("viewport-change"),g.referenceStrip&&(oe=g.referenceStrip.update(g.viewport)||oe);var fe=t[g.hash].animating;!fe&&oe&&(g.raiseEvent("animation-start"),p(g));var Z=fe&&!oe;Z&&(t[g.hash].animating=!1),(oe||Z||t[g.hash].forceRedraw||g.world.needsDraw())&&(ce(g),g._drawOverlays(),g.navigator&&g.navigator.update(g.viewport),t[g.hash].forceRedraw=!1,oe&&g.raiseEvent("animation")),Z&&(g.raiseEvent("animation-finish"),t[g.hash].mouseInside||f(g)),t[g.hash].animating=oe}}function ce(g){g.imageLoader.clear(),g.world.draw(),g.raiseEvent("update-viewport",{})}function re(g,x){return g?g+x:x}function j(){t[this.hash].lastZoomTime=e.now(),t[this.hash].zoomFactor=this.zoomPerSecond,t[this.hash].zooming=!0,We(this)}function se(){t[this.hash].lastZoomTime=e.now(),t[this.hash].zoomFactor=1/this.zoomPerSecond,t[this.hash].zooming=!0,We(this)}function nt(){t[this.hash].zooming=!1}function We(g){e.requestAnimationFrame(e.delegate(g,De))}function De(){var g,x,M;t[this.hash].zooming&&this.viewport&&(g=e.now(),x=g-t[this.hash].lastZoomTime,M=Math.pow(t[this.hash].zoomFactor,x/1e3),this.viewport.zoomBy(M),this.viewport.applyConstraints(),t[this.hash].lastZoomTime=g,We(this))}function Ke(){this.viewport&&(t[this.hash].zooming=!1,this.viewport.zoomBy(this.zoomPerClick/1),this.viewport.applyConstraints())}function ct(){this.viewport&&(t[this.hash].zooming=!1,this.viewport.zoomBy(1/this.zoomPerClick),this.viewport.applyConstraints())}function wi(){this.buttonGroup&&(this.buttonGroup.emulateEnter(),this.buttonGroup.emulateLeave())}function Ui(){this.viewport&&this.viewport.goHome()}function It(){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 Wt(){if(this.viewport){var g=this.viewport.getRotation();this.viewport.flipped?g+=this.rotationIncrement:g-=this.rotationIncrement,this.viewport.setRotation(g)}}function kt(){if(this.viewport){var g=this.viewport.getRotation();this.viewport.flipped?g-=this.rotationIncrement:g+=this.rotationIncrement,this.viewport.setRotation(g)}}function yt(){this.viewport.toggleFlip()}e.determineDrawer=function(g){for(let x in r){const M=r[x],X=M.prototype;if(X&&X instanceof r.DrawerBase&&e.isFunction(X.getType)&&X.getType.call(M)===g)return M}return null}})(r),(function(e){e.Navigator=function(o){var l=o.viewer,f=this,c,p;o.element||o.id?(o.element?(o.id&&e.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead."),o.element.id?o.id=o.element.id:o.id="navigator-"+e.now(),this.element=o.element):this.element=document.getElementById(o.id),o.controlOptions={anchor:e.ControlAnchor.NONE,attachToViewer:!1,autoFade:!1}):(o.id="navigator-"+e.now(),this.element=e.makeNeutralElement("div"),o.controlOptions={anchor:e.ControlAnchor.TOP_RIGHT,attachToViewer:!0,autoFade:o.autoFade},o.position&&(o.position==="BOTTOM_RIGHT"?o.controlOptions.anchor=e.ControlAnchor.BOTTOM_RIGHT:o.position==="BOTTOM_LEFT"?o.controlOptions.anchor=e.ControlAnchor.BOTTOM_LEFT:o.position==="TOP_RIGHT"?o.controlOptions.anchor=e.ControlAnchor.TOP_RIGHT:o.position==="TOP_LEFT"?o.controlOptions.anchor=e.ControlAnchor.TOP_LEFT:o.position==="ABSOLUTE"&&(o.controlOptions.anchor=e.ControlAnchor.ABSOLUTE,o.controlOptions.top=o.top,o.controlOptions.left=o.left,o.controlOptions.height=o.height,o.controlOptions.width=o.width))),this.element.id=o.id,this.element.className+=" navigator",o=e.extend(!0,{sizeRatio:e.DEFAULT_SETTINGS.navigatorSizeRatio},o,{element:this.element,tabIndex:-1,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:o.animationTime,autoResize:!1,minZoomImageRatio:1,background:o.background,opacity:o.opacity,borderColor:o.borderColor,displayRegionColor:o.displayRegionColor}),o.minPixelRatio=this.minPixelRatio=l.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),o.controlOptions.anchor!==e.ControlAnchor.NONE&&(function(v,w){v.margin="0px",v.border=w+"px solid "+o.borderColor,v.padding="0px",v.background=o.background,v.opacity=o.opacity,v.overflow="hidden"})(this.element.style,this.borderWidth),this.displayRegion=e.makeNeutralElement("div"),this.displayRegion.id=this.element.id+"-displayregion",this.displayRegion.className="displayregion",(function(v,w){v.position="relative",v.top="0px",v.left="0px",v.fontSize="0px",v.overflow="hidden",v.border=w+"px solid "+o.displayRegionColor,v.margin="0px",v.padding="0px",v.background="transparent",v.float="left",v.cssFloat="left",v.zIndex=999999999,v.cursor="default",v.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),l.addControl(this.element,o.controlOptions),this._resizeWithViewer=o.controlOptions.anchor!==e.ControlAnchor.ABSOLUTE&&o.controlOptions.anchor!==e.ControlAnchor.NONE,o.width&&o.height?(this.setWidth(o.width),this.setHeight(o.height)):this._resizeWithViewer&&(c=e.getElementSize(l.element),this.element.style.height=Math.round(c.y*o.sizeRatio)+"px",this.element.style.width=Math.round(c.x*o.sizeRatio)+"px",this.oldViewerSize=c,p=e.getElementSize(this.element),this.elementArea=p.x*p.y),this.oldContainerSize=new e.Point(0,0),e.Viewer.apply(this,[o]),this.displayRegionContainer.appendChild(this.displayRegion),this.element.getElementsByTagName("div")[0].appendChild(this.displayRegionContainer);function _(v,w){h(f.displayRegionContainer,v),h(f.displayRegion,-v),f.viewport.setRotation(v,w)}if(o.navigatorRotate){var d=o.viewer.viewport?o.viewer.viewport.getRotation():o.viewer.degrees||0;_(d,!0),o.viewer.addHandler("rotate",function(v){_(v.degrees,v.immediately)})}this.innerTracker.destroy(),this.innerTracker=new e.MouseTracker({userData:"Navigator.innerTracker",element:this.element,dragHandler:e.delegate(this,i),clickHandler:e.delegate(this,t),releaseHandler:e.delegate(this,n),scrollHandler:e.delegate(this,s),preProcessEventHandler:function(v){v.eventType==="wheel"&&(v.preventDefault=!0)}}),this.outerTracker.userData="Navigator.outerTracker",e.setElementPointerEventsNone(this.canvas),e.setElementPointerEventsNone(this.container),this.addHandler("reset-size",function(){f.viewport&&f.viewport.goHome(!0)}),l.world.addHandler("item-index-change",function(v){window.setTimeout(function(){var w=f.world.getItemAt(v.previousIndex);f.world.setItemIndex(w,v.newIndex)},1)}),l.world.addHandler("remove-item",function(v){var w=v.item,S=f._getMatchingItem(w);S&&f.world.removeItem(S)}),this.update(l.viewport)},e.extend(e.Navigator.prototype,e.EventSource.prototype,e.Viewer.prototype,{updateSize:function(){if(this.viewport){var o=new e.Point(this.container.clientWidth===0?1:this.container.clientWidth,this.container.clientHeight===0?1:this.container.clientHeight);o.equals(this.oldContainerSize)||(this.viewport.resize(o,!0),this.viewport.goHome(!0),this.oldContainerSize=o,this.world.update(),this.world.draw(),this.update(this.viewer.viewport))}},setWidth:function(o){this.width=o,this.element.style.width=typeof o=="number"?o+"px":o,this._resizeWithViewer=!1,this.updateSize()},setHeight:function(o){this.height=o,this.element.style.height=typeof o=="number"?o+"px":o,this._resizeWithViewer=!1,this.updateSize()},setFlip:function(o){return this.viewport.setFlip(o),this.setDisplayTransform(this.viewer.viewport.getFlip()?"scale(-1,1)":"scale(1,1)"),this},setDisplayTransform:function(o){u(this.canvas,o),u(this.element,o)},update:function(o){var l,f,c,p,_,d;if(o||(o=this.viewer.viewport),l=e.getElementSize(this.viewer.element),this._resizeWithViewer&&l.x&&l.y&&!l.equals(this.oldViewerSize)&&(this.oldViewerSize=l,this.maintainSizeRatio||!this.elementArea?(f=l.x*this.sizeRatio,c=l.y*this.sizeRatio):(f=Math.sqrt(this.elementArea*(l.x/l.y)),c=this.elementArea/f),this.element.style.width=Math.round(f)+"px",this.element.style.height=Math.round(c)+"px",this.elementArea||(this.elementArea=f*c),this.updateSize()),o&&this.viewport){if(p=o.getBoundsNoRotate(!0),_=this.viewport.pixelFromPointNoRotate(p.getTopLeft(),!1),d=this.viewport.pixelFromPointNoRotate(p.getBottomRight(),!1).minus(this.totalBorderWidths),!this.navigatorRotate){var v=o.getRotation(!0);h(this.displayRegion,-v)}var w=this.displayRegion.style;w.display=this.world.getItemCount()?"block":"none",w.top=_.y.toFixed(2)+"px",w.left=_.x.toFixed(2)+"px";var S=d.x-_.x,R=d.y-_.y;w.width=Math.round(Math.max(S,0))+"px",w.height=Math.round(Math.max(R,0))+"px"}},addTiledImage:function(o){var l=this,f=o.originalTiledImage;delete o.original;var c=e.extend({},o,{success:function(p){var _=p.item;_._originalForNavigator=f,l._matchBounds(_,f,!0),l._matchOpacity(_,f),l._matchCompositeOperation(_,f);function d(){l._matchBounds(_,f)}function v(){l._matchOpacity(_,f)}function w(){l._matchCompositeOperation(_,f)}f.addHandler("bounds-change",d),f.addHandler("clip-change",d),f.addHandler("opacity-change",v),f.addHandler("composite-operation-change",w)}});return e.Viewer.prototype.addTiledImage.apply(this,[c])},destroy:function(){return e.Viewer.prototype.destroy.apply(this)},_getMatchingItem:function(o){for(var l=this.world.getItemCount(),f,c=0;c<l;c++)if(f=this.world.getItemAt(c),f._originalForNavigator===o)return f;return null},_matchBounds:function(o,l,f){var c=l.getBoundsNoRotate();o.setPosition(c.getTopLeft(),f),o.setWidth(c.width,f),o.setRotation(l.getRotation(),f),o.setClip(l.getClip()),o.setFlip(l.getFlip())},_matchOpacity:function(o,l){o.setOpacity(l.opacity)},_matchCompositeOperation:function(o,l){o.setCompositeOperation(l.compositeOperation)}});function t(o){var l={tracker:o.eventSource,position:o.position,quick:o.quick,shift:o.shift,originalEvent:o.originalEvent,preventDefaultAction:!1};if(this.viewer.raiseEvent("navigator-click",l),!l.preventDefaultAction&&o.quick&&this.viewer.viewport&&(this.panVertical||this.panHorizontal)){this.viewer.viewport.flipped&&(o.position.x=this.viewport.getContainerSize().x-o.position.x);var f=this.viewport.pointFromPixel(o.position);this.panVertical?this.panHorizontal||(f.x=this.viewer.viewport.getCenter(!0).x):f.y=this.viewer.viewport.getCenter(!0).y,this.viewer.viewport.panTo(f),this.viewer.viewport.applyConstraints()}}function i(o){var l={tracker:o.eventSource,position:o.position,delta:o.delta,speed:o.speed,direction:o.direction,shift:o.shift,originalEvent:o.originalEvent,preventDefaultAction:!1};this.viewer.raiseEvent("navigator-drag",l),!l.preventDefaultAction&&this.viewer.viewport&&(this.panHorizontal||(o.delta.x=0),this.panVertical||(o.delta.y=0),this.viewer.viewport.flipped&&(o.delta.x=-o.delta.x),this.viewer.viewport.panBy(this.viewport.deltaPointsFromPixels(o.delta)),this.viewer.constrainDuringPan&&this.viewer.viewport.applyConstraints())}function n(o){o.insideElementPressed&&this.viewer.viewport&&this.viewer.viewport.applyConstraints()}function s(o){var l={tracker:o.eventSource,position:o.position,scroll:o.scroll,shift:o.shift,originalEvent:o.originalEvent,preventDefault:o.preventDefault};this.viewer.raiseEvent("navigator-scroll",l),o.preventDefault=l.preventDefault}function h(o,l){u(o,"rotate("+l+"deg)")}function u(o,l){o.style.webkitTransform=l,o.style.mozTransform=l,o.style.msTransform=l,o.style.oTransform=l,o.style.transform=l}})(r),(function(e){var t={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(i){var n=i.split("."),s=null,h=arguments,u=t,o;for(o=0;o<n.length-1;o++)u=u[n[o]]||{};return s=u[n[o]],typeof s!="string"&&(e.console.error("Untranslated source string:",i),s=""),s.replace(/\{\d+\}/g,function(l){var f=parseInt(l.match(/\d+/),10)+1;return f<h.length?h[f]:""})},setString:function(i,n){var s=i.split("."),h=t,u;for(u=0;u<s.length-1;u++)h[s[u]]||(h[s[u]]={}),h=h[s[u]];h[s[u]]=n}})})(r),(function(e){e.Point=function(t,i){this.x=typeof t=="number"?t:0,this.y=typeof i=="number"?i:0},e.Point.prototype={clone:function(){return new e.Point(this.x,this.y)},plus:function(t){return new e.Point(this.x+t.x,this.y+t.y)},minus:function(t){return new e.Point(this.x-t.x,this.y-t.y)},times:function(t){return new e.Point(this.x*t,this.y*t)},divide:function(t){return new e.Point(this.x/t,this.y/t)},negate:function(){return new e.Point(-this.x,-this.y)},distanceTo:function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},squaredDistanceTo:function(t){return Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2)},apply:function(t){return new e.Point(t(this.x),t(this.y))},equals:function(t){return t instanceof e.Point&&this.x===t.x&&this.y===t.y},rotate:function(t,i){i=i||new e.Point(0,0);var n,s;if(t%90===0){var h=e.positiveModulo(t,360);switch(h){case 0:n=1,s=0;break;case 90:n=0,s=1;break;case 180:n=-1,s=0;break;case 270:n=0,s=-1;break}}else{var u=t*Math.PI/180;n=Math.cos(u),s=Math.sin(u)}var o=n*(this.x-i.x)-s*(this.y-i.y)+i.x,l=s*(this.x-i.x)+n*(this.y-i.y)+i.y;return new e.Point(o,l)},toString:function(){return"("+Math.round(this.x*100)/100+","+Math.round(this.y*100)/100+")"}}})(r),(function(e){e.TileSource=function(i,n,s,h,u,o){var l=this,f=arguments,c,p;if(e.isPlainObject(i)?c=i:c={width:f[0],height:f[1],tileSize:f[2],tileOverlap:f[3],minLevel:f[4],maxLevel:f[5]},e.EventSource.call(this),e.extend(!0,this,c),!this.success){for(p=0;p<arguments.length;p++)if(e.isFunction(arguments[p])){this.success=arguments[p];break}}this.success&&this.addHandler("ready",function(_){l.success(_)}),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=c.width&&c.height?c.width/c.height:1,this.dimensions=new e.Point(c.width,c.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=c.tileOverlap?c.tileOverlap:0,this.minLevel=c.minLevel?c.minLevel:0,this.maxLevel=c.maxLevel!==void 0&&c.maxLevel!==null?c.maxLevel:c.width&&c.height?Math.ceil(Math.log(Math.max(c.width,c.height))/Math.log(2)):0,this.success&&e.isFunction(this.success)&&this.success(this))},e.TileSource.prototype={getTileSize:function(i){return e.console.error("[TileSource.getTileSize] is deprecated. Use TileSource.getTileWidth() and TileSource.getTileHeight() instead"),this._tileWidth},getTileWidth:function(i){return this._tileWidth?this._tileWidth:this.getTileSize(i)},getTileHeight:function(i){return this._tileHeight?this._tileHeight:this.getTileSize(i)},setMaxLevel:function(i){this.maxLevel=i,this._memoizeLevelScale()},getLevelScale:function(i){return this._memoizeLevelScale(),this.getLevelScale(i)},_memoizeLevelScale:function(){var i={},n;for(n=0;n<=this.maxLevel;n++)i[n]=1/Math.pow(2,this.maxLevel-n);this.getLevelScale=function(s){return i[s]}},getNumTiles:function(i){var n=this.getLevelScale(i),s=Math.ceil(n*this.dimensions.x/this.getTileWidth(i)),h=Math.ceil(n*this.dimensions.y/this.getTileHeight(i));return new e.Point(s,h)},getPixelRatio:function(i){var n=this.dimensions.times(this.getLevelScale(i)),s=1/n.x*e.pixelDensityRatio,h=1/n.y*e.pixelDensityRatio;return new e.Point(s,h)},getClosestLevel:function(){var i,n;for(i=this.minLevel+1;i<=this.maxLevel&&(n=this.getNumTiles(i),!(n.x>1||n.y>1));i++);return i-1},getTileAtPoint:function(i,n){var s=n.x>=0&&n.x<=1&&n.y>=0&&n.y<=1/this.aspectRatio;e.console.assert(s,"[TileSource.getTileAtPoint] must be called with a valid point.");var h=this.dimensions.x*this.getLevelScale(i),u=n.x*h,o=n.y*h,l=Math.floor(u/this.getTileWidth(i)),f=Math.floor(o/this.getTileHeight(i));n.x>=1&&(l=this.getNumTiles(i).x-1);var c=1e-15;return n.y>=1/this.aspectRatio-c&&(f=this.getNumTiles(i).y-1),new e.Point(l,f)},getTileBounds:function(i,n,s,h){var u=this.dimensions.times(this.getLevelScale(i)),o=this.getTileWidth(i),l=this.getTileHeight(i),f=n===0?0:o*n-this.tileOverlap,c=s===0?0:l*s-this.tileOverlap,p=o+(n===0?1:2)*this.tileOverlap,_=l+(s===0?1:2)*this.tileOverlap,d=1/u.x;return p=Math.min(p,u.x-f),_=Math.min(_,u.y-c),h?new e.Rect(0,0,p,_):new e.Rect(f*d,c*d,p*d,_*d)},getImageInfo:function(i){var n=this,s,h,u,o,l,f,c;i&&(l=i.split("/"),f=l[l.length-1],c=f.lastIndexOf("."),c>-1&&(l[l.length-1]=f.slice(0,c)));var p=null;if(this.splitHashDataForPost){var _=i.indexOf("#");_!==-1&&(p=i.substring(_+1),i=i.substr(0,_))}h=function(d){typeof d=="string"&&(d=e.parseXml(d));var v=e.TileSource.determineType(n,d,i);if(!v){n.raiseEvent("open-failed",{message:"Unable to load TileSource",source:i});return}o=v.prototype.configure.apply(n,[d,i,p]),o.ajaxWithCredentials===void 0&&(o.ajaxWithCredentials=n.ajaxWithCredentials),u=new v(o),n.ready=!0,n.raiseEvent("ready",{tileSource:u})},i.match(/\.js$/)?(s=i.split("/").pop().replace(".js",""),e.jsonp({url:i,async:!1,callbackName:s,callback:h})):e.makeAjaxRequest({url:i,postData:p,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(d){var v=t(d);h(v)},error:function(d,v){var w;try{w="HTTP "+d.status+" attempting to load TileSource: "+i}catch{var S;typeof v>"u"||!v.toString?S="Unknown error":S=v.toString(),w=S+" attempting to load TileSource: "+i}e.console.error(w),n.raiseEvent("open-failed",{message:w,source:i,postData:p})}})},supports:function(i,n){return!1},configure:function(i,n,s){throw new Error("Method not implemented.")},getTileUrl:function(i,n,s){throw new Error("Method not implemented.")},getTilePostData:function(i,n,s){return null},getTileAjaxHeaders:function(i,n,s){return{}},getTileHashKey:function(i,n,s,h,u,o){function l(f){return u?f+"+"+JSON.stringify(u):f}return l(typeof h!="string"?i+"/"+n+"_"+s:h)},tileExists:function(i,n,s){var h=this.getNumTiles(i);return i>=this.minLevel&&i<=this.maxLevel&&n>=0&&s>=0&&n<h.x&&s<h.y},hasTransparency:function(i,n,s,h){return!!i||n.match(".png")},downloadTileStart:function(i){var n=i.userData,s=new Image;n.image=s,n.request=null;var h=function(u){if(!s){i.finish(null,n.request,"Image load failed: undefined Image instance.");return}s.onload=s.onerror=s.onabort=null,i.finish(u?null:s,n.request,u)};s.onload=function(){h()},s.onabort=s.onerror=function(){h("Image load aborted.")},i.loadWithAjax?n.request=e.makeAjaxRequest({url:i.src,withCredentials:i.ajaxWithCredentials,headers:i.ajaxHeaders,responseType:"arraybuffer",postData:i.postData,success:function(u){var o;try{o=new window.Blob([u.response])}catch(c){var l=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(c.name==="TypeError"&&l){var f=new l;f.append(u.response),o=f.getBlob()}}o.size===0?h("Empty image response."):s.src=(window.URL||window.webkitURL).createObjectURL(o)},error:function(u){h("Image load aborted - XHR error")}}):(i.crossOriginPolicy!==!1&&(s.crossOrigin=i.crossOriginPolicy),s.src=i.src)},downloadTileAbort:function(i){i.userData.request&&i.userData.request.abort();var n=i.userData.image;i.userData.image&&(n.onload=n.onerror=n.onabort=null)},createTileCache:function(i,n,s){i._data=n},destroyTileCache:function(i){i._data=null,i._renderedContext=null},getTileCacheData:function(i){return i._data},getTileCacheDataAsImage:function(i){return i._data},getTileCacheDataAsContext2D:function(i){if(!i._renderedContext){var n=document.createElement("canvas");n.width=i._data.width,n.height=i._data.height,i._renderedContext=n.getContext("2d"),i._renderedContext.drawImage(i._data,0,0),i._data=null}return i._renderedContext}},e.extend(!0,e.TileSource.prototype,e.EventSource.prototype);function t(i){var n=i.responseText,s=i.status,h,u;if(i){if(i.status!==200&&i.status!==0)throw s=i.status,h=s===404?"Not Found":i.statusText,new Error(e.getString("Errors.Status",s,h))}else throw new Error(e.getString("Errors.Security"));if(n.match(/^\s*<.*/))try{u=i.responseXML&&i.responseXML.documentElement?i.responseXML:e.parseXml(n)}catch{u=i.responseText}else if(n.match(/\s*[{[].*/))try{u=e.parseJSON(n)}catch{u=n}else u=n;return u}e.TileSource.determineType=function(i,n,s){var h;for(h in r)if(h.match(/.+TileSource$/)&&e.isFunction(r[h])&&e.isFunction(r[h].prototype.supports)&&r[h].prototype.supports.call(i,n,s))return r[h];return e.console.error("No TileSource was able to open %s %s",s,n),null}})(r),(function(e){e.DziTileSource=function(n,s,h,u,o,l,f,c,p){var _,d,v,w;if(e.isPlainObject(n)?w=n:w={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=w.tilesUrl,this.fileFormat=w.fileFormat,this.displayRects=w.displayRects,this.displayRects)for(_=this.displayRects.length-1;_>=0;_--)for(d=this.displayRects[_],v=d.minLevel;v<=d.maxLevel;v++)this._levelRects[v]||(this._levelRects[v]=[]),this._levelRects[v].push(d);e.TileSource.apply(this,[w])},e.extend(e.DziTileSource.prototype,e.TileSource.prototype,{supports:function(n,s){var h;return n.Image?h=n.Image.xmlns:n.documentElement&&(n.documentElement.localName==="Image"||n.documentElement.tagName==="Image")&&(h=n.documentElement.namespaceURI),h=(h||"").toLowerCase(),h.indexOf("schemas.microsoft.com/deepzoom/2008")!==-1||h.indexOf("schemas.microsoft.com/deepzoom/2009")!==-1},configure:function(n,s,h){var u;return e.isPlainObject(n)?u=i(this,n):u=t(this,n),s&&!u.tilesUrl&&(u.tilesUrl=s.replace(/([^/]+?)(\.(dzi|xml|js)?(\?[^/]*)?)?\/?$/,"$1_files/"),s.search(/\.(dzi|xml|js)\?/)!==-1?u.queryParams=s.match(/\?.*/):u.queryParams=""),u},getTileUrl:function(n,s,h){return[this.tilesUrl,n,"/",s,"_",h,".",this.fileFormat,this.queryParams].join("")},tileExists:function(n,s,h){var u=this._levelRects[n],o,l,f,c,p,_,d;if(this.minLevel&&n<this.minLevel||this.maxLevel&&n>this.maxLevel)return!1;if(!u||!u.length)return!0;for(d=u.length-1;d>=0;d--)if(o=u[d],!(n<o.minLevel||n>o.maxLevel)&&(l=this.getLevelScale(n),f=o.x*l,c=o.y*l,p=f+o.width*l,_=c+o.height*l,f=Math.floor(f/this._tileWidth),c=Math.floor(c/this._tileWidth),p=Math.ceil(p/this._tileWidth),_=Math.ceil(_/this._tileWidth),f<=s&&s<p&&c<=h&&h<_))return!0;return!1}});function t(n,s){if(!s||!s.documentElement)throw new Error(e.getString("Errors.Xml"));var h=s.documentElement,u=h.localName||h.tagName,o=s.documentElement.namespaceURI,l=null,f=[],c,p,_,d,v;if(u==="Image")try{if(d=h.getElementsByTagName("Size")[0],d===void 0&&(d=h.getElementsByTagNameNS(o,"Size")[0]),l={Image:{xmlns:"http://schemas.microsoft.com/deepzoom/2008",Url:h.getAttribute("Url"),Format:h.getAttribute("Format"),DisplayRect:null,Overlap:parseInt(h.getAttribute("Overlap"),10),TileSize:parseInt(h.getAttribute("TileSize"),10),Size:{Height:parseInt(d.getAttribute("Height"),10),Width:parseInt(d.getAttribute("Width"),10)}}},!e.imageFormatSupported(l.Image.Format))throw new Error(e.getString("Errors.ImageFormat",l.Image.Format.toUpperCase()));for(c=h.getElementsByTagName("DisplayRect"),c===void 0&&(c=h.getElementsByTagNameNS(o,"DisplayRect")[0]),v=0;v<c.length;v++)p=c[v],_=p.getElementsByTagName("Rect")[0],_===void 0&&(_=p.getElementsByTagNameNS(o,"Rect")[0]),f.push({Rect:{X:parseInt(_.getAttribute("X"),10),Y:parseInt(_.getAttribute("Y"),10),Width:parseInt(_.getAttribute("Width"),10),Height:parseInt(_.getAttribute("Height"),10),MinLevel:parseInt(p.getAttribute("MinLevel"),10),MaxLevel:parseInt(p.getAttribute("MaxLevel"),10)}});return f.length&&(l.Image.DisplayRect=f),i(n,l)}catch(R){throw R instanceof Error?R:new Error(e.getString("Errors.Dzi"))}else{if(u==="Collection")throw new Error(e.getString("Errors.Dzc"));if(u==="Error"){var w=h.getElementsByTagName("Message")[0],S=w.firstChild.nodeValue;throw new Error(S)}}throw new Error(e.getString("Errors.Dzi"))}function i(n,s){var h=s.Image,u=h.Url,o=h.Format,l=h.Size,f=h.DisplayRect||[],c=parseInt(l.Width,10),p=parseInt(l.Height,10),_=parseInt(h.TileSize,10),d=parseInt(h.Overlap,10),v=[],w,S;for(S=0;S<f.length;S++)w=f[S].Rect,v.push(new e.DisplayRect(parseInt(w.X,10),parseInt(w.Y,10),parseInt(w.Width,10),parseInt(w.Height,10),parseInt(w.MinLevel,10),parseInt(w.MaxLevel,10)));return e.extend(!0,{width:c,height:p,tileSize:_,tileOverlap:d,minLevel:null,maxLevel:null,tilesUrl:u,fileFormat:o,displayRects:v},s)}})(r),(function(e){e.IIIFTileSource=function(h){if(e.extend(!0,this,h),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(h.tileSizePerScaleFactor={},this.tileFormat=this.tileFormat||"jpg",this.version=h.version,this.tile_width&&this.tile_height)h.tileWidth=this.tile_width,h.tileHeight=this.tile_height;else if(this.tile_width)h.tileSize=this.tile_width;else if(this.tile_height)h.tileSize=this.tile_height;else if(this.tiles)if(this.tiles.length===1)h.tileWidth=this.tiles[0].width,h.tileHeight=this.tiles[0].height||this.tiles[0].width,this.scale_factors=this.tiles[0].scaleFactors;else{this.scale_factors=[];for(var u=0;u<this.tiles.length;u++)for(var o=0;o<this.tiles[u].scaleFactors.length;o++){var l=this.tiles[u].scaleFactors[o];this.scale_factors.push(l),h.tileSizePerScaleFactor[l]={width:this.tiles[u].width,height:this.tiles[u].height||this.tiles[u].width}}}else if(t(h)){for(var f=Math.min(this.height,this.width),c=[256,512,1024],p=[],_=0;_<c.length;_++)c[_]<=f&&p.push(c[_]);p.length>0?h.tileSize=Math.max.apply(null,p):h.tileSize=f}else this.sizes&&this.sizes.length>0?(this.emulateLegacyImagePyramid=!0,h.levels=i(this),e.extend(!0,h,{width:h.levels[h.levels.length-1].width,height:h.levels[h.levels.length-1].height,tileSize:Math.max(h.height,h.width),tileOverlap:0,minLevel:0,maxLevel:h.levels.length-1}),this.levels=h.levels):e.console.error("Nothing in the info.json to construct image pyramids from");if(!h.maxLevel&&!this.emulateLegacyImagePyramid)if(!this.scale_factors)h.maxLevel=Number(Math.round(Math.log(Math.max(this.width,this.height),2)));else{var d=Math.max.apply(null,this.scale_factors);h.maxLevel=Math.round(Math.log(d)*Math.LOG2E)}if(this.sizes){var v=this.sizes.length;(v===h.maxLevel||v===h.maxLevel+1)&&(this.levelSizes=this.sizes.slice().sort((w,S)=>w.width-S.width),v===h.maxLevel&&this.levelSizes.push({width:this.width,height:this.height}))}e.TileSource.apply(this,[h])},e.extend(e.IIIFTileSource.prototype,e.TileSource.prototype,{supports:function(h,u){return h.protocol&&h.protocol==="http://iiif.io/api/image"||h["@context"]&&(h["@context"]==="http://library.stanford.edu/iiif/image-api/1.1/context.json"||h["@context"]==="http://iiif.io/api/image/1/context.json")||h.profile&&h.profile.indexOf("http://library.stanford.edu/iiif/image-api/compliance.html")===0||h.identifier&&h.width&&h.height?!0:!!(h.documentElement&&h.documentElement.tagName==="info"&&h.documentElement.namespaceURI==="http://library.stanford.edu/iiif/image-api/ns/")},configure:function(h,u,o){if(e.isPlainObject(h)){if(!h["@context"])h["@context"]="http://iiif.io/api/image/1.0/context.json",h["@id"]=u.replace("/info.json",""),h.version=1;else{var f=h["@context"];if(Array.isArray(f)){for(var c=0;c<f.length;c++)if(typeof f[c]=="string"&&(/^http:\/\/iiif\.io\/api\/image\/[1-3]\/context\.json$/.test(f[c])||f[c]==="http://library.stanford.edu/iiif/image-api/1.1/context.json")){f=f[c];break}}switch(f){case"http://iiif.io/api/image/1/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/context.json":h.version=1;break;case"http://iiif.io/api/image/2/context.json":h.version=2;break;case"http://iiif.io/api/image/3/context.json":h.version=3;break;default:e.console.error("Data has a @context property which contains no known IIIF context URI.")}}if(h.preferredFormats){for(var p=0;p<h.preferredFormats.length;p++)if(r.imageFormatSupported(h.preferredFormats[p])){h.tileFormat=h.preferredFormats[p];break}}return h}else{var l=n(h);return l["@context"]="http://iiif.io/api/image/1.0/context.json",l["@id"]=u.replace("/info.xml",""),l.version=1,l}},getTileWidth:function(h){if(this.emulateLegacyImagePyramid)return e.TileSource.prototype.getTileWidth.call(this,h);var u=Math.pow(2,this.maxLevel-h);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[u]?this.tileSizePerScaleFactor[u].width:this._tileWidth},getTileHeight:function(h){if(this.emulateLegacyImagePyramid)return e.TileSource.prototype.getTileHeight.call(this,h);var u=Math.pow(2,this.maxLevel-h);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[u]?this.tileSizePerScaleFactor[u].height:this._tileHeight},getLevelScale:function(h){if(this.emulateLegacyImagePyramid){var u=NaN;return this.levels.length>0&&h>=this.minLevel&&h<=this.maxLevel&&(u=this.levels[h].width/this.levels[this.maxLevel].width),u}return e.TileSource.prototype.getLevelScale.call(this,h)},getNumTiles:function(h){if(this.emulateLegacyImagePyramid){var u=this.getLevelScale(h);return u?new e.Point(1,1):new e.Point(0,0)}if(this.levelSizes){var o=this.levelSizes[h],l=Math.ceil(o.width/this.getTileWidth(h)),f=Math.ceil(o.height/this.getTileHeight(h));return new e.Point(l,f)}else return e.TileSource.prototype.getNumTiles.call(this,h)},getTileAtPoint:function(h,u){if(this.emulateLegacyImagePyramid)return new e.Point(0,0);if(this.levelSizes){var o=u.x>=0&&u.x<=1&&u.y>=0&&u.y<=1/this.aspectRatio;e.console.assert(o,"[TileSource.getTileAtPoint] must be called with a valid point.");var l=this.levelSizes[h].width,f=u.x*l,c=u.y*l,p=Math.floor(f/this.getTileWidth(h)),_=Math.floor(c/this.getTileHeight(h));u.x>=1&&(p=this.getNumTiles(h).x-1);var d=1e-15;return u.y>=1/this.aspectRatio-d&&(_=this.getNumTiles(h).y-1),new e.Point(p,_)}return e.TileSource.prototype.getTileAtPoint.call(this,h,u)},getTileUrl:function(h,u,o){if(this.emulateLegacyImagePyramid){var l=null;return this.levels.length>0&&h>=this.minLevel&&h<=this.maxLevel&&(l=this.levels[h].url),l}var f="0",c=Math.pow(.5,this.maxLevel-h),p,_,d,v,w,S,R,P,A,F,N,z,I,D,H,k;return this.levelSizes?(p=this.levelSizes[h].width,_=this.levelSizes[h].height):(p=Math.ceil(this.width*c),_=Math.ceil(this.height*c)),d=this.getTileWidth(h),v=this.getTileHeight(h),w=Math.round(d/c),S=Math.round(v/c),this.version===1?H="native."+this.tileFormat:H="default."+this.tileFormat,p<d&&_<v?(this.version===2&&p===this.width?z="full":this.version===3&&p===this.width&&_===this.height?z="max":this.version===3?z=p+","+_:z=p+",",R="full"):(P=u*w,A=o*S,F=Math.min(w,this.width-P),N=Math.min(S,this.height-A),u===0&&o===0&&F===this.width&&N===this.height?R="full":R=[P,A,F,N].join(","),I=Math.min(d,p-u*d),D=Math.min(v,_-o*v),this.version===2&&I===this.width?z="full":this.version===3&&I===this.width&&D===this.height?z="max":this.version===3?z=I+","+D:z=I+","),k=[this._id,R,z,f,H].join("/"),k},__testonly__:{canBeTiled:t,constructLevels:i}});function t(h){var u=["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"],o=Array.isArray(h.profile)?h.profile[0]:h.profile,l=u.indexOf(o)!==-1,f=!1;return h.version===2&&h.profile.length>1&&h.profile[1].supports&&(f=h.profile[1].supports.indexOf("sizeByW")!==-1),h.version===3&&h.extraFeatures&&(f=h.extraFeatures.indexOf("sizeByWh")!==-1),!l||f}function i(h){for(var u=[],o=0;o<h.sizes.length;o++)u.push({url:h._id+"/full/"+h.sizes[o].width+","+(h.version===3?h.sizes[o].height:"")+"/0/default."+h.tileFormat,width:h.sizes[o].width,height:h.sizes[o].height});return u.sort(function(l,f){return l.width-f.width})}function n(h){if(!h||!h.documentElement)throw new Error(e.getString("Errors.Xml"));var u=h.documentElement,o=u.tagName,l=null;if(o==="info")try{return l={},s(u,l),l}catch(f){throw f instanceof Error?f:new Error(e.getString("Errors.IIIF"))}throw new Error(e.getString("Errors.IIIF"))}function s(h,u,o){var l,f;if(h.nodeType===3&&o)f=h.nodeValue.trim(),f.match(/^\d*$/)&&(f=Number(f)),u[o]?(e.isArray(u[o])||(u[o]=[u[o]]),u[o].push(f)):u[o]=f;else if(h.nodeType===1)for(l=0;l<h.childNodes.length;l++)s(h.childNodes[l],u,h.nodeName)}})(r),(function(e){e.OsmTileSource=function(t,i,n,s,h){var u;e.isPlainObject(t)?u=t:u={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]},(!u.width||!u.height)&&(u.width=65572864,u.height=65572864),u.tileSize||(u.tileSize=256,u.tileOverlap=0),u.tilesUrl||(u.tilesUrl="http://tile.openstreetmap.org/"),u.minLevel=8,e.TileSource.apply(this,[u])},e.extend(e.OsmTileSource.prototype,e.TileSource.prototype,{supports:function(t,i){return t.type&&t.type==="openstreetmaps"},configure:function(t,i,n){return t},getTileUrl:function(t,i,n){return this.tilesUrl+(t-8)+"/"+i+"/"+n+".png"}})})(r),(function(e){e.TmsTileSource=function(t,i,n,s,h){var u;e.isPlainObject(t)?u=t:u={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]};var o=Math.ceil(u.width/256)*256,l=Math.ceil(u.height/256)*256,f;o>l?f=o/256:f=l/256,u.maxLevel=Math.ceil(Math.log(f)/Math.log(2))-1,u.tileSize=256,u.width=o,u.height=l,e.TileSource.apply(this,[u])},e.extend(e.TmsTileSource.prototype,e.TileSource.prototype,{supports:function(t,i){return t.type&&t.type==="tiledmapservice"},configure:function(t,i,n){return t},getTileUrl:function(t,i,n){var s=this.getNumTiles(t).y-1;return this.tilesUrl+t+"/"+i+"/"+(s-n)+".png"}})})(r),(function(e){e.ZoomifyTileSource=function(t){typeof t.tileSize>"u"&&(t.tileSize=256),typeof t.fileFormat>"u"&&(t.fileFormat="jpg",this.fileFormat=t.fileFormat);var i={x:t.width,y:t.height};for(t.imageSizes=[{x:t.width,y:t.height}],t.gridSize=[this._getGridSize(t.width,t.height,t.tileSize)];parseInt(i.x,10)>t.tileSize||parseInt(i.y,10)>t.tileSize;)i.x=Math.floor(i.x/2),i.y=Math.floor(i.y/2),t.imageSizes.push({x:i.x,y:i.y}),t.gridSize.push(this._getGridSize(i.x,i.y,t.tileSize));t.imageSizes.reverse(),t.gridSize.reverse(),t.minLevel=0,t.maxLevel=t.gridSize.length-1,r.TileSource.apply(this,[t])},e.extend(e.ZoomifyTileSource.prototype,e.TileSource.prototype,{_getGridSize:function(t,i,n){return{x:Math.ceil(t/n),y:Math.ceil(i/n)}},_calculateAbsoluteTileNumber:function(t,i,n){for(var s=0,h={},u=0;u<t;u++)h=this.gridSize[u],s+=h.x*h.y;return h=this.gridSize[t],s+=h.x*n+i,s},supports:function(t,i){return t.type&&t.type==="zoomifytileservice"},configure:function(t,i,n){return t},getTileUrl:function(t,i,n){var s=0,h=this._calculateAbsoluteTileNumber(t,i,n);return s=Math.floor(h/256),this.tilesUrl+"TileGroup"+s+"/"+t+"-"+i+"-"+n+"."+this.fileFormat}})})(r),(function(e){e.LegacyTileSource=function(s){var h,u,o;e.isArray(s)&&(h={type:"legacy-image-pyramid",levels:s}),h.levels=t(h.levels),h.levels.length>0?(u=h.levels[h.levels.length-1].width,o=h.levels[h.levels.length-1].height):(u=0,o=0,e.console.error("No supported image formats found")),e.extend(!0,h,{width:u,height:o,tileSize:Math.max(o,u),tileOverlap:0,minLevel:0,maxLevel:h.levels.length>0?h.levels.length-1:0}),e.TileSource.apply(this,[h]),this.levels=h.levels},e.extend(e.LegacyTileSource.prototype,e.TileSource.prototype,{supports:function(s,h){return s.type&&s.type==="legacy-image-pyramid"||s.documentElement&&s.documentElement.getAttribute("type")==="legacy-image-pyramid"},configure:function(s,h,u){var o;return e.isPlainObject(s)?o=n(this,s):o=i(this,s),o},getLevelScale:function(s){var h=NaN;return this.levels.length>0&&s>=this.minLevel&&s<=this.maxLevel&&(h=this.levels[s].width/this.levels[this.maxLevel].width),h},getNumTiles:function(s){var h=this.getLevelScale(s);return h?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(s,h,u){var o=null;return this.levels.length>0&&s>=this.minLevel&&s<=this.maxLevel&&(o=this.levels[s].url),o}});function t(s){var h=[],u,o;for(o=0;o<s.length;o++)u=s[o],u.height&&u.width&&u.url?h.push({url:u.url,width:Number(u.width),height:Number(u.height)}):e.console.error("Unsupported image format: %s",u.url?u.url:"<no URL>");return h.sort(function(l,f){return l.height-f.height})}function i(s,h){if(!h||!h.documentElement)throw new Error(e.getString("Errors.Xml"));var u=h.documentElement,o=u.tagName,l=null,f=[],c,p;if(o==="image")try{for(l={type:u.getAttribute("type"),levels:[]},f=u.getElementsByTagName("level"),p=0;p<f.length;p++)c=f[p],l.levels.push({url:c.getAttribute("url"),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10)});return n(s,l)}catch(_){throw _ instanceof Error?_:new Error("Unknown error parsing Legacy Image Pyramid XML.")}else{if(o==="collection")throw new Error("Legacy Image Pyramid Collections not yet supported.");if(o==="error")throw new Error("Error: "+h)}throw new Error("Unknown element "+o)}function n(s,h){return h.levels}})(r),(function(e){e.ImageTileSource=function(t){t=e.extend({buildPyramid:!0,crossOriginPolicy:!1,ajaxWithCredentials:!1},t),e.TileSource.apply(this,[t])},e.extend(e.ImageTileSource.prototype,e.TileSource.prototype,{supports:function(t,i){return t.type&&t.type==="image"},configure:function(t,i,n){return t},getImageInfo:function(t){var i=this._image=new Image,n=this;this.crossOriginPolicy&&(i.crossOrigin=this.crossOriginPolicy),this.ajaxWithCredentials&&(i.useCredentials=this.ajaxWithCredentials),e.addEvent(i,"load",function(){n.width=i.naturalWidth,n.height=i.naturalHeight,n.aspectRatio=n.width/n.height,n.dimensions=new e.Point(n.width,n.height),n._tileWidth=n.width,n._tileHeight=n.height,n.tileOverlap=0,n.minLevel=0,n.levels=n._buildLevels(),n.maxLevel=n.levels.length-1,n.ready=!0,n.raiseEvent("ready",{tileSource:n})}),e.addEvent(i,"error",function(){n.raiseEvent("open-failed",{message:"Error loading image at "+t,source:t})}),i.src=t},getLevelScale:function(t){var i=NaN;return t>=this.minLevel&&t<=this.maxLevel&&(i=this.levels[t].width/this.levels[this.maxLevel].width),i},getNumTiles:function(t){var i=this.getLevelScale(t);return i?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(t,i,n){var s=null;return t>=this.minLevel&&t<=this.maxLevel&&(s=this.levels[t].url),s},getContext2D:function(t,i,n){var s=null;return t>=this.minLevel&&t<=this.maxLevel&&(s=this.levels[t].context2D),s},destroy:function(t){this._freeupCanvasMemory(t)},_buildLevels:function(){var t=[{url:this._image.src,width:this._image.naturalWidth,height:this._image.naturalHeight}];if(!this.buildPyramid||!e.supportsCanvas)return delete this._image,t;var i=this._image.naturalWidth,n=this._image.naturalHeight,s=document.createElement("canvas"),h=s.getContext("2d");if(s.width=i,s.height=n,h.drawImage(this._image,0,0,i,n),t[0].context2D=h,delete this._image,e.isCanvasTainted(s))return t;for(;i>=2&&n>=2;){i=Math.floor(i/2),n=Math.floor(n/2);var u=document.createElement("canvas"),o=u.getContext("2d");u.width=i,u.height=n,o.drawImage(s,0,0,i,n),t.splice(0,0,{context2D:o,width:i,height:n}),s=u,h=o}return t},_freeupCanvasMemory:function(t){for(var i=0;i<this.levels.length;i++)this.levels[i].context2D&&(this.levels[i].context2D.canvas.height=0,this.levels[i].context2D.canvas.width=0,t&&t.raiseEvent("image-unloaded",{context2D:this.levels[i].context2D}))}})})(r),(function(e){e.TileSourceCollection=function(t,i,n,s){e.console.error("TileSourceCollection is deprecated; use World instead")}})(r),(function(e){e.ButtonState={REST:0,GROUP:1,HOVER:2,DOWN:3},e.Button=function(o){var l=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},o),this.element=o.element||e.makeNeutralElement("div"),o.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(f){f.insideElementPressed?(h(l,e.ButtonState.DOWN),l.raiseEvent("enter",{originalEvent:f.originalEvent})):f.buttonDownAny||h(l,e.ButtonState.HOVER)},focusHandler:function(f){l.tracker.enterHandler(f),l.raiseEvent("focus",{originalEvent:f.originalEvent})},leaveHandler:function(f){u(l,e.ButtonState.GROUP),f.insideElementPressed&&l.raiseEvent("exit",{originalEvent:f.originalEvent})},blurHandler:function(f){l.tracker.leaveHandler(f),l.raiseEvent("blur",{originalEvent:f.originalEvent})},pressHandler:function(f){h(l,e.ButtonState.DOWN),l.raiseEvent("press",{originalEvent:f.originalEvent})},releaseHandler:function(f){f.insideElementPressed&&f.insideElementReleased?(u(l,e.ButtonState.HOVER),l.raiseEvent("release",{originalEvent:f.originalEvent})):f.insideElementPressed?u(l,e.ButtonState.GROUP):h(l,e.ButtonState.HOVER)},clickHandler:function(f){f.quick&&l.raiseEvent("click",{originalEvent:f.originalEvent})},keyHandler:function(f){f.keyCode===13?(l.raiseEvent("click",{originalEvent:f.originalEvent}),l.raiseEvent("release",{originalEvent:f.originalEvent}),f.preventDefault=!0):f.preventDefault=!1}}),u(this,e.ButtonState.REST)},e.extend(e.Button.prototype,e.EventSource.prototype,{notifyGroupEnter:function(){h(this,e.ButtonState.GROUP)},notifyGroupExit:function(){u(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 t(o){e.requestAnimationFrame(function(){i(o)})}function i(o){var l,f,c;o.shouldFade&&(l=e.now(),f=l-o.fadeBeginTime,c=1-f/o.fadeLength,c=Math.min(1,c),c=Math.max(0,c),o.imgGroup&&e.setElementOpacity(o.imgGroup,c,!0),c>0&&t(o))}function n(o){o.shouldFade=!0,o.fadeBeginTime=e.now()+o.fadeDelay,window.setTimeout(function(){t(o)},o.fadeDelay)}function s(o){o.shouldFade=!1,o.imgGroup&&e.setElementOpacity(o.imgGroup,1,!0)}function h(o,l){o.element.disabled||(l>=e.ButtonState.GROUP&&o.currentState===e.ButtonState.REST&&(s(o),o.currentState=e.ButtonState.GROUP),l>=e.ButtonState.HOVER&&o.currentState===e.ButtonState.GROUP&&(o.imgHover&&(o.imgHover.style.visibility=""),o.currentState=e.ButtonState.HOVER),l>=e.ButtonState.DOWN&&o.currentState===e.ButtonState.HOVER&&(o.imgDown&&(o.imgDown.style.visibility=""),o.currentState=e.ButtonState.DOWN))}function u(o,l){o.element.disabled||(l<=e.ButtonState.HOVER&&o.currentState===e.ButtonState.DOWN&&(o.imgDown&&(o.imgDown.style.visibility="hidden"),o.currentState=e.ButtonState.HOVER),l<=e.ButtonState.GROUP&&o.currentState===e.ButtonState.HOVER&&(o.imgHover&&(o.imgHover.style.visibility="hidden"),o.currentState=e.ButtonState.GROUP),l<=e.ButtonState.REST&&o.currentState===e.ButtonState.GROUP&&(n(o),o.currentState=e.ButtonState.REST))}})(r),(function(e){e.ButtonGroup=function(t){e.extend(!0,this,{buttons:[],clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},t);var i=this.buttons.concat([]),n=this,s;if(this.element=t.element||e.makeNeutralElement("div"),!t.group)for(this.element.style.display="inline-block",s=0;s<i.length;s++)this.element.appendChild(i[s].element);e.setElementTouchActionNone(this.element),this.tracker=new e.MouseTracker({userData:"ButtonGroup.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(h){var u;for(u=0;u<n.buttons.length;u++)n.buttons[u].notifyGroupEnter()},leaveHandler:function(h){var u;if(!h.insideElementPressed)for(u=0;u<n.buttons.length;u++)n.buttons[u].notifyGroupExit()}})},e.ButtonGroup.prototype={addButton:function(t){this.buttons.push(t),this.element.appendChild(t.element)},emulateEnter:function(){this.tracker.enterHandler({eventSource:this.tracker})},emulateLeave:function(){this.tracker.leaveHandler({eventSource:this.tracker})},destroy:function(){for(;this.buttons.length;){var t=this.buttons.pop();this.element.removeChild(t.element),t.destroy()}this.tracker.destroy(),this.element=null}}})(r),(function(e){e.Rect=function(t,i,n,s,h){this.x=typeof t=="number"?t:0,this.y=typeof i=="number"?i:0,this.width=typeof n=="number"?n:0,this.height=typeof s=="number"?s:0,this.degrees=typeof h=="number"?h:0,this.degrees=e.positiveModulo(this.degrees,360);var u,o;this.degrees>=270?(u=this.getTopRight(),this.x=u.x,this.y=u.y,o=this.height,this.height=this.width,this.width=o,this.degrees-=270):this.degrees>=180?(u=this.getBottomRight(),this.x=u.x,this.y=u.y,this.degrees-=180):this.degrees>=90&&(u=this.getBottomLeft(),this.x=u.x,this.y=u.y,o=this.height,this.height=this.width,this.width=o,this.degrees-=90)},e.Rect.fromSummits=function(t,i,n){var s=t.distanceTo(i),h=t.distanceTo(n),u=i.minus(t),o=Math.atan(u.y/u.x);return u.x<0?o+=Math.PI:u.y<0&&(o+=2*Math.PI),new e.Rect(t.x,t.y,s,h,o/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(t){return t instanceof e.Rect&&this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height&&this.degrees===t.degrees},times:function(t){return new e.Rect(this.x*t,this.y*t,this.width*t,this.height*t,this.degrees)},translate:function(t){return new e.Rect(this.x+t.x,this.y+t.y,this.width,this.height,this.degrees)},union:function(t){var i=this.getBoundingBox(),n=t.getBoundingBox(),s=Math.min(i.x,n.x),h=Math.min(i.y,n.y),u=Math.max(i.x+i.width,n.x+n.width),o=Math.max(i.y+i.height,n.y+n.height);return new e.Rect(s,h,u-s,o-h)},intersection:function(t){var i=1e-10,n=[],s=this.getTopLeft();t.containsPoint(s,i)&&n.push(s);var h=this.getTopRight();t.containsPoint(h,i)&&n.push(h);var u=this.getBottomLeft();t.containsPoint(u,i)&&n.push(u);var o=this.getBottomRight();t.containsPoint(o,i)&&n.push(o);var l=t.getTopLeft();this.containsPoint(l,i)&&n.push(l);var f=t.getTopRight();this.containsPoint(f,i)&&n.push(f);var c=t.getBottomLeft();this.containsPoint(c,i)&&n.push(c);var p=t.getBottomRight();this.containsPoint(p,i)&&n.push(p);for(var _=this._getSegments(),d=t._getSegments(),v=0;v<_.length;v++)for(var w=_[v],S=0;S<d.length;S++){var R=d[S],P=A(w[0],w[1],R[0],R[1]);P&&n.push(P)}function A(k,q,O,U){var te=q.minus(k),$=U.minus(O),ne=-$.x*te.y+te.x*$.y;if(ne===0)return null;var B=(te.x*(k.y-O.y)-te.y*(k.x-O.x))/ne,W=($.x*(k.y-O.y)-$.y*(k.x-O.x))/ne;return-i<=B&&B<=1-i&&-i<=W&&W<=1-i?new e.Point(k.x+W*te.x,k.y+W*te.y):null}if(n.length===0)return null;for(var F=n[0].x,N=n[0].x,z=n[0].y,I=n[0].y,D=1;D<n.length;D++){var H=n[D];H.x<F&&(F=H.x),H.x>N&&(N=H.x),H.y<z&&(z=H.y),H.y>I&&(I=H.y)}return new e.Rect(F,z,N-F,I-z)},_getSegments:function(){var t=this.getTopLeft(),i=this.getTopRight(),n=this.getBottomLeft(),s=this.getBottomRight();return[[t,i],[i,s],[s,n],[n,t]]},rotate:function(t,i){if(t=e.positiveModulo(t,360),t===0)return this.clone();i=i||this.getCenter();var n=this.getTopLeft().rotate(t,i),s=this.getTopRight().rotate(t,i),h=s.minus(n);h=h.apply(function(o){var l=1e-15;return Math.abs(o)<l?0:o});var u=Math.atan(h.y/h.x);return h.x<0?u+=Math.PI:h.y<0&&(u+=2*Math.PI),new e.Rect(n.x,n.y,this.width,this.height,u/Math.PI*180)},getBoundingBox:function(){if(this.degrees===0)return this.clone();var t=this.getTopLeft(),i=this.getTopRight(),n=this.getBottomLeft(),s=this.getBottomRight(),h=Math.min(t.x,i.x,n.x,s.x),u=Math.max(t.x,i.x,n.x,s.x),o=Math.min(t.y,i.y,n.y,s.y),l=Math.max(t.y,i.y,n.y,s.y);return new e.Rect(h,o,u-h,l-o)},getIntegerBoundingBox:function(){var t=this.getBoundingBox(),i=Math.floor(t.x),n=Math.floor(t.y),s=Math.ceil(t.width+t.x-i),h=Math.ceil(t.height+t.y-n);return new e.Rect(i,n,s,h)},containsPoint:function(t,i){i=i||0;var n=this.getTopLeft(),s=this.getTopRight(),h=this.getBottomLeft(),u=s.minus(n),o=h.minus(n);return(t.x-n.x)*u.x+(t.y-n.y)*u.y>=-i&&(t.x-s.x)*u.x+(t.y-s.y)*u.y<=i&&(t.x-n.x)*o.x+(t.y-n.y)*o.y>=-i&&(t.x-h.x)*o.x+(t.y-h.y)*o.y<=i},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]"}}})(r),(function(e){var t={};e.ReferenceStrip=function(c){var p=this,_=c.viewer,d=e.getElementSize(_.element),v,w,S;for(c.id||(c.id="referencestrip-"+e.now(),this.element=e.makeNeutralElement("div"),this.element.id=c.id,this.element.className="referencestrip"),c=e.extend(!0,{sizeRatio:e.DEFAULT_SETTINGS.referenceStripSizeRatio,position:e.DEFAULT_SETTINGS.referenceStripPosition,scroll:e.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold},c,{element:this.element}),e.extend(this,c),t[this.id]={animating:!1},this.minPixelRatio=this.viewer.minPixelRatio,this.element.tabIndex=0,w=this.element.style,w.marginTop="0px",w.marginRight="0px",w.marginBottom="0px",w.marginLeft="0px",w.left="0px",w.bottom="0px",w.border="0px",w.background="#000",w.position="relative",e.setElementTouchActionNone(this.element),e.setElementOpacity(this.element,.8),this.viewer=_,this.tracker=new e.MouseTracker({userData:"ReferenceStrip.tracker",element:this.element,clickHandler:e.delegate(this,i),dragHandler:e.delegate(this,n),scrollHandler:e.delegate(this,s),enterHandler:e.delegate(this,u),leaveHandler:e.delegate(this,o),keyDownHandler:e.delegate(this,l),keyHandler:e.delegate(this,f),preProcessEventHandler:function(R){R.eventType==="wheel"&&(R.preventDefault=!0)}}),c.width&&c.height?(this.element.style.width=c.width+"px",this.element.style.height=c.height+"px",_.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})):c.scroll==="horizontal"?(this.element.style.width=d.x*c.sizeRatio*_.tileSources.length+12*_.tileSources.length+"px",this.element.style.height=d.y*c.sizeRatio+"px",_.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})):(this.element.style.height=d.y*c.sizeRatio*_.tileSources.length+12*_.tileSources.length+"px",this.element.style.width=d.x*c.sizeRatio+"px",_.addControl(this.element,{anchor:e.ControlAnchor.TOP_LEFT})),this.panelWidth=d.x*this.sizeRatio+8,this.panelHeight=d.y*this.sizeRatio+8,this.panels=[],this.miniViewers={},S=0;S<_.tileSources.length;S++)v=e.makeNeutralElement("div"),v.id=this.element.id+"-"+S,v.style.width=p.panelWidth+"px",v.style.height=p.panelHeight+"px",v.style.display="inline",v.style.float="left",v.style.cssFloat="left",v.style.padding="2px",e.setElementTouchActionNone(v),e.setElementPointerEventsNone(v),this.element.appendChild(v),v.activePanel=!1,this.panels.push(v);h(this,this.scroll==="vertical"?d.y:d.x,0),this.setFocus(0)},e.ReferenceStrip.prototype={setFocus:function(c){var p=this.element.querySelector("#"+this.element.id+"-"+c),_=e.getElementSize(this.viewer.canvas),d=Number(this.element.style.width.replace("px","")),v=Number(this.element.style.height.replace("px","")),w=-Number(this.element.style.marginLeft.replace("px","")),S=-Number(this.element.style.marginTop.replace("px","")),R;this.currentSelected!==p&&(this.currentSelected&&(this.currentSelected.style.background="#000"),this.currentSelected=p,this.currentSelected.style.background="#999",this.scroll==="horizontal"?(R=Number(c)*(this.panelWidth+3),R>w+_.x-this.panelWidth?(R=Math.min(R,d-_.x),this.element.style.marginLeft=-R+"px",h(this,_.x,-R)):R<w&&(R=Math.max(0,R-_.x/2),this.element.style.marginLeft=-R+"px",h(this,_.x,-R))):(R=Number(c)*(this.panelHeight+3),R>S+_.y-this.panelHeight?(R=Math.min(R,v-_.y),this.element.style.marginTop=-R+"px",h(this,_.y,-R)):R<S&&(R=Math.max(0,R-_.y/2),this.element.style.marginTop=-R+"px",h(this,_.y,-R))),this.currentPage=c,u.call(this,{eventSource:this.tracker}))},update:function(){return!!t[this.id].animating},destroy:function(){if(this.miniViewers)for(var c in this.miniViewers)this.miniViewers[c].destroy();this.tracker.destroy(),this.element&&this.viewer.removeControl(this.element)}};function i(c){if(c.quick){var p;this.scroll==="horizontal"?p=Math.floor(c.position.x/(this.panelWidth+4)):p=Math.floor(c.position.y/this.panelHeight),this.viewer.goToPage(p)}this.element.focus()}function n(c){if(this.dragging=!0,this.element){var p=Number(this.element.style.marginLeft.replace("px","")),_=Number(this.element.style.marginTop.replace("px","")),d=Number(this.element.style.width.replace("px","")),v=Number(this.element.style.height.replace("px","")),w=e.getElementSize(this.viewer.canvas);this.scroll==="horizontal"?-c.delta.x>0?p>-(d-w.x)&&(this.element.style.marginLeft=p+c.delta.x*2+"px",h(this,w.x,p+c.delta.x*2)):-c.delta.x<0&&p<0&&(this.element.style.marginLeft=p+c.delta.x*2+"px",h(this,w.x,p+c.delta.x*2)):-c.delta.y>0?_>-(v-w.y)&&(this.element.style.marginTop=_+c.delta.y*2+"px",h(this,w.y,_+c.delta.y*2)):-c.delta.y<0&&_<0&&(this.element.style.marginTop=_+c.delta.y*2+"px",h(this,w.y,_+c.delta.y*2))}}function s(c){if(this.element){var p=Number(this.element.style.marginLeft.replace("px","")),_=Number(this.element.style.marginTop.replace("px","")),d=Number(this.element.style.width.replace("px","")),v=Number(this.element.style.height.replace("px","")),w=e.getElementSize(this.viewer.canvas);this.scroll==="horizontal"?c.scroll>0?p>-(d-w.x)&&(this.element.style.marginLeft=p-c.scroll*60+"px",h(this,w.x,p-c.scroll*60)):c.scroll<0&&p<0&&(this.element.style.marginLeft=p-c.scroll*60+"px",h(this,w.x,p-c.scroll*60)):c.scroll<0?_>w.y-v&&(this.element.style.marginTop=_+c.scroll*60+"px",h(this,w.y,_+c.scroll*60)):c.scroll>0&&_<0&&(this.element.style.marginTop=_+c.scroll*60+"px",h(this,w.y,_+c.scroll*60)),c.preventDefault=!0}}function h(c,p,_){var d,v,w,S,R,P;for(c.scroll==="horizontal"?d=c.panelWidth:d=c.panelHeight,v=Math.ceil(p/d)+5,w=Math.ceil((Math.abs(_)+p)/d)+1,v=w-v,v=v<0?0:v,R=v;R<w&&R<c.panels.length;R++)if(P=c.panels[R],!P.activePanel){var A,F=c.viewer.tileSources[R];F.referenceStripThumbnailUrl?A={type:"image",url:F.referenceStripThumbnailUrl}:A=F,S=new e.Viewer({id:P.id,tileSources:[A],element:P,navigatorSizeRatio:c.sizeRatio,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:0,loadTilesWithAjax:c.viewer.loadTilesWithAjax,ajaxHeaders:c.viewer.ajaxHeaders,drawer:"canvas"}),e.setElementPointerEventsNone(S.canvas),e.setElementPointerEventsNone(S.container),S.innerTracker.setTracking(!1),S.outerTracker.setTracking(!1),c.miniViewers[P.id]=S,P.activePanel=!0}}function u(c){var p=c.eventSource.element;this.scroll==="horizontal"?p.style.marginBottom="0px":p.style.marginLeft="0px"}function o(c){var p=c.eventSource.element;this.scroll==="horizontal"?p.style.marginBottom="-"+e.getElementSize(p).y/2+"px":p.style.marginLeft="-"+e.getElementSize(p).x/2+"px"}function l(c){if(!c.ctrl&&!c.alt&&!c.meta)switch(c.keyCode){case 38:s.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),c.preventDefault=!0;break;case 40:s.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),c.preventDefault=!0;break;case 37:s.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),c.preventDefault=!0;break;case 39:s.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),c.preventDefault=!0;break;default:c.preventDefault=!1;break}else c.preventDefault=!1}function f(c){if(!c.ctrl&&!c.alt&&!c.meta)switch(c.keyCode){case 61:s.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),c.preventDefault=!0;break;case 45:s.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),c.preventDefault=!0;break;case 48:case 119:case 87:s.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),c.preventDefault=!0;break;case 115:case 83:s.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),c.preventDefault=!0;break;case 97:s.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),c.preventDefault=!0;break;case 100:s.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),c.preventDefault=!0;break;default:c.preventDefault=!1;break}else c.preventDefault=!1}})(r),(function(e){e.DisplayRect=function(t,i,n,s,h,u){e.Rect.apply(this,[t,i,n,s]),this.minLevel=h,this.maxLevel=u},e.extend(e.DisplayRect.prototype,e.Rect.prototype)})(r),(function(e){e.Spring=function(i){var n=arguments;typeof i!="object"&&(i={initial:n.length&&typeof n[0]=="number"?n[0]:void 0,springStiffness:n.length>1?n[1].springStiffness:5,animationTime:n.length>1?n[1].animationTime:1.5}),e.console.assert(typeof i.springStiffness=="number"&&i.springStiffness!==0,"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number"),e.console.assert(typeof i.animationTime=="number"&&i.animationTime>=0,"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0"),i.exponential&&(this._exponential=!0,delete i.exponential),e.extend(!0,this,i),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(i){e.console.assert(!this._exponential||i!==0,"[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs"),this.start.value=this.target.value=this.current.value=i,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(i){e.console.assert(!this._exponential||i!==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=i,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(i){this.start.value+=i,this.target.value+=i,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(i){this._exponential=i,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 i,n;if(this._exponential?(i=this.start._logValue,n=this.target._logValue):(i=this.start.value,n=this.target.value),this.current.time>=this.target.time)this.current.value=this.target.value;else{let s=i+(n-i)*t(this.springStiffness,(this.current.time-this.start.time)/(this.target.time-this.start.time));this._exponential?this.current.value=Math.exp(s):this.current.value=s}return this.current.value!==this.target.value},isAtTargetValue:function(){return this.current.value===this.target.value}};function t(i,n){return(1-Math.exp(i*-n))/(1-Math.exp(-i))}})(r),(function(e){e.ImageJob=function(i){e.extend(!0,this,{timeout:e.DEFAULT_SETTINGS.timeout,jobId:null,tries:0},i),this.data=null,this.userData={},this.errorMsg=null},e.ImageJob.prototype={start:function(){this.tries++;var i=this,n=this.abort;this.jobId=window.setTimeout(function(){i.finish(null,null,"Image load exceeded timeout ("+i.timeout+" ms)")},this.timeout),this.abort=function(){i.source.downloadTileAbort(i),typeof n=="function"&&n()},this.source.downloadTileStart(this)},finish:function(i,n,s){this.data=i,this.request=n,this.errorMsg=s,this.jobId&&window.clearTimeout(this.jobId),this.callback(this)}},e.ImageLoader=function(i){e.extend(!0,this,{jobLimit:e.DEFAULT_SETTINGS.imageLoaderLimit,timeout:e.DEFAULT_SETTINGS.timeout,jobQueue:[],failedTiles:[],jobsInProgress:0},i)},e.ImageLoader.prototype={addJob:function(i){if(!i.source){e.console.error("ImageLoader.prototype.addJob() requires [options.source]. TileSource since new API defines how images are fetched. Creating a dummy TileSource.");var n=e.TileSource.prototype;i.source={downloadTileStart:n.downloadTileStart,downloadTileAbort:n.downloadTileAbort}}var s=this,h=function(l){t(s,l,i.callback)},u={src:i.src,tile:i.tile||{},source:i.source,loadWithAjax:i.loadWithAjax,ajaxHeaders:i.loadWithAjax?i.ajaxHeaders:null,crossOriginPolicy:i.crossOriginPolicy,ajaxWithCredentials:i.ajaxWithCredentials,postData:i.postData,callback:h,abort:i.abort,timeout:this.timeout},o=new e.ImageJob(u);!this.jobLimit||this.jobsInProgress<this.jobLimit?(o.start(),this.jobsInProgress++):this.jobQueue.push(o)},clear:function(){for(var i=0;i<this.jobQueue.length;i++){var n=this.jobQueue[i];typeof n.abort=="function"&&n.abort()}this.jobQueue=[]}};function t(i,n,s){n.errorMsg!==""&&(n.data===null||n.data===void 0)&&n.tries<1+i.tileRetryMax&&i.failedTiles.push(n);var h;i.jobsInProgress--,(!i.jobLimit||i.jobsInProgress<i.jobLimit)&&i.jobQueue.length>0&&(h=i.jobQueue.shift(),h.start(),i.jobsInProgress++),i.tileRetryMax>0&&i.jobQueue.length===0&&(!i.jobLimit||i.jobsInProgress<i.jobLimit)&&i.failedTiles.length>0&&(h=i.failedTiles.shift(),setTimeout(function(){h.start()},i.tileRetryDelay),i.jobsInProgress++),s(n.data,n.errorMsg,n.request)}})(r),(function(e){e.Tile=function(t,i,n,s,h,u,o,l,f,c,p,_){this.level=t,this.x=i,this.y=n,this.bounds=s,this.positionedBounds=new r.Rect(s.x,s.y,s.width,s.height),this.sourceBounds=c,this.exists=h,this._url=u,this.postData=p,this.context2D=o,this.loadWithAjax=l,this.ajaxHeaders=f,_===void 0&&(e.console.warn("Tile constructor needs 'cacheKey' variable: creation tile cache in Tile class is deprecated. TileSource.prototype.getTileHashKey will be used."),_=e.TileSource.prototype.getTileHashKey(t,i,n,u,f,p)),this.cacheKey=_,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 t;if(this.cacheImageRecord)t=this.cacheImageRecord.getRenderedContext();else if(this.context2D)t=this.context2D;else return e.console.warn("[Tile.drawCanvas] attempting to get tile scale %s when tile's not cached",this.toString()),1;return t.canvas.width/(this.size.x*e.pixelDensityRatio)},getTranslationForEdgeSmoothing:function(t,i,n){var s=Math.max(1,Math.ceil((n.x-i.x)/2)),h=Math.max(1,Math.ceil((n.y-i.y)/2));return new e.Point(s,h).minus(this.position.times(e.pixelDensityRatio).times(t||1).apply(function(u){return u%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}}})(r),(function(e){e.OverlayPlacement=e.Placement,e.OverlayRotationMode=e.freezeObject({NO_ROTATION:1,EXACT:2,BOUNDING_BOX:3}),e.Overlay=function(t,i,n){var s;e.isPlainObject(t)?s=t:s={element:t,location:i,placement:n},this.elementWrapper=document.createElement("div"),this.element=s.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(s)},e.Overlay.prototype={_init:function(t){this.location=t.location,this.placement=t.placement===void 0?e.Placement.TOP_LEFT:t.placement,this.onDraw=t.onDraw,this.checkResize=t.checkResize===void 0?!0:t.checkResize,this.width=t.width===void 0?null:t.width,this.height=t.height===void 0?null:t.height,this.rotationMode=t.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(t,i){var n=e.Placement.properties[this.placement];n&&(n.isHorizontallyCentered?t.x-=i.x/2:n.isRight&&(t.x-=i.x),n.isVerticallyCentered?t.y-=i.y/2:n.isBottom&&(t.y-=i.y))},destroy:function(){var t=this.elementWrapper,i=this.style;t.parentNode&&(t.parentNode.removeChild(t),t.prevElementParent&&(i.display="none",document.body.appendChild(t))),this.onDraw=null,i.top="",i.left="",i.position="",this.width!==null&&(i.width=""),this.height!==null&&(i.height="");var n=e.getCssPropertyWithVendorPrefix("transformOrigin"),s=e.getCssPropertyWithVendorPrefix("transform");n&&s&&(i[n]="",i[s]="")},drawHTML:function(t,i){var n=this.elementWrapper;n.parentNode!==t&&(n.prevElementParent=n.parentNode,n.prevNextSibling=n.nextSibling,t.appendChild(n),this.style.position="absolute",this.size=e.getElementSize(this.elementWrapper));var s=this._getOverlayPositionAndSize(i),h=s.position,u=this.size=s.size,o="";i.overlayPreserveContentDirection&&(o=i.flipped?" scaleX(-1)":" scaleX(1)");var l=i.flipped?-s.rotate:s.rotate,f=i.flipped?" scaleX(-1)":"";if(this.onDraw)this.onDraw(h,u,this.element);else{var c=this.style,p=this.element.style;p.display="block",c.left=h.x+"px",c.top=h.y+"px",this.width!==null&&(p.width=u.x+"px"),this.height!==null&&(p.height=u.y+"px");var _=e.getCssPropertyWithVendorPrefix("transformOrigin"),d=e.getCssPropertyWithVendorPrefix("transform");_&&d&&(l&&!i.flipped?(p[d]="",c[_]=this._getTransformOrigin(),c[d]="rotate("+l+"deg)"):!l&&i.flipped?(p[d]=o,c[_]=this._getTransformOrigin(),c[d]=f):l&&i.flipped?(p[d]=o,c[_]=this._getTransformOrigin(),c[d]="rotate("+l+"deg)"+f):(p[d]="",c[_]="",c[d]="")),c.display="flex"}},_getOverlayPositionAndSize:function(t){var i=t.pixelFromPoint(this.location,!0),n=this._getSizeInPixels(t);this.adjust(i,n);var s=0;if(t.getRotation(!0)&&this.rotationMode!==e.OverlayRotationMode.NO_ROTATION)if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX&&this.width!==null&&this.height!==null){var h=new e.Rect(i.x,i.y,n.x,n.y),u=this._getBoundingBox(h,t.getRotation(!0));i=u.getTopLeft(),n=u.getSize()}else s=t.getRotation(!0);return t.flipped&&(i.x=t.getContainerSize().x-i.x),{position:i,size:n,rotate:s}},_getSizeInPixels:function(t){var i=this.size.x,n=this.size.y;if(this.width!==null||this.height!==null){var s=t.deltaPixelsFromPointsNoRotate(new e.Point(this.width||0,this.height||0),!0);this.width!==null&&(i=s.x),this.height!==null&&(n=s.y)}if(this.checkResize&&(this.width===null||this.height===null)){var h=this.size=e.getElementSize(this.elementWrapper);this.width===null&&(i=h.x),this.height===null&&(n=h.y)}return new e.Point(i,n)},_getBoundingBox:function(t,i){var n=this._getPlacementPoint(t);return t.rotate(i,n).getBoundingBox()},_getPlacementPoint:function(t){var i=new e.Point(t.x,t.y),n=e.Placement.properties[this.placement];return n&&(n.isHorizontallyCentered?i.x+=t.width/2:n.isRight&&(i.x+=t.width),n.isVerticallyCentered?i.y+=t.height/2:n.isBottom&&(i.y+=t.height)),i},_getTransformOrigin:function(){var t="",i=e.Placement.properties[this.placement];return i&&(i.isLeft?t="left":i.isRight&&(t="right"),i.isTop?t+=" top":i.isBottom&&(t+=" bottom")),t},update:function(t,i){var n=e.isPlainObject(t)?t:{location:t,placement:i};this._init({location:n.location||this.location,placement:n.placement!==void 0?n.placement:this.placement,onDraw:n.onDraw||this.onDraw,checkResize:n.checkResize||this.checkResize,width:n.width!==void 0?n.width:this.width,height:n.height!==void 0?n.height:this.height,rotationMode:n.rotationMode||this.rotationMode})},getBounds:function(t){e.console.assert(t,"A viewport must now be passed to Overlay.getBounds.");var i=this.width,n=this.height;if(i===null||n===null){var s=t.deltaPointsFromPixelsNoRotate(this.size,!0);i===null&&(i=s.x),n===null&&(n=s.y)}var h=this.location.clone();return this.adjust(h,new e.Point(i,n)),this._adjustBoundsForRotation(t,new e.Rect(h.x,h.y,i,n))},_adjustBoundsForRotation:function(t,i){if(!t||t.getRotation(!0)===0||this.rotationMode===e.OverlayRotationMode.EXACT)return i;if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX){if(this.width===null||this.height===null)return i;var n=this._getOverlayPositionAndSize(t);return t.viewerElementToViewportRectangle(new e.Rect(n.position.x,n.position.y,n.size.x,n.size.y))}return i.rotate(-t.getRotation(!0),this._getPlacementPoint(i))}}})(r),(function(e){const t=e;t.DrawerBase=class{constructor(n){e.console.assert(n.viewer,"[Drawer] options.viewer is required"),e.console.assert(n.viewport,"[Drawer] options.viewport is required"),e.console.assert(n.element,"[Drawer] options.element is required"),this.viewer=n.viewer,this.viewport=n.viewport,this.debugGridColor=typeof n.debugGridColor=="string"?[n.debugGridColor]:n.debugGridColor||e.DEFAULT_SETTINGS.debugGridColor,this.options=n.options||{},this.container=e.getElement(n.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(n){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(n){return!1}setImageSmoothingEnabled(n){e.console.error("Drawer.setImageSmoothingEnabled must be implemented by child class")}drawDebuggingRect(n){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(n){var s=this.viewport.pixelFromPointNoRotate(n.getTopLeft(),!0),h=this.viewport.deltaPixelsFromPointsNoRotate(n.getSize(),!0);return new e.Rect(s.x*e.pixelDensityRatio,s.y*e.pixelDensityRatio,h.x*e.pixelDensityRatio,h.y*e.pixelDensityRatio)}viewportCoordToDrawerCoord(n){var s=this.viewport.pixelFromPointNoRotate(n,!0);return new e.Point(s.x*e.pixelDensityRatio,s.y*e.pixelDensityRatio)}_calculateCanvasSize(){var n=e.pixelDensityRatio,s=this.viewport.getContainerSize();return new t.Point(Math.round(s.x*n),Math.round(s.y*n))}_raiseTiledImageDrawnEvent(n,s){this.viewer&&this.viewer.raiseEvent("tiled-image-drawn",{tiledImage:n,tiles:s})}_raiseDrawerErrorEvent(n,s){this.viewer&&this.viewer.raiseEvent("drawer-error",{tiledImage:n,drawer:this,error:s})}}})(r),(function(e){const t=e;class i extends t.DrawerBase{constructor(s){super(s),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(s){return!0}_createDrawingElement(){return e.makeNeutralElement("div")}draw(s){var h=this;this._prepareNewFrame(),s.forEach(function(u){u.opacity!==0&&h._drawTiles(u)})}canRotate(){return!1}destroy(){this.container.removeChild(this.canvas)}setImageSmoothingEnabled(){}_prepareNewFrame(){this.canvas.innerHTML=""}_drawTiles(s){var h=s.getTilesToDraw().map(l=>l.tile);if(!(s.opacity===0||h.length===0&&!s.placeholderFillStyle))for(var u=h.length-1;u>=0;u--){var o=h[u];this._drawTile(o),this.viewer&&this.viewer.raiseEvent("tile-drawn",{tiledImage:s,tile:o})}}_drawTile(s){e.console.assert(s,"[Drawer._drawTile] tile is required");let h=this.canvas;if(!s.cacheImageRecord){e.console.warn("[Drawer._drawTileToHTML] attempting to draw tile %s when it's not cached",s.toString());return}if(!s.loaded){e.console.warn("Attempting to draw tile %s when it's not yet loaded.",s.toString());return}if(!s.element){var u=s.getImage();if(!u)return;s.element=e.makeNeutralElement("div"),s.imgElement=u.cloneNode(),s.imgElement.style.msInterpolationMode="nearest-neighbor",s.imgElement.style.width="100%",s.imgElement.style.height="100%",s.style=s.element.style,s.style.position="absolute"}s.element.parentNode!==h&&h.appendChild(s.element),s.imgElement.parentNode!==s.element&&s.element.appendChild(s.imgElement),s.style.top=s.position.y+"px",s.style.left=s.position.x+"px",s.style.height=s.size.y+"px",s.style.width=s.size.x+"px",s.flipped&&(s.style.transform="scaleX(-1)"),e.setElementOpacity(s.element,s.opacity)}}e.HTMLDrawer=i})(r),(function(e){const t=e;class i extends t.DrawerBase{constructor(l){super(l),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 l=e.makeNeutralElement("canvas"),f=this._calculateCanvasSize();return l.width=f.x,l.height=f.y,l}draw(l){this._prepareNewFrame(),this.viewer.viewport.getFlip()!==this._viewportFlipped&&this._flip();for(const f of l)f.opacity!==0&&this._drawTiles(f)}canRotate(){return!0}destroy(){this.canvas.width=1,this.canvas.height=1,this.sketchCanvas=null,this.sketchContext=null,this.container.removeChild(this.canvas)}minimumOverlapRequired(l){return!0}setImageSmoothingEnabled(l){this._imageSmoothingEnabled=!!l,this._updateImageSmoothingEnabled(this.context),this.viewer.forceRedraw()}drawDebuggingRect(l){var f=this.context;f.save(),f.lineWidth=2*e.pixelDensityRatio,f.strokeStyle=this.debugGridColor[0],f.fillStyle=this.debugGridColor[0],f.strokeRect(l.x*e.pixelDensityRatio,l.y*e.pixelDensityRatio,l.width*e.pixelDensityRatio,l.height*e.pixelDensityRatio),f.restore()}get _viewportFlipped(){return this.context.getTransform().a<0}_raiseTileDrawingEvent(l,f,c,p){this.viewer.raiseEvent("tile-drawing",{tiledImage:l,context:f,tile:c,rendered:p})}_prepareNewFrame(){var l=this._calculateCanvasSize();if((this.canvas.width!==l.x||this.canvas.height!==l.y)&&(this.canvas.width=l.x,this.canvas.height=l.y,this._updateImageSmoothingEnabled(this.context),this.sketchCanvas!==null)){var f=this._calculateSketchCanvasSize();this.sketchCanvas.width=f.x,this.sketchCanvas.height=f.y,this._updateImageSmoothingEnabled(this.sketchContext)}this._clear()}_clear(l,f){var c=this._getContext(l);if(f)c.clearRect(f.x,f.y,f.width,f.height);else{var p=c.canvas;c.clearRect(0,0,p.width,p.height)}}_drawTiles(l){var f=l.getTilesToDraw().map(k=>k.tile);if(!(l.opacity===0||f.length===0&&!l.placeholderFillStyle)){var c=f[0],p;c&&(p=l.opacity<1||l.compositeOperation&&l.compositeOperation!=="source-over"||!l._isBottomItem()&&l.source.hasTransparency(c.context2D,c.getUrl(),c.ajaxHeaders,c.postData));var _,d,v=this.viewport.getZoom(!0),w=l.viewportToImageZoom(v);f.length>1&&w>l.smoothTileEdgesMinZoom&&!l.iOSDevice&&l.getRotation(!0)%360===0&&(p=!0,_=c.getScaleForEdgeSmoothing(),d=c.getTranslationForEdgeSmoothing(_,this._getCanvasSize(!1),this._getCanvasSize(!0)));var S;p&&(_||(S=this.viewport.viewportToViewerElementRectangle(l.getClippedBounds(!0)).getIntegerBoundingBox(),S=S.times(e.pixelDensityRatio)),this._clear(!0,S)),_||this._setRotations(l,p);var R=!1;if(l._clip){this._saveContext(p);var P=l.imageToViewportRectangle(l._clip,!0);P=P.rotate(-l.getRotation(!0),l._getRotationPoint(!0));var A=this.viewportToDrawerRectangle(P);_&&(A=A.times(_)),d&&(A=A.translate(d)),this._setClip(A,p),R=!0}if(l._croppingPolygons){var F=this;R||this._saveContext(p);try{var N=l._croppingPolygons.map(function(k){return k.map(function(q){var O=l.imageToViewportCoordinates(q.x,q.y,!0).rotate(-l.getRotation(!0),l._getRotationPoint(!0)),U=F.viewportCoordToDrawerCoord(O);return _&&(U=U.times(_)),d&&(U=U.plus(d)),U})});this._clipWithPolygons(N,p)}catch(k){e.console.error(k)}R=!0}if(l._hasOpaqueTile=!1,l.placeholderFillStyle&&l._hasOpaqueTile===!1){let k=this.viewportToDrawerRectangle(l.getBoundsNoRotate(!0));_&&(k=k.times(_)),d&&(k=k.translate(d));let q=null;typeof l.placeholderFillStyle=="function"?q=l.placeholderFillStyle(l,this.context):q=l.placeholderFillStyle,this._drawRectangle(k,q,p)}var z=u(l.subPixelRoundingForTransparency),I=!1;if(z===e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS)I=!0;else if(z===e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST){var D=this.viewer&&this.viewer.isAnimating();I=!D}for(var H=0;H<f.length;H++)c=f[H],this._drawTile(c,l,p,_,d,I,l.source),this.viewer&&this.viewer.raiseEvent("tile-drawn",{tiledImage:l,tile:c});R&&this._restoreContext(p),_||(l.getRotation(!0)%360!==0&&this._restoreRotationChanges(p),this.viewport.getRotation(!0)%360!==0&&this._restoreRotationChanges(p)),p&&(_&&this._setRotations(l),this.blendSketch({opacity:l.opacity,scale:_,translate:d,compositeOperation:l.compositeOperation,bounds:S}),_&&(l.getRotation(!0)%360!==0&&this._restoreRotationChanges(!1),this.viewport.getRotation(!0)%360!==0&&this._restoreRotationChanges(!1))),this._drawDebugInfo(l,f),this._raiseTiledImageDrawnEvent(l,f)}}_drawDebugInfo(l,f){if(l.debugMode)for(var c=f.length-1;c>=0;c--){var p=f[c];try{this._drawDebugInfoOnTile(p,f.length,c,l)}catch(_){e.console.error(_)}}}_clipWithPolygons(l,f){var c=this._getContext(f);c.beginPath();for(const p of l)for(const[_,d]of p.entries())c[_===0?"moveTo":"lineTo"](d.x,d.y);c.clip()}_drawTile(l,f,c,p,_,d,v){e.console.assert(l,"[Drawer._drawTile] tile is required"),e.console.assert(f,"[Drawer._drawTile] drawingHandler is required");var w=this._getContext(c);p=p||1,this._drawTileToCanvas(l,w,f,p,_,d,v)}_drawTileToCanvas(l,f,c,p,_,d,v){var w=l.position.times(e.pixelDensityRatio),S=l.size.times(e.pixelDensityRatio),R;if(!l.context2D&&!l.cacheImageRecord){e.console.warn("[Drawer._drawTileToCanvas] attempting to draw tile %s when it's not cached",l.toString());return}if(R=l.getCanvasContext(),!l.loaded||!R){e.console.warn("Attempting to draw tile %s when it's not yet loaded.",l.toString());return}f.save(),typeof p=="number"&&p!==1&&(w=w.times(p),S=S.times(p)),_ instanceof e.Point&&(w=w.plus(_)),f.globalAlpha===1&&l.hasTransparency&&(d&&(w.x=Math.round(w.x),w.y=Math.round(w.y),S.x=Math.round(S.x),S.y=Math.round(S.y)),f.clearRect(w.x,w.y,S.x,S.y)),this._raiseTileDrawingEvent(c,f,l,R);var P,A;l.sourceBounds?(P=Math.min(l.sourceBounds.width,R.canvas.width),A=Math.min(l.sourceBounds.height,R.canvas.height)):(P=R.canvas.width,A=R.canvas.height),f.translate(w.x+S.x/2,0),l.flipped&&f.scale(-1,1),f.drawImage(R.canvas,0,0,P,A,-S.x/2,w.y,S.x,S.y),f.restore()}_getContext(l){var f=this.context;if(l){if(this.sketchCanvas===null){this.sketchCanvas=document.createElement("canvas");var c=this._calculateSketchCanvasSize();if(this.sketchCanvas.width=c.x,this.sketchCanvas.height=c.y,this.sketchContext=this.sketchCanvas.getContext("2d"),this.viewport.getRotation()===0){var p=this;this.viewer.addHandler("rotate",function _(){if(p.viewport.getRotation()!==0){p.viewer.removeHandler("rotate",_);var d=p._calculateSketchCanvasSize();p.sketchCanvas.width=d.x,p.sketchCanvas.height=d.y}})}this._updateImageSmoothingEnabled(this.sketchContext)}f=this.sketchContext}return f}_saveContext(l){this._getContext(l).save()}_restoreContext(l){this._getContext(l).restore()}_setClip(l,f){var c=this._getContext(f);c.beginPath(),c.rect(l.x,l.y,l.width,l.height),c.clip()}_drawRectangle(l,f,c){var p=this._getContext(c);p.save(),p.fillStyle=f,p.fillRect(l.x,l.y,l.width,l.height),p.restore()}blendSketch(l,f,c,p){var _=l;e.isPlainObject(_)||(_={opacity:l,scale:f,translate:c,compositeOperation:p}),l=_.opacity,p=_.compositeOperation;var d=_.bounds;if(this.context.save(),this.context.globalAlpha=l,p&&(this.context.globalCompositeOperation=p),d)d.x<0&&(d.width+=d.x,d.x=0),d.x+d.width>this.canvas.width&&(d.width=this.canvas.width-d.x),d.y<0&&(d.height+=d.y,d.y=0),d.y+d.height>this.canvas.height&&(d.height=this.canvas.height-d.y),this.context.drawImage(this.sketchCanvas,d.x,d.y,d.width,d.height,d.x,d.y,d.width,d.height);else{f=_.scale||1,c=_.translate;var v=c instanceof e.Point?c:new e.Point(0,0),w=0,S=0;if(c){var R=this.sketchCanvas.width-this.canvas.width,P=this.sketchCanvas.height-this.canvas.height;w=Math.round(R/2),S=Math.round(P/2)}this.context.drawImage(this.sketchCanvas,v.x-w*f,v.y-S*f,(this.canvas.width+2*w)*f,(this.canvas.height+2*S)*f,-w,-S,this.canvas.width+2*w,this.canvas.height+2*S)}this.context.restore()}_drawDebugInfoOnTile(l,f,c,p){var _=this.viewer.world.getIndexOfItem(p)%this.debugGridColor.length,d=this.context;d.save(),d.lineWidth=2*e.pixelDensityRatio,d.font="small-caps bold "+13*e.pixelDensityRatio+"px arial",d.strokeStyle=this.debugGridColor[_],d.fillStyle=this.debugGridColor[_],this._setRotations(p),this._viewportFlipped&&this._flip({point:l.position.plus(l.size.divide(2))}),d.strokeRect(l.position.x*e.pixelDensityRatio,l.position.y*e.pixelDensityRatio,l.size.x*e.pixelDensityRatio,l.size.y*e.pixelDensityRatio);var v=(l.position.x+l.size.x/2)*e.pixelDensityRatio,w=(l.position.y+l.size.y/2)*e.pixelDensityRatio;d.translate(v,w);const S=this.viewport.getRotation(!0);d.rotate(Math.PI/180*-S),d.translate(-v,-w),l.x===0&&l.y===0&&(d.fillText("Zoom: "+this.viewport.getZoom(),l.position.x*e.pixelDensityRatio,(l.position.y-30)*e.pixelDensityRatio),d.fillText("Pan: "+this.viewport.getBounds().toString(),l.position.x*e.pixelDensityRatio,(l.position.y-20)*e.pixelDensityRatio)),d.fillText("Level: "+l.level,(l.position.x+10)*e.pixelDensityRatio,(l.position.y+20)*e.pixelDensityRatio),d.fillText("Column: "+l.x,(l.position.x+10)*e.pixelDensityRatio,(l.position.y+30)*e.pixelDensityRatio),d.fillText("Row: "+l.y,(l.position.x+10)*e.pixelDensityRatio,(l.position.y+40)*e.pixelDensityRatio),d.fillText("Order: "+c+" of "+f,(l.position.x+10)*e.pixelDensityRatio,(l.position.y+50)*e.pixelDensityRatio),d.fillText("Size: "+l.size.toString(),(l.position.x+10)*e.pixelDensityRatio,(l.position.y+60)*e.pixelDensityRatio),d.fillText("Position: "+l.position.toString(),(l.position.x+10)*e.pixelDensityRatio,(l.position.y+70)*e.pixelDensityRatio),this.viewport.getRotation(!0)%360!==0&&this._restoreRotationChanges(),p.getRotation(!0)%360!==0&&this._restoreRotationChanges(),d.restore()}_updateImageSmoothingEnabled(l){l.msImageSmoothingEnabled=this._imageSmoothingEnabled,l.imageSmoothingEnabled=this._imageSmoothingEnabled}_getCanvasSize(l){var f=this._getContext(l).canvas;return new e.Point(f.width,f.height)}_getCanvasCenter(){return new e.Point(this.canvas.width/2,this.canvas.height/2)}_setRotations(l,f=!1){var c=!1;this.viewport.getRotation(!0)%360!==0&&(this._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:f,saveContext:c}),c=!1),l.getRotation(!0)%360!==0&&this._offsetForRotation({degrees:l.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(l._getRotationPoint(!0),!0),useSketch:f,saveContext:c})}_offsetForRotation(l){var f=l.point?l.point.times(e.pixelDensityRatio):this._getCanvasCenter(),c=this._getContext(l.useSketch);c.save(),c.translate(f.x,f.y),c.rotate(Math.PI/180*l.degrees),c.translate(-f.x,-f.y)}_flip(l){l=l||{};var f=l.point?l.point.times(e.pixelDensityRatio):this._getCanvasCenter(),c=this._getContext(l.useSketch);c.translate(f.x,0),c.scale(-1,1),c.translate(-f.x,0)}_restoreRotationChanges(l){var f=this._getContext(l);f.restore()}_calculateCanvasSize(){var l=e.pixelDensityRatio,f=this.viewport.getContainerSize();return{x:Math.round(f.x*l),y:Math.round(f.y*l)}}_calculateSketchCanvasSize(){var l=this._calculateCanvasSize();if(this.viewport.getRotation()===0)return l;var f=Math.ceil(Math.sqrt(l.x*l.x+l.y*l.y));return{x:f,y:f}}}e.CanvasDrawer=i;var n=e.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER;function s(o){return o!==e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS&&o!==e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST&&o!==e.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER}function h(o){return s(o)?n:o}function u(o){if(typeof o=="number")return h(o);if(!o||!e.Browser)return n;var l=o[e.Browser.vendor];return s(l)&&(l=o["*"]),h(l)}})(r),(function(e){const t=e;t.WebGLDrawer=class extends t.DrawerBase{constructor(n){super(n),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=s=>this._tileReadyHandler(s),this._boundToImageUnloaded=s=>this._imageUnloadedHandler(s),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 n=this._gl;var s=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS);for(let u=0;u<s;++u)n.activeTexture(n.TEXTURE0+u),n.bindTexture(n.TEXTURE_2D,null),n.bindTexture(n.TEXTURE_CUBE_MAP,null);n.bindBuffer(n.ARRAY_BUFFER,null),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,null),n.bindRenderbuffer(n.RENDERBUFFER,null),n.bindFramebuffer(n.FRAMEBUFFER,null),this._unloadTextures(),n.deleteBuffer(this._secondPass.bufferOutputPosition),n.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 h=n.getExtension("WEBGL_lose_context");h&&h.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 n=document.createElement("canvas"),s=e.isFunction(n.getContext)&&n.getContext("webgl"),h=s&&s.getExtension("WEBGL_lose_context");return h&&h.loseContext(),!!s}getType(){return"webgl"}minimumOverlapRequired(n){return n.isTainted()}_createDrawingElement(){let n=e.makeNeutralElement("canvas"),s=this._calculateCanvasSize();return n.width=s.x,n.height=s.y,n}_getBackupCanvasDrawer(){return this._backupCanvasDrawer||(this._backupCanvasDrawer=this.viewer.requestDrawer("canvas",{mainDrawer:!1}),this._backupCanvasDrawer.canvas.style.setProperty("visibility","hidden")),this._backupCanvasDrawer}draw(n){let s=this._gl;const h=this.viewport.getBoundsNoRotateWithMargins(!0);let u={bounds:h,center:new t.Point(h.x+h.width/2,h.y+h.height/2),rotation:this.viewport.getRotation(!0)*Math.PI/180},o=this.viewport.flipped?-1:1,l=e.Mat3.makeTranslation(-u.center.x,-u.center.y),f=e.Mat3.makeScaling(2/u.bounds.width*o,-2/u.bounds.height),c=e.Mat3.makeRotation(-u.rotation),p=f.multiply(c).multiply(l);s.bindFramebuffer(s.FRAMEBUFFER,null),s.clear(s.COLOR_BUFFER_BIT),this._outputContext.clearRect(0,0,this._outputCanvas.width,this._outputCanvas.height);let _=!1;n.forEach((d,v)=>{if(d.isTainted()){_&&(this._outputContext.drawImage(this._renderingCanvas,0,0),s.bindFramebuffer(s.FRAMEBUFFER,null),s.clear(s.COLOR_BUFFER_BIT),_=!1);const w=this._getBackupCanvasDrawer();w.draw([d]),this._outputContext.drawImage(w.canvas,0,0)}else{let w=d.getTilesToDraw();if(d.placeholderFillStyle&&d._hasOpaqueTile===!1&&this._drawPlaceholder(d),w.length===0||d.getOpacity()===0)return;let S=w[0],R=d.compositeOperation||this.viewer.compositeOperation||d._clip||d._croppingPolygons||d.debugMode,P=R||d.opacity<1||S.hasTransparency;R&&(_&&this._outputContext.drawImage(this._renderingCanvas,0,0),s.bindFramebuffer(s.FRAMEBUFFER,null),s.clear(s.COLOR_BUFFER_BIT)),s.useProgram(this._firstPass.shaderProgram),P?(s.bindFramebuffer(s.FRAMEBUFFER,this._glFrameBuffer),s.clear(s.COLOR_BUFFER_BIT)):s.bindFramebuffer(s.FRAMEBUFFER,null);let A=p,F=d.getRotation(!0);if(F%360!==0){let k=e.Mat3.makeRotation(-F*Math.PI/180),q=d.getBoundsNoRotate(!0).getCenter(),O=e.Mat3.makeTranslation(q.x,q.y),U=e.Mat3.makeTranslation(-q.x,-q.y),te=O.multiply(k).multiply(U);A=p.multiply(te)}let N=this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS);if(N<=0)throw new Error(`WegGL error: bad value for gl parameter MAX_TEXTURE_IMAGE_UNITS (${N}). This could happen
9
- if too many contexts have been created and not released, or there is another problem with the graphics card.`);let z=new Float32Array(N*12),I=new Array(N),D=new Array(N),H=new Array(N);for(let k=0;k<w.length;k++){let q=w[k].tile,O=k%N,U=O+1,te=q.getCanvasContext(),$=te?this._TextureMap.get(te.canvas):null;if($||(this._tileReadyHandler({tile:q,tiledImage:d}),$=te?this._TextureMap.get(te.canvas):null),$&&this._getTileData(q,d,$,A,O,z,I,D,H),U===N||k===w.length-1){for(let ne=0;ne<=U;ne++)s.activeTexture(s.TEXTURE0+ne),s.bindTexture(s.TEXTURE_2D,I[ne]);s.bindBuffer(s.ARRAY_BUFFER,this._firstPass.bufferTexturePosition),s.bufferData(s.ARRAY_BUFFER,z,s.DYNAMIC_DRAW),D.forEach((ne,B)=>{s.uniformMatrix3fv(this._firstPass.uTransformMatrices[B],!1,ne)}),s.uniform1fv(this._firstPass.uOpacities,new Float32Array(H)),s.bindBuffer(s.ARRAY_BUFFER,this._firstPass.bufferOutputPosition),s.vertexAttribPointer(this._firstPass.aOutputPosition,2,s.FLOAT,!1,0,0),s.bindBuffer(s.ARRAY_BUFFER,this._firstPass.bufferTexturePosition),s.vertexAttribPointer(this._firstPass.aTexturePosition,2,s.FLOAT,!1,0,0),s.bindBuffer(s.ARRAY_BUFFER,this._firstPass.bufferIndex),s.vertexAttribPointer(this._firstPass.aIndex,1,s.FLOAT,!1,0,0),s.drawArrays(s.TRIANGLES,0,6*U)}}P&&(s.useProgram(this._secondPass.shaderProgram),s.bindFramebuffer(s.FRAMEBUFFER,null),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this._renderToTexture),this._gl.uniform1f(this._secondPass.uOpacityMultiplier,d.opacity),s.bindBuffer(s.ARRAY_BUFFER,this._secondPass.bufferTexturePosition),s.vertexAttribPointer(this._secondPass.aTexturePosition,2,s.FLOAT,!1,0,0),s.bindBuffer(s.ARRAY_BUFFER,this._secondPass.bufferOutputPosition),s.vertexAttribPointer(this._secondPass.aOutputPosition,2,s.FLOAT,!1,0,0),s.drawArrays(s.TRIANGLES,0,6)),_=!0,R&&(this._applyContext2dPipeline(d,w,v),_=!1,s.bindFramebuffer(s.FRAMEBUFFER,null),s.clear(s.COLOR_BUFFER_BIT)),v===0&&this._raiseTiledImageDrawnEvent(d,w.map(k=>k.tile))}}),_&&this._outputContext.drawImage(this._renderingCanvas,0,0)}setImageSmoothingEnabled(n){this._imageSmoothingEnabled!==n&&(this._imageSmoothingEnabled=n,this._unloadTextures(),this.viewer.world.draw())}drawDebuggingRect(n){let s=this._outputContext;s.save(),s.lineWidth=2*e.pixelDensityRatio,s.strokeStyle=this.debugGridColor[0],s.fillStyle=this.debugGridColor[0],s.strokeRect(n.x*e.pixelDensityRatio,n.y*e.pixelDensityRatio,n.width*e.pixelDensityRatio,n.height*e.pixelDensityRatio),s.restore()}_getTextureDataFromTile(n){return n.getCanvasContext().canvas}_applyContext2dPipeline(n,s,h){if(this._outputContext.save(),this._outputContext.globalCompositeOperation=h===0?null:n.compositeOperation||this.viewer.compositeOperation,n._croppingPolygons||n._clip?(this._renderToClippingCanvas(n),this._outputContext.drawImage(this._clippingCanvas,0,0)):this._outputContext.drawImage(this._renderingCanvas,0,0),this._outputContext.restore(),n.debugMode){const u=this.viewer.viewport.getFlip();u&&this._flip(),this._drawDebugInfo(s,n,u),u&&this._flip()}}_getTileData(n,s,h,u,o,l,f,c,p){let _=h.texture,d=h.position;l.set(d,o*12);let v=this._calculateOverlapFraction(n,s),w=n.positionedBounds.width*v.x,S=n.positionedBounds.height*v.y,R=n.positionedBounds.x+(n.x===0?0:w),P=n.positionedBounds.y+(n.y===0?0:S),A=n.positionedBounds.x+n.positionedBounds.width-(n.isRightMost?0:w),F=n.positionedBounds.y+n.positionedBounds.height-(n.isBottomMost?0:S),N=A-R,z=F-P,I=new e.Mat3([N,0,0,0,z,0,R,P,1]);if(n.flipped){let H=e.Mat3.makeTranslation(.5,0),k=e.Mat3.makeTranslation(-.5,0),q=H.multiply(e.Mat3.makeScaling(-1,1)).multiply(k);I=I.multiply(q)}let D=u.multiply(I);p[o]=n.opacity,f[o]=_,c[o]=D.values}_textureFilter(){return this._imageSmoothingEnabled?this._gl.LINEAR:this._gl.NEAREST}_setupRenderer(){let n=this._gl;n||e.console.error("_setupCanvases must be called before _setupRenderer"),this._unitQuad=this._makeQuadVertexBuffer(0,1,0,1),this._makeFirstPassShaderProgram(),this._makeSecondPassShaderProgram(),this._renderToTexture=n.createTexture(),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,this._renderToTexture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,this._renderingCanvas.width,this._renderingCanvas.height,0,n.RGBA,n.UNSIGNED_BYTE,null),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this._textureFilter()),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),this._glFrameBuffer=n.createFramebuffer(),n.bindFramebuffer(n.FRAMEBUFFER,this._glFrameBuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,this._renderToTexture,0),n.enable(n.BLEND),n.blendFunc(n.ONE,n.ONE_MINUS_SRC_ALPHA)}_makeFirstPassShaderProgram(){let n=this._glNumTextures=this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),s=()=>[...Array(n).keys()].map(_=>`uniform mat3 u_matrix_${_};`).join(`
10
- `),h=()=>[...Array(n).keys()].map(_=>`${_>0?"else ":""}if(int(a_index) == ${_}) { transform_matrix = u_matrix_${_}; }`).join(`
11
- `);const u=`
12
- attribute vec2 a_output_position;
13
- attribute vec2 a_texture_position;
14
- attribute float a_index;
15
-
16
- ${s()} // create a uniform mat3 for each potential tile to draw
17
-
18
- varying vec2 v_texture_position;
19
- varying float v_image_index;
20
-
21
- void main() {
22
-
23
- mat3 transform_matrix; // value will be set by the if/elses in makeConditional()
24
-
25
- ${h()}
26
-
27
- gl_Position = vec4(transform_matrix * vec3(a_output_position, 1), 1);
28
-
29
- v_texture_position = a_texture_position;
30
- v_image_index = a_index;
31
- }
32
- `,o=`
33
- precision mediump float;
34
-
35
- // our textures
36
- uniform sampler2D u_images[${n}];
37
- // our opacities
38
- uniform float u_opacities[${n}];
39
-
40
- // the varyings passed in from the vertex shader.
41
- varying vec2 v_texture_position;
42
- varying float v_image_index;
43
-
44
- void main() {
45
- // can't index directly with a variable, need to use a loop iterator hack
46
- for(int i = 0; i < ${n}; ++i){
47
- if(i == int(v_image_index)){
48
- gl_FragColor = texture2D(u_images[i], v_texture_position) * u_opacities[i];
49
- }
50
- }
51
- }
52
- `;let l=this._gl,f=this.constructor.initShaderProgram(l,u,o);l.useProgram(f),this._firstPass={shaderProgram:f,aOutputPosition:l.getAttribLocation(f,"a_output_position"),aTexturePosition:l.getAttribLocation(f,"a_texture_position"),aIndex:l.getAttribLocation(f,"a_index"),uTransformMatrices:[...Array(this._glNumTextures).keys()].map(_=>l.getUniformLocation(f,`u_matrix_${_}`)),uImages:l.getUniformLocation(f,"u_images"),uOpacities:l.getUniformLocation(f,"u_opacities"),bufferOutputPosition:l.createBuffer(),bufferTexturePosition:l.createBuffer(),bufferIndex:l.createBuffer()},l.uniform1iv(this._firstPass.uImages,[...Array(n).keys()]);let c=new Float32Array(n*12);for(let _=0;_<n;++_)c.set(Float32Array.from(this._unitQuad),_*12);l.bindBuffer(l.ARRAY_BUFFER,this._firstPass.bufferOutputPosition),l.bufferData(l.ARRAY_BUFFER,c,l.STATIC_DRAW),l.enableVertexAttribArray(this._firstPass.aOutputPosition),l.bindBuffer(l.ARRAY_BUFFER,this._firstPass.bufferTexturePosition),l.enableVertexAttribArray(this._firstPass.aTexturePosition),l.bindBuffer(l.ARRAY_BUFFER,this._firstPass.bufferIndex);let p=[...Array(this._glNumTextures).keys()].map(_=>Array(6).fill(_)).flat();l.bufferData(l.ARRAY_BUFFER,new Float32Array(p),l.STATIC_DRAW),l.enableVertexAttribArray(this._firstPass.aIndex)}_makeSecondPassShaderProgram(){const n=`
53
- attribute vec2 a_output_position;
54
- attribute vec2 a_texture_position;
55
-
56
- uniform mat3 u_matrix;
57
-
58
- varying vec2 v_texture_position;
59
-
60
- void main() {
61
- gl_Position = vec4(u_matrix * vec3(a_output_position, 1), 1);
62
-
63
- v_texture_position = a_texture_position;
64
- }
65
- `,s=`
66
- precision mediump float;
67
-
68
- // our texture
69
- uniform sampler2D u_image;
70
-
71
- // the texCoords passed in from the vertex shader.
72
- varying vec2 v_texture_position;
73
-
74
- // the opacity multiplier for the image
75
- uniform float u_opacity_multiplier;
76
-
77
- void main() {
78
- gl_FragColor = texture2D(u_image, v_texture_position);
79
- gl_FragColor *= u_opacity_multiplier;
80
- }
81
- `;let h=this._gl,u=this.constructor.initShaderProgram(h,n,s);h.useProgram(u),this._secondPass={shaderProgram:u,aOutputPosition:h.getAttribLocation(u,"a_output_position"),aTexturePosition:h.getAttribLocation(u,"a_texture_position"),uMatrix:h.getUniformLocation(u,"u_matrix"),uImage:h.getUniformLocation(u,"u_image"),uOpacityMultiplier:h.getUniformLocation(u,"u_opacity_multiplier"),bufferOutputPosition:h.createBuffer(),bufferTexturePosition:h.createBuffer()},h.bindBuffer(h.ARRAY_BUFFER,this._secondPass.bufferOutputPosition),h.bufferData(h.ARRAY_BUFFER,this._unitQuad,h.STATIC_DRAW),h.enableVertexAttribArray(this._secondPass.aOutputPosition),h.bindBuffer(h.ARRAY_BUFFER,this._secondPass.bufferTexturePosition),h.bufferData(h.ARRAY_BUFFER,this._unitQuad,h.DYNAMIC_DRAW),h.enableVertexAttribArray(this._secondPass.aTexturePosition);let o=e.Mat3.makeScaling(2,2).multiply(e.Mat3.makeTranslation(-.5,-.5));h.uniformMatrix3fv(this._secondPass.uMatrix,!1,o.values)}_resizeRenderer(){let n=this._gl,s=this._renderingCanvas.width,h=this._renderingCanvas.height;n.viewport(0,0,s,h),n.deleteTexture(this._renderToTexture),this._renderToTexture=n.createTexture(),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,this._renderToTexture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,s,h,0,n.RGBA,n.UNSIGNED_BYTE,null),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this._textureFilter()),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.bindFramebuffer(n.FRAMEBUFFER,this._glFrameBuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,this._renderToTexture,0)}_setupCanvases(){let n=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(){n._outputCanvas!==n.viewer.drawer.canvas&&(n._outputCanvas.style.width=n.viewer.drawer.canvas.clientWidth+"px",n._outputCanvas.style.height=n.viewer.drawer.canvas.clientHeight+"px");let s=n._calculateCanvasSize();(n._outputCanvas.width!==s.x||n._outputCanvas.height!==s.y)&&(n._outputCanvas.width=s.x,n._outputCanvas.height=s.y),n._renderingCanvas.style.width=n._outputCanvas.clientWidth+"px",n._renderingCanvas.style.height=n._outputCanvas.clientHeight+"px",n._renderingCanvas.width=n._clippingCanvas.width=n._outputCanvas.width,n._renderingCanvas.height=n._clippingCanvas.height=n._outputCanvas.height,n._resizeRenderer()},this.viewer.addHandler("resize",this._resizeHandler)}_makeQuadVertexBuffer(n,s,h,u){return new Float32Array([n,u,s,u,n,h,n,h,s,u,s,h])}_tileReadyHandler(n){let s=n.tile,h=n.tiledImage;if(h.isTainted())return;let u=s.getCanvasContext(),o=u&&u.canvas;if(!o||e.isCanvasTainted(o)){h.isTainted()||(h.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(h,"Tainted data cannot be used by the WebGLDrawer. Falling back to CanvasDrawer for this TiledImage."));return}if(!this._TextureMap.get(o)){let f=this._gl,c=f.createTexture(),p,_=h.source.tileOverlap,d,v;if(s.sourceBounds?(d=Math.min(s.sourceBounds.width,o.width)/o.width,v=Math.min(s.sourceBounds.height,o.height)/o.height):(d=1,v=1),_>0){let S=this._calculateOverlapFraction(s,h),R=(s.x===0?0:S.x)*d,P=(s.y===0?0:S.y)*v,A=(s.isRightMost?1:1-S.x)*d,F=(s.isBottomMost?1:1-S.y)*v;p=this._makeQuadVertexBuffer(R,A,P,F)}else d===1&&v===1?p=this._unitQuad:p=this._makeQuadVertexBuffer(0,d,0,v);let w={texture:c,position:p};this._TextureMap.set(o,w),f.activeTexture(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,c),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,this._textureFilter()),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,this._textureFilter()),this._uploadImageData(u)}}_calculateOverlapFraction(n,s){let h=s.source.tileOverlap,u=n.sourceBounds.width,o=n.sourceBounds.height,l=(n.x===0?0:h)+(n.isRightMost?0:h),f=(n.y===0?0:h)+(n.isBottomMost?0:h),c=h/(u+l),p=h/(o+f);return{x:c,y:p}}_unloadTextures(){Array.from(this._TextureMap.keys()).forEach(s=>{this._cleanupImageData(s)})}_uploadImageData(n){let s=this._gl,h=n.canvas;try{if(!h)throw n;s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,h)}catch(u){e.console.error("Error uploading image data to WebGL",u)}}_imageUnloadedHandler(n){let s=n.context2D.canvas;this._cleanupImageData(s)}_cleanupImageData(n){let s=this._TextureMap.get(n);this._TextureMap.delete(n),s&&this._gl.deleteTexture(s.texture)}_setClip(){}_renderToClippingCanvas(n){if(this._clippingContext.clearRect(0,0,this._clippingCanvas.width,this._clippingCanvas.height),this._clippingContext.save(),this.viewer.viewport.getFlip()){const s=new e.Point(this.canvas.width/2,this.canvas.height/2);this._clippingContext.translate(s.x,0),this._clippingContext.scale(-1,1),this._clippingContext.translate(-s.x,0)}if(n._clip){let h=[{x:n._clip.x,y:n._clip.y},{x:n._clip.x+n._clip.width,y:n._clip.y},{x:n._clip.x+n._clip.width,y:n._clip.y+n._clip.height},{x:n._clip.x,y:n._clip.y+n._clip.height}].map(u=>{let o=n.imageToViewportCoordinates(u.x,u.y,!0).rotate(this.viewer.viewport.getRotation(!0),this.viewer.viewport.getCenter(!0));return this.viewportCoordToDrawerCoord(o)});this._clippingContext.beginPath(),h.forEach((u,o)=>{this._clippingContext[o===0?"moveTo":"lineTo"](u.x,u.y)}),this._clippingContext.clip(),this._setClip()}if(n._croppingPolygons){let s=n._croppingPolygons.map(h=>h.map(u=>{let o=n.imageToViewportCoordinates(u.x,u.y,!0).rotate(this.viewer.viewport.getRotation(!0),this.viewer.viewport.getCenter(!0));return this.viewportCoordToDrawerCoord(o)}));this._clippingContext.beginPath(),s.forEach(h=>{h.forEach((u,o)=>{this._clippingContext[o===0?"moveTo":"lineTo"](u.x,u.y)})}),this._clippingContext.clip()}if(this.viewer.viewport.getFlip()){const s=new e.Point(this.canvas.width/2,this.canvas.height/2);this._clippingContext.translate(s.x,0),this._clippingContext.scale(-1,1),this._clippingContext.translate(-s.x,0)}this._clippingContext.drawImage(this._renderingCanvas,0,0),this._clippingContext.restore()}_setRotations(n){var s=!1;this.viewport.getRotation(!0)%360!==0&&(this._offsetForRotation({degrees:this.viewport.getRotation(!0),saveContext:s}),s=!1),n.getRotation(!0)%360!==0&&this._offsetForRotation({degrees:n.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(n._getRotationPoint(!0),!0),saveContext:s})}_offsetForRotation(n){var s=n.point?n.point.times(e.pixelDensityRatio):this._getCanvasCenter(),h=this._outputContext;h.save(),h.translate(s.x,s.y),h.rotate(Math.PI/180*n.degrees),h.translate(-s.x,-s.y)}_flip(n){n=n||{};var s=n.point?n.point.times(e.pixelDensityRatio):this._getCanvasCenter(),h=this._outputContext;h.translate(s.x,0),h.scale(-1,1),h.translate(-s.x,0)}_drawDebugInfo(n,s,h){for(var u=n.length-1;u>=0;u--){var o=n[u].tile;try{this._drawDebugInfoOnTile(o,n.length,u,s,h)}catch(l){e.console.error(l)}}}_drawDebugInfoOnTile(n,s,h,u,o){var l=this.viewer.world.getIndexOfItem(u)%this.debugGridColor.length,f=this.context;f.save(),f.lineWidth=2*e.pixelDensityRatio,f.font="small-caps bold "+13*e.pixelDensityRatio+"px arial",f.strokeStyle=this.debugGridColor[l],f.fillStyle=this.debugGridColor[l],this._setRotations(u),o&&this._flip({point:n.position.plus(n.size.divide(2))}),f.strokeRect(n.position.x*e.pixelDensityRatio,n.position.y*e.pixelDensityRatio,n.size.x*e.pixelDensityRatio,n.size.y*e.pixelDensityRatio);var c=(n.position.x+n.size.x/2)*e.pixelDensityRatio,p=(n.position.y+n.size.y/2)*e.pixelDensityRatio;f.translate(c,p);const _=this.viewport.getRotation(!0);f.rotate(Math.PI/180*-_),f.translate(-c,-p),n.x===0&&n.y===0&&(f.fillText("Zoom: "+this.viewport.getZoom(),n.position.x*e.pixelDensityRatio,(n.position.y-30)*e.pixelDensityRatio),f.fillText("Pan: "+this.viewport.getBounds().toString(),n.position.x*e.pixelDensityRatio,(n.position.y-20)*e.pixelDensityRatio)),f.fillText("Level: "+n.level,(n.position.x+10)*e.pixelDensityRatio,(n.position.y+20)*e.pixelDensityRatio),f.fillText("Column: "+n.x,(n.position.x+10)*e.pixelDensityRatio,(n.position.y+30)*e.pixelDensityRatio),f.fillText("Row: "+n.y,(n.position.x+10)*e.pixelDensityRatio,(n.position.y+40)*e.pixelDensityRatio),f.fillText("Order: "+h+" of "+s,(n.position.x+10)*e.pixelDensityRatio,(n.position.y+50)*e.pixelDensityRatio),f.fillText("Size: "+n.size.toString(),(n.position.x+10)*e.pixelDensityRatio,(n.position.y+60)*e.pixelDensityRatio),f.fillText("Position: "+n.position.toString(),(n.position.x+10)*e.pixelDensityRatio,(n.position.y+70)*e.pixelDensityRatio),this.viewport.getRotation(!0)%360!==0&&this._restoreRotationChanges(),u.getRotation(!0)%360!==0&&this._restoreRotationChanges(),f.restore()}_drawPlaceholder(n){const s=n.getBounds(!0),h=this.viewportToDrawerRectangle(n.getBounds(!0)),u=this._outputContext;let o;typeof n.placeholderFillStyle=="function"?o=n.placeholderFillStyle(n,u):o=n.placeholderFillStyle,this._offsetForRotation({degrees:this.viewer.viewport.getRotation(!0)}),u.fillStyle=o,u.translate(h.x,h.y),u.rotate(Math.PI/180*s.degrees),u.translate(-h.x,-h.y),u.fillRect(h.x,h.y,h.width,h.height),this._restoreRotationChanges()}_getCanvasCenter(){return new e.Point(this.canvas.width/2,this.canvas.height/2)}_restoreRotationChanges(){var n=this._outputContext;n.restore()}static initShaderProgram(n,s,h){function u(c,p,_){const d=c.createShader(p);return c.shaderSource(d,_),c.compileShader(d),c.getShaderParameter(d,c.COMPILE_STATUS)?d:(e.console.error(`An error occurred compiling the shaders: ${c.getShaderInfoLog(d)}`),c.deleteShader(d),null)}const o=u(n,n.VERTEX_SHADER,s),l=u(n,n.FRAGMENT_SHADER,h),f=n.createProgram();return n.attachShader(f,o),n.attachShader(f,l),n.linkProgram(f),n.getProgramParameter(f,n.LINK_STATUS)?f:(e.console.error(`Unable to initialize the shader program: ${n.getProgramInfoLog(f)}`),null)}}})(r),(function(e){e.Viewport=function(t){var i=arguments;i.length&&i[0]instanceof e.Point&&(t={containerSize:i[0],contentSize:i[1],config:i[2]}),t.config&&(e.extend(!0,t,t.config),delete t.config),this._margins=e.extend({left:0,top:0,right:0,bottom:0},t.margins||{}),delete t.margins,t.initialDegrees=t.degrees,delete t.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},t),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:t.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(t){e.console.warn("Setting [Viewport.degrees] is deprecated. Use viewport.rotateTo, viewport.rotateBy, or viewport.setRotation instead."),this.rotateTo(t)},resetContentSize:function(t){return e.console.assert(t,"[Viewport.resetContentSize] contentSize is required"),e.console.assert(t instanceof e.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point"),e.console.assert(t.x>0,"[Viewport.resetContentSize] contentSize.x must be greater than 0"),e.console.assert(t.y>0,"[Viewport.resetContentSize] contentSize.y must be greater than 0"),this._setContentBounds(new e.Rect(0,0,1,t.y/t.x),t.x),this},setHomeBounds:function(t,i){e.console.error("[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually."),this._setContentBounds(t,i)},_setContentBounds:function(t,i){e.console.assert(t,"[Viewport._setContentBounds] bounds is required"),e.console.assert(t instanceof e.Rect,"[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect"),e.console.assert(t.width>0,"[Viewport._setContentBounds] bounds.width must be greater than 0"),e.console.assert(t.height>0,"[Viewport._setContentBounds] bounds.height must be greater than 0"),this._contentBoundsNoRotate=t.clone(),this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(i),this._contentBounds=t.rotate(this.getRotation()).getBoundingBox(),this._contentSize=this._contentBounds.getSize().times(i),this._contentAspectRatio=this._contentSize.x/this._contentSize.y,this.viewer&&this.viewer.raiseEvent("reset-size",{contentSize:this._contentSizeNoRotate.clone(),contentFactor:i,homeBounds:this._contentBoundsNoRotate.clone(),contentBounds:this._contentBounds.clone()})},getHomeZoom:function(){if(this.defaultZoomLevel)return this.defaultZoomLevel;var t=this._contentAspectRatio/this.getAspectRatio(),i;return this.homeFillsViewer?i=t>=1?t:1:i=t>=1?1:t,i/this._contentBounds.width},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation())},getHomeBoundsNoRotate:function(){var t=this._contentBounds.getCenter(),i=1/this.getHomeZoom(),n=i/this.getAspectRatio();return new e.Rect(t.x-i/2,t.y-n/2,i,n)},goHome:function(t){return this.viewer&&this.viewer.raiseEvent("home",{immediately:t}),this.fitBounds(this.getHomeBounds(),t)},getMinZoom:function(){var t=this.getHomeZoom(),i=this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*t;return i},getMaxZoom:function(){var t=this.maxZoomLevel;return t||(t=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x,t/=this._contentBounds.width),Math.max(t,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(t){e.console.assert(e.type(t)==="object","[Viewport.setMargins] margins must be an object"),this._margins=e.extend({left:0,top:0,right:0,bottom:0},t),this._updateContainerInnerSize(),this.viewer&&this.viewer.forceRedraw()},getBounds:function(t){return this.getBoundsNoRotate(t).rotate(-this.getRotation(t))},getBoundsNoRotate:function(t){var i=this.getCenter(t),n=1/this.getZoom(t),s=n/this.getAspectRatio();return new e.Rect(i.x-n/2,i.y-s/2,n,s)},getBoundsWithMargins:function(t){return this.getBoundsNoRotateWithMargins(t).rotate(-this.getRotation(t),this.getCenter(t))},getBoundsNoRotateWithMargins:function(t){var i=this.getBoundsNoRotate(t),n=this._containerInnerSize.x*this.getZoom(t);return i.x-=this._margins.left/n,i.y-=this._margins.top/n,i.width+=(this._margins.left+this._margins.right)/n,i.height+=(this._margins.top+this._margins.bottom)/n,i},getCenter:function(t){var i=new e.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),n=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value),s,h,u,o,l,f,c,p;return t?i:this.zoomPoint?(s=this.pixelFromPoint(this.zoomPoint,!0),h=this.getZoom(),u=1/h,o=u/this.getAspectRatio(),l=new e.Rect(i.x-u/2,i.y-o/2,u,o),f=this._pixelFromPoint(this.zoomPoint,l),c=f.minus(s).rotate(-this.getRotation(!0)),p=c.divide(this._containerInnerSize.x*h),n.plus(p)):n},getZoom:function(t){return t?this.zoomSpring.current.value:this.zoomSpring.target.value},_applyZoomConstraints:function(t){return Math.max(Math.min(t,this.getMaxZoom()),this.getMinZoom())},_applyBoundaryConstraints:function(t){var i=this.viewportToViewerElementRectangle(t).getBoundingBox(),n=this.viewportToViewerElementRectangle(this._contentBoundsNoRotate).getBoundingBox(),s=!1,h=!1;if(!this.wrapHorizontal){var u=i.x+i.width,o=n.x+n.width,l,f,c;i.width>n.width?l=this.visibilityRatio*n.width:l=this.visibilityRatio*i.width,f=n.x-u+l,c=o-i.x-l,l>n.width?(i.x+=(f+c)/2,s=!0):c<0?(i.x+=c,s=!0):f>0&&(i.x+=f,s=!0)}if(!this.wrapVertical){var p=i.y+i.height,_=n.y+n.height,d,v,w;i.height>n.height?d=this.visibilityRatio*n.height:d=this.visibilityRatio*i.height,v=n.y-p+d,w=_-i.y-d,d>n.height?(i.y+=(v+w)/2,h=!0):w<0?(i.y+=w,h=!0):v>0&&(i.y+=v,h=!0)}var S=s||h,R=S?this.viewerElementToViewportRectangle(i):t.clone();return R.xConstrained=s,R.yConstrained=h,R.constraintApplied=S,R},_raiseConstraintsEvent:function(t){this.viewer&&this.viewer.raiseEvent("constrain",{immediately:t})},applyConstraints:function(t){var i=this.getZoom(),n=this._applyZoomConstraints(i);i!==n&&this.zoomTo(n,this.zoomPoint,t);var s=this.getConstrainedBounds(!1);return s.constraintApplied&&(this.fitBounds(s,t),this._raiseConstraintsEvent(t)),this},ensureVisible:function(t){return this.applyConstraints(t)},_fitBounds:function(t,i){i=i||{};var n=i.immediately||!1,s=i.constraints||!1,h=this.getAspectRatio(),u=t.getCenter(),o=new e.Rect(t.x,t.y,t.width,t.height,t.degrees+this.getRotation()).getBoundingBox();o.getAspectRatio()>=h?o.height=o.width/h:o.width=o.height*h,o.x=u.x-o.width/2,o.y=u.y-o.height/2;var l=1/o.width;if(n)return this.panTo(u,!0),this.zoomTo(l,null,!0),s&&this.applyConstraints(!0),this;var f=this.getCenter(!0),c=this.getZoom(!0);this.panTo(f,!0),this.zoomTo(c,null,!0);var p=this.getBounds(),_=this.getZoom();if(_===0||Math.abs(l/_-1)<1e-8)return this.zoomTo(l,null,!0),this.panTo(u,n),s&&this.applyConstraints(!1),this;if(s){this.panTo(u,!1),l=this._applyZoomConstraints(l),this.zoomTo(l,null,!1);var d=this.getConstrainedBounds();this.panTo(f,!0),this.zoomTo(c,null,!0),this.fitBounds(d)}else{var v=o.rotate(-this.getRotation()),w=v.getTopLeft().times(l).minus(p.getTopLeft().times(_)).divide(l-_);this.zoomTo(l,w,n)}return this},fitBounds:function(t,i){return this._fitBounds(t,{immediately:i,constraints:!1})},fitBoundsWithConstraints:function(t,i){return this._fitBounds(t,{immediately:i,constraints:!0})},fitVertically:function(t){var i=new e.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(i,t)},fitHorizontally:function(t){var i=new e.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(i,t)},getConstrainedBounds:function(t){var i,n;return i=this.getBounds(t),n=this._applyBoundaryConstraints(i),n},panBy:function(t,i){var n=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(n.plus(t),i)},panTo:function(t,i){return i?(this.centerSpringX.resetTo(t.x),this.centerSpringY.resetTo(t.y)):(this.centerSpringX.springTo(t.x),this.centerSpringY.springTo(t.y)),this.viewer&&this.viewer.raiseEvent("pan",{center:t,immediately:i}),this},zoomBy:function(t,i,n){return this.zoomTo(this.zoomSpring.target.value*t,i,n)},zoomTo:function(t,i,n){var s=this;return this.zoomPoint=i instanceof e.Point&&!isNaN(i.x)&&!isNaN(i.y)?i:null,n?this._adjustCenterSpringsForZoomPoint(function(){s.zoomSpring.resetTo(t)}):this.zoomSpring.springTo(t),this.viewer&&this.viewer.raiseEvent("zoom",{zoom:t,refPoint:i,immediately:n}),this},setRotation:function(t,i){return this.rotateTo(t,null,i)},getRotation:function(t){return t?this.degreesSpring.current.value:this.degreesSpring.target.value},setRotationWithPivot:function(t,i,n){return this.rotateTo(t,i,n)},rotateTo:function(t,i,n){if(!this.viewer||!this.viewer.drawer.canRotate())return this;if(this.degreesSpring.target.value===t&&this.degreesSpring.isAtTargetValue())return this;if(this.rotationPivot=i instanceof e.Point&&!isNaN(i.x)&&!isNaN(i.y)?i:null,n)if(this.rotationPivot){var s=t-this._oldDegrees;if(!s)return this.rotationPivot=null,this;this._rotateAboutPivot(t)}else this.degreesSpring.resetTo(t);else{var h=e.positiveModulo(this.degreesSpring.current.value,360),u=e.positiveModulo(t,360),o=u-h;o>180?u-=360:o<-180&&(u+=360);var l=h-u;this.degreesSpring.resetTo(t+l),this.degreesSpring.springTo(t)}return this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor()),this.viewer.forceRedraw(),this.viewer.raiseEvent("rotate",{degrees:t,immediately:!!n,pivot:this.rotationPivot||this.getCenter()}),this},rotateBy:function(t,i,n){return this.rotateTo(this.degreesSpring.target.value+t,i,n)},resize:function(t,i){var n=this.getBoundsNoRotate(),s=n,h;this.containerSize.x=t.x,this.containerSize.y=t.y,this._updateContainerInnerSize(),i&&(h=t.x/this.containerSize.x,s.width=n.width*h,s.height=s.width/this.getAspectRatio()),this.viewer&&this.viewer.raiseEvent("resize",{newContainerSize:t,maintain:i});var u=this.fitBounds(s,!0);return this.viewer&&this.viewer.raiseEvent("after-resize",{newContainerSize:t,maintain:i}),u},_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 t=this;this._adjustCenterSpringsForZoomPoint(function(){t.zoomSpring.update()}),this.degreesSpring.isAtTargetValue()&&(this.rotationPivot=null),this.centerSpringX.update(),this.centerSpringY.update(),this.rotationPivot?this._rotateAboutPivot(!0):this.degreesSpring.update();var i=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 n=i||!this.zoomSpring.isAtTargetValue()||!this.centerSpringX.isAtTargetValue()||!this.centerSpringY.isAtTargetValue()||!this.degreesSpring.isAtTargetValue();return n},_rotateAboutPivot:function(t){var i=t===!0,n=this.rotationPivot.minus(this.getCenter());this.centerSpringX.shiftBy(n.x),this.centerSpringY.shiftBy(n.y),i?this.degreesSpring.update():this.degreesSpring.resetTo(t);var s=this.degreesSpring.current.value-this._oldDegrees,h=n.rotate(s*-1).times(-1);this.centerSpringX.shiftBy(h.x),this.centerSpringY.shiftBy(h.y)},_adjustCenterSpringsForZoomPoint:function(t){if(this.zoomPoint){var i=this.pixelFromPoint(this.zoomPoint,!0);t();var n=this.pixelFromPoint(this.zoomPoint,!0),s=n.minus(i),h=this.deltaPointsFromPixels(s,!0);this.centerSpringX.shiftBy(h.x),this.centerSpringY.shiftBy(h.y),this.zoomSpring.isAtTargetValue()&&(this.zoomPoint=null)}else t()},deltaPixelsFromPointsNoRotate:function(t,i){return t.times(this._containerInnerSize.x*this.getZoom(i))},deltaPixelsFromPoints:function(t,i){return this.deltaPixelsFromPointsNoRotate(t.rotate(this.getRotation(i)),i)},deltaPointsFromPixelsNoRotate:function(t,i){return t.divide(this._containerInnerSize.x*this.getZoom(i))},deltaPointsFromPixels:function(t,i){return this.deltaPointsFromPixelsNoRotate(t,i).rotate(-this.getRotation(i))},pixelFromPointNoRotate:function(t,i){return this._pixelFromPointNoRotate(t,this.getBoundsNoRotate(i))},pixelFromPoint:function(t,i){return this._pixelFromPoint(t,this.getBoundsNoRotate(i))},_pixelFromPointNoRotate:function(t,i){return t.minus(i.getTopLeft()).times(this._containerInnerSize.x/i.width).plus(new e.Point(this._margins.left,this._margins.top))},_pixelFromPoint:function(t,i){return this._pixelFromPointNoRotate(t.rotate(this.getRotation(!0),this.getCenter(!0)),i)},pointFromPixelNoRotate:function(t,i){var n=this.getBoundsNoRotate(i);return t.minus(new e.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/n.width).plus(n.getTopLeft())},pointFromPixel:function(t,i){return this.pointFromPixelNoRotate(t,i).rotate(-this.getRotation(i),this.getCenter(i))},_viewportToImageDelta:function(t,i){var n=this._contentBoundsNoRotate.width;return new e.Point(t*this._contentSizeNoRotate.x/n,i*this._contentSizeNoRotate.x/n)},viewportToImageCoordinates:function(t,i){if(t instanceof e.Point)return this.viewportToImageCoordinates(t.x,t.y);if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.viewportToImageCoordinates] is not accurate with multi-image; use TiledImage.viewportToImageCoordinates instead.");else if(n===1){var s=this.viewer.world.getItemAt(0);return s.viewportToImageCoordinates(t,i,!0)}}return this._viewportToImageDelta(t-this._contentBoundsNoRotate.x,i-this._contentBoundsNoRotate.y)},_imageToViewportDelta:function(t,i){var n=this._contentBoundsNoRotate.width;return new e.Point(t/this._contentSizeNoRotate.x*n,i/this._contentSizeNoRotate.x*n)},imageToViewportCoordinates:function(t,i){if(t instanceof e.Point)return this.imageToViewportCoordinates(t.x,t.y);if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.imageToViewportCoordinates] is not accurate with multi-image; use TiledImage.imageToViewportCoordinates instead.");else if(n===1){var s=this.viewer.world.getItemAt(0);return s.imageToViewportCoordinates(t,i,!0)}}var h=this._imageToViewportDelta(t,i);return h.x+=this._contentBoundsNoRotate.x,h.y+=this._contentBoundsNoRotate.y,h},imageToViewportRectangle:function(t,i,n,s){var h=t;if(h instanceof e.Rect||(h=new e.Rect(t,i,n,s)),this.viewer){var u=this.viewer.world.getItemCount();if(u>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.imageToViewportRectangle] is not accurate with multi-image; use TiledImage.imageToViewportRectangle instead.");else if(u===1){var o=this.viewer.world.getItemAt(0);return o.imageToViewportRectangle(t,i,n,s,!0)}}var l=this.imageToViewportCoordinates(h.x,h.y),f=this._imageToViewportDelta(h.width,h.height);return new e.Rect(l.x,l.y,f.x,f.y,h.degrees)},viewportToImageRectangle:function(t,i,n,s){var h=t;if(h instanceof e.Rect||(h=new e.Rect(t,i,n,s)),this.viewer){var u=this.viewer.world.getItemCount();if(u>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.viewportToImageRectangle] is not accurate with multi-image; use TiledImage.viewportToImageRectangle instead.");else if(u===1){var o=this.viewer.world.getItemAt(0);return o.viewportToImageRectangle(t,i,n,s,!0)}}var l=this.viewportToImageCoordinates(h.x,h.y),f=this._viewportToImageDelta(h.width,h.height);return new e.Rect(l.x,l.y,f.x,f.y,h.degrees)},viewerElementToImageCoordinates:function(t){var i=this.pointFromPixel(t,!0);return this.viewportToImageCoordinates(i)},imageToViewerElementCoordinates:function(t){var i=this.imageToViewportCoordinates(t);return this.pixelFromPoint(i,!0)},windowToImageCoordinates:function(t){e.console.assert(this.viewer,"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");var i=t.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(i)},imageToWindowCoordinates:function(t){e.console.assert(this.viewer,"[Viewport.imageToWindowCoordinates] the viewport must have a viewer.");var i=this.imageToViewerElementCoordinates(t);return i.plus(e.getElementPosition(this.viewer.element))},viewerElementToViewportCoordinates:function(t){return this.pointFromPixel(t,!0)},viewportToViewerElementCoordinates:function(t){return this.pixelFromPoint(t,!0)},viewerElementToViewportRectangle:function(t){return e.Rect.fromSummits(this.pointFromPixel(t.getTopLeft(),!0),this.pointFromPixel(t.getTopRight(),!0),this.pointFromPixel(t.getBottomLeft(),!0))},viewportToViewerElementRectangle:function(t){return e.Rect.fromSummits(this.pixelFromPoint(t.getTopLeft(),!0),this.pixelFromPoint(t.getTopRight(),!0),this.pixelFromPoint(t.getBottomLeft(),!0))},windowToViewportCoordinates:function(t){e.console.assert(this.viewer,"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");var i=t.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(i)},viewportToWindowCoordinates:function(t){e.console.assert(this.viewer,"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer.");var i=this.viewportToViewerElementCoordinates(t);return i.plus(e.getElementPosition(this.viewer.element))},viewportToImageZoom:function(t){if(this.viewer){var i=this.viewer.world.getItemCount();if(i>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.viewportToImageZoom] is not accurate with multi-image.");else if(i===1){var n=this.viewer.world.getItemAt(0);return n.viewportToImageZoom(t)}}var s=this._contentSizeNoRotate.x,h=this._containerInnerSize.x,u=this._contentBoundsNoRotate.width,o=h/s*u;return t*o},imageToViewportZoom:function(t){if(this.viewer){var i=this.viewer.world.getItemCount();if(i>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(i===1){var n=this.viewer.world.getItemAt(0);return n.imageToViewportZoom(t)}}var s=this._contentSizeNoRotate.x,h=this._containerInnerSize.x,u=this._contentBoundsNoRotate.width,o=s/h/u;return t*o},toggleFlip:function(){return this.setFlip(!this.getFlip()),this},getFlip:function(){return this.flipped},setFlip:function(t){return this.flipped===t?this:(this.flipped=t,this.viewer.navigator&&this.viewer.navigator.setFlip(this.getFlip()),this.viewer.forceRedraw(),this.viewer.raiseEvent("flip",{flipped:t}),this)},getMaxZoomPixelRatio:function(){return this.maxZoomPixelRatio},setMaxZoomPixelRatio:function(t,i=!0,n=!1){e.console.assert(!isNaN(t),"[Viewport.setMaxZoomPixelRatio] ratio must be a number"),!isNaN(t)&&(this.maxZoomPixelRatio=t,i&&this.getZoom()>this.getMaxZoom()&&this.applyConstraints(n))}}})(r),(function(e){e.TiledImage=function(t){this._initialized=!1,e.console.assert(t.tileCache,"[TiledImage] options.tileCache is required"),e.console.assert(t.drawer,"[TiledImage] options.drawer is required"),e.console.assert(t.viewer,"[TiledImage] options.viewer is required"),e.console.assert(t.imageLoader,"[TiledImage] options.imageLoader is required"),e.console.assert(t.source,"[TiledImage] options.source is required"),e.console.assert(!t.clip||t.clip instanceof e.Rect,"[TiledImage] options.clip must be an OpenSeadragon.Rect if present"),e.EventSource.call(this),this._tileCache=t.tileCache,delete t.tileCache,this._drawer=t.drawer,delete t.drawer,this._imageLoader=t.imageLoader,delete t.imageLoader,t.clip instanceof e.Rect&&(this._clip=t.clip.clone()),delete t.clip;var i=t.x||0;delete t.x;var n=t.y||0;delete t.y,this.normHeight=t.source.dimensions.y/t.source.dimensions.x,this.contentAspectX=t.source.dimensions.x/t.source.dimensions.y;var s=1;t.width?(s=t.width,delete t.width,t.height&&(e.console.error("specifying both width and height to a tiledImage is not supported"),delete t.height)):t.height&&(s=t.height/this.normHeight,delete t.height);var h=t.fitBounds;delete t.fitBounds;var u=t.fitBoundsPlacement||r.Placement.CENTER;delete t.fitBoundsPlacement;var o=t.degrees||0;delete t.degrees;var l=t.ajaxHeaders;delete t.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},t),this._preload=this.preload,delete this.preload,this._fullyLoaded=!1,this._xSpring=new e.Spring({initial:i,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._ySpring=new e.Spring({initial:n,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._scaleSpring=new e.Spring({initial:s,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._degreesSpring=new e.Spring({initial:o,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._updateForScale(),h&&this.fitBounds(h,u,!0),this._ownAjaxHeaders={},this.setAjaxHeaders(l,!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(t){t!==this._fullyLoaded&&(this._fullyLoaded=t,this.raiseEvent("fully-loaded-change",{fullyLoaded:this._fullyLoaded}))},reset:function(){this._tileCache.clearTilesFor(this),this.lastResetTime=e.now(),this._needsDraw=!0},update:function(t){let i=this._xSpring.update(),n=this._ySpring.update(),s=this._scaleSpring.update(),h=this._degreesSpring.update(),u=i||n||s||h||this._needsUpdate;if(u||t||!this._fullyLoaded){let o=this._updateLevelsForViewport();this._setFullyLoaded(o)}return this._needsUpdate=!1,u?(this._updateForScale(),this._raiseBoundsChange(),this._needsDraw=!0,!0):!1},setDrawn:function(){return this._needsDraw=this._isBlending||this._wasBlending,this._needsDraw},setTainted(t){this._isTainted=t},isTainted(){return this._isTainted},destroy:function(){this.reset(),this.source.destroy&&this.source.destroy(this.viewer)},getBounds:function(t){return this.getBoundsNoRotate(t).rotate(this.getRotation(t),this._getRotationPoint(t))},getBoundsNoRotate:function(t){return t?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(t){var i=this.getBoundsNoRotate(t);if(this._clip){var n=t?this._worldWidthCurrent:this._worldWidthTarget,s=n/this.source.dimensions.x,h=this._clip.times(s);i=new e.Rect(i.x+h.x,i.y+h.y,h.width,h.height)}return i.rotate(this.getRotation(t),this._getRotationPoint(t))},getTileBounds:function(t,i,n){var s=this.source.getNumTiles(t),h=(s.x+i%s.x)%s.x,u=(s.y+n%s.y)%s.y,o=this.source.getTileBounds(t,h,u);return this.getFlip()&&(o.x=Math.max(0,1-o.x-o.width)),o.x+=(i-h)/s.x,o.y+=this._worldHeightCurrent/this._worldWidthCurrent*((n-u)/s.y),o},getContentSize:function(){return new e.Point(this.source.dimensions.x,this.source.dimensions.y)},getSizeInWindowCoordinates:function(){var t=this.imageToWindowCoordinates(new e.Point(0,0)),i=this.imageToWindowCoordinates(this.getContentSize());return new e.Point(i.x-t.x,i.y-t.y)},_viewportToImageDelta:function(t,i,n){var s=n?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(t*(this.source.dimensions.x/s),i*(this.source.dimensions.y*this.contentAspectX/s))},viewportToImageCoordinates:function(t,i,n){var s;return t instanceof e.Point?(n=i,s=t):s=new e.Point(t,i),s=s.rotate(-this.getRotation(n),this._getRotationPoint(n)),n?this._viewportToImageDelta(s.x-this._xSpring.current.value,s.y-this._ySpring.current.value):this._viewportToImageDelta(s.x-this._xSpring.target.value,s.y-this._ySpring.target.value)},_imageToViewportDelta:function(t,i,n){var s=n?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(t/this.source.dimensions.x*s,i/this.source.dimensions.y/this.contentAspectX*s)},imageToViewportCoordinates:function(t,i,n){t instanceof e.Point&&(n=i,i=t.y,t=t.x);var s=this._imageToViewportDelta(t,i,n);return n?(s.x+=this._xSpring.current.value,s.y+=this._ySpring.current.value):(s.x+=this._xSpring.target.value,s.y+=this._ySpring.target.value),s.rotate(this.getRotation(n),this._getRotationPoint(n))},imageToViewportRectangle:function(t,i,n,s,h){var u=t;u instanceof e.Rect?h=i:u=new e.Rect(t,i,n,s);var o=this.imageToViewportCoordinates(u.getTopLeft(),h),l=this._imageToViewportDelta(u.width,u.height,h);return new e.Rect(o.x,o.y,l.x,l.y,u.degrees+this.getRotation(h))},viewportToImageRectangle:function(t,i,n,s,h){var u=t;t instanceof e.Rect?h=i:u=new e.Rect(t,i,n,s);var o=this.viewportToImageCoordinates(u.getTopLeft(),h),l=this._viewportToImageDelta(u.width,u.height,h);return new e.Rect(o.x,o.y,l.x,l.y,u.degrees-this.getRotation(h))},viewerElementToImageCoordinates:function(t){var i=this.viewport.pointFromPixel(t,!0);return this.viewportToImageCoordinates(i)},imageToViewerElementCoordinates:function(t){var i=this.imageToViewportCoordinates(t);return this.viewport.pixelFromPoint(i,!0)},windowToImageCoordinates:function(t){var i=t.minus(r.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(i)},imageToWindowCoordinates:function(t){var i=this.imageToViewerElementCoordinates(t);return i.plus(r.getElementPosition(this.viewer.element))},_viewportToTiledImageRectangle:function(t){var i=this._scaleSpring.current.value;return t=t.rotate(-this.getRotation(!0),this._getRotationPoint(!0)),new e.Rect((t.x-this._xSpring.current.value)/i,(t.y-this._ySpring.current.value)/i,t.width/i,t.height/i,t.degrees)},viewportToImageZoom:function(t){var i=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return i*t},imageToViewportZoom:function(t){var i=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return t/i},setPosition:function(t,i){var n=this._xSpring.target.value===t.x&&this._ySpring.target.value===t.y;if(i){if(n&&this._xSpring.current.value===t.x&&this._ySpring.current.value===t.y)return;this._xSpring.resetTo(t.x),this._ySpring.resetTo(t.y),this._needsDraw=!0,this._needsUpdate=!0}else{if(n)return;this._xSpring.springTo(t.x),this._ySpring.springTo(t.y),this._needsDraw=!0,this._needsUpdate=!0}n||this._raiseBoundsChange()},setWidth:function(t,i){this._setScale(t,i)},setHeight:function(t,i){this._setScale(t/this.normHeight,i)},setCroppingPolygons:function(t){var i=function(s){return s instanceof e.Point||typeof s.x=="number"&&typeof s.y=="number"},n=function(s){return s.map(function(h){try{if(i(h))return{x:h.x,y:h.y};throw new Error}catch{throw new Error("A Provided cropping polygon point is not supported")}})};try{if(!e.isArray(t))throw new Error("Provided cropping polygon is not an array");this._croppingPolygons=t.map(function(s){return n(s)}),this._needsDraw=!0}catch(s){e.console.error("[TiledImage.setCroppingPolygons] Cropping polygon format not supported"),e.console.error(s),this.resetCroppingPolygons()}},resetCroppingPolygons:function(){this._croppingPolygons=null,this._needsDraw=!0},fitBounds:function(t,i,n){i=i||e.Placement.CENTER;var s=e.Placement.properties[i],h=this.contentAspectX,u=0,o=0,l=1,f=1;if(this._clip&&(h=this._clip.getAspectRatio(),l=this._clip.width/this.source.dimensions.x,f=this._clip.height/this.source.dimensions.y,t.getAspectRatio()>h?(u=this._clip.x/this._clip.height*t.height,o=this._clip.y/this._clip.height*t.height):(u=this._clip.x/this._clip.width*t.width,o=this._clip.y/this._clip.width*t.width)),t.getAspectRatio()>h){var c=t.height/f,p=0;s.isHorizontallyCentered?p=(t.width-t.height*h)/2:s.isRight&&(p=t.width-t.height*h),this.setPosition(new e.Point(t.x-u+p,t.y-o),n),this.setHeight(c,n)}else{var _=t.width/l,d=0;s.isVerticallyCentered?d=(t.height-t.width/h)/2:s.isBottom&&(d=t.height-t.width/h),this.setPosition(new e.Point(t.x-u,t.y-o+d),n),this.setWidth(_,n)}},getClip:function(){return this._clip?this._clip.clone():null},setClip:function(t){e.console.assert(!t||t instanceof e.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null"),t instanceof e.Rect?this._clip=t.clone():this._clip=null,this._needsUpdate=!0,this._needsDraw=!0,this.raiseEvent("clip-change")},getFlip:function(){return this.flipped},setFlip:function(t){this.flipped=t},get flipped(){return this._flipped},set flipped(t){let i=this._flipped!==!!t;this._flipped=!!t,i&&(this.update(!0),this._needsDraw=!0,this._raiseBoundsChange())},get wrapHorizontal(){return this._wrapHorizontal},set wrapHorizontal(t){let i=this._wrapHorizontal!==!!t;this._wrapHorizontal=!!t,this._initialized&&i&&(this.update(!0),this._needsDraw=!0)},get wrapVertical(){return this._wrapVertical},set wrapVertical(t){let i=this._wrapVertical!==!!t;this._wrapVertical=!!t,this._initialized&&i&&(this.update(!0),this._needsDraw=!0)},get debugMode(){return this._debugMode},set debugMode(t){this._debugMode=!!t,this._needsDraw=!0},getOpacity:function(){return this.opacity},setOpacity:function(t){this.opacity=t},get opacity(){return this._opacity},set opacity(t){t!==this.opacity&&(this._opacity=t,this._needsDraw=!0,this.raiseEvent("opacity-change",{opacity:this.opacity}))},getPreload:function(){return this._preload},setPreload:function(t){this._preload=!!t,this._needsDraw=!0},getRotation:function(t){return t?this._degreesSpring.current.value:this._degreesSpring.target.value},setRotation:function(t,i){this._degreesSpring.target.value===t&&this._degreesSpring.isAtTargetValue()||(i?this._degreesSpring.resetTo(t):this._degreesSpring.springTo(t),this._needsDraw=!0,this._needsUpdate=!0,this._raiseBoundsChange())},getDrawArea:function(){if(this._opacity===0&&!this._preload)return!1;var t=this._viewportToTiledImageRectangle(this.viewport.getBoundsWithMargins(!0));if(!this.wrapHorizontal&&!this.wrapVertical){var i=this._viewportToTiledImageRectangle(this.getClippedBounds(!0));t=t.intersection(i)}return t},getTilesToDraw:function(){let t=this._tilesToDraw.flat();return this._updateTilesInViewport(t),t=this._tilesToDraw.flat(),t.forEach(i=>{i.tile.beingDrawn=!0}),this._lastDrawn=t,t},_getRotationPoint:function(t){return this.getBoundsNoRotate(t).getCenter()},get compositeOperation(){return this._compositeOperation},set compositeOperation(t){t!==this._compositeOperation&&(this._compositeOperation=t,this._needsDraw=!0,this.raiseEvent("composite-operation-change",{compositeOperation:this._compositeOperation}))},getCompositeOperation:function(){return this._compositeOperation},setCompositeOperation:function(t){this.compositeOperation=t},setAjaxHeaders:function(t,i){if(t===null&&(t={}),!e.isPlainObject(t)){console.error("[TiledImage.setAjaxHeaders] Ignoring invalid headers, must be a plain object");return}this._ownAjaxHeaders=t,this._updateAjaxHeaders(i)},_updateAjaxHeaders:function(t){if(t===void 0&&(t=!0),e.isPlainObject(this.viewer.ajaxHeaders)?this.ajaxHeaders=e.extend({},this.viewer.ajaxHeaders,this._ownAjaxHeaders):this.ajaxHeaders=this._ownAjaxHeaders,t){var i,n,s,h;for(var u in this.tilesMatrix){i=this.source.getNumTiles(u);for(var o in this.tilesMatrix[u]){n=(i.x+o%i.x)%i.x;for(var l in this.tilesMatrix[u][o])if(s=(i.y+l%i.y)%i.y,h=this.tilesMatrix[u][o][l],h.loadWithAjax=this.loadTilesWithAjax,h.loadWithAjax){var f=this.source.getTileAjaxHeaders(u,n,s);h.ajaxHeaders=e.extend({},this.ajaxHeaders,f)}else h.ajaxHeaders=null}}for(var c=0;c<this._imageLoader.jobQueue.length;c++){var p=this._imageLoader.jobQueue[c];p.loadWithAjax=p.tile.loadWithAjax,p.ajaxHeaders=p.tile.loadWithAjax?p.tile.ajaxHeaders:null}}},_setScale:function(t,i){var n=this._scaleSpring.target.value===t;if(i){if(n&&this._scaleSpring.current.value===t)return;this._scaleSpring.resetTo(t),this._updateForScale(),this._needsDraw=!0,this._needsUpdate=!0}else{if(n)return;this._scaleSpring.springTo(t),this._updateForScale(),this._needsDraw=!0,this._needsUpdate=!0}n||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 t=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2))),i=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),!0).x*this._scaleSpring.current.value,n=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(i/this.minPixelRatio)/Math.log(2))));return n=Math.max(n,this.source.minLevel||0),t=Math.min(t,n),{lowestLevel:t,highestLevel:n}},_updateLevelsForViewport:function(){var t=this._getLevelsInterval(),i=t.lowestLevel,n=t.highestLevel,s=[],h=this.getDrawArea(),u=e.now();if(this._lastDrawn.forEach(A=>{A.tile.beingDrawn=!1}),this._tilesToDraw=[],this._tilesLoading=0,this.loadingCoverage={},!h)return this._needsDraw=!1,this._fullyLoaded;var o=new Array(n-i+1);for(let A=0,F=n;F>=i;F--,A++)o[A]=F;for(let A=n+1;A<=this.source.maxLevel;A++){var l=this.tilesMatrix[A]&&this.tilesMatrix[A][0]&&this.tilesMatrix[A][0][0];if(l&&l.isBottomMost&&l.isRightMost&&l.loaded){o.push(A);break}}let f=!1;for(let A=0;A<o.length;A++){let F=o[A];var c=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(F),!0).x*this._scaleSpring.current.value;if(A===o.length-1||c>=this.minPixelRatio)f=!0;else if(!f)continue;var p=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(F),!1).x*this._scaleSpring.current.value,_=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),!1).x*this._scaleSpring.current.value,d=this.immediateRender?1:_,v=Math.min(1,(c-.5)/.5),w=d/Math.abs(d-p),S=this._updateLevel(F,v,w,h,u,s);s=S.bestTiles;var R=S.updatedTiles.filter(N=>N.loaded),P=(function(N,z,I){return function(D){return{tile:D,level:N,levelOpacity:z,currentTime:I}}})(F,v,u);if(this._tilesToDraw[F]=R.map(P),this._providesCoverage(this.coverage,F))break}return s&&s.length>0?(s.forEach(function(A){A&&!A.context2D&&this._loadTile(A,u)},this),this._needsDraw=!0,!1):this._tilesLoading===0},_updateTilesInViewport:function(t){let i=e.now(),n=this;this._tilesLoading=0,this._wasBlending=this._isBlending,this._isBlending=!1,this.loadingCoverage={};let s=t.length?t[0].level:0;if(!this.getDrawArea())return;function u(l){let f=l.tile;if(f&&f.loaded){let c=n._blendTile(f,f.x,f.y,l.level,l.levelOpacity,i,s);n._isBlending=n._isBlending||c,n._needsDraw=n._needsDraw||c||n._wasBlending}}let o=0;for(let l=0;l<t.length;l++){let f=t[l];u(f),this._providesCoverage(this.coverage,f.level)&&(o=Math.max(o,f.level))}if(o>0)for(let l in this._tilesToDraw)l<o&&delete this._tilesToDraw[l]},_blendTile:function(t,i,n,s,h,u,o){let l=1e3*this.blendTime,f,c;return t.blendStart||(t.blendStart=u),f=u-t.blendStart,c=l?Math.min(1,f/l):1,s===o&&(c=1,f=l),this.alwaysBlend&&(c*=h),t.opacity=c,c===1&&(this._setCoverage(this.coverage,s,i,n,!0),this._hasOpaqueTile=!0),f<l},_updateLevel:function(t,i,n,s,h,u){var o=s.getBoundingBox().getTopLeft(),l=s.getBoundingBox().getBottomRight();this.viewer&&this.viewer.raiseEvent("update-level",{tiledImage:this,havedrawn:!0,level:t,opacity:i,visibility:n,drawArea:s,topleft:o,bottomright:l,currenttime:h,best:u}),this._resetCoverage(this.coverage,t),this._resetCoverage(this.loadingCoverage,t);var f=this._getCornerTiles(t,o,l),c=f.topLeft,p=f.bottomRight,_=this.source.getNumTiles(t),d=this.viewport.pixelFromPoint(this.viewport.getCenter());this.getFlip()&&(p.x+=1,this.wrapHorizontal||(p.x=Math.min(p.x,_.x-1)));for(var v=Math.max(0,(p.x-c.x)*(p.y-c.y)),w=new Array(v),S=0,R=c.x;R<=p.x;R++)for(var P=c.y;P<=p.y;P++){var A;if(this.getFlip()){var F=(_.x+R%_.x)%_.x;A=R+_.x-F-F-1}else A=R;if(s.intersection(this.getTileBounds(t,A,P))!==null){var N=this._updateTile(A,P,t,n,d,_,h,u);u=N.bestTiles,w[S]=N.tile,S+=1}}return{bestTiles:u,updatedTiles:w}},_positionTile:function(t,i,n,s,h){var u=t.bounds.getTopLeft();u.x*=this._scaleSpring.current.value,u.y*=this._scaleSpring.current.value,u.x+=this._xSpring.current.value,u.y+=this._ySpring.current.value;var o=t.bounds.getSize();o.x*=this._scaleSpring.current.value,o.y*=this._scaleSpring.current.value,t.positionedBounds.x=u.x,t.positionedBounds.y=u.y,t.positionedBounds.width=o.x,t.positionedBounds.height=o.y;var l=n.pixelFromPointNoRotate(u,!0),f=n.pixelFromPointNoRotate(u,!1),c=n.deltaPixelsFromPointsNoRotate(o,!0),p=n.deltaPixelsFromPointsNoRotate(o,!1),_=f.plus(p.divide(2)),d=s.squaredDistanceTo(_);this.viewer.drawer.minimumOverlapRequired(this)&&(i||(c=c.plus(new e.Point(1,1))),t.isRightMost&&this.wrapHorizontal&&(c.x+=.75),t.isBottomMost&&this.wrapVertical&&(c.y+=.75)),t.position=l,t.size=c,t.squaredDistance=d,t.visibility=h},_updateTile:function(t,i,n,s,h,u,o,l){var f=this._getTile(t,i,n,o,u);this.viewer&&this.viewer.raiseEvent("update-tile",{tiledImage:this,tile:f}),this._setCoverage(this.coverage,n,t,i,!1);var c=f.loaded||f.loading||this._isCovered(this.loadingCoverage,n,t,i);if(this._setCoverage(this.loadingCoverage,n,t,i,c),!f.exists)return{bestTiles:l,tile:f};if(f.loaded&&f.opacity===1&&this._setCoverage(this.coverage,n,t,i,!0),this._positionTile(f,this.source.tileOverlap,this.viewport,h,s),!f.loaded)if(f.context2D)this._setTileLoaded(f);else{var p=this._tileCache.getImageRecord(f.cacheKey);p&&this._setTileLoaded(f,p.getData())}return f.loading?this._tilesLoading++:c||(l=this._compareTiles(l,f,this.maxTilesPerFrame)),{bestTiles:l,tile:f}},_getCornerTiles:function(t,i,n){var s,h;this.wrapHorizontal?(s=e.positiveModulo(i.x,1),h=e.positiveModulo(n.x,1)):(s=Math.max(0,i.x),h=Math.min(1,n.x));var u,o,l=1/this.source.aspectRatio;this.wrapVertical?(u=e.positiveModulo(i.y,l),o=e.positiveModulo(n.y,l)):(u=Math.max(0,i.y),o=Math.min(l,n.y));var f=this.source.getTileAtPoint(t,new e.Point(s,u)),c=this.source.getTileAtPoint(t,new e.Point(h,o)),p=this.source.getNumTiles(t);return this.wrapHorizontal&&(f.x+=p.x*Math.floor(i.x),c.x+=p.x*Math.floor(n.x)),this.wrapVertical&&(f.y+=p.y*Math.floor(i.y/l),c.y+=p.y*Math.floor(n.y/l)),{topLeft:f,bottomRight:c}},_getTile:function(t,i,n,s,h){var u,o,l,f,c,p,_,d,v,w,S=this.tilesMatrix,R=this.source;return S[n]||(S[n]={}),S[n][t]||(S[n][t]={}),(!S[n][t][i]||!S[n][t][i].flipped!=!this.flipped)&&(u=(h.x+t%h.x)%h.x,o=(h.y+i%h.y)%h.y,l=this.getTileBounds(n,t,i),f=R.getTileBounds(n,u,o,!0),c=R.tileExists(n,u,o),p=R.getTileUrl(n,u,o),_=R.getTilePostData(n,u,o),this.loadTilesWithAjax?(d=R.getTileAjaxHeaders(n,u,o),e.isPlainObject(this.ajaxHeaders)&&(d=e.extend({},this.ajaxHeaders,d))):d=null,v=R.getContext2D?R.getContext2D(n,u,o):void 0,w=new e.Tile(n,t,i,l,c,p,v,this.loadTilesWithAjax,d,f,_,R.getTileHashKey(n,u,o,p,d,_)),this.getFlip()?u===0&&(w.isRightMost=!0):u===h.x-1&&(w.isRightMost=!0),o===h.y-1&&(w.isBottomMost=!0),w.flipped=this.flipped,S[n][t][i]=w),w=S[n][t][i],w.lastTouchTime=s,w},_loadTile:function(t,i){var n=this;t.loading=!0,this._imageLoader.addJob({src:t.getUrl(),tile:t,source:this.source,postData:t.postData,loadWithAjax:t.loadWithAjax,ajaxHeaders:t.ajaxHeaders,crossOriginPolicy:this.crossOriginPolicy,ajaxWithCredentials:this.ajaxWithCredentials,callback:function(s,h,u){n._onTileLoad(t,i,s,h,u)},abort:function(){t.loading=!1}})},_onTileLoad:function(t,i,n,s,h){if(n)t.exists=!0;else{e.console.error("Tile %s failed to load: %s - error: %s",t,t.getUrl(),s),this.viewer.raiseEvent("tile-load-failed",{tile:t,tiledImage:this,time:i,message:s,tileRequest:h}),t.loading=!1,t.exists=!1;return}if(i<this.lastResetTime){e.console.warn("Ignoring tile %s loaded before reset: %s",t,t.getUrl()),t.loading=!1;return}var u=this,o=function(){var l=u.source,f=l.getClosestLevel();u._setTileLoaded(t,n,f,h)};o()},_setTileLoaded:function(t,i,n,s){var h=0,u=!1,o=this;function l(){return u&&e.console.error("Event 'tile-loaded' argument getCompletionCallback must be called synchronously. Its return value should be called asynchronously."),h++,f}function f(){h--,h===0&&(t.loading=!1,t.loaded=!0,t.hasTransparency=o.source.hasTransparency(t.context2D,t.getUrl(),t.ajaxHeaders,t.postData),t.context2D||o._tileCache.cacheTile({data:i,tile:t,cutoff:n,tiledImage:o}),o.viewer.raiseEvent("tile-ready",{tile:t,tiledImage:o,tileRequest:s}),o._needsDraw=!0)}var c=l();this.viewer.raiseEvent("tile-loaded",{tile:t,tiledImage:this,tileRequest:s,get image(){return e.console.error("[tile-loaded] event 'image' has been deprecated. Use 'data' property instead."),i},data:i,getCompletionCallback:l}),u=!0,c()},_compareTiles:function(t,i,n){return t?(t.push(i),this._sortTiles(t),t.length>n&&t.pop(),t):[i]},_sortTiles:function(t){t.sort(function(i,n){return i===null?1:n===null?-1:i.visibility===n.visibility?i.squaredDistance-n.squaredDistance:n.visibility-i.visibility})},_providesCoverage:function(t,i,n,s){var h,u,o,l;if(!t[i])return!1;if(n===void 0||s===void 0){h=t[i];for(o in h)if(Object.prototype.hasOwnProperty.call(h,o)){u=h[o];for(l in u)if(Object.prototype.hasOwnProperty.call(u,l)&&!u[l])return!1}return!0}return t[i][n]===void 0||t[i][n][s]===void 0||t[i][n][s]===!0},_isCovered:function(t,i,n,s){return n===void 0||s===void 0?this._providesCoverage(t,i+1):this._providesCoverage(t,i+1,2*n,2*s)&&this._providesCoverage(t,i+1,2*n,2*s+1)&&this._providesCoverage(t,i+1,2*n+1,2*s)&&this._providesCoverage(t,i+1,2*n+1,2*s+1)},_setCoverage:function(t,i,n,s,h){if(!t[i]){e.console.warn("Setting coverage for a tile before its level's coverage has been reset: %s",i);return}t[i][n]||(t[i][n]={}),t[i][n][s]=h},_resetCoverage:function(t,i){t[i]={}}})})(r),(function(e){var t=function(n){e.console.assert(n,"[TileCache.cacheTile] options is required"),e.console.assert(n.tile,"[TileCache.cacheTile] options.tile is required"),e.console.assert(n.tiledImage,"[TileCache.cacheTile] options.tiledImage is required"),this.tile=n.tile,this.tiledImage=n.tiledImage},i=function(n){e.console.assert(n,"[ImageRecord] options is required"),e.console.assert(n.data,"[ImageRecord] options.data is required"),this._tiles=[],n.create.apply(null,[this,n.data,n.ownerTile]),this._destroyImplementation=n.destroy.bind(null,this),this.getImage=n.getImage.bind(null,this),this.getData=n.getData.bind(null,this),this.getRenderedContext=n.getRenderedContext.bind(null,this)};i.prototype={destroy:function(){this._destroyImplementation(),this._tiles=null},addTile:function(n){e.console.assert(n,"[ImageRecord.addTile] tile is required"),this._tiles.push(n)},removeTile:function(n){for(var s=0;s<this._tiles.length;s++)if(this._tiles[s]===n){this._tiles.splice(s,1);return}e.console.warn("[ImageRecord.removeTile] trying to remove unknown tile",n)},getTileCount:function(){return this._tiles.length}},e.TileCache=function(n){n=n||{},this._maxImageCacheCount=n.maxImageCacheCount||e.DEFAULT_SETTINGS.maxImageCacheCount,this._tilesLoaded=[],this._imagesLoaded=[],this._imagesLoadedCount=0},e.TileCache.prototype={numTilesLoaded:function(){return this._tilesLoaded.length},cacheTile:function(n){e.console.assert(n,"[TileCache.cacheTile] options is required"),e.console.assert(n.tile,"[TileCache.cacheTile] options.tile is required"),e.console.assert(n.tile.cacheKey,"[TileCache.cacheTile] options.tile.cacheKey is required"),e.console.assert(n.tiledImage,"[TileCache.cacheTile] options.tiledImage is required");var s=n.cutoff||0,h=this._tilesLoaded.length,u=this._imagesLoaded[n.tile.cacheKey];if(u||(n.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."),n.data=n.image),e.console.assert(n.data,"[TileCache.cacheTile] options.data is required to create an ImageRecord"),u=this._imagesLoaded[n.tile.cacheKey]=new i({data:n.data,ownerTile:n.tile,create:n.tiledImage.source.createTileCache,destroy:n.tiledImage.source.destroyTileCache,getImage:n.tiledImage.source.getTileCacheDataAsImage,getData:n.tiledImage.source.getTileCacheData,getRenderedContext:n.tiledImage.source.getTileCacheDataAsContext2D}),this._imagesLoadedCount++),u.addTile(n.tile),n.tile.cacheImageRecord=u,this._imagesLoadedCount>this._maxImageCacheCount){for(var o=null,l=-1,f=null,c,p,_,d,v,w,S=this._tilesLoaded.length-1;S>=0;S--)if(w=this._tilesLoaded[S],c=w.tile,!(c.level<=s||c.beingDrawn)){if(!o){o=c,l=S,f=w;continue}d=c.lastTouchTime,p=o.lastTouchTime,v=c.level,_=o.level,(d<p||d===p&&v>_)&&(o=c,l=S,f=w)}o&&l>=0&&(this._unloadTile(f),h=l)}this._tilesLoaded[h]=new t({tile:n.tile,tiledImage:n.tiledImage})},clearTilesFor:function(n){e.console.assert(n,"[TileCache.clearTilesFor] tiledImage is required");for(var s,h=0;h<this._tilesLoaded.length;++h)s=this._tilesLoaded[h],s.tiledImage===n&&(this._unloadTile(s),this._tilesLoaded.splice(h,1),h--)},getImageRecord:function(n){return e.console.assert(n,"[TileCache.getImageRecord] cacheKey is required"),this._imagesLoaded[n]},_unloadTile:function(n){e.console.assert(n,"[TileCache._unloadTile] tileRecord is required");var s=n.tile,h=n.tiledImage;let u=s.getCanvasContext&&s.getCanvasContext();s.unload(),s.cacheImageRecord=null;var o=this._imagesLoaded[s.cacheKey];o&&(o.removeTile(s),o.getTileCount()||(o.destroy(),delete this._imagesLoaded[s.cacheKey],this._imagesLoadedCount--,u&&(u.canvas.width=0,u.canvas.height=0,h.viewer.raiseEvent("image-unloaded",{context2D:u,tile:s}))),h.viewer.raiseEvent("tile-unloaded",{tile:s,tiledImage:h}))}}})(r),(function(e){e.World=function(t){var i=this;e.console.assert(t.viewer,"[World] options.viewer is required"),e.EventSource.call(this),this.viewer=t.viewer,this._items=[],this._needsDraw=!1,this._autoRefigureSizes=!0,this._needsSizesFigured=!1,this._delegatedFigureSizes=function(n){i._autoRefigureSizes?i._figureSizes():i._needsSizesFigured=!0},this._figureSizes()},e.extend(e.World.prototype,e.EventSource.prototype,{addItem:function(t,i){if(e.console.assert(t,"[World.addItem] item is required"),e.console.assert(t instanceof e.TiledImage,"[World.addItem] only TiledImages supported at this time"),i=i||{},i.index!==void 0){var n=Math.max(0,Math.min(this._items.length,i.index));this._items.splice(n,0,t)}else this._items.push(t);this._autoRefigureSizes?this._figureSizes():this._needsSizesFigured=!0,this._needsDraw=!0,t.addHandler("bounds-change",this._delegatedFigureSizes),t.addHandler("clip-change",this._delegatedFigureSizes),this.raiseEvent("add-item",{item:t})},getItemAt:function(t){return e.console.assert(t!==void 0,"[World.getItemAt] index is required"),this._items[t]},getIndexOfItem:function(t){return e.console.assert(t,"[World.getIndexOfItem] item is required"),e.indexOf(this._items,t)},getItemCount:function(){return this._items.length},setItemIndex:function(t,i){e.console.assert(t,"[World.setItemIndex] item is required"),e.console.assert(i!==void 0,"[World.setItemIndex] index is required");var n=this.getIndexOfItem(t);if(i>=this._items.length)throw new Error("Index bigger than number of layers.");i===n||n===-1||(this._items.splice(n,1),this._items.splice(i,0,t),this._needsDraw=!0,this.raiseEvent("item-index-change",{item:t,previousIndex:n,newIndex:i}))},removeItem:function(t){e.console.assert(t,"[World.removeItem] item is required");var i=e.indexOf(this._items,t);i!==-1&&(t.removeHandler("bounds-change",this._delegatedFigureSizes),t.removeHandler("clip-change",this._delegatedFigureSizes),t.destroy(),this._items.splice(i,1),this._figureSizes(),this._needsDraw=!0,this._raiseRemoveItem(t))},removeAll:function(){this.viewer._cancelPendingImages();var t,i;for(i=0;i<this._items.length;i++)t=this._items[i],t.removeHandler("bounds-change",this._delegatedFigureSizes),t.removeHandler("clip-change",this._delegatedFigureSizes),t.destroy();var n=this._items;for(this._items=[],this._figureSizes(),this._needsDraw=!0,i=0;i<n.length;i++)t=n[i],this._raiseRemoveItem(t)},resetItems:function(){for(var t=0;t<this._items.length;t++)this._items[t].reset()},update:function(t){for(var i=!1,n=0;n<this._items.length;n++)i=this._items[n].update(t)||i;return i},draw:function(){this.viewer.drawer.draw(this._items),this._needsDraw=!1,this._items.forEach(t=>{this._needsDraw=t.setDrawn()||this._needsDraw})},needsDraw:function(){for(var t=0;t<this._items.length;t++)if(this._items[t].needsDraw())return!0;return this._needsDraw},getHomeBounds:function(){return this._homeBounds.clone()},getContentFactor:function(){return this._contentFactor},setAutoRefigureSizes:function(t){this._autoRefigureSizes=t,t&this._needsSizesFigured&&(this._figureSizes(),this._needsSizesFigured=!1)},arrange:function(t){t=t||{};var i=t.immediately||!1,n=t.layout||e.DEFAULT_SETTINGS.collectionLayout,s=t.rows||e.DEFAULT_SETTINGS.collectionRows,h=t.columns||e.DEFAULT_SETTINGS.collectionColumns,u=t.tileSize||e.DEFAULT_SETTINGS.collectionTileSize,o=t.tileMargin||e.DEFAULT_SETTINGS.collectionTileMargin,l=u+o,f;!t.rows&&h?f=h:f=Math.ceil(this._items.length/s);var c=0,p=0,_,d,v,w,S;this.setAutoRefigureSizes(!1);for(var R=0;R<this._items.length;R++)R&&R%f===0&&(n==="horizontal"?(p+=l,c=0):(c+=l,p=0)),_=this._items[R],d=_.getBounds(),d.width>d.height?v=u:v=u*(d.width/d.height),w=v*(d.height/d.width),S=new e.Point(c+(u-v)/2,p+(u-w)/2),_.setPosition(S,i),_.setWidth(v,i),n==="horizontal"?c+=l:p+=l;this.setAutoRefigureSizes(!0)},_figureSizes:function(){var t=this._homeBounds?this._homeBounds.clone():null,i=this._contentSize?this._contentSize.clone():null,n=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 s=this._items[0],h=s.getBounds();this._contentFactor=s.getContentSize().x/h.width;for(var u=s.getClippedBounds().getBoundingBox(),o=u.x,l=u.y,f=u.x+u.width,c=u.y+u.height,p=1;p<this._items.length;p++)s=this._items[p],h=s.getBounds(),this._contentFactor=Math.max(this._contentFactor,s.getContentSize().x/h.width),u=s.getClippedBounds().getBoundingBox(),o=Math.min(o,u.x),l=Math.min(l,u.y),f=Math.max(f,u.x+u.width),c=Math.max(c,u.y+u.height);this._homeBounds=new e.Rect(o,l,f-o,c-l),this._contentSize=new e.Point(this._homeBounds.width*this._contentFactor,this._homeBounds.height*this._contentFactor)}(this._contentFactor!==n||!this._homeBounds.equals(t)||!this._contentSize.equals(i))&&this.raiseEvent("metrics-change",{})},_raiseRemoveItem:function(t){this.raiseEvent("remove-item",{item:t})}})})(r)})(vn)),vn.exports}var gh=ph();const So=Qn(gh);function Po(a){return a.id||a["@id"]||(typeof a.getId=="function"?a.getId():"")}function Ea(a){if(!a)return null;const r=a.match(/xywh=(\d+),(\d+),(\d+),(\d+)/);return r?{x:parseInt(r[1],10),y:parseInt(r[2],10),w:parseInt(r[3],10),h:parseInt(r[4],10)}:null}function vh(a){const r=mh(a);if(r)return _h(r);const e=Eh(a);return e?{type:"RECTANGLE",x:e.x,y:e.y,w:e.w,h:e.h}:null}function mh(a){var e,t;if(typeof a.getTarget=="function"){const i=((e=a.__jsonld)==null?void 0:e.on)||((t=a.__jsonld)==null?void 0:t.target);if(i)return Co(i)}const r=a.target||a.on;return r?Co(r):null}function Co(a){if(!a)return null;if(Array.isArray(a))for(const r of a){const e=Ro(r);if(e)return e}else return Ro(a);return null}function Ro(a){var e;if(!a)return null;const r=a.selector||a;return(r==null?void 0:r.type)==="SvgSelector"&&r.value?r.value:((e=r==null?void 0:r.item)==null?void 0:e.type)==="SvgSelector"&&r.item.value?r.item.value:null}function _h(a){try{const e=new DOMParser().parseFromString(a,"image/svg+xml");if(e.documentElement.nodeName==="parsererror")return console.warn("Failed to parse SVG selector:",a),null;const t=[],i=e.querySelectorAll("polygon");for(const h of i){const u=h.getAttribute("points");if(u){const o=yh(u);t.push(...o)}}const n=e.querySelectorAll("path");for(const h of n){const u=h.getAttribute("d");if(u){const o=wh(u);t.push(...o)}}const s=e.querySelectorAll("circle");for(const h of s){const u=parseFloat(h.getAttribute("cx")||"0"),o=parseFloat(h.getAttribute("cy")||"0"),l=parseFloat(h.getAttribute("r")||"0"),f=Th(u,o,l);t.push(...f)}return t.length===0?null:{type:"POLYGON",points:t}}catch(r){return console.warn("Failed to convert SVG to polygon:",r),null}}function yh(a){const r=[],e=a.trim().split(/\s+/);for(const t of e){const[i,n]=t.split(",").map(s=>parseFloat(s));!isNaN(i)&&!isNaN(n)&&r.push([i,n])}return r}function wh(a){const r=[],e=/[ML]\s*([\d.]+)[,\s]+([\d.]+)/g;let t;for(;(t=e.exec(a))!==null;){const i=parseFloat(t[1]),n=parseFloat(t[2]);!isNaN(i)&&!isNaN(n)&&r.push([i,n])}return r}function Th(a,r,e,t=8){const i=[];for(let n=0;n<t;n++){const s=n/t*Math.PI*2,h=a+e*Math.cos(s),u=r+e*Math.sin(s);i.push([h,u])}return i}function Eh(a){var e;if(typeof a.getTarget=="function"){const t=a.getTarget();if(typeof t=="string"&&t.includes("xywh="))return Ea(t);const i=(e=a.__jsonld)==null?void 0:e.on;if(i){const n=xa(i);if(n)return n}}const r=a.target||a.on;return r?xa(r):null}function xa(a){if(!a)return null;if(Array.isArray(a))for(const r of a){const e=xa(r);if(e)return e}if(typeof a=="string"&&a.includes("xywh="))return Ea(a);if(a.selector){const r=a.selector,e=r.item||r;if(e.value&&typeof e.value=="string"&&e.value.includes("xywh="))return Ea(e.value)}return null}function xh(a){let r="",e=!1;if(typeof a.getBody=="function"){const t=a.getBody();if(t&&Array.isArray(t)){const i=[];for(const n of t){const s=n.getValue?n.getValue():"";if(s){i.push(s);const h=n.getFormat?n.getFormat():"";(h==="text/html"||h==="application/html")&&(e=!0)}}r=i.join(" ")}}else{const t=n=>n&&(n.chars||n.value||n["cnt:chars"])||"",i=n=>n?n.format==="text/html"||n.type==="TextualBody":!1;if(a.resource){const n=Array.isArray(a.resource)?a.resource:[a.resource];r=n.map(t).filter(Boolean).join(" "),e=n.some(i)}else if(a.body){const n=Array.isArray(a.body)?a.body:[a.body];r=n.map(t).filter(Boolean).join(" "),e=n.some(i)}}return r||(typeof a.getLabel=="function"?r=a.getLabel()||"":a.label&&(r=Array.isArray(a.label)?a.label.join(" "):a.label)),{value:r||"Annotation",isHtml:e}}function bh(a,r,e=!1){const t=Po(a)||`anno-${r}`,i=vh(a);if(!i)return null;const n=xh(a);return{id:t,geometry:i,body:n,isSearchHit:e}}function Sh(a,r=new Set){return a.map((e,t)=>{const i=r.has(Po(e));return bh(e,t,i)}).filter(e=>e!==null)}var Ph=Ae("<div></div>"),Ch=J('<svg class="absolute pointer-events-auto"><title> </title><polygon stroke-width="2"></polygon></svg>'),Rh=Ae('<div class="w-full h-full relative"><div class="w-full h-full osd-background bg-base-100"></div> <!></div>');function Ah(a,r){Ve(r,!0);let e=Pe(void 0),t=Pe(void 0),i=Pe(0),n=le(()=>{if(!r.viewerState.manifestId||!r.viewerState.canvasId)return[];const c=$i.getAnnotations(r.viewerState.manifestId,r.viewerState.canvasId),p=r.viewerState.currentCanvasSearchAnnotations;return[...c,...p]}),s=le(()=>{const c=new Set;return r.viewerState.currentCanvasSearchAnnotations.forEach(p=>{const _=p.id||p["@id"];_&&c.add(_)}),c}),h=le(()=>Sh(T(n),T(s))),u=le(()=>{if(T(i),!T(t)||!T(h).length)return[];const c=T(t).world.getItemAt(0);if(!c)return[];const p=[];for(const _ of T(h)){if(!_.isSearchHit)if(r.viewerState.showAnnotations){if(!r.viewerState.visibleAnnotationIds.has(_.id))continue}else continue;if(_.geometry.type==="RECTANGLE"){const d=c.imageToViewportRectangle(_.geometry.x,_.geometry.y,_.geometry.w,_.geometry.h),v=T(t).viewport.viewportToViewerElementRectangle(d);p.push({id:_.id,type:"RECTANGLE",rect:{x:v.x,y:v.y,width:v.width,height:v.height},isSearchHit:_.isSearchHit,tooltip:_.body.value})}else if(_.geometry.type==="POLYGON"){const d=_.geometry.points.map(A=>{const F=c.imageToViewportCoordinates(new So.Point(A[0],A[1])),N=T(t).viewport.viewportToViewerElementCoordinates(F);return[N.x,N.y]});let v=1/0,w=1/0,S=-1/0,R=-1/0;for(const[A,F]of d)v=Math.min(v,A),w=Math.min(w,F),S=Math.max(S,A),R=Math.max(R,F);const P=d.map(([A,F])=>[A-v,F-w]);p.push({id:_.id,type:"POLYGON",bounds:{x:v,y:w,width:S-v,height:R-w},points:P,isSearchHit:_.isSearchHit,tooltip:_.body.value})}}return p});$l(()=>{if(T(e))return me(t,So({element:T(e),tileSources:null,prefixUrl:"",showNavigationControl:!1,showHomeControl:!1,showFullPageControl:!1,showSequenceControl:!1,showZoomControl:!1,showRotationControl:!1,animationTime:.5,springStiffness:7,zoomPerClick:2}),!0),()=>{var c;(c=T(t))==null||c.destroy()}}),si(()=>{if(!T(t))return;const c=()=>{Rl(i)};return T(t).addHandler("open",c),T(t).addHandler("animation",c),T(t).addHandler("resize",c),T(t).addHandler("rotate",c),T(t).world.addHandler("add-item",c),T(t).world.addHandler("remove-item",c),()=>{T(t).removeHandler("open",c),T(t).removeHandler("animation",c),T(t).removeHandler("resize",c),T(t).removeHandler("rotate",c),T(t).world.removeHandler("add-item",c),T(t).world.removeHandler("remove-item",c)}}),si(()=>{!T(t)||!r.tileSources||T(t).open(r.tileSources)});var o=Rh(),l=Q(o);Ws(l,c=>me(e,c),()=>T(e));var f=ue(l,2);yr(f,17,()=>T(u),c=>c.id,(c,p)=>{var _=ie(),d=K(_);{var v=S=>{var R=Ph();ke(()=>{je(R,1,`absolute border-2 transition-colors cursor-pointer pointer-events-auto ${T(p).isSearchHit?"border-yellow-400 bg-yellow-400/40 hover:bg-yellow-400/60":"border-red-500 bg-red-500/20 hover:bg-red-500/40"}`),Tr(R,`
82
- left: ${T(p).rect.x??""}px;
83
- top: ${T(p).rect.y??""}px;
84
- width: ${T(p).rect.width??""}px;
85
- height: ${T(p).rect.height??""}px;
86
- `),Me(R,"title",T(p).tooltip)}),C(S,R)},w=S=>{var R=ie(),P=K(R);{var A=F=>{var N=Ch(),z=Q(N),I=Q(z,!0);Y(z);var D=ue(z);Y(N),ke(H=>{Tr(N,`
87
- left: ${T(p).bounds.x??""}px;
88
- top: ${T(p).bounds.y??""}px;
89
- width: ${T(p).bounds.width??""}px;
90
- height: ${T(p).bounds.height??""}px;
91
- `),Ge(I,T(p).tooltip),Me(D,"points",H),je(D,0,`cursor-pointer transition-colors ${T(p).isSearchHit?"fill-yellow-400/40 stroke-yellow-400 hover:fill-yellow-400/60":"fill-red-500/20 stroke-red-500 hover:fill-red-500/40"}`)},[()=>T(p).points.map(H=>H.join(",")).join(" ")]),C(F,N)};G(P,F=>{T(p).type==="POLYGON"&&F(A)},!0)}C(S,R)};G(d,S=>{T(p).type==="RECTANGLE"?S(v):S(w,!1)})}C(c,_)}),Y(o),C(a,o),Ue()}let Ao=Symbol("phosphor-svelte");function Ct(){return vl(Ao)?qi(Ao):{}}var Ih=J('<path d="M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z"></path>'),Dh=J('<path d="M160,48V208L80,128Z" opacity="0.2"></path><path d="M163.06,40.61a8,8,0,0,0-8.72,1.73l-80,80a8,8,0,0,0,0,11.32l80,80A8,8,0,0,0,168,208V48A8,8,0,0,0,163.06,40.61ZM152,188.69,91.31,128,152,67.31Z"></path>',1),Oh=J('<path d="M168,48V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,168,48Z"></path>'),Lh=J('<path d="M164.24,203.76a6,6,0,1,1-8.48,8.48l-80-80a6,6,0,0,1,0-8.48l80-80a6,6,0,0,1,8.48,8.48L88.49,128Z"></path>'),Mh=J('<path d="M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z"></path>'),Hh=J('<path d="M162.83,205.17a4,4,0,0,1-5.66,5.66l-80-80a4,4,0,0,1,0-5.66l80-80a4,4,0,1,1,5.66,5.66L85.66,128Z"></path>'),Fh=J('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function Nh(a,r){Ve(r,!0);const e=Ct();let t=Pt(r,["$$slots","$$events","$$legacy","children"]),i=le(()=>r.weight??e.weight??"regular"),n=le(()=>r.color??e.color??"currentColor"),s=le(()=>r.size??e.size??"1em"),h=le(()=>r.mirrored??e.mirrored??!1);function u(d){let{weight:v,color:w,size:S,mirrored:R,...P}=d;return P}var o=Fh();St(o,(d,v)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:T(s),height:T(s),fill:T(n),transform:T(h)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...d,...v}),[()=>u(e),()=>u(t)]);var l=Q(o);{var f=d=>{var v=ie(),w=K(v);bt(w,()=>r.children),C(d,v)};G(l,d=>{r.children&&d(f)})}var c=ue(l,2);{var p=d=>{var v=Ih();C(d,v)},_=d=>{var v=ie(),w=K(v);{var S=P=>{var A=Dh();dt(),C(P,A)},R=P=>{var A=ie(),F=K(A);{var N=I=>{var D=Oh();C(I,D)},z=I=>{var D=ie(),H=K(D);{var k=O=>{var U=Lh();C(O,U)},q=O=>{var U=ie(),te=K(U);{var $=B=>{var W=Mh();C(B,W)},ne=B=>{var W=ie(),de=K(W);{var ce=j=>{var se=Hh();C(j,se)},re=j=>{var se=mt();se.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),C(j,se)};G(de,j=>{T(i)==="thin"?j(ce):j(re,!1)},!0)}C(B,W)};G(te,B=>{T(i)==="regular"?B($):B(ne,!1)},!0)}C(O,U)};G(H,O=>{T(i)==="light"?O(k):O(q,!1)},!0)}C(I,D)};G(F,I=>{T(i)==="fill"?I(N):I(z,!1)},!0)}C(P,A)};G(w,P=>{T(i)==="duotone"?P(S):P(R,!1)},!0)}C(d,v)};G(c,d=>{T(i)==="bold"?d(p):d(_,!1)})}Y(o),C(a,o),Ue()}var Bh=J('<path d="M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"></path>'),zh=J('<path d="M176,128,96,208V48Z" opacity="0.2"></path><path d="M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z"></path>',1),kh=J('<path d="M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z"></path>'),Vh=J('<path d="M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z"></path>'),Uh=J('<path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"></path>'),Gh=J('<path d="M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z"></path>'),jh=J('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function Zh(a,r){Ve(r,!0);const e=Ct();let t=Pt(r,["$$slots","$$events","$$legacy","children"]),i=le(()=>r.weight??e.weight??"regular"),n=le(()=>r.color??e.color??"currentColor"),s=le(()=>r.size??e.size??"1em"),h=le(()=>r.mirrored??e.mirrored??!1);function u(d){let{weight:v,color:w,size:S,mirrored:R,...P}=d;return P}var o=jh();St(o,(d,v)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:T(s),height:T(s),fill:T(n),transform:T(h)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...d,...v}),[()=>u(e),()=>u(t)]);var l=Q(o);{var f=d=>{var v=ie(),w=K(v);bt(w,()=>r.children),C(d,v)};G(l,d=>{r.children&&d(f)})}var c=ue(l,2);{var p=d=>{var v=Bh();C(d,v)},_=d=>{var v=ie(),w=K(v);{var S=P=>{var A=zh();dt(),C(P,A)},R=P=>{var A=ie(),F=K(A);{var N=I=>{var D=kh();C(I,D)},z=I=>{var D=ie(),H=K(D);{var k=O=>{var U=Vh();C(O,U)},q=O=>{var U=ie(),te=K(U);{var $=B=>{var W=Uh();C(B,W)},ne=B=>{var W=ie(),de=K(W);{var ce=j=>{var se=Gh();C(j,se)},re=j=>{var se=mt();se.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),C(j,se)};G(de,j=>{T(i)==="thin"?j(ce):j(re,!1)},!0)}C(B,W)};G(te,B=>{T(i)==="regular"?B($):B(ne,!1)},!0)}C(O,U)};G(H,O=>{T(i)==="light"?O(k):O(q,!1)},!0)}C(I,D)};G(F,I=>{T(i)==="fill"?I(N):I(z,!1)},!0)}C(P,A)};G(w,P=>{T(i)==="duotone"?P(S):P(R,!1)},!0)}C(d,v)};G(c,d=>{T(i)==="bold"?d(p):d(_,!1)})}Y(o),C(a,o),Ue()}const Wh="en";let be=()=>Wh;const qh=()=>"Hello World",Xh=()=>"Search",Yh=()=>"Close Search",Kh=()=>"Search content...",Qh=a=>`No results found for "${a.query}"`,Jh=()=>"Enter a search term to find occurrences within this manifest.",$h=a=>`${a.count} Results`,ec=()=>"Manifest Metadata",tc=()=>"Loading...",ic=()=>"Attribution",rc=()=>"License",nc=()=>"Close",ac=()=>"Menu",sc=()=>"Search",oc=()=>"Toggle Search",lc=()=>"Hide Gallery",uc=()=>"Show Gallery",hc=()=>"Exit Full Screen",cc=()=>"Enter Full Screen",fc=()=>"Hide Annotations",dc=()=>"Show Annotations",pc=()=>"Toggle Annotations",gc=()=>"Metadata",vc=()=>"Toggle Metadata",mc=()=>"Hide All Annotations",_c=()=>"Show All Annotations",yc=a=>`${a.count} Annotations`,wc=a=>`(${a.count} visible)`,Tc=()=>"(No content)",Ec=()=>"No annotations available.",xc=()=>"Previous Canvas",bc=()=>"Next Canvas",Sc=()=>"Docs",Pc=()=>"IIIF Manifest:",Cc=()=>"Enter IIIF manifest URL",Rc=()=>"Load",Ac=()=>"GitHub",Ic=()=>"Hallo Welt",Dc=()=>"Suche",Oc=()=>"Suche schließen",Lc=()=>"Inhalt durchsuchen...",Mc=a=>`Keine Ergebnisse für "${a.query}" gefunden`,Hc=()=>"Geben Sie einen Suchbegriff ein, um Vorkommen in diesem Manifest zu finden.",Fc=a=>`${a.count} Ergebnisse`,Nc=()=>"Manifest-Metadaten",Bc=()=>"Lädt...",zc=()=>"Quellenangabe",kc=()=>"Lizenz",Vc=()=>"Schließen",Uc=()=>"Menü",Gc=()=>"Suche",jc=()=>"Suche umschalten",Zc=()=>"Galerie ausblenden",Wc=()=>"Galerie einblenden",qc=()=>"Vollbildmodus beenden",Xc=()=>"Vollbildmodus",Yc=()=>"Annotationen ausblenden",Kc=()=>"Annotationen einblenden",Qc=()=>"Annotationen umschalten",Jc=()=>"Metadaten",$c=()=>"Metadaten umschalten",ef=()=>"Alle Annotationen ausblenden",tf=()=>"Alle Annotationen einblenden",rf=a=>`${a.count} Annotationen`,nf=a=>`(${a.count} sichtbar)`,af=()=>"(Kein Inhalt)",sf=()=>"Keine Annotationen verfügbar.",of=()=>"Vorheriges Canvas",lf=()=>"Nächstes Canvas",uf=()=>"Doku",hf=()=>"IIIF-Manifest:",cf=()=>"IIIF-Manifest-URL eingeben",ff=()=>"Laden",df=()=>"GitHub",pf=Object.freeze(Object.defineProperty({__proto__:null,annotations_count:(a,r={})=>({de:rf,en:yc})[r.languageTag??be()](a),attribution:(a={},r={})=>({de:zc,en:ic})[r.languageTag??be()](),close:(a={},r={})=>({de:Vc,en:nc})[r.languageTag??be()](),docs:(a={},r={})=>({de:uf,en:Sc})[r.languageTag??be()](),enter_full_screen:(a={},r={})=>({de:Xc,en:cc})[r.languageTag??be()](),exit_full_screen:(a={},r={})=>({de:qc,en:hc})[r.languageTag??be()](),github:(a={},r={})=>({de:df,en:Ac})[r.languageTag??be()](),hello_world:(a={},r={})=>({de:Ic,en:qh})[r.languageTag??be()](),hide_all_annotations:(a={},r={})=>({de:ef,en:mc})[r.languageTag??be()](),hide_annotations:(a={},r={})=>({de:Yc,en:fc})[r.languageTag??be()](),hide_gallery:(a={},r={})=>({de:Zc,en:lc})[r.languageTag??be()](),iiif_manifest_label:(a={},r={})=>({de:hf,en:Pc})[r.languageTag??be()](),license:(a={},r={})=>({de:kc,en:rc})[r.languageTag??be()](),load:(a={},r={})=>({de:ff,en:Rc})[r.languageTag??be()](),loading:(a={},r={})=>({de:Bc,en:tc})[r.languageTag??be()](),manifest_placeholder:(a={},r={})=>({de:cf,en:Cc})[r.languageTag??be()](),menu:(a={},r={})=>({de:Uc,en:ac})[r.languageTag??be()](),metadata:(a={},r={})=>({de:Jc,en:gc})[r.languageTag??be()](),metadata_label_fallback:(a={},r={})=>({de:Nc,en:ec})[r.languageTag??be()](),next_canvas:(a={},r={})=>({de:lf,en:bc})[r.languageTag??be()](),no_annotations_available:(a={},r={})=>({de:sf,en:Ec})[r.languageTag??be()](),no_content:(a={},r={})=>({de:af,en:Tc})[r.languageTag??be()](),previous_canvas:(a={},r={})=>({de:of,en:xc})[r.languageTag??be()](),search:(a={},r={})=>({de:Gc,en:sc})[r.languageTag??be()](),search_panel_close:(a={},r={})=>({de:Oc,en:Yh})[r.languageTag??be()](),search_panel_instruction:(a={},r={})=>({de:Hc,en:Jh})[r.languageTag??be()](),search_panel_no_results:(a,r={})=>({de:Mc,en:Qh})[r.languageTag??be()](a),search_panel_placeholder:(a={},r={})=>({de:Lc,en:Kh})[r.languageTag??be()](),search_panel_results_count:(a,r={})=>({de:Fc,en:$h})[r.languageTag??be()](a),search_panel_title:(a={},r={})=>({de:Dc,en:Xh})[r.languageTag??be()](),show_all_annotations:(a={},r={})=>({de:tf,en:_c})[r.languageTag??be()](),show_annotations:(a={},r={})=>({de:Kc,en:dc})[r.languageTag??be()](),show_gallery:(a={},r={})=>({de:Wc,en:uc})[r.languageTag??be()](),toggle_annotations:(a={},r={})=>({de:Qc,en:pc})[r.languageTag??be()](),toggle_metadata:(a={},r={})=>({de:$c,en:vc})[r.languageTag??be()](),toggle_search:(a={},r={})=>({de:jc,en:oc})[r.languageTag??be()](),visible_count:(a,r={})=>({de:nf,en:wc})[r.languageTag??be()](a)},Symbol.toStringTag,{value:"Module"}));let Io=Pe(Tt(be()));const gf={get current(){return T(Io)}},Re=new Proxy(pf,{get(a,r,e){return T(Io),Reflect.get(a,r,e)}});var vf=Ae('<div><button class="btn btn-circle btn-sm btn-ghost"><!></button> <span class="text-sm font-mono tabular-nums"> </span> <button class="btn btn-circle btn-sm btn-ghost"><!></button></div>');function mf(a,r){Ve(r,!0);var e=vf(),t=Q(e);t.__click=()=>r.viewerState.previousCanvas();var i=Q(t);Nh(i,{size:20,weight:"bold"}),Y(t);var n=ue(t,2),s=Q(n);Y(n);var h=ue(n,2);h.__click=()=>r.viewerState.nextCanvas();var u=Q(h);Zh(u,{size:20,weight:"bold"}),Y(h),Y(e),ke((o,l)=>{je(e,1,`absolute left-1/2 -translate-x-1/2 bg-base-200/90 backdrop-blur rounded-full shadow-lg px-4 py-2 flex items-center gap-4 z-10 border border-base-300 transition-all duration-200 ${r.viewerState.showThumbnailGallery&&r.viewerState.isGalleryDockedBottom?"bottom-40":"bottom-4"}`),t.disabled=!r.viewerState.hasPrevious,Me(t,"aria-label",o),Ge(s,`${r.viewerState.currentCanvasIndex+1} / ${r.viewerState.canvases.length??""}`),h.disabled=!r.viewerState.hasNext,Me(h,"aria-label",l)},[()=>Re.previous_canvas(),()=>Re.next_canvas()]),C(a,e),Ue()}Mi(["click"]);var _f=J('<path d="M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"></path>'),yf=J('<path d="M208,96l-80,80L48,96Z" opacity="0.2"></path><path d="M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"></path>',1),wf=J('<path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"></path>'),Tf=J('<path d="M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"></path>'),Ef=J('<path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"></path>'),xf=J('<path d="M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"></path>'),bf=J('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function Sf(a,r){Ve(r,!0);const e=Ct();let t=Pt(r,["$$slots","$$events","$$legacy","children"]),i=le(()=>r.weight??e.weight??"regular"),n=le(()=>r.color??e.color??"currentColor"),s=le(()=>r.size??e.size??"1em"),h=le(()=>r.mirrored??e.mirrored??!1);function u(d){let{weight:v,color:w,size:S,mirrored:R,...P}=d;return P}var o=bf();St(o,(d,v)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:T(s),height:T(s),fill:T(n),transform:T(h)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...d,...v}),[()=>u(e),()=>u(t)]);var l=Q(o);{var f=d=>{var v=ie(),w=K(v);bt(w,()=>r.children),C(d,v)};G(l,d=>{r.children&&d(f)})}var c=ue(l,2);{var p=d=>{var v=_f();C(d,v)},_=d=>{var v=ie(),w=K(v);{var S=P=>{var A=yf();dt(),C(P,A)},R=P=>{var A=ie(),F=K(A);{var N=I=>{var D=wf();C(I,D)},z=I=>{var D=ie(),H=K(D);{var k=O=>{var U=Tf();C(O,U)},q=O=>{var U=ie(),te=K(U);{var $=B=>{var W=Ef();C(B,W)},ne=B=>{var W=ie(),de=K(W);{var ce=j=>{var se=xf();C(j,se)},re=j=>{var se=mt();se.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),C(j,se)};G(de,j=>{T(i)==="thin"?j(ce):j(re,!1)},!0)}C(B,W)};G(te,B=>{T(i)==="regular"?B($):B(ne,!1)},!0)}C(O,U)};G(H,O=>{T(i)==="light"?O(k):O(q,!1)},!0)}C(I,D)};G(F,I=>{T(i)==="fill"?I(N):I(z,!1)},!0)}C(P,A)};G(w,P=>{T(i)==="duotone"?P(S):P(R,!1)},!0)}C(d,v)};G(c,d=>{T(i)==="bold"?d(p):d(_,!1)})}Y(o),C(a,o),Ue()}var Pf=J('<path d="M251,123.13c-.37-.81-9.13-20.26-28.48-39.61C196.63,57.67,164,44,128,44S59.37,57.67,33.51,83.52C14.16,102.87,5.4,122.32,5,123.13a12.08,12.08,0,0,0,0,9.75c.37.82,9.13,20.26,28.49,39.61C59.37,198.34,92,212,128,212s68.63-13.66,94.48-39.51c19.36-19.35,28.12-38.79,28.49-39.61A12.08,12.08,0,0,0,251,123.13Zm-46.06,33C183.47,177.27,157.59,188,128,188s-55.47-10.73-76.91-31.88A130.36,130.36,0,0,1,29.52,128,130.45,130.45,0,0,1,51.09,99.89C72.54,78.73,98.41,68,128,68s55.46,10.73,76.91,31.89A130.36,130.36,0,0,1,226.48,128,130.45,130.45,0,0,1,204.91,156.12ZM128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,64a20,20,0,1,1,20-20A20,20,0,0,1,128,148Z"></path>'),Cf=J('<path d="M128,56C48,56,16,128,16,128s32,72,112,72,112-72,112-72S208,56,128,56Zm0,112a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z" opacity="0.2"></path><path d="M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.47,133.47,0,0,1,25,128,133.33,133.33,0,0,1,48.07,97.25C70.33,75.19,97.22,64,128,64s57.67,11.19,79.93,33.25A133.46,133.46,0,0,1,231.05,128C223.84,141.46,192.43,192,128,192Zm0-112a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z"></path>',1),Rf=J('<path d="M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z"></path>'),Af=J('<path d="M245.48,125.57c-.34-.78-8.66-19.23-27.24-37.81C201,70.54,171.38,50,128,50S55,70.54,37.76,87.76c-18.58,18.58-26.9,37-27.24,37.81a6,6,0,0,0,0,4.88c.34.77,8.66,19.22,27.24,37.8C55,185.47,84.62,206,128,206s73-20.53,90.24-37.75c18.58-18.58,26.9-37,27.24-37.8A6,6,0,0,0,245.48,125.57ZM128,194c-31.38,0-58.78-11.42-81.45-33.93A134.77,134.77,0,0,1,22.69,128,134.56,134.56,0,0,1,46.55,95.94C69.22,73.42,96.62,62,128,62s58.78,11.42,81.45,33.94A134.56,134.56,0,0,1,233.31,128C226.94,140.21,195,194,128,194Zm0-112a46,46,0,1,0,46,46A46.06,46.06,0,0,0,128,82Zm0,80a34,34,0,1,1,34-34A34,34,0,0,1,128,162Z"></path>'),If=J('<path d="M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.47,133.47,0,0,1,25,128,133.33,133.33,0,0,1,48.07,97.25C70.33,75.19,97.22,64,128,64s57.67,11.19,79.93,33.25A133.46,133.46,0,0,1,231.05,128C223.84,141.46,192.43,192,128,192Zm0-112a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z"></path>'),Df=J('<path d="M243.66,126.38c-.34-.76-8.52-18.89-26.83-37.2C199.87,72.22,170.7,52,128,52S56.13,72.22,39.17,89.18c-18.31,18.31-26.49,36.44-26.83,37.2a4.08,4.08,0,0,0,0,3.25c.34.77,8.52,18.89,26.83,37.2,17,17,46.14,37.17,88.83,37.17s71.87-20.21,88.83-37.17c18.31-18.31,26.49-36.43,26.83-37.2A4.08,4.08,0,0,0,243.66,126.38Zm-32.7,35c-23.07,23-51,34.62-83,34.62s-59.89-11.65-83-34.62A135.71,135.71,0,0,1,20.44,128,135.69,135.69,0,0,1,45,94.62C68.11,71.65,96,60,128,60s59.89,11.65,83,34.62A135.79,135.79,0,0,1,235.56,128,135.71,135.71,0,0,1,211,161.38ZM128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,80a36,36,0,1,1,36-36A36,36,0,0,1,128,164Z"></path>'),Of=J('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function Do(a,r){Ve(r,!0);const e=Ct();let t=Pt(r,["$$slots","$$events","$$legacy","children"]),i=le(()=>r.weight??e.weight??"regular"),n=le(()=>r.color??e.color??"currentColor"),s=le(()=>r.size??e.size??"1em"),h=le(()=>r.mirrored??e.mirrored??!1);function u(d){let{weight:v,color:w,size:S,mirrored:R,...P}=d;return P}var o=Of();St(o,(d,v)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:T(s),height:T(s),fill:T(n),transform:T(h)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...d,...v}),[()=>u(e),()=>u(t)]);var l=Q(o);{var f=d=>{var v=ie(),w=K(v);bt(w,()=>r.children),C(d,v)};G(l,d=>{r.children&&d(f)})}var c=ue(l,2);{var p=d=>{var v=Pf();C(d,v)},_=d=>{var v=ie(),w=K(v);{var S=P=>{var A=Cf();dt(),C(P,A)},R=P=>{var A=ie(),F=K(A);{var N=I=>{var D=Rf();C(I,D)},z=I=>{var D=ie(),H=K(D);{var k=O=>{var U=Af();C(O,U)},q=O=>{var U=ie(),te=K(U);{var $=B=>{var W=If();C(B,W)},ne=B=>{var W=ie(),de=K(W);{var ce=j=>{var se=Df();C(j,se)},re=j=>{var se=mt();se.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),C(j,se)};G(de,j=>{T(i)==="thin"?j(ce):j(re,!1)},!0)}C(B,W)};G(te,B=>{T(i)==="regular"?B($):B(ne,!1)},!0)}C(O,U)};G(H,O=>{T(i)==="light"?O(k):O(q,!1)},!0)}C(I,D)};G(F,I=>{T(i)==="fill"?I(N):I(z,!1)},!0)}C(P,A)};G(w,P=>{T(i)==="duotone"?P(S):P(R,!1)},!0)}C(d,v)};G(c,d=>{T(i)==="bold"?d(p):d(_,!1)})}Y(o),C(a,o),Ue()}var Lf=J('<path d="M56.88,31.93A12,12,0,1,0,39.12,48.07l16,17.65C20.67,88.66,5.72,121.58,5,123.13a12.08,12.08,0,0,0,0,9.75c.37.82,9.13,20.26,28.49,39.61C59.37,198.34,92,212,128,212a131.34,131.34,0,0,0,51-10l20.09,22.1a12,12,0,0,0,17.76-16.14ZM128,188c-29.59,0-55.47-10.73-76.91-31.88A130.69,130.69,0,0,1,29.52,128c5.27-9.31,18.79-29.9,42-44.29l90.09,99.11A109.33,109.33,0,0,1,128,188Zm123-55.12c-.36.81-9,20-28,39.16a12,12,0,1,1-17-16.9A130.48,130.48,0,0,0,226.48,128a130.36,130.36,0,0,0-21.57-28.12C183.46,78.73,157.59,68,128,68c-3.35,0-6.7.14-10,.42a12,12,0,1,1-2-23.91c3.93-.34,8-.51,12-.51,36,0,68.63,13.67,94.49,39.52,19.35,19.35,28.11,38.8,28.48,39.61A12.08,12.08,0,0,1,251,132.88Z"></path>'),Mf=J('<path d="M128,56C48,56,16,128,16,128s32,72,112,72,112-72,112-72S208,56,128,56Zm0,112a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z" opacity="0.2"></path><path d="M53.92,34.62A8,8,0,1,0,42.08,45.38L61.32,66.55C25,88.84,9.38,123.2,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208a127.11,127.11,0,0,0,52.07-10.83l22,24.21a8,8,0,1,0,11.84-10.76Zm47.33,75.84,41.67,45.85a32,32,0,0,1-41.67-45.85ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.16,133.16,0,0,1,25,128c4.69-8.79,19.66-33.39,47.35-49.38l18,19.75a48,48,0,0,0,63.66,70l14.73,16.2A112,112,0,0,1,128,192Zm6-95.43a8,8,0,0,1,3-15.72,48.16,48.16,0,0,1,38.77,42.64,8,8,0,0,1-7.22,8.71,6.39,6.39,0,0,1-.75,0,8,8,0,0,1-8-7.26A32.09,32.09,0,0,0,134,96.57Zm113.28,34.69c-.42.94-10.55,23.37-33.36,43.8a8,8,0,1,1-10.67-11.92A132.77,132.77,0,0,0,231.05,128a133.15,133.15,0,0,0-23.12-30.77C185.67,75.19,158.78,64,128,64a118.37,118.37,0,0,0-19.36,1.57A8,8,0,1,1,106,49.79,134,134,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41A8,8,0,0,1,247.31,131.26Z"></path>',1),Hf=J('<path d="M96.68,57.87a4,4,0,0,1,2.08-6.6A130.13,130.13,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41a8,8,0,0,1,0,6.5c-.35.79-8.82,19.57-27.65,38.4q-4.28,4.26-8.79,8.07a4,4,0,0,1-5.55-.36ZM213.92,210.62a8,8,0,1,1-11.84,10.76L180,197.13A127.21,127.21,0,0,1,128,208c-34.88,0-66.57-13.26-91.66-38.34C17.51,150.83,9,132.05,8.69,131.26a8,8,0,0,1,0-6.5C9,124,17.51,105.18,36.34,86.35a135,135,0,0,1,25-19.78L42.08,45.38A8,8,0,1,1,53.92,34.62Zm-65.49-48.25-52.69-58a40,40,0,0,0,52.69,58Z"></path>'),Ff=J('<path d="M52.44,36A6,6,0,0,0,43.56,44L64.44,67c-37.28,21.9-53.23,57-53.92,58.57a6,6,0,0,0,0,4.88c.34.77,8.66,19.22,27.24,37.8C55,185.47,84.62,206,128,206a124.91,124.91,0,0,0,52.57-11.25l23,25.29a6,6,0,0,0,8.88-8.08Zm48.62,71.32,45,49.52a34,34,0,0,1-45-49.52ZM128,194c-31.38,0-58.78-11.42-81.45-33.93A134.57,134.57,0,0,1,22.69,128c4.29-8.2,20.1-35.18,50-51.91L92.89,98.3a46,46,0,0,0,61.35,67.48l17.81,19.6A113.47,113.47,0,0,1,128,194Zm6.4-99.4a6,6,0,0,1,2.25-11.79,46.17,46.17,0,0,1,37.15,40.87,6,6,0,0,1-5.42,6.53l-.56,0a6,6,0,0,1-6-5.45A34.1,34.1,0,0,0,134.4,94.6Zm111.08,35.85c-.41.92-10.37,23-32.86,43.12a6,6,0,1,1-8-8.94A134.07,134.07,0,0,0,233.31,128a134.67,134.67,0,0,0-23.86-32.07C186.78,73.42,159.38,62,128,62a120.19,120.19,0,0,0-19.69,1.6,6,6,0,1,1-2-11.83A131.12,131.12,0,0,1,128,50c43.38,0,73,20.54,90.24,37.76,18.58,18.58,26.9,37,27.24,37.81A6,6,0,0,1,245.48,130.45Z"></path>'),Nf=J('<path d="M53.92,34.62A8,8,0,1,0,42.08,45.38L61.32,66.55C25,88.84,9.38,123.2,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208a127.11,127.11,0,0,0,52.07-10.83l22,24.21a8,8,0,1,0,11.84-10.76Zm47.33,75.84,41.67,45.85a32,32,0,0,1-41.67-45.85ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.16,133.16,0,0,1,25,128c4.69-8.79,19.66-33.39,47.35-49.38l18,19.75a48,48,0,0,0,63.66,70l14.73,16.2A112,112,0,0,1,128,192Zm6-95.43a8,8,0,0,1,3-15.72,48.16,48.16,0,0,1,38.77,42.64,8,8,0,0,1-7.22,8.71,6.39,6.39,0,0,1-.75,0,8,8,0,0,1-8-7.26A32.09,32.09,0,0,0,134,96.57Zm113.28,34.69c-.42.94-10.55,23.37-33.36,43.8a8,8,0,1,1-10.67-11.92A132.77,132.77,0,0,0,231.05,128a133.15,133.15,0,0,0-23.12-30.77C185.67,75.19,158.78,64,128,64a118.37,118.37,0,0,0-19.36,1.57A8,8,0,1,1,106,49.79,134,134,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41A8,8,0,0,1,247.31,131.26Z"></path>'),Bf=J('<path d="M51,37.31A4,4,0,0,0,45,42.69L67.59,67.5C29.34,89,13,124.81,12.34,126.38a4.08,4.08,0,0,0,0,3.25c.34.77,8.52,18.89,26.83,37.2,17,17,46.14,37.17,88.83,37.17a122.59,122.59,0,0,0,53.06-11.69l24,26.38a4,4,0,1,0,5.92-5.38ZM149.1,157.16A36,36,0,0,1,101,104.22ZM128,196c-32,0-59.89-11.65-83-34.62A135.81,135.81,0,0,1,20.44,128c3.65-7.23,20.09-36.81,52.68-54.43l22.45,24.7a44,44,0,0,0,59,64.83l20.89,23A114.94,114.94,0,0,1,128,196Zm6.78-103.36a4,4,0,0,1,1.49-7.86,44.15,44.15,0,0,1,35.54,39.09,4,4,0,0,1-3.61,4.35l-.38,0a4,4,0,0,1-4-3.63A36.1,36.1,0,0,0,134.78,92.64Zm108.88,37c-.41.91-10.2,22.58-32.38,42.45a4,4,0,0,1-2.67,1,4,4,0,0,1-2.67-7A136.71,136.71,0,0,0,235.56,128,136.07,136.07,0,0,0,211,94.62C187.89,71.65,160,60,128,60a122,122,0,0,0-20,1.63,4,4,0,0,1-1.32-7.89A129.3,129.3,0,0,1,128,52c42.7,0,71.87,20.22,88.83,37.18,18.31,18.31,26.49,36.44,26.83,37.2A4.08,4.08,0,0,1,243.66,129.63Z"></path>'),zf=J('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function Oo(a,r){Ve(r,!0);const e=Ct();let t=Pt(r,["$$slots","$$events","$$legacy","children"]),i=le(()=>r.weight??e.weight??"regular"),n=le(()=>r.color??e.color??"currentColor"),s=le(()=>r.size??e.size??"1em"),h=le(()=>r.mirrored??e.mirrored??!1);function u(d){let{weight:v,color:w,size:S,mirrored:R,...P}=d;return P}var o=zf();St(o,(d,v)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:T(s),height:T(s),fill:T(n),transform:T(h)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...d,...v}),[()=>u(e),()=>u(t)]);var l=Q(o);{var f=d=>{var v=ie(),w=K(v);bt(w,()=>r.children),C(d,v)};G(l,d=>{r.children&&d(f)})}var c=ue(l,2);{var p=d=>{var v=Lf();C(d,v)},_=d=>{var v=ie(),w=K(v);{var S=P=>{var A=Mf();dt(),C(P,A)},R=P=>{var A=ie(),F=K(A);{var N=I=>{var D=Hf();C(I,D)},z=I=>{var D=ie(),H=K(D);{var k=O=>{var U=Ff();C(O,U)},q=O=>{var U=ie(),te=K(U);{var $=B=>{var W=Nf();C(B,W)},ne=B=>{var W=ie(),de=K(W);{var ce=j=>{var se=Bf();C(j,se)},re=j=>{var se=mt();se.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),C(j,se)};G(de,j=>{T(i)==="thin"?j(ce):j(re,!1)},!0)}C(B,W)};G(te,B=>{T(i)==="regular"?B($):B(ne,!1)},!0)}C(O,U)};G(H,O=>{T(i)==="light"?O(k):O(q,!1)},!0)}C(I,D)};G(F,I=>{T(i)==="fill"?I(N):I(z,!1)},!0)}C(P,A)};G(w,P=>{T(i)==="duotone"?P(S):P(R,!1)},!0)}C(d,v)};G(c,d=>{T(i)==="bold"?d(p):d(_,!1)})}Y(o),C(a,o),Ue()}var kf=Ae('<span class="text-xs opacity-50 truncate max-w-[150px]"> </span>'),Vf=Ae('<button class="w-full text-left p-3 hover:bg-base-300 transition-colors cursor-pointer flex gap-3 group/item items-start focus:outline-none focus:bg-base-300"><div class="btn btn-xs btn-circle btn-ghost mt-0.5 shrink-0 pointer-events-none"><!></div> <div class="flex-1 min-w-0"><div class="flex items-start justify-between"><span class="font-bold text-sm text-primary"></span> <!></div> <div><!></div></div></button>'),Uf=Ae('<div class="p-4 text-center opacity-50 text-sm">No annotations available.</div>'),Gf=Ae('<div><details class="group relative"><summary class="flex items-center gap-2 bg-base-200/90 backdrop-blur shadow-lg rounded-full px-4 py-2 cursor-pointer list-none hover:bg-base-200 transition-all select-none border border-base-300 pointer-events-auto"><button class="btn btn-xs btn-circle btn-ghost"><!></button> <span class="text-sm font-medium"> <span class="opacity-50 text-xs font-normal ml-1"> </span></span> <!></summary> <div class="absolute right-0 mt-2 w-96 bg-base-200/95 backdrop-blur shadow-xl rounded-box p-0 max-h-[60vh] overflow-y-auto border border-base-300 flex flex-col divide-y divide-base-300"></div></details></div>');function jf(a,r){Ve(r,!0);const e=qi(er);let t=le(()=>{if(!e.manifestId||!e.canvasId)return[];const c=$i.getAnnotations(e.manifestId,e.canvasId),p=e.currentCanvasSearchAnnotations;return[...c,...p]});function i(c){return c.id||c["@id"]||(typeof c.getId=="function"?c.getId():"")||""}si(()=>{if(T(t).length>0){const c=new Set;T(t).forEach(p=>{const _=i(p);_&&c.add(_)}),e.visibleAnnotationIds=c}else e.visibleAnnotationIds=new Set});let n=le(()=>T(t).length===0?!1:T(t).every(c=>{const p=i(c);return!p||e.visibleAnnotationIds.has(p)}));function s(c){e.visibleAnnotationIds.has(c)?e.visibleAnnotationIds.delete(c):e.visibleAnnotationIds.add(c),e.visibleAnnotationIds=new Set(e.visibleAnnotationIds)}function h(){if(T(n))e.visibleAnnotationIds=new Set;else{const c=new Set;T(t).forEach(p=>{const _=i(p);_&&c.add(_)}),e.visibleAnnotationIds=c}}let u=le(()=>T(t).length?T(t).map(c=>{let p="",_=!1;if(typeof c.getBody=="function"){const d=c.getBody();if(d&&d.length){const v=w=>{const S=w.getValue?w.getValue():null;return S||""};p=d.map(w=>v(w)).filter(Boolean).join(" "),_=d.some(w=>{const S=w.getFormat?w.getFormat():"";return S==="text/html"||S==="application/html"})}if(!p&&typeof c.getLabel=="function"){const v=c.getLabel();v&&(p=v)}}else{const d=w=>w&&(w.chars||w.value||w["cnt:chars"])||"",v=w=>w?w.format==="text/html"||w.type==="TextualBody":!1;if(c.resource?Array.isArray(c.resource)?(p=c.resource.map(w=>d(w)).join(" "),c.resource.some(w=>v(w))&&(_=!0)):(p=d(c.resource),v(c.resource)&&(_=!0)):c.body&&(Array.isArray(c.body)?(p=c.body.map(w=>d(w)).join(" "),c.body.some(w=>v(w))&&(_=!0)):(p=d(c.body),v(c.body)&&(_=!0))),!p){const w=c.label||c.name||c.title;w&&(p=Array.isArray(w)?w.join(" "):w)}}return{id:i(c),content:p,isHtml:_,label:(typeof c.getLabel=="function"?c.getLabel():c.label)||""}}):[]);var o=ie(),l=K(o);{var f=c=>{var p=Gf(),_=Q(p),d=Q(_),v=Q(d);v.__click=D=>{D.preventDefault(),h()};var w=Q(v);{var S=D=>{Do(D,{size:16,weight:"bold"})},R=D=>{Oo(D,{size:16,weight:"bold"})};G(w,D=>{T(n)?D(S):D(R,!1)})}Y(v);var P=ue(v,2),A=Q(P),F=ue(A),N=Q(F,!0);Y(F),Y(P);var z=ue(P,2);Sf(z,{size:16,weight:"bold",class:"group-open:rotate-180 transition-transform opacity-80"}),Y(d);var I=ue(d,2);yr(I,21,()=>T(u),un,(D,H,k)=>{const q=le(()=>e.visibleAnnotationIds.has(T(H).id));var O=Vf();O.__click=De=>{De.preventDefault(),s(T(H).id)};var U=Q(O),te=Q(U);{var $=De=>{Do(De,{size:16,weight:"bold"})},ne=De=>{Oo(De,{size:16,weight:"bold"})};G(te,De=>{T(q)?De($):De(ne,!1)})}Y(U);var B=ue(U,2),W=Q(B),de=Q(W);de.textContent=`#${k+1}`;var ce=ue(de,2);{var re=De=>{var Ke=kf(),ct=Q(Ke,!0);Y(Ke),ke(()=>Ge(ct,T(H).label)),C(De,Ke)};G(ce,De=>{T(H).label&&T(H).label!==T(H).content&&De(re)})}Y(W);var j=ue(W,2),se=Q(j);{var nt=De=>{var Ke=ie(),ct=K(Ke);Hi(ct,()=>T(H).content),C(De,Ke)},We=De=>{var Ke=mt();ke(()=>Ge(Ke,T(H).content||"(No content)")),C(De,Ke)};G(se,De=>{T(H).isHtml?De(nt):De(We,!1)})}Y(j),Y(B),Y(O),ke(()=>je(j,1,`text-sm prose prose-sm max-w-none prose-p:my-0 prose-a:text-blue-500 wrap-break-word text-left ${T(q)?"":"opacity-50"}`)),C(D,O)},D=>{var H=Uf();C(D,H)}),Y(I),Y(_),Y(p),ke((D,H,k)=>{je(p,1,`absolute top-4 z-500 pointer-events-auto transition-all duration-300 ${e.showSearchPanel?e.showThumbnailGallery&&e.isGalleryDockedRight?"right-[536px]":"right-[336px]":e.showThumbnailGallery&&e.isGalleryDockedRight?"right-[216px]":"right-4"}`),Me(v,"title",D),Ge(A,`${H??""} `),Ge(N,k)},[()=>T(n)?Re.hide_all_annotations():Re.show_all_annotations(),()=>Re.annotations_count({count:T(t).length}),()=>Re.visible_count({count:e.visibleAnnotationIds.size})]),C(c,p)};G(l,c=>{e.showAnnotations&&c(f)})}C(a,o),Ue()}Mi(["click"]);var Zf=J('<path d="M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"></path>'),Wf=J('<path d="M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z" opacity="0.2"></path><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>',1),qf=J('<path d="M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>'),Xf=J('<path d="M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"></path>'),Yf=J('<path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>'),Kf=J('<path d="M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"></path>'),Qf=J('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function Jf(a,r){Ve(r,!0);const e=Ct();let t=Pt(r,["$$slots","$$events","$$legacy","children"]),i=le(()=>r.weight??e.weight??"regular"),n=le(()=>r.color??e.color??"currentColor"),s=le(()=>r.size??e.size??"1em"),h=le(()=>r.mirrored??e.mirrored??!1);function u(d){let{weight:v,color:w,size:S,mirrored:R,...P}=d;return P}var o=Qf();St(o,(d,v)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:T(s),height:T(s),fill:T(n),transform:T(h)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...d,...v}),[()=>u(e),()=>u(t)]);var l=Q(o);{var f=d=>{var v=ie(),w=K(v);bt(w,()=>r.children),C(d,v)};G(l,d=>{r.children&&d(f)})}var c=ue(l,2);{var p=d=>{var v=Zf();C(d,v)},_=d=>{var v=ie(),w=K(v);{var S=P=>{var A=Wf();dt(),C(P,A)},R=P=>{var A=ie(),F=K(A);{var N=I=>{var D=qf();C(I,D)},z=I=>{var D=ie(),H=K(D);{var k=O=>{var U=Xf();C(O,U)},q=O=>{var U=ie(),te=K(U);{var $=B=>{var W=Yf();C(B,W)},ne=B=>{var W=ie(),de=K(W);{var ce=j=>{var se=Kf();C(j,se)},re=j=>{var se=mt();se.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),C(j,se)};G(de,j=>{T(i)==="thin"?j(ce):j(re,!1)},!0)}C(B,W)};G(te,B=>{T(i)==="regular"?B($):B(ne,!1)},!0)}C(O,U)};G(H,O=>{T(i)==="light"?O(k):O(q,!1)},!0)}C(I,D)};G(F,I=>{T(i)==="fill"?I(N):I(z,!1)},!0)}C(P,A)};G(w,P=>{T(i)==="duotone"?P(S):P(R,!1)},!0)}C(d,v)};G(c,d=>{T(i)==="bold"?d(p):d(_,!1)})}Y(o),C(a,o),Ue()}var $f=Ae('<img class="object-contain w-full h-full" loading="lazy"/>'),ed=Ae('<span class="opacity-20 text-4xl">?</span>'),td=Ae('<button><div class="aspect-4/3 bg-base-300 rounded overflow-hidden relative w-full flex items-center justify-center"><!></div> <div class="text-xs font-medium truncate w-full opacity-70 group-hover:opacity-100"><span class="font-bold mr-1"> </span> </div></button>'),id=Ae('<div class="absolute bottom-0 right-0 w-6 h-6 cursor-se-resize resize-handle bg-accent hover:bg-accent-focus transition-colors z-50" style="clip-path: polygon(100% 0, 0 100%, 100% 100%);" role="button" tabindex="0" aria-label="Resize"></div>'),rd=Ae('<div role="group"><span class="font-bold text-primary opacity-50">Dock Top</span></div> <div role="group"><span class="font-bold text-primary opacity-50">Dock Bottom</span></div> <div role="group"><span class="font-bold text-primary opacity-50 vertical-rl rotate-180" style="writing-mode: vertical-rl;">Dock Left</span></div> <div role="group"><span class="font-bold text-primary opacity-50 vertical-rl rotate-180" style="writing-mode: vertical-rl;">Dock Right</span></div>',1),nd=Ae('<div><button class="absolute top-1 right-1 btn btn-error btn-xs btn-circle z-20" aria-label="Close Gallery"><!></button> <div><div role="button" tabindex="0" aria-label="Drag Gallery"><div></div></div></div> <div><div></div></div> <!></div> <!>',1);function ad(a,r){Ve(r,!0);const e=qi(er);let t=Pe(Tt({x:20,y:100})),i=Pe(Tt({width:300,height:400})),n=Pe(!1),s=Pe(!1),h={x:0,y:0},u={x:0,y:0,w:0,h:0},o=Pe(void 0),l=le(()=>r.canvases?r.canvases.map((z,I)=>{let D="";try{if(z.getThumbnail){const H=z.getThumbnail();H&&(D=typeof H=="string"?H:H.id||H["@id"])}}catch(H){console.warn("Error getting thumbnail",H)}if(!D){let H=z.getImages();if((!H||!H.length)&&z.getContent&&(H=z.getContent()),H&&H.length>0){const k=H[0];let q=k.getResource?k.getResource():null;if(!q&&k.getBody){const O=k.getBody();Array.isArray(O)&&O.length>0?q=O[0]:O&&(q=O)}if(q&&!q.id&&!q.__jsonld&&(!q.getServices||q.getServices().length===0)&&(q=null),!q){const O=k.__jsonld||k;O.body&&(q=Array.isArray(O.body)?O.body[0]:O.body)}if(q){const U=(()=>{let $=[];if(q.getServices&&($=q.getServices()),!$||$.length===0){const ne=q.__jsonld||q;ne.service&&($=Array.isArray(ne.service)?ne.service:[ne.service])}return $})();let te=!1;if(U.length>0){const $=U[0];let ne="";try{ne=$.getProfile?$.getProfile():$.profile||"",typeof ne=="object"&&ne!==null&&(ne=ne.value||ne.id||ne["@id"]||JSON.stringify(ne))}catch{}const B=String(ne).toLowerCase();(B.includes("level0")||B.includes("level-0"))&&(te=!0);const W=$.id||$["@id"];te||(D=`${W}/full/200,/0/default.jpg`)}if(!D&&(D=q.id||q["@id"],!D)){let $=null;if(k.__jsonld&&k.__jsonld.body?$=k.__jsonld.body:k.body&&($=k.body),$){const ne=Array.isArray($)?$[0]:$;D=ne.id||ne["@id"]}}}}}return{id:z.id,label:z.getLabel().length?z.getLabel()[0].value:`Canvas ${I+1}`,src:D,index:I}}):[]);function f(z){if(!T(n))return;let I=z.clientX-h.x,D=z.clientY-h.y;if(T(o)&&T(o).parentElement){const H=T(o).parentElement,k=Math.max(0,H.clientWidth-T(i).width),q=Math.max(0,H.clientHeight-T(i).height);I=Math.max(0,Math.min(I,k)),D=Math.max(0,Math.min(D,q))}T(t).x=I,T(t).y=D}function c(){const z=T(S);me(n,!1),me(S,null),window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",c),z&&me(w,z,!0)}function p(z){z.stopPropagation(),me(s,!0),u={x:z.clientX,y:z.clientY,w:T(i).width,h:T(i).height},window.addEventListener("mousemove",_),window.addEventListener("mouseup",d)}function _(z){if(!T(s))return;const I=z.clientX-u.x,D=z.clientY-u.y;T(i).width=Math.max(200,u.w+I),T(i).height=Math.max(200,u.h+D)}function d(){me(s,!1),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",d)}function v(z){e.canvasId=z}let w=Pe("bottom"),S=Pe(null);si(()=>{e.dockSide=T(w),e.isGalleryDockedBottom=T(w)==="bottom",e.isGalleryDockedRight=T(w)==="right"});let R=le(()=>T(w)==="top"||T(w)==="bottom"||T(w)==="none"&&T(i).height<320);function P(z){var I,D;if(!z.target.closest(".resize-handle")){if(T(w)!=="none"){me(w,"none");const H=((D=(I=T(o))==null?void 0:I.parentElement)==null?void 0:D.getBoundingClientRect())||{left:0,top:0};me(i,{width:300,height:400},!0),me(t,{x:z.clientX-H.left-150,y:z.clientY-H.top-20},!0)}me(n,!0),h={x:z.clientX-T(t).x,y:z.clientY-T(t).y},window.addEventListener("mousemove",f),window.addEventListener("mouseup",c)}}var A=ie(),F=K(A);{var N=z=>{var I=nd(),D=K(I),H=Q(D);H.__click=()=>e.toggleThumbnailGallery();var k=Q(H);Jf(k,{size:16,weight:"bold"}),Y(H);var q=ue(H,2),O=Q(q);O.__mousedown=P;var U=Q(O);Y(O),Y(q);var te=ue(q,2),$=Q(te);yr($,21,()=>T(l),un,(ce,re)=>{var j=td();j.__click=()=>v(T(re).id);var se=Q(j),nt=Q(se);{var We=It=>{var Wt=$f();ke(()=>{Me(Wt,"src",T(re).src),Me(Wt,"alt",T(re).label)}),C(It,Wt)},De=It=>{var Wt=ed();C(It,Wt)};G(nt,It=>{T(re).src?It(We):It(De,!1)})}Y(se);var Ke=ue(se,2),ct=Q(Ke),wi=Q(ct);Y(ct);var Ui=ue(ct);Y(Ke),Y(j),ke(()=>{je(j,1,`group flex flex-col gap-1 p-1 rounded hover:bg-base-200 transition-colors text-left relative shrink-0 ${T(R)?"w-[140px]":""} ${e.canvasId===T(re).id?"ring-2 ring-primary bg-primary/5":""}`),Me(j,"aria-label",`Select canvas ${T(re).label??""}`),Ge(wi,`${T(re).index+1}.`),Ge(Ui,` ${T(re).label??""}`)}),C(ce,j)}),Y($),Y(te);var ne=ue(te,2);{var B=ce=>{var re=id();re.__mousedown=p,C(ce,re)};G(ne,ce=>{T(w)==="none"&&ce(B)})}Y(D),Ws(D,ce=>me(o,ce),()=>T(o));var W=ue(D,2);{var de=ce=>{var re=rd(),j=K(re),se=ue(j,2),nt=ue(se,2),We=ue(nt,2);ke(()=>{je(j,1,`absolute top-2 left-2 right-2 h-16 rounded-xl border-4 border-dashed border-primary/40 z-950 flex items-center justify-center transition-all duration-200 ${T(S)==="top"?"bg-primary/20 scale-105":"bg-base-100/50"}`),je(se,1,`absolute bottom-2 left-2 right-2 h-16 rounded-xl border-4 border-dashed border-primary/40 z-950 flex items-center justify-center transition-all duration-200 ${T(S)==="bottom"?"bg-primary/20 scale-105":"bg-base-100/50"}`),je(nt,1,`absolute top-2 bottom-2 left-2 w-16 rounded-xl border-4 border-dashed border-primary/40 z-950 flex items-center justify-center transition-all duration-200 ${T(S)==="left"?"bg-primary/20 scale-105":"bg-base-100/50"}`),je(We,1,`absolute top-2 bottom-2 w-16 rounded-xl border-4 border-dashed border-primary/40 z-950 flex items-center justify-center transition-all duration-300 ${e.showSearchPanel?"right-[328px]":"right-2"} ${T(S)==="right"?"bg-primary/20 scale-105":"bg-base-100/50"}`)}),gi("mouseenter",j,()=>me(S,"top")),gi("mouseleave",j,()=>me(S,null)),gi("mouseenter",se,()=>me(S,"bottom")),gi("mouseleave",se,()=>me(S,null)),gi("mouseenter",nt,()=>me(S,"left")),gi("mouseleave",nt,()=>me(S,null)),gi("mouseenter",We,()=>me(S,"right")),gi("mouseleave",We,()=>me(S,null)),C(ce,re)};G(W,ce=>{T(n)&&ce(de)})}ke(()=>{je(D,1,(T(w)!=="none"?`absolute z-900 bg-base-100 shadow-xl border-base-300 flex transition-all duration-200
92
- ${T(w)==="bottom"?"flex-row bottom-0 left-0 right-0 h-[140px] border-t":""}
93
- ${T(w)==="top"?"flex-row top-0 left-0 right-0 h-[140px] border-b":""}
94
- ${T(w)==="left"?"flex-col left-0 top-0 bottom-0 w-[200px] border-r":""}
95
- ${T(w)==="right"?`flex-col top-0 bottom-0 w-[200px] border-l ${e.showSearchPanel?"right-80":"right-0"}`:""}`:"absolute z-900 bg-base-100 shadow-2xl rounded-lg flex flex-col border border-base-300 overflow-hidden")+(T(n)?" pointer-events-none opacity-80":"")),Tr(D,T(w)!=="none"?"":`left: ${T(t).x}px; top: ${T(t).y}px; width: ${T(i).width}px; height: ${T(i).height}px;`),je(q,1,"bg-base-100 flex shrink-0 select-none relative "+(T(w)==="bottom"||T(w)==="top"?"flex-row h-full items-center border-r border-base-200":"flex-col w-full border-b border-base-200")),je(O,1,"cursor-move flex items-center justify-center hover:bg-base-200/50 active:bg-base-200 transition-colors "+(T(w)==="bottom"||T(w)==="top"?"w-8 h-full":"h-6 w-full")),je(U,1,"bg-base-300 rounded-full "+(T(w)==="bottom"||T(w)==="top"?"w-1.5 h-12":"w-12 h-1.5")),je(te,1,`flex-1 p-1 bg-base-100 ${T(R)?"overflow-x-auto overflow-y-hidden":"overflow-y-auto overflow-x-hidden"}`),je($,1,Zn(T(R)?"flex flex-row gap-2 h-full items-center":"grid gap-2")),Tr($,T(R)?"":"grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));")}),C(z,I)};G(F,z=>{e.showThumbnailGallery&&z(N)})}C(a,A),Ue()}Mi(["click","mousedown"]),pl();var sd=J('<path d="M84,100A12,12,0,0,1,96,88h64a12,12,0,0,1,0,24H96A12,12,0,0,1,84,100Zm12,52h64a12,12,0,0,0,0-24H96a12,12,0,0,0,0,24ZM236,56V184a20,20,0,0,1-20,20H157.89l-12.52,21.92a20,20,0,0,1-34.74,0L98.11,204H40a20,20,0,0,1-20-20V56A20,20,0,0,1,40,36H216A20,20,0,0,1,236,56Zm-24,4H44V180h61.07a12,12,0,0,1,10.42,6.05L128,207.94l12.51-21.89A12,12,0,0,1,150.93,180H212Z"></path>'),od=J('<path d="M224,56V184a8,8,0,0,1-8,8H150.93l-16,28a8,8,0,0,1-13.9,0l-16-28H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z" opacity="0.2"></path><path d="M88,104a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,104Zm8,40h64a8,8,0,0,0,0-16H96a8,8,0,0,0,0,16ZM232,56V184a16,16,0,0,1-16,16H155.57l-13.68,23.94a16,16,0,0,1-27.78,0L100.43,200H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Zm-16,0H40V184h65.07a8,8,0,0,1,7,4l16,28,16-28a8,8,0,0,1,7-4H216Z"></path>',1),ld=J('<path d="M216,40H40A16,16,0,0,0,24,56V184a16,16,0,0,0,16,16h60.43l13.68,23.94a16,16,0,0,0,27.78,0L155.57,200H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM160,144H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z"></path>'),ud=J('<path d="M166,104a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,104Zm-6,26H96a6,6,0,0,0,0,12h64a6,6,0,0,0,0-12Zm70-74V184a14,14,0,0,1-14,14H154.41L140.16,223a14,14,0,0,1-24.32,0L101.59,198H40a14,14,0,0,1-14-14V56A14,14,0,0,1,40,42H216A14,14,0,0,1,230,56Zm-12,0a2,2,0,0,0-2-2H40a2,2,0,0,0-2,2V184a2,2,0,0,0,2,2h65.07a6,6,0,0,1,5.21,3l16,28a2,2,0,0,0,3.48,0l16-28a6,6,0,0,1,5.21-3H216a2,2,0,0,0,2-2Z"></path>'),hd=J('<path d="M88,104a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,104Zm8,40h64a8,8,0,0,0,0-16H96a8,8,0,0,0,0,16ZM232,56V184a16,16,0,0,1-16,16H155.57l-13.68,23.94a16,16,0,0,1-27.78,0L100.43,200H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Zm-16,0H40V184h65.07a8,8,0,0,1,7,4l16,28,16-28a8,8,0,0,1,7-4H216Z"></path>'),cd=J('<path d="M164,104a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,104Zm-4,28H96a4,4,0,0,0,0,8h64a4,4,0,0,0,0-8Zm68-76V184a12,12,0,0,1-12,12H153.25L138.42,222a12,12,0,0,1-20.84,0L102.75,196H40a12,12,0,0,1-12-12V56A12,12,0,0,1,40,44H216A12,12,0,0,1,228,56Zm-8,0a4,4,0,0,0-4-4H40a4,4,0,0,0-4,4V184a4,4,0,0,0,4,4h65.07a4,4,0,0,1,3.47,2l16,28a4,4,0,0,0,6.94,0l16-28a4,4,0,0,1,3.47-2H216a4,4,0,0,0,4-4Z"></path>'),fd=J('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function dd(a,r){Ve(r,!0);const e=Ct();let t=Pt(r,["$$slots","$$events","$$legacy","children"]),i=le(()=>r.weight??e.weight??"regular"),n=le(()=>r.color??e.color??"currentColor"),s=le(()=>r.size??e.size??"1em"),h=le(()=>r.mirrored??e.mirrored??!1);function u(d){let{weight:v,color:w,size:S,mirrored:R,...P}=d;return P}var o=fd();St(o,(d,v)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:T(s),height:T(s),fill:T(n),transform:T(h)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...d,...v}),[()=>u(e),()=>u(t)]);var l=Q(o);{var f=d=>{var v=ie(),w=K(v);bt(w,()=>r.children),C(d,v)};G(l,d=>{r.children&&d(f)})}var c=ue(l,2);{var p=d=>{var v=sd();C(d,v)},_=d=>{var v=ie(),w=K(v);{var S=P=>{var A=od();dt(),C(P,A)},R=P=>{var A=ie(),F=K(A);{var N=I=>{var D=ld();C(I,D)},z=I=>{var D=ie(),H=K(D);{var k=O=>{var U=ud();C(O,U)},q=O=>{var U=ie(),te=K(U);{var $=B=>{var W=hd();C(B,W)},ne=B=>{var W=ie(),de=K(W);{var ce=j=>{var se=cd();C(j,se)},re=j=>{var se=mt();se.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),C(j,se)};G(de,j=>{T(i)==="thin"?j(ce):j(re,!1)},!0)}C(B,W)};G(te,B=>{T(i)==="regular"?B($):B(ne,!1)},!0)}C(O,U)};G(H,O=>{T(i)==="light"?O(k):O(q,!1)},!0)}C(I,D)};G(F,I=>{T(i)==="fill"?I(N):I(z,!1)},!0)}C(P,A)};G(w,P=>{T(i)==="duotone"?P(S):P(R,!1)},!0)}C(d,v)};G(c,d=>{T(i)==="bold"?d(p):d(_,!1)})}Y(o),C(a,o),Ue()}var pd=J('<path d="M148,96V48a12,12,0,0,1,24,0V84h36a12,12,0,0,1,0,24H160A12,12,0,0,1,148,96ZM96,148H48a12,12,0,0,0,0,24H84v36a12,12,0,0,0,24,0V160A12,12,0,0,0,96,148Zm112,0H160a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V172h36a12,12,0,0,0,0-24ZM96,36A12,12,0,0,0,84,48V84H48a12,12,0,0,0,0,24H96a12,12,0,0,0,12-12V48A12,12,0,0,0,96,36Z"></path>'),gd=J('<path d="M208,64V192a16,16,0,0,1-16,16H64a16,16,0,0,1-16-16V64A16,16,0,0,1,64,48H192A16,16,0,0,1,208,64Z" opacity="0.2"></path><path d="M152,96V48a8,8,0,0,1,16,0V88h40a8,8,0,0,1,0,16H160A8,8,0,0,1,152,96ZM96,152H48a8,8,0,0,0,0,16H88v40a8,8,0,0,0,16,0V160A8,8,0,0,0,96,152Zm112,0H160a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V168h40a8,8,0,0,0,0-16ZM96,40a8,8,0,0,0-8,8V88H48a8,8,0,0,0,0,16H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z"></path>',1),vd=J('<path d="M152,96V48a8,8,0,0,1,13.66-5.66l48,48A8,8,0,0,1,208,104H160A8,8,0,0,1,152,96ZM96,152H48a8,8,0,0,0-5.66,13.66l48,48A8,8,0,0,0,104,208V160A8,8,0,0,0,96,152ZM99.06,40.61a8,8,0,0,0-8.72,1.73l-48,48A8,8,0,0,0,48,104H96a8,8,0,0,0,8-8V48A8,8,0,0,0,99.06,40.61ZM208,152H160a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66l48-48A8,8,0,0,0,208,152Z"></path>'),md=J('<path d="M154,96V48a6,6,0,0,1,12,0V90h42a6,6,0,0,1,0,12H160A6,6,0,0,1,154,96ZM96,154H48a6,6,0,0,0,0,12H90v42a6,6,0,0,0,12,0V160A6,6,0,0,0,96,154Zm112,0H160a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V166h42a6,6,0,0,0,0-12ZM96,42a6,6,0,0,0-6,6V90H48a6,6,0,0,0,0,12H96a6,6,0,0,0,6-6V48A6,6,0,0,0,96,42Z"></path>'),_d=J('<path d="M152,96V48a8,8,0,0,1,16,0V88h40a8,8,0,0,1,0,16H160A8,8,0,0,1,152,96ZM96,152H48a8,8,0,0,0,0,16H88v40a8,8,0,0,0,16,0V160A8,8,0,0,0,96,152Zm112,0H160a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V168h40a8,8,0,0,0,0-16ZM96,40a8,8,0,0,0-8,8V88H48a8,8,0,0,0,0,16H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z"></path>'),yd=J('<path d="M156,96V48a4,4,0,0,1,8,0V92h44a4,4,0,0,1,0,8H160A4,4,0,0,1,156,96ZM96,156H48a4,4,0,0,0,0,8H92v44a4,4,0,0,0,8,0V160A4,4,0,0,0,96,156Zm112,0H160a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V164h44a4,4,0,0,0,0-8ZM96,44a4,4,0,0,0-4,4V92H48a4,4,0,0,0,0,8H96a4,4,0,0,0,4-4V48A4,4,0,0,0,96,44Z"></path>'),wd=J('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function Td(a,r){Ve(r,!0);const e=Ct();let t=Pt(r,["$$slots","$$events","$$legacy","children"]),i=le(()=>r.weight??e.weight??"regular"),n=le(()=>r.color??e.color??"currentColor"),s=le(()=>r.size??e.size??"1em"),h=le(()=>r.mirrored??e.mirrored??!1);function u(d){let{weight:v,color:w,size:S,mirrored:R,...P}=d;return P}var o=wd();St(o,(d,v)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:T(s),height:T(s),fill:T(n),transform:T(h)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...d,...v}),[()=>u(e),()=>u(t)]);var l=Q(o);{var f=d=>{var v=ie(),w=K(v);bt(w,()=>r.children),C(d,v)};G(l,d=>{r.children&&d(f)})}var c=ue(l,2);{var p=d=>{var v=pd();C(d,v)},_=d=>{var v=ie(),w=K(v);{var S=P=>{var A=gd();dt(),C(P,A)},R=P=>{var A=ie(),F=K(A);{var N=I=>{var D=vd();C(I,D)},z=I=>{var D=ie(),H=K(D);{var k=O=>{var U=md();C(O,U)},q=O=>{var U=ie(),te=K(U);{var $=B=>{var W=_d();C(B,W)},ne=B=>{var W=ie(),de=K(W);{var ce=j=>{var se=yd();C(j,se)},re=j=>{var se=mt();se.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),C(j,se)};G(de,j=>{T(i)==="thin"?j(ce):j(re,!1)},!0)}C(B,W)};G(te,B=>{T(i)==="regular"?B($):B(ne,!1)},!0)}C(O,U)};G(H,O=>{T(i)==="light"?O(k):O(q,!1)},!0)}C(I,D)};G(F,I=>{T(i)==="fill"?I(N):I(z,!1)},!0)}C(P,A)};G(w,P=>{T(i)==="duotone"?P(S):P(R,!1)},!0)}C(d,v)};G(c,d=>{T(i)==="bold"?d(p):d(_,!1)})}Y(o),C(a,o),Ue()}var Ed=J('<path d="M220,48V88a12,12,0,0,1-24,0V60H168a12,12,0,0,1,0-24h40A12,12,0,0,1,220,48ZM88,196H60V168a12,12,0,0,0-24,0v40a12,12,0,0,0,12,12H88a12,12,0,0,0,0-24Zm120-40a12,12,0,0,0-12,12v28H168a12,12,0,0,0,0,24h40a12,12,0,0,0,12-12V168A12,12,0,0,0,208,156ZM88,36H48A12,12,0,0,0,36,48V88a12,12,0,0,0,24,0V60H88a12,12,0,0,0,0-24Z"></path>'),xd=J('<path d="M208,48V208H48V48Z" opacity="0.2"></path><path d="M216,48V88a8,8,0,0,1-16,0V56H168a8,8,0,0,1,0-16h40A8,8,0,0,1,216,48ZM88,200H56V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H88a8,8,0,0,0,0-16Zm120-40a8,8,0,0,0-8,8v32H168a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,208,160ZM88,40H48a8,8,0,0,0-8,8V88a8,8,0,0,0,16,0V56H88a8,8,0,0,0,0-16Z"></path>',1),bd=J('<path d="M93.66,202.34A8,8,0,0,1,88,216H48a8,8,0,0,1-8-8V168a8,8,0,0,1,13.66-5.66ZM88,40H48a8,8,0,0,0-8,8V88a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,88,40ZM211.06,160.61a8,8,0,0,0-8.72,1.73l-40,40A8,8,0,0,0,168,216h40a8,8,0,0,0,8-8V168A8,8,0,0,0,211.06,160.61ZM208,40H168a8,8,0,0,0-5.66,13.66l40,40A8,8,0,0,0,216,88V48A8,8,0,0,0,208,40Z"></path>'),Sd=J('<path d="M214,48V88a6,6,0,0,1-12,0V54H168a6,6,0,0,1,0-12h40A6,6,0,0,1,214,48ZM88,202H54V168a6,6,0,0,0-12,0v40a6,6,0,0,0,6,6H88a6,6,0,0,0,0-12Zm120-40a6,6,0,0,0-6,6v34H168a6,6,0,0,0,0,12h40a6,6,0,0,0,6-6V168A6,6,0,0,0,208,162ZM88,42H48a6,6,0,0,0-6,6V88a6,6,0,0,0,12,0V54H88a6,6,0,0,0,0-12Z"></path>'),Pd=J('<path d="M216,48V88a8,8,0,0,1-16,0V56H168a8,8,0,0,1,0-16h40A8,8,0,0,1,216,48ZM88,200H56V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H88a8,8,0,0,0,0-16Zm120-40a8,8,0,0,0-8,8v32H168a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,208,160ZM88,40H48a8,8,0,0,0-8,8V88a8,8,0,0,0,16,0V56H88a8,8,0,0,0,0-16Z"></path>'),Cd=J('<path d="M212,48V88a4,4,0,0,1-8,0V52H168a4,4,0,0,1,0-8h40A4,4,0,0,1,212,48ZM88,204H52V168a4,4,0,0,0-8,0v40a4,4,0,0,0,4,4H88a4,4,0,0,0,0-8Zm120-40a4,4,0,0,0-4,4v36H168a4,4,0,0,0,0,8h40a4,4,0,0,0,4-4V168A4,4,0,0,0,208,164ZM88,44H48a4,4,0,0,0-4,4V88a4,4,0,0,0,8,0V52H88a4,4,0,0,0,0-8Z"></path>'),Rd=J('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function Ad(a,r){Ve(r,!0);const e=Ct();let t=Pt(r,["$$slots","$$events","$$legacy","children"]),i=le(()=>r.weight??e.weight??"regular"),n=le(()=>r.color??e.color??"currentColor"),s=le(()=>r.size??e.size??"1em"),h=le(()=>r.mirrored??e.mirrored??!1);function u(d){let{weight:v,color:w,size:S,mirrored:R,...P}=d;return P}var o=Rd();St(o,(d,v)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:T(s),height:T(s),fill:T(n),transform:T(h)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...d,...v}),[()=>u(e),()=>u(t)]);var l=Q(o);{var f=d=>{var v=ie(),w=K(v);bt(w,()=>r.children),C(d,v)};G(l,d=>{r.children&&d(f)})}var c=ue(l,2);{var p=d=>{var v=Ed();C(d,v)},_=d=>{var v=ie(),w=K(v);{var S=P=>{var A=xd();dt(),C(P,A)},R=P=>{var A=ie(),F=K(A);{var N=I=>{var D=bd();C(I,D)},z=I=>{var D=ie(),H=K(D);{var k=O=>{var U=Sd();C(O,U)},q=O=>{var U=ie(),te=K(U);{var $=B=>{var W=Pd();C(B,W)},ne=B=>{var W=ie(),de=K(W);{var ce=j=>{var se=Cd();C(j,se)},re=j=>{var se=mt();se.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),C(j,se)};G(de,j=>{T(i)==="thin"?j(ce):j(re,!1)},!0)}C(B,W)};G(te,B=>{T(i)==="regular"?B($):B(ne,!1)},!0)}C(O,U)};G(H,O=>{T(i)==="light"?O(k):O(q,!1)},!0)}C(I,D)};G(F,I=>{T(i)==="fill"?I(N):I(z,!1)},!0)}C(P,A)};G(w,P=>{T(i)==="duotone"?P(S):P(R,!1)},!0)}C(d,v)};G(c,d=>{T(i)==="bold"?d(p):d(_,!1)})}Y(o),C(a,o),Ue()}var Id=J('<path d="M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z"></path>'),Dd=J('<path d="M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z" opacity="0.2"></path><path d="M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z"></path>',1),Od=J('<path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z"></path>'),Ld=J('<path d="M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"></path>'),Md=J('<path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"></path>'),Hd=J('<path d="M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"></path>'),Fd=J('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function Nd(a,r){Ve(r,!0);const e=Ct();let t=Pt(r,["$$slots","$$events","$$legacy","children"]),i=le(()=>r.weight??e.weight??"regular"),n=le(()=>r.color??e.color??"currentColor"),s=le(()=>r.size??e.size??"1em"),h=le(()=>r.mirrored??e.mirrored??!1);function u(d){let{weight:v,color:w,size:S,mirrored:R,...P}=d;return P}var o=Fd();St(o,(d,v)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:T(s),height:T(s),fill:T(n),transform:T(h)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...d,...v}),[()=>u(e),()=>u(t)]);var l=Q(o);{var f=d=>{var v=ie(),w=K(v);bt(w,()=>r.children),C(d,v)};G(l,d=>{r.children&&d(f)})}var c=ue(l,2);{var p=d=>{var v=Id();C(d,v)},_=d=>{var v=ie(),w=K(v);{var S=P=>{var A=Dd();dt(),C(P,A)},R=P=>{var A=ie(),F=K(A);{var N=I=>{var D=Od();C(I,D)},z=I=>{var D=ie(),H=K(D);{var k=O=>{var U=Ld();C(O,U)},q=O=>{var U=ie(),te=K(U);{var $=B=>{var W=Md();C(B,W)},ne=B=>{var W=ie(),de=K(W);{var ce=j=>{var se=Hd();C(j,se)},re=j=>{var se=mt();se.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),C(j,se)};G(de,j=>{T(i)==="thin"?j(ce):j(re,!1)},!0)}C(B,W)};G(te,B=>{T(i)==="regular"?B($):B(ne,!1)},!0)}C(O,U)};G(H,O=>{T(i)==="light"?O(k):O(q,!1)},!0)}C(I,D)};G(F,I=>{T(i)==="fill"?I(N):I(z,!1)},!0)}C(P,A)};G(w,P=>{T(i)==="duotone"?P(S):P(R,!1)},!0)}C(d,v)};G(c,d=>{T(i)==="bold"?d(p):d(_,!1)})}Y(o),C(a,o),Ue()}var Bd=J('<path d="M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z"></path>'),zd=J('<path d="M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z" opacity="0.2"></path><path d="M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"></path>',1),kd=J('<path d="M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"></path>'),Vd=J('<path d="M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z"></path>'),Ud=J('<path d="M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"></path>'),Gd=J('<path d="M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z"></path>'),jd=J('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function Lo(a,r){Ve(r,!0);const e=Ct();let t=Pt(r,["$$slots","$$events","$$legacy","children"]),i=le(()=>r.weight??e.weight??"regular"),n=le(()=>r.color??e.color??"currentColor"),s=le(()=>r.size??e.size??"1em"),h=le(()=>r.mirrored??e.mirrored??!1);function u(d){let{weight:v,color:w,size:S,mirrored:R,...P}=d;return P}var o=jd();St(o,(d,v)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:T(s),height:T(s),fill:T(n),transform:T(h)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...d,...v}),[()=>u(e),()=>u(t)]);var l=Q(o);{var f=d=>{var v=ie(),w=K(v);bt(w,()=>r.children),C(d,v)};G(l,d=>{r.children&&d(f)})}var c=ue(l,2);{var p=d=>{var v=Bd();C(d,v)},_=d=>{var v=ie(),w=K(v);{var S=P=>{var A=zd();dt(),C(P,A)},R=P=>{var A=ie(),F=K(A);{var N=I=>{var D=kd();C(I,D)},z=I=>{var D=ie(),H=K(D);{var k=O=>{var U=Vd();C(O,U)},q=O=>{var U=ie(),te=K(U);{var $=B=>{var W=Ud();C(B,W)},ne=B=>{var W=ie(),de=K(W);{var ce=j=>{var se=Gd();C(j,se)},re=j=>{var se=mt();se.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),C(j,se)};G(de,j=>{T(i)==="thin"?j(ce):j(re,!1)},!0)}C(B,W)};G(te,B=>{T(i)==="regular"?B($):B(ne,!1)},!0)}C(O,U)};G(H,O=>{T(i)==="light"?O(k):O(q,!1)},!0)}C(I,D)};G(F,I=>{T(i)==="fill"?I(N):I(z,!1)},!0)}C(P,A)};G(w,P=>{T(i)==="duotone"?P(S):P(R,!1)},!0)}C(d,v)};G(c,d=>{T(i)==="bold"?d(p):d(_,!1)})}Y(o),C(a,o),Ue()}var Zd=J('<path d="M228,128a12,12,0,0,1-12,12H40a12,12,0,0,1,0-24H216A12,12,0,0,1,228,128ZM40,76H216a12,12,0,0,0,0-24H40a12,12,0,0,0,0,24ZM216,180H40a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Z"></path>'),Wd=J('<path d="M216,64V192H40V64Z" opacity="0.2"></path><path d="M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM40,72H216a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"></path>',1),qd=J('<path d="M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM192,184H64a8,8,0,0,1,0-16H192a8,8,0,0,1,0,16Zm0-48H64a8,8,0,0,1,0-16H192a8,8,0,0,1,0,16Zm0-48H64a8,8,0,0,1,0-16H192a8,8,0,0,1,0,16Z"></path>'),Xd=J('<path d="M222,128a6,6,0,0,1-6,6H40a6,6,0,0,1,0-12H216A6,6,0,0,1,222,128ZM40,70H216a6,6,0,0,0,0-12H40a6,6,0,0,0,0,12ZM216,186H40a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12Z"></path>'),Yd=J('<path d="M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM40,72H216a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"></path>'),Kd=J('<path d="M220,128a4,4,0,0,1-4,4H40a4,4,0,0,1,0-8H216A4,4,0,0,1,220,128ZM40,68H216a4,4,0,0,0,0-8H40a4,4,0,0,0,0,8ZM216,188H40a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8Z"></path>'),Qd=J('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function Jd(a,r){Ve(r,!0);const e=Ct();let t=Pt(r,["$$slots","$$events","$$legacy","children"]),i=le(()=>r.weight??e.weight??"regular"),n=le(()=>r.color??e.color??"currentColor"),s=le(()=>r.size??e.size??"1em"),h=le(()=>r.mirrored??e.mirrored??!1);function u(d){let{weight:v,color:w,size:S,mirrored:R,...P}=d;return P}var o=Qd();St(o,(d,v)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:T(s),height:T(s),fill:T(n),transform:T(h)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...d,...v}),[()=>u(e),()=>u(t)]);var l=Q(o);{var f=d=>{var v=ie(),w=K(v);bt(w,()=>r.children),C(d,v)};G(l,d=>{r.children&&d(f)})}var c=ue(l,2);{var p=d=>{var v=Zd();C(d,v)},_=d=>{var v=ie(),w=K(v);{var S=P=>{var A=Wd();dt(),C(P,A)},R=P=>{var A=ie(),F=K(A);{var N=I=>{var D=qd();C(I,D)},z=I=>{var D=ie(),H=K(D);{var k=O=>{var U=Xd();C(O,U)},q=O=>{var U=ie(),te=K(U);{var $=B=>{var W=Yd();C(B,W)},ne=B=>{var W=ie(),de=K(W);{var ce=j=>{var se=Kd();C(j,se)},re=j=>{var se=mt();se.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),C(j,se)};G(de,j=>{T(i)==="thin"?j(ce):j(re,!1)},!0)}C(B,W)};G(te,B=>{T(i)==="regular"?B($):B(ne,!1)},!0)}C(O,U)};G(H,O=>{T(i)==="light"?O(k):O(q,!1)},!0)}C(I,D)};G(F,I=>{T(i)==="fill"?I(N):I(z,!1)},!0)}C(P,A)};G(w,P=>{T(i)==="duotone"?P(S):P(R,!1)},!0)}C(d,v)};G(c,d=>{T(i)==="bold"?d(p):d(_,!1)})}Y(o),C(a,o),Ue()}var $d=J('<path d="M184,44H72A20,20,0,0,0,52,64V192a20,20,0,0,0,20,20H184a20,20,0,0,0,20-20V64A20,20,0,0,0,184,44Zm-4,144H76V68H180ZM244,56V200a12,12,0,0,1-24,0V56a12,12,0,0,1,24,0ZM36,56V200a12,12,0,0,1-24,0V56a12,12,0,0,1,24,0Z"></path>'),ep=J('<path d="M200,64V192a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H192A8,8,0,0,1,200,64Z" opacity="0.2"></path><path d="M192,48H64A16,16,0,0,0,48,64V192a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64A16,16,0,0,0,192,48Zm0,144H64V64H192V192ZM240,56V200a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0ZM32,56V200a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0Z"></path>',1),tp=J('<path d="M208,64V192a16,16,0,0,1-16,16H64a16,16,0,0,1-16-16V64A16,16,0,0,1,64,48H192A16,16,0,0,1,208,64Zm24-16a8,8,0,0,0-8,8V200a8,8,0,0,0,16,0V56A8,8,0,0,0,232,48ZM24,48a8,8,0,0,0-8,8V200a8,8,0,0,0,16,0V56A8,8,0,0,0,24,48Z"></path>'),ip=J('<path d="M192,50H64A14,14,0,0,0,50,64V192a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V64A14,14,0,0,0,192,50Zm2,142a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V64a2,2,0,0,1,2-2H192a2,2,0,0,1,2,2ZM238,56V200a6,6,0,0,1-12,0V56a6,6,0,0,1,12,0ZM30,56V200a6,6,0,0,1-12,0V56a6,6,0,0,1,12,0Z"></path>'),rp=J('<path d="M192,48H64A16,16,0,0,0,48,64V192a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64A16,16,0,0,0,192,48Zm0,144H64V64H192V192ZM240,56V200a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0ZM32,56V200a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0Z"></path>'),np=J('<path d="M192,52H64A12,12,0,0,0,52,64V192a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V64A12,12,0,0,0,192,52Zm4,140a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H192a4,4,0,0,1,4,4ZM236,56V200a4,4,0,0,1-8,0V56a4,4,0,0,1,8,0ZM28,56V200a4,4,0,0,1-8,0V56a4,4,0,0,1,8,0Z"></path>'),ap=J('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function sp(a,r){Ve(r,!0);const e=Ct();let t=Pt(r,["$$slots","$$events","$$legacy","children"]),i=le(()=>r.weight??e.weight??"regular"),n=le(()=>r.color??e.color??"currentColor"),s=le(()=>r.size??e.size??"1em"),h=le(()=>r.mirrored??e.mirrored??!1);function u(d){let{weight:v,color:w,size:S,mirrored:R,...P}=d;return P}var o=ap();St(o,(d,v)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:T(s),height:T(s),fill:T(n),transform:T(h)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...d,...v}),[()=>u(e),()=>u(t)]);var l=Q(o);{var f=d=>{var v=ie(),w=K(v);bt(w,()=>r.children),C(d,v)};G(l,d=>{r.children&&d(f)})}var c=ue(l,2);{var p=d=>{var v=$d();C(d,v)},_=d=>{var v=ie(),w=K(v);{var S=P=>{var A=ep();dt(),C(P,A)},R=P=>{var A=ie(),F=K(A);{var N=I=>{var D=tp();C(I,D)},z=I=>{var D=ie(),H=K(D);{var k=O=>{var U=ip();C(O,U)},q=O=>{var U=ie(),te=K(U);{var $=B=>{var W=rp();C(B,W)},ne=B=>{var W=ie(),de=K(W);{var ce=j=>{var se=np();C(j,se)},re=j=>{var se=mt();se.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),C(j,se)};G(de,j=>{T(i)==="thin"?j(ce):j(re,!1)},!0)}C(B,W)};G(te,B=>{T(i)==="regular"?B($):B(ne,!1)},!0)}C(O,U)};G(H,O=>{T(i)==="light"?O(k):O(q,!1)},!0)}C(I,D)};G(F,I=>{T(i)==="fill"?I(N):I(z,!1)},!0)}C(P,A)};G(w,P=>{T(i)==="duotone"?P(S):P(R,!1)},!0)}C(d,v)};G(c,d=>{T(i)==="bold"?d(p):d(_,!1)})}Y(o),C(a,o),Ue()}var op=Ae('<div><div tabindex="0" role="button" class="btn btn-lg btn-primary btn-circle shadow-xl"><span class="sr-only"> </span> <!></div> <div class="fab-close tooltip tooltip-top"><button><!></button></div> <div class="tooltip tooltip-left"><button><!></button></div> <div class="tooltip tooltip-left"><button><!></button></div> <div class="tooltip tooltip-top"><button><!></button></div> <div class="tooltip tooltip-top"><button><!></button></div></div>');function lp(a,r){Ve(r,!1);const e=qi(er);du();var t=op(),i=Q(t),n=Q(i),s=Q(n,!0);Y(n);var h=ue(n,2);Jd(h,{size:32,weight:"bold"}),Y(i);var u=ue(i,2),o=Q(u);o.__click=()=>e.toggleSearchPanel();var l=Q(o);Lo(l,{size:28,weight:"bold"}),Y(o),Y(u);var f=ue(u,2),c=Q(f);c.__click=()=>e.toggleThumbnailGallery();var p=Q(c);sp(p,{size:28,weight:"bold"}),Y(c),Y(f);var _=ue(f,2),d=Q(_);d.__click=()=>e.toggleFullScreen();var v=Q(d);{var w=I=>{Td(I,{size:28,weight:"bold"})},S=I=>{Ad(I,{size:28,weight:"bold"})};G(v,I=>{e.isFullScreen?I(w):I(S,!1)})}Y(d),Y(_);var R=ue(_,2),P=Q(R);P.__click=()=>e.toggleAnnotations();var A=Q(P);dd(A,{size:28,weight:"bold"}),Y(P),Y(R);var F=ue(R,2),N=Q(F);N.__click=()=>e.toggleMetadataDialog();var z=Q(N);Nd(z,{size:28,weight:"bold"}),Y(N),Y(F),Y(t),ke((I,D,H,k,q,O,U,te,$,ne,B)=>{je(t,1,`fab fab-flower fab-top-left absolute z-600 pointer-events-auto flex-col items-end transition-all duration-300 ${e.showSearchPanel?e.showThumbnailGallery&&e.isGalleryDockedRight?"right-[540px]":"right-[344px]":e.showThumbnailGallery&&e.isGalleryDockedRight?"right-[220px]":"right-6"} ${e.showThumbnailGallery&&e.dockSide==="bottom"?"bottom-40":"bottom-6"}`),Me(t,"data-tip",I),Ge(s,D),Me(u,"data-tip",H),Me(o,"aria-label",k),je(o,1,Zn(["btn btn-circle btn-lg shadow-lg",e.showSearchPanel&&"btn-primary",!e.showSearchPanel&&"btn-neutral"])),Me(f,"data-tip",q),Me(c,"aria-label",O),je(c,1,`btn btn-lg btn-circle shadow-lg ${e.showThumbnailGallery?"btn-info":"btn-neutral"}`),Me(_,"data-tip",U),je(d,1,`btn btn-circle btn-lg shadow-lg transition-all duration-300 ease-out ${e.isFullScreen?"btn-warning":"btn-neutral"}`),Me(R,"data-tip",te),Me(P,"aria-label",$),je(P,1,`btn btn-lg btn-circle shadow-lg ${e.showAnnotations?"btn-error":"btn-neutral"}`),Me(F,"data-tip",ne),Me(N,"aria-label",B),je(N,1,`btn btn-lg btn-circle shadow-lg ${e.showMetadataDialog?"btn-info":"btn-neutral"}`)},[()=>Re.menu(),()=>Re.menu(),()=>Re.search(),()=>Re.toggle_search(),()=>e.showThumbnailGallery?Re.hide_gallery():Re.show_gallery(),()=>e.showThumbnailGallery?Re.hide_gallery():Re.show_gallery(),()=>e.isFullScreen?Re.exit_full_screen():Re.enter_full_screen(),()=>e.showAnnotations?Re.hide_annotations():Re.show_annotations(),()=>Re.toggle_annotations(),()=>Re.metadata(),()=>Re.toggle_metadata()]),C(a,t),Ue()}Mi(["click"]);var up=Ae('<div class="mb-6 prose"><p><!></p></div>'),hp=Ae('<dt class="font-bold text-lg opacity-70 mt-6"> </dt> <dd class="text-sm ps-2"><!></dd>',1),cp=Ae('<dt class="font-bold text-lg opacity-70 mt-6"> </dt> <dd class="text-sm ps-2"><a target="_blank" rel="noreferrer" class="link link-primary break-all"> </a></dd>',1),fp=Ae('<dt class="font-bold text-lg opacity-70 mt-6"> </dt> <dd class="text-sm ps-2"><!></dd>',1),dp=Ae('<dialog class="modal"><div class="modal-box w-11/12 max-w-5xl"><form method="dialog"><button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</button></form> <h3 class="font-bold text-lg mb-4"> </h3> <div class="py-4 overflow-y-auto max-h-[70vh]"><!> <dl class="grid grid-cols-1 md:grid-cols-[200px_1fr]"><!> <!> <!></dl></div> <div class="modal-action"><form method="dialog"><button class="btn"> </button></form></div></div> <form method="dialog" class="modal-backdrop"><button> </button></form></dialog>');function pp(a,r){Ve(r,!0);const e=qi(er);let t=le(()=>e.manifest),i=le(()=>{const O=gf.current;if(!T(t))return[];const U=T(t).getMetadata();return U?U.map(te=>{let $="",ne="";const B=W=>{if(typeof W=="string")return W;if(Array.isArray(W)){let de=W.find(ce=>ce.locale===O||ce.language===O);return de||(de=W.find(ce=>ce.locale==="en"||ce.language==="en")),de||(de=W.find(ce=>!ce.locale&&!ce.language)),de||(de=W[0]),de?de.value:""}return String(W)};return te.getLabel?$=B(te.getLabel()):te.label&&($=B(te.label)),te.getValue?ne=B(te.getValue()):te.value&&(ne=B(te.value)),{label:$,value:ne}}):[]}),n=le(()=>T(t)?T(t).getDescription():""),s=le(()=>{var O;return T(t)?(O=T(t).getRequiredStatement())==null?void 0:O.getValue():""}),h=le(()=>T(t)?T(t).getLicense():"");var u=dp(),o=Q(u),l=Q(o),f=Q(l);f.__click=()=>e.toggleMetadataDialog(),Y(l);var c=ue(l,2),p=Q(c,!0);Y(c);var _=ue(c,2),d=Q(_);{var v=O=>{var U=up(),te=Q(U),$=Q(te);Hi($,()=>T(n)),Y(te),Y(U),C(O,U)};G(d,O=>{T(n)&&O(v)})}var w=ue(d,2),S=Q(w);{var R=O=>{var U=hp(),te=K(U),$=Q(te,!0);Y(te);var ne=ue(te,2),B=Q(ne);Hi(B,()=>T(s)),Y(ne),ke(W=>Ge($,W),[()=>Re.attribution()]),C(O,U)};G(S,O=>{T(s)&&O(R)})}var P=ue(S,2);{var A=O=>{var U=cp(),te=K(U),$=Q(te,!0);Y(te);var ne=ue(te,2),B=Q(ne),W=Q(B,!0);Y(B),Y(ne),ke(de=>{Ge($,de),Me(B,"href",T(h)),Ge(W,T(h))},[()=>Re.license()]),C(O,U)};G(P,O=>{T(h)&&O(A)})}var F=ue(P,2);yr(F,17,()=>T(i),un,(O,U)=>{var te=fp(),$=K(te),ne=Q($,!0);Y($);var B=ue($,2),W=Q(B);Hi(W,()=>T(U).value),Y(B),ke(()=>Ge(ne,T(U).label)),C(O,te)}),Y(w),Y(_);var N=ue(_,2),z=Q(N),I=Q(z);I.__click=()=>e.toggleMetadataDialog();var D=Q(I,!0);Y(I),Y(z),Y(N),Y(o);var H=ue(o,2),k=Q(H);k.__click=()=>e.toggleMetadataDialog();var q=Q(k,!0);Y(k),Y(H),Y(u),ke((O,U,te)=>{u.open=e.showMetadataDialog,Ge(p,O),Ge(D,U),Ge(q,te)},[()=>T(t)?T(t).getLabel().length&&T(t).getLabel()[0]?T(t).getLabel()[0].value:Re.metadata_label_fallback():Re.loading(),()=>Re.close(),()=>Re.close()]),C(a,u),Ue()}Mi(["click"]);var gp=Ae('<span class="loading loading-spinner loading-xs"></span>'),vp=Ae('<div class="flex justify-center p-8"><span class="loading loading-spinner loading-lg text-primary"></span></div>'),mp=Ae('<div class="text-center opacity-50 p-4"> </div>'),_p=Ae('<div class="text-center opacity-50 p-4 text-sm"> </div>'),yp=Ae('<div class="leading-relaxed"><span><!></span> <span class="bg-yellow-200 text-yellow-900 font-bold px-0.5 rounded"><!></span> <span><!></span></div>'),wp=Ae('<div class="leading-relaxed"> </div>'),Tp=Ae('<button class="w-full text-left card bg-base-100 shadow hover:shadow-md transition-all p-4 text-sm group border border-transparent hover:border-primary focus:outline-none focus:ring-2 focus:ring-primary"><div class="flex justify-between items-baseline mb-1"><span class="font-bold text-xs opacity-70 bg-base-200 px-1.5 py-0.5 rounded"> </span></div> <!></button>'),Ep=Ae('<div class="text-xs font-bold opacity-50 uppercase tracking-wider pb-2"> </div> <!>',1),xp=Ae('<div class="absolute top-0 right-0 h-full w-80 bg-base-200 shadow-2xl z-1000 transform transition-transform duration-300 flex flex-col border-l border-base-300" role="dialog"><div class="p-4 bg-base-300 flex justify-between items-center shrink-0"><h2 class="font-bold text-lg"> </h2> <button class="btn btn-sm btn-circle btn-ghost">✕</button></div> <div class="p-4 border-b border-base-300 shrink-0"><div class="join w-full"><input type="text" class="input input-bordered join-item w-full"/> <button class="btn btn-primary join-item"><!></button></div></div> <div class="flex-1 overflow-y-auto p-4 space-y-4"><!></div></div>');function bp(a,r){Ve(r,!0);const e=qi(er);let t=Pe(Tt(e.searchQuery));function i(){e.search(T(t))}function n(l){l.key==="Enter"&&i()}function s(l){const f=e.canvases[l.canvasIndex];f&&(e.canvasId=f.id)}var h=ie(),u=K(h);{var o=l=>{var f=xp(),c=Q(f),p=Q(c),_=Q(p,!0);Y(p);var d=ue(p,2);d.__click=()=>e.toggleSearchPanel(),Y(c);var v=ue(c,2),w=Q(v),S=Q(w);Vs(S),S.__keydown=n;var R=ue(S,2);R.__click=i;var P=Q(R);{var A=H=>{var k=gp();C(H,k)},F=H=>{Lo(H,{size:20,weight:"bold"})};G(P,H=>{e.isSearching?H(A):H(F,!1)})}Y(R),Y(w),Y(v);var N=ue(v,2),z=Q(N);{var I=H=>{var k=vp();C(H,k)},D=H=>{var k=ie(),q=K(k);{var O=te=>{var $=mp(),ne=Q($,!0);Y($),ke(B=>Ge(ne,B),[()=>Re.search_panel_no_results({query:e.searchQuery})]),C(te,$)},U=te=>{var $=ie(),ne=K($);{var B=de=>{var ce=_p(),re=Q(ce,!0);Y(ce),ke(j=>Ge(re,j),[()=>Re.search_panel_instruction()]),C(de,ce)},W=de=>{var ce=Ep(),re=K(ce),j=Q(re,!0);Y(re);var se=ue(re,2);yr(se,17,()=>e.searchResults,un,(nt,We)=>{var De=Tp();De.__click=()=>s(T(We));var Ke=Q(De),ct=Q(Ke),wi=Q(ct,!0);Y(ct),Y(Ke);var Ui=ue(Ke,2);{var It=kt=>{var yt=yp(),g=Q(yt),x=Q(g);Hi(x,()=>T(We).before),Y(g);var M=ue(g,2),X=Q(M);Hi(X,()=>T(We).match),Y(M);var oe=ue(M,2),fe=Q(oe);Hi(fe,()=>T(We).after),Y(oe),Y(yt),C(kt,yt)},Wt=kt=>{var yt=wp(),g=Q(yt,!0);Y(yt),ke(()=>Ge(g,T(We).match)),C(kt,yt)};G(Ui,kt=>{T(We).type==="hit"?kt(It):kt(Wt,!1)})}Y(De),ke(()=>Ge(wi,T(We).canvasLabel)),C(nt,De)}),ke(nt=>Ge(j,nt),[()=>Re.search_panel_results_count({count:e.searchResults.length})]),C(de,ce)};G(ne,de=>{e.searchResults.length===0&&!e.searchQuery?de(B):de(W,!1)},!0)}C(te,$)};G(q,te=>{e.searchResults.length===0&&e.searchQuery?te(O):te(U,!1)},!0)}C(H,k)};G(z,H=>{e.isSearching?H(I):H(D,!1)})}Y(N),Y(f),ke((H,k,q,O,U)=>{Me(f,"aria-label",H),Ge(_,k),Me(d,"aria-label",q),Me(S,"placeholder",O),Me(R,"aria-label",U)},[()=>Re.search_panel_title(),()=>Re.search_panel_title(),()=>Re.search_panel_close(),()=>Re.search_panel_placeholder(),()=>Re.search_panel_title()]),fu(S,()=>T(t),H=>me(t,H)),C(l,f)};G(u,l=>{e.showSearchPanel&&l(o)})}C(a,h),Ue()}Mi(["click","keydown"]);var Sp=Ae('<span class="loading loading-spinner loading-lg text-primary"></span>'),Pp=Ae('<div class="text-error"> </div>'),Cp=Ae('<div class="text-base-content/50">No image found</div>'),Rp=Ae("<!> <!>",1),Ap=Ae('<div id="triiiceratops-viewer" class="w-full h-full relative bg-base-100 flex items-center justify-center"><!> <!> <!> <!> <!> <!></div>');function Ip(a,r){Ve(r,!0);const e=new fh;gl(er,e),si(()=>{r.manifestId&&e.setManifest(r.manifestId)}),si(()=>{const w=()=>{e.isFullScreen=!!document.fullscreenElement};return document.addEventListener("fullscreenchange",w),()=>{document.removeEventListener("fullscreenchange",w)}});let t=le(()=>e.manifest),i=le(()=>e.canvases),n=le(()=>e.currentCanvasIndex),s=le(()=>{var I,D;if(!T(i)||T(n)===-1||!T(i)[T(n)])return(I=T(t))!=null&&I.isFetching||console.log("TriiiceratopsViewer: No canvas found"),null;const w=T(i)[T(n)];let S=w.getImages();if((!S||!S.length)&&w.getContent&&(S=w.getContent()),!S||!S.length)return w.__jsonld&&w.__jsonld.items,(D=T(t))!=null&&D.isFetching||console.log("TriiiceratopsViewer: No images/content in canvas"),null;const R=S[0];let P=R.getResource?R.getResource():null;if(!P&&R.getBody){const H=R.getBody();Array.isArray(H)&&H.length>0?P=H[0]:H&&(P=H)}if(P&&!P.id&&!P.__jsonld&&(!P.getServices||P.getServices().length===0)&&(P=null),!P){const H=R.__jsonld||R;H.body&&(P=Array.isArray(H.body)?H.body[0]:H.body)}if(!P)return null;const A=H=>H.id||H["@id"];let F=[];if(P.getServices&&(F=P.getServices()),!F.length){const H=P.__jsonld||P;H.service&&(F=Array.isArray(H.service)?H.service:[H.service])}if(F.length>0){const H=F.find(k=>{const q=k.getType?k.getType():k.type||"",O=k.getProfile?k.getProfile():k.profile||"";return q==="ImageService1"||q==="ImageService2"||q==="ImageService3"||typeof O=="string"&&O.includes("http://iiif.io/api/image")||typeof O=="string"&&O==="level0"});if(H){let k=A(H);return k&&!k.endsWith("/info.json")&&(k=`${k}/info.json`),k}}const N=A(P);if(N&&N.includes("/iiif/")){const H=N.split("/"),k=H.findIndex(q=>q==="full"||q.match(/^\d+,\d+,\d+,\d+$/));if(k>0)return`${H.slice(0,k).join("/")}/info.json`}return console.log("TriiiceratopsViewer: No service or ID found, returning raw URL"),{type:"image",url:N}});var h=Ap(),u=Q(h);{var o=w=>{var S=Sp();C(w,S)},l=w=>{var S=ie(),R=K(S);{var P=F=>{var N=Pp(),z=Q(N);Y(N),ke(()=>Ge(z,`Error: ${T(t).error??""}`)),C(F,N)},A=F=>{var N=ie(),z=K(N);{var I=H=>{var k=ie(),q=K(k);tu(q,()=>T(s),O=>{Ah(O,{get tileSources(){return T(s)},get viewerState(){return e}})}),C(H,k)},D=H=>{var k=Cp();C(H,k)};G(z,H=>{T(s)?H(I):H(D,!1)},!0)}C(F,N)};G(R,F=>{var N;(N=T(t))!=null&&N.error?F(P):F(A,!1)},!0)}C(w,S)};G(u,w=>{var S;(S=T(t))!=null&&S.isFetching?w(o):w(l,!1)})}var f=ue(u,2);{var c=w=>{var S=Rp(),R=K(S);mf(R,{get viewerState(){return e}});var P=ue(R,2);ad(P,{get canvases(){return T(i)}}),C(w,S)};G(f,w=>{T(i).length>1&&w(c)})}var p=ue(f,2);jf(p,{});var _=ue(p,2);pp(_,{});var d=ue(_,2);bp(d,{});var v=ue(d,2);lp(v,{}),Y(h),C(a,h),Ue()}var Dp=Ae('<div class="w-full h-full"><!></div>');function Op(a,r){Ve(r,!0);let e=gu(r,"manifestId",7,"");var t={get manifestId(){return e()},set manifestId(s=""){e(s),On()}},i=Dp(),n=Q(i);return Ip(n,{get manifestId(){return e()}}),Y(i),C(a,i),Ue(t)}customElements.define("triiiceratops-viewer",yu(Op,{manifestId:{attribute:"manifest-id",reflect:!0,type:"String"}},[],[],!1))})();