diff --git a/ckanext/nhm/theme/assets/scripts/apps/liv/dist/liv.js b/ckanext/nhm/theme/assets/scripts/apps/liv/dist/liv.js index 6ffc4bec..6f929cc0 100644 --- a/ckanext/nhm/theme/assets/scripts/apps/liv/dist/liv.js +++ b/ckanext/nhm/theme/assets/scripts/apps/liv/dist/liv.js @@ -6,14 +6,14 @@ * @vue/reactivity v3.4.14 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/let Tt;class Al{constructor(i=!1){this.detached=i,this._active=!0,this.effects=[],this.cleanups=[],this.parent=Tt,!i&&Tt&&(this.index=(Tt.scopes||(Tt.scopes=[])).push(this)-1)}get active(){return this._active}run(i){if(this._active){const e=Tt;try{return Tt=this,i()}finally{Tt=e}}}on(){Tt=this}off(){Tt=this.parent}stop(i){if(this._active){let e,n;for(e=0,n=this.effects.length;e=2))break}this._dirtyLevel<2&&(this._dirtyLevel=0),Ti()}return this._dirtyLevel>=2}set dirty(i){this._dirtyLevel=i?2:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let i=wi,e=Vi;try{return wi=!0,Vi=this,this._runnings++,Dl(this),this.fn()}finally{Ml(this),this._runnings--,Vi=e,wi=i}}stop(){var i;this.active&&(Dl(this),Ml(this),(i=this.onStop)==null||i.call(this),this.active=!1)}}function tp(t){return t.value}function Dl(t){t._trackId++,t._depsLength=0}function Ml(t){if(t.deps&&t.deps.length>t._depsLength){for(let i=t._depsLength;i{const e=new Map;return e.cleanup=t,e.computed=i,e},Fr=new WeakMap,ji=Symbol(""),go=Symbol("");function vt(t,i,e){if(wi&&Vi){let n=Fr.get(t);n||Fr.set(t,n=new Map);let r=n.get(e);r||n.set(e,r=Hl(()=>n.delete(e))),Fl(Vi,r)}}function ii(t,i,e,n,r,s){const a=Fr.get(t);if(!a)return;let o=[];if(i==="clear")o=[...a.values()];else if(e==="length"&&we(t)){const l=Number(n);a.forEach((u,c)=>{(c==="length"||!yi(c)&&c>=l)&&o.push(u)})}else switch(e!==void 0&&o.push(a.get(e)),i){case"add":we(t)?so(e)&&o.push(a.get("length")):(o.push(a.get(ji)),sn(t)&&o.push(a.get(go)));break;case"delete":we(t)||(o.push(a.get(ji)),sn(t)&&o.push(a.get(go)));break;case"set":sn(t)&&o.push(a.get(ji));break}fo();for(const l of o)l&&zl(l,2);po()}function ip(t,i){var e;return(e=Fr.get(t))==null?void 0:e.get(i)}const np=Ot("__proto__,__v_isRef,__isVue"),Bl=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(yi)),Ul=rp();function rp(){const t={};return["includes","indexOf","lastIndexOf"].forEach(i=>{t[i]=function(...e){const n=Ie(this);for(let s=0,a=this.length;s{t[i]=function(...e){_i(),fo();const n=Ie(this)[i].apply(this,e);return po(),Ti(),n}}),t}function sp(t){const i=Ie(this);return vt(i,"has",t),i.hasOwnProperty(t)}class Vl{constructor(i=!1,e=!1){this._isReadonly=i,this._shallow=e}get(i,e,n){const r=this._isReadonly,s=this._shallow;if(e==="__v_isReactive")return!r;if(e==="__v_isReadonly")return r;if(e==="__v_isShallow")return s;if(e==="__v_raw")return n===(r?s?yp:Xl:s?Yl:Zl).get(i)||Object.getPrototypeOf(i)===Object.getPrototypeOf(n)?i:void 0;const a=we(i);if(!r){if(a&&Fe(Ul,e))return Reflect.get(Ul,e,n);if(e==="hasOwnProperty")return sp}const o=Reflect.get(i,e,n);return(yi(e)?Bl.has(e):np(e))||(r||vt(i,"get",e),s)?o:ze(o)?a&&so(e)?o:o.value:je(o)?r?bo(o):Kt(o):o}}class jl extends Vl{constructor(i=!1){super(!1,i)}set(i,e,n,r){let s=i[e];if(!this._shallow){const l=un(s);if(!Wr(n)&&!un(n)&&(s=Ie(s),n=Ie(n)),!we(i)&&ze(s)&&!ze(n))return l?!1:(s.value=n,!0)}const a=we(i)&&so(e)?Number(e)t,zr=t=>Reflect.getPrototypeOf(t);function Hr(t,i,e=!1,n=!1){t=t.__v_raw;const r=Ie(t),s=Ie(i);e||(Gt(i,s)&&vt(r,"get",i),vt(r,"get",s));const{has:a}=zr(r),o=n?vo:e?To:Dn;if(a.call(r,i))return o(t.get(i));if(a.call(r,s))return o(t.get(s));t!==r&&t.get(i)}function Br(t,i=!1){const e=this.__v_raw,n=Ie(e),r=Ie(t);return i||(Gt(t,r)&&vt(n,"has",t),vt(n,"has",r)),t===r?e.has(t):e.has(t)||e.has(r)}function Ur(t,i=!1){return t=t.__v_raw,!i&&vt(Ie(t),"iterate",ji),Reflect.get(t,"size",t)}function Wl(t){t=Ie(t);const i=Ie(this);return zr(i).has.call(i,t)||(i.add(t),ii(i,"add",t,t)),this}function Gl(t,i){i=Ie(i);const e=Ie(this),{has:n,get:r}=zr(e);let s=n.call(e,t);s||(t=Ie(t),s=n.call(e,t));const a=r.call(e,t);return e.set(t,i),s?Gt(i,a)&&ii(e,"set",t,i):ii(e,"add",t,i),this}function ql(t){const i=Ie(this),{has:e,get:n}=zr(i);let r=e.call(i,t);r||(t=Ie(t),r=e.call(i,t)),n&&n.call(i,t);const s=i.delete(t);return r&&ii(i,"delete",t,void 0),s}function Kl(){const t=Ie(this),i=t.size!==0,e=t.clear();return i&&ii(t,"clear",void 0,void 0),e}function Vr(t,i){return function(n,r){const s=this,a=s.__v_raw,o=Ie(a),l=i?vo:t?To:Dn;return!t&&vt(o,"iterate",ji),a.forEach((u,c)=>n.call(r,l(u),l(c),s))}}function jr(t,i,e){return function(...n){const r=this.__v_raw,s=Ie(r),a=sn(s),o=t==="entries"||t===Symbol.iterator&&a,l=t==="keys"&&a,u=r[t](...n),c=e?vo:i?To:Dn;return!i&&vt(s,"iterate",l?go:ji),{next(){const{value:h,done:f}=u.next();return f?{value:h,done:f}:{value:o?[c(h[0]),c(h[1])]:c(h),done:f}},[Symbol.iterator](){return this}}}}function xi(t){return function(...i){return t==="delete"?!1:t==="clear"?void 0:this}}function cp(){const t={get(s){return Hr(this,s)},get size(){return Ur(this)},has:Br,add:Wl,set:Gl,delete:ql,clear:Kl,forEach:Vr(!1,!1)},i={get(s){return Hr(this,s,!1,!0)},get size(){return Ur(this)},has:Br,add:Wl,set:Gl,delete:ql,clear:Kl,forEach:Vr(!1,!0)},e={get(s){return Hr(this,s,!0)},get size(){return Ur(this,!0)},has(s){return Br.call(this,s,!0)},add:xi("add"),set:xi("set"),delete:xi("delete"),clear:xi("clear"),forEach:Vr(!0,!1)},n={get(s){return Hr(this,s,!0,!0)},get size(){return Ur(this,!0)},has(s){return Br.call(this,s,!0)},add:xi("add"),set:xi("set"),delete:xi("delete"),clear:xi("clear"),forEach:Vr(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(s=>{t[s]=jr(s,!1,!1),e[s]=jr(s,!0,!1),i[s]=jr(s,!1,!0),n[s]=jr(s,!0,!0)}),[t,e,i,n]}const[hp,fp,dp,pp]=cp();function yo(t,i){const e=i?t?pp:dp:t?fp:hp;return(n,r,s)=>r==="__v_isReactive"?!t:r==="__v_isReadonly"?t:r==="__v_raw"?n:Reflect.get(Fe(e,r)&&r in n?e:n,r,s)}const mp={get:yo(!1,!1)},gp={get:yo(!1,!0)},vp={get:yo(!0,!1)},Zl=new WeakMap,Yl=new WeakMap,Xl=new WeakMap,yp=new WeakMap;function bp(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function wp(t){return t.__v_skip||!Object.isExtensible(t)?0:bp(Gd(t))}function Kt(t){return un(t)?t:wo(t,!1,ap,mp,Zl)}function Jl(t){return wo(t,!1,up,gp,Yl)}function bo(t){return wo(t,!0,lp,vp,Xl)}function wo(t,i,e,n,r){if(!je(t)||t.__v_raw&&!(i&&t.__v_isReactive))return t;const s=r.get(t);if(s)return s;const a=wp(t);if(a===0)return t;const o=new Proxy(t,a===2?n:e);return r.set(t,o),o}function ni(t){return un(t)?ni(t.__v_raw):!!(t&&t.__v_isReactive)}function un(t){return!!(t&&t.__v_isReadonly)}function Wr(t){return!!(t&&t.__v_isShallow)}function _o(t){return ni(t)||un(t)}function Ie(t){const i=t&&t.__v_raw;return i?Ie(i):t}function Gr(t){return Mr(t,"__v_skip",!0),t}const Dn=t=>je(t)?Kt(t):t,To=t=>je(t)?bo(t):t;class Ql{constructor(i,e,n,r){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new co(()=>i(this._value),()=>qr(this,1)),this.effect.computed=this,this.effect.active=this._cacheable=!r,this.__v_isReadonly=n}get value(){const i=Ie(this);return(!i._cacheable||i.effect.dirty)&&Gt(i._value,i._value=i.effect.run())&&qr(i,2),xo(i),i._value}set value(i){this._setter(i)}get _dirty(){return this.effect.dirty}set _dirty(i){this.effect.dirty=i}}function _p(t,i,e=!1){let n,r;const s=Pe(t);return s?(n=t,r=At):(n=t.get,r=t.set),new Ql(n,r,s||!r,e)}function xo(t){wi&&Vi&&(t=Ie(t),Fl(Vi,t.dep||(t.dep=Hl(()=>t.dep=void 0,t instanceof Ql?t:void 0))))}function qr(t,i=2,e){t=Ie(t);const n=t.dep;n&&zl(n,i)}function ze(t){return!!(t&&t.__v_isRef===!0)}function $(t){return eu(t,!1)}function $l(t){return eu(t,!0)}function eu(t,i){return ze(t)?t:new Tp(t,i)}class Tp{constructor(i,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?i:Ie(i),this._value=e?i:Dn(i)}get value(){return xo(this),this._value}set value(i){const e=this.__v_isShallow||Wr(i)||un(i);i=e?i:Ie(i),Gt(i,this._rawValue)&&(this._rawValue=i,this._value=e?i:Dn(i),qr(this,2))}}function k(t){return ze(t)?t.value:t}const xp={get:(t,i,e)=>k(Reflect.get(t,i,e)),set:(t,i,e,n)=>{const r=t[i];return ze(r)&&!ze(e)?(r.value=e,!0):Reflect.set(t,i,e,n)}};function tu(t){return ni(t)?t:new Proxy(t,xp)}class Sp{constructor(i){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=i(()=>xo(this),()=>qr(this));this._get=e,this._set=n}get value(){return this._get()}set value(i){this._set(i)}}function iu(t){return new Sp(t)}function Ep(t){const i=we(t)?new Array(t.length):{};for(const e in t)i[e]=nu(t,e);return i}class Pp{constructor(i,e,n){this._object=i,this._key=e,this._defaultValue=n,this.__v_isRef=!0}get value(){const i=this._object[this._key];return i===void 0?this._defaultValue:i}set value(i){this._object[this._key]=i}get dep(){return ip(Ie(this._object),this._key)}}class Rp{constructor(i){this._getter=i,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function Cp(t,i,e){return ze(t)?t:Pe(t)?new Rp(t):je(t)&&arguments.length>1?nu(t,i,e):$(t)}function nu(t,i,e){const n=t[i];return ze(n)?n:new Pp(t,i,e)}/** +**/let Tt;class Al{constructor(i=!1){this.detached=i,this._active=!0,this.effects=[],this.cleanups=[],this.parent=Tt,!i&&Tt&&(this.index=(Tt.scopes||(Tt.scopes=[])).push(this)-1)}get active(){return this._active}run(i){if(this._active){const e=Tt;try{return Tt=this,i()}finally{Tt=e}}}on(){Tt=this}off(){Tt=this.parent}stop(i){if(this._active){let e,n;for(e=0,n=this.effects.length;e=2))break}this._dirtyLevel<2&&(this._dirtyLevel=0),Ti()}return this._dirtyLevel>=2}set dirty(i){this._dirtyLevel=i?2:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let i=wi,e=Vi;try{return wi=!0,Vi=this,this._runnings++,Dl(this),this.fn()}finally{Ml(this),this._runnings--,Vi=e,wi=i}}stop(){var i;this.active&&(Dl(this),Ml(this),(i=this.onStop)==null||i.call(this),this.active=!1)}}function tp(t){return t.value}function Dl(t){t._trackId++,t._depsLength=0}function Ml(t){if(t.deps&&t.deps.length>t._depsLength){for(let i=t._depsLength;i{const e=new Map;return e.cleanup=t,e.computed=i,e},Fr=new WeakMap,ji=Symbol(""),go=Symbol("");function vt(t,i,e){if(wi&&Vi){let n=Fr.get(t);n||Fr.set(t,n=new Map);let r=n.get(e);r||n.set(e,r=Hl(()=>n.delete(e))),Fl(Vi,r)}}function ii(t,i,e,n,r,s){const a=Fr.get(t);if(!a)return;let o=[];if(i==="clear")o=[...a.values()];else if(e==="length"&&we(t)){const l=Number(n);a.forEach((u,c)=>{(c==="length"||!yi(c)&&c>=l)&&o.push(u)})}else switch(e!==void 0&&o.push(a.get(e)),i){case"add":we(t)?so(e)&&o.push(a.get("length")):(o.push(a.get(ji)),sn(t)&&o.push(a.get(go)));break;case"delete":we(t)||(o.push(a.get(ji)),sn(t)&&o.push(a.get(go)));break;case"set":sn(t)&&o.push(a.get(ji));break}fo();for(const l of o)l&&zl(l,2);po()}function ip(t,i){var e;return(e=Fr.get(t))==null?void 0:e.get(i)}const np=Ot("__proto__,__v_isRef,__isVue"),Bl=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(yi)),Ul=rp();function rp(){const t={};return["includes","indexOf","lastIndexOf"].forEach(i=>{t[i]=function(...e){const n=Ae(this);for(let s=0,a=this.length;s{t[i]=function(...e){_i(),fo();const n=Ae(this)[i].apply(this,e);return po(),Ti(),n}}),t}function sp(t){const i=Ae(this);return vt(i,"has",t),i.hasOwnProperty(t)}class Vl{constructor(i=!1,e=!1){this._isReadonly=i,this._shallow=e}get(i,e,n){const r=this._isReadonly,s=this._shallow;if(e==="__v_isReactive")return!r;if(e==="__v_isReadonly")return r;if(e==="__v_isShallow")return s;if(e==="__v_raw")return n===(r?s?yp:Xl:s?Yl:Zl).get(i)||Object.getPrototypeOf(i)===Object.getPrototypeOf(n)?i:void 0;const a=we(i);if(!r){if(a&&Fe(Ul,e))return Reflect.get(Ul,e,n);if(e==="hasOwnProperty")return sp}const o=Reflect.get(i,e,n);return(yi(e)?Bl.has(e):np(e))||(r||vt(i,"get",e),s)?o:ze(o)?a&&so(e)?o:o.value:je(o)?r?bo(o):Kt(o):o}}class jl extends Vl{constructor(i=!1){super(!1,i)}set(i,e,n,r){let s=i[e];if(!this._shallow){const l=un(s);if(!Wr(n)&&!un(n)&&(s=Ae(s),n=Ae(n)),!we(i)&&ze(s)&&!ze(n))return l?!1:(s.value=n,!0)}const a=we(i)&&so(e)?Number(e)t,zr=t=>Reflect.getPrototypeOf(t);function Hr(t,i,e=!1,n=!1){t=t.__v_raw;const r=Ae(t),s=Ae(i);e||(Gt(i,s)&&vt(r,"get",i),vt(r,"get",s));const{has:a}=zr(r),o=n?vo:e?To:Dn;if(a.call(r,i))return o(t.get(i));if(a.call(r,s))return o(t.get(s));t!==r&&t.get(i)}function Br(t,i=!1){const e=this.__v_raw,n=Ae(e),r=Ae(t);return i||(Gt(t,r)&&vt(n,"has",t),vt(n,"has",r)),t===r?e.has(t):e.has(t)||e.has(r)}function Ur(t,i=!1){return t=t.__v_raw,!i&&vt(Ae(t),"iterate",ji),Reflect.get(t,"size",t)}function Wl(t){t=Ae(t);const i=Ae(this);return zr(i).has.call(i,t)||(i.add(t),ii(i,"add",t,t)),this}function Gl(t,i){i=Ae(i);const e=Ae(this),{has:n,get:r}=zr(e);let s=n.call(e,t);s||(t=Ae(t),s=n.call(e,t));const a=r.call(e,t);return e.set(t,i),s?Gt(i,a)&&ii(e,"set",t,i):ii(e,"add",t,i),this}function ql(t){const i=Ae(this),{has:e,get:n}=zr(i);let r=e.call(i,t);r||(t=Ae(t),r=e.call(i,t)),n&&n.call(i,t);const s=i.delete(t);return r&&ii(i,"delete",t,void 0),s}function Kl(){const t=Ae(this),i=t.size!==0,e=t.clear();return i&&ii(t,"clear",void 0,void 0),e}function Vr(t,i){return function(n,r){const s=this,a=s.__v_raw,o=Ae(a),l=i?vo:t?To:Dn;return!t&&vt(o,"iterate",ji),a.forEach((u,c)=>n.call(r,l(u),l(c),s))}}function jr(t,i,e){return function(...n){const r=this.__v_raw,s=Ae(r),a=sn(s),o=t==="entries"||t===Symbol.iterator&&a,l=t==="keys"&&a,u=r[t](...n),c=e?vo:i?To:Dn;return!i&&vt(s,"iterate",l?go:ji),{next(){const{value:h,done:f}=u.next();return f?{value:h,done:f}:{value:o?[c(h[0]),c(h[1])]:c(h),done:f}},[Symbol.iterator](){return this}}}}function xi(t){return function(...i){return t==="delete"?!1:t==="clear"?void 0:this}}function cp(){const t={get(s){return Hr(this,s)},get size(){return Ur(this)},has:Br,add:Wl,set:Gl,delete:ql,clear:Kl,forEach:Vr(!1,!1)},i={get(s){return Hr(this,s,!1,!0)},get size(){return Ur(this)},has:Br,add:Wl,set:Gl,delete:ql,clear:Kl,forEach:Vr(!1,!0)},e={get(s){return Hr(this,s,!0)},get size(){return Ur(this,!0)},has(s){return Br.call(this,s,!0)},add:xi("add"),set:xi("set"),delete:xi("delete"),clear:xi("clear"),forEach:Vr(!0,!1)},n={get(s){return Hr(this,s,!0,!0)},get size(){return Ur(this,!0)},has(s){return Br.call(this,s,!0)},add:xi("add"),set:xi("set"),delete:xi("delete"),clear:xi("clear"),forEach:Vr(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(s=>{t[s]=jr(s,!1,!1),e[s]=jr(s,!0,!1),i[s]=jr(s,!1,!0),n[s]=jr(s,!0,!0)}),[t,e,i,n]}const[hp,fp,dp,pp]=cp();function yo(t,i){const e=i?t?pp:dp:t?fp:hp;return(n,r,s)=>r==="__v_isReactive"?!t:r==="__v_isReadonly"?t:r==="__v_raw"?n:Reflect.get(Fe(e,r)&&r in n?e:n,r,s)}const mp={get:yo(!1,!1)},gp={get:yo(!1,!0)},vp={get:yo(!0,!1)},Zl=new WeakMap,Yl=new WeakMap,Xl=new WeakMap,yp=new WeakMap;function bp(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function wp(t){return t.__v_skip||!Object.isExtensible(t)?0:bp(Gd(t))}function Kt(t){return un(t)?t:wo(t,!1,ap,mp,Zl)}function Jl(t){return wo(t,!1,up,gp,Yl)}function bo(t){return wo(t,!0,lp,vp,Xl)}function wo(t,i,e,n,r){if(!je(t)||t.__v_raw&&!(i&&t.__v_isReactive))return t;const s=r.get(t);if(s)return s;const a=wp(t);if(a===0)return t;const o=new Proxy(t,a===2?n:e);return r.set(t,o),o}function ni(t){return un(t)?ni(t.__v_raw):!!(t&&t.__v_isReactive)}function un(t){return!!(t&&t.__v_isReadonly)}function Wr(t){return!!(t&&t.__v_isShallow)}function _o(t){return ni(t)||un(t)}function Ae(t){const i=t&&t.__v_raw;return i?Ae(i):t}function Gr(t){return Mr(t,"__v_skip",!0),t}const Dn=t=>je(t)?Kt(t):t,To=t=>je(t)?bo(t):t;class Ql{constructor(i,e,n,r){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new co(()=>i(this._value),()=>qr(this,1)),this.effect.computed=this,this.effect.active=this._cacheable=!r,this.__v_isReadonly=n}get value(){const i=Ae(this);return(!i._cacheable||i.effect.dirty)&&Gt(i._value,i._value=i.effect.run())&&qr(i,2),xo(i),i._value}set value(i){this._setter(i)}get _dirty(){return this.effect.dirty}set _dirty(i){this.effect.dirty=i}}function _p(t,i,e=!1){let n,r;const s=Pe(t);return s?(n=t,r=At):(n=t.get,r=t.set),new Ql(n,r,s||!r,e)}function xo(t){wi&&Vi&&(t=Ae(t),Fl(Vi,t.dep||(t.dep=Hl(()=>t.dep=void 0,t instanceof Ql?t:void 0))))}function qr(t,i=2,e){t=Ae(t);const n=t.dep;n&&zl(n,i)}function ze(t){return!!(t&&t.__v_isRef===!0)}function $(t){return eu(t,!1)}function $l(t){return eu(t,!0)}function eu(t,i){return ze(t)?t:new Tp(t,i)}class Tp{constructor(i,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?i:Ae(i),this._value=e?i:Dn(i)}get value(){return xo(this),this._value}set value(i){const e=this.__v_isShallow||Wr(i)||un(i);i=e?i:Ae(i),Gt(i,this._rawValue)&&(this._rawValue=i,this._value=e?i:Dn(i),qr(this,2))}}function k(t){return ze(t)?t.value:t}const xp={get:(t,i,e)=>k(Reflect.get(t,i,e)),set:(t,i,e,n)=>{const r=t[i];return ze(r)&&!ze(e)?(r.value=e,!0):Reflect.set(t,i,e,n)}};function tu(t){return ni(t)?t:new Proxy(t,xp)}class Sp{constructor(i){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=i(()=>xo(this),()=>qr(this));this._get=e,this._set=n}get value(){return this._get()}set value(i){this._set(i)}}function iu(t){return new Sp(t)}function Ep(t){const i=we(t)?new Array(t.length):{};for(const e in t)i[e]=nu(t,e);return i}class Pp{constructor(i,e,n){this._object=i,this._key=e,this._defaultValue=n,this.__v_isRef=!0}get value(){const i=this._object[this._key];return i===void 0?this._defaultValue:i}set value(i){this._object[this._key]=i}get dep(){return ip(Ae(this._object),this._key)}}class Rp{constructor(i){this._getter=i,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function Cp(t,i,e){return ze(t)?t:Pe(t)?new Rp(t):je(t)&&arguments.length>1?nu(t,i,e):$(t)}function nu(t,i,e){const n=t[i];return ze(n)?n:new Pp(t,i,e)}/** * @vue/runtime-core v3.4.14 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/const Mn=[];function TR(t,...i){_i();const e=Mn.length?Mn[Mn.length-1].component:null,n=e&&e.appContext.config.warnHandler,r=Op();if(n)ri(n,e,11,[t+i.join(""),e&&e.proxy,r.map(({vnode:s})=>`at <${Ju(e,s.type)}>`).join(` `),r]);else{const s=[`[Vue warn]: ${t}`,...i];r.length&&s.push(` `,...Ip(r)),console.warn(...s)}Ti()}function Op(){let t=Mn[Mn.length-1];if(!t)return[];const i=[];for(;t;){const e=i[0];e&&e.vnode===t?e.recurseCount++:i.push({vnode:t,recurseCount:0});const n=t.component&&t.component.parent;t=n&&n.vnode}return i}function Ip(t){const i=[];return t.forEach((e,n)=>{i.push(...n===0?[]:[` -`],...Ap(e))}),i}function Ap({vnode:t,recurseCount:i}){const e=i>0?`... (${i} recursive calls)`:"",n=t.component?t.component.parent==null:!1,r=` at <${Ju(t.component,t.type,n)}`,s=">"+e;return t.props?[r,...kp(t.props),s]:[r+s]}function kp(t){const i=[],e=Object.keys(t);return e.slice(0,3).forEach(n=>{i.push(...ru(n,t[n]))}),e.length>3&&i.push(" ..."),i}function ru(t,i,e){return Xe(i)?(i=JSON.stringify(i),e?i:[`${t}=${i}`]):typeof i=="number"||typeof i=="boolean"||i==null?e?i:[`${t}=${i}`]:ze(i)?(i=ru(t,Ie(i.value),!0),e?i:[`${t}=Ref<`,i,">"]):Pe(i)?[`${t}=fn${i.name?`<${i.name}>`:""}`]:(i=Ie(i),e?i:[`${t}=`,i])}function ri(t,i,e,n){let r;try{r=n?t(...n):t()}catch(s){Nn(s,i,e)}return r}function zt(t,i,e,n){if(Pe(t)){const s=ri(t,i,e,n);return s&&Sl(s)&&s.catch(a=>{Nn(a,i,e)}),s}const r=[];for(let s=0;s>>1,r=ft[n],s=zn(r);sZt&&ft.splice(i,1)}function Lp(t){we(t)?cn.push(...t):(!Si||!Si.includes(t,t.allowRecurse?Wi+1:Wi))&&cn.push(t),ou()}function au(t,i,e=Ln?Zt+1:0){for(;ezn(e)-zn(n));if(cn.length=0,Si){Si.push(...i);return}for(Si=i,Wi=0;Wit.id==null?1/0:t.id,Fp=(t,i)=>{const e=zn(t)-zn(i);if(e===0){if(t.pre&&!i.pre)return-1;if(i.pre&&!t.pre)return 1}return e};function uu(t){So=!1,Ln=!0,ft.sort(Fp);try{for(Zt=0;ZtXe(p)?p.trim():p)),h&&(r=e.map(Nr))}let o,l=n[o=oo(i)]||n[o=oo(Ft(i))];!l&&s&&(l=n[o=oo(bi(i))]),l&&zt(l,t,6,r);const u=n[o+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[o])return;t.emitted[o]=!0,zt(u,t,6,r)}}function cu(t,i,e=!1){const n=i.emitsCache,r=n.get(t);if(r!==void 0)return r;const s=t.emits;let a={},o=!1;if(!Pe(t)){const l=u=>{const c=cu(u,i,!0);c&&(o=!0,lt(a,c))};!e&&i.mixins.length&&i.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!s&&!o?(je(t)&&n.set(t,null),null):(we(s)?s.forEach(l=>a[l]=null):lt(a,s),je(t)&&n.set(t,a),a)}function Zr(t,i){return!t||!Ir(i)?!1:(i=i.slice(2).replace(/Once$/,""),Fe(t,i[0].toLowerCase()+i.slice(1))||Fe(t,bi(i))||Fe(t,i))}let Qe=null,hu=null;function Yr(t){const i=Qe;return Qe=t,hu=t&&t.type.__scopeId||null,i}function ut(t,i=Qe,e){if(!i||t._n)return t;const n=(...r)=>{n._d&&ju(-1);const s=Yr(i);let a;try{a=t(...r)}finally{Yr(s),n._d&&ju(1)}return a};return n._n=!0,n._c=!0,n._d=!0,n}function xR(){}function Po(t){const{type:i,vnode:e,proxy:n,withProxy:r,props:s,propsOptions:[a],slots:o,attrs:l,emit:u,render:c,renderCache:h,data:f,setupState:p,ctx:m,inheritAttrs:b}=t;let T,y;const w=Yr(t);try{if(e.shapeFlag&4){const C=r||n,L=C;T=Yt(c.call(L,C,h,s,p,f,m)),y=l}else{const C=i;T=Yt(C.length>1?C(s,{attrs:l,slots:o,emit:u}):C(s,null)),y=i.props?l:Hp(l)}}catch(C){Wn.length=0,Nn(C,t,1),T=be(Pi)}let S=T;if(y&&b!==!1){const C=Object.keys(y),{shapeFlag:L}=S;C.length&&L&7&&(a&&C.some(no)&&(y=Bp(y,a)),S=Zi(S,y))}return e.dirs&&(S=Zi(S),S.dirs=S.dirs?S.dirs.concat(e.dirs):e.dirs),e.transition&&(S.transition=e.transition),T=S,Yr(w),T}const Hp=t=>{let i;for(const e in t)(e==="class"||e==="style"||Ir(e))&&((i||(i={}))[e]=t[e]);return i},Bp=(t,i)=>{const e={};for(const n in t)(!no(n)||!(n.slice(9)in i))&&(e[n]=t[n]);return e};function Up(t,i,e){const{props:n,children:r,component:s}=t,{props:a,children:o,patchFlag:l}=i,u=s.emitsOptions;if(i.dirs||i.transition)return!0;if(e&&l>=0){if(l&1024)return!0;if(l&16)return n?fu(n,a,u):!!a;if(l&8){const c=i.dynamicProps;for(let h=0;ht.__isSuspense;function qp(t,i){i&&i.pendingBranch?we(t)?i.effects.push(...t):i.effects.push(t):Lp(t)}const Kp=Symbol.for("v-scx"),Zp=()=>ye(Kp);function gu(t,i){return Jr(t,null,i)}function Yp(t,i){return Jr(t,null,{flush:"sync"})}const Xr={};function $e(t,i,e){return Jr(t,i,e)}function Jr(t,i,{immediate:e,deep:n,flush:r,once:s,onTrack:a,onTrigger:o}=Ne){if(i&&s){const D=i;i=(...j)=>{D(...j),L()}}const l=tt,u=D=>n===!0?D:Gi(D,n===!1?1:void 0);let c,h=!1,f=!1;if(ze(t)?(c=()=>t.value,h=Wr(t)):ni(t)?(c=()=>u(t),h=!0):we(t)?(f=!0,h=t.some(D=>ni(D)||Wr(D)),c=()=>t.map(D=>{if(ze(D))return D.value;if(ni(D))return u(D);if(Pe(D))return ri(D,l,2)})):Pe(t)?i?c=()=>ri(t,l,2):c=()=>(p&&p(),zt(t,l,3,[m])):c=At,i&&n){const D=c;c=()=>Gi(D())}let p,m=D=>{p=S.onStop=()=>{ri(D,l,4),p=S.onStop=void 0}},b;if(Zn)if(m=At,i?e&&zt(i,l,3,[c(),f?[]:void 0,m]):c(),r==="sync"){const D=Zp();b=D.__watcherHandles||(D.__watcherHandles=[])}else return At;let T=f?new Array(t.length).fill(Xr):Xr;const y=()=>{if(!(!S.active||!S.dirty))if(i){const D=S.run();(n||h||(f?D.some((j,N)=>Gt(j,T[N])):Gt(D,T)))&&(p&&p(),zt(i,l,3,[D,T===Xr?void 0:f&&T[0]===Xr?[]:T,m]),T=D)}else S.run()};y.allowRecurse=!!i;let w;r==="sync"?w=y:r==="post"?w=()=>ct(y,l&&l.suspense):(y.pre=!0,l&&(y.id=l.uid),w=()=>Kr(y));const S=new co(c,At,w),C=Lr(),L=()=>{S.stop(),C&&ro(C.effects,S)};return i?e?y():T=S.run():r==="post"?ct(S.run.bind(S),l&&l.suspense):S.run(),b&&b.push(L),L}function Xp(t,i,e){const n=this.proxy,r=Xe(t)?t.includes(".")?vu(n,t):()=>n[t]:t.bind(n,n);let s;Pe(i)?s=i:(s=i.handler,e=i);const a=Kn(this),o=Jr(r,s.bind(n),e);return a(),o}function vu(t,i){const e=i.split(".");return()=>{let n=t;for(let r=0;r0){if(e>=i)return t;e++}if(n=n||new Set,n.has(t))return t;if(n.add(t),ze(t))Gi(t.value,i,e,n);else if(we(t))for(let r=0;r{Gi(r,i,e,n)});else if(Pl(t))for(const r in t)Gi(t[r],i,e,n);return t}function xt(t,i){if(Qe===null)return t;const e=os(Qe)||Qe.proxy,n=t.dirs||(t.dirs=[]);for(let r=0;r!!t.type.__asyncLoader;/*! #__NO_SIDE_EFFECTS__ */function bu(t){Pe(t)&&(t={loader:t});const{loader:i,loadingComponent:e,errorComponent:n,delay:r=200,timeout:s,suspensible:a=!0,onError:o}=t;let l=null,u,c=0;const h=()=>(c++,l=null,f()),f=()=>{let p;return l||(p=l=i().catch(m=>{if(m=m instanceof Error?m:new Error(String(m)),o)return new Promise((b,T)=>{o(m,()=>b(h()),()=>T(m),c+1)});throw m}).then(m=>p!==l&&l?l:(m&&(m.__esModule||m[Symbol.toStringTag]==="Module")&&(m=m.default),u=m,m)))};return Hn({name:"AsyncComponentWrapper",__asyncLoader:f,get __asyncResolved(){return u},setup(){const p=tt;if(u)return()=>Ro(u,p);const m=w=>{l=null,Nn(w,p,13,!n)};if(a&&p.suspense||Zn)return f().then(w=>()=>Ro(w,p)).catch(w=>(m(w),()=>n?be(n,{error:w}):null));const b=$(!1),T=$(),y=$(!!r);return r&&setTimeout(()=>{y.value=!1},r),s!=null&&setTimeout(()=>{if(!b.value&&!T.value){const w=new Error(`Async component timed out after ${s}ms.`);m(w),T.value=w}},s),f().then(()=>{b.value=!0,p.parent&&Co(p.parent.vnode)&&(p.parent.effect.dirty=!0,Kr(p.parent.update))}).catch(w=>{m(w),T.value=w}),()=>{if(b.value&&u)return Ro(u,p);if(T.value&&n)return be(n,{error:T.value});if(e&&!y.value)return be(e)}}})}function Ro(t,i){const{ref:e,props:n,children:r,ce:s}=i.vnode,a=be(t,n,r);return a.ref=e,a.ce=s,delete i.vnode.ce,a}const Co=t=>t.type.__isKeepAlive,wu={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(t,{slots:i}){const e=rs(),n=e.ctx;if(!n.renderer)return()=>{const w=i.default&&i.default();return w&&w.length===1?w[0]:w};const r=new Map,s=new Set;let a=null;const o=e.suspense,{renderer:{p:l,m:u,um:c,o:{createElement:h}}}=n,f=h("div");n.activate=(w,S,C,L,D)=>{const j=w.component;u(w,S,C,0,o),l(j.vnode,w,S,C,j,o,L,w.slotScopeIds,D),ct(()=>{j.isDeactivated=!1,j.a&&ln(j.a);const N=w.props&&w.props.onVnodeMounted;N&&kt(N,j.parent,w)},o)},n.deactivate=w=>{const S=w.component;u(w,f,null,1,o),ct(()=>{S.da&&ln(S.da);const C=w.props&&w.props.onVnodeUnmounted;C&&kt(C,S.parent,w),S.isDeactivated=!0},o)};function p(w){Oo(w),c(w,e,o,!0)}function m(w){r.forEach((S,C)=>{const L=as(S.type);L&&(!w||!w(L))&&b(C)})}function b(w){const S=r.get(w);!a||!fn(S,a)?p(S):a&&Oo(a),r.delete(w),s.delete(w)}$e(()=>[t.include,t.exclude],([w,S])=>{w&&m(C=>Bn(w,C)),S&&m(C=>!Bn(S,C))},{flush:"post",deep:!0});let T=null;const y=()=>{T!=null&&r.set(T,Io(e.subTree))};return oi(y),Tu(y),xu(()=>{r.forEach(w=>{const{subTree:S,suspense:C}=e,L=Io(S);if(w.type===L.type&&w.key===L.key){Oo(L);const D=L.component.da;D&&ct(D,C);return}p(w)})}),()=>{if(T=null,!i.default)return null;const w=i.default(),S=w[0];if(w.length>1)return a=null,w;if(!qn(S)||!(S.shapeFlag&4)&&!(S.shapeFlag&128))return a=null,S;let C=Io(S);const L=C.type,D=as(hn(C)?C.type.__asyncResolved||{}:L),{include:j,exclude:N,max:K}=t;if(j&&(!D||!Bn(j,D))||N&&D&&Bn(N,D))return a=C,S;const se=C.key==null?L:C.key,ue=r.get(se);return C.el&&(C=Zi(C),S.shapeFlag&128&&(S.ssContent=C)),T=se,ue?(C.el=ue.el,C.component=ue.component,C.transition&&yu(C,C.transition),C.shapeFlag|=512,s.delete(se),s.add(se)):(s.add(se),K&&s.size>parseInt(K,10)&&b(s.values().next().value)),C.shapeFlag|=256,a=C,mu(S.type)?S:C}}};function Bn(t,i){return we(t)?t.some(e=>Bn(e,i)):Xe(t)?t.split(",").includes(i):Wd(t)?t.test(i):!1}function Jp(t,i){_u(t,"a",i)}function Qp(t,i){_u(t,"da",i)}function _u(t,i,e=tt){const n=t.__wdc||(t.__wdc=()=>{let r=e;for(;r;){if(r.isDeactivated)return;r=r.parent}return t()});if(Qr(i,n,e),e){let r=e.parent;for(;r&&r.parent;)Co(r.parent.vnode)&&$p(n,i,e,r),r=r.parent}}function $p(t,i,e,n){const r=Qr(i,t,n,!0);Su(()=>{ro(n[i],r)},e)}function Oo(t){t.shapeFlag&=-257,t.shapeFlag&=-513}function Io(t){return t.shapeFlag&128?t.ssContent:t}function Qr(t,i,e=tt,n=!1){if(e){const r=e[t]||(e[t]=[]),s=i.__weh||(i.__weh=(...a)=>{if(e.isUnmounted)return;_i();const o=Kn(e),l=zt(i,e,t,a);return o(),Ti(),l});return n?r.unshift(s):r.push(s),s}}const si=t=>(i,e=tt)=>(!Zn||t==="sp")&&Qr(t,(...n)=>i(...n),e),em=si("bm"),oi=si("m"),tm=si("bu"),Tu=si("u"),xu=si("bum"),Su=si("um"),im=si("sp"),nm=si("rtg"),rm=si("rtc");function sm(t,i=tt){Qr("ec",t,i)}function yt(t,i,e,n){let r;const s=e&&e[n];if(we(t)||Xe(t)){r=new Array(t.length);for(let a=0,o=t.length;ai(a,o,void 0,s&&s[o]));else{const a=Object.keys(t);r=new Array(a.length);for(let o=0,l=a.length;oqn(i)?!(i.type===Pi||i.type===De&&!Eu(i.children)):!0)?t:null}const Ao=t=>t?Ku(t)?os(t)||t.proxy:Ao(t.parent):null,Un=lt(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Ao(t.parent),$root:t=>Ao(t.root),$emit:t=>t.emit,$options:t=>Mo(t),$forceUpdate:t=>t.f||(t.f=()=>{t.effect.dirty=!0,Kr(t.update)}),$nextTick:t=>t.n||(t.n=Fn.bind(t.proxy)),$watch:t=>Xp.bind(t)}),ko=(t,i)=>t!==Ne&&!t.__isScriptSetup&&Fe(t,i),om={get({_:t},i){const{ctx:e,setupState:n,data:r,props:s,accessCache:a,type:o,appContext:l}=t;let u;if(i[0]!=="$"){const p=a[i];if(p!==void 0)switch(p){case 1:return n[i];case 2:return r[i];case 4:return e[i];case 3:return s[i]}else{if(ko(n,i))return a[i]=1,n[i];if(r!==Ne&&Fe(r,i))return a[i]=2,r[i];if((u=t.propsOptions[0])&&Fe(u,i))return a[i]=3,s[i];if(e!==Ne&&Fe(e,i))return a[i]=4,e[i];Do&&(a[i]=0)}}const c=Un[i];let h,f;if(c)return i==="$attrs"&&vt(t,"get",i),c(t);if((h=o.__cssModules)&&(h=h[i]))return h;if(e!==Ne&&Fe(e,i))return a[i]=4,e[i];if(f=l.config.globalProperties,Fe(f,i))return f[i]},set({_:t},i,e){const{data:n,setupState:r,ctx:s}=t;return ko(r,i)?(r[i]=e,!0):n!==Ne&&Fe(n,i)?(n[i]=e,!0):Fe(t.props,i)||i[0]==="$"&&i.slice(1)in t?!1:(s[i]=e,!0)},has({_:{data:t,setupState:i,accessCache:e,ctx:n,appContext:r,propsOptions:s}},a){let o;return!!e[a]||t!==Ne&&Fe(t,a)||ko(i,a)||(o=s[0])&&Fe(o,a)||Fe(n,a)||Fe(Un,a)||Fe(r.config.globalProperties,a)},defineProperty(t,i,e){return e.get!=null?t._.accessCache[i]=0:Fe(e,"value")&&this.set(t,i,e.value,null),Reflect.defineProperty(t,i,e)}};function Pu(t){return we(t)?t.reduce((i,e)=>(i[e]=null,i),{}):t}let Do=!0;function am(t){const i=Mo(t),e=t.proxy,n=t.ctx;Do=!1,i.beforeCreate&&Ru(i.beforeCreate,t,"bc");const{data:r,computed:s,methods:a,watch:o,provide:l,inject:u,created:c,beforeMount:h,mounted:f,beforeUpdate:p,updated:m,activated:b,deactivated:T,beforeDestroy:y,beforeUnmount:w,destroyed:S,unmounted:C,render:L,renderTracked:D,renderTriggered:j,errorCaptured:N,serverPrefetch:K,expose:se,inheritAttrs:ue,components:Se,directives:Re,filters:Ee}=i;if(u&&lm(u,n,null),a)for(const ne in a){const U=a[ne];Pe(U)&&(n[ne]=U.bind(e))}if(r){const ne=r.call(e,e);je(ne)&&(t.data=Kt(ne))}if(Do=!0,s)for(const ne in s){const U=s[ne],re=Pe(U)?U.bind(e,e):Pe(U.get)?U.get.bind(e,e):At,ce=!Pe(U)&&Pe(U.set)?U.set.bind(e):At,Q=Y({get:re,set:ce});Object.defineProperty(n,ne,{enumerable:!0,configurable:!0,get:()=>Q.value,set:_e=>Q.value=_e})}if(o)for(const ne in o)Cu(o[ne],n,e,ne);if(l){const ne=Pe(l)?l.call(e):l;Reflect.ownKeys(ne).forEach(U=>{St(U,ne[U])})}c&&Ru(c,t,"c");function ge(ne,U){we(U)?U.forEach(re=>ne(re.bind(e))):U&&ne(U.bind(e))}if(ge(em,h),ge(oi,f),ge(tm,p),ge(Tu,m),ge(Jp,b),ge(Qp,T),ge(sm,N),ge(rm,D),ge(nm,j),ge(xu,w),ge(Su,C),ge(im,K),we(se))if(se.length){const ne=t.exposed||(t.exposed={});se.forEach(U=>{Object.defineProperty(ne,U,{get:()=>e[U],set:re=>e[U]=re})})}else t.exposed||(t.exposed={});L&&t.render===At&&(t.render=L),ue!=null&&(t.inheritAttrs=ue),Se&&(t.components=Se),Re&&(t.directives=Re)}function lm(t,i,e=At){we(t)&&(t=No(t));for(const n in t){const r=t[n];let s;je(r)?"default"in r?s=ye(r.from||n,r.default,!0):s=ye(r.from||n):s=ye(r),ze(s)?Object.defineProperty(i,n,{enumerable:!0,configurable:!0,get:()=>s.value,set:a=>s.value=a}):i[n]=s}}function Ru(t,i,e){zt(we(t)?t.map(n=>n.bind(i.proxy)):t.bind(i.proxy),i,e)}function Cu(t,i,e,n){const r=n.includes(".")?vu(e,n):()=>e[n];if(Xe(t)){const s=i[t];Pe(s)&&$e(r,s)}else if(Pe(t))$e(r,t.bind(e));else if(je(t))if(we(t))t.forEach(s=>Cu(s,i,e,n));else{const s=Pe(t.handler)?t.handler.bind(e):i[t.handler];Pe(s)&&$e(r,s,t)}}function Mo(t){const i=t.type,{mixins:e,extends:n}=i,{mixins:r,optionsCache:s,config:{optionMergeStrategies:a}}=t.appContext,o=s.get(i);let l;return o?l=o:!r.length&&!e&&!n?l=i:(l={},r.length&&r.forEach(u=>$r(l,u,a,!0)),$r(l,i,a)),je(i)&&s.set(i,l),l}function $r(t,i,e,n=!1){const{mixins:r,extends:s}=i;s&&$r(t,s,e,!0),r&&r.forEach(a=>$r(t,a,e,!0));for(const a in i)if(!(n&&a==="expose")){const o=um[a]||e&&e[a];t[a]=o?o(t[a],i[a]):i[a]}return t}const um={data:Ou,props:Iu,emits:Iu,methods:Vn,computed:Vn,beforeCreate:pt,created:pt,beforeMount:pt,mounted:pt,beforeUpdate:pt,updated:pt,beforeDestroy:pt,beforeUnmount:pt,destroyed:pt,unmounted:pt,activated:pt,deactivated:pt,errorCaptured:pt,serverPrefetch:pt,components:Vn,directives:Vn,watch:hm,provide:Ou,inject:cm};function Ou(t,i){return i?t?function(){return lt(Pe(t)?t.call(this,this):t,Pe(i)?i.call(this,this):i)}:i:t}function cm(t,i){return Vn(No(t),No(i))}function No(t){if(we(t)){const i={};for(let e=0;e1)return e&&Pe(i)?i.call(n&&n.proxy):i}}function pm(){return!!(tt||Qe||jn)}function mm(t,i,e,n=!1){const r={},s={};Mr(s,ts,1),t.propsDefaults=Object.create(null),ku(t,i,r,s);for(const a in t.propsOptions[0])a in r||(r[a]=void 0);e?t.props=n?r:Jl(r):t.type.props?t.props=r:t.props=s,t.attrs=s}function gm(t,i,e,n){const{props:r,attrs:s,vnode:{patchFlag:a}}=t,o=Ie(r),[l]=t.propsOptions;let u=!1;if((n||a>0)&&!(a&16)){if(a&8){const c=t.vnode.dynamicProps;for(let h=0;h{l=!0;const[f,p]=Du(h,i,!0);lt(a,f),p&&o.push(...p)};!e&&i.mixins.length&&i.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}if(!s&&!l)return je(t)&&n.set(t,It),It;if(we(s))for(let c=0;c-1,p[1]=b<0||m-1||Fe(p,"default"))&&o.push(h)}}}const u=[a,o];return je(t)&&n.set(t,u),u}function Mu(t){return t[0]!=="$"}function Nu(t){const i=t&&t.toString().match(/^\s*(function|class) (\w+)/);return i?i[2]:t===null?"null":""}function Lu(t,i){return Nu(t)===Nu(i)}function Fu(t,i){return we(i)?i.findIndex(e=>Lu(e,t)):Pe(i)&&Lu(i,t)?0:-1}const zu=t=>t[0]==="_"||t==="$stable",Fo=t=>we(t)?t.map(Yt):[Yt(t)],vm=(t,i,e)=>{if(i._n)return i;const n=ut((...r)=>Fo(i(...r)),e);return n._c=!1,n},Hu=(t,i,e)=>{const n=t._ctx;for(const r in t){if(zu(r))continue;const s=t[r];if(Pe(s))i[r]=vm(r,s,n);else if(s!=null){const a=Fo(s);i[r]=()=>a}}},Bu=(t,i)=>{const e=Fo(i);t.slots.default=()=>e},ym=(t,i)=>{if(t.vnode.shapeFlag&32){const e=i._;e?(t.slots=Ie(i),Mr(i,"_",e)):Hu(i,t.slots={})}else t.slots={},i&&Bu(t,i);Mr(t.slots,ts,1)},bm=(t,i,e)=>{const{vnode:n,slots:r}=t;let s=!0,a=Ne;if(n.shapeFlag&32){const o=i._;o?e&&o===1?s=!1:(lt(r,i),!e&&o===1&&delete r._):(s=!i.$stable,Hu(i,r)),a=i}else i&&(Bu(t,i),a={default:1});if(s)for(const o in r)!zu(o)&&a[o]==null&&delete r[o]};function zo(t,i,e,n,r=!1){if(we(t)){t.forEach((f,p)=>zo(f,i&&(we(i)?i[p]:i),e,n,r));return}if(hn(n)&&!r)return;const s=n.shapeFlag&4?os(n.component)||n.component.proxy:n.el,a=r?null:s,{i:o,r:l}=t,u=i&&i.r,c=o.refs===Ne?o.refs={}:o.refs,h=o.setupState;if(u!=null&&u!==l&&(Xe(u)?(c[u]=null,Fe(h,u)&&(h[u]=null)):ze(u)&&(u.value=null)),Pe(l))ri(l,o,12,[a,c]);else{const f=Xe(l),p=ze(l);if(f||p){const m=()=>{if(t.f){const b=f?Fe(h,l)?h[l]:c[l]:l.value;r?we(b)&&ro(b,s):we(b)?b.includes(s)||b.push(s):f?(c[l]=[s],Fe(h,l)&&(h[l]=c[l])):(l.value=[s],t.k&&(c[t.k]=l.value))}else f?(c[l]=a,Fe(h,l)&&(h[l]=a)):p&&(l.value=a,t.k&&(c[t.k]=a))};a?(m.id=-1,ct(m,e)):m()}}}const ct=qp;function wm(t){return _m(t)}function _m(t,i){const e=Cl();e.__VUE__=!0;const{insert:n,remove:r,patchProp:s,createElement:a,createText:o,createComment:l,setText:u,setElementText:c,parentNode:h,nextSibling:f,setScopeId:p=At,insertStaticContent:m}=t,b=(P,O,d,_=null,R=null,A=null,M=void 0,H=null,z=!!O.dynamicChildren)=>{if(P===O)return;P&&!fn(P,O)&&(_=W(P),_e(P,R,A,!0),P=null),O.patchFlag===-2&&(z=!1,O.dynamicChildren=null);const{type:G,ref:te,shapeFlag:I}=O;switch(G){case es:T(P,O,d,_);break;case Pi:y(P,O,d,_);break;case Bo:P==null&&w(O,d,_,M);break;case De:Se(P,O,d,_,R,A,M,H,z);break;default:I&1?L(P,O,d,_,R,A,M,H,z):I&6?Re(P,O,d,_,R,A,M,H,z):(I&64||I&128)&&G.process(P,O,d,_,R,A,M,H,z,he)}te!=null&&R&&zo(te,P&&P.ref,A,O||P,!O)},T=(P,O,d,_)=>{if(P==null)n(O.el=o(O.children),d,_);else{const R=O.el=P.el;O.children!==P.children&&u(R,O.children)}},y=(P,O,d,_)=>{P==null?n(O.el=l(O.children||""),d,_):O.el=P.el},w=(P,O,d,_)=>{[P.el,P.anchor]=m(P.children,O,d,_,P.el,P.anchor)},S=({el:P,anchor:O},d,_)=>{let R;for(;P&&P!==O;)R=f(P),n(P,d,_),P=R;n(O,d,_)},C=({el:P,anchor:O})=>{let d;for(;P&&P!==O;)d=f(P),r(P),P=d;r(O)},L=(P,O,d,_,R,A,M,H,z)=>{O.type==="svg"?M="svg":O.type==="math"&&(M="mathml"),P==null?D(O,d,_,R,A,M,H,z):K(P,O,R,A,M,H,z)},D=(P,O,d,_,R,A,M,H)=>{let z,G;const{props:te,shapeFlag:I,transition:F,dirs:V}=P;if(z=P.el=a(P.type,A,te&&te.is,te),I&8?c(z,P.children):I&16&&N(P.children,z,null,_,R,Ho(P,A),M,H),V&&qi(P,null,_,"created"),j(z,P,P.scopeId,M,_),te){for(const me in te)me!=="value"&&!Ar(me)&&s(z,me,null,te[me],A,P.children,_,R,Te);"value"in te&&s(z,"value",null,te.value,A),(G=te.onVnodeBeforeMount)&&kt(G,_,P)}V&&qi(P,null,_,"beforeMount");const X=Tm(R,F);X&&F.beforeEnter(z),n(z,O,d),((G=te&&te.onVnodeMounted)||X||V)&&ct(()=>{G&&kt(G,_,P),X&&F.enter(z),V&&qi(P,null,_,"mounted")},R)},j=(P,O,d,_,R)=>{if(d&&p(P,d),_)for(let A=0;A<_.length;A++)p(P,_[A]);if(R){let A=R.subTree;if(O===A){const M=R.vnode;j(P,M,M.scopeId,M.slotScopeIds,R.parent)}}},N=(P,O,d,_,R,A,M,H,z=0)=>{for(let G=z;G{const H=O.el=P.el;let{patchFlag:z,dynamicChildren:G,dirs:te}=O;z|=P.patchFlag&16;const I=P.props||Ne,F=O.props||Ne;let V;if(d&&Ki(d,!1),(V=F.onVnodeBeforeUpdate)&&kt(V,d,O,P),te&&qi(O,P,d,"beforeUpdate"),d&&Ki(d,!0),G?se(P.dynamicChildren,G,H,d,_,Ho(O,R),A):M||U(P,O,H,null,d,_,Ho(O,R),A,!1),z>0){if(z&16)ue(H,O,I,F,d,_,R);else if(z&2&&I.class!==F.class&&s(H,"class",null,F.class,R),z&4&&s(H,"style",I.style,F.style,R),z&8){const X=O.dynamicProps;for(let me=0;me{V&&kt(V,d,O,P),te&&qi(O,P,d,"updated")},_)},se=(P,O,d,_,R,A,M)=>{for(let H=0;H{if(d!==_){if(d!==Ne)for(const H in d)!Ar(H)&&!(H in _)&&s(P,H,d[H],null,M,O.children,R,A,Te);for(const H in _){if(Ar(H))continue;const z=_[H],G=d[H];z!==G&&H!=="value"&&s(P,H,G,z,M,O.children,R,A,Te)}"value"in _&&s(P,"value",d.value,_.value,M)}},Se=(P,O,d,_,R,A,M,H,z)=>{const G=O.el=P?P.el:o(""),te=O.anchor=P?P.anchor:o("");let{patchFlag:I,dynamicChildren:F,slotScopeIds:V}=O;V&&(H=H?H.concat(V):V),P==null?(n(G,d,_),n(te,d,_),N(O.children||[],d,te,R,A,M,H,z)):I>0&&I&64&&F&&P.dynamicChildren?(se(P.dynamicChildren,F,d,R,A,M,H),(O.key!=null||R&&O===R.subTree)&&Uu(P,O,!0)):U(P,O,d,te,R,A,M,H,z)},Re=(P,O,d,_,R,A,M,H,z)=>{O.slotScopeIds=H,P==null?O.shapeFlag&512?R.ctx.activate(O,d,_,M,z):Ee(O,d,_,R,A,M,z):Me(P,O,z)},Ee=(P,O,d,_,R,A,M)=>{const H=P.component=Im(P,_,R);if(Co(P)&&(H.ctx.renderer=he),Am(H),H.asyncDep){if(R&&R.registerDep(H,ge),!P.el){const z=H.subTree=be(Pi);y(null,z,O,d)}}else ge(H,P,O,d,R,A,M)},Me=(P,O,d)=>{const _=O.component=P.component;if(Up(P,O,d))if(_.asyncDep&&!_.asyncResolved){ne(_,O,d);return}else _.next=O,Np(_.update),_.effect.dirty=!0,_.update();else O.el=P.el,_.vnode=O},ge=(P,O,d,_,R,A,M)=>{const H=()=>{if(P.isMounted){let{next:te,bu:I,u:F,parent:V,vnode:X}=P;{const E=Vu(P);if(E){te&&(te.el=X.el,ne(P,te,M)),E.asyncDep.then(()=>{P.isUnmounted||H()});return}}let me=te,v;Ki(P,!1),te?(te.el=X.el,ne(P,te,M)):te=X,I&&ln(I),(v=te.props&&te.props.onVnodeBeforeUpdate)&&kt(v,V,te,X),Ki(P,!0);const g=Po(P),x=P.subTree;P.subTree=g,b(x,g,h(x.el),W(x),P,R,A),te.el=g.el,me===null&&Vp(P,g.el),F&&ct(F,R),(v=te.props&&te.props.onVnodeUpdated)&&ct(()=>kt(v,V,te,X),R)}else{let te;const{el:I,props:F}=O,{bm:V,m:X,parent:me}=P,v=hn(O);if(Ki(P,!1),V&&ln(V),!v&&(te=F&&F.onVnodeBeforeMount)&&kt(te,me,O),Ki(P,!0),I&&Ce){const g=()=>{P.subTree=Po(P),Ce(I,P.subTree,P,R,null)};v?O.type.__asyncLoader().then(()=>!P.isUnmounted&&g()):g()}else{const g=P.subTree=Po(P);b(null,g,d,_,P,R,A),O.el=g.el}if(X&&ct(X,R),!v&&(te=F&&F.onVnodeMounted)){const g=O;ct(()=>kt(te,me,g),R)}(O.shapeFlag&256||me&&hn(me.vnode)&&me.vnode.shapeFlag&256)&&P.a&&ct(P.a,R),P.isMounted=!0,O=d=_=null}},z=P.effect=new co(H,At,()=>Kr(G),P.scope),G=P.update=()=>{z.dirty&&z.run()};G.id=P.uid,Ki(P,!0),G()},ne=(P,O,d)=>{O.component=P;const _=P.vnode.props;P.vnode=O,P.next=null,gm(P,O.props,_,d),bm(P,O.children,d),_i(),au(P),Ti()},U=(P,O,d,_,R,A,M,H,z=!1)=>{const G=P&&P.children,te=P?P.shapeFlag:0,I=O.children,{patchFlag:F,shapeFlag:V}=O;if(F>0){if(F&128){ce(G,I,d,_,R,A,M,H,z);return}else if(F&256){re(G,I,d,_,R,A,M,H,z);return}}V&8?(te&16&&Te(G,R,A),I!==G&&c(d,I)):te&16?V&16?ce(G,I,d,_,R,A,M,H,z):Te(G,R,A,!0):(te&8&&c(d,""),V&16&&N(I,d,_,R,A,M,H,z))},re=(P,O,d,_,R,A,M,H,z)=>{P=P||It,O=O||It;const G=P.length,te=O.length,I=Math.min(G,te);let F;for(F=0;Fte?Te(P,R,A,!0,!1,I):N(O,d,_,R,A,M,H,z,I)},ce=(P,O,d,_,R,A,M,H,z)=>{let G=0;const te=O.length;let I=P.length-1,F=te-1;for(;G<=I&&G<=F;){const V=P[G],X=O[G]=z?Ri(O[G]):Yt(O[G]);if(fn(V,X))b(V,X,d,null,R,A,M,H,z);else break;G++}for(;G<=I&&G<=F;){const V=P[I],X=O[F]=z?Ri(O[F]):Yt(O[F]);if(fn(V,X))b(V,X,d,null,R,A,M,H,z);else break;I--,F--}if(G>I){if(G<=F){const V=F+1,X=VF)for(;G<=I;)_e(P[G],R,A,!0),G++;else{const V=G,X=G,me=new Map;for(G=X;G<=F;G++){const xe=O[G]=z?Ri(O[G]):Yt(O[G]);xe.key!=null&&me.set(xe.key,G)}let v,g=0;const x=F-X+1;let E=!1,B=0;const J=new Array(x);for(G=0;G=x){_e(xe,R,A,!0);continue}let pe;if(xe.key!=null)pe=me.get(xe.key);else for(v=X;v<=F;v++)if(J[v-X]===0&&fn(xe,O[v])){pe=v;break}pe===void 0?_e(xe,R,A,!0):(J[pe-X]=G+1,pe>=B?B=pe:E=!0,b(xe,O[pe],d,null,R,A,M,H,z),g++)}const fe=E?xm(J):It;for(v=fe.length-1,G=x-1;G>=0;G--){const xe=X+G,pe=O[xe],at=xe+1{const{el:A,type:M,transition:H,children:z,shapeFlag:G}=P;if(G&6){Q(P.component.subTree,O,d,_);return}if(G&128){P.suspense.move(O,d,_);return}if(G&64){M.move(P,O,d,he);return}if(M===De){n(A,O,d);for(let I=0;IH.enter(A),R);else{const{leave:I,delayLeave:F,afterLeave:V}=H,X=()=>n(A,O,d),me=()=>{I(A,()=>{X(),V&&V()})};F?F(A,X,me):me()}else n(A,O,d)},_e=(P,O,d,_=!1,R=!1)=>{const{type:A,props:M,ref:H,children:z,dynamicChildren:G,shapeFlag:te,patchFlag:I,dirs:F}=P;if(H!=null&&zo(H,null,d,P,!0),te&256){O.ctx.deactivate(P);return}const V=te&1&&F,X=!hn(P);let me;if(X&&(me=M&&M.onVnodeBeforeUnmount)&&kt(me,O,P),te&6)Ae(P.component,d,_);else{if(te&128){P.suspense.unmount(d,_);return}V&&qi(P,null,O,"beforeUnmount"),te&64?P.type.remove(P,O,d,R,he,_):G&&(A!==De||I>0&&I&64)?Te(G,O,d,!1,!0):(A===De&&I&384||!R&&te&16)&&Te(z,O,d),_&&He(P)}(X&&(me=M&&M.onVnodeUnmounted)||V)&&ct(()=>{me&&kt(me,O,P),V&&qi(P,null,O,"unmounted")},d)},He=P=>{const{type:O,el:d,anchor:_,transition:R}=P;if(O===De){Ve(d,_);return}if(O===Bo){C(P);return}const A=()=>{r(d),R&&!R.persisted&&R.afterLeave&&R.afterLeave()};if(P.shapeFlag&1&&R&&!R.persisted){const{leave:M,delayLeave:H}=R,z=()=>M(d,A);H?H(P.el,A,z):z()}else A()},Ve=(P,O)=>{let d;for(;P!==O;)d=f(P),r(P),P=d;r(O)},Ae=(P,O,d)=>{const{bum:_,scope:R,update:A,subTree:M,um:H}=P;_&&ln(_),R.stop(),A&&(A.active=!1,_e(M,P,O,d)),H&&ct(H,O),ct(()=>{P.isUnmounted=!0},O),O&&O.pendingBranch&&!O.isUnmounted&&P.asyncDep&&!P.asyncResolved&&P.suspenseId===O.pendingId&&(O.deps--,O.deps===0&&O.resolve())},Te=(P,O,d,_=!1,R=!1,A=0)=>{for(let M=A;MP.shapeFlag&6?W(P.component.subTree):P.shapeFlag&128?P.suspense.next():f(P.anchor||P.el);let oe=!1;const ae=(P,O,d)=>{P==null?O._vnode&&_e(O._vnode,null,null,!0):b(O._vnode||null,P,O,null,null,null,d),oe||(oe=!0,au(),lu(),oe=!1),O._vnode=P},he={p:b,um:_e,m:Q,r:He,mt:Ee,mc:N,pc:U,pbc:se,n:W,o:t};let ke,Ce;return i&&([ke,Ce]=i(he)),{render:ae,hydrate:ke,createApp:dm(ae,ke)}}function Ho({type:t,props:i},e){return e==="svg"&&t==="foreignObject"||e==="mathml"&&t==="annotation-xml"&&i&&i.encoding&&i.encoding.includes("html")?void 0:e}function Ki({effect:t,update:i},e){t.allowRecurse=i.allowRecurse=e}function Tm(t,i){return(!t||t&&!t.pendingBranch)&&i&&!i.persisted}function Uu(t,i,e=!1){const n=t.children,r=i.children;if(we(n)&&we(r))for(let s=0;s>1,t[e[o]]0&&(i[n]=e[s-1]),e[s]=n)}}for(s=e.length,a=e[s-1];s-- >0;)e[s]=a,a=i[a];return e}function Vu(t){const i=t.subTree.component;if(i)return i.asyncDep&&!i.asyncResolved?i:Vu(i)}const Sm=t=>t.__isTeleport,De=Symbol.for("v-fgt"),es=Symbol.for("v-txt"),Pi=Symbol.for("v-cmt"),Bo=Symbol.for("v-stc"),Wn=[];let Ht=null;function ie(t=!1){Wn.push(Ht=t?null:[])}function Em(){Wn.pop(),Ht=Wn[Wn.length-1]||null}let Gn=1;function ju(t){Gn+=t}function Wu(t){return t.dynamicChildren=Gn>0?Ht||It:null,Em(),Gn>0&&Ht&&Ht.push(t),t}function le(t,i,e,n,r,s){return Wu(ee(t,i,e,n,r,s,!0))}function bt(t,i,e,n,r){return Wu(be(t,i,e,n,r,!0))}function qn(t){return t?t.__v_isVNode===!0:!1}function fn(t,i){return t.type===i.type&&t.key===i.key}const ts="__vInternal",Gu=({key:t})=>t??null,is=({ref:t,ref_key:i,ref_for:e})=>(typeof t=="number"&&(t=""+t),t!=null?Xe(t)||ze(t)||Pe(t)?{i:Qe,r:t,k:i,f:!!e}:t:null);function ee(t,i=null,e=null,n=0,r=null,s=t===De?0:1,a=!1,o=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:i,key:i&&Gu(i),ref:i&&is(i),scopeId:hu,slotScopeIds:null,children:e,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:n,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:Qe};return o?(Uo(l,e),s&128&&t.normalize(l)):e&&(l.shapeFlag|=Xe(e)?8:16),Gn>0&&!a&&Ht&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&Ht.push(l),l}const be=Pm;function Pm(t,i=null,e=null,n=0,r=null,s=!1){if((!t||t===Wp)&&(t=Pi),qn(t)){const o=Zi(t,i,!0);return e&&Uo(o,e),Gn>0&&!s&&Ht&&(o.shapeFlag&6?Ht[Ht.indexOf(t)]=o:Ht.push(o)),o.patchFlag|=-2,o}if(Fm(t)&&(t=t.__vccOpts),i){i=Rm(i);let{class:o,style:l}=i;o&&!Xe(o)&&(i.class=q(o)),je(l)&&(_o(l)&&!we(l)&&(l=lt({},l)),i.style=qt(l))}const a=Xe(t)?1:mu(t)?128:Sm(t)?64:je(t)?4:Pe(t)?2:0;return ee(t,i,e,n,r,a,s,!0)}function Rm(t){return t?_o(t)||ts in t?lt({},t):t:null}function Zi(t,i,e=!1){const{props:n,ref:r,patchFlag:s,children:a}=t,o=i?ns(n||{},i):n;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:o,key:o&&Gu(o),ref:i&&i.ref?e&&r?we(r)?r.concat(is(i)):[r,is(i)]:is(i):r,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:i&&t.type!==De?s===-1?16:s|16:s,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:t.transition,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Zi(t.ssContent),ssFallback:t.ssFallback&&Zi(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce}}function mt(t=" ",i=0){return be(es,null,t,i)}function qe(t="",i=!1){return i?(ie(),bt(Pi,null,t)):be(Pi,null,t)}function Yt(t){return t==null||typeof t=="boolean"?be(Pi):we(t)?be(De,null,t.slice()):typeof t=="object"?Ri(t):be(es,null,String(t))}function Ri(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Zi(t)}function Uo(t,i){let e=0;const{shapeFlag:n}=t;if(i==null)i=null;else if(we(i))e=16;else if(typeof i=="object")if(n&65){const r=i.default;r&&(r._c&&(r._d=!1),Uo(t,r()),r._c&&(r._d=!0));return}else{e=32;const r=i._;!r&&!(ts in i)?i._ctx=Qe:r===3&&Qe&&(Qe.slots._===1?i._=1:(i._=2,t.patchFlag|=1024))}else Pe(i)?(i={default:i,_ctx:Qe},e=32):(i=String(i),n&64?(e=16,i=[mt(i)]):e=8);t.children=i,t.shapeFlag|=e}function ns(...t){const i={};for(let e=0;ett||Qe;let ss,Vo;{const t=Cl(),i=(e,n)=>{let r;return(r=t[e])||(r=t[e]=[]),r.push(n),s=>{r.length>1?r.forEach(a=>a(s)):r[0](s)}};ss=i("__VUE_INSTANCE_SETTERS__",e=>tt=e),Vo=i("__VUE_SSR_SETTERS__",e=>Zn=e)}const Kn=t=>{const i=tt;return ss(t),t.scope.on(),()=>{t.scope.off(),ss(i)}},qu=()=>{tt&&tt.scope.off(),ss(null)};function Ku(t){return t.vnode.shapeFlag&4}let Zn=!1;function Am(t,i=!1){i&&Vo(i);const{props:e,children:n}=t.vnode,r=Ku(t);mm(t,e,r,i),ym(t,n);const s=r?km(t,i):void 0;return i&&Vo(!1),s}function km(t,i){const e=t.type;t.accessCache=Object.create(null),t.proxy=Gr(new Proxy(t.ctx,om));const{setup:n}=e;if(n){const r=t.setupContext=n.length>1?Mm(t):null,s=Kn(t);_i();const a=ri(n,t,0,[t.props,r]);if(Ti(),s(),Sl(a)){if(a.then(qu,qu),i)return a.then(o=>{Zu(t,o,i)}).catch(o=>{Nn(o,t,0)});t.asyncDep=a}else Zu(t,a,i)}else Xu(t,i)}function Zu(t,i,e){Pe(i)?t.type.__ssrInlineRender?t.ssrRender=i:t.render=i:je(i)&&(t.setupState=tu(i)),Xu(t,e)}let Yu;function Xu(t,i,e){const n=t.type;if(!t.render){if(!i&&Yu&&!n.render){const r=n.template||Mo(t).template;if(r){const{isCustomElement:s,compilerOptions:a}=t.appContext.config,{delimiters:o,compilerOptions:l}=n,u=lt(lt({isCustomElement:s,delimiters:o},a),l);n.render=Yu(r,u)}}t.render=n.render||At}{const r=Kn(t);_i();try{am(t)}finally{Ti(),r()}}}function Dm(t){return t.attrsProxy||(t.attrsProxy=new Proxy(t.attrs,{get(i,e){return vt(t,"get","$attrs"),i[e]}}))}function Mm(t){const i=e=>{t.exposed=e||{}};return{get attrs(){return Dm(t)},slots:t.slots,emit:t.emit,expose:i}}function os(t){if(t.exposed)return t.exposeProxy||(t.exposeProxy=new Proxy(tu(Gr(t.exposed)),{get(i,e){if(e in i)return i[e];if(e in Un)return Un[e](t)},has(i,e){return e in i||e in Un}}))}const Nm=/(?:^|[-_])(\w)/g,Lm=t=>t.replace(Nm,i=>i.toUpperCase()).replace(/[-_]/g,"");function as(t,i=!0){return Pe(t)?t.displayName||t.name:t.name||i&&t.__name}function Ju(t,i,e=!1){let n=as(i);if(!n&&i.__file){const r=i.__file.match(/([^/\\]+)\.\w+$/);r&&(n=r[1])}if(!n&&t&&t.parent){const r=s=>{for(const a in s)if(s[a]===i)return a};n=r(t.components||t.parent.type.components)||r(t.appContext.components)}return n?Lm(n):e?"App":"Anonymous"}function Fm(t){return Pe(t)&&"__vccOpts"in t}const Y=(t,i)=>_p(t,i,Zn);function Qu(t,i,e=Ne){const n=rs(),r=Ft(i),s=bi(i),a=iu((l,u)=>{let c;return Yp(()=>{const h=t[i];Gt(c,h)&&(c=h,u())}),{get(){return l(),e.get?e.get(c):c},set(h){const f=n.vnode.props;!(f&&(i in f||r in f||s in f)&&(`onUpdate:${i}`in f||`onUpdate:${r}`in f||`onUpdate:${s}`in f))&&Gt(h,c)&&(c=h,u()),n.emit(`update:${i}`,e.set?e.set(h):h)}}}),o=i==="modelValue"?"modelModifiers":`${i}Modifiers`;return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?t[o]||{}:a,done:!1}:{done:!0}}}},a}function ls(t,i,e){const n=arguments.length;return n===2?je(i)&&!we(i)?qn(i)?be(t,null,[i]):be(t,i):be(t,null,i):(n>3?e=Array.prototype.slice.call(arguments,2):n===3&&qn(e)&&(e=[e]),be(t,i,e))}const zm="3.4.14";/** +`],...Ap(e))}),i}function Ap({vnode:t,recurseCount:i}){const e=i>0?`... (${i} recursive calls)`:"",n=t.component?t.component.parent==null:!1,r=` at <${Ju(t.component,t.type,n)}`,s=">"+e;return t.props?[r,...kp(t.props),s]:[r+s]}function kp(t){const i=[],e=Object.keys(t);return e.slice(0,3).forEach(n=>{i.push(...ru(n,t[n]))}),e.length>3&&i.push(" ..."),i}function ru(t,i,e){return Xe(i)?(i=JSON.stringify(i),e?i:[`${t}=${i}`]):typeof i=="number"||typeof i=="boolean"||i==null?e?i:[`${t}=${i}`]:ze(i)?(i=ru(t,Ae(i.value),!0),e?i:[`${t}=Ref<`,i,">"]):Pe(i)?[`${t}=fn${i.name?`<${i.name}>`:""}`]:(i=Ae(i),e?i:[`${t}=`,i])}function ri(t,i,e,n){let r;try{r=n?t(...n):t()}catch(s){Nn(s,i,e)}return r}function zt(t,i,e,n){if(Pe(t)){const s=ri(t,i,e,n);return s&&Sl(s)&&s.catch(a=>{Nn(a,i,e)}),s}const r=[];for(let s=0;s>>1,r=ft[n],s=zn(r);sZt&&ft.splice(i,1)}function Lp(t){we(t)?cn.push(...t):(!Si||!Si.includes(t,t.allowRecurse?Wi+1:Wi))&&cn.push(t),ou()}function au(t,i,e=Ln?Zt+1:0){for(;ezn(e)-zn(n));if(cn.length=0,Si){Si.push(...i);return}for(Si=i,Wi=0;Wit.id==null?1/0:t.id,Fp=(t,i)=>{const e=zn(t)-zn(i);if(e===0){if(t.pre&&!i.pre)return-1;if(i.pre&&!t.pre)return 1}return e};function uu(t){So=!1,Ln=!0,ft.sort(Fp);try{for(Zt=0;ZtXe(p)?p.trim():p)),h&&(r=e.map(Nr))}let o,l=n[o=oo(i)]||n[o=oo(Ft(i))];!l&&s&&(l=n[o=oo(bi(i))]),l&&zt(l,t,6,r);const u=n[o+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[o])return;t.emitted[o]=!0,zt(u,t,6,r)}}function cu(t,i,e=!1){const n=i.emitsCache,r=n.get(t);if(r!==void 0)return r;const s=t.emits;let a={},o=!1;if(!Pe(t)){const l=u=>{const c=cu(u,i,!0);c&&(o=!0,lt(a,c))};!e&&i.mixins.length&&i.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!s&&!o?(je(t)&&n.set(t,null),null):(we(s)?s.forEach(l=>a[l]=null):lt(a,s),je(t)&&n.set(t,a),a)}function Zr(t,i){return!t||!Ir(i)?!1:(i=i.slice(2).replace(/Once$/,""),Fe(t,i[0].toLowerCase()+i.slice(1))||Fe(t,bi(i))||Fe(t,i))}let Qe=null,hu=null;function Yr(t){const i=Qe;return Qe=t,hu=t&&t.type.__scopeId||null,i}function ut(t,i=Qe,e){if(!i||t._n)return t;const n=(...r)=>{n._d&&ju(-1);const s=Yr(i);let a;try{a=t(...r)}finally{Yr(s),n._d&&ju(1)}return a};return n._n=!0,n._c=!0,n._d=!0,n}function xR(){}function Po(t){const{type:i,vnode:e,proxy:n,withProxy:r,props:s,propsOptions:[a],slots:o,attrs:l,emit:u,render:c,renderCache:h,data:f,setupState:p,ctx:m,inheritAttrs:b}=t;let T,y;const w=Yr(t);try{if(e.shapeFlag&4){const C=r||n,L=C;T=Yt(c.call(L,C,h,s,p,f,m)),y=l}else{const C=i;T=Yt(C.length>1?C(s,{attrs:l,slots:o,emit:u}):C(s,null)),y=i.props?l:Hp(l)}}catch(C){Wn.length=0,Nn(C,t,1),T=be(Pi)}let S=T;if(y&&b!==!1){const C=Object.keys(y),{shapeFlag:L}=S;C.length&&L&7&&(a&&C.some(no)&&(y=Bp(y,a)),S=Zi(S,y))}return e.dirs&&(S=Zi(S),S.dirs=S.dirs?S.dirs.concat(e.dirs):e.dirs),e.transition&&(S.transition=e.transition),T=S,Yr(w),T}const Hp=t=>{let i;for(const e in t)(e==="class"||e==="style"||Ir(e))&&((i||(i={}))[e]=t[e]);return i},Bp=(t,i)=>{const e={};for(const n in t)(!no(n)||!(n.slice(9)in i))&&(e[n]=t[n]);return e};function Up(t,i,e){const{props:n,children:r,component:s}=t,{props:a,children:o,patchFlag:l}=i,u=s.emitsOptions;if(i.dirs||i.transition)return!0;if(e&&l>=0){if(l&1024)return!0;if(l&16)return n?fu(n,a,u):!!a;if(l&8){const c=i.dynamicProps;for(let h=0;ht.__isSuspense;function qp(t,i){i&&i.pendingBranch?we(t)?i.effects.push(...t):i.effects.push(t):Lp(t)}const Kp=Symbol.for("v-scx"),Zp=()=>ye(Kp);function gu(t,i){return Jr(t,null,i)}function Yp(t,i){return Jr(t,null,{flush:"sync"})}const Xr={};function $e(t,i,e){return Jr(t,i,e)}function Jr(t,i,{immediate:e,deep:n,flush:r,once:s,onTrack:a,onTrigger:o}=Ne){if(i&&s){const D=i;i=(...j)=>{D(...j),L()}}const l=tt,u=D=>n===!0?D:Gi(D,n===!1?1:void 0);let c,h=!1,f=!1;if(ze(t)?(c=()=>t.value,h=Wr(t)):ni(t)?(c=()=>u(t),h=!0):we(t)?(f=!0,h=t.some(D=>ni(D)||Wr(D)),c=()=>t.map(D=>{if(ze(D))return D.value;if(ni(D))return u(D);if(Pe(D))return ri(D,l,2)})):Pe(t)?i?c=()=>ri(t,l,2):c=()=>(p&&p(),zt(t,l,3,[m])):c=At,i&&n){const D=c;c=()=>Gi(D())}let p,m=D=>{p=S.onStop=()=>{ri(D,l,4),p=S.onStop=void 0}},b;if(Zn)if(m=At,i?e&&zt(i,l,3,[c(),f?[]:void 0,m]):c(),r==="sync"){const D=Zp();b=D.__watcherHandles||(D.__watcherHandles=[])}else return At;let T=f?new Array(t.length).fill(Xr):Xr;const y=()=>{if(!(!S.active||!S.dirty))if(i){const D=S.run();(n||h||(f?D.some((j,N)=>Gt(j,T[N])):Gt(D,T)))&&(p&&p(),zt(i,l,3,[D,T===Xr?void 0:f&&T[0]===Xr?[]:T,m]),T=D)}else S.run()};y.allowRecurse=!!i;let w;r==="sync"?w=y:r==="post"?w=()=>ct(y,l&&l.suspense):(y.pre=!0,l&&(y.id=l.uid),w=()=>Kr(y));const S=new co(c,At,w),C=Lr(),L=()=>{S.stop(),C&&ro(C.effects,S)};return i?e?y():T=S.run():r==="post"?ct(S.run.bind(S),l&&l.suspense):S.run(),b&&b.push(L),L}function Xp(t,i,e){const n=this.proxy,r=Xe(t)?t.includes(".")?vu(n,t):()=>n[t]:t.bind(n,n);let s;Pe(i)?s=i:(s=i.handler,e=i);const a=Kn(this),o=Jr(r,s.bind(n),e);return a(),o}function vu(t,i){const e=i.split(".");return()=>{let n=t;for(let r=0;r0){if(e>=i)return t;e++}if(n=n||new Set,n.has(t))return t;if(n.add(t),ze(t))Gi(t.value,i,e,n);else if(we(t))for(let r=0;r{Gi(r,i,e,n)});else if(Pl(t))for(const r in t)Gi(t[r],i,e,n);return t}function xt(t,i){if(Qe===null)return t;const e=os(Qe)||Qe.proxy,n=t.dirs||(t.dirs=[]);for(let r=0;r!!t.type.__asyncLoader;/*! #__NO_SIDE_EFFECTS__ */function bu(t){Pe(t)&&(t={loader:t});const{loader:i,loadingComponent:e,errorComponent:n,delay:r=200,timeout:s,suspensible:a=!0,onError:o}=t;let l=null,u,c=0;const h=()=>(c++,l=null,f()),f=()=>{let p;return l||(p=l=i().catch(m=>{if(m=m instanceof Error?m:new Error(String(m)),o)return new Promise((b,T)=>{o(m,()=>b(h()),()=>T(m),c+1)});throw m}).then(m=>p!==l&&l?l:(m&&(m.__esModule||m[Symbol.toStringTag]==="Module")&&(m=m.default),u=m,m)))};return Hn({name:"AsyncComponentWrapper",__asyncLoader:f,get __asyncResolved(){return u},setup(){const p=tt;if(u)return()=>Ro(u,p);const m=w=>{l=null,Nn(w,p,13,!n)};if(a&&p.suspense||Zn)return f().then(w=>()=>Ro(w,p)).catch(w=>(m(w),()=>n?be(n,{error:w}):null));const b=$(!1),T=$(),y=$(!!r);return r&&setTimeout(()=>{y.value=!1},r),s!=null&&setTimeout(()=>{if(!b.value&&!T.value){const w=new Error(`Async component timed out after ${s}ms.`);m(w),T.value=w}},s),f().then(()=>{b.value=!0,p.parent&&Co(p.parent.vnode)&&(p.parent.effect.dirty=!0,Kr(p.parent.update))}).catch(w=>{m(w),T.value=w}),()=>{if(b.value&&u)return Ro(u,p);if(T.value&&n)return be(n,{error:T.value});if(e&&!y.value)return be(e)}}})}function Ro(t,i){const{ref:e,props:n,children:r,ce:s}=i.vnode,a=be(t,n,r);return a.ref=e,a.ce=s,delete i.vnode.ce,a}const Co=t=>t.type.__isKeepAlive,wu={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(t,{slots:i}){const e=rs(),n=e.ctx;if(!n.renderer)return()=>{const w=i.default&&i.default();return w&&w.length===1?w[0]:w};const r=new Map,s=new Set;let a=null;const o=e.suspense,{renderer:{p:l,m:u,um:c,o:{createElement:h}}}=n,f=h("div");n.activate=(w,S,C,L,D)=>{const j=w.component;u(w,S,C,0,o),l(j.vnode,w,S,C,j,o,L,w.slotScopeIds,D),ct(()=>{j.isDeactivated=!1,j.a&&ln(j.a);const N=w.props&&w.props.onVnodeMounted;N&&kt(N,j.parent,w)},o)},n.deactivate=w=>{const S=w.component;u(w,f,null,1,o),ct(()=>{S.da&&ln(S.da);const C=w.props&&w.props.onVnodeUnmounted;C&&kt(C,S.parent,w),S.isDeactivated=!0},o)};function p(w){Oo(w),c(w,e,o,!0)}function m(w){r.forEach((S,C)=>{const L=as(S.type);L&&(!w||!w(L))&&b(C)})}function b(w){const S=r.get(w);!a||!fn(S,a)?p(S):a&&Oo(a),r.delete(w),s.delete(w)}$e(()=>[t.include,t.exclude],([w,S])=>{w&&m(C=>Bn(w,C)),S&&m(C=>!Bn(S,C))},{flush:"post",deep:!0});let T=null;const y=()=>{T!=null&&r.set(T,Io(e.subTree))};return oi(y),Tu(y),xu(()=>{r.forEach(w=>{const{subTree:S,suspense:C}=e,L=Io(S);if(w.type===L.type&&w.key===L.key){Oo(L);const D=L.component.da;D&&ct(D,C);return}p(w)})}),()=>{if(T=null,!i.default)return null;const w=i.default(),S=w[0];if(w.length>1)return a=null,w;if(!qn(S)||!(S.shapeFlag&4)&&!(S.shapeFlag&128))return a=null,S;let C=Io(S);const L=C.type,D=as(hn(C)?C.type.__asyncResolved||{}:L),{include:j,exclude:N,max:K}=t;if(j&&(!D||!Bn(j,D))||N&&D&&Bn(N,D))return a=C,S;const se=C.key==null?L:C.key,ue=r.get(se);return C.el&&(C=Zi(C),S.shapeFlag&128&&(S.ssContent=C)),T=se,ue?(C.el=ue.el,C.component=ue.component,C.transition&&yu(C,C.transition),C.shapeFlag|=512,s.delete(se),s.add(se)):(s.add(se),K&&s.size>parseInt(K,10)&&b(s.values().next().value)),C.shapeFlag|=256,a=C,mu(S.type)?S:C}}};function Bn(t,i){return we(t)?t.some(e=>Bn(e,i)):Xe(t)?t.split(",").includes(i):Wd(t)?t.test(i):!1}function Jp(t,i){_u(t,"a",i)}function Qp(t,i){_u(t,"da",i)}function _u(t,i,e=tt){const n=t.__wdc||(t.__wdc=()=>{let r=e;for(;r;){if(r.isDeactivated)return;r=r.parent}return t()});if(Qr(i,n,e),e){let r=e.parent;for(;r&&r.parent;)Co(r.parent.vnode)&&$p(n,i,e,r),r=r.parent}}function $p(t,i,e,n){const r=Qr(i,t,n,!0);Su(()=>{ro(n[i],r)},e)}function Oo(t){t.shapeFlag&=-257,t.shapeFlag&=-513}function Io(t){return t.shapeFlag&128?t.ssContent:t}function Qr(t,i,e=tt,n=!1){if(e){const r=e[t]||(e[t]=[]),s=i.__weh||(i.__weh=(...a)=>{if(e.isUnmounted)return;_i();const o=Kn(e),l=zt(i,e,t,a);return o(),Ti(),l});return n?r.unshift(s):r.push(s),s}}const si=t=>(i,e=tt)=>(!Zn||t==="sp")&&Qr(t,(...n)=>i(...n),e),em=si("bm"),oi=si("m"),tm=si("bu"),Tu=si("u"),xu=si("bum"),Su=si("um"),im=si("sp"),nm=si("rtg"),rm=si("rtc");function sm(t,i=tt){Qr("ec",t,i)}function yt(t,i,e,n){let r;const s=e&&e[n];if(we(t)||Xe(t)){r=new Array(t.length);for(let a=0,o=t.length;ai(a,o,void 0,s&&s[o]));else{const a=Object.keys(t);r=new Array(a.length);for(let o=0,l=a.length;oqn(i)?!(i.type===Pi||i.type===De&&!Eu(i.children)):!0)?t:null}const Ao=t=>t?Ku(t)?os(t)||t.proxy:Ao(t.parent):null,Un=lt(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Ao(t.parent),$root:t=>Ao(t.root),$emit:t=>t.emit,$options:t=>Mo(t),$forceUpdate:t=>t.f||(t.f=()=>{t.effect.dirty=!0,Kr(t.update)}),$nextTick:t=>t.n||(t.n=Fn.bind(t.proxy)),$watch:t=>Xp.bind(t)}),ko=(t,i)=>t!==Ne&&!t.__isScriptSetup&&Fe(t,i),om={get({_:t},i){const{ctx:e,setupState:n,data:r,props:s,accessCache:a,type:o,appContext:l}=t;let u;if(i[0]!=="$"){const p=a[i];if(p!==void 0)switch(p){case 1:return n[i];case 2:return r[i];case 4:return e[i];case 3:return s[i]}else{if(ko(n,i))return a[i]=1,n[i];if(r!==Ne&&Fe(r,i))return a[i]=2,r[i];if((u=t.propsOptions[0])&&Fe(u,i))return a[i]=3,s[i];if(e!==Ne&&Fe(e,i))return a[i]=4,e[i];Do&&(a[i]=0)}}const c=Un[i];let h,f;if(c)return i==="$attrs"&&vt(t,"get",i),c(t);if((h=o.__cssModules)&&(h=h[i]))return h;if(e!==Ne&&Fe(e,i))return a[i]=4,e[i];if(f=l.config.globalProperties,Fe(f,i))return f[i]},set({_:t},i,e){const{data:n,setupState:r,ctx:s}=t;return ko(r,i)?(r[i]=e,!0):n!==Ne&&Fe(n,i)?(n[i]=e,!0):Fe(t.props,i)||i[0]==="$"&&i.slice(1)in t?!1:(s[i]=e,!0)},has({_:{data:t,setupState:i,accessCache:e,ctx:n,appContext:r,propsOptions:s}},a){let o;return!!e[a]||t!==Ne&&Fe(t,a)||ko(i,a)||(o=s[0])&&Fe(o,a)||Fe(n,a)||Fe(Un,a)||Fe(r.config.globalProperties,a)},defineProperty(t,i,e){return e.get!=null?t._.accessCache[i]=0:Fe(e,"value")&&this.set(t,i,e.value,null),Reflect.defineProperty(t,i,e)}};function Pu(t){return we(t)?t.reduce((i,e)=>(i[e]=null,i),{}):t}let Do=!0;function am(t){const i=Mo(t),e=t.proxy,n=t.ctx;Do=!1,i.beforeCreate&&Ru(i.beforeCreate,t,"bc");const{data:r,computed:s,methods:a,watch:o,provide:l,inject:u,created:c,beforeMount:h,mounted:f,beforeUpdate:p,updated:m,activated:b,deactivated:T,beforeDestroy:y,beforeUnmount:w,destroyed:S,unmounted:C,render:L,renderTracked:D,renderTriggered:j,errorCaptured:N,serverPrefetch:K,expose:se,inheritAttrs:ue,components:Se,directives:Re,filters:Ee}=i;if(u&&lm(u,n,null),a)for(const ne in a){const U=a[ne];Pe(U)&&(n[ne]=U.bind(e))}if(r){const ne=r.call(e,e);je(ne)&&(t.data=Kt(ne))}if(Do=!0,s)for(const ne in s){const U=s[ne],re=Pe(U)?U.bind(e,e):Pe(U.get)?U.get.bind(e,e):At,ce=!Pe(U)&&Pe(U.set)?U.set.bind(e):At,Q=Y({get:re,set:ce});Object.defineProperty(n,ne,{enumerable:!0,configurable:!0,get:()=>Q.value,set:_e=>Q.value=_e})}if(o)for(const ne in o)Cu(o[ne],n,e,ne);if(l){const ne=Pe(l)?l.call(e):l;Reflect.ownKeys(ne).forEach(U=>{St(U,ne[U])})}c&&Ru(c,t,"c");function ge(ne,U){we(U)?U.forEach(re=>ne(re.bind(e))):U&&ne(U.bind(e))}if(ge(em,h),ge(oi,f),ge(tm,p),ge(Tu,m),ge(Jp,b),ge(Qp,T),ge(sm,N),ge(rm,D),ge(nm,j),ge(xu,w),ge(Su,C),ge(im,K),we(se))if(se.length){const ne=t.exposed||(t.exposed={});se.forEach(U=>{Object.defineProperty(ne,U,{get:()=>e[U],set:re=>e[U]=re})})}else t.exposed||(t.exposed={});L&&t.render===At&&(t.render=L),ue!=null&&(t.inheritAttrs=ue),Se&&(t.components=Se),Re&&(t.directives=Re)}function lm(t,i,e=At){we(t)&&(t=No(t));for(const n in t){const r=t[n];let s;je(r)?"default"in r?s=ye(r.from||n,r.default,!0):s=ye(r.from||n):s=ye(r),ze(s)?Object.defineProperty(i,n,{enumerable:!0,configurable:!0,get:()=>s.value,set:a=>s.value=a}):i[n]=s}}function Ru(t,i,e){zt(we(t)?t.map(n=>n.bind(i.proxy)):t.bind(i.proxy),i,e)}function Cu(t,i,e,n){const r=n.includes(".")?vu(e,n):()=>e[n];if(Xe(t)){const s=i[t];Pe(s)&&$e(r,s)}else if(Pe(t))$e(r,t.bind(e));else if(je(t))if(we(t))t.forEach(s=>Cu(s,i,e,n));else{const s=Pe(t.handler)?t.handler.bind(e):i[t.handler];Pe(s)&&$e(r,s,t)}}function Mo(t){const i=t.type,{mixins:e,extends:n}=i,{mixins:r,optionsCache:s,config:{optionMergeStrategies:a}}=t.appContext,o=s.get(i);let l;return o?l=o:!r.length&&!e&&!n?l=i:(l={},r.length&&r.forEach(u=>$r(l,u,a,!0)),$r(l,i,a)),je(i)&&s.set(i,l),l}function $r(t,i,e,n=!1){const{mixins:r,extends:s}=i;s&&$r(t,s,e,!0),r&&r.forEach(a=>$r(t,a,e,!0));for(const a in i)if(!(n&&a==="expose")){const o=um[a]||e&&e[a];t[a]=o?o(t[a],i[a]):i[a]}return t}const um={data:Ou,props:Iu,emits:Iu,methods:Vn,computed:Vn,beforeCreate:pt,created:pt,beforeMount:pt,mounted:pt,beforeUpdate:pt,updated:pt,beforeDestroy:pt,beforeUnmount:pt,destroyed:pt,unmounted:pt,activated:pt,deactivated:pt,errorCaptured:pt,serverPrefetch:pt,components:Vn,directives:Vn,watch:hm,provide:Ou,inject:cm};function Ou(t,i){return i?t?function(){return lt(Pe(t)?t.call(this,this):t,Pe(i)?i.call(this,this):i)}:i:t}function cm(t,i){return Vn(No(t),No(i))}function No(t){if(we(t)){const i={};for(let e=0;e1)return e&&Pe(i)?i.call(n&&n.proxy):i}}function pm(){return!!(tt||Qe||jn)}function mm(t,i,e,n=!1){const r={},s={};Mr(s,ts,1),t.propsDefaults=Object.create(null),ku(t,i,r,s);for(const a in t.propsOptions[0])a in r||(r[a]=void 0);e?t.props=n?r:Jl(r):t.type.props?t.props=r:t.props=s,t.attrs=s}function gm(t,i,e,n){const{props:r,attrs:s,vnode:{patchFlag:a}}=t,o=Ae(r),[l]=t.propsOptions;let u=!1;if((n||a>0)&&!(a&16)){if(a&8){const c=t.vnode.dynamicProps;for(let h=0;h{l=!0;const[f,p]=Du(h,i,!0);lt(a,f),p&&o.push(...p)};!e&&i.mixins.length&&i.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}if(!s&&!l)return je(t)&&n.set(t,It),It;if(we(s))for(let c=0;c-1,p[1]=b<0||m-1||Fe(p,"default"))&&o.push(h)}}}const u=[a,o];return je(t)&&n.set(t,u),u}function Mu(t){return t[0]!=="$"}function Nu(t){const i=t&&t.toString().match(/^\s*(function|class) (\w+)/);return i?i[2]:t===null?"null":""}function Lu(t,i){return Nu(t)===Nu(i)}function Fu(t,i){return we(i)?i.findIndex(e=>Lu(e,t)):Pe(i)&&Lu(i,t)?0:-1}const zu=t=>t[0]==="_"||t==="$stable",Fo=t=>we(t)?t.map(Yt):[Yt(t)],vm=(t,i,e)=>{if(i._n)return i;const n=ut((...r)=>Fo(i(...r)),e);return n._c=!1,n},Hu=(t,i,e)=>{const n=t._ctx;for(const r in t){if(zu(r))continue;const s=t[r];if(Pe(s))i[r]=vm(r,s,n);else if(s!=null){const a=Fo(s);i[r]=()=>a}}},Bu=(t,i)=>{const e=Fo(i);t.slots.default=()=>e},ym=(t,i)=>{if(t.vnode.shapeFlag&32){const e=i._;e?(t.slots=Ae(i),Mr(i,"_",e)):Hu(i,t.slots={})}else t.slots={},i&&Bu(t,i);Mr(t.slots,ts,1)},bm=(t,i,e)=>{const{vnode:n,slots:r}=t;let s=!0,a=Ne;if(n.shapeFlag&32){const o=i._;o?e&&o===1?s=!1:(lt(r,i),!e&&o===1&&delete r._):(s=!i.$stable,Hu(i,r)),a=i}else i&&(Bu(t,i),a={default:1});if(s)for(const o in r)!zu(o)&&a[o]==null&&delete r[o]};function zo(t,i,e,n,r=!1){if(we(t)){t.forEach((f,p)=>zo(f,i&&(we(i)?i[p]:i),e,n,r));return}if(hn(n)&&!r)return;const s=n.shapeFlag&4?os(n.component)||n.component.proxy:n.el,a=r?null:s,{i:o,r:l}=t,u=i&&i.r,c=o.refs===Ne?o.refs={}:o.refs,h=o.setupState;if(u!=null&&u!==l&&(Xe(u)?(c[u]=null,Fe(h,u)&&(h[u]=null)):ze(u)&&(u.value=null)),Pe(l))ri(l,o,12,[a,c]);else{const f=Xe(l),p=ze(l);if(f||p){const m=()=>{if(t.f){const b=f?Fe(h,l)?h[l]:c[l]:l.value;r?we(b)&&ro(b,s):we(b)?b.includes(s)||b.push(s):f?(c[l]=[s],Fe(h,l)&&(h[l]=c[l])):(l.value=[s],t.k&&(c[t.k]=l.value))}else f?(c[l]=a,Fe(h,l)&&(h[l]=a)):p&&(l.value=a,t.k&&(c[t.k]=a))};a?(m.id=-1,ct(m,e)):m()}}}const ct=qp;function wm(t){return _m(t)}function _m(t,i){const e=Cl();e.__VUE__=!0;const{insert:n,remove:r,patchProp:s,createElement:a,createText:o,createComment:l,setText:u,setElementText:c,parentNode:h,nextSibling:f,setScopeId:p=At,insertStaticContent:m}=t,b=(P,O,d,_=null,R=null,A=null,M=void 0,H=null,z=!!O.dynamicChildren)=>{if(P===O)return;P&&!fn(P,O)&&(_=W(P),_e(P,R,A,!0),P=null),O.patchFlag===-2&&(z=!1,O.dynamicChildren=null);const{type:G,ref:te,shapeFlag:I}=O;switch(G){case es:T(P,O,d,_);break;case Pi:y(P,O,d,_);break;case Bo:P==null&&w(O,d,_,M);break;case De:Se(P,O,d,_,R,A,M,H,z);break;default:I&1?L(P,O,d,_,R,A,M,H,z):I&6?Re(P,O,d,_,R,A,M,H,z):(I&64||I&128)&&G.process(P,O,d,_,R,A,M,H,z,he)}te!=null&&R&&zo(te,P&&P.ref,A,O||P,!O)},T=(P,O,d,_)=>{if(P==null)n(O.el=o(O.children),d,_);else{const R=O.el=P.el;O.children!==P.children&&u(R,O.children)}},y=(P,O,d,_)=>{P==null?n(O.el=l(O.children||""),d,_):O.el=P.el},w=(P,O,d,_)=>{[P.el,P.anchor]=m(P.children,O,d,_,P.el,P.anchor)},S=({el:P,anchor:O},d,_)=>{let R;for(;P&&P!==O;)R=f(P),n(P,d,_),P=R;n(O,d,_)},C=({el:P,anchor:O})=>{let d;for(;P&&P!==O;)d=f(P),r(P),P=d;r(O)},L=(P,O,d,_,R,A,M,H,z)=>{O.type==="svg"?M="svg":O.type==="math"&&(M="mathml"),P==null?D(O,d,_,R,A,M,H,z):K(P,O,R,A,M,H,z)},D=(P,O,d,_,R,A,M,H)=>{let z,G;const{props:te,shapeFlag:I,transition:F,dirs:V}=P;if(z=P.el=a(P.type,A,te&&te.is,te),I&8?c(z,P.children):I&16&&N(P.children,z,null,_,R,Ho(P,A),M,H),V&&qi(P,null,_,"created"),j(z,P,P.scopeId,M,_),te){for(const me in te)me!=="value"&&!Ar(me)&&s(z,me,null,te[me],A,P.children,_,R,xe);"value"in te&&s(z,"value",null,te.value,A),(G=te.onVnodeBeforeMount)&&kt(G,_,P)}V&&qi(P,null,_,"beforeMount");const X=Tm(R,F);X&&F.beforeEnter(z),n(z,O,d),((G=te&&te.onVnodeMounted)||X||V)&&ct(()=>{G&&kt(G,_,P),X&&F.enter(z),V&&qi(P,null,_,"mounted")},R)},j=(P,O,d,_,R)=>{if(d&&p(P,d),_)for(let A=0;A<_.length;A++)p(P,_[A]);if(R){let A=R.subTree;if(O===A){const M=R.vnode;j(P,M,M.scopeId,M.slotScopeIds,R.parent)}}},N=(P,O,d,_,R,A,M,H,z=0)=>{for(let G=z;G{const H=O.el=P.el;let{patchFlag:z,dynamicChildren:G,dirs:te}=O;z|=P.patchFlag&16;const I=P.props||Ne,F=O.props||Ne;let V;if(d&&Ki(d,!1),(V=F.onVnodeBeforeUpdate)&&kt(V,d,O,P),te&&qi(O,P,d,"beforeUpdate"),d&&Ki(d,!0),G?se(P.dynamicChildren,G,H,d,_,Ho(O,R),A):M||U(P,O,H,null,d,_,Ho(O,R),A,!1),z>0){if(z&16)ue(H,O,I,F,d,_,R);else if(z&2&&I.class!==F.class&&s(H,"class",null,F.class,R),z&4&&s(H,"style",I.style,F.style,R),z&8){const X=O.dynamicProps;for(let me=0;me{V&&kt(V,d,O,P),te&&qi(O,P,d,"updated")},_)},se=(P,O,d,_,R,A,M)=>{for(let H=0;H{if(d!==_){if(d!==Ne)for(const H in d)!Ar(H)&&!(H in _)&&s(P,H,d[H],null,M,O.children,R,A,xe);for(const H in _){if(Ar(H))continue;const z=_[H],G=d[H];z!==G&&H!=="value"&&s(P,H,G,z,M,O.children,R,A,xe)}"value"in _&&s(P,"value",d.value,_.value,M)}},Se=(P,O,d,_,R,A,M,H,z)=>{const G=O.el=P?P.el:o(""),te=O.anchor=P?P.anchor:o("");let{patchFlag:I,dynamicChildren:F,slotScopeIds:V}=O;V&&(H=H?H.concat(V):V),P==null?(n(G,d,_),n(te,d,_),N(O.children||[],d,te,R,A,M,H,z)):I>0&&I&64&&F&&P.dynamicChildren?(se(P.dynamicChildren,F,d,R,A,M,H),(O.key!=null||R&&O===R.subTree)&&Uu(P,O,!0)):U(P,O,d,te,R,A,M,H,z)},Re=(P,O,d,_,R,A,M,H,z)=>{O.slotScopeIds=H,P==null?O.shapeFlag&512?R.ctx.activate(O,d,_,M,z):Ee(O,d,_,R,A,M,z):Me(P,O,z)},Ee=(P,O,d,_,R,A,M)=>{const H=P.component=Im(P,_,R);if(Co(P)&&(H.ctx.renderer=he),Am(H),H.asyncDep){if(R&&R.registerDep(H,ge),!P.el){const z=H.subTree=be(Pi);y(null,z,O,d)}}else ge(H,P,O,d,R,A,M)},Me=(P,O,d)=>{const _=O.component=P.component;if(Up(P,O,d))if(_.asyncDep&&!_.asyncResolved){ne(_,O,d);return}else _.next=O,Np(_.update),_.effect.dirty=!0,_.update();else O.el=P.el,_.vnode=O},ge=(P,O,d,_,R,A,M)=>{const H=()=>{if(P.isMounted){let{next:te,bu:I,u:F,parent:V,vnode:X}=P;{const E=Vu(P);if(E){te&&(te.el=X.el,ne(P,te,M)),E.asyncDep.then(()=>{P.isUnmounted||H()});return}}let me=te,v;Ki(P,!1),te?(te.el=X.el,ne(P,te,M)):te=X,I&&ln(I),(v=te.props&&te.props.onVnodeBeforeUpdate)&&kt(v,V,te,X),Ki(P,!0);const g=Po(P),x=P.subTree;P.subTree=g,b(x,g,h(x.el),W(x),P,R,A),te.el=g.el,me===null&&Vp(P,g.el),F&&ct(F,R),(v=te.props&&te.props.onVnodeUpdated)&&ct(()=>kt(v,V,te,X),R)}else{let te;const{el:I,props:F}=O,{bm:V,m:X,parent:me}=P,v=hn(O);if(Ki(P,!1),V&&ln(V),!v&&(te=F&&F.onVnodeBeforeMount)&&kt(te,me,O),Ki(P,!0),I&&Ce){const g=()=>{P.subTree=Po(P),Ce(I,P.subTree,P,R,null)};v?O.type.__asyncLoader().then(()=>!P.isUnmounted&&g()):g()}else{const g=P.subTree=Po(P);b(null,g,d,_,P,R,A),O.el=g.el}if(X&&ct(X,R),!v&&(te=F&&F.onVnodeMounted)){const g=O;ct(()=>kt(te,me,g),R)}(O.shapeFlag&256||me&&hn(me.vnode)&&me.vnode.shapeFlag&256)&&P.a&&ct(P.a,R),P.isMounted=!0,O=d=_=null}},z=P.effect=new co(H,At,()=>Kr(G),P.scope),G=P.update=()=>{z.dirty&&z.run()};G.id=P.uid,Ki(P,!0),G()},ne=(P,O,d)=>{O.component=P;const _=P.vnode.props;P.vnode=O,P.next=null,gm(P,O.props,_,d),bm(P,O.children,d),_i(),au(P),Ti()},U=(P,O,d,_,R,A,M,H,z=!1)=>{const G=P&&P.children,te=P?P.shapeFlag:0,I=O.children,{patchFlag:F,shapeFlag:V}=O;if(F>0){if(F&128){ce(G,I,d,_,R,A,M,H,z);return}else if(F&256){re(G,I,d,_,R,A,M,H,z);return}}V&8?(te&16&&xe(G,R,A),I!==G&&c(d,I)):te&16?V&16?ce(G,I,d,_,R,A,M,H,z):xe(G,R,A,!0):(te&8&&c(d,""),V&16&&N(I,d,_,R,A,M,H,z))},re=(P,O,d,_,R,A,M,H,z)=>{P=P||It,O=O||It;const G=P.length,te=O.length,I=Math.min(G,te);let F;for(F=0;Fte?xe(P,R,A,!0,!1,I):N(O,d,_,R,A,M,H,z,I)},ce=(P,O,d,_,R,A,M,H,z)=>{let G=0;const te=O.length;let I=P.length-1,F=te-1;for(;G<=I&&G<=F;){const V=P[G],X=O[G]=z?Ri(O[G]):Yt(O[G]);if(fn(V,X))b(V,X,d,null,R,A,M,H,z);else break;G++}for(;G<=I&&G<=F;){const V=P[I],X=O[F]=z?Ri(O[F]):Yt(O[F]);if(fn(V,X))b(V,X,d,null,R,A,M,H,z);else break;I--,F--}if(G>I){if(G<=F){const V=F+1,X=VF)for(;G<=I;)_e(P[G],R,A,!0),G++;else{const V=G,X=G,me=new Map;for(G=X;G<=F;G++){const Te=O[G]=z?Ri(O[G]):Yt(O[G]);Te.key!=null&&me.set(Te.key,G)}let v,g=0;const x=F-X+1;let E=!1,B=0;const J=new Array(x);for(G=0;G=x){_e(Te,R,A,!0);continue}let pe;if(Te.key!=null)pe=me.get(Te.key);else for(v=X;v<=F;v++)if(J[v-X]===0&&fn(Te,O[v])){pe=v;break}pe===void 0?_e(Te,R,A,!0):(J[pe-X]=G+1,pe>=B?B=pe:E=!0,b(Te,O[pe],d,null,R,A,M,H,z),g++)}const fe=E?xm(J):It;for(v=fe.length-1,G=x-1;G>=0;G--){const Te=X+G,pe=O[Te],at=Te+1{const{el:A,type:M,transition:H,children:z,shapeFlag:G}=P;if(G&6){Q(P.component.subTree,O,d,_);return}if(G&128){P.suspense.move(O,d,_);return}if(G&64){M.move(P,O,d,he);return}if(M===De){n(A,O,d);for(let I=0;IH.enter(A),R);else{const{leave:I,delayLeave:F,afterLeave:V}=H,X=()=>n(A,O,d),me=()=>{I(A,()=>{X(),V&&V()})};F?F(A,X,me):me()}else n(A,O,d)},_e=(P,O,d,_=!1,R=!1)=>{const{type:A,props:M,ref:H,children:z,dynamicChildren:G,shapeFlag:te,patchFlag:I,dirs:F}=P;if(H!=null&&zo(H,null,d,P,!0),te&256){O.ctx.deactivate(P);return}const V=te&1&&F,X=!hn(P);let me;if(X&&(me=M&&M.onVnodeBeforeUnmount)&&kt(me,O,P),te&6)Ie(P.component,d,_);else{if(te&128){P.suspense.unmount(d,_);return}V&&qi(P,null,O,"beforeUnmount"),te&64?P.type.remove(P,O,d,R,he,_):G&&(A!==De||I>0&&I&64)?xe(G,O,d,!1,!0):(A===De&&I&384||!R&&te&16)&&xe(z,O,d),_&&He(P)}(X&&(me=M&&M.onVnodeUnmounted)||V)&&ct(()=>{me&&kt(me,O,P),V&&qi(P,null,O,"unmounted")},d)},He=P=>{const{type:O,el:d,anchor:_,transition:R}=P;if(O===De){Ve(d,_);return}if(O===Bo){C(P);return}const A=()=>{r(d),R&&!R.persisted&&R.afterLeave&&R.afterLeave()};if(P.shapeFlag&1&&R&&!R.persisted){const{leave:M,delayLeave:H}=R,z=()=>M(d,A);H?H(P.el,A,z):z()}else A()},Ve=(P,O)=>{let d;for(;P!==O;)d=f(P),r(P),P=d;r(O)},Ie=(P,O,d)=>{const{bum:_,scope:R,update:A,subTree:M,um:H}=P;_&&ln(_),R.stop(),A&&(A.active=!1,_e(M,P,O,d)),H&&ct(H,O),ct(()=>{P.isUnmounted=!0},O),O&&O.pendingBranch&&!O.isUnmounted&&P.asyncDep&&!P.asyncResolved&&P.suspenseId===O.pendingId&&(O.deps--,O.deps===0&&O.resolve())},xe=(P,O,d,_=!1,R=!1,A=0)=>{for(let M=A;MP.shapeFlag&6?W(P.component.subTree):P.shapeFlag&128?P.suspense.next():f(P.anchor||P.el);let oe=!1;const ae=(P,O,d)=>{P==null?O._vnode&&_e(O._vnode,null,null,!0):b(O._vnode||null,P,O,null,null,null,d),oe||(oe=!0,au(),lu(),oe=!1),O._vnode=P},he={p:b,um:_e,m:Q,r:He,mt:Ee,mc:N,pc:U,pbc:se,n:W,o:t};let ke,Ce;return i&&([ke,Ce]=i(he)),{render:ae,hydrate:ke,createApp:dm(ae,ke)}}function Ho({type:t,props:i},e){return e==="svg"&&t==="foreignObject"||e==="mathml"&&t==="annotation-xml"&&i&&i.encoding&&i.encoding.includes("html")?void 0:e}function Ki({effect:t,update:i},e){t.allowRecurse=i.allowRecurse=e}function Tm(t,i){return(!t||t&&!t.pendingBranch)&&i&&!i.persisted}function Uu(t,i,e=!1){const n=t.children,r=i.children;if(we(n)&&we(r))for(let s=0;s>1,t[e[o]]0&&(i[n]=e[s-1]),e[s]=n)}}for(s=e.length,a=e[s-1];s-- >0;)e[s]=a,a=i[a];return e}function Vu(t){const i=t.subTree.component;if(i)return i.asyncDep&&!i.asyncResolved?i:Vu(i)}const Sm=t=>t.__isTeleport,De=Symbol.for("v-fgt"),es=Symbol.for("v-txt"),Pi=Symbol.for("v-cmt"),Bo=Symbol.for("v-stc"),Wn=[];let Ht=null;function ie(t=!1){Wn.push(Ht=t?null:[])}function Em(){Wn.pop(),Ht=Wn[Wn.length-1]||null}let Gn=1;function ju(t){Gn+=t}function Wu(t){return t.dynamicChildren=Gn>0?Ht||It:null,Em(),Gn>0&&Ht&&Ht.push(t),t}function le(t,i,e,n,r,s){return Wu(ee(t,i,e,n,r,s,!0))}function bt(t,i,e,n,r){return Wu(be(t,i,e,n,r,!0))}function qn(t){return t?t.__v_isVNode===!0:!1}function fn(t,i){return t.type===i.type&&t.key===i.key}const ts="__vInternal",Gu=({key:t})=>t??null,is=({ref:t,ref_key:i,ref_for:e})=>(typeof t=="number"&&(t=""+t),t!=null?Xe(t)||ze(t)||Pe(t)?{i:Qe,r:t,k:i,f:!!e}:t:null);function ee(t,i=null,e=null,n=0,r=null,s=t===De?0:1,a=!1,o=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:i,key:i&&Gu(i),ref:i&&is(i),scopeId:hu,slotScopeIds:null,children:e,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:n,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:Qe};return o?(Uo(l,e),s&128&&t.normalize(l)):e&&(l.shapeFlag|=Xe(e)?8:16),Gn>0&&!a&&Ht&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&Ht.push(l),l}const be=Pm;function Pm(t,i=null,e=null,n=0,r=null,s=!1){if((!t||t===Wp)&&(t=Pi),qn(t)){const o=Zi(t,i,!0);return e&&Uo(o,e),Gn>0&&!s&&Ht&&(o.shapeFlag&6?Ht[Ht.indexOf(t)]=o:Ht.push(o)),o.patchFlag|=-2,o}if(Fm(t)&&(t=t.__vccOpts),i){i=Rm(i);let{class:o,style:l}=i;o&&!Xe(o)&&(i.class=q(o)),je(l)&&(_o(l)&&!we(l)&&(l=lt({},l)),i.style=qt(l))}const a=Xe(t)?1:mu(t)?128:Sm(t)?64:je(t)?4:Pe(t)?2:0;return ee(t,i,e,n,r,a,s,!0)}function Rm(t){return t?_o(t)||ts in t?lt({},t):t:null}function Zi(t,i,e=!1){const{props:n,ref:r,patchFlag:s,children:a}=t,o=i?ns(n||{},i):n;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:o,key:o&&Gu(o),ref:i&&i.ref?e&&r?we(r)?r.concat(is(i)):[r,is(i)]:is(i):r,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:i&&t.type!==De?s===-1?16:s|16:s,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:t.transition,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Zi(t.ssContent),ssFallback:t.ssFallback&&Zi(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce}}function mt(t=" ",i=0){return be(es,null,t,i)}function qe(t="",i=!1){return i?(ie(),bt(Pi,null,t)):be(Pi,null,t)}function Yt(t){return t==null||typeof t=="boolean"?be(Pi):we(t)?be(De,null,t.slice()):typeof t=="object"?Ri(t):be(es,null,String(t))}function Ri(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Zi(t)}function Uo(t,i){let e=0;const{shapeFlag:n}=t;if(i==null)i=null;else if(we(i))e=16;else if(typeof i=="object")if(n&65){const r=i.default;r&&(r._c&&(r._d=!1),Uo(t,r()),r._c&&(r._d=!0));return}else{e=32;const r=i._;!r&&!(ts in i)?i._ctx=Qe:r===3&&Qe&&(Qe.slots._===1?i._=1:(i._=2,t.patchFlag|=1024))}else Pe(i)?(i={default:i,_ctx:Qe},e=32):(i=String(i),n&64?(e=16,i=[mt(i)]):e=8);t.children=i,t.shapeFlag|=e}function ns(...t){const i={};for(let e=0;ett||Qe;let ss,Vo;{const t=Cl(),i=(e,n)=>{let r;return(r=t[e])||(r=t[e]=[]),r.push(n),s=>{r.length>1?r.forEach(a=>a(s)):r[0](s)}};ss=i("__VUE_INSTANCE_SETTERS__",e=>tt=e),Vo=i("__VUE_SSR_SETTERS__",e=>Zn=e)}const Kn=t=>{const i=tt;return ss(t),t.scope.on(),()=>{t.scope.off(),ss(i)}},qu=()=>{tt&&tt.scope.off(),ss(null)};function Ku(t){return t.vnode.shapeFlag&4}let Zn=!1;function Am(t,i=!1){i&&Vo(i);const{props:e,children:n}=t.vnode,r=Ku(t);mm(t,e,r,i),ym(t,n);const s=r?km(t,i):void 0;return i&&Vo(!1),s}function km(t,i){const e=t.type;t.accessCache=Object.create(null),t.proxy=Gr(new Proxy(t.ctx,om));const{setup:n}=e;if(n){const r=t.setupContext=n.length>1?Mm(t):null,s=Kn(t);_i();const a=ri(n,t,0,[t.props,r]);if(Ti(),s(),Sl(a)){if(a.then(qu,qu),i)return a.then(o=>{Zu(t,o,i)}).catch(o=>{Nn(o,t,0)});t.asyncDep=a}else Zu(t,a,i)}else Xu(t,i)}function Zu(t,i,e){Pe(i)?t.type.__ssrInlineRender?t.ssrRender=i:t.render=i:je(i)&&(t.setupState=tu(i)),Xu(t,e)}let Yu;function Xu(t,i,e){const n=t.type;if(!t.render){if(!i&&Yu&&!n.render){const r=n.template||Mo(t).template;if(r){const{isCustomElement:s,compilerOptions:a}=t.appContext.config,{delimiters:o,compilerOptions:l}=n,u=lt(lt({isCustomElement:s,delimiters:o},a),l);n.render=Yu(r,u)}}t.render=n.render||At}{const r=Kn(t);_i();try{am(t)}finally{Ti(),r()}}}function Dm(t){return t.attrsProxy||(t.attrsProxy=new Proxy(t.attrs,{get(i,e){return vt(t,"get","$attrs"),i[e]}}))}function Mm(t){const i=e=>{t.exposed=e||{}};return{get attrs(){return Dm(t)},slots:t.slots,emit:t.emit,expose:i}}function os(t){if(t.exposed)return t.exposeProxy||(t.exposeProxy=new Proxy(tu(Gr(t.exposed)),{get(i,e){if(e in i)return i[e];if(e in Un)return Un[e](t)},has(i,e){return e in i||e in Un}}))}const Nm=/(?:^|[-_])(\w)/g,Lm=t=>t.replace(Nm,i=>i.toUpperCase()).replace(/[-_]/g,"");function as(t,i=!0){return Pe(t)?t.displayName||t.name:t.name||i&&t.__name}function Ju(t,i,e=!1){let n=as(i);if(!n&&i.__file){const r=i.__file.match(/([^/\\]+)\.\w+$/);r&&(n=r[1])}if(!n&&t&&t.parent){const r=s=>{for(const a in s)if(s[a]===i)return a};n=r(t.components||t.parent.type.components)||r(t.appContext.components)}return n?Lm(n):e?"App":"Anonymous"}function Fm(t){return Pe(t)&&"__vccOpts"in t}const Y=(t,i)=>_p(t,i,Zn);function Qu(t,i,e=Ne){const n=rs(),r=Ft(i),s=bi(i),a=iu((l,u)=>{let c;return Yp(()=>{const h=t[i];Gt(c,h)&&(c=h,u())}),{get(){return l(),e.get?e.get(c):c},set(h){const f=n.vnode.props;!(f&&(i in f||r in f||s in f)&&(`onUpdate:${i}`in f||`onUpdate:${r}`in f||`onUpdate:${s}`in f))&&Gt(h,c)&&(c=h,u()),n.emit(`update:${i}`,e.set?e.set(h):h)}}}),o=i==="modelValue"?"modelModifiers":`${i}Modifiers`;return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?t[o]||{}:a,done:!1}:{done:!0}}}},a}function ls(t,i,e){const n=arguments.length;return n===2?je(i)&&!we(i)?qn(i)?be(t,null,[i]):be(t,i):be(t,null,i):(n>3?e=Array.prototype.slice.call(arguments,2):n===3&&qn(e)&&(e=[e]),be(t,i,e))}const zm="3.4.14";/** * @vue/runtime-dom v3.4.14 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT @@ -21,7 +21,7 @@ * pinia v2.1.7 * (c) 2023 Eduardo San Martin Morote * @license MIT - */let fc;const cs=t=>fc=t,dc=Symbol();function Ko(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var Xn;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(Xn||(Xn={}));function mg(){const t=kl(!0),i=t.run(()=>$({}));let e=[],n=[];const r=Gr({install(s){cs(r),r._a=s,s.provide(dc,r),s.config.globalProperties.$pinia=r,n.forEach(a=>e.push(a)),n=[]},use(s){return!this._a&&!pg?n.push(s):e.push(s),this},_p:e,_a:null,_e:t,_s:new Map,state:i});return r}const pc=()=>{};function mc(t,i,e,n=pc){t.push(i);const r=()=>{const s=t.indexOf(i);s>-1&&(t.splice(s,1),n())};return!e&&Lr()&&uo(r),r}function mn(t,...i){t.slice().forEach(e=>{e(...i)})}const gg=t=>t();function Zo(t,i){t instanceof Map&&i instanceof Map&&i.forEach((e,n)=>t.set(n,e)),t instanceof Set&&i instanceof Set&&i.forEach(t.add,t);for(const e in i){if(!i.hasOwnProperty(e))continue;const n=i[e],r=t[e];Ko(r)&&Ko(n)&&t.hasOwnProperty(e)&&!ze(n)&&!ni(n)?t[e]=Zo(r,n):t[e]=n}return t}const vg=Symbol();function yg(t){return!Ko(t)||!t.hasOwnProperty(vg)}const{assign:Ii}=Object;function bg(t){return!!(ze(t)&&t.effect)}function wg(t,i,e,n){const{state:r,actions:s,getters:a}=i,o=e.state.value[t];let l;function u(){o||(e.state.value[t]=r?r():{});const c=Ep(e.state.value[t]);return Ii(c,s,Object.keys(a||{}).reduce((h,f)=>(h[f]=Gr(Y(()=>{cs(e);const p=e._s.get(t);return a[f].call(p,p)})),h),{}))}return l=gc(t,u,i,e,n,!0),l}function gc(t,i,e={},n,r,s){let a;const o=Ii({actions:{}},e),l={deep:!0};let u,c,h=[],f=[],p;const m=n.state.value[t];!s&&!m&&(n.state.value[t]={}),$({});let b;function T(N){let K;u=c=!1,typeof N=="function"?(N(n.state.value[t]),K={type:Xn.patchFunction,storeId:t,events:p}):(Zo(n.state.value[t],N),K={type:Xn.patchObject,payload:N,storeId:t,events:p});const se=b=Symbol();Fn().then(()=>{b===se&&(u=!0)}),c=!0,mn(h,K,n.state.value[t])}const y=s?function(){const{state:K}=e,se=K?K():{};this.$patch(ue=>{Ii(ue,se)})}:pc;function w(){a.stop(),h=[],f=[],n._s.delete(t)}function S(N,K){return function(){cs(n);const se=Array.from(arguments),ue=[],Se=[];function Re(ge){ue.push(ge)}function Ee(ge){Se.push(ge)}mn(f,{args:se,name:N,store:L,after:Re,onError:Ee});let Me;try{Me=K.apply(this&&this.$id===t?this:L,se)}catch(ge){throw mn(Se,ge),ge}return Me instanceof Promise?Me.then(ge=>(mn(ue,ge),ge)).catch(ge=>(mn(Se,ge),Promise.reject(ge))):(mn(ue,Me),Me)}}const C={_p:n,$id:t,$onAction:mc.bind(null,f),$patch:T,$reset:y,$subscribe(N,K={}){const se=mc(h,N,K.detached,()=>ue()),ue=a.run(()=>$e(()=>n.state.value[t],Se=>{(K.flush==="sync"?c:u)&&N({storeId:t,type:Xn.direct,events:p},Se)},Ii({},l,K)));return se},$dispose:w},L=Kt(C);n._s.set(t,L);const j=(n._a&&n._a.runWithContext||gg)(()=>n._e.run(()=>(a=kl()).run(i)));for(const N in j){const K=j[N];if(ze(K)&&!bg(K)||ni(K))s||(m&&yg(K)&&(ze(K)?K.value=m[N]:Zo(K,m[N])),n.state.value[t][N]=K);else if(typeof K=="function"){const se=S(N,K);j[N]=se,o.actions[N]=K}}return Ii(L,j),Ii(Ie(L),j),Object.defineProperty(L,"$state",{get:()=>n.state.value[t],set:N=>{T(K=>{Ii(K,N)})}}),n._p.forEach(N=>{Ii(L,a.run(()=>N({store:L,app:n._a,pinia:n,options:o})))}),m&&s&&e.hydrate&&e.hydrate(L.$state,m),u=!0,c=!0,L}function Yo(t,i,e){let n,r;const s=typeof i=="function";typeof t=="string"?(n=t,r=s?e:i):(r=t,n=t.id);function a(o,l){const u=pm();return o=o||(u?ye(dc,null):null),o&&cs(o),o=fc,o._s.has(n)||(s?gc(n,i,r,o):wg(n,r,o)),o._s.get(n)}return a.$id=n,a}function _g(t){{t=Ie(t);const i={};for(const e in t){const n=t[e];(ze(n)||ni(n))&&(i[e]=Cp(t,e))}return i}}function Tg(t,i,e){switch(e){case">":return t>i;case">=":return t>=i;case"<":return t({criteria:i.map(l=>typeof l=="function"?l(a):a[l]),index:++r,value:a}));return Eg(s,(a,o)=>Pg(a,o,e,n))}function Eg(t,i){let e=t.length;t.sort(i);const n=[];for(;e--;)n[e]=t[e].value;return n}function Pg(t,i,e,n){let r=-1;const s=t.criteria,a=i.criteria,o=s.length;for(;++ri||r&&a||!n||!s?1:-1}return 0}function Cg(t,i){return t.reduce((e,n)=>{const r=i(n);return e[r]===void 0&&(e[r]=[]),e[r].push(n),e},{})}function hs(t){throw new Error(["[Pinia ORM]"].concat(t).join(" "))}function Qn(t,i){t||hs(i)}function Og(t,i){let e="",n=t;for(;n--;)e+=i[Math.random()*64|0];return e}function Ig(t,i){const n=JSON.stringify(i?{key:t,params:i}:{key:t});return typeof process>"u"?btoa(n):n}function Qo(t,i){if(t===i)return!0;if(t instanceof Date&&i instanceof Date)return t.getTime()===i.getTime();if(!t||!i||typeof t!="object"&&typeof i!="object")return t===i;if(t.prototype!==i.prototype)return!1;const e=Object.keys(t);return e.length!==Object.keys(i).length?!1:e.every(n=>Qo(t[n],i[n]))}class Ag{constructor(i,e={},n={}){if(!i||typeof i!="string")throw new Error(`Expected a string key for Entity, but found ${i}.`);const{idAttribute:r="id",mergeStrategy:s=(o,l)=>({...o,...l}),processStrategy:a=o=>({...o})}=n;this._key=i,this._getId=r,this._mergeStrategy=s,this._processStrategy=a,this.define(e)}get key(){return this._key}define(i){this.schema=Object.keys(i).reduce((e,n)=>{const r=i[n];return{...e,[n]:r}},this.schema||{})}getId(i,e,n){return this._getId(i,e,n)}merge(i,e){return this._mergeStrategy(i,e)}normalize(i,e,n,r,s,a){const o=this.getId(i,e,n),l=this.key;if(l in a||(a[l]={}),o in a[l]||(a[l][o]=[]),a[l][o].includes(i))return o;a[l][o].push(i);const u=this._processStrategy(i,e,n);return Object.keys(this.schema).forEach(c=>{if(u.hasOwnProperty(c)&&typeof u[c]=="object"){const h=this.schema[c],f=typeof h=="function"?h(i):h;u[c]=r(u[c],u,c,f,s,a)}}),s(this,u,i,e,n),o}}class vc{constructor(i,e){e&&(this._schemaAttribute=typeof e=="string"?n=>n[e]:e),this.define(i)}get isSingleSchema(){return!this._schemaAttribute}define(i){this.schema=i}getSchemaAttribute(i,e,n){return!this.isSingleSchema&&this._schemaAttribute(i,e,n)}inferSchema(i,e,n){if(this.isSingleSchema)return this.schema;const r=this.getSchemaAttribute(i,e,n);return this.schema[r]}normalizeValue(i,e,n,r,s,a){const o=this.inferSchema(i,e,n);if(!o)return i;const l=r(i,e,n,o,s,a);return this.isSingleSchema||l===void 0||l===null?l:{id:l,schema:this.getSchemaAttribute(i,e,n)}}}class kg extends vc{constructor(i,e){if(!e)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');super(i,e)}normalize(i,e,n,r,s,a){return this.normalizeValue(i,e,n,r,s,a)}}const Dg=t=>{if(Array.isArray(t)&&t.length>1)throw new Error(`Expected schema definition to be a single schema, but found ${t.length}.`);return t[0]},yc=t=>Array.isArray(t)?t:Object.keys(t).map(i=>t[i]),Mg=(t,i,e,n,r,s,a)=>yc(i).map(o=>r(o,e,n,Dg(t),s,a));class Ng extends vc{normalize(i,e,n,r,s,a){return yc(i).map(o=>this.normalizeValue(o,e,n,r,s,a)).filter(o=>o!=null)}}const Lg=(t,i,e,n,r,s,a)=>{const o={...i};return Object.keys(t).forEach(l=>{const u=t[l],c=typeof u=="function"?u(i):u,h=r(i[l],i,l,c,s,a);h==null?delete o[l]:o[l]=h}),o},$o=(t,i,e,n,r,s)=>typeof t!="object"||!t?t:typeof n=="object"&&(!n.normalize||typeof n.normalize!="function")?(Array.isArray(n)?Mg:Lg)(n,t,i,e,$o,r,s):n.normalize(t,i,e,$o,r,s),Fg=t=>(i,e,n,r,s)=>{const a=i.key,o=i.getId(n,r,s);a in t||(t[a]={}),t[a][o]=t[a][o]?i.merge(t[a][o],e):e},ea={Array:Ng,Entity:Ag,Union:kg},zg=(t,i)=>{if(!t||typeof t!="object")throw new Error(`Unexpected input given to normalize. Expected type to be "object", found "${t===null?"null":typeof t}".`);const e={},n=Fg(e),s=$o(t,t,null,i,n,{});return{entities:e,result:s}};var Hg=Object.defineProperty,Bg=(t,i,e)=>i in t?Hg(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,ta=(t,i,e)=>(Bg(t,typeof i!="symbol"?i+"":i,e),e);class bc{constructor(i){ta(this,"$parameters",{}),this.$self().attributes=i,this.$parameters={...this.$parameters,...this.$self().parameters}}get(i){return i}set(i){return i}static withParameters(i){return this.parameters=i,this}getParameters(){return this.$parameters}$self(){return this.constructor}static newRawInstance(i){return new this(i)}}ta(bc,"attributes"),ta(bc,"parameters");var Ug=Object.defineProperty,Vg=(t,i,e)=>i in t?Ug(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,wc=(t,i,e)=>(Vg(t,typeof i!="symbol"?i+"":i,e),e);class _c{constructor(i){wc(this,"model"),wc(this,"key"),this.model=i,this.key=""}setKey(i){return this.key=i,this}}var jg=Object.defineProperty,Wg=(t,i,e)=>i in t?jg(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,ia=(t,i,e)=>(Wg(t,typeof i!="symbol"?i+"":i,e),e);class nt extends _c{constructor(i,e){super(i),ia(this,"parent"),ia(this,"related"),ia(this,"onDeleteMode"),this.parent=i,this.related=e}getRelated(){return this.related}getKeys(i,e){return i.map(n=>n[e])}onDelete(i){return this.onDeleteMode=i,this}mapToDictionary(i,e){return i.reduce((n,r)=>{const[s,a]=e(r);return n[s]||(n[s]=[]),n[s].push(a),n},{})}compositeKeyMapper(i,e,n){We(i)&&We(e)?i.forEach((r,s)=>{n(r,e[s])}):!We(e)&&!We(i)?n(i,e):hs(["This relation cant be resolve. Either child or parent doesnt have different key types (composite)",JSON.stringify(i),JSON.stringify(e)])}getKey(i){return We(i)?`[${i.join(",")}]`:i}}var Gg=Object.defineProperty,qg=(t,i,e)=>i in t?Gg(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,$n=(t,i,e)=>(qg(t,typeof i!="symbol"?i+"":i,e),e);class na extends nt{constructor(i,e,n,r,s){super(i,i),$n(this,"relatedModels"),$n(this,"relatedTypes"),$n(this,"morphId"),$n(this,"morphType"),$n(this,"ownerKey"),this.relatedModels=e,this.relatedTypes=this.createRelatedTypes(e),this.morphId=n,this.morphType=r,this.ownerKey=s}createRelatedTypes(i){return i.reduce((e,n)=>(e[n.$entity()]=n,e),{})}getType(){return this.morphType}getRelateds(){return this.relatedModels}define(i){return i.union(this.relatedModels,(e,n,r)=>{const s=n[this.morphType],a=this.relatedTypes[s],o=this.ownerKey||a.$getKeyName();return n[this.morphId]=e[o],s})}attach(i,e){}addEagerConstraints(i,e){}match(i,e,n){const r=this.buildDictionary(n,e);e.forEach(s=>{var u;const a=s[this.morphType],o=s[this.morphId],l=((u=r[a])==null?void 0:u[o])??null;s.$setRelation(i,l)})}make(i,e){return!i||!e?null:this.relatedTypes[e].$newInstance(i)}buildDictionary(i,e){const n=this.getKeysByEntity(e),r={};for(const s in n){const a=this.relatedTypes[s];Qn(!!a,[`Trying to load "morph to" relation of \`${s}\``,"but the model could not be found."]);const o=this.ownerKey||a.$getKeyName(),l=i.newQueryWithConstraints(s).whereIn(o,n[s]).get(!1);r[s]=l.reduce((u,c)=>(u[c[o]]=c,u),{})}return r}getKeysByEntity(i){return i.reduce((e,n)=>{const r=n[this.morphType],s=n[this.morphId];return s!==null&&this.relatedTypes[r]!==void 0&&(e[r]||(e[r]=[]),e[r].push(s)),e},{})}}var Kg=Object.defineProperty,Zg=(t,i,e)=>i in t?Kg(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,Tc=(t,i,e)=>(Zg(t,typeof i!="symbol"?i+"":i,e),e);class er extends _c{constructor(i,e=null){super(i),Tc(this,"value"),Tc(this,"isNullable",!0),this.value=typeof e=="function"?e():e}notNullable(){return this.isNullable=!1,this}makeReturn(i,e){return e===void 0?this.value:e===null?(this.isNullable||this.throwWarning(["is set as non nullable!"]),e):(typeof e!==i&&this.throwWarning([e,"is not a",i]),e)}throwWarning(i){console.warn(["[Pinia ORM]"].concat([`Field ${this.model.$entity()}:${this.key} - `,...i]).join(" "))}}var Yg=Object.defineProperty,Xg=(t,i,e)=>i in t?Yg(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,ra=(t,i,e)=>(Xg(t,typeof i!="symbol"?i+"":i,e),e);class xc extends er{constructor(i,e={}){super(i),ra(this,"options"),ra(this,"alphabet","useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"),ra(this,"size",21),this.options=typeof e=="number"?{size:e}:e,this.alphabet=this.options.alphabet??this.alphabet,this.size=this.options.size??this.size}make(i){const e=this.model.$casts()[this.model.$getKeyName()];return e?i??e.withParameters(this.options).newRawInstance(this.model.$fields()).set(i):i??Og(this.size,this.alphabet)}}var Jg=Object.defineProperty,Qg=(t,i,e)=>i in t?Jg(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,Sc=(t,i,e)=>(Qg(t,typeof i!="symbol"?i+"":i,e),e);class $g{constructor(i){Sc(this,"schemas",{}),Sc(this,"model"),this.model=i}one(i,e){i=i||this.model,e=e||this.model;const n=`${i.$entity()}${e.$entity()}`;if(this.schemas[n])return this.schemas[n];const r=this.newEntity(i,e);this.schemas[n]=r;const s=this.definition(i);return r.define(s),r}many(i,e){return new ea.Array(this.one(i,e))}union(i,e){const n=i.reduce((r,s)=>(r[s.$entity()]=this.one(s),r),{});return new ea.Union(n,e)}newEntity(i,e){const n=i.$entity(),r=this.idAttribute(i,e);return new ea.Entity(n,{},{idAttribute:r})}idAttribute(i,e){const n=this.getUidPrimaryKeyPairs(i);return(r,s,a)=>{var l,u,c;a!==null&&((l=e.$fields()[a])==null||l.attach(s,r));for(const h in n)Xo(r[h])&&(r[h]=n[h].setKey(h).make(r[h]));return["BelongsTo","HasOne","MorphOne","MorphTo"].includes(((u=e.$fields()[a])==null?void 0:u.constructor.name)??"")&&We(s[a])&&hs(['You are passing a list to "',`${e.$entity()}.${a}`,`" which is a one to one Relation(${(c=e.$fields()[a])==null?void 0:c.constructor.name}):`,JSON.stringify(s[a])]),i.$getIndexId(r)}}getUidPrimaryKeyPairs(i){const e=i.$fields(),n=i.$getKeyName(),r=We(n)?n:[n],s={};return r.forEach(a=>{const o=e[a];o instanceof xc&&(s[a]=o)}),s}definition(i){const e=i.$fields(),n={};for(const r in e){const s=e[r];s instanceof nt&&(n[r]=s.define(this))}return n}}var ev=Object.defineProperty,tv=(t,i,e)=>i in t?ev(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,iv=(t,i,e)=>(tv(t,typeof i!="symbol"?i+"":i,e),e);class nv{constructor(i){iv(this,"model"),this.model=i}process(i){const e=this.normalize(i);return[i,e]}normalize(i){const e=We(i)?[this.getSchema()]:this.getSchema();return zg(i,e).entities}getSchema(){return new $g(this.model).one()}}function rv(t){return{save(i,e=!0){Object.assign(this.data,i),e&&t&&t.newQuery(this.$id).save(Object.values(i))},insert(i,e=!0){Object.assign(this.data,i),e&&t&&t.newQuery(this.$id).insert(Object.values(i))},update(i,e=!0){Object.assign(this.data,i),e&&t&&t.newQuery(this.$id).update(Object.values(i))},fresh(i,e=!0){this.data=i,e&&t&&t.newQuery(this.$id).fresh(Object.values(i))},destroy(i,e=!0){e&&t?t.newQuery(this.$id).newQuery(this.$id).destroy(i):i.forEach(n=>delete this.data[n])},delete(i,e=!0){e&&t?t.whereId(i).delete():i.forEach(n=>delete this.data[n])},flush(i,e=!0){this.data={},e&&t&&t.newQuery(this.$id).flush()}}}function Ec(t,i,e){return Yo(t,{state:()=>({data:{}}),actions:rv(e),...i})}var sv=Object.defineProperty,ov=(t,i,e)=>i in t?sv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,gn=(t,i,e)=>(ov(t,typeof i!="symbol"?i+"":i,e),e);class Pc extends nt{constructor(i,e,n,r,s,a,o){super(i,e),gn(this,"pivot"),gn(this,"foreignPivotKey"),gn(this,"relatedPivotKey"),gn(this,"parentKey"),gn(this,"relatedKey"),gn(this,"pivotKey","pivot"),this.pivot=n,this.foreignPivotKey=r,this.relatedPivotKey=s,this.parentKey=a,this.relatedKey=o}getRelateds(){return[this.related,this.pivot]}define(i){return i.many(this.related,this.parent)}attach(i,e){const n=e.pivot??{};n[this.foreignPivotKey]=i[this.parentKey],n[this.relatedPivotKey]=e[this.relatedKey],e[`pivot_${this.pivot.$entity()}`]=n}make(i){return i?i.map(e=>this.related.$newInstance(e)):[]}match(i,e,n){const r=n.get(!1),s=n.newQuery(this.pivot.$entity()).whereIn(this.relatedPivotKey,this.getKeys(r,this.relatedKey)).whereIn(this.foreignPivotKey,this.getKeys(e,this.parentKey)).groupBy(this.foreignPivotKey,this.relatedPivotKey).get();e.forEach(a=>{const o=[];r.forEach(l=>{var h;const u=((h=s[`[${a[this.parentKey]},${l[this.relatedKey]}]`])==null?void 0:h[0])??null,c=l.$newInstance(l.$toJson());c.$setRelation("pivot",u),u&&o.push(c)}),a.$setRelation(i,o)})}addEagerConstraints(i,e){}}var av=Object.defineProperty,lv=(t,i,e)=>i in t?av(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,dt=(t,i,e)=>(lv(t,typeof i!="symbol"?i+"":i,e),e);class tr{constructor(i,e,n,r,s){dt(this,"database"),dt(this,"model"),dt(this,"wheres",[]),dt(this,"orders",[]),dt(this,"groups",[]),dt(this,"take",null),dt(this,"skip",0),dt(this,"visible",["*"]),dt(this,"hidden",[]),dt(this,"cache"),dt(this,"eagerLoad",{}),dt(this,"pinia"),dt(this,"fromCache",!1),dt(this,"cacheConfig",{}),dt(this,"getNewHydrated",!1),dt(this,"hydratedDataCache"),this.database=i,this.model=e,this.pinia=s,this.cache=n,this.hydratedDataCache=r,this.getNewHydrated=!1}newQuery(i){return this.getNewHydrated=!0,new tr(this.database,this.database.getModel(i),this.cache,this.hydratedDataCache,this.pinia)}newQueryWithConstraints(i){const e=new tr(this.database,this.database.getModel(i),this.cache,this.hydratedDataCache,this.pinia);return e.eagerLoad={...this.eagerLoad},e.wheres=[...this.wheres],e.orders=[...this.orders],e.take=this.take,e.skip=this.skip,e.fromCache=this.fromCache,e.cacheConfig=this.cacheConfig,e}newQueryForRelation(i){return new tr(this.database,i.getRelated(),this.cache,new Map,this.pinia)}newInterpreter(){return new nv(this.model)}commit(i,e){const n=Ec(this.model.$storeName(),this.model.$piniaOptions(),this)(this.pinia);return i&&typeof n[i]=="function"&&n[i](e,!1),this.cache&&["get","all","insert","flush","delete","update","destroy"].includes(i)&&this.cache.clear(),n.$state.data}withMeta(){return this.makeVisible(["_meta"])}makeVisible(i){return this.visible=i,this.getNewHydrated=!0,this}makeHidden(i){return this.hidden=i,this.getNewHydrated=!0,this}where(i,e){return this.wheres.push({field:i,value:e,boolean:"and"}),this}whereIn(i,e){return e instanceof Set&&(e=Array.from(e)),this.wheres.push({field:i,value:e,boolean:"and"}),this}whereId(i){return this.where(this.model.$getKeyName(),i)}orWhere(i,e){return this.wheres.push({field:i,value:e,boolean:"or"}),this}whereHas(i,e=()=>{},n,r){return this.where(this.getFieldWhereForRelations(i,e,n,r))}orWhereHas(i,e=()=>{},n,r){return this.orWhere(this.getFieldWhereForRelations(i,e,n,r))}has(i,e,n){return this.where(this.getFieldWhereForRelations(i,()=>{},e,n))}orHas(i,e,n){return this.orWhere(this.getFieldWhereForRelations(i,()=>{},e,n))}doesntHave(i){return this.where(this.getFieldWhereForRelations(i,()=>{},"=",0))}orDoesntHave(i){return this.orWhere(this.getFieldWhereForRelations(i,()=>{},"=",0))}whereDoesntHave(i,e=()=>{}){return this.where(this.getFieldWhereForRelations(i,e,"=",0))}orWhereDoesntHave(i,e=()=>{}){return this.orWhere(this.getFieldWhereForRelations(i,e,"=",0))}groupBy(...i){return i.forEach(e=>{this.groups.push({field:e})}),this}orderBy(i,e="asc"){return this.orders.push({field:i,direction:e}),this}limit(i){return this.take=i,this}offset(i){return this.skip=i,this}with(i,e=()=>{}){return this.getNewHydrated=!0,this.eagerLoad[i]=e,this}withAll(i=()=>{}){let e=this.model.$fields();Object.values(this.model.$types()).forEach(r=>{e={...e,...r.fields()}});for(const r in e)e[r]instanceof nt&&this.with(r,i);return this}withAllRecursive(i=3){return this.withAll(e=>{i>0&&e.withAllRecursive(i-1)})}useCache(i,e){return this.fromCache=!0,this.cacheConfig={key:i,params:e},this}getFieldWhereForRelations(i,e=()=>{},n,r){const s=this.newQuery(this.model.$entity()).with(i,e).get(!1).filter(a=>Tg(We(a[i])?a[i].length:a[i]===null?0:1,typeof n=="number"?n:r??1,typeof n=="number"||r===void 0?">=":n)).map(a=>a.$getIndexId());return a=>s.includes(a.$getIndexId())}storeFind(i=[]){const e=this.commit("all"),n=[],r=new Set(i);return r.size>0?r.forEach(s=>{e[s]&&n.push(this.hydrate(e[s],{visible:this.visible,hidden:this.hidden,operation:"get"}))}):Object.values(e).forEach(s=>n.push(this.hydrate(s,{visible:this.visible,hidden:this.hidden,operation:"get"}))),n}all(){return this.storeFind()}get(i=!0){if(!this.fromCache||!this.cache)return this.internalGet(i);const e=this.cacheConfig.key?this.cacheConfig.key+JSON.stringify(this.cacheConfig.params):Ig(this.model.$entity(),{where:this.wheres,groups:this.groups,orders:this.orders,eagerLoads:this.eagerLoad,skip:this.skip,take:this.take,hidden:this.hidden,visible:this.visible}),n=this.cache.get(e);if(n)return n;const r=this.internalGet(i);return this.cache.set(e,r),r}internalGet(i){this.model.$entity()!==this.model.$baseEntity()&&this.where(this.model.$typeKey(),this.model.$fields()[this.model.$typeKey()].make());const e=this.select();return Jn(e)||this.eagerLoadRelations(e),i&&e.forEach(n=>n.$self().retrieved(n)),this.groups.length>0?this.filterGroup(e):e}first(){return this.limit(1).get()[0]??null}find(i){return this.whereId(i)[We(i)?"get":"first"]()}select(){let i=[];const e=this.wheres,n=this.wheres.findIndex(s=>s.field===this.model.$getKeyName());if(n>-1){const s=this.wheres[n].value;i=((Jo(s)?[]:We(s)?s:[s])||[]).map(String)||[],i.length>0&&(this.wheres=[...this.wheres.slice(0,n),...this.wheres.slice(n+1)])}let r=this.storeFind(i);return r=this.filterWhere(r),r=this.filterOrder(r),r=this.filterLimit(r),this.wheres=e,r}filterWhere(i){if(Jn(this.wheres))return i;const e=this.getWhereComparator();return i.filter(n=>e(n))}getWhereComparator(){const{and:i,or:e}=Cg(this.wheres,n=>n.boolean);return n=>{const r=[];return i&&r.push(i.every(s=>this.whereComparator(n,s))),e&&r.push(e.some(s=>this.whereComparator(n,s))),r.includes(!0)}}whereComparator(i,e){return Jo(e.field)?e.field(i):We(e.value)?e.value.includes(i[e.field]):Jo(e.value)?e.value(i[e.field]):i[e.field]===e.value}filterOrder(i){if(this.orders.length===0)return i;const e=this.orders.map(r=>r.field),n=this.orders.map(r=>r.direction);return Sg(i,e,n)}filterGroup(i){const e={},n=this.groups.map(r=>r.field);return i.forEach(r=>{const s=n.length===1?r[n[0]]:`[${n.map(a=>r[a]).toString()}]`;e[s]=(e[s]||[]).concat(r)}),e}filterLimit(i){return this.take!==null?i.slice(this.skip,this.skip+this.take):i.slice(this.skip)}load(i){this.eagerLoadRelations(i)}eagerLoadRelations(i){for(const e in this.eagerLoad)this.eagerLoadRelation(i,e,this.eagerLoad[e])}eagerLoadRelation(i,e,n){const r=this.getRelation(e),s=this.newQueryForRelation(r);r.addEagerConstraints(s,i),n(s),r.match(e,i,s)}getRelation(i){return this.model.$getRelation(i)}revive(i){return We(i)?this.reviveMany(i):this.reviveOne(i)}reviveOne(i){this.getNewHydrated=!1;const e=this.model.$getIndexId(i),n=this.commit("get")[e]??null;if(!n)return null;const r=this.hydrate(n,{visible:this.visible,hidden:this.hidden,operation:"get"});return this.reviveRelations(r,i),r}reviveMany(i){return i.reduce((e,n)=>{const r=this.reviveOne(n);return r&&e.push(r),e},[])}reviveRelations(i,e){const n=this.model.$fields();for(const r in e){const s=n[r];if(!(s instanceof nt))continue;const a=e[r];if(!a)return;if(s instanceof na){const o=i[s.getType()];i[r]=this.newQuery(o).reviveOne(a);continue}i[r]=We(a)?this.newQueryForRelation(s).reviveMany(a):this.newQueryForRelation(s).reviveOne(a)}}new(i=!0){let e=this.hydrate({},{operation:i?"set":"get"});const n=e.$self().creating(e),r=e.$self().saving(e);return n===!1||r===!1?null:(e.$isDirty()&&(e=this.hydrate(e.$getAttributes(),{operation:i?"set":"get"})),i&&(this.hydratedDataCache.set(this.model.$entity()+e.$getKey(void 0,!0),this.hydrate(e.$getAttributes(),{operation:"get"})),e.$self().created(e),e.$self().saved(e),this.commit("insert",this.compile(e))),e)}save(i){let e=this.newInterpreter().process(i);const n=this.model.$types(),r=this.model.$baseEntity()!==this.model.$entity();if(Object.values(n).length>0||r){const o=Object.keys(n),l={};i=We(i)?i:[i],i.forEach(u=>{const c=o.includes(`${u[this.model.$typeKey()]}`)||r?u[this.model.$typeKey()]??this.model.$fields()[this.model.$typeKey()].value:o[0];l[c]||(l[c]=[]),l[c].push(u)});for(const u in l){const c=n[u];c.entity===this.model.$entity()?e=this.newInterpreter().process(l[u]):this.newQueryWithConstraints(c.entity).save(l[u])}}const[s,a]=e;for(const o in a){const l=this.newQuery(o),u=a[o];l.saveElements(u)}return this.revive(s)}saveElements(i){const e={},n=this.commit("all"),r=[];for(const s in i){const a=i[s],o=n[s];let l=o?this.hydrate({...o,...a},{operation:"set",action:"update"}):this.hydrate(a,{operation:"set",action:"save"});const u=l.$self().saving(l,a),c=o?l.$self().updating(l,a):l.$self().creating(l,a);u===!1||c===!1||(l.$isDirty()&&(l=this.hydrate(l.$getAttributes(),{operation:"set",action:o?"update":"save"})),r.push(()=>l.$self().saved(l,a)),r.push(()=>o?l.$self().updated(l,a):l.$self().created(l,a)),e[s]=l.$getAttributes(),Object.values(l.$types()).length>0&&!e[s][l.$typeKey()]&&(e[s][l.$typeKey()]=a[l.$typeKey()]))}Object.keys(e).length>0&&(this.commit("save",e),r.forEach(s=>s()))}insert(i){const e=this.hydrate(i,{operation:"set",action:"insert"});return this.commit("insert",this.compile(e)),e}fresh(i){this.hydratedDataCache.clear();const e=this.hydrate(i,{action:"update"});return this.commit("fresh",this.compile(e)),e}update(i){const e=this.get(!1);if(Jn(e))return[];const n=e.map(r=>{const s=this.hydrate({...r.$getAttributes(),...i},{action:"update",operation:"set"});return r.$self().updating(r,i)===!1?r:(s.$self().updated(s),s)});return this.commit("update",this.compile(n)),n}destroy(i){return We(i)?this.destroyMany(i):this.destroyOne(i)}destroyOne(i){const e=this.find(i);if(!e)return null;const[n,r]=this.dispatchDeleteHooks(e);return r.includes(e.$getIndexId())||(this.commit("destroy",[e.$getIndexId()]),n.forEach(s=>s())),e}destroyMany(i){const e=this.find(i);if(Jn(e))return[];const[n,r]=this.dispatchDeleteHooks(e),s=this.getIndexIdsFromCollection(e).filter(a=>!r.includes(a));return this.commit("destroy",s),n.forEach(a=>a()),e}delete(){const i=this.get(!1);if(Jn(i))return[];const[e,n]=this.dispatchDeleteHooks(i),r=this.getIndexIdsFromCollection(i).filter(s=>!n.includes(s));return this.commit("delete",r),e.forEach(s=>s()),i}flush(){return this.commit("flush"),this.hydratedDataCache.clear(),this.get(!1)}checkAndDeleteRelations(i){const e=i.$fields();for(const n in e){const r=e[n];if(e[n]instanceof nt&&r.onDeleteMode&&i[n]){const a=(We(i[n])?i[n]:[i[n]]).map(l=>l.$getKey(void 0,!0)),o={};if(r instanceof Pc){this.newQuery(r.pivot.$entity()).where(r.foreignPivotKey,i[i.$getLocalKey()]).delete();continue}switch(r.onDeleteMode){case"cascade":{this.newQueryForRelation(r).destroy(a);break}case"set null":{r.foreignKey&&(o[r.foreignKey]=null),r.morphId&&(o[r.morphId]=null,o[r.morphType]=null),this.newQueryForRelation(r).whereId(a).update(o);break}}}}}dispatchDeleteHooks(i){const e=[],n=[];return i=We(i)?i:[i],this.withAll().load(i),i.forEach(r=>{r.$self().deleting(r)===!1?n.push(r.$getIndexId()):(this.hydratedDataCache.delete(this.model.$entity()+r.$getIndexId()),e.push(()=>r.$self().deleted(r)),this.checkAndDeleteRelations(r))}),[e,n]}getIndexIdsFromCollection(i){return i.map(e=>e.$getIndexId())}hydrate(i,e){return We(i)?i.map(n=>this.hydrate(n,e)):this.getHydratedModel(i,{relations:!1,...e||{}})}compile(i){return(We(i)?i:[i]).reduce((n,r)=>(n[r.$getIndexId()]=r.$getAttributes(),n),{})}getHydratedModel(i,e){const n=this.model.$getKey(i,!0),r=n&&this.hydratedDataCache.get(this.model.$entity()+n);if(!this.getNewHydrated&&(e==null?void 0:e.operation)!=="set"&&r)return r;const s=this.model.$types()[i[this.model.$typeKey()]],a=l=>(s?s.newRawInstance():this.model).$newInstance(i,{relations:!1,...e||{},...l}),o=a();return n&&!this.getNewHydrated&&(e==null?void 0:e.operation)!=="set"&&this.hydratedDataCache.set(this.model.$entity()+n,o),n&&(e==null?void 0:e.action)==="update"&&this.hydratedDataCache.set(this.model.$entity()+n,a({operation:"get"})),o}}var uv=Object.defineProperty,cv=(t,i,e)=>i in t?uv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,hv=(t,i,e)=>(cv(t,typeof i!="symbol"?i+"":i,e),e),fv=(t,i,e)=>{if(!i.has(t))throw TypeError("Cannot "+e)},Xt=(t,i,e)=>(fv(t,i,"read from private field"),e?e.call(t):i.get(t)),dv=(t,i,e)=>{if(i.has(t))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(t):i.set(t,e)},Rc,Mt;class Cc{constructor(){hv(this,Rc),dv(this,Mt,new Map)}has(i){var e;return!!(Xt(this,Mt).has(i)&&((e=Xt(this,Mt).get(i))!=null&&e.deref()))}get(i){const e=Xt(this,Mt).get(i);if(!e)return;const n=e.deref();if(n)return n;Xt(this,Mt).delete(i)}set(i,e){return Xt(this,Mt).set(i,new WeakRef(e)),this}get size(){return Xt(this,Mt).size}clear(){Xt(this,Mt).clear()}delete(i){return Xt(this,Mt).delete(i),!1}forEach(i){for(const[e,n]of this)i(n,e,this)}*[(Rc=Symbol.toStringTag,Symbol.iterator)](){for(const[i,e]of Xt(this,Mt)){const n=e.deref();if(!n){Xt(this,Mt).delete(i);continue}yield[i,n]}}*entries(){for(const[i,e]of this)yield[i,e]}*keys(){for(const[i]of this)yield i}*values(){for(const[,i]of this)yield i}}Mt=new WeakMap;const pv=new Cc,mv=new Map,sa={model:{namespace:"",withMeta:!1,hidden:["_meta"],visible:["*"]},cache:{shared:!0,provider:Cc}},Ai={...sa};var gv=Object.defineProperty,vv=(t,i,e)=>i in t?gv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,li=(t,i,e)=>(vv(t,typeof i!="symbol"?i+"":i,e),e);class oa{constructor(i,e){li(this,"database"),li(this,"model"),li(this,"pinia"),li(this,"queryCache"),li(this,"hydratedDataCache"),li(this,"use"),li(this,"config"),this.config=Ai,this.database=i,this.pinia=e,this.hydratedDataCache=mv}static setModel(i){return this.useModel=i,this}setConfig(i){this.config=i}initialize(i){return this.config.cache&&this.config.cache!==!0&&(this.queryCache=this.config.cache.shared?pv:new this.config.cache.provider),i?(this.model=i.newRawInstance(),this):this.use||this.$self().useModel?(this.use=this.use??this.$self().useModel,this.model=this.use.newRawInstance(),this):this}$self(){return this.constructor}getModel(){return Qn(!!this.model,["The model is not registered. Please define the model to be used at","`use` property of the repository class."]),this.model}piniaStore(){return Ec(this.model.$storeName(),this.model.$piniaOptions(),this.query())(this.pinia)}repo(i){return Yi(i)}query(){return new tr(this.database,this.getModel(),this.queryCache,this.hydratedDataCache,this.pinia)}cache(){return this.queryCache}where(i,e){return this.query().where(i,e)}orWhere(i,e){return this.query().orWhere(i,e)}whereHas(i,e=()=>{},n,r){return this.query().whereHas(i,e,n,r)}orWhereHas(i,e=()=>{},n,r){return this.query().orWhereHas(i,e,n,r)}has(i,e,n){return this.query().has(i,e,n)}orHas(i,e,n){return this.query().orHas(i,e,n)}doesntHave(i){return this.query().doesntHave(i)}orDoesntHave(i){return this.query().orDoesntHave(i)}whereDoesntHave(i,e=()=>{}){return this.query().whereDoesntHave(i,e)}orWhereDoesntHave(i,e=()=>{}){return this.query().orWhereDoesntHave(i,e)}withMeta(){return this.query().withMeta()}makeVisible(i){return this.query().makeVisible(i)}makeHidden(i){return this.query().makeHidden(i)}groupBy(...i){return this.query().groupBy(...i)}orderBy(i,e){return this.query().orderBy(i,e)}limit(i){return this.query().limit(i)}offset(i){return this.query().offset(i)}with(i,e){return this.query().with(i,e)}withAll(i){return this.query().withAll(i)}withAllRecursive(i){return this.query().withAllRecursive(i)}useCache(i,e){return this.query().useCache(i,e)}all(){return this.query().get()}find(i){return this.query().find(i)}revive(i){return this.query().revive(i)}make(i){return We(i)?i.map(e=>this.getModel().$newInstance(e,{relations:!0})):this.getModel().$newInstance(i,{relations:!0})}save(i){return this.query().save(i)}new(i=!0){return this.query().new(i)}insert(i){return this.query().insert(i)}fresh(i){return this.query().fresh(i)}destroy(i){return this.query().destroy(i)}flush(){return this.query().flush()}}li(oa,"_isRepository",!0),li(oa,"useModel");var yv=Object.defineProperty,bv=(t,i,e)=>i in t?yv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,wv=(t,i,e)=>(bv(t,typeof i!="symbol"?i+"":i,e),e);class _v{constructor(){wv(this,"models",{})}register(i){const e=i.$entity();this.models[e]||(this.models[e]=i,this.registerRelatedModels(i))}registerRelatedModels(i){const e=i.$fields();for(const n in e){const r=e[n];r instanceof nt&&r.getRelateds().forEach(s=>{this.register(s)})}}getModel(i){return this.models[i]}}const Oc=[];function Tv(t){let i=Ai;return Oc.forEach(e=>{const n=e({config:i,repository:t,model:t.getModel()});i={...i,...n.config}}),t.setConfig(i),t}function Yi(t,i){const e=new _v,n=t._isRepository?new t(e,i).initialize():new oa(e,i).initialize(t);try{const r=Object.values(n.getModel().$types());r.length>0?r.forEach(s=>n.database.register(s.newRawInstance())):n.database.register(n.getModel())}catch{}return Tv(n)}function xv(t){Ai.model={...sa.model,...t==null?void 0:t.model},Ai.cache=(t==null?void 0:t.cache)===!1?!1:{...sa.cache,...(t==null?void 0:t.cache)!==!0&&(t==null?void 0:t.cache)};const i={use(e){return Oc.push(e),this}};return()=>i}class Sv extends er{make(i){return i===void 0?this.value:i}}let Ev=class extends er{constructor(i,e){super(i,e)}make(i){return this.makeReturn("string",i)}},Pv=class extends er{constructor(i,e){super(i,e)}make(i){return this.makeReturn("number",i)}},Rv=class extends er{constructor(i,e){super(i,e)}make(i){return this.makeReturn("boolean",i)}};var Cv=Object.defineProperty,Ov=(t,i,e)=>i in t?Cv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,Ic=(t,i,e)=>(Ov(t,typeof i!="symbol"?i+"":i,e),e);class Ac extends nt{constructor(i,e,n,r){super(i,e),Ic(this,"foreignKey"),Ic(this,"localKey"),this.foreignKey=n,this.localKey=r}getRelateds(){return[this.related]}define(i){return i.one(this.related,this.parent)}attach(i,e){this.compositeKeyMapper(this.foreignKey,this.localKey,(n,r)=>{e[n]=i[r]})}addEagerConstraints(i,e){this.compositeKeyMapper(this.foreignKey,this.localKey,(n,r)=>i.whereIn(n,this.getKeys(e,r)))}match(i,e,n){const r=this.buildDictionary(n.get(!1));e.forEach(s=>{const a=s[this.getKey(this.localKey)];r[a]?s.$setRelation(i,r[a][0]):s.$setRelation(i,null)})}buildDictionary(i){return this.mapToDictionary(i,e=>[e[this.getKey(this.foreignKey)],e])}make(i){return i?this.related.$newInstance(i):null}}var Iv=Object.defineProperty,Av=(t,i,e)=>i in t?Iv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,aa=(t,i,e)=>(Av(t,typeof i!="symbol"?i+"":i,e),e);class kv extends nt{constructor(i,e,n,r){super(i,e),aa(this,"child"),aa(this,"foreignKey"),aa(this,"ownerKey"),this.foreignKey=n,this.ownerKey=r,this.child=e}getRelateds(){return[this.child]}define(i){return i.one(this.child,this.parent)}attach(i,e){this.compositeKeyMapper(this.foreignKey,this.ownerKey,(n,r)=>{i[n]=e[r]})}addEagerConstraints(i,e){this.compositeKeyMapper(this.foreignKey,this.ownerKey,(n,r)=>i.whereIn(r,this.getEagerModelKeys(e,n)))}getEagerModelKeys(i,e){return i.reduce((n,r)=>(r[e]!==null&&n.push(r[e]),n),[])}match(i,e,n){const r=this.buildDictionary(n.get(!1));e.forEach(s=>{const a=s[this.getKey(this.foreignKey)];r[a]?s.$setRelation(i,r[a]):s.$setRelation(i,null)})}buildDictionary(i){return i.reduce((e,n)=>(e[n[this.getKey(this.ownerKey)]]=n,e),{})}make(i){return i?this.child.$newInstance(i):null}}var Dv=Object.defineProperty,Mv=(t,i,e)=>i in t?Dv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,kc=(t,i,e)=>(Mv(t,typeof i!="symbol"?i+"":i,e),e);class Nv extends nt{constructor(i,e,n,r){super(i,e),kc(this,"foreignKey"),kc(this,"localKey"),this.foreignKey=n,this.localKey=r}getRelateds(){return[this.related]}define(i){return i.many(this.related,this.parent)}attach(i,e){this.compositeKeyMapper(this.foreignKey,this.localKey,(n,r)=>{e[n]=i[r]})}addEagerConstraints(i,e){this.compositeKeyMapper(this.foreignKey,this.localKey,(n,r)=>i.whereIn(n,this.getKeys(e,r)))}match(i,e,n){const r=this.buildDictionary(n.get(!1));e.forEach(s=>{const a=s[this.getKey(this.localKey)];r[a]?s.$setRelation(i,r[a]):s.$setRelation(i,[])})}buildDictionary(i){return this.mapToDictionary(i,e=>{const n=this.getKey(this.foreignKey);return[e[n],e]})}make(i){return i?i.map(e=>this.related.$newInstance(e)):[]}}var Lv=Object.defineProperty,Fv=(t,i,e)=>i in t?Lv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,la=(t,i,e)=>(Fv(t,typeof i!="symbol"?i+"":i,e),e);class zv extends nt{constructor(i,e,n,r){super(i,e),la(this,"child"),la(this,"foreignKey"),la(this,"ownerKey"),this.foreignKey=n,this.ownerKey=r,this.child=e}getRelateds(){return[this.child]}define(i){return i.many(this.child,this.parent)}attach(i,e){e[this.ownerKey]!==void 0&&(i[this.foreignKey]||(i[this.foreignKey]=[]),this.attachIfMissing(i[this.foreignKey],e[this.ownerKey]))}attachIfMissing(i,e){i.includes(e)||i.push(e)}addEagerConstraints(i,e){i.whereIn(this.ownerKey,this.getEagerModelKeys(e))}getEagerModelKeys(i){return i.reduce((e,n)=>[...e,...n[this.foreignKey]],[])}match(i,e,n){const r=this.buildDictionary(n.get(!1));e.forEach(s=>{const a=this.getRelatedModels(r,s[this.foreignKey]);s.$setRelation(i,a)})}buildDictionary(i){return i.reduce((e,n)=>(e[n[this.ownerKey]]=n,e),{})}getRelatedModels(i,e){return e.reduce((n,r)=>{const s=i[r];return s&&n.push(s),n},[])}make(i){return i?i.map(e=>this.child.$newInstance(e)):[]}}var Hv=Object.defineProperty,Bv=(t,i,e)=>i in t?Hv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,ua=(t,i,e)=>(Bv(t,typeof i!="symbol"?i+"":i,e),e);class Dc extends nt{constructor(i,e,n,r,s){super(i,e),ua(this,"morphId"),ua(this,"morphType"),ua(this,"localKey"),this.morphId=n,this.morphType=r,this.localKey=s}getRelateds(){return[this.related]}define(i){return i.one(this.related,this.parent)}attach(i,e){e[this.morphId]=i[this.localKey],e[this.morphType]=this.parent.$entity()}addEagerConstraints(i,e){i.where(this.morphType,this.parent.$entity()).whereIn(this.morphId,this.getKeys(e,this.localKey))}match(i,e,n){const r=this.buildDictionary(n.get(!1));e.forEach(s=>{const a=s[this.localKey];r[a]?s.$setRelation(i,r[a]):s.$setRelation(i,null)})}buildDictionary(i){return i.reduce((e,n)=>(e[n[this.morphId]]=n,e),{})}make(i){return i?this.related.$newInstance(i):null}}var Uv=Object.defineProperty,Vv=(t,i,e)=>i in t?Uv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,ca=(t,i,e)=>(Vv(t,typeof i!="symbol"?i+"":i,e),e);class jv extends nt{constructor(i,e,n,r,s){super(i,e),ca(this,"morphId"),ca(this,"morphType"),ca(this,"localKey"),this.morphId=n,this.morphType=r,this.localKey=s}getRelateds(){return[this.related]}define(i){return i.many(this.related,this.parent)}attach(i,e){e[this.morphId]=i[this.localKey],e[this.morphType]=this.parent.$entity()}addEagerConstraints(i,e){i.where(this.morphType,this.parent.$entity()),i.whereIn(this.morphId,this.getKeys(e,this.localKey))}match(i,e,n){const r=this.buildDictionary(n.get(!1));e.forEach(s=>{const a=s[this.localKey];r[a]?s.$setRelation(i,r[a]):s.$setRelation(i,[])})}buildDictionary(i){return this.mapToDictionary(i,e=>[e[this.morphId],e])}make(i){return i?i.map(e=>this.related.$newInstance(e)):[]}}var Wv=Object.defineProperty,Gv=(t,i,e)=>i in t?Wv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,ir=(t,i,e)=>(Gv(t,typeof i!="symbol"?i+"":i,e),e);class qv extends nt{constructor(i,e,n,r,s,a,o){super(i,e),ir(this,"through"),ir(this,"firstKey"),ir(this,"secondKey"),ir(this,"localKey"),ir(this,"secondLocalKey"),this.through=n,this.firstKey=r,this.secondKey=s,this.localKey=a,this.secondLocalKey=o}getRelateds(){return[this.related,this.through]}define(i){return i.many(this.related,this.parent)}attach(i,e){}addEagerConstraints(i,e){}match(i,e,n){const r=n.newQuery(this.through.$entity()).where(this.firstKey,this.getKeys(e,this.localKey)).get(!1),s=n.where(this.secondKey,this.getKeys(r,this.secondLocalKey)).groupBy(this.secondKey).get(!1),a=this.buildDictionary(r,s);e.forEach(o=>{const l=o[this.localKey];a[l]?o.$setRelation(i,a[l][0]):o.$setRelation(i,[])})}buildDictionary(i,e){return this.mapToDictionary(i,n=>[n[this.firstKey],e[n[this.secondLocalKey]]])}make(i){return i?i.map(e=>this.related.$newInstance(e)):[]}}var Kv=Object.defineProperty,Zv=(t,i,e)=>i in t?Kv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,Xi=(t,i,e)=>(Zv(t,typeof i!="symbol"?i+"":i,e),e);class Yv extends nt{constructor(i,e,n,r,s,a,o,l){super(i,e),Xi(this,"pivot"),Xi(this,"morphId"),Xi(this,"morphType"),Xi(this,"relatedId"),Xi(this,"parentKey"),Xi(this,"relatedKey"),Xi(this,"pivotKey","pivot"),this.pivot=n,this.morphId=s,this.morphType=a,this.relatedId=r,this.parentKey=o,this.relatedKey=l}getRelateds(){return[this.related,this.pivot]}define(i){return i.many(this.related,this.parent)}attach(i,e){const n=e.pivot??{};n[this.morphId]=i[this.parentKey],n[this.morphType]=this.parent.$entity(),n[this.relatedId]=e[this.relatedKey],e[`pivot_${this.pivot.$entity()}`]=n}make(i){return i?i.map(e=>this.related.$newInstance(e)):[]}match(i,e,n){const r=n.get(!1),s=n.newQuery(this.pivot.$entity()).whereIn(this.relatedId,this.getKeys(r,this.relatedKey)).whereIn(this.morphId,this.getKeys(e,this.parentKey)).groupBy(this.morphId,this.relatedId,this.morphType).get();e.forEach(a=>{const o=[];r.forEach(l=>{var h;const u=((h=s[`[${a[this.parentKey]},${l[this.relatedKey]},${this.parent.$entity()}]`])==null?void 0:h[0])??null,c=l.$newInstance(l.$toJson());c.$setRelation("pivot",u),u&&o.push(c)}),a.$setRelation(i,o)})}addEagerConstraints(i,e){}}var Xv=Object.defineProperty,Jv=(t,i,e)=>i in t?Xv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,Ge=(t,i,e)=>(Jv(t,typeof i!="symbol"?i+"":i,e),e);class Be{constructor(i,e={operation:"set"}){this.$boot(),(e.fill??!0)&&this.$fill(i,e)}static fields(){return{}}static initializeSchema(){this.schemas[this.entity]={},this.fieldsOnDelete[this.entity]=this.fieldsOnDelete[this.entity]??{};const i={...this.fields(),...this.registries[this.entity]};for(const e in i){const n=i[e];this.schemas[this.entity][e]=typeof n=="function"?n():n,this.fieldsOnDelete[this.entity][e]&&(this.schemas[this.entity][e]=this.schemas[this.entity][e].onDelete(this.fieldsOnDelete[this.entity][e]))}}static setRegistry(i,e){return this.registries[this.entity]||(this.registries[this.entity]={}),this.registries[this.entity][i]=e,this}static setFieldDeleteMode(i,e){return this.fieldsOnDelete[this.entity]=this.fieldsOnDelete[this.entity]??{},this.fieldsOnDelete[this.entity][i]=e,this}static setMutator(i,e){return this.fieldMutators[i]=e,this}static setCast(i,e){return this.fieldCasts[i]=e,this}static setHidden(i){return this.hidden.push(i),this}static clearBootedModels(){this.booted={},this.original={},this.schemas={},this.fieldMutators={},this.fieldCasts={},this.hidden=[],this.visible=[]}static clearRegistries(){this.registries={}}static newRawInstance(){return new this(void 0,{fill:!1})}static attr(i){return new Sv(this.newRawInstance(),i)}static string(i){return new Ev(this.newRawInstance(),i)}static number(i){return new Pv(this.newRawInstance(),i)}static boolean(i){return new Rv(this.newRawInstance(),i)}static uid(i){return new xc(this.newRawInstance(),i)}static hasOne(i,e,n){const r=this.newRawInstance();return n=n??r.$getKeyName(),new Ac(r,i.newRawInstance(),e,n)}static belongsTo(i,e,n){const r=i.newRawInstance();return n=n??r.$getKeyName(),new kv(this.newRawInstance(),r,e,n)}static belongsToMany(i,e,n,r,s,a){const o=i.newRawInstance(),l=this.newRawInstance(),u=e.newRawInstance();return s=s??l.$getLocalKey(),a=a??o.$getLocalKey(),this.schemas[i.entity][`pivot_${u.$entity()}`]=new Ac(o,u,r,a),new Pc(l,o,u,n,r,s,a)}static morphToMany(i,e,n,r,s,a,o){const l=i.newRawInstance(),u=this.newRawInstance(),c=e.newRawInstance();return a=a??u.$getLocalKey(),o=o??l.$getLocalKey(),this.schemas[i.entity][`pivot_${c.$entity()}`]=new Dc(l,c,n,u.$entity(),o),new Yv(u,l,c,n,r,s,a,o)}static hasMany(i,e,n){const r=this.newRawInstance();return n=n??r.$getKeyName(),new Nv(r,i.newRawInstance(),e,n)}static hasManyBy(i,e,n){const r=i.newRawInstance();return n=n??r.$getLocalKey(),new zv(this.newRawInstance(),r,e,n)}static hasManyThrough(i,e,n,r,s,a){const o=this.newRawInstance(),l=e.newRawInstance();return s=s??o.$getLocalKey(),a=a??l.$getLocalKey(),new qv(o,i.newRawInstance(),l,n,r,s,a)}static morphOne(i,e,n,r){const s=this.newRawInstance();return r=r??s.$getLocalKey(),new Dc(s,i.newRawInstance(),e,n,r)}static morphTo(i,e,n,r=""){const s=this.newRawInstance(),a=i.map(o=>o.newRawInstance());return new na(s,a,e,n,r)}static morphMany(i,e,n,r){const s=this.newRawInstance();return r=r??s.$getLocalKey(),new jv(s,i.newRawInstance(),e,n,r)}static mutators(){return{}}static casts(){return{}}static types(){return{}}$self(){return this.constructor}$entity(){return this.$self().entity}$config(){return this.$self().config}$namespace(){return this.$self().namespace??Ai.model.namespace}$storeName(){return(this.$namespace()?this.$namespace()+"/":"")+this.$baseEntity()}$baseEntity(){return this.$self().baseEntity??this.$entity()}$typeKey(){return this.$self().typeKey}$types(){return this.$self().types()}$piniaOptions(){return this.$self().piniaOptions}$primaryKey(){return this.$self().primaryKey}$fields(){return this.$self().schemas[this.$entity()]}$hidden(){return this.$self().hidden}$visible(){return this.$self().visible}$newInstance(i,e){const n=this.$self();return new n(i,e)}$boot(){this.$self().booted[this.$entity()]||(this.$self().booted[this.$entity()]=!0,this.$initializeSchema())}$initializeSchema(){this.$self().initializeSchema()}$casts(){return{...this.$getCasts(),...this.$self().fieldCasts}}$fill(i={},e={}){var l;const n=e.operation??"get",r={...Ai.model,...this.$config()};r.withMeta&&(this.$self().schemas[this.$entity()][this.$self().metaKey]=this.$self().attr({}));const s=this.$fields(),a=e.relations??!0,o={...this.$getMutators(),...this.$self().fieldMutators};for(const u in s){if(n==="get"&&!this.isFieldVisible(u,this.$hidden(),this.$visible(),e))continue;const c=s[u];let h=i[u];if(c instanceof nt&&!a)continue;const f=o==null?void 0:o[u],p=(l=this.$casts()[u])==null?void 0:l.newRawInstance(s);f&&n==="get"&&(h=typeof f=="function"?f(h):typeof f.get=="function"?f.get(h):h),p&&n==="get"&&(h=p.get(h));let m=this.$fillField(u,c,h);f&&typeof f!="function"&&n==="set"&&f.set&&(m=f.set(m)),p&&n==="set"&&(m=p.set(m)),this[u]=this[u]??m}return n==="set"&&(this.$self().original[this.$getKey(this,!0)]=this.$getAttributes()),r.withMeta&&n==="set"&&this.$fillMeta(e.action),this}$fillMeta(i="save"){const e=Math.floor(Date.now()/1e3);i==="save"&&(this[this.$self().metaKey]={createdAt:e,updatedAt:e}),i==="update"&&(this[this.$self().metaKey].updatedAt=e)}$fillField(i,e,n){if(n!==void 0)return e instanceof na?e.setKey(i).make(n,this[e.getType()]):e.setKey(i).make(n);if(this[i]===void 0)return e.setKey(i).make()}isFieldVisible(i,e,n,r){const s=e.length>0?e:Ai.model.hidden,a=[...n.length>0?n:Ai.model.visible,String(this.$primaryKey())],o=r.visible??[],l=r.hidden??[];return(s.includes("*")||s.includes(i))&&!o.includes(i)||l.includes(i)?!1:(a.includes("*")||a.includes(i))&&!l.includes(i)||o.includes(i)}$getKeyName(){return this.$primaryKey()}$getKey(i,e=!1){if(i=i??this,this.$hasCompositeKey()){const r=this.$getCompositeKey(i);return e?"["+(r==null?void 0:r.join(","))+"]":r}const n=i[this.$getKeyName()];return Xo(n)?null:n}$hasCompositeKey(){return We(this.$getKeyName())}$getCompositeKey(i){let e=[];return this.$getKeyName().every(n=>{const r=i[n];return Xo(r)?(e=null,!1):(e.push(r),!0)}),e===null?null:e}$getIndexId(i){const e=i??this,n=this.$getKey(e);return Qn(n!==null,["The record is missing the primary key. If you want to persist record","without the primary key, please define the primary key field with the","`uid` attribute."]),this.$stringifyId(n)}$stringifyId(i){return We(i)?JSON.stringify(i):String(i)}$getLocalKey(){return Qn(!this.$hasCompositeKey(),["Please provide the local key for the relationship. The model with the","composite key can't infer its local key."]),this.$getKeyName()}$getRelation(i){let e=this.$fields()[i];return Object.values(this.$types()).forEach(r=>{e===void 0&&(e=r.fields()[i])}),Qn(e instanceof nt,[`Relationship [${i}] on model [${this.$entity()}] not found.`]),e}$setRelation(i,e){return i.includes("pivot")?(this.pivot=e,this):(this.$fields()[i]&&(this[i]=e),this)}$getMutators(){return this.$self().mutators()}$getCasts(){return this.$self().casts()}$getOriginal(){return this.$self().original[this.$getKey(this,!0)]}$refresh(){return this.$isDirty()&&Object.entries(this.$getOriginal()).forEach(i=>{this[i[0]]=i[1]}),this}$isDirty(i){const e=this.$getOriginal();return i?(Object.keys(e).includes(i)||hs(['The property"',i,'"does not exit in the model "',this.$entity(),'"']),!Qo(this[i],e[i])):!Qo(e,this.$getAttributes())}$getAttributes(){return this.$toJson(this,{relations:!1})}$toJson(i,e={}){i=i??this;const n=i.$fields(),r=e.relations??!0,s={};for(const a in n){const o=n[a],l=i[a];if(!(o instanceof nt)){s[a]=this.serializeValue(l);continue}r&&(s[a]=this.serializeRelation(l))}return s}serializeValue(i){return i===null?null:We(i)?this.serializeArray(i):typeof i=="object"?i instanceof Date&&!isNaN(i.getTime())&&typeof i.toISOString=="function"?i.toISOString():this.serializeObject(i):i}serializeArray(i){return i.map(e=>this.serializeValue(e))}serializeObject(i){const e={};for(const n in i)e[n]=this.serializeValue(i[n]);return e}serializeRelation(i){if(i!==void 0)return i===null?null:We(i)?i.map(e=>e.$toJson()):i.$toJson()}}Ge(Be,"entity"),Ge(Be,"baseEntity"),Ge(Be,"namespace"),Ge(Be,"primaryKey","id"),Ge(Be,"metaKey","_meta"),Ge(Be,"hidden",["_meta"]),Ge(Be,"visible",[]),Ge(Be,"config"),Ge(Be,"typeKey","type"),Ge(Be,"fieldsOnDelete",{}),Ge(Be,"original",{}),Ge(Be,"schemas",{}),Ge(Be,"registries",{}),Ge(Be,"piniaOptions",{}),Ge(Be,"fieldMutators",{}),Ge(Be,"fieldCasts",{}),Ge(Be,"booted",{}),Ge(Be,"saving",()=>{}),Ge(Be,"updating",()=>{}),Ge(Be,"creating",()=>{}),Ge(Be,"deleting",()=>{}),Ge(Be,"retrieved",()=>{}),Ge(Be,"saved",()=>{}),Ge(Be,"updated",()=>{}),Ge(Be,"created",()=>{}),Ge(Be,"deleted",()=>{});function Mc(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);i&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function de(t){for(var i=1;it.length)&&(i=t.length);for(var e=0,n=new Array(i);efc=t,dc=Symbol();function Ko(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var Xn;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(Xn||(Xn={}));function mg(){const t=kl(!0),i=t.run(()=>$({}));let e=[],n=[];const r=Gr({install(s){cs(r),r._a=s,s.provide(dc,r),s.config.globalProperties.$pinia=r,n.forEach(a=>e.push(a)),n=[]},use(s){return!this._a&&!pg?n.push(s):e.push(s),this},_p:e,_a:null,_e:t,_s:new Map,state:i});return r}const pc=()=>{};function mc(t,i,e,n=pc){t.push(i);const r=()=>{const s=t.indexOf(i);s>-1&&(t.splice(s,1),n())};return!e&&Lr()&&uo(r),r}function mn(t,...i){t.slice().forEach(e=>{e(...i)})}const gg=t=>t();function Zo(t,i){t instanceof Map&&i instanceof Map&&i.forEach((e,n)=>t.set(n,e)),t instanceof Set&&i instanceof Set&&i.forEach(t.add,t);for(const e in i){if(!i.hasOwnProperty(e))continue;const n=i[e],r=t[e];Ko(r)&&Ko(n)&&t.hasOwnProperty(e)&&!ze(n)&&!ni(n)?t[e]=Zo(r,n):t[e]=n}return t}const vg=Symbol();function yg(t){return!Ko(t)||!t.hasOwnProperty(vg)}const{assign:Ii}=Object;function bg(t){return!!(ze(t)&&t.effect)}function wg(t,i,e,n){const{state:r,actions:s,getters:a}=i,o=e.state.value[t];let l;function u(){o||(e.state.value[t]=r?r():{});const c=Ep(e.state.value[t]);return Ii(c,s,Object.keys(a||{}).reduce((h,f)=>(h[f]=Gr(Y(()=>{cs(e);const p=e._s.get(t);return a[f].call(p,p)})),h),{}))}return l=gc(t,u,i,e,n,!0),l}function gc(t,i,e={},n,r,s){let a;const o=Ii({actions:{}},e),l={deep:!0};let u,c,h=[],f=[],p;const m=n.state.value[t];!s&&!m&&(n.state.value[t]={}),$({});let b;function T(N){let K;u=c=!1,typeof N=="function"?(N(n.state.value[t]),K={type:Xn.patchFunction,storeId:t,events:p}):(Zo(n.state.value[t],N),K={type:Xn.patchObject,payload:N,storeId:t,events:p});const se=b=Symbol();Fn().then(()=>{b===se&&(u=!0)}),c=!0,mn(h,K,n.state.value[t])}const y=s?function(){const{state:K}=e,se=K?K():{};this.$patch(ue=>{Ii(ue,se)})}:pc;function w(){a.stop(),h=[],f=[],n._s.delete(t)}function S(N,K){return function(){cs(n);const se=Array.from(arguments),ue=[],Se=[];function Re(ge){ue.push(ge)}function Ee(ge){Se.push(ge)}mn(f,{args:se,name:N,store:L,after:Re,onError:Ee});let Me;try{Me=K.apply(this&&this.$id===t?this:L,se)}catch(ge){throw mn(Se,ge),ge}return Me instanceof Promise?Me.then(ge=>(mn(ue,ge),ge)).catch(ge=>(mn(Se,ge),Promise.reject(ge))):(mn(ue,Me),Me)}}const C={_p:n,$id:t,$onAction:mc.bind(null,f),$patch:T,$reset:y,$subscribe(N,K={}){const se=mc(h,N,K.detached,()=>ue()),ue=a.run(()=>$e(()=>n.state.value[t],Se=>{(K.flush==="sync"?c:u)&&N({storeId:t,type:Xn.direct,events:p},Se)},Ii({},l,K)));return se},$dispose:w},L=Kt(C);n._s.set(t,L);const j=(n._a&&n._a.runWithContext||gg)(()=>n._e.run(()=>(a=kl()).run(i)));for(const N in j){const K=j[N];if(ze(K)&&!bg(K)||ni(K))s||(m&&yg(K)&&(ze(K)?K.value=m[N]:Zo(K,m[N])),n.state.value[t][N]=K);else if(typeof K=="function"){const se=S(N,K);j[N]=se,o.actions[N]=K}}return Ii(L,j),Ii(Ae(L),j),Object.defineProperty(L,"$state",{get:()=>n.state.value[t],set:N=>{T(K=>{Ii(K,N)})}}),n._p.forEach(N=>{Ii(L,a.run(()=>N({store:L,app:n._a,pinia:n,options:o})))}),m&&s&&e.hydrate&&e.hydrate(L.$state,m),u=!0,c=!0,L}function Yo(t,i,e){let n,r;const s=typeof i=="function";typeof t=="string"?(n=t,r=s?e:i):(r=t,n=t.id);function a(o,l){const u=pm();return o=o||(u?ye(dc,null):null),o&&cs(o),o=fc,o._s.has(n)||(s?gc(n,i,r,o):wg(n,r,o)),o._s.get(n)}return a.$id=n,a}function _g(t){{t=Ae(t);const i={};for(const e in t){const n=t[e];(ze(n)||ni(n))&&(i[e]=Cp(t,e))}return i}}function Tg(t,i,e){switch(e){case">":return t>i;case">=":return t>=i;case"<":return t({criteria:i.map(l=>typeof l=="function"?l(a):a[l]),index:++r,value:a}));return Eg(s,(a,o)=>Pg(a,o,e,n))}function Eg(t,i){let e=t.length;t.sort(i);const n=[];for(;e--;)n[e]=t[e].value;return n}function Pg(t,i,e,n){let r=-1;const s=t.criteria,a=i.criteria,o=s.length;for(;++ri||r&&a||!n||!s?1:-1}return 0}function Cg(t,i){return t.reduce((e,n)=>{const r=i(n);return e[r]===void 0&&(e[r]=[]),e[r].push(n),e},{})}function hs(t){throw new Error(["[Pinia ORM]"].concat(t).join(" "))}function Qn(t,i){t||hs(i)}function Og(t,i){let e="",n=t;for(;n--;)e+=i[Math.random()*64|0];return e}function Ig(t,i){const n=JSON.stringify(i?{key:t,params:i}:{key:t});return typeof process>"u"?btoa(n):n}function Qo(t,i){if(t===i)return!0;if(t instanceof Date&&i instanceof Date)return t.getTime()===i.getTime();if(!t||!i||typeof t!="object"&&typeof i!="object")return t===i;if(t.prototype!==i.prototype)return!1;const e=Object.keys(t);return e.length!==Object.keys(i).length?!1:e.every(n=>Qo(t[n],i[n]))}class Ag{constructor(i,e={},n={}){if(!i||typeof i!="string")throw new Error(`Expected a string key for Entity, but found ${i}.`);const{idAttribute:r="id",mergeStrategy:s=(o,l)=>({...o,...l}),processStrategy:a=o=>({...o})}=n;this._key=i,this._getId=r,this._mergeStrategy=s,this._processStrategy=a,this.define(e)}get key(){return this._key}define(i){this.schema=Object.keys(i).reduce((e,n)=>{const r=i[n];return{...e,[n]:r}},this.schema||{})}getId(i,e,n){return this._getId(i,e,n)}merge(i,e){return this._mergeStrategy(i,e)}normalize(i,e,n,r,s,a){const o=this.getId(i,e,n),l=this.key;if(l in a||(a[l]={}),o in a[l]||(a[l][o]=[]),a[l][o].includes(i))return o;a[l][o].push(i);const u=this._processStrategy(i,e,n);return Object.keys(this.schema).forEach(c=>{if(u.hasOwnProperty(c)&&typeof u[c]=="object"){const h=this.schema[c],f=typeof h=="function"?h(i):h;u[c]=r(u[c],u,c,f,s,a)}}),s(this,u,i,e,n),o}}class vc{constructor(i,e){e&&(this._schemaAttribute=typeof e=="string"?n=>n[e]:e),this.define(i)}get isSingleSchema(){return!this._schemaAttribute}define(i){this.schema=i}getSchemaAttribute(i,e,n){return!this.isSingleSchema&&this._schemaAttribute(i,e,n)}inferSchema(i,e,n){if(this.isSingleSchema)return this.schema;const r=this.getSchemaAttribute(i,e,n);return this.schema[r]}normalizeValue(i,e,n,r,s,a){const o=this.inferSchema(i,e,n);if(!o)return i;const l=r(i,e,n,o,s,a);return this.isSingleSchema||l===void 0||l===null?l:{id:l,schema:this.getSchemaAttribute(i,e,n)}}}class kg extends vc{constructor(i,e){if(!e)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');super(i,e)}normalize(i,e,n,r,s,a){return this.normalizeValue(i,e,n,r,s,a)}}const Dg=t=>{if(Array.isArray(t)&&t.length>1)throw new Error(`Expected schema definition to be a single schema, but found ${t.length}.`);return t[0]},yc=t=>Array.isArray(t)?t:Object.keys(t).map(i=>t[i]),Mg=(t,i,e,n,r,s,a)=>yc(i).map(o=>r(o,e,n,Dg(t),s,a));class Ng extends vc{normalize(i,e,n,r,s,a){return yc(i).map(o=>this.normalizeValue(o,e,n,r,s,a)).filter(o=>o!=null)}}const Lg=(t,i,e,n,r,s,a)=>{const o={...i};return Object.keys(t).forEach(l=>{const u=t[l],c=typeof u=="function"?u(i):u,h=r(i[l],i,l,c,s,a);h==null?delete o[l]:o[l]=h}),o},$o=(t,i,e,n,r,s)=>typeof t!="object"||!t?t:typeof n=="object"&&(!n.normalize||typeof n.normalize!="function")?(Array.isArray(n)?Mg:Lg)(n,t,i,e,$o,r,s):n.normalize(t,i,e,$o,r,s),Fg=t=>(i,e,n,r,s)=>{const a=i.key,o=i.getId(n,r,s);a in t||(t[a]={}),t[a][o]=t[a][o]?i.merge(t[a][o],e):e},ea={Array:Ng,Entity:Ag,Union:kg},zg=(t,i)=>{if(!t||typeof t!="object")throw new Error(`Unexpected input given to normalize. Expected type to be "object", found "${t===null?"null":typeof t}".`);const e={},n=Fg(e),s=$o(t,t,null,i,n,{});return{entities:e,result:s}};var Hg=Object.defineProperty,Bg=(t,i,e)=>i in t?Hg(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,ta=(t,i,e)=>(Bg(t,typeof i!="symbol"?i+"":i,e),e);class bc{constructor(i){ta(this,"$parameters",{}),this.$self().attributes=i,this.$parameters={...this.$parameters,...this.$self().parameters}}get(i){return i}set(i){return i}static withParameters(i){return this.parameters=i,this}getParameters(){return this.$parameters}$self(){return this.constructor}static newRawInstance(i){return new this(i)}}ta(bc,"attributes"),ta(bc,"parameters");var Ug=Object.defineProperty,Vg=(t,i,e)=>i in t?Ug(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,wc=(t,i,e)=>(Vg(t,typeof i!="symbol"?i+"":i,e),e);class _c{constructor(i){wc(this,"model"),wc(this,"key"),this.model=i,this.key=""}setKey(i){return this.key=i,this}}var jg=Object.defineProperty,Wg=(t,i,e)=>i in t?jg(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,ia=(t,i,e)=>(Wg(t,typeof i!="symbol"?i+"":i,e),e);class nt extends _c{constructor(i,e){super(i),ia(this,"parent"),ia(this,"related"),ia(this,"onDeleteMode"),this.parent=i,this.related=e}getRelated(){return this.related}getKeys(i,e){return i.map(n=>n[e])}onDelete(i){return this.onDeleteMode=i,this}mapToDictionary(i,e){return i.reduce((n,r)=>{const[s,a]=e(r);return n[s]||(n[s]=[]),n[s].push(a),n},{})}compositeKeyMapper(i,e,n){We(i)&&We(e)?i.forEach((r,s)=>{n(r,e[s])}):!We(e)&&!We(i)?n(i,e):hs(["This relation cant be resolve. Either child or parent doesnt have different key types (composite)",JSON.stringify(i),JSON.stringify(e)])}getKey(i){return We(i)?`[${i.join(",")}]`:i}}var Gg=Object.defineProperty,qg=(t,i,e)=>i in t?Gg(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,$n=(t,i,e)=>(qg(t,typeof i!="symbol"?i+"":i,e),e);class na extends nt{constructor(i,e,n,r,s){super(i,i),$n(this,"relatedModels"),$n(this,"relatedTypes"),$n(this,"morphId"),$n(this,"morphType"),$n(this,"ownerKey"),this.relatedModels=e,this.relatedTypes=this.createRelatedTypes(e),this.morphId=n,this.morphType=r,this.ownerKey=s}createRelatedTypes(i){return i.reduce((e,n)=>(e[n.$entity()]=n,e),{})}getType(){return this.morphType}getRelateds(){return this.relatedModels}define(i){return i.union(this.relatedModels,(e,n,r)=>{const s=n[this.morphType],a=this.relatedTypes[s],o=this.ownerKey||a.$getKeyName();return n[this.morphId]=e[o],s})}attach(i,e){}addEagerConstraints(i,e){}match(i,e,n){const r=this.buildDictionary(n,e);e.forEach(s=>{var u;const a=s[this.morphType],o=s[this.morphId],l=((u=r[a])==null?void 0:u[o])??null;s.$setRelation(i,l)})}make(i,e){return!i||!e?null:this.relatedTypes[e].$newInstance(i)}buildDictionary(i,e){const n=this.getKeysByEntity(e),r={};for(const s in n){const a=this.relatedTypes[s];Qn(!!a,[`Trying to load "morph to" relation of \`${s}\``,"but the model could not be found."]);const o=this.ownerKey||a.$getKeyName(),l=i.newQueryWithConstraints(s).whereIn(o,n[s]).get(!1);r[s]=l.reduce((u,c)=>(u[c[o]]=c,u),{})}return r}getKeysByEntity(i){return i.reduce((e,n)=>{const r=n[this.morphType],s=n[this.morphId];return s!==null&&this.relatedTypes[r]!==void 0&&(e[r]||(e[r]=[]),e[r].push(s)),e},{})}}var Kg=Object.defineProperty,Zg=(t,i,e)=>i in t?Kg(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,Tc=(t,i,e)=>(Zg(t,typeof i!="symbol"?i+"":i,e),e);class er extends _c{constructor(i,e=null){super(i),Tc(this,"value"),Tc(this,"isNullable",!0),this.value=typeof e=="function"?e():e}notNullable(){return this.isNullable=!1,this}makeReturn(i,e){return e===void 0?this.value:e===null?(this.isNullable||this.throwWarning(["is set as non nullable!"]),e):(typeof e!==i&&this.throwWarning([e,"is not a",i]),e)}throwWarning(i){console.warn(["[Pinia ORM]"].concat([`Field ${this.model.$entity()}:${this.key} - `,...i]).join(" "))}}var Yg=Object.defineProperty,Xg=(t,i,e)=>i in t?Yg(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,ra=(t,i,e)=>(Xg(t,typeof i!="symbol"?i+"":i,e),e);class xc extends er{constructor(i,e={}){super(i),ra(this,"options"),ra(this,"alphabet","useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"),ra(this,"size",21),this.options=typeof e=="number"?{size:e}:e,this.alphabet=this.options.alphabet??this.alphabet,this.size=this.options.size??this.size}make(i){const e=this.model.$casts()[this.model.$getKeyName()];return e?i??e.withParameters(this.options).newRawInstance(this.model.$fields()).set(i):i??Og(this.size,this.alphabet)}}var Jg=Object.defineProperty,Qg=(t,i,e)=>i in t?Jg(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,Sc=(t,i,e)=>(Qg(t,typeof i!="symbol"?i+"":i,e),e);class $g{constructor(i){Sc(this,"schemas",{}),Sc(this,"model"),this.model=i}one(i,e){i=i||this.model,e=e||this.model;const n=`${i.$entity()}${e.$entity()}`;if(this.schemas[n])return this.schemas[n];const r=this.newEntity(i,e);this.schemas[n]=r;const s=this.definition(i);return r.define(s),r}many(i,e){return new ea.Array(this.one(i,e))}union(i,e){const n=i.reduce((r,s)=>(r[s.$entity()]=this.one(s),r),{});return new ea.Union(n,e)}newEntity(i,e){const n=i.$entity(),r=this.idAttribute(i,e);return new ea.Entity(n,{},{idAttribute:r})}idAttribute(i,e){const n=this.getUidPrimaryKeyPairs(i);return(r,s,a)=>{var l,u,c;a!==null&&((l=e.$fields()[a])==null||l.attach(s,r));for(const h in n)Xo(r[h])&&(r[h]=n[h].setKey(h).make(r[h]));return["BelongsTo","HasOne","MorphOne","MorphTo"].includes(((u=e.$fields()[a])==null?void 0:u.constructor.name)??"")&&We(s[a])&&hs(['You are passing a list to "',`${e.$entity()}.${a}`,`" which is a one to one Relation(${(c=e.$fields()[a])==null?void 0:c.constructor.name}):`,JSON.stringify(s[a])]),i.$getIndexId(r)}}getUidPrimaryKeyPairs(i){const e=i.$fields(),n=i.$getKeyName(),r=We(n)?n:[n],s={};return r.forEach(a=>{const o=e[a];o instanceof xc&&(s[a]=o)}),s}definition(i){const e=i.$fields(),n={};for(const r in e){const s=e[r];s instanceof nt&&(n[r]=s.define(this))}return n}}var ev=Object.defineProperty,tv=(t,i,e)=>i in t?ev(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,iv=(t,i,e)=>(tv(t,typeof i!="symbol"?i+"":i,e),e);class nv{constructor(i){iv(this,"model"),this.model=i}process(i){const e=this.normalize(i);return[i,e]}normalize(i){const e=We(i)?[this.getSchema()]:this.getSchema();return zg(i,e).entities}getSchema(){return new $g(this.model).one()}}function rv(t){return{save(i,e=!0){Object.assign(this.data,i),e&&t&&t.newQuery(this.$id).save(Object.values(i))},insert(i,e=!0){Object.assign(this.data,i),e&&t&&t.newQuery(this.$id).insert(Object.values(i))},update(i,e=!0){Object.assign(this.data,i),e&&t&&t.newQuery(this.$id).update(Object.values(i))},fresh(i,e=!0){this.data=i,e&&t&&t.newQuery(this.$id).fresh(Object.values(i))},destroy(i,e=!0){e&&t?t.newQuery(this.$id).newQuery(this.$id).destroy(i):i.forEach(n=>delete this.data[n])},delete(i,e=!0){e&&t?t.whereId(i).delete():i.forEach(n=>delete this.data[n])},flush(i,e=!0){this.data={},e&&t&&t.newQuery(this.$id).flush()}}}function Ec(t,i,e){return Yo(t,{state:()=>({data:{}}),actions:rv(e),...i})}var sv=Object.defineProperty,ov=(t,i,e)=>i in t?sv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,gn=(t,i,e)=>(ov(t,typeof i!="symbol"?i+"":i,e),e);class Pc extends nt{constructor(i,e,n,r,s,a,o){super(i,e),gn(this,"pivot"),gn(this,"foreignPivotKey"),gn(this,"relatedPivotKey"),gn(this,"parentKey"),gn(this,"relatedKey"),gn(this,"pivotKey","pivot"),this.pivot=n,this.foreignPivotKey=r,this.relatedPivotKey=s,this.parentKey=a,this.relatedKey=o}getRelateds(){return[this.related,this.pivot]}define(i){return i.many(this.related,this.parent)}attach(i,e){const n=e.pivot??{};n[this.foreignPivotKey]=i[this.parentKey],n[this.relatedPivotKey]=e[this.relatedKey],e[`pivot_${this.pivot.$entity()}`]=n}make(i){return i?i.map(e=>this.related.$newInstance(e)):[]}match(i,e,n){const r=n.get(!1),s=n.newQuery(this.pivot.$entity()).whereIn(this.relatedPivotKey,this.getKeys(r,this.relatedKey)).whereIn(this.foreignPivotKey,this.getKeys(e,this.parentKey)).groupBy(this.foreignPivotKey,this.relatedPivotKey).get();e.forEach(a=>{const o=[];r.forEach(l=>{var h;const u=((h=s[`[${a[this.parentKey]},${l[this.relatedKey]}]`])==null?void 0:h[0])??null,c=l.$newInstance(l.$toJson());c.$setRelation("pivot",u),u&&o.push(c)}),a.$setRelation(i,o)})}addEagerConstraints(i,e){}}var av=Object.defineProperty,lv=(t,i,e)=>i in t?av(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,dt=(t,i,e)=>(lv(t,typeof i!="symbol"?i+"":i,e),e);class tr{constructor(i,e,n,r,s){dt(this,"database"),dt(this,"model"),dt(this,"wheres",[]),dt(this,"orders",[]),dt(this,"groups",[]),dt(this,"take",null),dt(this,"skip",0),dt(this,"visible",["*"]),dt(this,"hidden",[]),dt(this,"cache"),dt(this,"eagerLoad",{}),dt(this,"pinia"),dt(this,"fromCache",!1),dt(this,"cacheConfig",{}),dt(this,"getNewHydrated",!1),dt(this,"hydratedDataCache"),this.database=i,this.model=e,this.pinia=s,this.cache=n,this.hydratedDataCache=r,this.getNewHydrated=!1}newQuery(i){return this.getNewHydrated=!0,new tr(this.database,this.database.getModel(i),this.cache,this.hydratedDataCache,this.pinia)}newQueryWithConstraints(i){const e=new tr(this.database,this.database.getModel(i),this.cache,this.hydratedDataCache,this.pinia);return e.eagerLoad={...this.eagerLoad},e.wheres=[...this.wheres],e.orders=[...this.orders],e.take=this.take,e.skip=this.skip,e.fromCache=this.fromCache,e.cacheConfig=this.cacheConfig,e}newQueryForRelation(i){return new tr(this.database,i.getRelated(),this.cache,new Map,this.pinia)}newInterpreter(){return new nv(this.model)}commit(i,e){const n=Ec(this.model.$storeName(),this.model.$piniaOptions(),this)(this.pinia);return i&&typeof n[i]=="function"&&n[i](e,!1),this.cache&&["get","all","insert","flush","delete","update","destroy"].includes(i)&&this.cache.clear(),n.$state.data}withMeta(){return this.makeVisible(["_meta"])}makeVisible(i){return this.visible=i,this.getNewHydrated=!0,this}makeHidden(i){return this.hidden=i,this.getNewHydrated=!0,this}where(i,e){return this.wheres.push({field:i,value:e,boolean:"and"}),this}whereIn(i,e){return e instanceof Set&&(e=Array.from(e)),this.wheres.push({field:i,value:e,boolean:"and"}),this}whereId(i){return this.where(this.model.$getKeyName(),i)}orWhere(i,e){return this.wheres.push({field:i,value:e,boolean:"or"}),this}whereHas(i,e=()=>{},n,r){return this.where(this.getFieldWhereForRelations(i,e,n,r))}orWhereHas(i,e=()=>{},n,r){return this.orWhere(this.getFieldWhereForRelations(i,e,n,r))}has(i,e,n){return this.where(this.getFieldWhereForRelations(i,()=>{},e,n))}orHas(i,e,n){return this.orWhere(this.getFieldWhereForRelations(i,()=>{},e,n))}doesntHave(i){return this.where(this.getFieldWhereForRelations(i,()=>{},"=",0))}orDoesntHave(i){return this.orWhere(this.getFieldWhereForRelations(i,()=>{},"=",0))}whereDoesntHave(i,e=()=>{}){return this.where(this.getFieldWhereForRelations(i,e,"=",0))}orWhereDoesntHave(i,e=()=>{}){return this.orWhere(this.getFieldWhereForRelations(i,e,"=",0))}groupBy(...i){return i.forEach(e=>{this.groups.push({field:e})}),this}orderBy(i,e="asc"){return this.orders.push({field:i,direction:e}),this}limit(i){return this.take=i,this}offset(i){return this.skip=i,this}with(i,e=()=>{}){return this.getNewHydrated=!0,this.eagerLoad[i]=e,this}withAll(i=()=>{}){let e=this.model.$fields();Object.values(this.model.$types()).forEach(r=>{e={...e,...r.fields()}});for(const r in e)e[r]instanceof nt&&this.with(r,i);return this}withAllRecursive(i=3){return this.withAll(e=>{i>0&&e.withAllRecursive(i-1)})}useCache(i,e){return this.fromCache=!0,this.cacheConfig={key:i,params:e},this}getFieldWhereForRelations(i,e=()=>{},n,r){const s=this.newQuery(this.model.$entity()).with(i,e).get(!1).filter(a=>Tg(We(a[i])?a[i].length:a[i]===null?0:1,typeof n=="number"?n:r??1,typeof n=="number"||r===void 0?">=":n)).map(a=>a.$getIndexId());return a=>s.includes(a.$getIndexId())}storeFind(i=[]){const e=this.commit("all"),n=[],r=new Set(i);return r.size>0?r.forEach(s=>{e[s]&&n.push(this.hydrate(e[s],{visible:this.visible,hidden:this.hidden,operation:"get"}))}):Object.values(e).forEach(s=>n.push(this.hydrate(s,{visible:this.visible,hidden:this.hidden,operation:"get"}))),n}all(){return this.storeFind()}get(i=!0){if(!this.fromCache||!this.cache)return this.internalGet(i);const e=this.cacheConfig.key?this.cacheConfig.key+JSON.stringify(this.cacheConfig.params):Ig(this.model.$entity(),{where:this.wheres,groups:this.groups,orders:this.orders,eagerLoads:this.eagerLoad,skip:this.skip,take:this.take,hidden:this.hidden,visible:this.visible}),n=this.cache.get(e);if(n)return n;const r=this.internalGet(i);return this.cache.set(e,r),r}internalGet(i){this.model.$entity()!==this.model.$baseEntity()&&this.where(this.model.$typeKey(),this.model.$fields()[this.model.$typeKey()].make());const e=this.select();return Jn(e)||this.eagerLoadRelations(e),i&&e.forEach(n=>n.$self().retrieved(n)),this.groups.length>0?this.filterGroup(e):e}first(){return this.limit(1).get()[0]??null}find(i){return this.whereId(i)[We(i)?"get":"first"]()}select(){let i=[];const e=this.wheres,n=this.wheres.findIndex(s=>s.field===this.model.$getKeyName());if(n>-1){const s=this.wheres[n].value;i=((Jo(s)?[]:We(s)?s:[s])||[]).map(String)||[],i.length>0&&(this.wheres=[...this.wheres.slice(0,n),...this.wheres.slice(n+1)])}let r=this.storeFind(i);return r=this.filterWhere(r),r=this.filterOrder(r),r=this.filterLimit(r),this.wheres=e,r}filterWhere(i){if(Jn(this.wheres))return i;const e=this.getWhereComparator();return i.filter(n=>e(n))}getWhereComparator(){const{and:i,or:e}=Cg(this.wheres,n=>n.boolean);return n=>{const r=[];return i&&r.push(i.every(s=>this.whereComparator(n,s))),e&&r.push(e.some(s=>this.whereComparator(n,s))),r.includes(!0)}}whereComparator(i,e){return Jo(e.field)?e.field(i):We(e.value)?e.value.includes(i[e.field]):Jo(e.value)?e.value(i[e.field]):i[e.field]===e.value}filterOrder(i){if(this.orders.length===0)return i;const e=this.orders.map(r=>r.field),n=this.orders.map(r=>r.direction);return Sg(i,e,n)}filterGroup(i){const e={},n=this.groups.map(r=>r.field);return i.forEach(r=>{const s=n.length===1?r[n[0]]:`[${n.map(a=>r[a]).toString()}]`;e[s]=(e[s]||[]).concat(r)}),e}filterLimit(i){return this.take!==null?i.slice(this.skip,this.skip+this.take):i.slice(this.skip)}load(i){this.eagerLoadRelations(i)}eagerLoadRelations(i){for(const e in this.eagerLoad)this.eagerLoadRelation(i,e,this.eagerLoad[e])}eagerLoadRelation(i,e,n){const r=this.getRelation(e),s=this.newQueryForRelation(r);r.addEagerConstraints(s,i),n(s),r.match(e,i,s)}getRelation(i){return this.model.$getRelation(i)}revive(i){return We(i)?this.reviveMany(i):this.reviveOne(i)}reviveOne(i){this.getNewHydrated=!1;const e=this.model.$getIndexId(i),n=this.commit("get")[e]??null;if(!n)return null;const r=this.hydrate(n,{visible:this.visible,hidden:this.hidden,operation:"get"});return this.reviveRelations(r,i),r}reviveMany(i){return i.reduce((e,n)=>{const r=this.reviveOne(n);return r&&e.push(r),e},[])}reviveRelations(i,e){const n=this.model.$fields();for(const r in e){const s=n[r];if(!(s instanceof nt))continue;const a=e[r];if(!a)return;if(s instanceof na){const o=i[s.getType()];i[r]=this.newQuery(o).reviveOne(a);continue}i[r]=We(a)?this.newQueryForRelation(s).reviveMany(a):this.newQueryForRelation(s).reviveOne(a)}}new(i=!0){let e=this.hydrate({},{operation:i?"set":"get"});const n=e.$self().creating(e),r=e.$self().saving(e);return n===!1||r===!1?null:(e.$isDirty()&&(e=this.hydrate(e.$getAttributes(),{operation:i?"set":"get"})),i&&(this.hydratedDataCache.set(this.model.$entity()+e.$getKey(void 0,!0),this.hydrate(e.$getAttributes(),{operation:"get"})),e.$self().created(e),e.$self().saved(e),this.commit("insert",this.compile(e))),e)}save(i){let e=this.newInterpreter().process(i);const n=this.model.$types(),r=this.model.$baseEntity()!==this.model.$entity();if(Object.values(n).length>0||r){const o=Object.keys(n),l={};i=We(i)?i:[i],i.forEach(u=>{const c=o.includes(`${u[this.model.$typeKey()]}`)||r?u[this.model.$typeKey()]??this.model.$fields()[this.model.$typeKey()].value:o[0];l[c]||(l[c]=[]),l[c].push(u)});for(const u in l){const c=n[u];c.entity===this.model.$entity()?e=this.newInterpreter().process(l[u]):this.newQueryWithConstraints(c.entity).save(l[u])}}const[s,a]=e;for(const o in a){const l=this.newQuery(o),u=a[o];l.saveElements(u)}return this.revive(s)}saveElements(i){const e={},n=this.commit("all"),r=[];for(const s in i){const a=i[s],o=n[s];let l=o?this.hydrate({...o,...a},{operation:"set",action:"update"}):this.hydrate(a,{operation:"set",action:"save"});const u=l.$self().saving(l,a),c=o?l.$self().updating(l,a):l.$self().creating(l,a);u===!1||c===!1||(l.$isDirty()&&(l=this.hydrate(l.$getAttributes(),{operation:"set",action:o?"update":"save"})),r.push(()=>l.$self().saved(l,a)),r.push(()=>o?l.$self().updated(l,a):l.$self().created(l,a)),e[s]=l.$getAttributes(),Object.values(l.$types()).length>0&&!e[s][l.$typeKey()]&&(e[s][l.$typeKey()]=a[l.$typeKey()]))}Object.keys(e).length>0&&(this.commit("save",e),r.forEach(s=>s()))}insert(i){const e=this.hydrate(i,{operation:"set",action:"insert"});return this.commit("insert",this.compile(e)),e}fresh(i){this.hydratedDataCache.clear();const e=this.hydrate(i,{action:"update"});return this.commit("fresh",this.compile(e)),e}update(i){const e=this.get(!1);if(Jn(e))return[];const n=e.map(r=>{const s=this.hydrate({...r.$getAttributes(),...i},{action:"update",operation:"set"});return r.$self().updating(r,i)===!1?r:(s.$self().updated(s),s)});return this.commit("update",this.compile(n)),n}destroy(i){return We(i)?this.destroyMany(i):this.destroyOne(i)}destroyOne(i){const e=this.find(i);if(!e)return null;const[n,r]=this.dispatchDeleteHooks(e);return r.includes(e.$getIndexId())||(this.commit("destroy",[e.$getIndexId()]),n.forEach(s=>s())),e}destroyMany(i){const e=this.find(i);if(Jn(e))return[];const[n,r]=this.dispatchDeleteHooks(e),s=this.getIndexIdsFromCollection(e).filter(a=>!r.includes(a));return this.commit("destroy",s),n.forEach(a=>a()),e}delete(){const i=this.get(!1);if(Jn(i))return[];const[e,n]=this.dispatchDeleteHooks(i),r=this.getIndexIdsFromCollection(i).filter(s=>!n.includes(s));return this.commit("delete",r),e.forEach(s=>s()),i}flush(){return this.commit("flush"),this.hydratedDataCache.clear(),this.get(!1)}checkAndDeleteRelations(i){const e=i.$fields();for(const n in e){const r=e[n];if(e[n]instanceof nt&&r.onDeleteMode&&i[n]){const a=(We(i[n])?i[n]:[i[n]]).map(l=>l.$getKey(void 0,!0)),o={};if(r instanceof Pc){this.newQuery(r.pivot.$entity()).where(r.foreignPivotKey,i[i.$getLocalKey()]).delete();continue}switch(r.onDeleteMode){case"cascade":{this.newQueryForRelation(r).destroy(a);break}case"set null":{r.foreignKey&&(o[r.foreignKey]=null),r.morphId&&(o[r.morphId]=null,o[r.morphType]=null),this.newQueryForRelation(r).whereId(a).update(o);break}}}}}dispatchDeleteHooks(i){const e=[],n=[];return i=We(i)?i:[i],this.withAll().load(i),i.forEach(r=>{r.$self().deleting(r)===!1?n.push(r.$getIndexId()):(this.hydratedDataCache.delete(this.model.$entity()+r.$getIndexId()),e.push(()=>r.$self().deleted(r)),this.checkAndDeleteRelations(r))}),[e,n]}getIndexIdsFromCollection(i){return i.map(e=>e.$getIndexId())}hydrate(i,e){return We(i)?i.map(n=>this.hydrate(n,e)):this.getHydratedModel(i,{relations:!1,...e||{}})}compile(i){return(We(i)?i:[i]).reduce((n,r)=>(n[r.$getIndexId()]=r.$getAttributes(),n),{})}getHydratedModel(i,e){const n=this.model.$getKey(i,!0),r=n&&this.hydratedDataCache.get(this.model.$entity()+n);if(!this.getNewHydrated&&(e==null?void 0:e.operation)!=="set"&&r)return r;const s=this.model.$types()[i[this.model.$typeKey()]],a=l=>(s?s.newRawInstance():this.model).$newInstance(i,{relations:!1,...e||{},...l}),o=a();return n&&!this.getNewHydrated&&(e==null?void 0:e.operation)!=="set"&&this.hydratedDataCache.set(this.model.$entity()+n,o),n&&(e==null?void 0:e.action)==="update"&&this.hydratedDataCache.set(this.model.$entity()+n,a({operation:"get"})),o}}var uv=Object.defineProperty,cv=(t,i,e)=>i in t?uv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,hv=(t,i,e)=>(cv(t,typeof i!="symbol"?i+"":i,e),e),fv=(t,i,e)=>{if(!i.has(t))throw TypeError("Cannot "+e)},Xt=(t,i,e)=>(fv(t,i,"read from private field"),e?e.call(t):i.get(t)),dv=(t,i,e)=>{if(i.has(t))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(t):i.set(t,e)},Rc,Mt;class Cc{constructor(){hv(this,Rc),dv(this,Mt,new Map)}has(i){var e;return!!(Xt(this,Mt).has(i)&&((e=Xt(this,Mt).get(i))!=null&&e.deref()))}get(i){const e=Xt(this,Mt).get(i);if(!e)return;const n=e.deref();if(n)return n;Xt(this,Mt).delete(i)}set(i,e){return Xt(this,Mt).set(i,new WeakRef(e)),this}get size(){return Xt(this,Mt).size}clear(){Xt(this,Mt).clear()}delete(i){return Xt(this,Mt).delete(i),!1}forEach(i){for(const[e,n]of this)i(n,e,this)}*[(Rc=Symbol.toStringTag,Symbol.iterator)](){for(const[i,e]of Xt(this,Mt)){const n=e.deref();if(!n){Xt(this,Mt).delete(i);continue}yield[i,n]}}*entries(){for(const[i,e]of this)yield[i,e]}*keys(){for(const[i]of this)yield i}*values(){for(const[,i]of this)yield i}}Mt=new WeakMap;const pv=new Cc,mv=new Map,sa={model:{namespace:"",withMeta:!1,hidden:["_meta"],visible:["*"]},cache:{shared:!0,provider:Cc}},Ai={...sa};var gv=Object.defineProperty,vv=(t,i,e)=>i in t?gv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,li=(t,i,e)=>(vv(t,typeof i!="symbol"?i+"":i,e),e);class oa{constructor(i,e){li(this,"database"),li(this,"model"),li(this,"pinia"),li(this,"queryCache"),li(this,"hydratedDataCache"),li(this,"use"),li(this,"config"),this.config=Ai,this.database=i,this.pinia=e,this.hydratedDataCache=mv}static setModel(i){return this.useModel=i,this}setConfig(i){this.config=i}initialize(i){return this.config.cache&&this.config.cache!==!0&&(this.queryCache=this.config.cache.shared?pv:new this.config.cache.provider),i?(this.model=i.newRawInstance(),this):this.use||this.$self().useModel?(this.use=this.use??this.$self().useModel,this.model=this.use.newRawInstance(),this):this}$self(){return this.constructor}getModel(){return Qn(!!this.model,["The model is not registered. Please define the model to be used at","`use` property of the repository class."]),this.model}piniaStore(){return Ec(this.model.$storeName(),this.model.$piniaOptions(),this.query())(this.pinia)}repo(i){return Yi(i)}query(){return new tr(this.database,this.getModel(),this.queryCache,this.hydratedDataCache,this.pinia)}cache(){return this.queryCache}where(i,e){return this.query().where(i,e)}orWhere(i,e){return this.query().orWhere(i,e)}whereHas(i,e=()=>{},n,r){return this.query().whereHas(i,e,n,r)}orWhereHas(i,e=()=>{},n,r){return this.query().orWhereHas(i,e,n,r)}has(i,e,n){return this.query().has(i,e,n)}orHas(i,e,n){return this.query().orHas(i,e,n)}doesntHave(i){return this.query().doesntHave(i)}orDoesntHave(i){return this.query().orDoesntHave(i)}whereDoesntHave(i,e=()=>{}){return this.query().whereDoesntHave(i,e)}orWhereDoesntHave(i,e=()=>{}){return this.query().orWhereDoesntHave(i,e)}withMeta(){return this.query().withMeta()}makeVisible(i){return this.query().makeVisible(i)}makeHidden(i){return this.query().makeHidden(i)}groupBy(...i){return this.query().groupBy(...i)}orderBy(i,e){return this.query().orderBy(i,e)}limit(i){return this.query().limit(i)}offset(i){return this.query().offset(i)}with(i,e){return this.query().with(i,e)}withAll(i){return this.query().withAll(i)}withAllRecursive(i){return this.query().withAllRecursive(i)}useCache(i,e){return this.query().useCache(i,e)}all(){return this.query().get()}find(i){return this.query().find(i)}revive(i){return this.query().revive(i)}make(i){return We(i)?i.map(e=>this.getModel().$newInstance(e,{relations:!0})):this.getModel().$newInstance(i,{relations:!0})}save(i){return this.query().save(i)}new(i=!0){return this.query().new(i)}insert(i){return this.query().insert(i)}fresh(i){return this.query().fresh(i)}destroy(i){return this.query().destroy(i)}flush(){return this.query().flush()}}li(oa,"_isRepository",!0),li(oa,"useModel");var yv=Object.defineProperty,bv=(t,i,e)=>i in t?yv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,wv=(t,i,e)=>(bv(t,typeof i!="symbol"?i+"":i,e),e);class _v{constructor(){wv(this,"models",{})}register(i){const e=i.$entity();this.models[e]||(this.models[e]=i,this.registerRelatedModels(i))}registerRelatedModels(i){const e=i.$fields();for(const n in e){const r=e[n];r instanceof nt&&r.getRelateds().forEach(s=>{this.register(s)})}}getModel(i){return this.models[i]}}const Oc=[];function Tv(t){let i=Ai;return Oc.forEach(e=>{const n=e({config:i,repository:t,model:t.getModel()});i={...i,...n.config}}),t.setConfig(i),t}function Yi(t,i){const e=new _v,n=t._isRepository?new t(e,i).initialize():new oa(e,i).initialize(t);try{const r=Object.values(n.getModel().$types());r.length>0?r.forEach(s=>n.database.register(s.newRawInstance())):n.database.register(n.getModel())}catch{}return Tv(n)}function xv(t){Ai.model={...sa.model,...t==null?void 0:t.model},Ai.cache=(t==null?void 0:t.cache)===!1?!1:{...sa.cache,...(t==null?void 0:t.cache)!==!0&&(t==null?void 0:t.cache)};const i={use(e){return Oc.push(e),this}};return()=>i}class Sv extends er{make(i){return i===void 0?this.value:i}}let Ev=class extends er{constructor(i,e){super(i,e)}make(i){return this.makeReturn("string",i)}},Pv=class extends er{constructor(i,e){super(i,e)}make(i){return this.makeReturn("number",i)}},Rv=class extends er{constructor(i,e){super(i,e)}make(i){return this.makeReturn("boolean",i)}};var Cv=Object.defineProperty,Ov=(t,i,e)=>i in t?Cv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,Ic=(t,i,e)=>(Ov(t,typeof i!="symbol"?i+"":i,e),e);class Ac extends nt{constructor(i,e,n,r){super(i,e),Ic(this,"foreignKey"),Ic(this,"localKey"),this.foreignKey=n,this.localKey=r}getRelateds(){return[this.related]}define(i){return i.one(this.related,this.parent)}attach(i,e){this.compositeKeyMapper(this.foreignKey,this.localKey,(n,r)=>{e[n]=i[r]})}addEagerConstraints(i,e){this.compositeKeyMapper(this.foreignKey,this.localKey,(n,r)=>i.whereIn(n,this.getKeys(e,r)))}match(i,e,n){const r=this.buildDictionary(n.get(!1));e.forEach(s=>{const a=s[this.getKey(this.localKey)];r[a]?s.$setRelation(i,r[a][0]):s.$setRelation(i,null)})}buildDictionary(i){return this.mapToDictionary(i,e=>[e[this.getKey(this.foreignKey)],e])}make(i){return i?this.related.$newInstance(i):null}}var Iv=Object.defineProperty,Av=(t,i,e)=>i in t?Iv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,aa=(t,i,e)=>(Av(t,typeof i!="symbol"?i+"":i,e),e);class kv extends nt{constructor(i,e,n,r){super(i,e),aa(this,"child"),aa(this,"foreignKey"),aa(this,"ownerKey"),this.foreignKey=n,this.ownerKey=r,this.child=e}getRelateds(){return[this.child]}define(i){return i.one(this.child,this.parent)}attach(i,e){this.compositeKeyMapper(this.foreignKey,this.ownerKey,(n,r)=>{i[n]=e[r]})}addEagerConstraints(i,e){this.compositeKeyMapper(this.foreignKey,this.ownerKey,(n,r)=>i.whereIn(r,this.getEagerModelKeys(e,n)))}getEagerModelKeys(i,e){return i.reduce((n,r)=>(r[e]!==null&&n.push(r[e]),n),[])}match(i,e,n){const r=this.buildDictionary(n.get(!1));e.forEach(s=>{const a=s[this.getKey(this.foreignKey)];r[a]?s.$setRelation(i,r[a]):s.$setRelation(i,null)})}buildDictionary(i){return i.reduce((e,n)=>(e[n[this.getKey(this.ownerKey)]]=n,e),{})}make(i){return i?this.child.$newInstance(i):null}}var Dv=Object.defineProperty,Mv=(t,i,e)=>i in t?Dv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,kc=(t,i,e)=>(Mv(t,typeof i!="symbol"?i+"":i,e),e);class Nv extends nt{constructor(i,e,n,r){super(i,e),kc(this,"foreignKey"),kc(this,"localKey"),this.foreignKey=n,this.localKey=r}getRelateds(){return[this.related]}define(i){return i.many(this.related,this.parent)}attach(i,e){this.compositeKeyMapper(this.foreignKey,this.localKey,(n,r)=>{e[n]=i[r]})}addEagerConstraints(i,e){this.compositeKeyMapper(this.foreignKey,this.localKey,(n,r)=>i.whereIn(n,this.getKeys(e,r)))}match(i,e,n){const r=this.buildDictionary(n.get(!1));e.forEach(s=>{const a=s[this.getKey(this.localKey)];r[a]?s.$setRelation(i,r[a]):s.$setRelation(i,[])})}buildDictionary(i){return this.mapToDictionary(i,e=>{const n=this.getKey(this.foreignKey);return[e[n],e]})}make(i){return i?i.map(e=>this.related.$newInstance(e)):[]}}var Lv=Object.defineProperty,Fv=(t,i,e)=>i in t?Lv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,la=(t,i,e)=>(Fv(t,typeof i!="symbol"?i+"":i,e),e);class zv extends nt{constructor(i,e,n,r){super(i,e),la(this,"child"),la(this,"foreignKey"),la(this,"ownerKey"),this.foreignKey=n,this.ownerKey=r,this.child=e}getRelateds(){return[this.child]}define(i){return i.many(this.child,this.parent)}attach(i,e){e[this.ownerKey]!==void 0&&(i[this.foreignKey]||(i[this.foreignKey]=[]),this.attachIfMissing(i[this.foreignKey],e[this.ownerKey]))}attachIfMissing(i,e){i.includes(e)||i.push(e)}addEagerConstraints(i,e){i.whereIn(this.ownerKey,this.getEagerModelKeys(e))}getEagerModelKeys(i){return i.reduce((e,n)=>[...e,...n[this.foreignKey]],[])}match(i,e,n){const r=this.buildDictionary(n.get(!1));e.forEach(s=>{const a=this.getRelatedModels(r,s[this.foreignKey]);s.$setRelation(i,a)})}buildDictionary(i){return i.reduce((e,n)=>(e[n[this.ownerKey]]=n,e),{})}getRelatedModels(i,e){return e.reduce((n,r)=>{const s=i[r];return s&&n.push(s),n},[])}make(i){return i?i.map(e=>this.child.$newInstance(e)):[]}}var Hv=Object.defineProperty,Bv=(t,i,e)=>i in t?Hv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,ua=(t,i,e)=>(Bv(t,typeof i!="symbol"?i+"":i,e),e);class Dc extends nt{constructor(i,e,n,r,s){super(i,e),ua(this,"morphId"),ua(this,"morphType"),ua(this,"localKey"),this.morphId=n,this.morphType=r,this.localKey=s}getRelateds(){return[this.related]}define(i){return i.one(this.related,this.parent)}attach(i,e){e[this.morphId]=i[this.localKey],e[this.morphType]=this.parent.$entity()}addEagerConstraints(i,e){i.where(this.morphType,this.parent.$entity()).whereIn(this.morphId,this.getKeys(e,this.localKey))}match(i,e,n){const r=this.buildDictionary(n.get(!1));e.forEach(s=>{const a=s[this.localKey];r[a]?s.$setRelation(i,r[a]):s.$setRelation(i,null)})}buildDictionary(i){return i.reduce((e,n)=>(e[n[this.morphId]]=n,e),{})}make(i){return i?this.related.$newInstance(i):null}}var Uv=Object.defineProperty,Vv=(t,i,e)=>i in t?Uv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,ca=(t,i,e)=>(Vv(t,typeof i!="symbol"?i+"":i,e),e);class jv extends nt{constructor(i,e,n,r,s){super(i,e),ca(this,"morphId"),ca(this,"morphType"),ca(this,"localKey"),this.morphId=n,this.morphType=r,this.localKey=s}getRelateds(){return[this.related]}define(i){return i.many(this.related,this.parent)}attach(i,e){e[this.morphId]=i[this.localKey],e[this.morphType]=this.parent.$entity()}addEagerConstraints(i,e){i.where(this.morphType,this.parent.$entity()),i.whereIn(this.morphId,this.getKeys(e,this.localKey))}match(i,e,n){const r=this.buildDictionary(n.get(!1));e.forEach(s=>{const a=s[this.localKey];r[a]?s.$setRelation(i,r[a]):s.$setRelation(i,[])})}buildDictionary(i){return this.mapToDictionary(i,e=>[e[this.morphId],e])}make(i){return i?i.map(e=>this.related.$newInstance(e)):[]}}var Wv=Object.defineProperty,Gv=(t,i,e)=>i in t?Wv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,ir=(t,i,e)=>(Gv(t,typeof i!="symbol"?i+"":i,e),e);class qv extends nt{constructor(i,e,n,r,s,a,o){super(i,e),ir(this,"through"),ir(this,"firstKey"),ir(this,"secondKey"),ir(this,"localKey"),ir(this,"secondLocalKey"),this.through=n,this.firstKey=r,this.secondKey=s,this.localKey=a,this.secondLocalKey=o}getRelateds(){return[this.related,this.through]}define(i){return i.many(this.related,this.parent)}attach(i,e){}addEagerConstraints(i,e){}match(i,e,n){const r=n.newQuery(this.through.$entity()).where(this.firstKey,this.getKeys(e,this.localKey)).get(!1),s=n.where(this.secondKey,this.getKeys(r,this.secondLocalKey)).groupBy(this.secondKey).get(!1),a=this.buildDictionary(r,s);e.forEach(o=>{const l=o[this.localKey];a[l]?o.$setRelation(i,a[l][0]):o.$setRelation(i,[])})}buildDictionary(i,e){return this.mapToDictionary(i,n=>[n[this.firstKey],e[n[this.secondLocalKey]]])}make(i){return i?i.map(e=>this.related.$newInstance(e)):[]}}var Kv=Object.defineProperty,Zv=(t,i,e)=>i in t?Kv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,Xi=(t,i,e)=>(Zv(t,typeof i!="symbol"?i+"":i,e),e);class Yv extends nt{constructor(i,e,n,r,s,a,o,l){super(i,e),Xi(this,"pivot"),Xi(this,"morphId"),Xi(this,"morphType"),Xi(this,"relatedId"),Xi(this,"parentKey"),Xi(this,"relatedKey"),Xi(this,"pivotKey","pivot"),this.pivot=n,this.morphId=s,this.morphType=a,this.relatedId=r,this.parentKey=o,this.relatedKey=l}getRelateds(){return[this.related,this.pivot]}define(i){return i.many(this.related,this.parent)}attach(i,e){const n=e.pivot??{};n[this.morphId]=i[this.parentKey],n[this.morphType]=this.parent.$entity(),n[this.relatedId]=e[this.relatedKey],e[`pivot_${this.pivot.$entity()}`]=n}make(i){return i?i.map(e=>this.related.$newInstance(e)):[]}match(i,e,n){const r=n.get(!1),s=n.newQuery(this.pivot.$entity()).whereIn(this.relatedId,this.getKeys(r,this.relatedKey)).whereIn(this.morphId,this.getKeys(e,this.parentKey)).groupBy(this.morphId,this.relatedId,this.morphType).get();e.forEach(a=>{const o=[];r.forEach(l=>{var h;const u=((h=s[`[${a[this.parentKey]},${l[this.relatedKey]},${this.parent.$entity()}]`])==null?void 0:h[0])??null,c=l.$newInstance(l.$toJson());c.$setRelation("pivot",u),u&&o.push(c)}),a.$setRelation(i,o)})}addEagerConstraints(i,e){}}var Xv=Object.defineProperty,Jv=(t,i,e)=>i in t?Xv(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,Ge=(t,i,e)=>(Jv(t,typeof i!="symbol"?i+"":i,e),e);class Be{constructor(i,e={operation:"set"}){this.$boot(),(e.fill??!0)&&this.$fill(i,e)}static fields(){return{}}static initializeSchema(){this.schemas[this.entity]={},this.fieldsOnDelete[this.entity]=this.fieldsOnDelete[this.entity]??{};const i={...this.fields(),...this.registries[this.entity]};for(const e in i){const n=i[e];this.schemas[this.entity][e]=typeof n=="function"?n():n,this.fieldsOnDelete[this.entity][e]&&(this.schemas[this.entity][e]=this.schemas[this.entity][e].onDelete(this.fieldsOnDelete[this.entity][e]))}}static setRegistry(i,e){return this.registries[this.entity]||(this.registries[this.entity]={}),this.registries[this.entity][i]=e,this}static setFieldDeleteMode(i,e){return this.fieldsOnDelete[this.entity]=this.fieldsOnDelete[this.entity]??{},this.fieldsOnDelete[this.entity][i]=e,this}static setMutator(i,e){return this.fieldMutators[i]=e,this}static setCast(i,e){return this.fieldCasts[i]=e,this}static setHidden(i){return this.hidden.push(i),this}static clearBootedModels(){this.booted={},this.original={},this.schemas={},this.fieldMutators={},this.fieldCasts={},this.hidden=[],this.visible=[]}static clearRegistries(){this.registries={}}static newRawInstance(){return new this(void 0,{fill:!1})}static attr(i){return new Sv(this.newRawInstance(),i)}static string(i){return new Ev(this.newRawInstance(),i)}static number(i){return new Pv(this.newRawInstance(),i)}static boolean(i){return new Rv(this.newRawInstance(),i)}static uid(i){return new xc(this.newRawInstance(),i)}static hasOne(i,e,n){const r=this.newRawInstance();return n=n??r.$getKeyName(),new Ac(r,i.newRawInstance(),e,n)}static belongsTo(i,e,n){const r=i.newRawInstance();return n=n??r.$getKeyName(),new kv(this.newRawInstance(),r,e,n)}static belongsToMany(i,e,n,r,s,a){const o=i.newRawInstance(),l=this.newRawInstance(),u=e.newRawInstance();return s=s??l.$getLocalKey(),a=a??o.$getLocalKey(),this.schemas[i.entity][`pivot_${u.$entity()}`]=new Ac(o,u,r,a),new Pc(l,o,u,n,r,s,a)}static morphToMany(i,e,n,r,s,a,o){const l=i.newRawInstance(),u=this.newRawInstance(),c=e.newRawInstance();return a=a??u.$getLocalKey(),o=o??l.$getLocalKey(),this.schemas[i.entity][`pivot_${c.$entity()}`]=new Dc(l,c,n,u.$entity(),o),new Yv(u,l,c,n,r,s,a,o)}static hasMany(i,e,n){const r=this.newRawInstance();return n=n??r.$getKeyName(),new Nv(r,i.newRawInstance(),e,n)}static hasManyBy(i,e,n){const r=i.newRawInstance();return n=n??r.$getLocalKey(),new zv(this.newRawInstance(),r,e,n)}static hasManyThrough(i,e,n,r,s,a){const o=this.newRawInstance(),l=e.newRawInstance();return s=s??o.$getLocalKey(),a=a??l.$getLocalKey(),new qv(o,i.newRawInstance(),l,n,r,s,a)}static morphOne(i,e,n,r){const s=this.newRawInstance();return r=r??s.$getLocalKey(),new Dc(s,i.newRawInstance(),e,n,r)}static morphTo(i,e,n,r=""){const s=this.newRawInstance(),a=i.map(o=>o.newRawInstance());return new na(s,a,e,n,r)}static morphMany(i,e,n,r){const s=this.newRawInstance();return r=r??s.$getLocalKey(),new jv(s,i.newRawInstance(),e,n,r)}static mutators(){return{}}static casts(){return{}}static types(){return{}}$self(){return this.constructor}$entity(){return this.$self().entity}$config(){return this.$self().config}$namespace(){return this.$self().namespace??Ai.model.namespace}$storeName(){return(this.$namespace()?this.$namespace()+"/":"")+this.$baseEntity()}$baseEntity(){return this.$self().baseEntity??this.$entity()}$typeKey(){return this.$self().typeKey}$types(){return this.$self().types()}$piniaOptions(){return this.$self().piniaOptions}$primaryKey(){return this.$self().primaryKey}$fields(){return this.$self().schemas[this.$entity()]}$hidden(){return this.$self().hidden}$visible(){return this.$self().visible}$newInstance(i,e){const n=this.$self();return new n(i,e)}$boot(){this.$self().booted[this.$entity()]||(this.$self().booted[this.$entity()]=!0,this.$initializeSchema())}$initializeSchema(){this.$self().initializeSchema()}$casts(){return{...this.$getCasts(),...this.$self().fieldCasts}}$fill(i={},e={}){var l;const n=e.operation??"get",r={...Ai.model,...this.$config()};r.withMeta&&(this.$self().schemas[this.$entity()][this.$self().metaKey]=this.$self().attr({}));const s=this.$fields(),a=e.relations??!0,o={...this.$getMutators(),...this.$self().fieldMutators};for(const u in s){if(n==="get"&&!this.isFieldVisible(u,this.$hidden(),this.$visible(),e))continue;const c=s[u];let h=i[u];if(c instanceof nt&&!a)continue;const f=o==null?void 0:o[u],p=(l=this.$casts()[u])==null?void 0:l.newRawInstance(s);f&&n==="get"&&(h=typeof f=="function"?f(h):typeof f.get=="function"?f.get(h):h),p&&n==="get"&&(h=p.get(h));let m=this.$fillField(u,c,h);f&&typeof f!="function"&&n==="set"&&f.set&&(m=f.set(m)),p&&n==="set"&&(m=p.set(m)),this[u]=this[u]??m}return n==="set"&&(this.$self().original[this.$getKey(this,!0)]=this.$getAttributes()),r.withMeta&&n==="set"&&this.$fillMeta(e.action),this}$fillMeta(i="save"){const e=Math.floor(Date.now()/1e3);i==="save"&&(this[this.$self().metaKey]={createdAt:e,updatedAt:e}),i==="update"&&(this[this.$self().metaKey].updatedAt=e)}$fillField(i,e,n){if(n!==void 0)return e instanceof na?e.setKey(i).make(n,this[e.getType()]):e.setKey(i).make(n);if(this[i]===void 0)return e.setKey(i).make()}isFieldVisible(i,e,n,r){const s=e.length>0?e:Ai.model.hidden,a=[...n.length>0?n:Ai.model.visible,String(this.$primaryKey())],o=r.visible??[],l=r.hidden??[];return(s.includes("*")||s.includes(i))&&!o.includes(i)||l.includes(i)?!1:(a.includes("*")||a.includes(i))&&!l.includes(i)||o.includes(i)}$getKeyName(){return this.$primaryKey()}$getKey(i,e=!1){if(i=i??this,this.$hasCompositeKey()){const r=this.$getCompositeKey(i);return e?"["+(r==null?void 0:r.join(","))+"]":r}const n=i[this.$getKeyName()];return Xo(n)?null:n}$hasCompositeKey(){return We(this.$getKeyName())}$getCompositeKey(i){let e=[];return this.$getKeyName().every(n=>{const r=i[n];return Xo(r)?(e=null,!1):(e.push(r),!0)}),e===null?null:e}$getIndexId(i){const e=i??this,n=this.$getKey(e);return Qn(n!==null,["The record is missing the primary key. If you want to persist record","without the primary key, please define the primary key field with the","`uid` attribute."]),this.$stringifyId(n)}$stringifyId(i){return We(i)?JSON.stringify(i):String(i)}$getLocalKey(){return Qn(!this.$hasCompositeKey(),["Please provide the local key for the relationship. The model with the","composite key can't infer its local key."]),this.$getKeyName()}$getRelation(i){let e=this.$fields()[i];return Object.values(this.$types()).forEach(r=>{e===void 0&&(e=r.fields()[i])}),Qn(e instanceof nt,[`Relationship [${i}] on model [${this.$entity()}] not found.`]),e}$setRelation(i,e){return i.includes("pivot")?(this.pivot=e,this):(this.$fields()[i]&&(this[i]=e),this)}$getMutators(){return this.$self().mutators()}$getCasts(){return this.$self().casts()}$getOriginal(){return this.$self().original[this.$getKey(this,!0)]}$refresh(){return this.$isDirty()&&Object.entries(this.$getOriginal()).forEach(i=>{this[i[0]]=i[1]}),this}$isDirty(i){const e=this.$getOriginal();return i?(Object.keys(e).includes(i)||hs(['The property"',i,'"does not exit in the model "',this.$entity(),'"']),!Qo(this[i],e[i])):!Qo(e,this.$getAttributes())}$getAttributes(){return this.$toJson(this,{relations:!1})}$toJson(i,e={}){i=i??this;const n=i.$fields(),r=e.relations??!0,s={};for(const a in n){const o=n[a],l=i[a];if(!(o instanceof nt)){s[a]=this.serializeValue(l);continue}r&&(s[a]=this.serializeRelation(l))}return s}serializeValue(i){return i===null?null:We(i)?this.serializeArray(i):typeof i=="object"?i instanceof Date&&!isNaN(i.getTime())&&typeof i.toISOString=="function"?i.toISOString():this.serializeObject(i):i}serializeArray(i){return i.map(e=>this.serializeValue(e))}serializeObject(i){const e={};for(const n in i)e[n]=this.serializeValue(i[n]);return e}serializeRelation(i){if(i!==void 0)return i===null?null:We(i)?i.map(e=>e.$toJson()):i.$toJson()}}Ge(Be,"entity"),Ge(Be,"baseEntity"),Ge(Be,"namespace"),Ge(Be,"primaryKey","id"),Ge(Be,"metaKey","_meta"),Ge(Be,"hidden",["_meta"]),Ge(Be,"visible",[]),Ge(Be,"config"),Ge(Be,"typeKey","type"),Ge(Be,"fieldsOnDelete",{}),Ge(Be,"original",{}),Ge(Be,"schemas",{}),Ge(Be,"registries",{}),Ge(Be,"piniaOptions",{}),Ge(Be,"fieldMutators",{}),Ge(Be,"fieldCasts",{}),Ge(Be,"booted",{}),Ge(Be,"saving",()=>{}),Ge(Be,"updating",()=>{}),Ge(Be,"creating",()=>{}),Ge(Be,"deleting",()=>{}),Ge(Be,"retrieved",()=>{}),Ge(Be,"saved",()=>{}),Ge(Be,"updated",()=>{}),Ge(Be,"created",()=>{}),Ge(Be,"deleted",()=>{});function Mc(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);i&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function de(t){for(var i=1;it.length)&&(i=t.length);for(var e=0,n=new Array(i);e-1;r--){var s=e[r],a=(s.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(a)>-1&&(n=s)}return Ke.head.insertBefore(i,n),t}}var Ty="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function hr(){for(var t=12,i="";t-- >0;)i+=Ty[Math.random()*62|0];return i}function yn(t){for(var i=[],e=(t||[]).length>>>0;e--;)i[e]=t[e];return i}function ba(t){return t.classList?yn(t.classList):(t.getAttribute("class")||"").split(" ").filter(function(i){return i})}function Qc(t){return"".concat(t).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function xy(t){return Object.keys(t||{}).reduce(function(i,e){return i+"".concat(e,'="').concat(Qc(t[e]),'" ')},"").trim()}function bs(t){return Object.keys(t||{}).reduce(function(i,e){return i+"".concat(e,": ").concat(t[e].trim(),";")},"")}function wa(t){return t.size!==Jt.size||t.x!==Jt.x||t.y!==Jt.y||t.rotate!==Jt.rotate||t.flipX||t.flipY}function Sy(t){var i=t.transform,e=t.containerWidth,n=t.iconWidth,r={transform:"translate(".concat(e/2," 256)")},s="translate(".concat(i.x*32,", ").concat(i.y*32,") "),a="scale(".concat(i.size/16*(i.flipX?-1:1),", ").concat(i.size/16*(i.flipY?-1:1),") "),o="rotate(".concat(i.rotate," 0 0)"),l={transform:"".concat(s," ").concat(a," ").concat(o)},u={transform:"translate(".concat(n/2*-1," -256)")};return{outer:r,inner:l,path:u}}function Ey(t){var i=t.transform,e=t.width,n=e===void 0?pa:e,r=t.height,s=r===void 0?pa:r,a=t.startCentered,o=a===void 0?!1:a,l="";return o&&Wc?l+="translate(".concat(i.x/Di-n/2,"em, ").concat(i.y/Di-s/2,"em) "):o?l+="translate(calc(-50% + ".concat(i.x/Di,"em), calc(-50% + ").concat(i.y/Di,"em)) "):l+="translate(".concat(i.x/Di,"em, ").concat(i.y/Di,"em) "),l+="scale(".concat(i.size/Di*(i.flipX?-1:1),", ").concat(i.size/Di*(i.flipY?-1:1),") "),l+="rotate(".concat(i.rotate,"deg) "),l}var Py=`:root, :host { --fa-font-solid: normal 900 1em/1 "Font Awesome 6 Solid"; @@ -786,13 +786,13 @@ svg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa { `).forEach(function(a){r=a.indexOf(":"),e=a.substring(0,r).trim().toLowerCase(),n=a.substring(r+1).trim(),!(!e||i[e]&&Uw[e])&&(e==="set-cookie"?i[e]?i[e].push(n):i[e]=[n]:i[e]=i[e]?i[e]+", "+n:n)}),i},af=Symbol("internals");function gr(t){return t&&String(t).trim().toLowerCase()}function Ls(t){return t===!1||t==null?t:Z.isArray(t)?t.map(Ls):String(t)}function jw(t){const i=Object.create(null),e=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=e.exec(t);)i[n[1]]=n[2];return i}const Ww=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Ka(t,i,e,n,r){if(Z.isFunction(n))return n.call(this,i,e);if(r&&(i=e),!!Z.isString(i)){if(Z.isString(n))return i.indexOf(n)!==-1;if(Z.isRegExp(n))return n.test(i)}}function Gw(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(i,e,n)=>e.toUpperCase()+n)}function qw(t,i){const e=Z.toCamelCase(" "+i);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+e,{value:function(r,s,a){return this[n].call(this,i,r,s,a)},configurable:!0})})}class Fs{constructor(i){i&&this.set(i)}set(i,e,n){const r=this;function s(o,l,u){const c=gr(l);if(!c)throw new Error("header name must be a non-empty string");const h=Z.findKey(r,c);(!h||r[h]===void 0||u===!0||u===void 0&&r[h]!==!1)&&(r[h||l]=Ls(o))}const a=(o,l)=>Z.forEach(o,(u,c)=>s(u,c,l));return Z.isPlainObject(i)||i instanceof this.constructor?a(i,e):Z.isString(i)&&(i=i.trim())&&!Ww(i)?a(Vw(i),e):i!=null&&s(e,i,n),this}get(i,e){if(i=gr(i),i){const n=Z.findKey(this,i);if(n){const r=this[n];if(!e)return r;if(e===!0)return jw(r);if(Z.isFunction(e))return e.call(this,r,n);if(Z.isRegExp(e))return e.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(i,e){if(i=gr(i),i){const n=Z.findKey(this,i);return!!(n&&this[n]!==void 0&&(!e||Ka(this,this[n],n,e)))}return!1}delete(i,e){const n=this;let r=!1;function s(a){if(a=gr(a),a){const o=Z.findKey(n,a);o&&(!e||Ka(n,n[o],o,e))&&(delete n[o],r=!0)}}return Z.isArray(i)?i.forEach(s):s(i),r}clear(i){const e=Object.keys(this);let n=e.length,r=!1;for(;n--;){const s=e[n];(!i||Ka(this,this[s],s,i,!0))&&(delete this[s],r=!0)}return r}normalize(i){const e=this,n={};return Z.forEach(this,(r,s)=>{const a=Z.findKey(n,s);if(a){e[a]=Ls(r),delete e[s];return}const o=i?Gw(s):String(s).trim();o!==s&&delete e[s],e[o]=Ls(r),n[o]=!0}),this}concat(...i){return this.constructor.concat(this,...i)}toJSON(i){const e=Object.create(null);return Z.forEach(this,(n,r)=>{n!=null&&n!==!1&&(e[r]=i&&Z.isArray(n)?n.join(", "):n)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([i,e])=>i+": "+e).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(i){return i instanceof this?i:new this(i)}static concat(i,...e){const n=new this(i);return e.forEach(r=>n.set(r)),n}static accessor(i){const n=(this[af]=this[af]={accessors:{}}).accessors,r=this.prototype;function s(a){const o=gr(a);n[o]||(qw(r,a),n[o]=!0)}return Z.isArray(i)?i.forEach(s):s(i),this}}Fs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Z.reduceDescriptors(Fs.prototype,({value:t},i)=>{let e=i[0].toUpperCase()+i.slice(1);return{get:()=>t,set(n){this[e]=n}}}),Z.freezeMethods(Fs);const pi=Fs;function Za(t,i){const e=this||qa,n=i||e,r=pi.from(n.headers);let s=n.data;return Z.forEach(t,function(o){s=o.call(e,s,r.normalize(),i?i.status:void 0)}),r.normalize(),s}function lf(t){return!!(t&&t.__CANCEL__)}function vr(t,i,e){Le.call(this,t??"canceled",Le.ERR_CANCELED,i,e),this.name="CanceledError"}Z.inherits(vr,Le,{__CANCEL__:!0});function Kw(t,i,e){const n=e.config.validateStatus;!e.status||!n||n(e.status)?t(e):i(new Le("Request failed with status code "+e.status,[Le.ERR_BAD_REQUEST,Le.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e))}const Zw=$t.hasStandardBrowserEnv?{write(t,i,e,n,r,s){const a=[t+"="+encodeURIComponent(i)];Z.isNumber(e)&&a.push("expires="+new Date(e).toGMTString()),Z.isString(n)&&a.push("path="+n),Z.isString(r)&&a.push("domain="+r),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(t){const i=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Yw(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Xw(t,i){return i?t.replace(/\/?\/$/,"")+"/"+i.replace(/^\/+/,""):t}function uf(t,i){return t&&!Yw(i)?Xw(t,i):i}const Jw=$t.hasStandardBrowserEnv?function(){const i=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");let n;function r(s){let a=s;return i&&(e.setAttribute("href",a),a=e.href),e.setAttribute("href",a),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:e.pathname.charAt(0)==="/"?e.pathname:"/"+e.pathname}}return n=r(window.location.href),function(a){const o=Z.isString(a)?r(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}();function Qw(t){const i=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return i&&i[1]||""}function $w(t,i){t=t||10;const e=new Array(t),n=new Array(t);let r=0,s=0,a;return i=i!==void 0?i:1e3,function(l){const u=Date.now(),c=n[s];a||(a=u),e[r]=l,n[r]=u;let h=s,f=0;for(;h!==r;)f+=e[h++],h=h%t;if(r=(r+1)%t,r===s&&(s=(s+1)%t),u-a{const s=r.loaded,a=r.lengthComputable?r.total:void 0,o=s-e,l=n(o),u=s<=a;e=s;const c={loaded:s,total:a,progress:a?s/a:void 0,bytes:o,rate:l||void 0,estimated:l&&a&&u?(a-s)/l:void 0,event:r};c[i?"download":"upload"]=!0,t(c)}}const Ya={http:Iw,xhr:typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(e,n){let r=t.data;const s=pi.from(t.headers).normalize();let{responseType:a,withXSRFToken:o}=t,l;function u(){t.cancelToken&&t.cancelToken.unsubscribe(l),t.signal&&t.signal.removeEventListener("abort",l)}let c;if(Z.isFormData(r)){if($t.hasStandardBrowserEnv||$t.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((c=s.getContentType())!==!1){const[b,...T]=c?c.split(";").map(y=>y.trim()).filter(Boolean):[];s.setContentType([b||"multipart/form-data",...T].join("; "))}}let h=new XMLHttpRequest;if(t.auth){const b=t.auth.username||"",T=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(b+":"+T))}const f=uf(t.baseURL,t.url);h.open(t.method.toUpperCase(),tf(f,t.params,t.paramsSerializer),!0),h.timeout=t.timeout;function p(){if(!h)return;const b=pi.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),y={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:b,config:t,request:h};Kw(function(S){e(S),u()},function(S){n(S),u()},y),h=null}if("onloadend"in h?h.onloadend=p:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(p)},h.onabort=function(){h&&(n(new Le("Request aborted",Le.ECONNABORTED,t,h)),h=null)},h.onerror=function(){n(new Le("Network Error",Le.ERR_NETWORK,t,h)),h=null},h.ontimeout=function(){let T=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const y=t.transitional||rf;t.timeoutErrorMessage&&(T=t.timeoutErrorMessage),n(new Le(T,y.clarifyTimeoutError?Le.ETIMEDOUT:Le.ECONNABORTED,t,h)),h=null},$t.hasStandardBrowserEnv&&(o&&Z.isFunction(o)&&(o=o(t)),o||o!==!1&&Jw(f))){const b=t.xsrfHeaderName&&t.xsrfCookieName&&Zw.read(t.xsrfCookieName);b&&s.set(t.xsrfHeaderName,b)}r===void 0&&s.setContentType(null),"setRequestHeader"in h&&Z.forEach(s.toJSON(),function(T,y){h.setRequestHeader(y,T)}),Z.isUndefined(t.withCredentials)||(h.withCredentials=!!t.withCredentials),a&&a!=="json"&&(h.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&h.addEventListener("progress",cf(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&h.upload&&h.upload.addEventListener("progress",cf(t.onUploadProgress)),(t.cancelToken||t.signal)&&(l=b=>{h&&(n(!b||b.type?new vr(null,t,h):b),h.abort(),h=null)},t.cancelToken&&t.cancelToken.subscribe(l),t.signal&&(t.signal.aborted?l():t.signal.addEventListener("abort",l)));const m=Qw(f);if(m&&$t.protocols.indexOf(m)===-1){n(new Le("Unsupported protocol "+m+":",Le.ERR_BAD_REQUEST,t));return}h.send(r||null)})}};Z.forEach(Ya,(t,i)=>{if(t){try{Object.defineProperty(t,"name",{value:i})}catch{}Object.defineProperty(t,"adapterName",{value:i})}});const hf=t=>`- ${t}`,e_=t=>Z.isFunction(t)||t===null||t===!1,ff={getAdapter:t=>{t=Z.isArray(t)?t:[t];const{length:i}=t;let e,n;const r={};for(let s=0;s`adapter ${o} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=i?s.length>1?`since : `+s.map(hf).join(` -`):" "+hf(s[0]):"as no adapter specified";throw new Le("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return n},adapters:Ya};function Xa(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new vr(null,t)}function df(t){return Xa(t),t.headers=pi.from(t.headers),t.data=Za.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),ff.getAdapter(t.adapter||qa.adapter)(t).then(function(n){return Xa(t),n.data=Za.call(t,t.transformResponse,n),n.headers=pi.from(n.headers),n},function(n){return lf(n)||(Xa(t),n&&n.response&&(n.response.data=Za.call(t,t.transformResponse,n.response),n.response.headers=pi.from(n.response.headers))),Promise.reject(n)})}const pf=t=>t instanceof pi?t.toJSON():t;function Sn(t,i){i=i||{};const e={};function n(u,c,h){return Z.isPlainObject(u)&&Z.isPlainObject(c)?Z.merge.call({caseless:h},u,c):Z.isPlainObject(c)?Z.merge({},c):Z.isArray(c)?c.slice():c}function r(u,c,h){if(Z.isUndefined(c)){if(!Z.isUndefined(u))return n(void 0,u,h)}else return n(u,c,h)}function s(u,c){if(!Z.isUndefined(c))return n(void 0,c)}function a(u,c){if(Z.isUndefined(c)){if(!Z.isUndefined(u))return n(void 0,u)}else return n(void 0,c)}function o(u,c,h){if(h in i)return n(u,c);if(h in t)return n(void 0,u)}const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(u,c)=>r(pf(u),pf(c),!0)};return Z.forEach(Object.keys(Object.assign({},t,i)),function(c){const h=l[c]||r,f=h(t[c],i[c],c);Z.isUndefined(f)&&h!==o||(e[c]=f)}),e}const mf="1.6.5",Ja={};["object","boolean","number","function","string","symbol"].forEach((t,i)=>{Ja[t]=function(n){return typeof n===t||"a"+(i<1?"n ":" ")+t}});const gf={};Ja.transitional=function(i,e,n){function r(s,a){return"[Axios v"+mf+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return(s,a,o)=>{if(i===!1)throw new Le(r(a," has been removed"+(e?" in "+e:"")),Le.ERR_DEPRECATED);return e&&!gf[a]&&(gf[a]=!0,console.warn(r(a," has been deprecated since v"+e+" and will be removed in the near future"))),i?i(s,a,o):!0}};function t_(t,i,e){if(typeof t!="object")throw new Le("options must be an object",Le.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let r=n.length;for(;r-- >0;){const s=n[r],a=i[s];if(a){const o=t[s],l=o===void 0||a(o,s,t);if(l!==!0)throw new Le("option "+s+" must be "+l,Le.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new Le("Unknown option "+s,Le.ERR_BAD_OPTION)}}const Qa={assertOptions:t_,validators:Ja},Li=Qa.validators;class zs{constructor(i){this.defaults=i,this.interceptors={request:new nf,response:new nf}}request(i,e){typeof i=="string"?(e=e||{},e.url=i):e=i||{},e=Sn(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:s}=e;n!==void 0&&Qa.assertOptions(n,{silentJSONParsing:Li.transitional(Li.boolean),forcedJSONParsing:Li.transitional(Li.boolean),clarifyTimeoutError:Li.transitional(Li.boolean)},!1),r!=null&&(Z.isFunction(r)?e.paramsSerializer={serialize:r}:Qa.assertOptions(r,{encode:Li.function,serialize:Li.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let a=s&&Z.merge(s.common,s[e.method]);s&&Z.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]}),e.headers=pi.concat(a,s);const o=[];let l=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(e)===!1||(l=l&&b.synchronous,o.unshift(b.fulfilled,b.rejected))});const u=[];this.interceptors.response.forEach(function(b){u.push(b.fulfilled,b.rejected)});let c,h=0,f;if(!l){const m=[df.bind(this),void 0];for(m.unshift.apply(m,o),m.push.apply(m,u),f=m.length,c=Promise.resolve(e);h{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](r);n._listeners=null}),this.promise.then=r=>{let s;const a=new Promise(o=>{n.subscribe(o),s=o}).then(r);return a.cancel=function(){n.unsubscribe(s)},a},i(function(s,a,o){n.reason||(n.reason=new vr(s,a,o),e(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(i){if(this.reason){i(this.reason);return}this._listeners?this._listeners.push(i):this._listeners=[i]}unsubscribe(i){if(!this._listeners)return;const e=this._listeners.indexOf(i);e!==-1&&this._listeners.splice(e,1)}static source(){let i;return{token:new $a(function(r){i=r}),cancel:i}}}const i_=$a;function n_(t){return function(e){return t.apply(null,e)}}function r_(t){return Z.isObject(t)&&t.isAxiosError===!0}const el={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(el).forEach(([t,i])=>{el[i]=t});const s_=el;function vf(t){const i=new Hs(t),e=Hh(Hs.prototype.request,i);return Z.extend(e,Hs.prototype,i,{allOwnKeys:!0}),Z.extend(e,i,null,{allOwnKeys:!0}),e.create=function(r){return vf(Sn(t,r))},e}const Je=vf(qa);Je.Axios=Hs,Je.CanceledError=vr,Je.CancelToken=i_,Je.isCancel=lf,Je.VERSION=mf,Je.toFormData=Ns,Je.AxiosError=Le,Je.Cancel=Je.CanceledError,Je.all=function(i){return Promise.all(i)},Je.spread=n_,Je.isAxiosError=r_,Je.mergeConfig=Sn,Je.AxiosHeaders=pi,Je.formToJSON=t=>of(Z.isHTMLForm(t)?new FormData(t):t),Je.getAdapter=ff.getAdapter,Je.HttpStatusCode=s_,Je.default=Je;var o_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yf(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Pt(t){this.queue=[],this.timeslotRequests=0,this.interceptors={request:null,response:null},this.handleRequest=this.handleRequest.bind(this),this.handleResponse=this.handleResponse.bind(this),this.enable(t)}Pt.prototype.getMaxRPS=function(){var t=this.perMilliseconds/1e3;return this.maxRequests/t},Pt.prototype.setMaxRPS=function(t){this.setRateLimitOptions({maxRequests:t,perMilliseconds:1e3})},Pt.prototype.setRateLimitOptions=function(t){t.maxRPS?this.setMaxRPS(t.maxRPS):(this.perMilliseconds=t.perMilliseconds,this.maxRequests=t.maxRequests)},Pt.prototype.enable=function(t){function i(e){return Promise.reject(e)}this.interceptors.request=t.interceptors.request.use(this.handleRequest,i),this.interceptors.response=t.interceptors.response.use(this.handleResponse,i)},Pt.prototype.handleRequest=function(t){return new Promise((function(i){this.push({resolve:function(){i(t)}})}).bind(this))},Pt.prototype.handleResponse=function(t){return this.shift(),t},Pt.prototype.push=function(t){this.queue.push(t),this.shiftInitial()},Pt.prototype.shiftInitial=function(){setTimeout((function(){return this.shift()}).bind(this),0)},Pt.prototype.shift=function(){if(this.queue.length){if(this.timeslotRequests===this.maxRequests){this.timeoutId&&typeof this.timeoutId.ref=="function"&&this.timeoutId.ref();return}var t=this.queue.shift();t.resolve(),this.timeslotRequests===0&&(this.timeoutId=setTimeout((function(){this.timeslotRequests=0,this.shift()}).bind(this),this.perMilliseconds),typeof this.timeoutId.unref=="function"&&this.queue.length===0&&this.timeoutId.unref()),this.timeslotRequests+=1}};function a_(t,i){var e=new Pt(t);return e.setRateLimitOptions(i),t.getMaxRPS=Pt.prototype.getMaxRPS.bind(e),t.setMaxRPS=Pt.prototype.setMaxRPS.bind(e),t.setRateLimitOptions=Pt.prototype.setRateLimitOptions.bind(e),t}var l_=a_;const bf=yf(l_)(Je.create({baseURL:"/api/3/action/",timeout:2e4,headers:{"Content-Type":"application/json"}}),{maxRPS:5});async function tl(t,i){return bf.post(t,i).then(e=>e.data)}async function il(t,i={}){return bf.get(t,{params:i}).then(e=>e.data)}class Bs extends Be{static fields(){return{id:this.uid(),name:this.string(""),titleField:this.string("_id"),subtitleField:this.string("family"),imgField:this.string("associatedMedia"),dwc:this.boolean(!1),packageId:this.string(""),packageName:this.string(""),data:this.attr({}),records:this.hasMany(yr,"resourceId")}}}io(Bs,"entity","resources");class yr extends Be{static fields(){return{id:this.uid(),ix:this.number(0),data:this.attr({}),manifest:this.string(""),images:this.hasMany(nl,"recordId"),resourceId:this.string(""),resource:this.belongsTo(Bs,"resourceId")}}get title(){try{return this.data[this.resource.titleField]}catch{return this.id}}get subtitle(){try{return this.data[this.resource.subtitleField]}catch{return null}}get url(){if(this.data._id)return`/record/${this.resourceId}/${this.data._id}`}get imageViewerUrl(){if(this.data._id)return`/image-viewer/record/${this.resourceId}/${this.data._id}`}get displayData(){let i=[],e=this.resource?this.resource.imgField:"associatedMedia";return rl(this.data,i,[e]),i}get dataSummary(){let i=[];return this.resource!=null&&this.resource.id==="bb909597-dedf-427d-8c04-4c02b3a24db3"?i=["currentScientificName","type","phylum","class","order","family","kindOfMaterial"]:this.resource!=null&&this.resource.format==="dwc"?i=["scientificName","typeStatus","phylum","class","order","family","country","catalogNumber","preservative","collectionCode"]:i=Object.keys(this.data).filter(e=>e!=="id"&&e!=="_id"),this.resource!=null&&(i=i.filter(e=>e!==this.resource.titleField&&e!==this.resource.subtitleField&&e!==this.resource.imgField)),i.slice(0,10).map(e=>({key:e,value:this.data[e]}))}}io(yr,"entity","records");let nl=(Tl=class extends Be{static fields(){return{id:this.uid(),ix:this.number(0),url:this.string(""),data:this.attr({}),iiifData:this.attr({}),recordId:this.attr(null),record:this.belongsTo(yr,"recordId")}}get name(){let i=this.url.split("/");return i[i.length-1]}get thumbnail(){return`${this.url}/full/200,/0/default.jpg`}get info(){return`${this.url}/info.json`}get imageViewerUrl(){if(this.record&&this.record.imageViewerUrl)return`${this.record.imageViewerUrl}/${this.ix}`}get displayData(){let i=[];return rl({...this.data,maxHeight:this.iiifData.maxHeight,maxWidth:this.iiifData.maxWidth,rights:this.iiifData.rights},i),i}},io(Tl,"entity","images"),Tl);function rl(t,i,e=[],n=[]){return Object.entries(t).filter(r=>r[0]!=="id"&&r[0]!=="_id"&&!e.includes(r[0])).sort((r,s)=>r[0].localeCompare(s[0])).forEach(r=>{r[1]!=null&&typeof r[1]=="object"?rl(r[1],i,e,[...n,r[0]]):i.push({key:n?[...n,r[0]].join("."):r[0],value:r[1]})})}function u_(t){return{all:t=t||new Map,on:function(i,e){var n=t.get(i);n?n.push(e):t.set(i,[e])},off:function(i,e){var n=t.get(i);n&&(e?n.splice(n.indexOf(e)>>>0,1):t.set(i,[]))},emit:function(i,e){var n=t.get(i);n&&n.slice().map(function(r){r(e)}),(n=t.get("*"))&&n.slice().map(function(r){r(i,e)})}}}const br={recordsRetrieved:"RECORDS_RETRIEVED",querySet:"QUERY_SET"},Fi=u_();Fi.once=function(t,i){const e=(...n)=>{Fi.off(t,e),i(n)};Fi.on(t,e),i._=e};function c_(t,i=0){let e=3735928559^i,n=1103547991^i;for(let r=0,s;r>>16,2246822507),e^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(e^e>>>13,3266489909),4294967296*(2097151&n)+(e>>>0)}const zi=Yo("liv",()=>{const t=Y(()=>Yi(Bs)),i=Y(()=>Yi(yr)),e=Y(()=>Yi(nl)),n=100,r=10,s=$({}),a=$({}),o=Y(()=>t.value.where(ne=>s.value.resource_ids.includes(ne.id)).get()),l=Y(()=>c_(JSON.stringify(s.value))),u=$(null),c=$(null),h=$(null),f=$(!1),p=$(!1),m=Y(()=>c.value!=null&&!f.value),b=$(0),T=$(0),y=Y(()=>b.value.5),w=$(null),S=Y(()=>w.value==null?null:i.value.withAllRecursive().find(w.value.recordId)),C=$(0),L=Y(()=>e.value.withAllRecursive(2).get()),D=Y(()=>i.value.withAll().get()),j=$({attempted:!1,loading:!1,error:!1,errorMsg:null}),N=$(!1);async function K(ne){let U=[],re=[];function ce(Q){Q.imgField&&!U.includes(Q.imgField)&&U.push(Q.imgField)}return ne.resource_ids==null||ne.resource_ids.length===0?re.push(Ee().then(()=>t.value.all().forEach(ce))):re=ne.resource_ids.map(Q=>il("resource_show",{id:Q}).then(_e=>{let He=Re(_e.result);He&&ce(He)})),Promise.allSettled(re).then(()=>{const Q={exists:{fields:U}};if(ne.query||(ne.query={}),!ne.query.filters)ne.query.filters={and:[Q]};else if(Object.keys(ne.query.filters)[0]!=="and"){const _e={...ne.query.filters};ne.query.filters={and:[Q,_e]}}else{let _e=JSON.stringify(Q);ne.query.filters.and.map(He=>JSON.stringify(He)).some(He=>He===_e)||ne.query.filters.and.push(Q)}return ne})}async function*se(){for(;;){const ne=await tl("datastore_multisearch",u.value);if(C.value=ne.result.total,yield*ne.result.records,ne.result.after)u.value.after=ne.result.after;else break}}async function ue(ne=1){j.value.loading=!0,j.value.attempted=!0,p.value=!0;const U=l.value.toString();return new Promise(async(re,ce)=>{c.value==null&&(c.value=se());let Q=[],_e=r*ne,He=0;for(;!f.value&&(!_e||He<_e);)Q.push(c.value.next().then(Ve=>(Ve.done&&(f.value=!0),Se(Ve.value,U))).catch(Ve=>{j.value.error=!0,j.value.errorMsg=Ve})),He++;Promise.allSettled(Q).then(()=>{p.value=!1,Q.length>0&&Fi.emit(br.recordsRetrieved,{}),j.value.loading=!1,re()})})}function Se(ne,U){const re=ne.iiif?ne.iiif.items:[];if(re.length===0)return console.error("No IIIF data."),console.log(ne),new Promise(Ve=>Ve());const ce=t.value.find(ne.resource),Q=`${ne.resource}_${ne.data._id}`,_e={id:Q,data:Ie(ne.data),manifest:ne.iiif.id,resourceId:ne.resource,images:[]},He=re.map((Ve,Ae)=>{b.value++;const Te=Ve.items[0].items[0].body.id,W=Te+"/info.json";return il(W).then(oe=>new Promise(ae=>{let he={};ce&&ce.dwc&&(he=ne.data.associatedMedia.filter(Ce=>Ce.identifier===Te)[0]),Object.entries(a.value).every(Ce=>{if(Ce[0]==="ix")return Ae.toString()===Ce[1];try{let P=Ce[0].split("."),O=he;for(const d in P)O=O[P[d]];return Ce[1].includes(O)}catch{return!1}})&&_e.images.push({id:Te,ix:Ae,url:Te,recordId:Q,iiifData:oe,data:he}),ae()})).catch(()=>{T.value++})});return Promise.allSettled(He).then(()=>{l.value.toString()===U&&i.value.save(_e)})}function Re(ne,U){if(!ne._image_field)return;const re=ne._title_field,ce=ne._subtitle_field,Q=ne._image_field;let _e={id:ne.id,name:ne.name,titleField:re,subtitleField:ce,imgField:Q,dwc:ne.format.toLowerCase()==="dwc",data:ne,packageId:ne.package_id};return U&&(_e.packageName=U),t.value.save(_e)}function Ee(){return il("current_package_list_with_resources",{limit:1e4}).then(ne=>{ne.result.forEach(U=>{U.resources.forEach(re=>Re(re,U.title))})})}function Me(ne){w.value=ne,N.value=!0}function ge(ne,U=null){U?a.value=U:a.value={},s.value=ne,j.value={attempted:!1,loading:!1,error:!1,errorMsg:null},b.value=0,T.value=0,p.value=!1,h.value=null,f.value=!1,c.value=null,u.value=null,C.value=0,i.value.flush(),e.value.flush(),K(s.value).then(re=>(u.value={...re,size:n},Fi.emit(br.querySet,s.value),ue(4)))}return{allImages:L,allRecords:D,changeImage:Me,currentImage:w,currentRecord:S,currentResources:o,disableAutoLoad:y,getAllResources:Ee,getRecords:ue,imageQuery:a,imageRepo:e,more:m,pending:p,query:s,queryHash:l,recordRepo:i,resourceRepo:t,setQuery:ge,showOverlay:N,state:j,totalRecords:C}});/*! +`):" "+hf(s[0]):"as no adapter specified";throw new Le("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return n},adapters:Ya};function Xa(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new vr(null,t)}function df(t){return Xa(t),t.headers=pi.from(t.headers),t.data=Za.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),ff.getAdapter(t.adapter||qa.adapter)(t).then(function(n){return Xa(t),n.data=Za.call(t,t.transformResponse,n),n.headers=pi.from(n.headers),n},function(n){return lf(n)||(Xa(t),n&&n.response&&(n.response.data=Za.call(t,t.transformResponse,n.response),n.response.headers=pi.from(n.response.headers))),Promise.reject(n)})}const pf=t=>t instanceof pi?t.toJSON():t;function Sn(t,i){i=i||{};const e={};function n(u,c,h){return Z.isPlainObject(u)&&Z.isPlainObject(c)?Z.merge.call({caseless:h},u,c):Z.isPlainObject(c)?Z.merge({},c):Z.isArray(c)?c.slice():c}function r(u,c,h){if(Z.isUndefined(c)){if(!Z.isUndefined(u))return n(void 0,u,h)}else return n(u,c,h)}function s(u,c){if(!Z.isUndefined(c))return n(void 0,c)}function a(u,c){if(Z.isUndefined(c)){if(!Z.isUndefined(u))return n(void 0,u)}else return n(void 0,c)}function o(u,c,h){if(h in i)return n(u,c);if(h in t)return n(void 0,u)}const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(u,c)=>r(pf(u),pf(c),!0)};return Z.forEach(Object.keys(Object.assign({},t,i)),function(c){const h=l[c]||r,f=h(t[c],i[c],c);Z.isUndefined(f)&&h!==o||(e[c]=f)}),e}const mf="1.6.5",Ja={};["object","boolean","number","function","string","symbol"].forEach((t,i)=>{Ja[t]=function(n){return typeof n===t||"a"+(i<1?"n ":" ")+t}});const gf={};Ja.transitional=function(i,e,n){function r(s,a){return"[Axios v"+mf+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return(s,a,o)=>{if(i===!1)throw new Le(r(a," has been removed"+(e?" in "+e:"")),Le.ERR_DEPRECATED);return e&&!gf[a]&&(gf[a]=!0,console.warn(r(a," has been deprecated since v"+e+" and will be removed in the near future"))),i?i(s,a,o):!0}};function t_(t,i,e){if(typeof t!="object")throw new Le("options must be an object",Le.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let r=n.length;for(;r-- >0;){const s=n[r],a=i[s];if(a){const o=t[s],l=o===void 0||a(o,s,t);if(l!==!0)throw new Le("option "+s+" must be "+l,Le.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new Le("Unknown option "+s,Le.ERR_BAD_OPTION)}}const Qa={assertOptions:t_,validators:Ja},Li=Qa.validators;class zs{constructor(i){this.defaults=i,this.interceptors={request:new nf,response:new nf}}request(i,e){typeof i=="string"?(e=e||{},e.url=i):e=i||{},e=Sn(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:s}=e;n!==void 0&&Qa.assertOptions(n,{silentJSONParsing:Li.transitional(Li.boolean),forcedJSONParsing:Li.transitional(Li.boolean),clarifyTimeoutError:Li.transitional(Li.boolean)},!1),r!=null&&(Z.isFunction(r)?e.paramsSerializer={serialize:r}:Qa.assertOptions(r,{encode:Li.function,serialize:Li.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let a=s&&Z.merge(s.common,s[e.method]);s&&Z.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]}),e.headers=pi.concat(a,s);const o=[];let l=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(e)===!1||(l=l&&b.synchronous,o.unshift(b.fulfilled,b.rejected))});const u=[];this.interceptors.response.forEach(function(b){u.push(b.fulfilled,b.rejected)});let c,h=0,f;if(!l){const m=[df.bind(this),void 0];for(m.unshift.apply(m,o),m.push.apply(m,u),f=m.length,c=Promise.resolve(e);h{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](r);n._listeners=null}),this.promise.then=r=>{let s;const a=new Promise(o=>{n.subscribe(o),s=o}).then(r);return a.cancel=function(){n.unsubscribe(s)},a},i(function(s,a,o){n.reason||(n.reason=new vr(s,a,o),e(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(i){if(this.reason){i(this.reason);return}this._listeners?this._listeners.push(i):this._listeners=[i]}unsubscribe(i){if(!this._listeners)return;const e=this._listeners.indexOf(i);e!==-1&&this._listeners.splice(e,1)}static source(){let i;return{token:new $a(function(r){i=r}),cancel:i}}}const i_=$a;function n_(t){return function(e){return t.apply(null,e)}}function r_(t){return Z.isObject(t)&&t.isAxiosError===!0}const el={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(el).forEach(([t,i])=>{el[i]=t});const s_=el;function vf(t){const i=new Hs(t),e=Hh(Hs.prototype.request,i);return Z.extend(e,Hs.prototype,i,{allOwnKeys:!0}),Z.extend(e,i,null,{allOwnKeys:!0}),e.create=function(r){return vf(Sn(t,r))},e}const Je=vf(qa);Je.Axios=Hs,Je.CanceledError=vr,Je.CancelToken=i_,Je.isCancel=lf,Je.VERSION=mf,Je.toFormData=Ns,Je.AxiosError=Le,Je.Cancel=Je.CanceledError,Je.all=function(i){return Promise.all(i)},Je.spread=n_,Je.isAxiosError=r_,Je.mergeConfig=Sn,Je.AxiosHeaders=pi,Je.formToJSON=t=>of(Z.isHTMLForm(t)?new FormData(t):t),Je.getAdapter=ff.getAdapter,Je.HttpStatusCode=s_,Je.default=Je;var o_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yf(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Pt(t){this.queue=[],this.timeslotRequests=0,this.interceptors={request:null,response:null},this.handleRequest=this.handleRequest.bind(this),this.handleResponse=this.handleResponse.bind(this),this.enable(t)}Pt.prototype.getMaxRPS=function(){var t=this.perMilliseconds/1e3;return this.maxRequests/t},Pt.prototype.setMaxRPS=function(t){this.setRateLimitOptions({maxRequests:t,perMilliseconds:1e3})},Pt.prototype.setRateLimitOptions=function(t){t.maxRPS?this.setMaxRPS(t.maxRPS):(this.perMilliseconds=t.perMilliseconds,this.maxRequests=t.maxRequests)},Pt.prototype.enable=function(t){function i(e){return Promise.reject(e)}this.interceptors.request=t.interceptors.request.use(this.handleRequest,i),this.interceptors.response=t.interceptors.response.use(this.handleResponse,i)},Pt.prototype.handleRequest=function(t){return new Promise((function(i){this.push({resolve:function(){i(t)}})}).bind(this))},Pt.prototype.handleResponse=function(t){return this.shift(),t},Pt.prototype.push=function(t){this.queue.push(t),this.shiftInitial()},Pt.prototype.shiftInitial=function(){setTimeout((function(){return this.shift()}).bind(this),0)},Pt.prototype.shift=function(){if(this.queue.length){if(this.timeslotRequests===this.maxRequests){this.timeoutId&&typeof this.timeoutId.ref=="function"&&this.timeoutId.ref();return}var t=this.queue.shift();t.resolve(),this.timeslotRequests===0&&(this.timeoutId=setTimeout((function(){this.timeslotRequests=0,this.shift()}).bind(this),this.perMilliseconds),typeof this.timeoutId.unref=="function"&&this.queue.length===0&&this.timeoutId.unref()),this.timeslotRequests+=1}};function a_(t,i){var e=new Pt(t);return e.setRateLimitOptions(i),t.getMaxRPS=Pt.prototype.getMaxRPS.bind(e),t.setMaxRPS=Pt.prototype.setMaxRPS.bind(e),t.setRateLimitOptions=Pt.prototype.setRateLimitOptions.bind(e),t}var l_=a_;const bf=yf(l_)(Je.create({baseURL:"/api/3/action/",timeout:2e4,headers:{"Content-Type":"application/json"}}),{maxRPS:5});async function tl(t,i){return bf.post(t,i).then(e=>e.data)}async function il(t,i={}){return bf.get(t,{params:i}).then(e=>e.data)}class Bs extends Be{static fields(){return{id:this.uid(),name:this.string(""),titleField:this.string("_id"),subtitleField:this.string("family"),imgField:this.string("associatedMedia"),dwc:this.boolean(!1),packageId:this.string(""),packageName:this.string(""),data:this.attr({}),records:this.hasMany(yr,"resourceId")}}}io(Bs,"entity","resources");class yr extends Be{static fields(){return{id:this.uid(),ix:this.number(0),data:this.attr({}),manifest:this.string(""),images:this.hasMany(nl,"recordId"),resourceId:this.string(""),resource:this.belongsTo(Bs,"resourceId")}}get title(){try{return this.data[this.resource.titleField]}catch{return this.id}}get subtitle(){try{return this.data[this.resource.subtitleField]}catch{return null}}get url(){if(this.data._id)return`/record/${this.resourceId}/${this.data._id}`}get imageViewerUrl(){if(this.data._id)return`/image-viewer/record/${this.resourceId}/${this.data._id}`}get displayData(){let i=[],e=this.resource?this.resource.imgField:"associatedMedia";return rl(this.data,i,[e]),i}get dataSummary(){let i=[];return this.resource!=null&&this.resource.id==="bb909597-dedf-427d-8c04-4c02b3a24db3"?i=["currentScientificName","type","phylum","class","order","family","kindOfMaterial"]:this.resource!=null&&this.resource.format==="dwc"?i=["scientificName","typeStatus","phylum","class","order","family","country","catalogNumber","preservative","collectionCode"]:i=Object.keys(this.data).filter(e=>e!=="id"&&e!=="_id"),this.resource!=null&&(i=i.filter(e=>e!==this.resource.titleField&&e!==this.resource.subtitleField&&e!==this.resource.imgField)),i.slice(0,10).map(e=>({key:e,value:this.data[e]}))}}io(yr,"entity","records");let nl=(Tl=class extends Be{static fields(){return{id:this.uid(),ix:this.number(0),url:this.string(""),data:this.attr({}),iiifData:this.attr({}),recordId:this.attr(null),record:this.belongsTo(yr,"recordId")}}get name(){let i=this.url.split("/");return i[i.length-1]}get thumbnail(){return`${this.url}/full/200,/0/default.jpg`}get info(){return`${this.url}/info.json`}get imageViewerUrl(){if(this.record&&this.record.imageViewerUrl)return`${this.record.imageViewerUrl}/${this.ix}`}get displayData(){let i=[];return rl({...this.data,maxHeight:this.iiifData.maxHeight,maxWidth:this.iiifData.maxWidth,rights:this.iiifData.rights},i),i}},io(Tl,"entity","images"),Tl);function rl(t,i,e=[],n=[]){return Object.entries(t).filter(r=>r[0]!=="id"&&r[0]!=="_id"&&!e.includes(r[0])).sort((r,s)=>r[0].localeCompare(s[0])).forEach(r=>{r[1]!=null&&typeof r[1]=="object"?rl(r[1],i,e,[...n,r[0]]):i.push({key:n?[...n,r[0]].join("."):r[0],value:r[1]})})}function u_(t){return{all:t=t||new Map,on:function(i,e){var n=t.get(i);n?n.push(e):t.set(i,[e])},off:function(i,e){var n=t.get(i);n&&(e?n.splice(n.indexOf(e)>>>0,1):t.set(i,[]))},emit:function(i,e){var n=t.get(i);n&&n.slice().map(function(r){r(e)}),(n=t.get("*"))&&n.slice().map(function(r){r(i,e)})}}}const br={recordsRetrieved:"RECORDS_RETRIEVED",querySet:"QUERY_SET"},Fi=u_();Fi.once=function(t,i){const e=(...n)=>{Fi.off(t,e),i(n)};Fi.on(t,e),i._=e};function c_(t,i=0){let e=3735928559^i,n=1103547991^i;for(let r=0,s;r>>16,2246822507),e^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(e^e>>>13,3266489909),4294967296*(2097151&n)+(e>>>0)}const zi=Yo("liv",()=>{const t=Y(()=>Yi(Bs)),i=Y(()=>Yi(yr)),e=Y(()=>Yi(nl)),n=100,r=10,s=$({}),a=$({}),o=Y(()=>t.value.where(ne=>s.value.resource_ids.includes(ne.id)).get()),l=Y(()=>c_(JSON.stringify(s.value))),u=$(null),c=$(null),h=$(null),f=$(!1),p=$(!1),m=Y(()=>c.value!=null&&!f.value),b=$(0),T=$(0),y=Y(()=>b.value.5),w=$(null),S=Y(()=>w.value==null?null:i.value.withAllRecursive().find(w.value.recordId)),C=$(0),L=Y(()=>e.value.withAllRecursive(2).get()),D=Y(()=>i.value.withAll().get()),j=$({attempted:!1,loading:!1,error:!1,errorMsg:null}),N=$(!1);async function K(ne){let U=[],re=[];function ce(Q){Q.imgField&&!U.includes(Q.imgField)&&U.push(Q.imgField)}return ne.resource_ids==null||ne.resource_ids.length===0?re.push(Ee().then(()=>t.value.all().forEach(ce))):re=ne.resource_ids.map(Q=>il("resource_show",{id:Q}).then(_e=>{let He=Re(_e.result);He&&ce(He)})),Promise.allSettled(re).then(()=>{const Q={exists:{fields:U}};if(ne.query||(ne.query={}),!ne.query.filters)ne.query.filters={and:[Q]};else if(Object.keys(ne.query.filters)[0]!=="and"){const _e={...ne.query.filters};ne.query.filters={and:[Q,_e]}}else{let _e=JSON.stringify(Q);ne.query.filters.and.map(He=>JSON.stringify(He)).some(He=>He===_e)||ne.query.filters.and.push(Q)}return ne})}async function*se(){for(;;){const ne=await tl("datastore_multisearch",u.value);if(C.value=ne.result.total,yield*ne.result.records,ne.result.after)u.value.after=ne.result.after;else break}}async function ue(ne=1){j.value.loading=!0,j.value.attempted=!0,p.value=!0;const U=l.value.toString();return new Promise(async(re,ce)=>{c.value==null&&(c.value=se());let Q=[],_e=r*ne,He=0;for(;!f.value&&(!_e||He<_e);)Q.push(c.value.next().then(Ve=>(Ve.done&&(f.value=!0),Se(Ve.value,U))).catch(Ve=>{j.value.error=!0,j.value.errorMsg=Ve})),He++;Promise.allSettled(Q).then(()=>{p.value=!1,Q.length>0&&Fi.emit(br.recordsRetrieved,{}),j.value.loading=!1,re()})})}function Se(ne,U){const re=ne.iiif?ne.iiif.items:[];if(re.length===0)return console.error("No IIIF data."),console.log(ne),new Promise(Ve=>Ve());const ce=t.value.find(ne.resource),Q=`${ne.resource}_${ne.data._id}`,_e={id:Q,data:Ae(ne.data),manifest:ne.iiif.id,resourceId:ne.resource,images:[]},He=re.map((Ve,Ie)=>{b.value++;const xe=Ve.items[0].items[0].body.id,W=xe+"/info.json";return il(W).then(oe=>new Promise(ae=>{let he={};ce&&ce.dwc&&(he=ne.data.associatedMedia.filter(Ce=>Ce.identifier===xe)[0]),Object.entries(a.value).every(Ce=>{if(Ce[0]==="ix")return Ie.toString()===Ce[1];try{let P=Ce[0].split("."),O=he;for(const d in P)O=O[P[d]];return Ce[1].includes(O)}catch{return!1}})&&_e.images.push({id:`${ne.resource}/${Q}/${Ie}`,ix:Ie,url:xe,recordId:Q,iiifData:oe,data:he}),ae()})).catch(()=>{T.value++})});return Promise.allSettled(He).then(()=>{l.value.toString()===U&&i.value.save(_e)})}function Re(ne,U){if(!ne._image_field)return;const re=ne._title_field,ce=ne._subtitle_field,Q=ne._image_field;let _e={id:ne.id,name:ne.name,titleField:re,subtitleField:ce,imgField:Q,dwc:ne.format.toLowerCase()==="dwc",data:ne,packageId:ne.package_id};return U&&(_e.packageName=U),t.value.save(_e)}function Ee(){return il("current_package_list_with_resources",{limit:1e4}).then(ne=>{ne.result.forEach(U=>{U.resources.forEach(re=>Re(re,U.title))})})}function Me(ne){w.value=ne,N.value=!0}function ge(ne,U=null){U?a.value=U:a.value={},s.value=ne,j.value={attempted:!1,loading:!1,error:!1,errorMsg:null},b.value=0,T.value=0,p.value=!1,h.value=null,f.value=!1,c.value=null,u.value=null,C.value=0,i.value.flush(),e.value.flush(),K(s.value).then(re=>(u.value={...re,size:n},Fi.emit(br.querySet,s.value),ue(4)))}return{allImages:L,allRecords:D,changeImage:Me,currentImage:w,currentRecord:S,currentResources:o,disableAutoLoad:y,getAllResources:Ee,getRecords:ue,imageQuery:a,imageRepo:e,more:m,pending:p,query:s,queryHash:l,recordRepo:i,resourceRepo:t,setQuery:ge,showOverlay:N,state:j,totalRecords:C}});/*! * vue-router v4.2.5 * (c) 2023 Eduardo San Martin Morote * @license MIT - */const En=typeof window<"u";function h_(t){return t.__esModule||t[Symbol.toStringTag]==="Module"}const Ue=Object.assign;function sl(t,i){const e={};for(const n in i){const r=i[n];e[n]=Ut(r)?r.map(t):t(r)}return e}const wr=()=>{},Ut=Array.isArray,f_=/\/$/,d_=t=>t.replace(f_,"");function ol(t,i,e="/"){let n,r={},s="",a="";const o=i.indexOf("#");let l=i.indexOf("?");return o=0&&(l=-1),l>-1&&(n=i.slice(0,l),s=i.slice(l+1,o>-1?o:i.length),r=t(s)),o>-1&&(n=n||i.slice(0,o),a=i.slice(o,i.length)),n=v_(n??i,e),{fullPath:n+(s&&"?")+s+a,path:n,query:r,hash:a}}function p_(t,i){const e=i.query?t(i.query):"";return i.path+(e&&"?")+e+(i.hash||"")}function wf(t,i){return!i||!t.toLowerCase().startsWith(i.toLowerCase())?t:t.slice(i.length)||"/"}function m_(t,i,e){const n=i.matched.length-1,r=e.matched.length-1;return n>-1&&n===r&&Pn(i.matched[n],e.matched[r])&&_f(i.params,e.params)&&t(i.query)===t(e.query)&&i.hash===e.hash}function Pn(t,i){return(t.aliasOf||t)===(i.aliasOf||i)}function _f(t,i){if(Object.keys(t).length!==Object.keys(i).length)return!1;for(const e in t)if(!g_(t[e],i[e]))return!1;return!0}function g_(t,i){return Ut(t)?Tf(t,i):Ut(i)?Tf(i,t):t===i}function Tf(t,i){return Ut(i)?t.length===i.length&&t.every((e,n)=>e===i[n]):t.length===1&&t[0]===i}function v_(t,i){if(t.startsWith("/"))return t;if(!t)return i;const e=i.split("/"),n=t.split("/"),r=n[n.length-1];(r===".."||r===".")&&n.push("");let s=e.length-1,a,o;for(a=0;a1&&s--;else break;return e.slice(0,s).join("/")+"/"+n.slice(a-(a===n.length?1:0)).join("/")}var _r;(function(t){t.pop="pop",t.push="push"})(_r||(_r={}));var Tr;(function(t){t.back="back",t.forward="forward",t.unknown=""})(Tr||(Tr={}));function y_(t){if(!t)if(En){const i=document.querySelector("base");t=i&&i.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),d_(t)}const b_=/^[^#]+#/;function w_(t,i){return t.replace(b_,"#")+i}function __(t,i){const e=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:i.behavior,left:n.left-e.left-(i.left||0),top:n.top-e.top-(i.top||0)}}const Us=()=>({left:window.pageXOffset,top:window.pageYOffset});function T_(t){let i;if("el"in t){const e=t.el,n=typeof e=="string"&&e.startsWith("#"),r=typeof e=="string"?n?document.getElementById(e.slice(1)):document.querySelector(e):e;if(!r)return;i=__(r,t)}else i=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(i):window.scrollTo(i.left!=null?i.left:window.pageXOffset,i.top!=null?i.top:window.pageYOffset)}function xf(t,i){return(history.state?history.state.position-i:-1)+t}const al=new Map;function x_(t,i){al.set(t,i)}function S_(t){const i=al.get(t);return al.delete(t),i}let E_=()=>location.protocol+"//"+location.host;function Sf(t,i){const{pathname:e,search:n,hash:r}=i,s=t.indexOf("#");if(s>-1){let o=r.includes(t.slice(s))?t.slice(s).length:1,l=r.slice(o);return l[0]!=="/"&&(l="/"+l),wf(l,"")}return wf(e,t)+n+r}function P_(t,i,e,n){let r=[],s=[],a=null;const o=({state:f})=>{const p=Sf(t,location),m=e.value,b=i.value;let T=0;if(f){if(e.value=p,i.value=f,a&&a===m){a=null;return}T=b?f.position-b.position:0}else n(p);r.forEach(y=>{y(e.value,m,{delta:T,type:_r.pop,direction:T?T>0?Tr.forward:Tr.back:Tr.unknown})})};function l(){a=e.value}function u(f){r.push(f);const p=()=>{const m=r.indexOf(f);m>-1&&r.splice(m,1)};return s.push(p),p}function c(){const{history:f}=window;f.state&&f.replaceState(Ue({},f.state,{scroll:Us()}),"")}function h(){for(const f of s)f();s=[],window.removeEventListener("popstate",o),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",o),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:l,listen:u,destroy:h}}function Ef(t,i,e,n=!1,r=!1){return{back:t,current:i,forward:e,replaced:n,position:window.history.length,scroll:r?Us():null}}function R_(t){const{history:i,location:e}=window,n={value:Sf(t,e)},r={value:i.state};r.value||s(n.value,{back:null,current:n.value,forward:null,position:i.length-1,replaced:!0,scroll:null},!0);function s(l,u,c){const h=t.indexOf("#"),f=h>-1?(e.host&&document.querySelector("base")?t:t.slice(h))+l:E_()+t+l;try{i[c?"replaceState":"pushState"](u,"",f),r.value=u}catch(p){console.error(p),e[c?"replace":"assign"](f)}}function a(l,u){const c=Ue({},i.state,Ef(r.value.back,l,r.value.forward,!0),u,{position:r.value.position});s(l,c,!0),n.value=l}function o(l,u){const c=Ue({},r.value,i.state,{forward:l,scroll:Us()});s(c.current,c,!0);const h=Ue({},Ef(n.value,l,null),{position:c.position+1},u);s(l,h,!1),n.value=l}return{location:n,state:r,push:o,replace:a}}function C_(t){t=y_(t);const i=R_(t),e=P_(t,i.state,i.location,i.replace);function n(s,a=!0){a||e.pauseListeners(),history.go(s)}const r=Ue({location:"",base:t,go:n,createHref:w_.bind(null,t)},i,e);return Object.defineProperty(r,"location",{enumerable:!0,get:()=>i.location.value}),Object.defineProperty(r,"state",{enumerable:!0,get:()=>i.state.value}),r}function O_(t){return typeof t=="string"||t&&typeof t=="object"}function Pf(t){return typeof t=="string"||typeof t=="symbol"}const Hi={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},Rf=Symbol("");var Cf;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(Cf||(Cf={}));function Rn(t,i){return Ue(new Error,{type:t,[Rf]:!0},i)}function mi(t,i){return t instanceof Error&&Rf in t&&(i==null||!!(t.type&i))}const Of="[^/]+?",I_={sensitive:!1,strict:!1,start:!0,end:!0},A_=/[.+*?^${}()[\]/\\]/g;function k_(t,i){const e=Ue({},I_,i),n=[];let r=e.start?"^":"";const s=[];for(const u of t){const c=u.length?[]:[90];e.strict&&!u.length&&(r+="/");for(let h=0;hi.length?i.length===1&&i[0]===80?1:-1:0}function M_(t,i){let e=0;const n=t.score,r=i.score;for(;e0&&i[i.length-1]<0}const N_={type:0,value:""},L_=/[a-zA-Z0-9_]/;function F_(t){if(!t)return[[]];if(t==="/")return[[N_]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function i(p){throw new Error(`ERR (${e})/"${u}": ${p}`)}let e=0,n=e;const r=[];let s;function a(){s&&r.push(s),s=[]}let o=0,l,u="",c="";function h(){u&&(e===0?s.push({type:0,value:u}):e===1||e===2||e===3?(s.length>1&&(l==="*"||l==="+")&&i(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),s.push({type:1,value:u,regexp:c,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):i("Invalid state to consume buffer"),u="")}function f(){u+=l}for(;o{a(w)}:wr}function a(c){if(Pf(c)){const h=n.get(c);h&&(n.delete(c),e.splice(e.indexOf(h),1),h.children.forEach(a),h.alias.forEach(a))}else{const h=e.indexOf(c);h>-1&&(e.splice(h,1),c.record.name&&n.delete(c.record.name),c.children.forEach(a),c.alias.forEach(a))}}function o(){return e}function l(c){let h=0;for(;h=0&&(c.record.path!==e[h].record.path||!Mf(c,e[h]));)h++;e.splice(h,0,c),c.record.name&&!kf(c)&&n.set(c.record.name,c)}function u(c,h){let f,p={},m,b;if("name"in c&&c.name){if(f=n.get(c.name),!f)throw Rn(1,{location:c});b=f.record.name,p=Ue(Af(h.params,f.keys.filter(w=>!w.optional).map(w=>w.name)),c.params&&Af(c.params,f.keys.map(w=>w.name))),m=f.stringify(p)}else if("path"in c)m=c.path,f=e.find(w=>w.re.test(m)),f&&(p=f.parse(m),b=f.record.name);else{if(f=h.name?n.get(h.name):e.find(w=>w.re.test(h.path)),!f)throw Rn(1,{location:c,currentLocation:h});b=f.record.name,p=Ue({},h.params,c.params),m=f.stringify(p)}const T=[];let y=f;for(;y;)T.unshift(y.record),y=y.parent;return{name:b,path:m,params:p,matched:T,meta:V_(T)}}return t.forEach(c=>s(c)),{addRoute:s,resolve:u,removeRoute:a,getRoutes:o,getRecordMatcher:r}}function Af(t,i){const e={};for(const n of i)n in t&&(e[n]=t[n]);return e}function B_(t){return{path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:void 0,beforeEnter:t.beforeEnter,props:U_(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}}}function U_(t){const i={},e=t.props||!1;if("component"in t)i.default=e;else for(const n in t.components)i[n]=typeof e=="object"?e[n]:e;return i}function kf(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function V_(t){return t.reduce((i,e)=>Ue(i,e.meta),{})}function Df(t,i){const e={};for(const n in t)e[n]=n in i?i[n]:t[n];return e}function Mf(t,i){return i.children.some(e=>e===t||Mf(t,e))}const Nf=/#/g,j_=/&/g,W_=/\//g,G_=/=/g,q_=/\?/g,Lf=/\+/g,K_=/%5B/g,Z_=/%5D/g,Ff=/%5E/g,Y_=/%60/g,zf=/%7B/g,X_=/%7C/g,Hf=/%7D/g,J_=/%20/g;function ll(t){return encodeURI(""+t).replace(X_,"|").replace(K_,"[").replace(Z_,"]")}function Q_(t){return ll(t).replace(zf,"{").replace(Hf,"}").replace(Ff,"^")}function ul(t){return ll(t).replace(Lf,"%2B").replace(J_,"+").replace(Nf,"%23").replace(j_,"%26").replace(Y_,"`").replace(zf,"{").replace(Hf,"}").replace(Ff,"^")}function $_(t){return ul(t).replace(G_,"%3D")}function e0(t){return ll(t).replace(Nf,"%23").replace(q_,"%3F")}function t0(t){return t==null?"":e0(t).replace(W_,"%2F")}function Vs(t){try{return decodeURIComponent(""+t)}catch{}return""+t}function i0(t){const i={};if(t===""||t==="?")return i;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let r=0;rs&&ul(s)):[n&&ul(n)]).forEach(s=>{s!==void 0&&(i+=(i.length?"&":"")+e,s!=null&&(i+="="+s))})}return i}function n0(t){const i={};for(const e in t){const n=t[e];n!==void 0&&(i[e]=Ut(n)?n.map(r=>r==null?null:""+r):n==null?n:""+n)}return i}const r0=Symbol(""),Uf=Symbol(""),js=Symbol(""),cl=Symbol(""),hl=Symbol("");function xr(){let t=[];function i(n){return t.push(n),()=>{const r=t.indexOf(n);r>-1&&t.splice(r,1)}}function e(){t=[]}return{add:i,list:()=>t.slice(),reset:e}}function Bi(t,i,e,n,r){const s=n&&(n.enterCallbacks[r]=n.enterCallbacks[r]||[]);return()=>new Promise((a,o)=>{const l=h=>{h===!1?o(Rn(4,{from:e,to:i})):h instanceof Error?o(h):O_(h)?o(Rn(2,{from:i,to:h})):(s&&n.enterCallbacks[r]===s&&typeof h=="function"&&s.push(h),a())},u=t.call(n&&n.instances[r],i,e,l);let c=Promise.resolve(u);t.length<3&&(c=c.then(l)),c.catch(h=>o(h))})}function fl(t,i,e,n){const r=[];for(const s of t)for(const a in s.components){let o=s.components[a];if(!(i!=="beforeRouteEnter"&&!s.instances[a]))if(s0(o)){const u=(o.__vccOpts||o)[i];u&&r.push(Bi(u,e,n,s,a))}else{let l=o();r.push(()=>l.then(u=>{if(!u)return Promise.reject(new Error(`Couldn't resolve component "${a}" at "${s.path}"`));const c=h_(u)?u.default:u;s.components[a]=c;const f=(c.__vccOpts||c)[i];return f&&Bi(f,e,n,s,a)()}))}}return r}function s0(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Vf(t){const i=ye(js),e=ye(cl),n=Y(()=>i.resolve(k(t.to))),r=Y(()=>{const{matched:l}=n.value,{length:u}=l,c=l[u-1],h=e.matched;if(!c||!h.length)return-1;const f=h.findIndex(Pn.bind(null,c));if(f>-1)return f;const p=jf(l[u-2]);return u>1&&jf(c)===p&&h[h.length-1].path!==p?h.findIndex(Pn.bind(null,l[u-2])):f}),s=Y(()=>r.value>-1&&l0(e.params,n.value.params)),a=Y(()=>r.value>-1&&r.value===e.matched.length-1&&_f(e.params,n.value.params));function o(l={}){return a0(l)?i[k(t.replace)?"replace":"push"](k(t.to)).catch(wr):Promise.resolve()}return{route:n,href:Y(()=>n.value.href),isActive:s,isExactActive:a,navigate:o}}const o0=Hn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:Vf,setup(t,{slots:i}){const e=Kt(Vf(t)),{options:n}=ye(js),r=Y(()=>({[Wf(t.activeClass,n.linkActiveClass,"router-link-active")]:e.isActive,[Wf(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:e.isExactActive}));return()=>{const s=i.default&&i.default(e);return t.custom?s:ls("a",{"aria-current":e.isExactActive?t.ariaCurrentValue:null,href:e.href,onClick:e.navigate,class:r.value},s)}}});function a0(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const i=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(i))return}return t.preventDefault&&t.preventDefault(),!0}}function l0(t,i){for(const e in i){const n=i[e],r=t[e];if(typeof n=="string"){if(n!==r)return!1}else if(!Ut(r)||r.length!==n.length||n.some((s,a)=>s!==r[a]))return!1}return!0}function jf(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Wf=(t,i,e)=>t??i??e,u0=Hn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:i,slots:e}){const n=ye(hl),r=Y(()=>t.route||n.value),s=ye(Uf,0),a=Y(()=>{let u=k(s);const{matched:c}=r.value;let h;for(;(h=c[u])&&!h.components;)u++;return u}),o=Y(()=>r.value.matched[a.value]);St(Uf,Y(()=>a.value+1)),St(r0,o),St(hl,r);const l=$();return $e(()=>[l.value,o.value,t.name],([u,c,h],[f,p,m])=>{c&&(c.instances[h]=u,p&&p!==c&&u&&u===f&&(c.leaveGuards.size||(c.leaveGuards=p.leaveGuards),c.updateGuards.size||(c.updateGuards=p.updateGuards))),u&&c&&(!p||!Pn(c,p)||!f)&&(c.enterCallbacks[h]||[]).forEach(b=>b(u))},{flush:"post"}),()=>{const u=r.value,c=t.name,h=o.value,f=h&&h.components[c];if(!f)return Gf(e.default,{Component:f,route:u});const p=h.props[c],m=p?p===!0?u.params:typeof p=="function"?p(u):p:null,T=ls(f,Ue({},m,i,{onVnodeUnmounted:y=>{y.component.isUnmounted&&(h.instances[c]=null)},ref:l}));return Gf(e.default,{Component:T,route:u})||T}}});function Gf(t,i){if(!t)return null;const e=t(i);return e.length===1?e[0]:e}const c0=u0;function h0(t){const i=H_(t.routes,t),e=t.parseQuery||i0,n=t.stringifyQuery||Bf,r=t.history,s=xr(),a=xr(),o=xr(),l=$l(Hi);let u=Hi;En&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=sl.bind(null,W=>""+W),h=sl.bind(null,t0),f=sl.bind(null,Vs);function p(W,oe){let ae,he;return Pf(W)?(ae=i.getRecordMatcher(W),he=oe):he=W,i.addRoute(he,ae)}function m(W){const oe=i.getRecordMatcher(W);oe&&i.removeRoute(oe)}function b(){return i.getRoutes().map(W=>W.record)}function T(W){return!!i.getRecordMatcher(W)}function y(W,oe){if(oe=Ue({},oe||l.value),typeof W=="string"){const O=ol(e,W,oe.path),d=i.resolve({path:O.path},oe),_=r.createHref(O.fullPath);return Ue(O,d,{params:f(d.params),hash:Vs(O.hash),redirectedFrom:void 0,href:_})}let ae;if("path"in W)ae=Ue({},W,{path:ol(e,W.path,oe.path).path});else{const O=Ue({},W.params);for(const d in O)O[d]==null&&delete O[d];ae=Ue({},W,{params:h(O)}),oe.params=h(oe.params)}const he=i.resolve(ae,oe),ke=W.hash||"";he.params=c(f(he.params));const Ce=p_(n,Ue({},W,{hash:Q_(ke),path:he.path})),P=r.createHref(Ce);return Ue({fullPath:Ce,hash:ke,query:n===Bf?n0(W.query):W.query||{}},he,{redirectedFrom:void 0,href:P})}function w(W){return typeof W=="string"?ol(e,W,l.value.path):Ue({},W)}function S(W,oe){if(u!==W)return Rn(8,{from:oe,to:W})}function C(W){return j(W)}function L(W){return C(Ue(w(W),{replace:!0}))}function D(W){const oe=W.matched[W.matched.length-1];if(oe&&oe.redirect){const{redirect:ae}=oe;let he=typeof ae=="function"?ae(W):ae;return typeof he=="string"&&(he=he.includes("?")||he.includes("#")?he=w(he):{path:he},he.params={}),Ue({query:W.query,hash:W.hash,params:"path"in he?{}:W.params},he)}}function j(W,oe){const ae=u=y(W),he=l.value,ke=W.state,Ce=W.force,P=W.replace===!0,O=D(ae);if(O)return j(Ue(w(O),{state:typeof O=="object"?Ue({},ke,O.state):ke,force:Ce,replace:P}),oe||ae);const d=ae;d.redirectedFrom=oe;let _;return!Ce&&m_(n,he,ae)&&(_=Rn(16,{to:d,from:he}),Q(he,he,!0,!1)),(_?Promise.resolve(_):se(d,he)).catch(R=>mi(R)?mi(R,2)?R:ce(R):U(R,d,he)).then(R=>{if(R){if(mi(R,2))return j(Ue({replace:P},w(R.to),{state:typeof R.to=="object"?Ue({},ke,R.to.state):ke,force:Ce}),oe||d)}else R=Se(d,he,!0,P,ke);return ue(d,he,R),R})}function N(W,oe){const ae=S(W,oe);return ae?Promise.reject(ae):Promise.resolve()}function K(W){const oe=Ve.values().next().value;return oe&&typeof oe.runWithContext=="function"?oe.runWithContext(W):W()}function se(W,oe){let ae;const[he,ke,Ce]=f0(W,oe);ae=fl(he.reverse(),"beforeRouteLeave",W,oe);for(const O of he)O.leaveGuards.forEach(d=>{ae.push(Bi(d,W,oe))});const P=N.bind(null,W,oe);return ae.push(P),Te(ae).then(()=>{ae=[];for(const O of s.list())ae.push(Bi(O,W,oe));return ae.push(P),Te(ae)}).then(()=>{ae=fl(ke,"beforeRouteUpdate",W,oe);for(const O of ke)O.updateGuards.forEach(d=>{ae.push(Bi(d,W,oe))});return ae.push(P),Te(ae)}).then(()=>{ae=[];for(const O of Ce)if(O.beforeEnter)if(Ut(O.beforeEnter))for(const d of O.beforeEnter)ae.push(Bi(d,W,oe));else ae.push(Bi(O.beforeEnter,W,oe));return ae.push(P),Te(ae)}).then(()=>(W.matched.forEach(O=>O.enterCallbacks={}),ae=fl(Ce,"beforeRouteEnter",W,oe),ae.push(P),Te(ae))).then(()=>{ae=[];for(const O of a.list())ae.push(Bi(O,W,oe));return ae.push(P),Te(ae)}).catch(O=>mi(O,8)?O:Promise.reject(O))}function ue(W,oe,ae){o.list().forEach(he=>K(()=>he(W,oe,ae)))}function Se(W,oe,ae,he,ke){const Ce=S(W,oe);if(Ce)return Ce;const P=oe===Hi,O=En?history.state:{};ae&&(he||P?r.replace(W.fullPath,Ue({scroll:P&&O&&O.scroll},ke)):r.push(W.fullPath,ke)),l.value=W,Q(W,oe,ae,P),ce()}let Re;function Ee(){Re||(Re=r.listen((W,oe,ae)=>{if(!Ae.listening)return;const he=y(W),ke=D(he);if(ke){j(Ue(ke,{replace:!0}),he).catch(wr);return}u=he;const Ce=l.value;En&&x_(xf(Ce.fullPath,ae.delta),Us()),se(he,Ce).catch(P=>mi(P,12)?P:mi(P,2)?(j(P.to,he).then(O=>{mi(O,20)&&!ae.delta&&ae.type===_r.pop&&r.go(-1,!1)}).catch(wr),Promise.reject()):(ae.delta&&r.go(-ae.delta,!1),U(P,he,Ce))).then(P=>{P=P||Se(he,Ce,!1),P&&(ae.delta&&!mi(P,8)?r.go(-ae.delta,!1):ae.type===_r.pop&&mi(P,20)&&r.go(-1,!1)),ue(he,Ce,P)}).catch(wr)}))}let Me=xr(),ge=xr(),ne;function U(W,oe,ae){ce(W);const he=ge.list();return he.length?he.forEach(ke=>ke(W,oe,ae)):console.error(W),Promise.reject(W)}function re(){return ne&&l.value!==Hi?Promise.resolve():new Promise((W,oe)=>{Me.add([W,oe])})}function ce(W){return ne||(ne=!W,Ee(),Me.list().forEach(([oe,ae])=>W?ae(W):oe()),Me.reset()),W}function Q(W,oe,ae,he){const{scrollBehavior:ke}=t;if(!En||!ke)return Promise.resolve();const Ce=!ae&&S_(xf(W.fullPath,0))||(he||!ae)&&history.state&&history.state.scroll||null;return Fn().then(()=>ke(W,oe,Ce)).then(P=>P&&T_(P)).catch(P=>U(P,W,oe))}const _e=W=>r.go(W);let He;const Ve=new Set,Ae={currentRoute:l,listening:!0,addRoute:p,removeRoute:m,hasRoute:T,getRoutes:b,resolve:y,options:t,push:C,replace:L,go:_e,back:()=>_e(-1),forward:()=>_e(1),beforeEach:s.add,beforeResolve:a.add,afterEach:o.add,onError:ge.add,isReady:re,install(W){const oe=this;W.component("RouterLink",o0),W.component("RouterView",c0),W.config.globalProperties.$router=oe,Object.defineProperty(W.config.globalProperties,"$route",{enumerable:!0,get:()=>k(l)}),En&&!He&&l.value===Hi&&(He=!0,C(r.location).catch(ke=>{}));const ae={};for(const ke in Hi)Object.defineProperty(ae,ke,{get:()=>l.value[ke],enumerable:!0});W.provide(js,oe),W.provide(cl,Jl(ae)),W.provide(hl,l);const he=W.unmount;Ve.add(W),W.unmount=function(){Ve.delete(W),Ve.size<1&&(u=Hi,Re&&Re(),Re=null,l.value=Hi,He=!1,ne=!1),he()}}};function Te(W){return W.reduce((oe,ae)=>oe.then(()=>K(ae)),Promise.resolve())}return Ae}function f0(t,i){const e=[],n=[],r=[],s=Math.max(i.matched.length,t.matched.length);for(let a=0;aPn(u,o))?n.push(o):e.push(o));const l=t.matched[a];l&&(i.matched.find(u=>Pn(u,l))||r.push(l))}return[e,n,r]}function d0(){return ye(js)}function p0(){return ye(cl)}const qf=Yo("modes",()=>{const t=zi();Y(()=>Yi(Bs)),Y(()=>Yi(yr)),Y(()=>Yi(nl));const i=new Kf({id:"default",externalUrl:"",enableResources:!0,enableFilters:!0}),e=[{id:"image",externalUrl:"image",paramCount:1},{id:"resource",externalUrl:"resource",paramCount:1,enableFilters:!0},{id:"record",externalUrl:"record",paramCount:2},{id:"recordImage",externalUrl:"record",paramCount:3},{id:"slug",externalUrl:"search",paramCount:1},{id:"doi",externalUrl:"search",paramCount:2}].map(f=>new Kf(f)),n=p0(),r=Y(()=>{let p=!!n.params.mode?n.params.mode[0]:"default",m=e.filter(b=>b.externalUrl===p&&b.paramCount===s.value.length);return m.length>0?m[0]:i}),s=Y(()=>!!n.params.mode?n.params.mode.slice(1,n.params.mode.length):[]);function a(){switch(Fi.once(br.recordsRetrieved,()=>{t.currentImage=t.allImages[0]}),r.value.id){case"image":t.currentImage=t.imageRepo.save({url:"/media/"+s.value[0]}),t.showOverlay=!0;break;case"resource":o(s.value[0]);break;case"record":l(s.value[0],s.value[1],null);break;case"recordImage":l(s.value[0],s.value[1],s.value[2]);break;case"slug":u(s.value[0]);break;case"doi":c(s.value[0],s.value[1]);break;default:h()}}function o(f){t.setQuery({query:{},resource_ids:[f]})}function l(f,p,m){m!=null&&Fi.once(br.recordsRetrieved,()=>{t.changeImage(t.allImages[0])}),t.setQuery({query:{filters:{and:[{string_equals:{fields:["_id"],value:p}}]}},resource_ids:[f]},m==null?null:{ix:m})}function u(f){tl("datastore_resolve_slug",{slug:f}).then(p=>{p.success&&t.setQuery(p.result)})}function c(f,p){tl("datastore_resolve_slug",{slug:`${f}/${p}`}).then(m=>{m.success&&t.setQuery(m.result)})}function h(){t.setQuery({query:{filters:{and:[{string_equals:{fields:["associatedMedia.category"],value:"Drawer scan"}}]}},resource_ids:["05ff2255-c38a-40c9-b657-4ccb55ab2feb","bb909597-dedf-427d-8c04-4c02b3a24db3"]})}return{mode:r,modeParams:s,loadData:a}});class Kf{constructor(i){this.id=i.id,this.externalUrl=i.externalUrl,this.paramCount=i.paramCount==null?0:i.paramCount,this.enableResources=i.enableResources==null?!1:i.enableResources,this.enableFilters=i.enableFilters==null?!1:i.enableFilters}get lockAll(){return!this.enableResources&&!this.enableFilters}}function Sr(t){function i(e){return e=e||[],t.class&&Array.isArray(t.class)?e=e.concat(t.class):t.class&&e.push(t.class),e}return{addPropClasses:i}}const m0="zoa__button__main",g0="zoa__button__checkbox",v0={main:m0,"kind--normal":"zoa__button__kind--normal",checkbox:g0,"kind--primary":"zoa__button__kind--primary","kind--alt":"zoa__button__kind--alt","size--sm":"zoa__button__size--sm","size--md":"zoa__button__size--md"},ht=(t,i)=>{const e=t.__vccOpts||t;for(const[n,r]of i)e[n]=r;return e},y0={__name:"Button",props:{class:{type:[String,Array,null],default:null},label:{type:String,default:"Button"},kind:{type:String,default:"normal"},size:{type:String,default:"md"}},setup(t){const i=t,{addPropClasses:e}=Sr(i);return(n,r)=>(ie(),le("button",{class:q(k(e)([n.$style.main,n.$style[`kind--${t.kind}`],n.$style[`size--${t.size}`]]))},[Ei(n.$slots,"default",{},()=>[mt(Oe(t.label),1)])],2))}},b0={$style:v0},Vt=ht(y0,[["__cssModules",b0]]);let w0=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((i,e)=>(e&=63,e<36?i+=e.toString(36):e<62?i+=(e-26).toString(36).toUpperCase():e>62?i+="-":i+="_",i),"");function dl(){const t=$(w0(6));function i(e){return`${t.value}__${e}`}return{componentId:t,subId:i}}const{now:Zf}=Date,Ws=(t,i=1,e)=>{i=Math.max(1,i);const n=(e==null?void 0:e.leading)??!1,r=(e==null?void 0:e.trailing)??!0,s=Math.max((e==null?void 0:e.maxWait)??1/0,i);let a,o,l=0,u=0;const c=()=>{const C=Zf(),L=C-l,D=C-u,j=L>=i||D>=s;return[C,j]},h=C=>{if(u=C,!a)return;const L=a;a=void 0,t.apply(void 0,L)},f=()=>{w(0)},p=()=>{o&&(f(),h(Zf()))},m=C=>{if(u=C,n)return h(C)},b=C=>{if(r&&a)return h(C);a=void 0},T=()=>{o=void 0;const[C,L]=c();return L?b(C):y(C)},y=C=>{const L=C-l,D=C-u,j=i-L,N=s-D,K=Math.min(j,N);return w(K)},w=C=>{o&&clearTimeout(o),!(C<=0)&&(o=setTimeout(T,C))},S=(...C)=>{const[L,D]=c(),j=!!o;if(a=C,l=L,(D||!o)&&w(i),D)return j?h(L):m(L)};return S.cancel=f,S.flush=p,S};function Rt(t,i){let e;try{e=parseInt(i.delay)||0}catch{e=0}const n=$(null);function r(l){t("change",l)}const s=Ws(r,e);function a(l){t("update:modelValue",l),n.value=l,s(l)}const o=Y({get(){return i.modelValue===void 0?n.value:i.modelValue},set(l){a(l)}});return{emitChange:s,valueChanged:a,value:o}}function _0(t,i){let e,n,r;const s=$(!0),a=()=>{s.value=!0,r()};$e(t,a,{flush:"sync"});const o=typeof i=="function"?i:i.get,l=typeof i=="function"?void 0:i.set,u=iu((c,h)=>(n=c,r=h,{get(){return s.value&&(e=o(),s.value=!1),n(),e},set(f){l==null||l(f)}}));return Object.isExtensible(u)&&(u.trigger=a),u}function T0(t){return Lr()?(uo(t),!0):!1}function jt(t){return typeof t=="function"?t():k(t)}const Yf=typeof window<"u"&&typeof document<"u",x0=Object.prototype.toString,S0=t=>x0.call(t)==="[object Object]",gi=()=>{},E0=P0();function P0(){var t;return Yf&&((t=window==null?void 0:window.navigator)==null?void 0:t.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent)}function Xf(t,i){function e(...n){return new Promise((r,s)=>{Promise.resolve(t(()=>i.apply(this,n),{fn:i,thisArg:this,args:n})).then(r).catch(s)})}return e}function R0(t,i={}){let e,n,r=gi;const s=a=>{clearTimeout(a),r(),r=gi};return a=>{const o=jt(t),l=jt(i.maxWait);return e&&s(e),o<=0||l!==void 0&&l<=0?(n&&(s(n),n=null),Promise.resolve(a())):new Promise((u,c)=>{r=i.rejectOnCancel?c:u,l&&!n&&(n=setTimeout(()=>{e&&s(e),n=null,u(a())},l)),e=setTimeout(()=>{n&&s(n),n=null,u(a())},o)})}}function C0(t,i=!0,e=!0,n=!1){let r=0,s,a=!0,o=gi,l;const u=()=>{s&&(clearTimeout(s),s=void 0,o(),o=gi)};return c=>{const h=jt(t),f=Date.now()-r,p=()=>l=c();return u(),h<=0?(r=Date.now(),p()):(f>h&&(e||!a)?(r=Date.now(),p()):i&&(l=new Promise((m,b)=>{o=n?b:m,s=setTimeout(()=>{r=Date.now(),a=!0,m(p()),u()},Math.max(0,h-f))})),!e&&!s&&(s=setTimeout(()=>a=!0,h)),a=!1,l)}}function O0(t,i=200,e={}){return Xf(R0(i,e),t)}function I0(t,i=200,e=!1,n=!0,r=!1){return Xf(C0(i,e,n,r),t)}function tn(t){var i;const e=jt(t);return(i=e==null?void 0:e.$el)!=null?i:e}const Cn=Yf?window:void 0;function Lt(...t){let i,e,n,r;if(typeof t[0]=="string"||Array.isArray(t[0])?([e,n,r]=t,i=Cn):[i,e,n,r]=t,!i)return gi;Array.isArray(e)||(e=[e]),Array.isArray(n)||(n=[n]);const s=[],a=()=>{s.forEach(c=>c()),s.length=0},o=(c,h,f,p)=>(c.addEventListener(h,f,p),()=>c.removeEventListener(h,f,p)),l=$e(()=>[tn(i),jt(r)],([c,h])=>{if(a(),!c)return;const f=S0(h)?{...h}:h;s.push(...e.flatMap(p=>n.map(m=>o(c,p,m,f))))},{immediate:!0,flush:"post"}),u=()=>{l(),a()};return T0(u),u}let Jf=!1;function pl(t,i,e={}){const{window:n=Cn,ignore:r=[],capture:s=!0,detectIframe:a=!1}=e;if(!n)return;E0&&!Jf&&(Jf=!0,Array.from(n.document.body.children).forEach(c=>c.addEventListener("click",gi)),n.document.documentElement.addEventListener("click",gi));let o=!0;const l=c=>r.some(h=>{if(typeof h=="string")return Array.from(n.document.querySelectorAll(h)).some(f=>f===c.target||c.composedPath().includes(f));{const f=tn(h);return f&&(c.target===f||c.composedPath().includes(f))}}),u=[Lt(n,"click",c=>{const h=tn(t);if(!(!h||h===c.target||c.composedPath().includes(h))){if(c.detail===0&&(o=!l(c)),!o){o=!0;return}i(c)}},{passive:!0,capture:s}),Lt(n,"pointerdown",c=>{const h=tn(t);h&&(o=!c.composedPath().includes(h)&&!l(c))},{passive:!0}),a&&Lt(n,"blur",c=>{setTimeout(()=>{var h;const f=tn(t);((h=n.document.activeElement)==null?void 0:h.tagName)==="IFRAME"&&!(f!=null&&f.contains(n.document.activeElement))&&i(c)},0)})].filter(Boolean);return()=>u.forEach(c=>c())}function A0(t){return typeof t=="function"?t:typeof t=="string"?i=>i.key===t:Array.isArray(t)?i=>t.includes(i.key):()=>!0}function rt(...t){let i,e,n={};t.length===3?(i=t[0],e=t[1],n=t[2]):t.length===2?typeof t[1]=="object"?(i=!0,e=t[0],n=t[1]):(i=t[0],e=t[1]):(i=!0,e=t[0]);const{target:r=Cn,eventName:s="keydown",passive:a=!1,dedupe:o=!1}=n,l=A0(i);return Lt(r,s,u=>{u.repeat&&jt(o)||l(u)&&e(u)},a)}function k0(t={}){var i;const{window:e=Cn,deep:n=!0}=t,r=(i=t.document)!=null?i:e==null?void 0:e.document,s=()=>{var o;let l=r==null?void 0:r.activeElement;if(n)for(;l!=null&&l.shadowRoot;)l=(o=l==null?void 0:l.shadowRoot)==null?void 0:o.activeElement;return l},a=_0(()=>null,()=>s());return e&&(Lt(e,"blur",o=>{o.relatedTarget===null&&a.trigger()},!0),Lt(e,"focus",a.trigger,!0)),a}function D0(t,i={}){const{delayEnter:e=0,delayLeave:n=0,window:r=Cn}=i,s=$(!1);let a;const o=l=>{const u=l?e:n;a&&(clearTimeout(a),a=void 0),u?a=setTimeout(()=>s.value=l,u):s.value=l};return r&&(Lt(t,"mouseenter",()=>o(!0),{passive:!0}),Lt(t,"mouseleave",()=>o(!1),{passive:!0})),s}function On(t,i={}){const{initialValue:e=!1,focusVisible:n=!1}=i,r=$(!1),s=Y(()=>tn(t));Lt(s,"focus",o=>{var l,u;(!n||(u=(l=o.target).matches)!=null&&u.call(l,":focus-visible"))&&(r.value=!0)}),Lt(s,"blur",()=>r.value=!1);const a=Y({get:()=>r.value,set(o){var l,u;!o&&r.value?(l=s.value)==null||l.blur():o&&!r.value&&((u=s.value)==null||u.focus())}});return $e(s,()=>{a.value=e},{immediate:!0,flush:"post"}),{focused:a}}function ei(t,i={}){const e=k0(i),n=Y(()=>tn(t));return{focused:Y(()=>n.value&&e.value?n.value.contains(e.value):!1)}}const Qf=1;function M0(t,i={}){const{throttle:e=0,idle:n=200,onStop:r=gi,onScroll:s=gi,offset:a={left:0,right:0,top:0,bottom:0},eventListenerOptions:o={capture:!1,passive:!0},behavior:l="auto",window:u=Cn}=i,c=$(0),h=$(0),f=Y({get(){return c.value},set(D){m(D,void 0)}}),p=Y({get(){return h.value},set(D){m(void 0,D)}});function m(D,j){var N,K,se;if(!u)return;const ue=jt(t);ue&&((se=ue instanceof Document?u.document.body:ue)==null||se.scrollTo({top:(N=jt(j))!=null?N:p.value,left:(K=jt(D))!=null?K:f.value,behavior:jt(l)}))}const b=$(!1),T=Kt({left:!0,right:!1,top:!0,bottom:!1}),y=Kt({left:!1,right:!1,top:!1,bottom:!1}),w=D=>{b.value&&(b.value=!1,y.left=!1,y.right=!1,y.top=!1,y.bottom=!1,r(D))},S=O0(w,e+n),C=D=>{var j;if(!u)return;const N=D.document?D.document.documentElement:(j=D.documentElement)!=null?j:D,{display:K,flexDirection:se}=getComputedStyle(N),ue=N.scrollLeft;y.left=uec.value;const Se=Math.abs(ue)<=0+(a.left||0),Re=Math.abs(ue)+N.clientWidth>=N.scrollWidth-(a.right||0)-Qf;K==="flex"&&se==="row-reverse"?(T.left=Re,T.right=Se):(T.left=Se,T.right=Re),c.value=ue;let Ee=N.scrollTop;D===u.document&&!Ee&&(Ee=u.document.body.scrollTop),y.top=Eeh.value;const Me=Math.abs(Ee)<=0+(a.top||0),ge=Math.abs(Ee)+N.clientHeight>=N.scrollHeight-(a.bottom||0)-Qf;K==="flex"&&se==="column-reverse"?(T.top=ge,T.bottom=Me):(T.top=Me,T.bottom=ge),h.value=Ee},L=D=>{var j;if(!u)return;const N=(j=D.target.documentElement)!=null?j:D.target;C(N),b.value=!0,S(D),s(D)};return Lt(t,"scroll",e?I0(L,e,!0,!1):L,o),Lt(t,"scrollend",w,o),{x:f,y:p,isScrolling:b,arrivedState:T,directions:y,measure(){const D=jt(t);u&&D&&C(D)}}}const N0="zoa__togglebutton__input",L0="zoa__togglebutton__inputWrapper",F0="zoa__togglebutton__container",z0="zoa__togglebutton__main",H0="zoa__togglebutton__checkbox",B0={input:N0,inputWrapper:L0,container:F0,main:z0,"kind--normal":"zoa__togglebutton__kind--normal",checkbox:H0,"kind--primary":"zoa__togglebutton__kind--primary","kind--alt":"zoa__togglebutton__kind--alt","size--sm":"zoa__togglebutton__size--sm","size--md":"zoa__togglebutton__size--md"},U0=["id","for"],V0=["id","name","value"],j0={__name:"ToggleButton",props:{modelValue:{type:[Boolean,Array],default:void 0},class:{type:[String,Array,null],default:null},label:{type:String,default:"Checkbox"},delay:{type:Number,default:0},name:{type:[String,null],default:null},checkValue:{type:[String,null],default:null},kind:{type:String,default:"normal"},size:{type:String,default:"md"}},emits:["change","update:modelValue"],setup(t,{emit:i}){const e=t,{componentId:n,subId:r}=dl(),{addPropClasses:s}=Sr(e),{value:a}=Rt(i,e),o=$(null),l=$(null),u=ei(o),c=Y(()=>e.checkValue||e.label);function h(){let f=_o(a.value)?Ie(a.value):a.value;if(Array.isArray(f)){let p=!l.value.checked;f=f.filter(m=>m!==c.value),p&&f.push(c.value),a.value=f,l.value.checked=p}else a.value=!a.value}return rt(" ",()=>{u.focused.value&&h()}),rt("Enter",()=>{u.focused.value&&h()}),(f,p)=>(ie(),le("label",{id:k(n),for:k(r)("toggle"),tabindex:"0",ref_key:"checkboxContainer",ref:o,class:q(k(s)([f.$style.container]))},[xt(ee("input",{type:"checkbox",id:k(r)("toggle"),class:q(f.$style.checkbox),"onUpdate:modelValue":p[0]||(p[0]=m=>ze(a)?a.value=m:null),name:t.name,value:c.value,ref_key:"checkboxInput",ref:l},null,10,V0),[[ac,k(a)]]),ee("span",{class:q([f.$style.main,f.$style[`kind--${t.kind}`],f.$style[`size--${t.size}`]])},[Ei(f.$slots,"default",{},()=>[mt(Oe(t.label),1)])],2)],10,U0))}},W0={$style:B0},G0=ht(j0,[["__cssModules",W0]]),q0="zoa__tabs__input",K0="zoa__tabs__inputWrapper",Z0="zoa__tabs__tab",Y0="zoa__tabs__tabContainer",X0={input:q0,inputWrapper:K0,tab:Z0,"state--active":"zoa__tabs__state--active","orient--left":"zoa__tabs__orient--left","orient--right":"zoa__tabs__orient--right","orient--above":"zoa__tabs__orient--above","orient--below":"zoa__tabs__orient--below","kind--normal":"zoa__tabs__kind--normal","kind--primary":"zoa__tabs__kind--primary","kind--alt":"zoa__tabs__kind--alt","size--sm":"zoa__tabs__size--sm","size--md":"zoa__tabs__size--md",tabContainer:Y0},J0=["value"],Q0={__name:"Tabs",props:{modelValue:{type:String,default:void 0},class:{type:[String,Array,null],default:null},delay:{type:Number,default:0},kind:{type:String,default:"normal"},size:{type:String,default:"md"},activePosition:{type:String,default:"below"},options:{type:Array},initialValue:{type:[String,null],default:null}},emits:["change","update:modelValue"],setup(t,{emit:i}){const e=t;dl();const{addPropClasses:n}=Sr(e),{value:r}=Rt(i,e),s=$(null);$(null),ei(s);const a=Y(()=>{let o=[];return e.options.forEach(l=>{typeof l=="object"?o.push({label:l.label||l.value,value:l.value||l.label,order:l.order==null?null:l.order}):o.push({label:l,value:l})}),o.sort((l,u)=>{let c=0;(l.order!=null||u.order!=null)&&(c=l.order!=null&&u.order!=null?l.order-u.order:l.order!=null?-1:1);let h=l.label.localeCompare(u.label);return c!==0?c:h}),o});return r.value==null&&(e.initialValue&&a.value.some(o=>o.value===e.initialValue)?r.value=e.initialValue:r.value=a.value[0].value),(o,l)=>(ie(),le("div",{class:q(k(n)([]))},[ee("ul",{class:q([o.$style.tabContainer,o.$style[`orient--${t.activePosition}`]])},[(ie(!0),le(De,null,yt(a.value,u=>(ie(),le("li",null,[ee("label",{tabindex:"0",class:q([o.$style.tab,o.$style[`orient--${t.activePosition}`],o.$style[`kind--${t.kind}`],o.$style[`size--${t.size}`],o.$style[`state--${k(r)===u.value?"active":"inactive"}`]])},[xt(ee("input",{type:"radio",value:u.value,"onUpdate:modelValue":l[0]||(l[0]=c=>ze(r)?r.value=c:null)},null,8,J0),[[sg,k(r)]]),ee("span",null,Oe(u.label),1)],2)]))),256))],2)],2))}},$0={$style:X0},eT=ht(Q0,[["__cssModules",$0]]),tT="zoa__label__main",iT={main:tT,"main--right":"zoa__label__main--right","main--left":"zoa__label__main--left","main--above":"zoa__label__main--above","main--below":"zoa__label__main--below","main--none":"zoa__label__main--none"},nT=["id","for","tabindex"],rT=["id"],sT={__name:"Label",props:{label:{type:String},labelPosition:{type:String,default:"above"},inputId:{type:String},legend:{type:Boolean,default:!1},tabbable:{type:Boolean,default:!1}},setup(t){const i=ye("labelId");return(e,n)=>t.label&&!t.legend?(ie(),le("label",{key:0,id:k(i),for:t.inputId,class:q([e.$style.main,e.$style[`main--${t.labelPosition}`]]),tabindex:t.tabbable?0:-1},Oe(t.label),11,nT)):t.label?(ie(),le("legend",{key:1,id:k(i),class:q([e.$style.main,e.$style[`main--${t.labelPosition}`]])},Oe(t.label),11,rT)):qe("",!0)}},oT={$style:iT},$f=ht(sT,[["__cssModules",oT]]);function ed(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);i&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function vi(t){for(var i=1;i=0)&&(e[r]=t[r]);return e}function lT(t,i){if(t==null)return{};var e=aT(t,i),n,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(e[n]=t[n])}return e}var uT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},td={exports:{}};(function(t){(function(i){var e=function(y,w,S){if(!u(w)||h(w)||f(w)||p(w)||l(w))return w;var C,L=0,D=0;if(c(w))for(C=[],D=w.length;L1&&arguments[1]!==void 0?arguments[1]:{},e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(typeof t=="string")return t;var n=(t.children||[]).map(function(l){return id(l)}),r=Object.keys(t.attributes||{}).reduce(function(l,u){var c=t.attributes[u];switch(u){case"class":l.class=dT(c);break;case"style":l.style=fT(c);break;default:l.attrs[u]=c}return l},{attrs:{},class:{},style:{}});e.class;var s=e.style,a=s===void 0?{}:s,o=lT(e,hT);return ls(t.tag,vi(vi(vi({},i),{},{class:r.class,style:vi(vi({},r.style),a)},r.attrs),o),n)}var nd=!1;try{nd=!0}catch{}function pT(){if(!nd&&console&&typeof console.error=="function"){var t;(t=console).error.apply(t,arguments)}}function ml(t,i){return Array.isArray(i)&&i.length>0||!Array.isArray(i)&&i?_t({},t,i):{}}function mT(t){var i,e=(i={"fa-spin":t.spin,"fa-pulse":t.pulse,"fa-fw":t.fixedWidth,"fa-border":t.border,"fa-li":t.listItem,"fa-inverse":t.inverse,"fa-flip":t.flip===!0,"fa-flip-horizontal":t.flip==="horizontal"||t.flip==="both","fa-flip-vertical":t.flip==="vertical"||t.flip==="both"},_t(i,"fa-".concat(t.size),t.size!==null),_t(i,"fa-rotate-".concat(t.rotation),t.rotation!==null),_t(i,"fa-pull-".concat(t.pull),t.pull!==null),_t(i,"fa-swap-opacity",t.swapOpacity),_t(i,"fa-bounce",t.bounce),_t(i,"fa-shake",t.shake),_t(i,"fa-beat",t.beat),_t(i,"fa-fade",t.fade),_t(i,"fa-beat-fade",t.beatFade),_t(i,"fa-flash",t.flash),_t(i,"fa-spin-pulse",t.spinPulse),_t(i,"fa-spin-reverse",t.spinReverse),i);return Object.keys(e).map(function(n){return e[n]?n:null}).filter(function(n){return n})}function rd(t){if(t&&Gs(t)==="object"&&t.prefix&&t.iconName&&t.icon)return t;if(Tn.icon)return Tn.icon(t);if(t===null)return null;if(Gs(t)==="object"&&t.prefix&&t.iconName)return t;if(Array.isArray(t)&&t.length===2)return{prefix:t[0],iconName:t[1]};if(typeof t=="string")return{prefix:"fas",iconName:t}}var In=Hn({name:"FontAwesomeIcon",props:{border:{type:Boolean,default:!1},fixedWidth:{type:Boolean,default:!1},flip:{type:[Boolean,String],default:!1,validator:function(t){return[!0,!1,"horizontal","vertical","both"].indexOf(t)>-1}},icon:{type:[Object,Array,String],required:!0},mask:{type:[Object,Array,String],default:null},listItem:{type:Boolean,default:!1},pull:{type:String,default:null,validator:function(t){return["right","left"].indexOf(t)>-1}},pulse:{type:Boolean,default:!1},rotation:{type:[String,Number],default:null,validator:function(t){return[90,180,270].indexOf(Number.parseInt(t,10))>-1}},swapOpacity:{type:Boolean,default:!1},size:{type:String,default:null,validator:function(t){return["2xs","xs","sm","lg","xl","2xl","1x","2x","3x","4x","5x","6x","7x","8x","9x","10x"].indexOf(t)>-1}},spin:{type:Boolean,default:!1},transform:{type:[String,Object],default:null},symbol:{type:[Boolean,String],default:!1},title:{type:String,default:null},inverse:{type:Boolean,default:!1},bounce:{type:Boolean,default:!1},shake:{type:Boolean,default:!1},beat:{type:Boolean,default:!1},fade:{type:Boolean,default:!1},beatFade:{type:Boolean,default:!1},flash:{type:Boolean,default:!1},spinPulse:{type:Boolean,default:!1},spinReverse:{type:Boolean,default:!1}},setup:function(t,i){var e=i.attrs,n=Y(function(){return rd(t.icon)}),r=Y(function(){return ml("classes",mT(t))}),s=Y(function(){return ml("transform",typeof t.transform=="string"?Tn.transform(t.transform):t.transform)}),a=Y(function(){return ml("mask",rd(t.mask))}),o=Y(function(){return Dh(n.value,vi(vi(vi(vi({},r.value),s.value),a.value),{},{symbol:t.symbol,title:t.title}))});$e(o,function(u){if(!u)return pT("Could not find one or more icon(s)",n.value,a.value)},{immediate:!0});var l=Y(function(){return o.value?id(o.value.abstract[0],{},e):null});return function(){return l.value}}});kh.add(Xb,Kb,Gb,Vb,jb,Wb,Yb,qb);const gT="zoa__help__main",vT="zoa__help__icon",yT="zoa__help__popup",bT={main:gT,"main--above":"zoa__help__main--above","main--below":"zoa__help__main--below",icon:vT,popup:yT,"popup--right":"zoa__help__popup--right"},wT=["id"],_T={__name:"Help",props:{text:{type:String},position:{type:String,default:"right"}},setup(t){const i=ye("labelPosition"),e=ye("helpId"),n=$(!1),r=$(null),s=D0(r,{delayEnter:500});return $e(s,()=>{n.value=s.value}),rt("Escape",()=>n.value=!1),(a,o)=>(ie(),le("div",{class:q([a.$style.main,a.$style[`main--${k(i)}`]]),ref_key:"helpContainer",ref:r},[be(k(In),{icon:["fa-solid","fa-circle-question"],class:q(a.$style.icon)},null,8,["class"]),xt(ee("div",{class:q([a.$style.popup,a.$style[`popup--${t.position}`]]),id:k(e),role:"tooltip"},[Ei(a.$slots,"default",{},()=>[mt(Oe(t.text),1)])],10,wT),[[us,n.value]])],2))}},TT={$style:bT},sd=ht(_T,[["__cssModules",TT]]),xT="zoa__autocompletetextbox__input",ST="zoa__autocompletetextbox__inputWrapper",ET="zoa__autocompletetextbox__disabled",PT="zoa__autocompletetextbox__options",RT="zoa__autocompletetextbox__option",CT="zoa__autocompletetextbox__noOptions",OT={input:xT,inputWrapper:ST,disabled:ET,options:PT,option:RT,noOptions:CT},IT=["aria-labelledby","aria-describedby"],AT=["placeholder","id","disabled"],kT={key:0},DT=["onClick"],MT=["value"],NT={__name:"AutocompleteTextbox",props:{modelValue:{type:String},delay:{type:Number,default:200},placeholder:{type:[String,void 0],default:null},options:{type:Array}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=ye("inputId"),s=ye("labelId"),a=ye("helpId"),o=ye("disabled"),{value:l}=Rt(e,n),u=Y(()=>{let w=[];return n.options.forEach(S=>{typeof S=="object"?w.push({label:S.label||S.value,value:S.value||S.label,order:S.order==null?null:S.order}):w.push({label:S,value:S})}),w.sort((S,C)=>{let L=0;(S.order!=null||C.order!=null)&&(L=S.order!=null&&C.order!=null?S.order-C.order:S.order!=null?-1:1);let D=S.label.localeCompare(C.label);return L!==0?L:D}),w}),c=$(null),h=$(null),f=$(null);i({target:h});const p=$(!1),m=On(h),b=ei(f);function T(){try{c.value.blur(),h.value.blur(),f.value.blur()}catch{}p.value=!1}pl(c,()=>{p.value=!1}),rt("ArrowDown",()=>{if(u.value.length!==0){if(m.focused.value)f.value.children[0].children[0].focus();else if(b.focused.value){const w=f.value.querySelector("li:focus");!w||!w.nextElementSibling?f.value.children[0].children[0].focus():w.nextElementSibling.focus()}}}),rt("ArrowUp",()=>{if(u.value.length!==0&&b.focused.value){const w=f.value.querySelector("li:focus");!w||!w.previousElementSibling?h.value.focus():w.previousElementSibling.focus()}}),rt("Enter",()=>{if(b.focused.value){const w=f.value.querySelector("li:focus");w&&y(w.querySelector("input").value)}T()});function y(w){l.value=w,T()}return(w,S)=>(ie(),le("div",{class:q([w.$style.inputWrapper,k(o)?w.$style.disabled:""]),ref_key:"container",ref:c,"aria-labelledby":k(s),"aria-describedby":k(a)},[xt(ee("input",{type:"text",placeholder:t.placeholder,id:k(r),class:q(w.$style.input),"onUpdate:modelValue":S[0]||(S[0]=C=>ze(l)?l.value=C:null),onFocusin:S[1]||(S[1]=C=>p.value=!0),ref_key:"textbox",ref:h,disabled:k(o)},null,42,AT),[[dn,k(l)]]),p.value&&!k(o)?(ie(),le("div",{key:0,class:q(w.$style.options),ref_key:"dropdown",ref:f},[u.value.length>0?(ie(),le("ul",kT,[(ie(!0),le(De,null,yt(u.value,C=>(ie(),le("li",{class:q(w.$style.option),onClick:L=>y(C.value),tabindex:"0"},[ee("span",null,Oe(C.label),1),ee("input",{type:"hidden",value:C.value},null,8,MT)],10,DT))),256))])):(ie(),le("div",{key:1,class:q(w.$style.noOptions)},"No options found",2))],2)):qe("",!0)],10,IT))}},LT={$style:OT},FT=ht(NT,[["__cssModules",LT]]),zT="zoa__checkbox__input",HT="zoa__checkbox__inputWrapper",BT="zoa__checkbox__defaultCheckbox",UT="zoa__checkbox__checkbox",VT="zoa__checkbox__check",jT="zoa__checkbox__disabled",WT={input:zT,inputWrapper:HT,defaultCheckbox:BT,checkbox:UT,check:VT,disabled:jT},GT=["aria-labelledby","aria-describedby"],qT=["id","name","value","disabled"],KT={__name:"Checkbox",props:{modelValue:{type:[Boolean,Array],default:void 0},delay:{type:Number,default:0},name:{type:[String,null],default:null},checkValue:{type:[String,null],default:null}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=ye("inputId"),s=ye("labelId"),a=ye("helpId"),o=ye("disabled"),{value:l,valueChanged:u}=Rt(e,n),c=ye("rootContainer"),h=$(null),f=ei(c);i({target:h});const p=ye("label"),m=Y(()=>n.checkValue||p.value),b=Y({get(){return n.name?l.value||[]:l.value||!1},set(y){u(y)}});function T(){if(!o.value)if(n.name){let y=!b.value.includes(m.value),w=b.value.filter(S=>S!==m.value);y&&w.push(m.value),b.value=w}else b.value=!b.value}return rt(" ",()=>{f.focused.value&&T()}),(y,w)=>(ie(),le("div",{class:q([y.$style.inputWrapper,k(o)?y.$style.disabled:""]),"aria-labelledby":k(s),"aria-describedby":k(a)},[xt(ee("input",{type:"checkbox",id:k(r),class:q(y.$style.defaultCheckbox),"onUpdate:modelValue":w[0]||(w[0]=S=>b.value=S),name:t.name?t.name:null,value:m.value,ref_key:"checkboxInput",ref:h,disabled:k(o)},null,10,qT),[[ac,b.value]]),ee("span",{class:q(y.$style.checkbox),onClick:T},[be(k(In),{icon:"fa-solid fa-check",class:q(y.$style.check)},null,8,["class"])],2)],10,GT))}},ZT={$style:WT},YT=ht(KT,[["__cssModules",ZT]]);function od(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var XT={__locale:"en",days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviated_days:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviated_months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],am:"AM",pm:"PM"},JT=XT;const gl=od(JT),QT="zoa__dateambiguous__input",$T="zoa__dateambiguous__inputWrapper",ex="zoa__dateambiguous__disabled",tx="zoa__dateambiguous__datePopup",ix="zoa__dateambiguous__popupSection",nx="zoa__dateambiguous__yearGrid",rx="zoa__dateambiguous__monthGrid",sx="zoa__dateambiguous__dayGrid",ox="zoa__dateambiguous__editing",ax="zoa__dateambiguous__suggestion",lx="zoa__dateambiguous__dateRange",ux="zoa__dateambiguous__yearParts",cx={input:QT,inputWrapper:$T,disabled:ex,datePopup:tx,popupSection:ix,yearGrid:nx,monthGrid:rx,dayGrid:sx,editing:ox,suggestion:ax,dateRange:lx,yearParts:ux},hx=["aria-labelledby","aria-describedby"],fx=["placeholder","id","disabled"],dx=["onClick","onKeydown"],px={__name:"DateAmbiguous",props:{modelValue:{type:Object},delay:{type:Number,default:200},placeholder:{type:String,default:null},min:{type:String,default:"1582-01-01"},max:{type:String,default:"today"}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=()=>Promise.resolve().then(()=>cR),s=ye("inputId"),a=ye("labelId"),o=ye("helpId"),l=ye("disabled"),{valueChanged:u}=Rt(e,n.delay),c=Y(()=>{let I;try{I=new Date(n.min==="today"?Date.now():Date.parse(n.min||"0000-01-01"))}catch{I=new Date(0,0,1)}return{year:I.getUTCFullYear(),month:I.getUTCMonth()+1,day:I.getUTCDate(),date:I}}),h=Y(()=>{let I;try{I=new Date(n.max==="today"?Date.now():Date.parse(n.max||"9999-12-31"))}catch{I=new Date(9999,11,31)}return{year:I.getUTCFullYear(),month:I.getUTCMonth()+1,day:I.getUTCDate(),date:I}}),f=$(null),p=ye("rootContainer"),m=$(null),b=$(null),T=$(null),y=$(null),w=$(null),S=$(null),C=$(null),L=$(!1),{focused:D}=ei(p);i({target:f});const j=On(m),N=ei(m),K=On(b),se=ei(b),ue=On(T),Se=ei(T),Re=Y(()=>{let I;return j.focused.value?I=m.value:K.focused.value?I=b.value:ue.focused.value&&(I=T.value),I}),Ee=Y(()=>{let I;return N.focused.value?I=m.value:se.focused.value?I=b.value:Se.focused.value&&(I=T.value),I});rt("Enter",()=>{Re&&Re.value.children[0].focus()}),rt("ArrowLeft",()=>{if(!Ee.value)return;const I=Ee.value.querySelector("button:focus");!I||!I.previousElementSibling?Ee.value.children[Ee.value.children.length-1].focus():I.previousElementSibling.focus()}),rt("ArrowRight",()=>{if(!Ee.value)return;const I=Ee.value.querySelector("button:focus");!I||!I.nextElementSibling?Ee.value.children[0].focus():I.nextElementSibling.focus()}),rt("Escape",()=>{const I=p.value.querySelector("*:focus");I&&I.blur()});function Me(I,F,V){I.value&&(I.value.target.onkeyup=X=>{/^[0-9]$/.test(X.key)&&F?F.value.focus():X.key==="Backspace"&&V&&V.value.focus()})}gu(()=>{Me(y,w,null),Me(w,S,y),Me(S,C,w),Me(C,null,S)});const ge=Y(()=>({year:Ae.value,month:_.value,day:z.value,earliest:`${U.value.lower.year.toString().padStart(4,"0")}-${U.value.lower.month.toString().padStart(2,"0")}-${U.value.lower.day.toString().padStart(2,"0")}`,latest:`${U.value.upper.year.toString().padStart(4,"0")}-${U.value.upper.month.toString().padStart(2,"0")}-${U.value.upper.day.toString().padStart(2,"0")}`})),ne=Y(()=>te(ge.value.year,ge.value.month,ge.value.day)),U=Y(()=>{let I,F;if(!oe.value)I=c.value.year,F=h.value.year;else{const J=10**(4-(Math.max(...W.map((at,et)=>isNaN(parseInt(Te.value[at]))?-1:et))+1)),fe=Ce(Te.value,4),xe=Math.floor(c.value.year/J)*J,pe=Math.floor(h.value.year/J)*J;fepe?(I=c.value.year,F=h.value.year):fe===xe?(I=c.value.year,F=fe+J-1):fe===pe?(I=fe,F=h.value.year):(I=fe,F=fe+J-1)}const V=I===c.value.year,X=F===h.value.year,me=V?Math.max(c.value.month,d.value||1):d.value||1,v=X?Math.min(h.value.month,d.value||12):d.value||12,g=me===c.value.month,x=v===h.value.month;let E=H.value||1,B=H.value||M(v);return E=V&&g?Math.max(E,c.value.day):E,B=X&&x?Math.min(B,h.value.day):B,I===F&&me===v&&(X&&x&&E>B&&(E=1),V&&g&&B=1,x=v||V<=M(F);if(X||I>U.value.lower.year&&IU.value.upper.year)return{year:!1,month:g,day:x};let E=g,B=x;return I===U.value.lower.year&&(E=E&&(me||F>=U.value.lower.month),F===U.value.lower.month&&(B=B&&(v||V>=U.value.lower.day))),I===U.value.upper.year&&(E=E&&(me||F<=U.value.upper.month),F===U.value.upper.month&&(B=B&&(v||V<=U.value.upper.day))),{year:!0,month:E,day:B}}function ce(){f.value.value=ne.value,L.value=!1}const Q=$([]);function _e(I){L.value=!0,r().then(F=>{Q.value=F.parseDate(I.target.value)})}const He=Ws(_e,200);function Ve(I){Te.value=P(I.year),_.value=I.month,z.value=I.day,Q.value=[]}const Ae=Y(()=>{if(!oe.value)return null;const I=Ce(Te.value,4);return re(I,_.value,z.value).year?I:null}),Te=$({millenium:null,century:null,decade:null,year:null}),W=["millenium","century","decade","year"],oe=Y(()=>Object.values(Te.value).some(I=>!isNaN(parseInt(I)))),ae=Y(()=>{const I=P(U.value.lower.year),F={millenium:null,century:null,decade:null,year:null};if(c.value.year===h.value.year&&isNaN(parseInt(Te.value.year)))return[I];if(U.value.lower.year===U.value.upper.year)return[F];const V=P(U.value.upper.year);let X,me={...F};if(oe.value)X=Math.max(...W.map((x,E)=>(me[x]=Te.value[x],isNaN(parseInt(Te.value[x]))?-1:E)))+1;else for(let x=0;x{let pe={...me};return pe[E]=fe+xe,pe}).filter(fe=>{const xe=Ce(fe,x+1);return xe>=B&&xe<=J})}let g=v(X);return g.length===1&&X<3&&(me={...g[0]},g=v(X+1)),oe.value&&g.push(F),g}),he=Y(()=>Ae.value%100===0?Ae.value%400===0:Ae.value%4===0);function ke(I){return Object.values(I).every(F=>F==null)?"clear":W.map(F=>I[F]||0).join("")}function Ce(I,F){return W.slice(0,F).reduce((V,X,me)=>{let v=I[X]||0;return V+v*10**(3-me)},0)}function P(I){return{millenium:Math.floor(I/1e3),century:Math.floor(I%1e3/100),decade:Math.floor(I%100/10),year:Math.floor(I%10)}}function O(I){if(Te.value=I,Math.max(...W.map((F,V)=>isNaN(parseInt(Te.value[F]))?-1:V))===3){let F=re(Ae.value,_.value,z.value);(!F.month||!F.day)&&(_.value=null,z.value=null)}}const d=$(null),_=Y({get(){return re(Ae.value,d.value,z.value).month?d.value:null},set(I){d.value=isNaN(parseInt(I))?null:I,z.value&&z.value>A.value&&(z.value=A.value)}}),R=Y(()=>{let I=gl.abbreviated_months.map((V,X)=>[V,X+1]);const F=Ae.value?Ae.value:c.value.year===h.value.year?c.value.year:null;if(F===c.value.year&&(I=I.slice(c.value.month-1,I.length)),F===h.value.year){const V=12-I.length;I=I.slice(0,h.value.month-V)}return d.value&&I.push(["clear",null]),I}),A=Y(()=>M(_.value));function M(I){return[4,6,9,11].includes(I)?30:I===2?he.value?29:28:31}const H=$(null),z=Y({get(){const I=re(Ae.value,d.value,H.value);return I.month&&I.day?H.value:null},set(I){H.value=isNaN(parseInt(I))?null:I}}),G=Y(()=>{const I=Ae.value?Ae.value:c.value.year===h.value.year?c.value.year:null,F=_.value?_.value:c.value.year===h.value.year&&c.value.month===h.value.month?c.value.month:null,V=M(F);let X=Array(V).fill(1).map((me,v)=>v+1);if(I===c.value.year&&!isNaN(parseInt(F))&&F<=c.value.month&&(X=X.slice(c.value.day-1)),I===h.value.year&&!isNaN(parseInt(F))&&F>=h.value.month){const me=V-X.length;X=X.slice(0,h.value.day-me)}return H.value&&X.push(null),X});function te(I,F,V){const X=gl.abbreviated_months[F-1];return I&&F&&V?`${V} ${X} ${I}`:I&&F?`${X} ${I}`:I&&V?`${V} ??? ${I}`:F&&V?`${V} ${X}`:I||(F?X:V?`day ${V}`:null)}return $e(ge,()=>{ce(),u(ge.value)}),(I,F)=>(ie(),le("div",{class:q([I.$style.inputWrapper,k(l)?I.$style.disabled:""]),"aria-labelledby":k(a),"aria-describedby":k(o)},[ee("input",{type:"text",placeholder:t.placeholder,id:k(s),class:q([I.$style.input,L.value?I.$style.editing:""]),ref_key:"displayBox",ref:f,onInput:F[0]||(F[0]=(...V)=>k(He)&&k(He)(...V)),disabled:k(l)},null,42,fx),k(D)&&!k(l)?(ie(),le("div",{key:0,class:q(I.$style.datePopup)},[Q.value.length>0?(ie(),le("div",{key:0,class:q(I.$style.popupSection)},[(ie(!0),le(De,null,yt(Q.value,V=>(ie(),le("span",{onClick:X=>Ve(V),onKeydown:lg(X=>Ve(V),["enter"]),class:q(I.$style.suggestion),tabindex:"0"},Oe(te(V.year,V.month,V.day)),43,dx))),256))],2)):qe("",!0),ee("div",{class:q(I.$style.popupSection)},[be(k(st),{label:"year","grid-class":I.$style.yearParts},{default:ut(()=>[be(k(st),{"zoa-type":"number",label:"millenium","label-position":"none",options:{placeholder:0,min:0,max:9},modelValue:Te.value.millenium,"onUpdate:modelValue":F[1]||(F[1]=V=>Te.value.millenium=V),ref_key:"yrM",ref:y},null,8,["modelValue"]),be(k(st),{"zoa-type":"number",label:"century","label-position":"none",options:{placeholder:0,min:0,max:9},modelValue:Te.value.century,"onUpdate:modelValue":F[2]||(F[2]=V=>Te.value.century=V),ref_key:"yrC",ref:w},null,8,["modelValue"]),be(k(st),{"zoa-type":"number",label:"decade","label-position":"none",options:{placeholder:0,min:0,max:9},modelValue:Te.value.decade,"onUpdate:modelValue":F[3]||(F[3]=V=>Te.value.decade=V),ref_key:"yrD",ref:S},null,8,["modelValue"]),be(k(st),{"zoa-type":"number",label:"year","label-position":"none",options:{placeholder:0,min:0,max:9},modelValue:Te.value.year,"onUpdate:modelValue":F[4]||(F[4]=V=>Te.value.year=V),ref_key:"yrY",ref:C},null,8,["modelValue"])]),_:1},8,["grid-class"]),ee("div",{class:q(I.$style.yearGrid),tabindex:"0",ref_key:"yearBtns",ref:m},[(ie(!0),le(De,null,yt(ae.value,V=>(ie(),bt(k(Vt),{size:"sm",onClick:X=>O(V),tabindex:"-1"},{default:ut(()=>[mt(Oe(ke(V)),1)]),_:2},1032,["onClick"]))),256))],2)],2),ee("div",{class:q(I.$style.popupSection)},[be(k(st),{"zoa-type":"number",label:"month",options:{placeholder:1,min:1,max:12},modelValue:_.value,"onUpdate:modelValue":F[5]||(F[5]=V=>_.value=V)},null,8,["modelValue"]),ee("div",{class:q(I.$style.monthGrid),tabindex:"0",ref_key:"monthBtns",ref:b},[(ie(!0),le(De,null,yt(R.value,V=>(ie(),bt(k(Vt),{size:"sm",onClick:X=>_.value=V[1],tabindex:"-1"},{default:ut(()=>[mt(Oe(V[0]),1)]),_:2},1032,["onClick"]))),256))],2)],2),ee("div",{class:q(I.$style.popupSection)},[be(k(st),{"zoa-type":"number",label:"day",options:{placeholder:1,min:1,max:A.value},modelValue:z.value,"onUpdate:modelValue":F[6]||(F[6]=V=>z.value=V)},null,8,["options","modelValue"]),ee("div",{class:q(I.$style.dayGrid),tabindex:"0",ref_key:"dayBtns",ref:T},[(ie(!0),le(De,null,yt(G.value,V=>(ie(),bt(k(Vt),{size:"sm",onClick:X=>z.value=V,tabindex:"-1"},{default:ut(()=>[mt(Oe(V||"clear"),1)]),_:2},1032,["onClick"]))),256))],2)],2),ee("div",{class:q(I.$style.popupSection)},[ee("small",{class:q(I.$style.dateRange)},Oe(ge.value.earliest)+" to "+Oe(ge.value.latest),3)],2)],2)):qe("",!0)],10,hx))}},mx={$style:cx},gx=ht(px,[["__cssModules",mx]]),vx="zoa__datesimple__input",yx="zoa__datesimple__inputWrapper",bx="zoa__datesimple__disabled",wx={input:vx,inputWrapper:yx,disabled:bx},_x=["aria-labelledby","aria-describedby"],Tx=["placeholder","min","max","step","id","disabled"],xx={__name:"DateSimple",props:{modelValue:{type:Object},delay:{type:Number,default:200},placeholder:{type:String,default:null},min:{type:String,default:null},max:{type:String,default:null},step:{type:[String,Number],default:"any"}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=ye("inputId"),s=ye("labelId"),a=ye("helpId"),o=ye("disabled"),{value:l}=Rt(e,n),u=$(null);return i({target:u}),(c,h)=>(ie(),le("div",{class:q([c.$style.inputWrapper,k(o)?c.$style.disabled:""]),"aria-labelledby":k(s),"aria-describedby":k(a)},[xt(ee("input",{type:"date",placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,id:k(r),class:q(c.$style.input),"onUpdate:modelValue":h[0]||(h[0]=f=>ze(l)?l.value=f:null),ref_key:"target",ref:u,disabled:k(o)},null,10,Tx),[[dn,k(l)]])],10,_x))}},Sx={$style:wx},Ex=ht(xx,[["__cssModules",Sx]]),Px="zoa__dropdown__input",Rx="zoa__dropdown__inputWrapper",Cx="zoa__dropdown__arrow",Ox="zoa__dropdown__disabled",Ix={input:Px,inputWrapper:Rx,arrow:Cx,disabled:Ox},Ax=["aria-labelledby","aria-describedby"],kx=["id","disabled"],Dx={value:null},Mx=["value"],Nx={__name:"Dropdown",props:{modelValue:{type:String},delay:{type:Number,default:0},placeholder:{type:String,default:"Please choose an option"},options:{type:Array}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=ye("inputId"),s=ye("labelId"),a=ye("helpId"),o=ye("disabled"),l=Y(()=>{let h=[];return n.options.forEach(f=>{typeof f=="object"?h.push({label:f.label||f.value,value:f.value||f.label,order:f.order==null?null:f.order}):h.push({label:f,value:f})}),h.sort((f,p)=>{let m=0;(f.order!=null||p.order!=null)&&(m=f.order!=null&&p.order!=null?f.order-p.order:f.order!=null?-1:1);let b=f.label.localeCompare(p.label);return m!==0?m:b}),h}),{value:u}=Rt(e,n),c=$(null);return i({target:c}),(h,f)=>(ie(),le("div",{class:q([h.$style.inputWrapper,k(o)?h.$style.disabled:""]),"aria-labelledby":k(s),"aria-describedby":k(a)},[xt(ee("select",{id:k(r),class:q(h.$style.input),"onUpdate:modelValue":f[0]||(f[0]=p=>ze(u)?u.value=p:null),ref_key:"target",ref:c,disabled:k(o)},[ee("option",Dx,Oe(t.placeholder),1),(ie(!0),le(De,null,yt(l.value,p=>(ie(),le("option",{value:p.value},Oe(p.label),9,Mx))),256))],10,kx),[[og,k(u)]]),be(k(In),{icon:"fa-solid fa-caret-down",class:q(h.$style.arrow)},null,8,["class"])],10,Ax))}},Lx={$style:Ix},Fx=ht(Nx,[["__cssModules",Lx]]);function*zx(t,i,e=0,n=null){if(t.length===0)return;n===null&&(n=i.length);let r;for(;(r=i.indexOf(t,e))>-1&&!(r+t.length>n);)yield r,e=r+1}function Hx(t){return t.split("").reverse().join("")}var Bx={searchExact:zx,reverse:Hx};const{searchExact:ad,reverse:ld}=Bx;function Ux(t,i,e){t.length>i.length&&([t,i]=[i,t]);const n=i.length-t.length;if(n>e)return!1;if(e===0)return t===i;let r;for(r=0;r=0&&t[s]===i[s+n];s--);t=t.slice(r,s+1),i=i.slice(r,s+1+n);const[a,o]=qs(t,i,e);return a+(i.length-o)<=e}function Vx(t,i){t.length>i.length&&([t,i]=[i,t]);const e=new Array(t.length+1);for(let s=0;s<=t.length;s++)e[s]=s;let n,r;for(let s=0;s=0;n--)e[t[n]]=n;return e}function*Wx(t,i,e){if(t.length>i.length+e)return;const n=Math.floor(t.length/(e+1));if(e===0)for(const r of ad(t,i))yield{start:r,end:r+t.length,dist:0};else n>=10?yield*ud(t,i,e):yield*cd(t,i,e)}function qs(t,i,e){e=+e;let n;for(n=0;nr+e)return;const s=jx(t,e);let a=[],o=[];for(let l=0;l{e("search",U)},n.searchDelay),f=Ws(U=>{c.value=U},n.searchDelay),p=Y({get(){return c.value},set(U){f(U),h(U)}}),m=Y(()=>!u.value||u.value.length!==1?n.itemNamePlural||n.itemName+"s":n.itemName),b=Y(()=>{let U=[];return n.options.forEach(re=>{typeof re=="object"?U.push({label:re.label||re.value,value:re.value||re.label,group:re.group||null,order:re.order==null?null:re.order}):U.push({label:re,value:re,group:null})}),U.sort((re,ce)=>{let Q;re.group===ce.group?Q=0:!re.group||!ce.group?Q=re.group?1:-1:Q=re.group.localeCompare(ce.group);let _e=0;(re.order!=null||ce.order!=null)&&(_e=re.order!=null&&ce.order!=null?re.order-ce.order:re.order!=null?-1:1);let He=re.label.localeCompare(ce.label);return Q!==0?Q:_e!==0?_e:He}),U}),T=Y(()=>{const U=n.enableSearch&&p.value,re=U?p.value.toLowerCase():null,ce=Ae=>Ae?[...Yx.fuzzySearch(re,Ae.toLowerCase(),1)].length>0:!1;let Q;U?Q=b.value.filter(Ae=>ce(Ae.group)||ce(Ae.label)||ce(Ae.value)):Q=b.value;let _e=[],He=Object.entries(Object.groupBy(Q,({group:Ae})=>Ae)),Ve=re?2:1;return He.forEach(Ae=>{let Te=Ae[0],W=Ae[1];Te&&Te!=="null"&&(_e.push({ix:Ve,kind:"group",label:Te,value:Te,group:Te}),Ve+=1),_e=_e.concat(W.map((oe,ae)=>({ix:Ve+ae,kind:"option",label:oe.label,value:oe.value,group:oe.group}))),Ve+=W.length}),_e}),y=$(null),w=$(null),S=$(null);i({target:w});const{y:C}=M0(S),L=Y(()=>!S.value||S.value&&C.value!==S.value.scrollTop?0:C.value),D=Y(()=>{try{return S.value.clientHeight}catch{return 500}}),j=Y(()=>T.value.lengthT.value.length{w.value.focus()},50)}function Re(){try{y.value.blur(),w.value.blur(),S.value.blur()}catch{}K.value=!1}function Ee(){K.value?Re():Se()}pl(y,()=>{Re()}),rt("ArrowDown",()=>{if(b.value.length!==0){if(se.focused.value)S.value.children[0].children[0].children[0].focus();else if(ue.focused.value){const U=[...S.value.querySelectorAll("label")],re=S.value.querySelector("label:focus");if(!re)U[0].focus();else{const ce=U.findIndex(Q=>Q===re);ce===U.length-1?U[0].focus():U[ce+1].focus()}}}}),rt("ArrowUp",()=>{if(b.value.length!==0&&ue.focused.value){const U=[...S.value.querySelectorAll("label")],re=S.value.querySelector("label:focus");if(!re)w.value.focus();else{const ce=U.findIndex(Q=>Q===re);ce===0?w.value.focus():U[ce-1].focus()}}}),rt("Enter",()=>{Re()});const Me=Y({get(){const U=b.value;return u.value==null||u.value.length!==U.length?!1:U.filter(re=>!u.value.includes(re.value)).length===0},set(U){U?u.value=b.value.map(re=>re.value):u.value=[]}}),ge=Y({get(){let U=T.value.filter(re=>re.kind==="option").map(re=>re.value);return u.value==null||u.value.length!u.value.includes(re)).length===0},set(U){let re=T.value.filter(_e=>_e.kind==="option").map(_e=>_e.value);const ce=u.value?u.value:[],Q=re.filter(_e=>!ce.includes(_e));U?u.value=ce.concat(Q):u.value=ce.filter(_e=>!re.includes(_e))}});function ne(U){const re=T.value.filter(Q=>Q.kind==="option"&&Q.group===U).map(Q=>Q.value);u.value=u.value?u.value:[];const ce=re.filter(Q=>!u.value.includes(Q));ce.length>0?ce.forEach(Q=>{u.value.push(Q)}):u.value=u.value.filter(Q=>!re.includes(Q))}return(U,re)=>(ie(),le("div",{class:q([U.$style.inputWrapper,k(l)?U.$style.disabled:""]),ref_key:"container",ref:y,"aria-labelledby":k(a),"aria-describedby":k(o)},[ee("div",{class:q(U.$style.textboxWrapper)},[xt(ee("input",{type:"text",placeholder:t.placeholder,id:k(r),class:q(U.$style.input),"onUpdate:modelValue":re[0]||(re[0]=ce=>p.value=ce),ref_key:"textbox",ref:w,disabled:k(l)},null,10,c1),[[dn,p.value],[us,K.value&&!k(l)]]),xt(ee("div",{class:q(U.$style.input),tabindex:"0",onFocusin:Se},Oe(k(u)?k(u).length:0)+" "+Oe(m.value)+" selected ",35),[[us,!K.value||k(l)]]),be(k(In),{icon:"fa-solid fa-caret-down",class:q(U.$style.arrow),onClick:Ee},null,8,["class"])],2),K.value&&!k(l)?(ie(),le("div",{key:0,class:q(U.$style.options),ref_key:"dropdown",ref:S},[b.value.length>0?(ie(),le("ul",{key:0,class:q(U.$style.optlist)},[ee("li",{title:"Select all",class:q([U.$style.selectAll,U.$style.listItem,U.$style.option]),style:qt({height:`${t.itemHeight}px`})},[be(k(st),{"zoa-type":"checkbox",label:"Select all","label-position":"right",modelValue:Me.value,"onUpdate:modelValue":re[1]||(re[1]=ce=>Me.value=ce)},null,8,["modelValue"])],6),c.value?(ie(),le("li",{key:0,title:"Select results",class:q([U.$style.selectAll,U.$style.listItem,U.$style.option]),style:qt({height:`${t.itemHeight}px`})},[be(k(st),{"zoa-type":"checkbox",label:"Select results","label-position":"right",modelValue:ge.value,"onUpdate:modelValue":re[2]||(re[2]=ce=>ge.value=ce)},null,8,["modelValue"])],6)):qe("",!0),(ie(!0),le(De,null,yt(T.value,ce=>(ie(),le("li",{title:ce.label,class:q([U.$style.listItem,ce.kind==="group"?U.$style.subgroup:U.$style.option]),style:qt({height:`${t.itemHeight}px`})},[ce.kind==="group"?(ie(),le("div",{key:0,onClick:Q=>ne(ce.group)},Oe(ce.label),9,f1)):(ie(),le("div",d1,[ce.ix>=j.value&&ce.ix<=N.value?(ie(),bt(k(st),{key:0,"zoa-type":"checkbox",label:ce.label,"label-position":"right",options:{checkValue:ce.value,name:k(s)("checkboxes")},modelValue:k(u),"onUpdate:modelValue":re[3]||(re[3]=Q=>ze(u)?u.value=Q:null)},null,8,["label","options","modelValue"])):qe("",!0)]))],14,h1))),256))],2)):(ie(),le("div",{key:1,class:q(U.$style.noOptions)},"No options found",2))],2)):qe("",!0)],10,u1))}},m1={$style:l1},g1=ht(p1,[["__cssModules",m1]]),v1="zoa__number__input",y1="zoa__number__inputWrapper",b1="zoa__number__disabled",w1={input:v1,inputWrapper:y1,disabled:b1},_1=["aria-labelledby","aria-describedby"],T1=["placeholder","min","max","step","id","disabled"],x1={__name:"Number",props:{modelValue:{type:Number},delay:{type:Number,default:200},placeholder:{type:Number,default:0},min:{type:Number,default:null},max:{type:Number,default:null},step:{type:Number,default:1}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=ye("inputId"),s=ye("labelId"),a=ye("helpId"),o=ye("disabled"),{value:l}=Rt(e,n),u=$(null);return i({target:u}),(c,h)=>(ie(),le("div",{class:q([c.$style.inputWrapper,k(o)?c.$style.disabled:""]),"aria-labelledby":k(s),"aria-describedby":k(a)},[xt(ee("input",{type:"number",placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,id:k(r),class:q(c.$style.input),"onUpdate:modelValue":h[0]||(h[0]=f=>ze(l)?l.value=f:null),ref_key:"target",ref:u,disabled:k(o)},null,10,T1),[[dn,k(l)]])],10,_1))}},S1={$style:w1},E1=ht(x1,[["__cssModules",S1]]),P1="zoa__rangeslider__input",R1="zoa__rangeslider__inputWrapper",C1={input:P1,inputWrapper:R1},O1=["aria-labelledby","aria-describedby"],I1={__name:"RangeSlider",props:{modelValue:{type:Array},delay:{type:Number,default:200},placeholder:{type:Number,default:null},min:{type:Number,default:0},max:{type:Number,default:100},step:{type:Number,default:1},labelLower:{type:String,default:"Lower"},labelUpper:{type:String,default:"Upper"},labelsRight:{type:Boolean,default:!1}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t;ye("inputId");const r=ye("labelId"),s=ye("helpId"),a=ye("disabled"),{valueChanged:o}=Rt(e,n),l=$(null),u=$(null),c=Y(()=>{if(l.value)return l.value.target}),h=Y(()=>l.value&&u.value?[l.value.target,u.value.target]:[]);i({target:c,elements:h});const f=$(null),p=$(null),m=Y(()=>Math.max(Number(p.value)-Number(n.step),Number(n.min))),b=Y(()=>Math.min(Number(f.value)+Number(n.step),Number(n.max))),T=Y(()=>{const y=Math.min(f.value,m.value),w=Math.max(p.value,b.value);return[y,w]});return $e(T,()=>{o(T.value)}),(y,w)=>(ie(),le("div",{class:q(y.$style.inputWrapper),"aria-labelledby":k(r),"aria-describedby":k(s)},[be(k(st),{"zoa-type":"slider",label:t.labelLower,"label-position":t.labelsRight?"right":"left",options:{min:t.min,max:t.max,step:t.step,validMax:m.value,valueLabelPosition:"above",placeholderPosition:.25},modelValue:f.value,"onUpdate:modelValue":w[0]||(w[0]=S=>f.value=S),ref:"lowerTrack",disabled:k(a)},null,8,["label","label-position","options","modelValue","disabled"]),be(k(st),{"zoa-type":"slider",label:t.labelUpper,"label-position":t.labelsRight?"right":"left",options:{min:t.min,max:t.max,step:t.step,validMin:b.value,placeholderPosition:.75,activeTrackRight:!0},modelValue:p.value,"onUpdate:modelValue":w[1]||(w[1]=S=>p.value=S),ref:"upperTrack",disabled:k(a)},null,8,["label","label-position","options","modelValue","disabled"])],10,O1))}},A1={$style:C1},k1=ht(I1,[["__cssModules",A1]]),D1="zoa__slider__input",M1="zoa__slider__inputWrapper",N1="zoa__slider__track",L1="zoa__slider__valueLabel",F1="zoa__slider__disabled",z1={input:D1,inputWrapper:M1,track:N1,"track--active":"zoa__slider__track--active",valueLabel:L1,"valueLabel--below":"zoa__slider__valueLabel--below","valueLabel--above":"zoa__slider__valueLabel--above",disabled:F1},H1=["aria-labelledby","aria-describedby"],B1=["min","max","step","id","disabled"],U1={__name:"Slider",props:{modelValue:{type:Number},delay:{type:Number,default:200},placeholder:{type:[Number,void 0],default:null},min:{type:Number,default:0},max:{type:Number,default:100},step:{type:Number,default:1},placeholderPosition:{type:Number,default:.5},valueLabelPosition:{type:String,default:"below"},validMin:{type:Number,default:null},validMax:{type:Number,default:null},activeTrackRight:{type:Boolean,default:!1}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=ye("inputId"),s=ye("labelId"),a=ye("helpId"),o=ye("disabled"),{value:l}=Rt(e,n),u=$(null),c=$(null);i({target:u});const h=Y(()=>n.validMin?Math.max(Number(n.validMin),Number(n.min)):Number(n.min)),f=Y(()=>n.validMax?Math.min(Number(n.validMax),Number(n.max)):Number(n.max)),p=ei(u),m=On(c),b=Y(()=>l.valuef.value?f.value:l.value),T=Y(()=>n.activeTrackRight?{left:`${w.value.handle}%`}:{right:`${100-w.value.handle}%`}),y=Y(()=>(l.value-n.min)/(n.max-n.min)),w=Y(()=>S());function S(){try{const N=u.value.clientWidth,K=24;c.value&&(c.value.innerText=b.value);const se=c.value?c.value.clientWidth:0,ue=N/2,Se=(y.value*N-ue)/ue*(K/2),Re=Se+se/2,Ee=Se/N;return{handle:((y.value-Ee)*100).toFixed(2),label:((y.value-Re/N)*100).toFixed(2)}}catch{const N=y.value*100;return{handle:N.toFixed(2),label:N.toFixed(2)}}}function C(){if(n.placeholder!==null&&n.placeholder!==void 0)return n.placeholder;let N=(n.max-n.min)/(1/n.placeholderPosition),K=N%n.step;return N-K+n.min}function L(){if(l.value===n.max)return;let N=Number(l.value)+Number(n.step);N>n.max?l.value=n.max:l.value=N}function D(){if(l.value===n.min)return;let N=Number(l.value)-Number(n.step);N0?L():N.wheelDelta<0&&D()}return rt("ArrowDown",N=>{N.preventDefault(),(p.focused.value||m.focused.value)&&D()}),rt("ArrowLeft",N=>{N.preventDefault(),(p.focused.value||m.focused.value)&&D()}),rt("ArrowUp",N=>{N.preventDefault(),(p.focused.value||m.focused.value)&&L()}),rt("ArrowRight",N=>{N.preventDefault(),(p.focused.value||m.focused.value)&&L()}),$e(l,N=>{Number(N)>=Number(f.value)&&(l.value=f.value),Number(N)<=Number(h.value)&&(l.value=h.value)}),l.value=C(),(N,K)=>(ie(),le("div",{class:q([N.$style.inputWrapper,,k(o)?N.$style.disabled:""]),onWheel:j,"aria-labelledby":k(s),"aria-describedby":k(a)},[ee("span",{class:q(N.$style.track)},null,2),ee("span",{class:q([N.$style.track,N.$style["track--active"]]),style:qt(T.value)},null,6),ee("span",{class:q([N.$style.valueLabel,N.$style[`valueLabel--${t.valueLabelPosition}`]]),style:qt({left:`${w.value.label}%`}),ref_key:"valueLabel",ref:c,tabindex:"0"},Oe(b.value),7),xt(ee("input",{type:"range",min:t.min,max:t.max,step:t.step,id:k(r),class:q(N.$style.input),"onUpdate:modelValue":K[0]||(K[0]=se=>ze(l)?l.value=se:null),ref_key:"slider",ref:u,disabled:k(o)},null,10,B1),[[dn,k(l)]])],42,H1))}},V1={$style:z1},j1=ht(U1,[["__cssModules",V1]]),W1="zoa__textbox__input",G1="zoa__textbox__inputWrapper",q1="zoa__textbox__disabled",K1={input:W1,inputWrapper:G1,disabled:q1},Z1=["aria-labelledby","aria-describedby"],Y1=["placeholder","id","disabled"],X1={__name:"Textbox",props:{modelValue:{type:String},delay:{type:Number,default:200},placeholder:{type:[String,void 0],default:null}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=ye("inputId"),s=ye("labelId"),a=ye("helpId"),o=ye("disabled"),{value:l}=Rt(e,n),u=$(null);return i({target:u}),(c,h)=>(ie(),le("div",{class:q([c.$style.inputWrapper,k(o)?c.$style.disabled:""]),"aria-labelledby":k(s),"aria-describedby":k(a)},[xt(ee("input",{type:"text",placeholder:t.placeholder,id:k(r),class:q(c.$style.input),"onUpdate:modelValue":h[0]||(h[0]=f=>ze(l)?l.value=f:null),ref_key:"target",ref:u,disabled:k(o)},null,10,Y1),[[dn,k(l)]])],10,Z1))}},J1={$style:K1},Q1=ht(X1,[["__cssModules",J1]]),hd={checkbox:{component:YT,multi:!1,delay:0,tabLabel:!0},"date-ambiguous":{component:gx,multi:!1,delay:200},"date-simple":{component:Ex,multi:!1,delay:200},dropdown:{component:Fx,multi:!1,delay:0},multiselect:{component:g1,multi:!1,delay:0},empty:{component:null,multi:!0},number:{component:E1,multi:!1,delay:200},"range-slider":{component:k1,multi:!0,delay:200},slider:{component:j1,multi:!1,delay:200,wrapperProps:["valueLabelPosition"]},"autocomplete-textbox":{component:FT,multi:!1,delay:200},textbox:{component:Q1,multi:!1,delay:200}},$1="zoa__input__input",eS="zoa__input__inputWrapper",tS="zoa__input__rootWrapper",iS="zoa__input__checkbox",nS="zoa__input__slider",rS="zoa__input__emptyGrid",sS="zoa__input__fieldset",oS={input:$1,inputWrapper:eS,rootWrapper:tS,"rootWrapper--above":"zoa__input__rootWrapper--above","rootWrapper--help":"zoa__input__rootWrapper--help","rootWrapper--below":"zoa__input__rootWrapper--below","rootWrapper--left":"zoa__input__rootWrapper--left","rootWrapper--right":"zoa__input__rootWrapper--right","rootWrapper--none":"zoa__input__rootWrapper--none",checkbox:iS,slider:nS,"rootWrapper-valueLabelPosition--below":"zoa__input__rootWrapper-valueLabelPosition--below","rootWrapper-valueLabelPosition--above":"zoa__input__rootWrapper-valueLabelPosition--above","range-slider":"zoa__input__range-slider",emptyGrid:rS,fieldset:sS},aS=["id"],lS={__name:"Input",props:{modelValue:{default:void 0},zoaType:{type:String,default:"empty"},class:{type:[String,Array,null],default:null},label:{type:String,default:"Input"},labelPosition:{type:String,default:"above"},options:{type:Object,default:()=>({})},gridClass:{type:[String,Array,null],default:null},help:{type:[String,null],default:null},helpPosition:{type:String,default:"right"},disabled:{type:Boolean,default:!1}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=Y(()=>{let N=hd[n.zoaType];return N==null&&(N=hd.empty),N}),s=Y(()=>r.value.component),{componentId:a,subId:o}=dl(),l=o("input"),u=o("label"),c=o("help"),h=Y(()=>{let N=["rootWrapper",`rootWrapper--${n.labelPosition}`,n.zoaType];return n.help&&N.push("rootWrapper--help"),r.value.wrapperProps&&r.value.wrapperProps.forEach(K=>{n.options[K]!=null&&N.push(`rootWrapper-${K}--${n.options[K]}`)}),N}),{addPropClasses:f}=Sr(n),{value:p}=Rt(e,n),m=$(null),b=Y(()=>n.label),T=Y(()=>n.labelPosition),y=Y(()=>n.help?c:null),w=Y(()=>n.disabled);St("label",b),St("labelPosition",T),St("componentId",a),St("subId",o),St("inputId",l),St("labelId",u),St("helpId",y),St("rootContainer",m),St("disabled",w);const S=$(null);function C(){S.value&&S.value.target.focus()}function L(){S.value&&S.value.target.blur()}const D=Y(()=>{if(S.value)return S.value.target}),j=Y(()=>S.value&&S.value.elements?S.value.elements:{});return i({focus:C,blur:L,target:D,elements:j}),(N,K)=>(ie(),le("div",{id:k(a),ref_key:"rootContainer",ref:m,class:q(k(f)(h.value.map(se=>N.$style[se])))},[r.value.multi?(ie(),le("fieldset",{key:0,class:q(N.$style.fieldset)},[be($f,{"input-id":k(l),legend:!0,label:t.label,"label-position":t.labelPosition,tabbable:r.value.tabLabel},null,8,["input-id","label","label-position","tabbable"]),t.help?(ie(),bt(sd,{key:0,text:t.help,position:t.helpPosition},null,8,["text","position"])):qe("",!0),s.value==null?(ie(),le("div",{key:1,class:q([t.gridClass||N.$style.emptyGrid,N.$style.inputWrapper])},[Ei(N.$slots,"default")],2)):(ie(),bt(k(s),ns({key:2},t.options,{modelValue:k(p),"onUpdate:modelValue":K[0]||(K[0]=se=>ze(p)?p.value=se:null),ref_key:"inputComponent",ref:S}),null,16,["modelValue"]))],2)):(ie(),le(De,{key:1},[be($f,{"input-id":k(l),legend:!1,label:t.label,"label-position":t.labelPosition,tabbable:r.value.tabLabel,help:t.help},null,8,["input-id","label","label-position","tabbable","help"]),t.help?(ie(),bt(sd,{key:0,text:t.help,position:t.helpPosition},null,8,["text","position"])):qe("",!0),be(k(s),ns(t.options,{modelValue:k(p),"onUpdate:modelValue":K[1]||(K[1]=se=>ze(p)?p.value=se:null),ref_key:"inputComponent",ref:S}),null,16,["modelValue"])],64))],10,aS))}},uS={$style:oS},st=ht(lS,[["__cssModules",uS]]);function cS(t){return{icon:Y(()=>{switch(t.kind){case"info":return"fa-circle-info";case"warning":return"fa-circle-exclamation";case"error":return"fa-circle-xmark";case"success":return"fa-circle-check";default:return"fa-circle-question"}})}}const hS="zoa__modal__main",fS="zoa__modal__container",dS="zoa__modal__header",pS="zoa__modal__icon",mS="zoa__modal__headerText",gS="zoa__modal__content",vS="zoa__modal__form",yS="zoa__modal__close",bS={main:hS,container:fS,header:dS,icon:pS,headerText:mS,content:gS,"kind--info":"zoa__modal__kind--info","kind--warning":"zoa__modal__kind--warning","kind--error":"zoa__modal__kind--error","kind--success":"zoa__modal__kind--success",form:vS,close:yS},wS={__name:"Modal",props:{class:{type:[String,Array,null],default:null},kind:{type:String,default:"info"},header:{type:String,default:"Here is an informational message."},message:{type:String,default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Duis at tellus at urna condimentum."},buttonArgs:{type:Object,default:()=>({label:"Open modal"})}},emits:["opened","closed"],setup(t,{emit:i}){const e=t,{icon:n}=cS(e),{addPropClasses:r}=Sr(e),s=$(null);function a(){s.value.show(),i("opened")}return pl(s,()=>{s.value.close(),i("closed")}),(o,l)=>(ie(),le(De,null,[be(k(Vt),ns(t.buttonArgs,{onClick:a}),{default:ut(()=>[Ei(o.$slots,"button")]),_:3},16),ee("dialog",{ref_key:"modal",ref:s,class:q(k(r)([o.$style.main,o.$style[`kind--${t.kind}`]]))},[ee("div",{class:q(o.$style.container)},[ee("div",{class:q(o.$style.header)},[be(k(In),{icon:["fa-solid",k(n)],class:q(o.$style.icon)},null,8,["icon","class"]),ee("h2",{class:q(o.$style.headerText)},[Ei(o.$slots,"header",{},()=>[mt(Oe(t.header),1)])],2),ee("form",{method:"dialog",class:q(o.$style.form),onSubmit:l[0]||(l[0]=u=>i("closed"))},[ee("button",{class:q(o.$style.close)},[be(k(In),{icon:"fa-solid fa-xmark"})],2)],34)],2),ee("div",{class:q(o.$style.content)},[Ei(o.$slots,"default",{},()=>[mt(Oe(t.message),1)])],2)],2)],2)],64))}},_S={$style:bS},TS=ht(wS,[["__cssModules",_S]]),xS={main:"liv_search__main",input:"liv_search__input",buttons:"liv_search__buttons"},nn=(t,i)=>{const e=t.__vccOpts||t;for(const[n,r]of i)e[n]=r;return e},SS=nn({__name:"Search",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(t){const i=Qu(t,"modelValue"),e=zi(),n=qf(),r=$(null),s=$([]),a=Y(()=>e.resourceRepo.all().map(S=>({label:S.name,value:S.id,group:S.packageName}))),o=Y(()=>s.value.map(S=>e.resourceRepo.find(S)).filter(S=>S!=null)),l=Y(()=>o.value.length>0?o.value.every(S=>S.dwc||S.id==="bb909597-dedf-427d-8c04-4c02b3a24db3"):!1),u=$(null),c=["scientificName","currentScientificName","kingdom","phylum","class","order","family","genus","specificEpithet","infraspecificEpithet","higherClassification"],h=$([]),f=$([{value:"Type",order:0},{value:"Non-type",order:1},{value:"Paratype",order:2},{value:"Holotype",order:3},{value:"Syntype",order:4},{value:"Isotype",order:5},{value:"Lectotype",order:6},{value:"Paralectotype",order:7},{value:"Original material",order:8},{value:"Isolectotype",order:9},{value:"Cotype",order:10},{value:"Figured",order:11},{value:"Isosyntype",order:12}]),p=$([]),m=$([{value:"Drawer scan",order:0},{value:"Specimen",order:1},{value:"Register",order:2},{value:"Label",order:3},{value:"Document",order:4},{value:"Other",order:5}]);function b(S,C,L="string_equals"){if(S.length===1){let D={};return D[L]={fields:C,value:S[0]},D}else return{or:S.map(D=>{let j={};return j[L]={fields:C,value:D},j})}}function T(){let S={query:{},resource_ids:[...e.query.resource_ids]},C={};n.mode.enableFilters&&(r.value&&(S.query.search=r.value),l.value&&((u.value||h.value||p.value)&&(S.query.filters={and:[]}),u.value&&S.query.filters.and.push(b([u.value],c,"string_contains")),h.value.length>0&&S.query.filters.and.push(b(h.value,["typeStatus","materialType"])),p.value.length>0&&(S.query.filters.and.push(b(p.value,["associatedMedia.category"])),C.category=p.value))),n.mode.enableResources&&(S.resource_ids=[...s.value]),e.setQuery(S,C),i.value=!1}function y(){if(e.query.query&&(r.value=e.query.query.search,e.query.query.filters&&e.query.query.filters.and)){let j=function(N){N.forEach(K=>{const se=Object.entries(K)[0];se[0]==="or"&&j(se[1]),se[0]==="string_equals"&&(se[1].fields[0]==="typeStatus"?S.push(se[1].value):se[1].fields[0]==="associatedMedia.category"?C.push(se[1].value):JSON.stringify(se[1].fields.sort())===D&&(L=se[1].value))})},S=[],C=[],L=null;const D=JSON.stringify(c.sort());j(e.query.query.filters.and),h.value=S,p.value=C,u.value=L}}function w(){r.value=null,u.value=null,h.value=[],p.value=[],n.mode.enableResources&&(s.value=[])}return Fi.on(br.querySet,S=>{y()}),oi(()=>{s.value=[...e.query.resource_ids],setTimeout(y,200)}),(S,C)=>(ie(),le("div",{class:q(S.$style.main)},[k(n).mode&&k(n).mode.enableFilters?(ie(),le(De,{key:0},[be(k(st),{"zoa-type":"textbox",label:"Keywords",options:{placeholder:"Search everything"},modelValue:r.value,"onUpdate:modelValue":C[0]||(C[0]=L=>r.value=L),class:q(S.$style.input)},null,8,["modelValue","class"]),l.value?(ie(),le(De,{key:0},[be(k(st),{"zoa-type":"textbox",label:"Search taxa",options:{placeholder:"e.g. coleoptera"},modelValue:u.value,"onUpdate:modelValue":C[1]||(C[1]=L=>u.value=L),class:q(S.$style.input)},null,8,["options","modelValue","class"]),be(k(st),{"zoa-type":"multiselect",label:"Type status",options:{options:f.value,enableSearch:!0},modelValue:h.value,"onUpdate:modelValue":C[2]||(C[2]=L=>h.value=L),class:q(S.$style.input)},null,8,["options","modelValue","class"]),be(k(st),{"zoa-type":"multiselect",label:"Image category",options:{options:m.value,enableSearch:!0},modelValue:p.value,"onUpdate:modelValue":C[3]||(C[3]=L=>p.value=L),class:q(S.$style.input)},null,8,["options","modelValue","class"])],64)):qe("",!0)],64)):qe("",!0),k(n).mode&&k(n).mode.enableResources?(ie(),bt(k(st),{key:1,"zoa-type":"multiselect",label:"Resources",options:{options:a.value,enableSearch:!0},modelValue:s.value,"onUpdate:modelValue":C[4]||(C[4]=L=>s.value=L),class:q(S.$style.input)},null,8,["options","modelValue","class"])):qe("",!0),ee("div",{class:q(S.$style.buttons)},[be(k(Vt),{onClick:w},{default:ut(()=>[mt("Clear")]),_:1}),be(k(Vt),{onClick:T},{default:ut(()=>[mt("Apply")]),_:1})],2)],2))}},[["__cssModules",{$style:xS}]]),ES={resultsHeader:"liv_results__resultsHeader",status:"liv_results__status",viewTabs:"liv_results__viewTabs",buttons:"liv_results__buttons",resetButton:"liv_results__resetButton",filterButton:"liv_results__filterButton",noResults:"liv_results__noResults"},PS={key:0,class:"fas fa-spinner fa-spin fa-lg"},RS=ee("i",{class:"fas fa-undo-alt"},null,-1),CS=ee("span",{class:"sr-only"},"Reset to defaults",-1),fd=nn({__name:"Results",setup(t){const i=zi(),e=qf(),n=d0(),r=$l({gallery:bu({loader:()=>Promise.resolve().then(()=>mR)}),list:bu({loader:()=>Promise.resolve().then(()=>yR)})}),s=[{label:"Gallery",value:"gallery",order:0},{label:"List",value:"list",order:1}],a=$(null),o=Y(()=>r.value[a.value]),l=$(!1);function u(){n.push("/").then(()=>{window.location.reload()})}return oi(()=>{e.loadData()}),(c,h)=>(ie(),le("div",null,[ee("div",{class:q(c.$style.resultsHeader)},[ee("span",{class:q(c.$style.status)},"Loaded "+Oe(k(i).allImages.length)+" images from "+Oe(k(i).totalRecords)+" total records",3),k(i).state.loading?(ie(),le("i",PS)):qe("",!0)],2),ee("div",{class:q(c.$style.buttons)},[be(k(eT),{options:s,modelValue:a.value,"onUpdate:modelValue":h[0]||(h[0]=f=>a.value=f),class:q(c.$style.viewTabs)},null,8,["modelValue","class"]),be(k(Vt),{onClick:u,size:"sm",class:q(c.$style.resetButton)},{default:ut(()=>[RS,CS]),_:1},8,["class"]),k(e).mode&&!k(e).mode.lockAll?(ie(),bt(k(G0),{key:0,label:"Filters",modelValue:l.value,"onUpdate:modelValue":h[1]||(h[1]=f=>l.value=f),class:q(c.$style.filterButton)},null,8,["modelValue","class"])):qe("",!0)],2),(ie(),bt(wu,null,[l.value?(ie(),bt(SS,{key:0,modelValue:l.value,"onUpdate:modelValue":h[2]||(h[2]=f=>l.value=f)},null,8,["modelValue"])):qe("",!0)],1024)),k(i).totalRecords>0?(ie(),bt(wu,{key:0},[be(k(o))],1024)):k(i).state.attempted&&!k(i).state.loading?(ie(),le("div",{key:1,class:q(c.$style.noResults)}," No results. ",2)):qe("",!0)]))}},[["__cssModules",{$style:ES}]]),OS=h0({routes:[{path:"/",component:fd},{path:"/:mode*",component:fd}],history:C_("/image-viewer/")});var dd={exports:{}};(function(t){//! openseadragon 4.0.0 + */const En=typeof window<"u";function h_(t){return t.__esModule||t[Symbol.toStringTag]==="Module"}const Ue=Object.assign;function sl(t,i){const e={};for(const n in i){const r=i[n];e[n]=Ut(r)?r.map(t):t(r)}return e}const wr=()=>{},Ut=Array.isArray,f_=/\/$/,d_=t=>t.replace(f_,"");function ol(t,i,e="/"){let n,r={},s="",a="";const o=i.indexOf("#");let l=i.indexOf("?");return o=0&&(l=-1),l>-1&&(n=i.slice(0,l),s=i.slice(l+1,o>-1?o:i.length),r=t(s)),o>-1&&(n=n||i.slice(0,o),a=i.slice(o,i.length)),n=v_(n??i,e),{fullPath:n+(s&&"?")+s+a,path:n,query:r,hash:a}}function p_(t,i){const e=i.query?t(i.query):"";return i.path+(e&&"?")+e+(i.hash||"")}function wf(t,i){return!i||!t.toLowerCase().startsWith(i.toLowerCase())?t:t.slice(i.length)||"/"}function m_(t,i,e){const n=i.matched.length-1,r=e.matched.length-1;return n>-1&&n===r&&Pn(i.matched[n],e.matched[r])&&_f(i.params,e.params)&&t(i.query)===t(e.query)&&i.hash===e.hash}function Pn(t,i){return(t.aliasOf||t)===(i.aliasOf||i)}function _f(t,i){if(Object.keys(t).length!==Object.keys(i).length)return!1;for(const e in t)if(!g_(t[e],i[e]))return!1;return!0}function g_(t,i){return Ut(t)?Tf(t,i):Ut(i)?Tf(i,t):t===i}function Tf(t,i){return Ut(i)?t.length===i.length&&t.every((e,n)=>e===i[n]):t.length===1&&t[0]===i}function v_(t,i){if(t.startsWith("/"))return t;if(!t)return i;const e=i.split("/"),n=t.split("/"),r=n[n.length-1];(r===".."||r===".")&&n.push("");let s=e.length-1,a,o;for(a=0;a1&&s--;else break;return e.slice(0,s).join("/")+"/"+n.slice(a-(a===n.length?1:0)).join("/")}var _r;(function(t){t.pop="pop",t.push="push"})(_r||(_r={}));var Tr;(function(t){t.back="back",t.forward="forward",t.unknown=""})(Tr||(Tr={}));function y_(t){if(!t)if(En){const i=document.querySelector("base");t=i&&i.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),d_(t)}const b_=/^[^#]+#/;function w_(t,i){return t.replace(b_,"#")+i}function __(t,i){const e=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:i.behavior,left:n.left-e.left-(i.left||0),top:n.top-e.top-(i.top||0)}}const Us=()=>({left:window.pageXOffset,top:window.pageYOffset});function T_(t){let i;if("el"in t){const e=t.el,n=typeof e=="string"&&e.startsWith("#"),r=typeof e=="string"?n?document.getElementById(e.slice(1)):document.querySelector(e):e;if(!r)return;i=__(r,t)}else i=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(i):window.scrollTo(i.left!=null?i.left:window.pageXOffset,i.top!=null?i.top:window.pageYOffset)}function xf(t,i){return(history.state?history.state.position-i:-1)+t}const al=new Map;function x_(t,i){al.set(t,i)}function S_(t){const i=al.get(t);return al.delete(t),i}let E_=()=>location.protocol+"//"+location.host;function Sf(t,i){const{pathname:e,search:n,hash:r}=i,s=t.indexOf("#");if(s>-1){let o=r.includes(t.slice(s))?t.slice(s).length:1,l=r.slice(o);return l[0]!=="/"&&(l="/"+l),wf(l,"")}return wf(e,t)+n+r}function P_(t,i,e,n){let r=[],s=[],a=null;const o=({state:f})=>{const p=Sf(t,location),m=e.value,b=i.value;let T=0;if(f){if(e.value=p,i.value=f,a&&a===m){a=null;return}T=b?f.position-b.position:0}else n(p);r.forEach(y=>{y(e.value,m,{delta:T,type:_r.pop,direction:T?T>0?Tr.forward:Tr.back:Tr.unknown})})};function l(){a=e.value}function u(f){r.push(f);const p=()=>{const m=r.indexOf(f);m>-1&&r.splice(m,1)};return s.push(p),p}function c(){const{history:f}=window;f.state&&f.replaceState(Ue({},f.state,{scroll:Us()}),"")}function h(){for(const f of s)f();s=[],window.removeEventListener("popstate",o),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",o),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:l,listen:u,destroy:h}}function Ef(t,i,e,n=!1,r=!1){return{back:t,current:i,forward:e,replaced:n,position:window.history.length,scroll:r?Us():null}}function R_(t){const{history:i,location:e}=window,n={value:Sf(t,e)},r={value:i.state};r.value||s(n.value,{back:null,current:n.value,forward:null,position:i.length-1,replaced:!0,scroll:null},!0);function s(l,u,c){const h=t.indexOf("#"),f=h>-1?(e.host&&document.querySelector("base")?t:t.slice(h))+l:E_()+t+l;try{i[c?"replaceState":"pushState"](u,"",f),r.value=u}catch(p){console.error(p),e[c?"replace":"assign"](f)}}function a(l,u){const c=Ue({},i.state,Ef(r.value.back,l,r.value.forward,!0),u,{position:r.value.position});s(l,c,!0),n.value=l}function o(l,u){const c=Ue({},r.value,i.state,{forward:l,scroll:Us()});s(c.current,c,!0);const h=Ue({},Ef(n.value,l,null),{position:c.position+1},u);s(l,h,!1),n.value=l}return{location:n,state:r,push:o,replace:a}}function C_(t){t=y_(t);const i=R_(t),e=P_(t,i.state,i.location,i.replace);function n(s,a=!0){a||e.pauseListeners(),history.go(s)}const r=Ue({location:"",base:t,go:n,createHref:w_.bind(null,t)},i,e);return Object.defineProperty(r,"location",{enumerable:!0,get:()=>i.location.value}),Object.defineProperty(r,"state",{enumerable:!0,get:()=>i.state.value}),r}function O_(t){return typeof t=="string"||t&&typeof t=="object"}function Pf(t){return typeof t=="string"||typeof t=="symbol"}const Hi={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},Rf=Symbol("");var Cf;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(Cf||(Cf={}));function Rn(t,i){return Ue(new Error,{type:t,[Rf]:!0},i)}function mi(t,i){return t instanceof Error&&Rf in t&&(i==null||!!(t.type&i))}const Of="[^/]+?",I_={sensitive:!1,strict:!1,start:!0,end:!0},A_=/[.+*?^${}()[\]/\\]/g;function k_(t,i){const e=Ue({},I_,i),n=[];let r=e.start?"^":"";const s=[];for(const u of t){const c=u.length?[]:[90];e.strict&&!u.length&&(r+="/");for(let h=0;hi.length?i.length===1&&i[0]===80?1:-1:0}function M_(t,i){let e=0;const n=t.score,r=i.score;for(;e0&&i[i.length-1]<0}const N_={type:0,value:""},L_=/[a-zA-Z0-9_]/;function F_(t){if(!t)return[[]];if(t==="/")return[[N_]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function i(p){throw new Error(`ERR (${e})/"${u}": ${p}`)}let e=0,n=e;const r=[];let s;function a(){s&&r.push(s),s=[]}let o=0,l,u="",c="";function h(){u&&(e===0?s.push({type:0,value:u}):e===1||e===2||e===3?(s.length>1&&(l==="*"||l==="+")&&i(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),s.push({type:1,value:u,regexp:c,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):i("Invalid state to consume buffer"),u="")}function f(){u+=l}for(;o{a(w)}:wr}function a(c){if(Pf(c)){const h=n.get(c);h&&(n.delete(c),e.splice(e.indexOf(h),1),h.children.forEach(a),h.alias.forEach(a))}else{const h=e.indexOf(c);h>-1&&(e.splice(h,1),c.record.name&&n.delete(c.record.name),c.children.forEach(a),c.alias.forEach(a))}}function o(){return e}function l(c){let h=0;for(;h=0&&(c.record.path!==e[h].record.path||!Mf(c,e[h]));)h++;e.splice(h,0,c),c.record.name&&!kf(c)&&n.set(c.record.name,c)}function u(c,h){let f,p={},m,b;if("name"in c&&c.name){if(f=n.get(c.name),!f)throw Rn(1,{location:c});b=f.record.name,p=Ue(Af(h.params,f.keys.filter(w=>!w.optional).map(w=>w.name)),c.params&&Af(c.params,f.keys.map(w=>w.name))),m=f.stringify(p)}else if("path"in c)m=c.path,f=e.find(w=>w.re.test(m)),f&&(p=f.parse(m),b=f.record.name);else{if(f=h.name?n.get(h.name):e.find(w=>w.re.test(h.path)),!f)throw Rn(1,{location:c,currentLocation:h});b=f.record.name,p=Ue({},h.params,c.params),m=f.stringify(p)}const T=[];let y=f;for(;y;)T.unshift(y.record),y=y.parent;return{name:b,path:m,params:p,matched:T,meta:V_(T)}}return t.forEach(c=>s(c)),{addRoute:s,resolve:u,removeRoute:a,getRoutes:o,getRecordMatcher:r}}function Af(t,i){const e={};for(const n of i)n in t&&(e[n]=t[n]);return e}function B_(t){return{path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:void 0,beforeEnter:t.beforeEnter,props:U_(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}}}function U_(t){const i={},e=t.props||!1;if("component"in t)i.default=e;else for(const n in t.components)i[n]=typeof e=="object"?e[n]:e;return i}function kf(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function V_(t){return t.reduce((i,e)=>Ue(i,e.meta),{})}function Df(t,i){const e={};for(const n in t)e[n]=n in i?i[n]:t[n];return e}function Mf(t,i){return i.children.some(e=>e===t||Mf(t,e))}const Nf=/#/g,j_=/&/g,W_=/\//g,G_=/=/g,q_=/\?/g,Lf=/\+/g,K_=/%5B/g,Z_=/%5D/g,Ff=/%5E/g,Y_=/%60/g,zf=/%7B/g,X_=/%7C/g,Hf=/%7D/g,J_=/%20/g;function ll(t){return encodeURI(""+t).replace(X_,"|").replace(K_,"[").replace(Z_,"]")}function Q_(t){return ll(t).replace(zf,"{").replace(Hf,"}").replace(Ff,"^")}function ul(t){return ll(t).replace(Lf,"%2B").replace(J_,"+").replace(Nf,"%23").replace(j_,"%26").replace(Y_,"`").replace(zf,"{").replace(Hf,"}").replace(Ff,"^")}function $_(t){return ul(t).replace(G_,"%3D")}function e0(t){return ll(t).replace(Nf,"%23").replace(q_,"%3F")}function t0(t){return t==null?"":e0(t).replace(W_,"%2F")}function Vs(t){try{return decodeURIComponent(""+t)}catch{}return""+t}function i0(t){const i={};if(t===""||t==="?")return i;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let r=0;rs&&ul(s)):[n&&ul(n)]).forEach(s=>{s!==void 0&&(i+=(i.length?"&":"")+e,s!=null&&(i+="="+s))})}return i}function n0(t){const i={};for(const e in t){const n=t[e];n!==void 0&&(i[e]=Ut(n)?n.map(r=>r==null?null:""+r):n==null?n:""+n)}return i}const r0=Symbol(""),Uf=Symbol(""),js=Symbol(""),cl=Symbol(""),hl=Symbol("");function xr(){let t=[];function i(n){return t.push(n),()=>{const r=t.indexOf(n);r>-1&&t.splice(r,1)}}function e(){t=[]}return{add:i,list:()=>t.slice(),reset:e}}function Bi(t,i,e,n,r){const s=n&&(n.enterCallbacks[r]=n.enterCallbacks[r]||[]);return()=>new Promise((a,o)=>{const l=h=>{h===!1?o(Rn(4,{from:e,to:i})):h instanceof Error?o(h):O_(h)?o(Rn(2,{from:i,to:h})):(s&&n.enterCallbacks[r]===s&&typeof h=="function"&&s.push(h),a())},u=t.call(n&&n.instances[r],i,e,l);let c=Promise.resolve(u);t.length<3&&(c=c.then(l)),c.catch(h=>o(h))})}function fl(t,i,e,n){const r=[];for(const s of t)for(const a in s.components){let o=s.components[a];if(!(i!=="beforeRouteEnter"&&!s.instances[a]))if(s0(o)){const u=(o.__vccOpts||o)[i];u&&r.push(Bi(u,e,n,s,a))}else{let l=o();r.push(()=>l.then(u=>{if(!u)return Promise.reject(new Error(`Couldn't resolve component "${a}" at "${s.path}"`));const c=h_(u)?u.default:u;s.components[a]=c;const f=(c.__vccOpts||c)[i];return f&&Bi(f,e,n,s,a)()}))}}return r}function s0(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Vf(t){const i=ye(js),e=ye(cl),n=Y(()=>i.resolve(k(t.to))),r=Y(()=>{const{matched:l}=n.value,{length:u}=l,c=l[u-1],h=e.matched;if(!c||!h.length)return-1;const f=h.findIndex(Pn.bind(null,c));if(f>-1)return f;const p=jf(l[u-2]);return u>1&&jf(c)===p&&h[h.length-1].path!==p?h.findIndex(Pn.bind(null,l[u-2])):f}),s=Y(()=>r.value>-1&&l0(e.params,n.value.params)),a=Y(()=>r.value>-1&&r.value===e.matched.length-1&&_f(e.params,n.value.params));function o(l={}){return a0(l)?i[k(t.replace)?"replace":"push"](k(t.to)).catch(wr):Promise.resolve()}return{route:n,href:Y(()=>n.value.href),isActive:s,isExactActive:a,navigate:o}}const o0=Hn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:Vf,setup(t,{slots:i}){const e=Kt(Vf(t)),{options:n}=ye(js),r=Y(()=>({[Wf(t.activeClass,n.linkActiveClass,"router-link-active")]:e.isActive,[Wf(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:e.isExactActive}));return()=>{const s=i.default&&i.default(e);return t.custom?s:ls("a",{"aria-current":e.isExactActive?t.ariaCurrentValue:null,href:e.href,onClick:e.navigate,class:r.value},s)}}});function a0(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const i=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(i))return}return t.preventDefault&&t.preventDefault(),!0}}function l0(t,i){for(const e in i){const n=i[e],r=t[e];if(typeof n=="string"){if(n!==r)return!1}else if(!Ut(r)||r.length!==n.length||n.some((s,a)=>s!==r[a]))return!1}return!0}function jf(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Wf=(t,i,e)=>t??i??e,u0=Hn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:i,slots:e}){const n=ye(hl),r=Y(()=>t.route||n.value),s=ye(Uf,0),a=Y(()=>{let u=k(s);const{matched:c}=r.value;let h;for(;(h=c[u])&&!h.components;)u++;return u}),o=Y(()=>r.value.matched[a.value]);St(Uf,Y(()=>a.value+1)),St(r0,o),St(hl,r);const l=$();return $e(()=>[l.value,o.value,t.name],([u,c,h],[f,p,m])=>{c&&(c.instances[h]=u,p&&p!==c&&u&&u===f&&(c.leaveGuards.size||(c.leaveGuards=p.leaveGuards),c.updateGuards.size||(c.updateGuards=p.updateGuards))),u&&c&&(!p||!Pn(c,p)||!f)&&(c.enterCallbacks[h]||[]).forEach(b=>b(u))},{flush:"post"}),()=>{const u=r.value,c=t.name,h=o.value,f=h&&h.components[c];if(!f)return Gf(e.default,{Component:f,route:u});const p=h.props[c],m=p?p===!0?u.params:typeof p=="function"?p(u):p:null,T=ls(f,Ue({},m,i,{onVnodeUnmounted:y=>{y.component.isUnmounted&&(h.instances[c]=null)},ref:l}));return Gf(e.default,{Component:T,route:u})||T}}});function Gf(t,i){if(!t)return null;const e=t(i);return e.length===1?e[0]:e}const c0=u0;function h0(t){const i=H_(t.routes,t),e=t.parseQuery||i0,n=t.stringifyQuery||Bf,r=t.history,s=xr(),a=xr(),o=xr(),l=$l(Hi);let u=Hi;En&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=sl.bind(null,W=>""+W),h=sl.bind(null,t0),f=sl.bind(null,Vs);function p(W,oe){let ae,he;return Pf(W)?(ae=i.getRecordMatcher(W),he=oe):he=W,i.addRoute(he,ae)}function m(W){const oe=i.getRecordMatcher(W);oe&&i.removeRoute(oe)}function b(){return i.getRoutes().map(W=>W.record)}function T(W){return!!i.getRecordMatcher(W)}function y(W,oe){if(oe=Ue({},oe||l.value),typeof W=="string"){const O=ol(e,W,oe.path),d=i.resolve({path:O.path},oe),_=r.createHref(O.fullPath);return Ue(O,d,{params:f(d.params),hash:Vs(O.hash),redirectedFrom:void 0,href:_})}let ae;if("path"in W)ae=Ue({},W,{path:ol(e,W.path,oe.path).path});else{const O=Ue({},W.params);for(const d in O)O[d]==null&&delete O[d];ae=Ue({},W,{params:h(O)}),oe.params=h(oe.params)}const he=i.resolve(ae,oe),ke=W.hash||"";he.params=c(f(he.params));const Ce=p_(n,Ue({},W,{hash:Q_(ke),path:he.path})),P=r.createHref(Ce);return Ue({fullPath:Ce,hash:ke,query:n===Bf?n0(W.query):W.query||{}},he,{redirectedFrom:void 0,href:P})}function w(W){return typeof W=="string"?ol(e,W,l.value.path):Ue({},W)}function S(W,oe){if(u!==W)return Rn(8,{from:oe,to:W})}function C(W){return j(W)}function L(W){return C(Ue(w(W),{replace:!0}))}function D(W){const oe=W.matched[W.matched.length-1];if(oe&&oe.redirect){const{redirect:ae}=oe;let he=typeof ae=="function"?ae(W):ae;return typeof he=="string"&&(he=he.includes("?")||he.includes("#")?he=w(he):{path:he},he.params={}),Ue({query:W.query,hash:W.hash,params:"path"in he?{}:W.params},he)}}function j(W,oe){const ae=u=y(W),he=l.value,ke=W.state,Ce=W.force,P=W.replace===!0,O=D(ae);if(O)return j(Ue(w(O),{state:typeof O=="object"?Ue({},ke,O.state):ke,force:Ce,replace:P}),oe||ae);const d=ae;d.redirectedFrom=oe;let _;return!Ce&&m_(n,he,ae)&&(_=Rn(16,{to:d,from:he}),Q(he,he,!0,!1)),(_?Promise.resolve(_):se(d,he)).catch(R=>mi(R)?mi(R,2)?R:ce(R):U(R,d,he)).then(R=>{if(R){if(mi(R,2))return j(Ue({replace:P},w(R.to),{state:typeof R.to=="object"?Ue({},ke,R.to.state):ke,force:Ce}),oe||d)}else R=Se(d,he,!0,P,ke);return ue(d,he,R),R})}function N(W,oe){const ae=S(W,oe);return ae?Promise.reject(ae):Promise.resolve()}function K(W){const oe=Ve.values().next().value;return oe&&typeof oe.runWithContext=="function"?oe.runWithContext(W):W()}function se(W,oe){let ae;const[he,ke,Ce]=f0(W,oe);ae=fl(he.reverse(),"beforeRouteLeave",W,oe);for(const O of he)O.leaveGuards.forEach(d=>{ae.push(Bi(d,W,oe))});const P=N.bind(null,W,oe);return ae.push(P),xe(ae).then(()=>{ae=[];for(const O of s.list())ae.push(Bi(O,W,oe));return ae.push(P),xe(ae)}).then(()=>{ae=fl(ke,"beforeRouteUpdate",W,oe);for(const O of ke)O.updateGuards.forEach(d=>{ae.push(Bi(d,W,oe))});return ae.push(P),xe(ae)}).then(()=>{ae=[];for(const O of Ce)if(O.beforeEnter)if(Ut(O.beforeEnter))for(const d of O.beforeEnter)ae.push(Bi(d,W,oe));else ae.push(Bi(O.beforeEnter,W,oe));return ae.push(P),xe(ae)}).then(()=>(W.matched.forEach(O=>O.enterCallbacks={}),ae=fl(Ce,"beforeRouteEnter",W,oe),ae.push(P),xe(ae))).then(()=>{ae=[];for(const O of a.list())ae.push(Bi(O,W,oe));return ae.push(P),xe(ae)}).catch(O=>mi(O,8)?O:Promise.reject(O))}function ue(W,oe,ae){o.list().forEach(he=>K(()=>he(W,oe,ae)))}function Se(W,oe,ae,he,ke){const Ce=S(W,oe);if(Ce)return Ce;const P=oe===Hi,O=En?history.state:{};ae&&(he||P?r.replace(W.fullPath,Ue({scroll:P&&O&&O.scroll},ke)):r.push(W.fullPath,ke)),l.value=W,Q(W,oe,ae,P),ce()}let Re;function Ee(){Re||(Re=r.listen((W,oe,ae)=>{if(!Ie.listening)return;const he=y(W),ke=D(he);if(ke){j(Ue(ke,{replace:!0}),he).catch(wr);return}u=he;const Ce=l.value;En&&x_(xf(Ce.fullPath,ae.delta),Us()),se(he,Ce).catch(P=>mi(P,12)?P:mi(P,2)?(j(P.to,he).then(O=>{mi(O,20)&&!ae.delta&&ae.type===_r.pop&&r.go(-1,!1)}).catch(wr),Promise.reject()):(ae.delta&&r.go(-ae.delta,!1),U(P,he,Ce))).then(P=>{P=P||Se(he,Ce,!1),P&&(ae.delta&&!mi(P,8)?r.go(-ae.delta,!1):ae.type===_r.pop&&mi(P,20)&&r.go(-1,!1)),ue(he,Ce,P)}).catch(wr)}))}let Me=xr(),ge=xr(),ne;function U(W,oe,ae){ce(W);const he=ge.list();return he.length?he.forEach(ke=>ke(W,oe,ae)):console.error(W),Promise.reject(W)}function re(){return ne&&l.value!==Hi?Promise.resolve():new Promise((W,oe)=>{Me.add([W,oe])})}function ce(W){return ne||(ne=!W,Ee(),Me.list().forEach(([oe,ae])=>W?ae(W):oe()),Me.reset()),W}function Q(W,oe,ae,he){const{scrollBehavior:ke}=t;if(!En||!ke)return Promise.resolve();const Ce=!ae&&S_(xf(W.fullPath,0))||(he||!ae)&&history.state&&history.state.scroll||null;return Fn().then(()=>ke(W,oe,Ce)).then(P=>P&&T_(P)).catch(P=>U(P,W,oe))}const _e=W=>r.go(W);let He;const Ve=new Set,Ie={currentRoute:l,listening:!0,addRoute:p,removeRoute:m,hasRoute:T,getRoutes:b,resolve:y,options:t,push:C,replace:L,go:_e,back:()=>_e(-1),forward:()=>_e(1),beforeEach:s.add,beforeResolve:a.add,afterEach:o.add,onError:ge.add,isReady:re,install(W){const oe=this;W.component("RouterLink",o0),W.component("RouterView",c0),W.config.globalProperties.$router=oe,Object.defineProperty(W.config.globalProperties,"$route",{enumerable:!0,get:()=>k(l)}),En&&!He&&l.value===Hi&&(He=!0,C(r.location).catch(ke=>{}));const ae={};for(const ke in Hi)Object.defineProperty(ae,ke,{get:()=>l.value[ke],enumerable:!0});W.provide(js,oe),W.provide(cl,Jl(ae)),W.provide(hl,l);const he=W.unmount;Ve.add(W),W.unmount=function(){Ve.delete(W),Ve.size<1&&(u=Hi,Re&&Re(),Re=null,l.value=Hi,He=!1,ne=!1),he()}}};function xe(W){return W.reduce((oe,ae)=>oe.then(()=>K(ae)),Promise.resolve())}return Ie}function f0(t,i){const e=[],n=[],r=[],s=Math.max(i.matched.length,t.matched.length);for(let a=0;aPn(u,o))?n.push(o):e.push(o));const l=t.matched[a];l&&(i.matched.find(u=>Pn(u,l))||r.push(l))}return[e,n,r]}function d0(){return ye(js)}function p0(){return ye(cl)}const qf=Yo("modes",()=>{const t=zi();Y(()=>Yi(Bs)),Y(()=>Yi(yr)),Y(()=>Yi(nl));const i=new Kf({id:"default",externalUrl:"",enableResources:!0,enableFilters:!0}),e=[{id:"image",externalUrl:"image",paramCount:1},{id:"resource",externalUrl:"resource",paramCount:1,enableFilters:!0},{id:"record",externalUrl:"record",paramCount:2},{id:"recordImage",externalUrl:"record",paramCount:3},{id:"slug",externalUrl:"search",paramCount:1},{id:"doi",externalUrl:"search",paramCount:2}].map(f=>new Kf(f)),n=p0(),r=Y(()=>{let p=!!n.params.mode?n.params.mode[0]:"default",m=e.filter(b=>b.externalUrl===p&&b.paramCount===s.value.length);return m.length>0?m[0]:i}),s=Y(()=>!!n.params.mode?n.params.mode.slice(1,n.params.mode.length):[]);function a(){switch(Fi.once(br.recordsRetrieved,()=>{t.currentImage=t.allImages[0]}),r.value.id){case"image":t.currentImage=t.imageRepo.save({url:"/media/"+s.value[0]}),t.showOverlay=!0;break;case"resource":o(s.value[0]);break;case"record":l(s.value[0],s.value[1],null);break;case"recordImage":l(s.value[0],s.value[1],s.value[2]);break;case"slug":u(s.value[0]);break;case"doi":c(s.value[0],s.value[1]);break;default:h()}}function o(f){t.setQuery({query:{},resource_ids:[f]})}function l(f,p,m){m!=null&&Fi.once(br.recordsRetrieved,()=>{t.changeImage(t.allImages[0])}),t.setQuery({query:{filters:{and:[{string_equals:{fields:["_id"],value:p}}]}},resource_ids:[f]},m==null?null:{ix:m})}function u(f){tl("datastore_resolve_slug",{slug:f}).then(p=>{p.success&&t.setQuery(p.result)})}function c(f,p){tl("datastore_resolve_slug",{slug:`${f}/${p}`}).then(m=>{m.success&&t.setQuery(m.result)})}function h(){t.setQuery({query:{filters:{and:[{string_equals:{fields:["associatedMedia.category"],value:"Drawer scan"}}]}},resource_ids:["05ff2255-c38a-40c9-b657-4ccb55ab2feb","bb909597-dedf-427d-8c04-4c02b3a24db3"]})}return{mode:r,modeParams:s,loadData:a}});class Kf{constructor(i){this.id=i.id,this.externalUrl=i.externalUrl,this.paramCount=i.paramCount==null?0:i.paramCount,this.enableResources=i.enableResources==null?!1:i.enableResources,this.enableFilters=i.enableFilters==null?!1:i.enableFilters}get lockAll(){return!this.enableResources&&!this.enableFilters}}function Sr(t){function i(e){return e=e||[],t.class&&Array.isArray(t.class)?e=e.concat(t.class):t.class&&e.push(t.class),e}return{addPropClasses:i}}const m0="zoa__button__main",g0="zoa__button__checkbox",v0={main:m0,"kind--normal":"zoa__button__kind--normal",checkbox:g0,"kind--primary":"zoa__button__kind--primary","kind--alt":"zoa__button__kind--alt","size--sm":"zoa__button__size--sm","size--md":"zoa__button__size--md"},ht=(t,i)=>{const e=t.__vccOpts||t;for(const[n,r]of i)e[n]=r;return e},y0={__name:"Button",props:{class:{type:[String,Array,null],default:null},label:{type:String,default:"Button"},kind:{type:String,default:"normal"},size:{type:String,default:"md"}},setup(t){const i=t,{addPropClasses:e}=Sr(i);return(n,r)=>(ie(),le("button",{class:q(k(e)([n.$style.main,n.$style[`kind--${t.kind}`],n.$style[`size--${t.size}`]]))},[Ei(n.$slots,"default",{},()=>[mt(Oe(t.label),1)])],2))}},b0={$style:v0},Vt=ht(y0,[["__cssModules",b0]]);let w0=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((i,e)=>(e&=63,e<36?i+=e.toString(36):e<62?i+=(e-26).toString(36).toUpperCase():e>62?i+="-":i+="_",i),"");function dl(){const t=$(w0(6));function i(e){return`${t.value}__${e}`}return{componentId:t,subId:i}}const{now:Zf}=Date,Ws=(t,i=1,e)=>{i=Math.max(1,i);const n=(e==null?void 0:e.leading)??!1,r=(e==null?void 0:e.trailing)??!0,s=Math.max((e==null?void 0:e.maxWait)??1/0,i);let a,o,l=0,u=0;const c=()=>{const C=Zf(),L=C-l,D=C-u,j=L>=i||D>=s;return[C,j]},h=C=>{if(u=C,!a)return;const L=a;a=void 0,t.apply(void 0,L)},f=()=>{w(0)},p=()=>{o&&(f(),h(Zf()))},m=C=>{if(u=C,n)return h(C)},b=C=>{if(r&&a)return h(C);a=void 0},T=()=>{o=void 0;const[C,L]=c();return L?b(C):y(C)},y=C=>{const L=C-l,D=C-u,j=i-L,N=s-D,K=Math.min(j,N);return w(K)},w=C=>{o&&clearTimeout(o),!(C<=0)&&(o=setTimeout(T,C))},S=(...C)=>{const[L,D]=c(),j=!!o;if(a=C,l=L,(D||!o)&&w(i),D)return j?h(L):m(L)};return S.cancel=f,S.flush=p,S};function Rt(t,i){let e;try{e=parseInt(i.delay)||0}catch{e=0}const n=$(null);function r(l){t("change",l)}const s=Ws(r,e);function a(l){t("update:modelValue",l),n.value=l,s(l)}const o=Y({get(){return i.modelValue===void 0?n.value:i.modelValue},set(l){a(l)}});return{emitChange:s,valueChanged:a,value:o}}function _0(t,i){let e,n,r;const s=$(!0),a=()=>{s.value=!0,r()};$e(t,a,{flush:"sync"});const o=typeof i=="function"?i:i.get,l=typeof i=="function"?void 0:i.set,u=iu((c,h)=>(n=c,r=h,{get(){return s.value&&(e=o(),s.value=!1),n(),e},set(f){l==null||l(f)}}));return Object.isExtensible(u)&&(u.trigger=a),u}function T0(t){return Lr()?(uo(t),!0):!1}function jt(t){return typeof t=="function"?t():k(t)}const Yf=typeof window<"u"&&typeof document<"u",x0=Object.prototype.toString,S0=t=>x0.call(t)==="[object Object]",gi=()=>{},E0=P0();function P0(){var t;return Yf&&((t=window==null?void 0:window.navigator)==null?void 0:t.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent)}function Xf(t,i){function e(...n){return new Promise((r,s)=>{Promise.resolve(t(()=>i.apply(this,n),{fn:i,thisArg:this,args:n})).then(r).catch(s)})}return e}function R0(t,i={}){let e,n,r=gi;const s=a=>{clearTimeout(a),r(),r=gi};return a=>{const o=jt(t),l=jt(i.maxWait);return e&&s(e),o<=0||l!==void 0&&l<=0?(n&&(s(n),n=null),Promise.resolve(a())):new Promise((u,c)=>{r=i.rejectOnCancel?c:u,l&&!n&&(n=setTimeout(()=>{e&&s(e),n=null,u(a())},l)),e=setTimeout(()=>{n&&s(n),n=null,u(a())},o)})}}function C0(t,i=!0,e=!0,n=!1){let r=0,s,a=!0,o=gi,l;const u=()=>{s&&(clearTimeout(s),s=void 0,o(),o=gi)};return c=>{const h=jt(t),f=Date.now()-r,p=()=>l=c();return u(),h<=0?(r=Date.now(),p()):(f>h&&(e||!a)?(r=Date.now(),p()):i&&(l=new Promise((m,b)=>{o=n?b:m,s=setTimeout(()=>{r=Date.now(),a=!0,m(p()),u()},Math.max(0,h-f))})),!e&&!s&&(s=setTimeout(()=>a=!0,h)),a=!1,l)}}function O0(t,i=200,e={}){return Xf(R0(i,e),t)}function I0(t,i=200,e=!1,n=!0,r=!1){return Xf(C0(i,e,n,r),t)}function tn(t){var i;const e=jt(t);return(i=e==null?void 0:e.$el)!=null?i:e}const Cn=Yf?window:void 0;function Lt(...t){let i,e,n,r;if(typeof t[0]=="string"||Array.isArray(t[0])?([e,n,r]=t,i=Cn):[i,e,n,r]=t,!i)return gi;Array.isArray(e)||(e=[e]),Array.isArray(n)||(n=[n]);const s=[],a=()=>{s.forEach(c=>c()),s.length=0},o=(c,h,f,p)=>(c.addEventListener(h,f,p),()=>c.removeEventListener(h,f,p)),l=$e(()=>[tn(i),jt(r)],([c,h])=>{if(a(),!c)return;const f=S0(h)?{...h}:h;s.push(...e.flatMap(p=>n.map(m=>o(c,p,m,f))))},{immediate:!0,flush:"post"}),u=()=>{l(),a()};return T0(u),u}let Jf=!1;function pl(t,i,e={}){const{window:n=Cn,ignore:r=[],capture:s=!0,detectIframe:a=!1}=e;if(!n)return;E0&&!Jf&&(Jf=!0,Array.from(n.document.body.children).forEach(c=>c.addEventListener("click",gi)),n.document.documentElement.addEventListener("click",gi));let o=!0;const l=c=>r.some(h=>{if(typeof h=="string")return Array.from(n.document.querySelectorAll(h)).some(f=>f===c.target||c.composedPath().includes(f));{const f=tn(h);return f&&(c.target===f||c.composedPath().includes(f))}}),u=[Lt(n,"click",c=>{const h=tn(t);if(!(!h||h===c.target||c.composedPath().includes(h))){if(c.detail===0&&(o=!l(c)),!o){o=!0;return}i(c)}},{passive:!0,capture:s}),Lt(n,"pointerdown",c=>{const h=tn(t);h&&(o=!c.composedPath().includes(h)&&!l(c))},{passive:!0}),a&&Lt(n,"blur",c=>{setTimeout(()=>{var h;const f=tn(t);((h=n.document.activeElement)==null?void 0:h.tagName)==="IFRAME"&&!(f!=null&&f.contains(n.document.activeElement))&&i(c)},0)})].filter(Boolean);return()=>u.forEach(c=>c())}function A0(t){return typeof t=="function"?t:typeof t=="string"?i=>i.key===t:Array.isArray(t)?i=>t.includes(i.key):()=>!0}function rt(...t){let i,e,n={};t.length===3?(i=t[0],e=t[1],n=t[2]):t.length===2?typeof t[1]=="object"?(i=!0,e=t[0],n=t[1]):(i=t[0],e=t[1]):(i=!0,e=t[0]);const{target:r=Cn,eventName:s="keydown",passive:a=!1,dedupe:o=!1}=n,l=A0(i);return Lt(r,s,u=>{u.repeat&&jt(o)||l(u)&&e(u)},a)}function k0(t={}){var i;const{window:e=Cn,deep:n=!0}=t,r=(i=t.document)!=null?i:e==null?void 0:e.document,s=()=>{var o;let l=r==null?void 0:r.activeElement;if(n)for(;l!=null&&l.shadowRoot;)l=(o=l==null?void 0:l.shadowRoot)==null?void 0:o.activeElement;return l},a=_0(()=>null,()=>s());return e&&(Lt(e,"blur",o=>{o.relatedTarget===null&&a.trigger()},!0),Lt(e,"focus",a.trigger,!0)),a}function D0(t,i={}){const{delayEnter:e=0,delayLeave:n=0,window:r=Cn}=i,s=$(!1);let a;const o=l=>{const u=l?e:n;a&&(clearTimeout(a),a=void 0),u?a=setTimeout(()=>s.value=l,u):s.value=l};return r&&(Lt(t,"mouseenter",()=>o(!0),{passive:!0}),Lt(t,"mouseleave",()=>o(!1),{passive:!0})),s}function On(t,i={}){const{initialValue:e=!1,focusVisible:n=!1}=i,r=$(!1),s=Y(()=>tn(t));Lt(s,"focus",o=>{var l,u;(!n||(u=(l=o.target).matches)!=null&&u.call(l,":focus-visible"))&&(r.value=!0)}),Lt(s,"blur",()=>r.value=!1);const a=Y({get:()=>r.value,set(o){var l,u;!o&&r.value?(l=s.value)==null||l.blur():o&&!r.value&&((u=s.value)==null||u.focus())}});return $e(s,()=>{a.value=e},{immediate:!0,flush:"post"}),{focused:a}}function ei(t,i={}){const e=k0(i),n=Y(()=>tn(t));return{focused:Y(()=>n.value&&e.value?n.value.contains(e.value):!1)}}const Qf=1;function M0(t,i={}){const{throttle:e=0,idle:n=200,onStop:r=gi,onScroll:s=gi,offset:a={left:0,right:0,top:0,bottom:0},eventListenerOptions:o={capture:!1,passive:!0},behavior:l="auto",window:u=Cn}=i,c=$(0),h=$(0),f=Y({get(){return c.value},set(D){m(D,void 0)}}),p=Y({get(){return h.value},set(D){m(void 0,D)}});function m(D,j){var N,K,se;if(!u)return;const ue=jt(t);ue&&((se=ue instanceof Document?u.document.body:ue)==null||se.scrollTo({top:(N=jt(j))!=null?N:p.value,left:(K=jt(D))!=null?K:f.value,behavior:jt(l)}))}const b=$(!1),T=Kt({left:!0,right:!1,top:!0,bottom:!1}),y=Kt({left:!1,right:!1,top:!1,bottom:!1}),w=D=>{b.value&&(b.value=!1,y.left=!1,y.right=!1,y.top=!1,y.bottom=!1,r(D))},S=O0(w,e+n),C=D=>{var j;if(!u)return;const N=D.document?D.document.documentElement:(j=D.documentElement)!=null?j:D,{display:K,flexDirection:se}=getComputedStyle(N),ue=N.scrollLeft;y.left=uec.value;const Se=Math.abs(ue)<=0+(a.left||0),Re=Math.abs(ue)+N.clientWidth>=N.scrollWidth-(a.right||0)-Qf;K==="flex"&&se==="row-reverse"?(T.left=Re,T.right=Se):(T.left=Se,T.right=Re),c.value=ue;let Ee=N.scrollTop;D===u.document&&!Ee&&(Ee=u.document.body.scrollTop),y.top=Eeh.value;const Me=Math.abs(Ee)<=0+(a.top||0),ge=Math.abs(Ee)+N.clientHeight>=N.scrollHeight-(a.bottom||0)-Qf;K==="flex"&&se==="column-reverse"?(T.top=ge,T.bottom=Me):(T.top=Me,T.bottom=ge),h.value=Ee},L=D=>{var j;if(!u)return;const N=(j=D.target.documentElement)!=null?j:D.target;C(N),b.value=!0,S(D),s(D)};return Lt(t,"scroll",e?I0(L,e,!0,!1):L,o),Lt(t,"scrollend",w,o),{x:f,y:p,isScrolling:b,arrivedState:T,directions:y,measure(){const D=jt(t);u&&D&&C(D)}}}const N0="zoa__togglebutton__input",L0="zoa__togglebutton__inputWrapper",F0="zoa__togglebutton__container",z0="zoa__togglebutton__main",H0="zoa__togglebutton__checkbox",B0={input:N0,inputWrapper:L0,container:F0,main:z0,"kind--normal":"zoa__togglebutton__kind--normal",checkbox:H0,"kind--primary":"zoa__togglebutton__kind--primary","kind--alt":"zoa__togglebutton__kind--alt","size--sm":"zoa__togglebutton__size--sm","size--md":"zoa__togglebutton__size--md"},U0=["id","for"],V0=["id","name","value"],j0={__name:"ToggleButton",props:{modelValue:{type:[Boolean,Array],default:void 0},class:{type:[String,Array,null],default:null},label:{type:String,default:"Checkbox"},delay:{type:Number,default:0},name:{type:[String,null],default:null},checkValue:{type:[String,null],default:null},kind:{type:String,default:"normal"},size:{type:String,default:"md"}},emits:["change","update:modelValue"],setup(t,{emit:i}){const e=t,{componentId:n,subId:r}=dl(),{addPropClasses:s}=Sr(e),{value:a}=Rt(i,e),o=$(null),l=$(null),u=ei(o),c=Y(()=>e.checkValue||e.label);function h(){let f=_o(a.value)?Ae(a.value):a.value;if(Array.isArray(f)){let p=!l.value.checked;f=f.filter(m=>m!==c.value),p&&f.push(c.value),a.value=f,l.value.checked=p}else a.value=!a.value}return rt(" ",()=>{u.focused.value&&h()}),rt("Enter",()=>{u.focused.value&&h()}),(f,p)=>(ie(),le("label",{id:k(n),for:k(r)("toggle"),tabindex:"0",ref_key:"checkboxContainer",ref:o,class:q(k(s)([f.$style.container]))},[xt(ee("input",{type:"checkbox",id:k(r)("toggle"),class:q(f.$style.checkbox),"onUpdate:modelValue":p[0]||(p[0]=m=>ze(a)?a.value=m:null),name:t.name,value:c.value,ref_key:"checkboxInput",ref:l},null,10,V0),[[ac,k(a)]]),ee("span",{class:q([f.$style.main,f.$style[`kind--${t.kind}`],f.$style[`size--${t.size}`]])},[Ei(f.$slots,"default",{},()=>[mt(Oe(t.label),1)])],2)],10,U0))}},W0={$style:B0},G0=ht(j0,[["__cssModules",W0]]),q0="zoa__tabs__input",K0="zoa__tabs__inputWrapper",Z0="zoa__tabs__tab",Y0="zoa__tabs__tabContainer",X0={input:q0,inputWrapper:K0,tab:Z0,"state--active":"zoa__tabs__state--active","orient--left":"zoa__tabs__orient--left","orient--right":"zoa__tabs__orient--right","orient--above":"zoa__tabs__orient--above","orient--below":"zoa__tabs__orient--below","kind--normal":"zoa__tabs__kind--normal","kind--primary":"zoa__tabs__kind--primary","kind--alt":"zoa__tabs__kind--alt","size--sm":"zoa__tabs__size--sm","size--md":"zoa__tabs__size--md",tabContainer:Y0},J0=["value"],Q0={__name:"Tabs",props:{modelValue:{type:String,default:void 0},class:{type:[String,Array,null],default:null},delay:{type:Number,default:0},kind:{type:String,default:"normal"},size:{type:String,default:"md"},activePosition:{type:String,default:"below"},options:{type:Array},initialValue:{type:[String,null],default:null}},emits:["change","update:modelValue"],setup(t,{emit:i}){const e=t;dl();const{addPropClasses:n}=Sr(e),{value:r}=Rt(i,e),s=$(null);$(null),ei(s);const a=Y(()=>{let o=[];return e.options.forEach(l=>{typeof l=="object"?o.push({label:l.label||l.value,value:l.value||l.label,order:l.order==null?null:l.order}):o.push({label:l,value:l})}),o.sort((l,u)=>{let c=0;(l.order!=null||u.order!=null)&&(c=l.order!=null&&u.order!=null?l.order-u.order:l.order!=null?-1:1);let h=l.label.localeCompare(u.label);return c!==0?c:h}),o});return r.value==null&&(e.initialValue&&a.value.some(o=>o.value===e.initialValue)?r.value=e.initialValue:r.value=a.value[0].value),(o,l)=>(ie(),le("div",{class:q(k(n)([]))},[ee("ul",{class:q([o.$style.tabContainer,o.$style[`orient--${t.activePosition}`]])},[(ie(!0),le(De,null,yt(a.value,u=>(ie(),le("li",null,[ee("label",{tabindex:"0",class:q([o.$style.tab,o.$style[`orient--${t.activePosition}`],o.$style[`kind--${t.kind}`],o.$style[`size--${t.size}`],o.$style[`state--${k(r)===u.value?"active":"inactive"}`]])},[xt(ee("input",{type:"radio",value:u.value,"onUpdate:modelValue":l[0]||(l[0]=c=>ze(r)?r.value=c:null)},null,8,J0),[[sg,k(r)]]),ee("span",null,Oe(u.label),1)],2)]))),256))],2)],2))}},$0={$style:X0},eT=ht(Q0,[["__cssModules",$0]]),tT="zoa__label__main",iT={main:tT,"main--right":"zoa__label__main--right","main--left":"zoa__label__main--left","main--above":"zoa__label__main--above","main--below":"zoa__label__main--below","main--none":"zoa__label__main--none"},nT=["id","for","tabindex"],rT=["id"],sT={__name:"Label",props:{label:{type:String},labelPosition:{type:String,default:"above"},inputId:{type:String},legend:{type:Boolean,default:!1},tabbable:{type:Boolean,default:!1}},setup(t){const i=ye("labelId");return(e,n)=>t.label&&!t.legend?(ie(),le("label",{key:0,id:k(i),for:t.inputId,class:q([e.$style.main,e.$style[`main--${t.labelPosition}`]]),tabindex:t.tabbable?0:-1},Oe(t.label),11,nT)):t.label?(ie(),le("legend",{key:1,id:k(i),class:q([e.$style.main,e.$style[`main--${t.labelPosition}`]])},Oe(t.label),11,rT)):qe("",!0)}},oT={$style:iT},$f=ht(sT,[["__cssModules",oT]]);function ed(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);i&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function vi(t){for(var i=1;i=0)&&(e[r]=t[r]);return e}function lT(t,i){if(t==null)return{};var e=aT(t,i),n,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(e[n]=t[n])}return e}var uT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},td={exports:{}};(function(t){(function(i){var e=function(y,w,S){if(!u(w)||h(w)||f(w)||p(w)||l(w))return w;var C,L=0,D=0;if(c(w))for(C=[],D=w.length;L1&&arguments[1]!==void 0?arguments[1]:{},e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(typeof t=="string")return t;var n=(t.children||[]).map(function(l){return id(l)}),r=Object.keys(t.attributes||{}).reduce(function(l,u){var c=t.attributes[u];switch(u){case"class":l.class=dT(c);break;case"style":l.style=fT(c);break;default:l.attrs[u]=c}return l},{attrs:{},class:{},style:{}});e.class;var s=e.style,a=s===void 0?{}:s,o=lT(e,hT);return ls(t.tag,vi(vi(vi({},i),{},{class:r.class,style:vi(vi({},r.style),a)},r.attrs),o),n)}var nd=!1;try{nd=!0}catch{}function pT(){if(!nd&&console&&typeof console.error=="function"){var t;(t=console).error.apply(t,arguments)}}function ml(t,i){return Array.isArray(i)&&i.length>0||!Array.isArray(i)&&i?_t({},t,i):{}}function mT(t){var i,e=(i={"fa-spin":t.spin,"fa-pulse":t.pulse,"fa-fw":t.fixedWidth,"fa-border":t.border,"fa-li":t.listItem,"fa-inverse":t.inverse,"fa-flip":t.flip===!0,"fa-flip-horizontal":t.flip==="horizontal"||t.flip==="both","fa-flip-vertical":t.flip==="vertical"||t.flip==="both"},_t(i,"fa-".concat(t.size),t.size!==null),_t(i,"fa-rotate-".concat(t.rotation),t.rotation!==null),_t(i,"fa-pull-".concat(t.pull),t.pull!==null),_t(i,"fa-swap-opacity",t.swapOpacity),_t(i,"fa-bounce",t.bounce),_t(i,"fa-shake",t.shake),_t(i,"fa-beat",t.beat),_t(i,"fa-fade",t.fade),_t(i,"fa-beat-fade",t.beatFade),_t(i,"fa-flash",t.flash),_t(i,"fa-spin-pulse",t.spinPulse),_t(i,"fa-spin-reverse",t.spinReverse),i);return Object.keys(e).map(function(n){return e[n]?n:null}).filter(function(n){return n})}function rd(t){if(t&&Gs(t)==="object"&&t.prefix&&t.iconName&&t.icon)return t;if(Tn.icon)return Tn.icon(t);if(t===null)return null;if(Gs(t)==="object"&&t.prefix&&t.iconName)return t;if(Array.isArray(t)&&t.length===2)return{prefix:t[0],iconName:t[1]};if(typeof t=="string")return{prefix:"fas",iconName:t}}var In=Hn({name:"FontAwesomeIcon",props:{border:{type:Boolean,default:!1},fixedWidth:{type:Boolean,default:!1},flip:{type:[Boolean,String],default:!1,validator:function(t){return[!0,!1,"horizontal","vertical","both"].indexOf(t)>-1}},icon:{type:[Object,Array,String],required:!0},mask:{type:[Object,Array,String],default:null},listItem:{type:Boolean,default:!1},pull:{type:String,default:null,validator:function(t){return["right","left"].indexOf(t)>-1}},pulse:{type:Boolean,default:!1},rotation:{type:[String,Number],default:null,validator:function(t){return[90,180,270].indexOf(Number.parseInt(t,10))>-1}},swapOpacity:{type:Boolean,default:!1},size:{type:String,default:null,validator:function(t){return["2xs","xs","sm","lg","xl","2xl","1x","2x","3x","4x","5x","6x","7x","8x","9x","10x"].indexOf(t)>-1}},spin:{type:Boolean,default:!1},transform:{type:[String,Object],default:null},symbol:{type:[Boolean,String],default:!1},title:{type:String,default:null},inverse:{type:Boolean,default:!1},bounce:{type:Boolean,default:!1},shake:{type:Boolean,default:!1},beat:{type:Boolean,default:!1},fade:{type:Boolean,default:!1},beatFade:{type:Boolean,default:!1},flash:{type:Boolean,default:!1},spinPulse:{type:Boolean,default:!1},spinReverse:{type:Boolean,default:!1}},setup:function(t,i){var e=i.attrs,n=Y(function(){return rd(t.icon)}),r=Y(function(){return ml("classes",mT(t))}),s=Y(function(){return ml("transform",typeof t.transform=="string"?Tn.transform(t.transform):t.transform)}),a=Y(function(){return ml("mask",rd(t.mask))}),o=Y(function(){return Dh(n.value,vi(vi(vi(vi({},r.value),s.value),a.value),{},{symbol:t.symbol,title:t.title}))});$e(o,function(u){if(!u)return pT("Could not find one or more icon(s)",n.value,a.value)},{immediate:!0});var l=Y(function(){return o.value?id(o.value.abstract[0],{},e):null});return function(){return l.value}}});kh.add(Xb,Kb,Gb,Vb,jb,Wb,Yb,qb);const gT="zoa__help__main",vT="zoa__help__icon",yT="zoa__help__popup",bT={main:gT,"main--above":"zoa__help__main--above","main--below":"zoa__help__main--below",icon:vT,popup:yT,"popup--right":"zoa__help__popup--right"},wT=["id"],_T={__name:"Help",props:{text:{type:String},position:{type:String,default:"right"}},setup(t){const i=ye("labelPosition"),e=ye("helpId"),n=$(!1),r=$(null),s=D0(r,{delayEnter:500});return $e(s,()=>{n.value=s.value}),rt("Escape",()=>n.value=!1),(a,o)=>(ie(),le("div",{class:q([a.$style.main,a.$style[`main--${k(i)}`]]),ref_key:"helpContainer",ref:r},[be(k(In),{icon:["fa-solid","fa-circle-question"],class:q(a.$style.icon)},null,8,["class"]),xt(ee("div",{class:q([a.$style.popup,a.$style[`popup--${t.position}`]]),id:k(e),role:"tooltip"},[Ei(a.$slots,"default",{},()=>[mt(Oe(t.text),1)])],10,wT),[[us,n.value]])],2))}},TT={$style:bT},sd=ht(_T,[["__cssModules",TT]]),xT="zoa__autocompletetextbox__input",ST="zoa__autocompletetextbox__inputWrapper",ET="zoa__autocompletetextbox__disabled",PT="zoa__autocompletetextbox__options",RT="zoa__autocompletetextbox__option",CT="zoa__autocompletetextbox__noOptions",OT={input:xT,inputWrapper:ST,disabled:ET,options:PT,option:RT,noOptions:CT},IT=["aria-labelledby","aria-describedby"],AT=["placeholder","id","disabled"],kT={key:0},DT=["onClick"],MT=["value"],NT={__name:"AutocompleteTextbox",props:{modelValue:{type:String},delay:{type:Number,default:200},placeholder:{type:[String,void 0],default:null},options:{type:Array}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=ye("inputId"),s=ye("labelId"),a=ye("helpId"),o=ye("disabled"),{value:l}=Rt(e,n),u=Y(()=>{let w=[];return n.options.forEach(S=>{typeof S=="object"?w.push({label:S.label||S.value,value:S.value||S.label,order:S.order==null?null:S.order}):w.push({label:S,value:S})}),w.sort((S,C)=>{let L=0;(S.order!=null||C.order!=null)&&(L=S.order!=null&&C.order!=null?S.order-C.order:S.order!=null?-1:1);let D=S.label.localeCompare(C.label);return L!==0?L:D}),w}),c=$(null),h=$(null),f=$(null);i({target:h});const p=$(!1),m=On(h),b=ei(f);function T(){try{c.value.blur(),h.value.blur(),f.value.blur()}catch{}p.value=!1}pl(c,()=>{p.value=!1}),rt("ArrowDown",()=>{if(u.value.length!==0){if(m.focused.value)f.value.children[0].children[0].focus();else if(b.focused.value){const w=f.value.querySelector("li:focus");!w||!w.nextElementSibling?f.value.children[0].children[0].focus():w.nextElementSibling.focus()}}}),rt("ArrowUp",()=>{if(u.value.length!==0&&b.focused.value){const w=f.value.querySelector("li:focus");!w||!w.previousElementSibling?h.value.focus():w.previousElementSibling.focus()}}),rt("Enter",()=>{if(b.focused.value){const w=f.value.querySelector("li:focus");w&&y(w.querySelector("input").value)}T()});function y(w){l.value=w,T()}return(w,S)=>(ie(),le("div",{class:q([w.$style.inputWrapper,k(o)?w.$style.disabled:""]),ref_key:"container",ref:c,"aria-labelledby":k(s),"aria-describedby":k(a)},[xt(ee("input",{type:"text",placeholder:t.placeholder,id:k(r),class:q(w.$style.input),"onUpdate:modelValue":S[0]||(S[0]=C=>ze(l)?l.value=C:null),onFocusin:S[1]||(S[1]=C=>p.value=!0),ref_key:"textbox",ref:h,disabled:k(o)},null,42,AT),[[dn,k(l)]]),p.value&&!k(o)?(ie(),le("div",{key:0,class:q(w.$style.options),ref_key:"dropdown",ref:f},[u.value.length>0?(ie(),le("ul",kT,[(ie(!0),le(De,null,yt(u.value,C=>(ie(),le("li",{class:q(w.$style.option),onClick:L=>y(C.value),tabindex:"0"},[ee("span",null,Oe(C.label),1),ee("input",{type:"hidden",value:C.value},null,8,MT)],10,DT))),256))])):(ie(),le("div",{key:1,class:q(w.$style.noOptions)},"No options found",2))],2)):qe("",!0)],10,IT))}},LT={$style:OT},FT=ht(NT,[["__cssModules",LT]]),zT="zoa__checkbox__input",HT="zoa__checkbox__inputWrapper",BT="zoa__checkbox__defaultCheckbox",UT="zoa__checkbox__checkbox",VT="zoa__checkbox__check",jT="zoa__checkbox__disabled",WT={input:zT,inputWrapper:HT,defaultCheckbox:BT,checkbox:UT,check:VT,disabled:jT},GT=["aria-labelledby","aria-describedby"],qT=["id","name","value","disabled"],KT={__name:"Checkbox",props:{modelValue:{type:[Boolean,Array],default:void 0},delay:{type:Number,default:0},name:{type:[String,null],default:null},checkValue:{type:[String,null],default:null}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=ye("inputId"),s=ye("labelId"),a=ye("helpId"),o=ye("disabled"),{value:l,valueChanged:u}=Rt(e,n),c=ye("rootContainer"),h=$(null),f=ei(c);i({target:h});const p=ye("label"),m=Y(()=>n.checkValue||p.value),b=Y({get(){return n.name?l.value||[]:l.value||!1},set(y){u(y)}});function T(){if(!o.value)if(n.name){let y=!b.value.includes(m.value),w=b.value.filter(S=>S!==m.value);y&&w.push(m.value),b.value=w}else b.value=!b.value}return rt(" ",()=>{f.focused.value&&T()}),(y,w)=>(ie(),le("div",{class:q([y.$style.inputWrapper,k(o)?y.$style.disabled:""]),"aria-labelledby":k(s),"aria-describedby":k(a)},[xt(ee("input",{type:"checkbox",id:k(r),class:q(y.$style.defaultCheckbox),"onUpdate:modelValue":w[0]||(w[0]=S=>b.value=S),name:t.name?t.name:null,value:m.value,ref_key:"checkboxInput",ref:h,disabled:k(o)},null,10,qT),[[ac,b.value]]),ee("span",{class:q(y.$style.checkbox),onClick:T},[be(k(In),{icon:"fa-solid fa-check",class:q(y.$style.check)},null,8,["class"])],2)],10,GT))}},ZT={$style:WT},YT=ht(KT,[["__cssModules",ZT]]);function od(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var XT={__locale:"en",days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviated_days:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviated_months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],am:"AM",pm:"PM"},JT=XT;const gl=od(JT),QT="zoa__dateambiguous__input",$T="zoa__dateambiguous__inputWrapper",ex="zoa__dateambiguous__disabled",tx="zoa__dateambiguous__datePopup",ix="zoa__dateambiguous__popupSection",nx="zoa__dateambiguous__yearGrid",rx="zoa__dateambiguous__monthGrid",sx="zoa__dateambiguous__dayGrid",ox="zoa__dateambiguous__editing",ax="zoa__dateambiguous__suggestion",lx="zoa__dateambiguous__dateRange",ux="zoa__dateambiguous__yearParts",cx={input:QT,inputWrapper:$T,disabled:ex,datePopup:tx,popupSection:ix,yearGrid:nx,monthGrid:rx,dayGrid:sx,editing:ox,suggestion:ax,dateRange:lx,yearParts:ux},hx=["aria-labelledby","aria-describedby"],fx=["placeholder","id","disabled"],dx=["onClick","onKeydown"],px={__name:"DateAmbiguous",props:{modelValue:{type:Object},delay:{type:Number,default:200},placeholder:{type:String,default:null},min:{type:String,default:"1582-01-01"},max:{type:String,default:"today"}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=()=>Promise.resolve().then(()=>cR),s=ye("inputId"),a=ye("labelId"),o=ye("helpId"),l=ye("disabled"),{valueChanged:u}=Rt(e,n.delay),c=Y(()=>{let I;try{I=new Date(n.min==="today"?Date.now():Date.parse(n.min||"0000-01-01"))}catch{I=new Date(0,0,1)}return{year:I.getUTCFullYear(),month:I.getUTCMonth()+1,day:I.getUTCDate(),date:I}}),h=Y(()=>{let I;try{I=new Date(n.max==="today"?Date.now():Date.parse(n.max||"9999-12-31"))}catch{I=new Date(9999,11,31)}return{year:I.getUTCFullYear(),month:I.getUTCMonth()+1,day:I.getUTCDate(),date:I}}),f=$(null),p=ye("rootContainer"),m=$(null),b=$(null),T=$(null),y=$(null),w=$(null),S=$(null),C=$(null),L=$(!1),{focused:D}=ei(p);i({target:f});const j=On(m),N=ei(m),K=On(b),se=ei(b),ue=On(T),Se=ei(T),Re=Y(()=>{let I;return j.focused.value?I=m.value:K.focused.value?I=b.value:ue.focused.value&&(I=T.value),I}),Ee=Y(()=>{let I;return N.focused.value?I=m.value:se.focused.value?I=b.value:Se.focused.value&&(I=T.value),I});rt("Enter",()=>{Re&&Re.value.children[0].focus()}),rt("ArrowLeft",()=>{if(!Ee.value)return;const I=Ee.value.querySelector("button:focus");!I||!I.previousElementSibling?Ee.value.children[Ee.value.children.length-1].focus():I.previousElementSibling.focus()}),rt("ArrowRight",()=>{if(!Ee.value)return;const I=Ee.value.querySelector("button:focus");!I||!I.nextElementSibling?Ee.value.children[0].focus():I.nextElementSibling.focus()}),rt("Escape",()=>{const I=p.value.querySelector("*:focus");I&&I.blur()});function Me(I,F,V){I.value&&(I.value.target.onkeyup=X=>{/^[0-9]$/.test(X.key)&&F?F.value.focus():X.key==="Backspace"&&V&&V.value.focus()})}gu(()=>{Me(y,w,null),Me(w,S,y),Me(S,C,w),Me(C,null,S)});const ge=Y(()=>({year:Ie.value,month:_.value,day:z.value,earliest:`${U.value.lower.year.toString().padStart(4,"0")}-${U.value.lower.month.toString().padStart(2,"0")}-${U.value.lower.day.toString().padStart(2,"0")}`,latest:`${U.value.upper.year.toString().padStart(4,"0")}-${U.value.upper.month.toString().padStart(2,"0")}-${U.value.upper.day.toString().padStart(2,"0")}`})),ne=Y(()=>te(ge.value.year,ge.value.month,ge.value.day)),U=Y(()=>{let I,F;if(!oe.value)I=c.value.year,F=h.value.year;else{const J=10**(4-(Math.max(...W.map((at,et)=>isNaN(parseInt(xe.value[at]))?-1:et))+1)),fe=Ce(xe.value,4),Te=Math.floor(c.value.year/J)*J,pe=Math.floor(h.value.year/J)*J;fepe?(I=c.value.year,F=h.value.year):fe===Te?(I=c.value.year,F=fe+J-1):fe===pe?(I=fe,F=h.value.year):(I=fe,F=fe+J-1)}const V=I===c.value.year,X=F===h.value.year,me=V?Math.max(c.value.month,d.value||1):d.value||1,v=X?Math.min(h.value.month,d.value||12):d.value||12,g=me===c.value.month,x=v===h.value.month;let E=H.value||1,B=H.value||M(v);return E=V&&g?Math.max(E,c.value.day):E,B=X&&x?Math.min(B,h.value.day):B,I===F&&me===v&&(X&&x&&E>B&&(E=1),V&&g&&B=1,x=v||V<=M(F);if(X||I>U.value.lower.year&&IU.value.upper.year)return{year:!1,month:g,day:x};let E=g,B=x;return I===U.value.lower.year&&(E=E&&(me||F>=U.value.lower.month),F===U.value.lower.month&&(B=B&&(v||V>=U.value.lower.day))),I===U.value.upper.year&&(E=E&&(me||F<=U.value.upper.month),F===U.value.upper.month&&(B=B&&(v||V<=U.value.upper.day))),{year:!0,month:E,day:B}}function ce(){f.value.value=ne.value,L.value=!1}const Q=$([]);function _e(I){L.value=!0,r().then(F=>{Q.value=F.parseDate(I.target.value)})}const He=Ws(_e,200);function Ve(I){xe.value=P(I.year),_.value=I.month,z.value=I.day,Q.value=[]}const Ie=Y(()=>{if(!oe.value)return null;const I=Ce(xe.value,4);return re(I,_.value,z.value).year?I:null}),xe=$({millenium:null,century:null,decade:null,year:null}),W=["millenium","century","decade","year"],oe=Y(()=>Object.values(xe.value).some(I=>!isNaN(parseInt(I)))),ae=Y(()=>{const I=P(U.value.lower.year),F={millenium:null,century:null,decade:null,year:null};if(c.value.year===h.value.year&&isNaN(parseInt(xe.value.year)))return[I];if(U.value.lower.year===U.value.upper.year)return[F];const V=P(U.value.upper.year);let X,me={...F};if(oe.value)X=Math.max(...W.map((x,E)=>(me[x]=xe.value[x],isNaN(parseInt(xe.value[x]))?-1:E)))+1;else for(let x=0;x{let pe={...me};return pe[E]=fe+Te,pe}).filter(fe=>{const Te=Ce(fe,x+1);return Te>=B&&Te<=J})}let g=v(X);return g.length===1&&X<3&&(me={...g[0]},g=v(X+1)),oe.value&&g.push(F),g}),he=Y(()=>Ie.value%100===0?Ie.value%400===0:Ie.value%4===0);function ke(I){return Object.values(I).every(F=>F==null)?"clear":W.map(F=>I[F]||0).join("")}function Ce(I,F){return W.slice(0,F).reduce((V,X,me)=>{let v=I[X]||0;return V+v*10**(3-me)},0)}function P(I){return{millenium:Math.floor(I/1e3),century:Math.floor(I%1e3/100),decade:Math.floor(I%100/10),year:Math.floor(I%10)}}function O(I){if(xe.value=I,Math.max(...W.map((F,V)=>isNaN(parseInt(xe.value[F]))?-1:V))===3){let F=re(Ie.value,_.value,z.value);(!F.month||!F.day)&&(_.value=null,z.value=null)}}const d=$(null),_=Y({get(){return re(Ie.value,d.value,z.value).month?d.value:null},set(I){d.value=isNaN(parseInt(I))?null:I,z.value&&z.value>A.value&&(z.value=A.value)}}),R=Y(()=>{let I=gl.abbreviated_months.map((V,X)=>[V,X+1]);const F=Ie.value?Ie.value:c.value.year===h.value.year?c.value.year:null;if(F===c.value.year&&(I=I.slice(c.value.month-1,I.length)),F===h.value.year){const V=12-I.length;I=I.slice(0,h.value.month-V)}return d.value&&I.push(["clear",null]),I}),A=Y(()=>M(_.value));function M(I){return[4,6,9,11].includes(I)?30:I===2?he.value?29:28:31}const H=$(null),z=Y({get(){const I=re(Ie.value,d.value,H.value);return I.month&&I.day?H.value:null},set(I){H.value=isNaN(parseInt(I))?null:I}}),G=Y(()=>{const I=Ie.value?Ie.value:c.value.year===h.value.year?c.value.year:null,F=_.value?_.value:c.value.year===h.value.year&&c.value.month===h.value.month?c.value.month:null,V=M(F);let X=Array(V).fill(1).map((me,v)=>v+1);if(I===c.value.year&&!isNaN(parseInt(F))&&F<=c.value.month&&(X=X.slice(c.value.day-1)),I===h.value.year&&!isNaN(parseInt(F))&&F>=h.value.month){const me=V-X.length;X=X.slice(0,h.value.day-me)}return H.value&&X.push(null),X});function te(I,F,V){const X=gl.abbreviated_months[F-1];return I&&F&&V?`${V} ${X} ${I}`:I&&F?`${X} ${I}`:I&&V?`${V} ??? ${I}`:F&&V?`${V} ${X}`:I||(F?X:V?`day ${V}`:null)}return $e(ge,()=>{ce(),u(ge.value)}),(I,F)=>(ie(),le("div",{class:q([I.$style.inputWrapper,k(l)?I.$style.disabled:""]),"aria-labelledby":k(a),"aria-describedby":k(o)},[ee("input",{type:"text",placeholder:t.placeholder,id:k(s),class:q([I.$style.input,L.value?I.$style.editing:""]),ref_key:"displayBox",ref:f,onInput:F[0]||(F[0]=(...V)=>k(He)&&k(He)(...V)),disabled:k(l)},null,42,fx),k(D)&&!k(l)?(ie(),le("div",{key:0,class:q(I.$style.datePopup)},[Q.value.length>0?(ie(),le("div",{key:0,class:q(I.$style.popupSection)},[(ie(!0),le(De,null,yt(Q.value,V=>(ie(),le("span",{onClick:X=>Ve(V),onKeydown:lg(X=>Ve(V),["enter"]),class:q(I.$style.suggestion),tabindex:"0"},Oe(te(V.year,V.month,V.day)),43,dx))),256))],2)):qe("",!0),ee("div",{class:q(I.$style.popupSection)},[be(k(st),{label:"year","grid-class":I.$style.yearParts},{default:ut(()=>[be(k(st),{"zoa-type":"number",label:"millenium","label-position":"none",options:{placeholder:0,min:0,max:9},modelValue:xe.value.millenium,"onUpdate:modelValue":F[1]||(F[1]=V=>xe.value.millenium=V),ref_key:"yrM",ref:y},null,8,["modelValue"]),be(k(st),{"zoa-type":"number",label:"century","label-position":"none",options:{placeholder:0,min:0,max:9},modelValue:xe.value.century,"onUpdate:modelValue":F[2]||(F[2]=V=>xe.value.century=V),ref_key:"yrC",ref:w},null,8,["modelValue"]),be(k(st),{"zoa-type":"number",label:"decade","label-position":"none",options:{placeholder:0,min:0,max:9},modelValue:xe.value.decade,"onUpdate:modelValue":F[3]||(F[3]=V=>xe.value.decade=V),ref_key:"yrD",ref:S},null,8,["modelValue"]),be(k(st),{"zoa-type":"number",label:"year","label-position":"none",options:{placeholder:0,min:0,max:9},modelValue:xe.value.year,"onUpdate:modelValue":F[4]||(F[4]=V=>xe.value.year=V),ref_key:"yrY",ref:C},null,8,["modelValue"])]),_:1},8,["grid-class"]),ee("div",{class:q(I.$style.yearGrid),tabindex:"0",ref_key:"yearBtns",ref:m},[(ie(!0),le(De,null,yt(ae.value,V=>(ie(),bt(k(Vt),{size:"sm",onClick:X=>O(V),tabindex:"-1"},{default:ut(()=>[mt(Oe(ke(V)),1)]),_:2},1032,["onClick"]))),256))],2)],2),ee("div",{class:q(I.$style.popupSection)},[be(k(st),{"zoa-type":"number",label:"month",options:{placeholder:1,min:1,max:12},modelValue:_.value,"onUpdate:modelValue":F[5]||(F[5]=V=>_.value=V)},null,8,["modelValue"]),ee("div",{class:q(I.$style.monthGrid),tabindex:"0",ref_key:"monthBtns",ref:b},[(ie(!0),le(De,null,yt(R.value,V=>(ie(),bt(k(Vt),{size:"sm",onClick:X=>_.value=V[1],tabindex:"-1"},{default:ut(()=>[mt(Oe(V[0]),1)]),_:2},1032,["onClick"]))),256))],2)],2),ee("div",{class:q(I.$style.popupSection)},[be(k(st),{"zoa-type":"number",label:"day",options:{placeholder:1,min:1,max:A.value},modelValue:z.value,"onUpdate:modelValue":F[6]||(F[6]=V=>z.value=V)},null,8,["options","modelValue"]),ee("div",{class:q(I.$style.dayGrid),tabindex:"0",ref_key:"dayBtns",ref:T},[(ie(!0),le(De,null,yt(G.value,V=>(ie(),bt(k(Vt),{size:"sm",onClick:X=>z.value=V,tabindex:"-1"},{default:ut(()=>[mt(Oe(V||"clear"),1)]),_:2},1032,["onClick"]))),256))],2)],2),ee("div",{class:q(I.$style.popupSection)},[ee("small",{class:q(I.$style.dateRange)},Oe(ge.value.earliest)+" to "+Oe(ge.value.latest),3)],2)],2)):qe("",!0)],10,hx))}},mx={$style:cx},gx=ht(px,[["__cssModules",mx]]),vx="zoa__datesimple__input",yx="zoa__datesimple__inputWrapper",bx="zoa__datesimple__disabled",wx={input:vx,inputWrapper:yx,disabled:bx},_x=["aria-labelledby","aria-describedby"],Tx=["placeholder","min","max","step","id","disabled"],xx={__name:"DateSimple",props:{modelValue:{type:Object},delay:{type:Number,default:200},placeholder:{type:String,default:null},min:{type:String,default:null},max:{type:String,default:null},step:{type:[String,Number],default:"any"}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=ye("inputId"),s=ye("labelId"),a=ye("helpId"),o=ye("disabled"),{value:l}=Rt(e,n),u=$(null);return i({target:u}),(c,h)=>(ie(),le("div",{class:q([c.$style.inputWrapper,k(o)?c.$style.disabled:""]),"aria-labelledby":k(s),"aria-describedby":k(a)},[xt(ee("input",{type:"date",placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,id:k(r),class:q(c.$style.input),"onUpdate:modelValue":h[0]||(h[0]=f=>ze(l)?l.value=f:null),ref_key:"target",ref:u,disabled:k(o)},null,10,Tx),[[dn,k(l)]])],10,_x))}},Sx={$style:wx},Ex=ht(xx,[["__cssModules",Sx]]),Px="zoa__dropdown__input",Rx="zoa__dropdown__inputWrapper",Cx="zoa__dropdown__arrow",Ox="zoa__dropdown__disabled",Ix={input:Px,inputWrapper:Rx,arrow:Cx,disabled:Ox},Ax=["aria-labelledby","aria-describedby"],kx=["id","disabled"],Dx={value:null},Mx=["value"],Nx={__name:"Dropdown",props:{modelValue:{type:String},delay:{type:Number,default:0},placeholder:{type:String,default:"Please choose an option"},options:{type:Array}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=ye("inputId"),s=ye("labelId"),a=ye("helpId"),o=ye("disabled"),l=Y(()=>{let h=[];return n.options.forEach(f=>{typeof f=="object"?h.push({label:f.label||f.value,value:f.value||f.label,order:f.order==null?null:f.order}):h.push({label:f,value:f})}),h.sort((f,p)=>{let m=0;(f.order!=null||p.order!=null)&&(m=f.order!=null&&p.order!=null?f.order-p.order:f.order!=null?-1:1);let b=f.label.localeCompare(p.label);return m!==0?m:b}),h}),{value:u}=Rt(e,n),c=$(null);return i({target:c}),(h,f)=>(ie(),le("div",{class:q([h.$style.inputWrapper,k(o)?h.$style.disabled:""]),"aria-labelledby":k(s),"aria-describedby":k(a)},[xt(ee("select",{id:k(r),class:q(h.$style.input),"onUpdate:modelValue":f[0]||(f[0]=p=>ze(u)?u.value=p:null),ref_key:"target",ref:c,disabled:k(o)},[ee("option",Dx,Oe(t.placeholder),1),(ie(!0),le(De,null,yt(l.value,p=>(ie(),le("option",{value:p.value},Oe(p.label),9,Mx))),256))],10,kx),[[og,k(u)]]),be(k(In),{icon:"fa-solid fa-caret-down",class:q(h.$style.arrow)},null,8,["class"])],10,Ax))}},Lx={$style:Ix},Fx=ht(Nx,[["__cssModules",Lx]]);function*zx(t,i,e=0,n=null){if(t.length===0)return;n===null&&(n=i.length);let r;for(;(r=i.indexOf(t,e))>-1&&!(r+t.length>n);)yield r,e=r+1}function Hx(t){return t.split("").reverse().join("")}var Bx={searchExact:zx,reverse:Hx};const{searchExact:ad,reverse:ld}=Bx;function Ux(t,i,e){t.length>i.length&&([t,i]=[i,t]);const n=i.length-t.length;if(n>e)return!1;if(e===0)return t===i;let r;for(r=0;r=0&&t[s]===i[s+n];s--);t=t.slice(r,s+1),i=i.slice(r,s+1+n);const[a,o]=qs(t,i,e);return a+(i.length-o)<=e}function Vx(t,i){t.length>i.length&&([t,i]=[i,t]);const e=new Array(t.length+1);for(let s=0;s<=t.length;s++)e[s]=s;let n,r;for(let s=0;s=0;n--)e[t[n]]=n;return e}function*Wx(t,i,e){if(t.length>i.length+e)return;const n=Math.floor(t.length/(e+1));if(e===0)for(const r of ad(t,i))yield{start:r,end:r+t.length,dist:0};else n>=10?yield*ud(t,i,e):yield*cd(t,i,e)}function qs(t,i,e){e=+e;let n;for(n=0;nr+e)return;const s=jx(t,e);let a=[],o=[];for(let l=0;l{e("search",U)},n.searchDelay),f=Ws(U=>{c.value=U},n.searchDelay),p=Y({get(){return c.value},set(U){f(U),h(U)}}),m=Y(()=>!u.value||u.value.length!==1?n.itemNamePlural||n.itemName+"s":n.itemName),b=Y(()=>{let U=[];return n.options.forEach(re=>{typeof re=="object"?U.push({label:re.label||re.value,value:re.value||re.label,group:re.group||null,order:re.order==null?null:re.order}):U.push({label:re,value:re,group:null})}),U.sort((re,ce)=>{let Q;re.group===ce.group?Q=0:!re.group||!ce.group?Q=re.group?1:-1:Q=re.group.localeCompare(ce.group);let _e=0;(re.order!=null||ce.order!=null)&&(_e=re.order!=null&&ce.order!=null?re.order-ce.order:re.order!=null?-1:1);let He=re.label.localeCompare(ce.label);return Q!==0?Q:_e!==0?_e:He}),U}),T=Y(()=>{const U=n.enableSearch&&p.value,re=U?p.value.toLowerCase():null,ce=Ie=>Ie?[...Yx.fuzzySearch(re,Ie.toLowerCase(),1)].length>0:!1;let Q;U?Q=b.value.filter(Ie=>ce(Ie.group)||ce(Ie.label)||ce(Ie.value)):Q=b.value;let _e=[],He=Object.entries(Object.groupBy(Q,({group:Ie})=>Ie)),Ve=re?2:1;return He.forEach(Ie=>{let xe=Ie[0],W=Ie[1];xe&&xe!=="null"&&(_e.push({ix:Ve,kind:"group",label:xe,value:xe,group:xe}),Ve+=1),_e=_e.concat(W.map((oe,ae)=>({ix:Ve+ae,kind:"option",label:oe.label,value:oe.value,group:oe.group}))),Ve+=W.length}),_e}),y=$(null),w=$(null),S=$(null);i({target:w});const{y:C}=M0(S),L=Y(()=>!S.value||S.value&&C.value!==S.value.scrollTop?0:C.value),D=Y(()=>{try{return S.value.clientHeight}catch{return 500}}),j=Y(()=>T.value.lengthT.value.length{w.value.focus()},50)}function Re(){try{y.value.blur(),w.value.blur(),S.value.blur()}catch{}K.value=!1}function Ee(){K.value?Re():Se()}pl(y,()=>{Re()}),rt("ArrowDown",()=>{if(b.value.length!==0){if(se.focused.value)S.value.children[0].children[0].children[0].focus();else if(ue.focused.value){const U=[...S.value.querySelectorAll("label")],re=S.value.querySelector("label:focus");if(!re)U[0].focus();else{const ce=U.findIndex(Q=>Q===re);ce===U.length-1?U[0].focus():U[ce+1].focus()}}}}),rt("ArrowUp",()=>{if(b.value.length!==0&&ue.focused.value){const U=[...S.value.querySelectorAll("label")],re=S.value.querySelector("label:focus");if(!re)w.value.focus();else{const ce=U.findIndex(Q=>Q===re);ce===0?w.value.focus():U[ce-1].focus()}}}),rt("Enter",()=>{Re()});const Me=Y({get(){const U=b.value;return u.value==null||u.value.length!==U.length?!1:U.filter(re=>!u.value.includes(re.value)).length===0},set(U){U?u.value=b.value.map(re=>re.value):u.value=[]}}),ge=Y({get(){let U=T.value.filter(re=>re.kind==="option").map(re=>re.value);return u.value==null||u.value.length!u.value.includes(re)).length===0},set(U){let re=T.value.filter(_e=>_e.kind==="option").map(_e=>_e.value);const ce=u.value?u.value:[],Q=re.filter(_e=>!ce.includes(_e));U?u.value=ce.concat(Q):u.value=ce.filter(_e=>!re.includes(_e))}});function ne(U){const re=T.value.filter(Q=>Q.kind==="option"&&Q.group===U).map(Q=>Q.value);u.value=u.value?u.value:[];const ce=re.filter(Q=>!u.value.includes(Q));ce.length>0?ce.forEach(Q=>{u.value.push(Q)}):u.value=u.value.filter(Q=>!re.includes(Q))}return(U,re)=>(ie(),le("div",{class:q([U.$style.inputWrapper,k(l)?U.$style.disabled:""]),ref_key:"container",ref:y,"aria-labelledby":k(a),"aria-describedby":k(o)},[ee("div",{class:q(U.$style.textboxWrapper)},[xt(ee("input",{type:"text",placeholder:t.placeholder,id:k(r),class:q(U.$style.input),"onUpdate:modelValue":re[0]||(re[0]=ce=>p.value=ce),ref_key:"textbox",ref:w,disabled:k(l)},null,10,c1),[[dn,p.value],[us,K.value&&!k(l)]]),xt(ee("div",{class:q(U.$style.input),tabindex:"0",onFocusin:Se},Oe(k(u)?k(u).length:0)+" "+Oe(m.value)+" selected ",35),[[us,!K.value||k(l)]]),be(k(In),{icon:"fa-solid fa-caret-down",class:q(U.$style.arrow),onClick:Ee},null,8,["class"])],2),K.value&&!k(l)?(ie(),le("div",{key:0,class:q(U.$style.options),ref_key:"dropdown",ref:S},[b.value.length>0?(ie(),le("ul",{key:0,class:q(U.$style.optlist)},[ee("li",{title:"Select all",class:q([U.$style.selectAll,U.$style.listItem,U.$style.option]),style:qt({height:`${t.itemHeight}px`})},[be(k(st),{"zoa-type":"checkbox",label:"Select all","label-position":"right",modelValue:Me.value,"onUpdate:modelValue":re[1]||(re[1]=ce=>Me.value=ce)},null,8,["modelValue"])],6),c.value?(ie(),le("li",{key:0,title:"Select results",class:q([U.$style.selectAll,U.$style.listItem,U.$style.option]),style:qt({height:`${t.itemHeight}px`})},[be(k(st),{"zoa-type":"checkbox",label:"Select results","label-position":"right",modelValue:ge.value,"onUpdate:modelValue":re[2]||(re[2]=ce=>ge.value=ce)},null,8,["modelValue"])],6)):qe("",!0),(ie(!0),le(De,null,yt(T.value,ce=>(ie(),le("li",{title:ce.label,class:q([U.$style.listItem,ce.kind==="group"?U.$style.subgroup:U.$style.option]),style:qt({height:`${t.itemHeight}px`})},[ce.kind==="group"?(ie(),le("div",{key:0,onClick:Q=>ne(ce.group)},Oe(ce.label),9,f1)):(ie(),le("div",d1,[ce.ix>=j.value&&ce.ix<=N.value?(ie(),bt(k(st),{key:0,"zoa-type":"checkbox",label:ce.label,"label-position":"right",options:{checkValue:ce.value,name:k(s)("checkboxes")},modelValue:k(u),"onUpdate:modelValue":re[3]||(re[3]=Q=>ze(u)?u.value=Q:null)},null,8,["label","options","modelValue"])):qe("",!0)]))],14,h1))),256))],2)):(ie(),le("div",{key:1,class:q(U.$style.noOptions)},"No options found",2))],2)):qe("",!0)],10,u1))}},m1={$style:l1},g1=ht(p1,[["__cssModules",m1]]),v1="zoa__number__input",y1="zoa__number__inputWrapper",b1="zoa__number__disabled",w1={input:v1,inputWrapper:y1,disabled:b1},_1=["aria-labelledby","aria-describedby"],T1=["placeholder","min","max","step","id","disabled"],x1={__name:"Number",props:{modelValue:{type:Number},delay:{type:Number,default:200},placeholder:{type:Number,default:0},min:{type:Number,default:null},max:{type:Number,default:null},step:{type:Number,default:1}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=ye("inputId"),s=ye("labelId"),a=ye("helpId"),o=ye("disabled"),{value:l}=Rt(e,n),u=$(null);return i({target:u}),(c,h)=>(ie(),le("div",{class:q([c.$style.inputWrapper,k(o)?c.$style.disabled:""]),"aria-labelledby":k(s),"aria-describedby":k(a)},[xt(ee("input",{type:"number",placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,id:k(r),class:q(c.$style.input),"onUpdate:modelValue":h[0]||(h[0]=f=>ze(l)?l.value=f:null),ref_key:"target",ref:u,disabled:k(o)},null,10,T1),[[dn,k(l)]])],10,_1))}},S1={$style:w1},E1=ht(x1,[["__cssModules",S1]]),P1="zoa__rangeslider__input",R1="zoa__rangeslider__inputWrapper",C1={input:P1,inputWrapper:R1},O1=["aria-labelledby","aria-describedby"],I1={__name:"RangeSlider",props:{modelValue:{type:Array},delay:{type:Number,default:200},placeholder:{type:Number,default:null},min:{type:Number,default:0},max:{type:Number,default:100},step:{type:Number,default:1},labelLower:{type:String,default:"Lower"},labelUpper:{type:String,default:"Upper"},labelsRight:{type:Boolean,default:!1}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t;ye("inputId");const r=ye("labelId"),s=ye("helpId"),a=ye("disabled"),{valueChanged:o}=Rt(e,n),l=$(null),u=$(null),c=Y(()=>{if(l.value)return l.value.target}),h=Y(()=>l.value&&u.value?[l.value.target,u.value.target]:[]);i({target:c,elements:h});const f=$(null),p=$(null),m=Y(()=>Math.max(Number(p.value)-Number(n.step),Number(n.min))),b=Y(()=>Math.min(Number(f.value)+Number(n.step),Number(n.max))),T=Y(()=>{const y=Math.min(f.value,m.value),w=Math.max(p.value,b.value);return[y,w]});return $e(T,()=>{o(T.value)}),(y,w)=>(ie(),le("div",{class:q(y.$style.inputWrapper),"aria-labelledby":k(r),"aria-describedby":k(s)},[be(k(st),{"zoa-type":"slider",label:t.labelLower,"label-position":t.labelsRight?"right":"left",options:{min:t.min,max:t.max,step:t.step,validMax:m.value,valueLabelPosition:"above",placeholderPosition:.25},modelValue:f.value,"onUpdate:modelValue":w[0]||(w[0]=S=>f.value=S),ref:"lowerTrack",disabled:k(a)},null,8,["label","label-position","options","modelValue","disabled"]),be(k(st),{"zoa-type":"slider",label:t.labelUpper,"label-position":t.labelsRight?"right":"left",options:{min:t.min,max:t.max,step:t.step,validMin:b.value,placeholderPosition:.75,activeTrackRight:!0},modelValue:p.value,"onUpdate:modelValue":w[1]||(w[1]=S=>p.value=S),ref:"upperTrack",disabled:k(a)},null,8,["label","label-position","options","modelValue","disabled"])],10,O1))}},A1={$style:C1},k1=ht(I1,[["__cssModules",A1]]),D1="zoa__slider__input",M1="zoa__slider__inputWrapper",N1="zoa__slider__track",L1="zoa__slider__valueLabel",F1="zoa__slider__disabled",z1={input:D1,inputWrapper:M1,track:N1,"track--active":"zoa__slider__track--active",valueLabel:L1,"valueLabel--below":"zoa__slider__valueLabel--below","valueLabel--above":"zoa__slider__valueLabel--above",disabled:F1},H1=["aria-labelledby","aria-describedby"],B1=["min","max","step","id","disabled"],U1={__name:"Slider",props:{modelValue:{type:Number},delay:{type:Number,default:200},placeholder:{type:[Number,void 0],default:null},min:{type:Number,default:0},max:{type:Number,default:100},step:{type:Number,default:1},placeholderPosition:{type:Number,default:.5},valueLabelPosition:{type:String,default:"below"},validMin:{type:Number,default:null},validMax:{type:Number,default:null},activeTrackRight:{type:Boolean,default:!1}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=ye("inputId"),s=ye("labelId"),a=ye("helpId"),o=ye("disabled"),{value:l}=Rt(e,n),u=$(null),c=$(null);i({target:u});const h=Y(()=>n.validMin?Math.max(Number(n.validMin),Number(n.min)):Number(n.min)),f=Y(()=>n.validMax?Math.min(Number(n.validMax),Number(n.max)):Number(n.max)),p=ei(u),m=On(c),b=Y(()=>l.valuef.value?f.value:l.value),T=Y(()=>n.activeTrackRight?{left:`${w.value.handle}%`}:{right:`${100-w.value.handle}%`}),y=Y(()=>(l.value-n.min)/(n.max-n.min)),w=Y(()=>S());function S(){try{const N=u.value.clientWidth,K=24;c.value&&(c.value.innerText=b.value);const se=c.value?c.value.clientWidth:0,ue=N/2,Se=(y.value*N-ue)/ue*(K/2),Re=Se+se/2,Ee=Se/N;return{handle:((y.value-Ee)*100).toFixed(2),label:((y.value-Re/N)*100).toFixed(2)}}catch{const N=y.value*100;return{handle:N.toFixed(2),label:N.toFixed(2)}}}function C(){if(n.placeholder!==null&&n.placeholder!==void 0)return n.placeholder;let N=(n.max-n.min)/(1/n.placeholderPosition),K=N%n.step;return N-K+n.min}function L(){if(l.value===n.max)return;let N=Number(l.value)+Number(n.step);N>n.max?l.value=n.max:l.value=N}function D(){if(l.value===n.min)return;let N=Number(l.value)-Number(n.step);N0?L():N.wheelDelta<0&&D()}return rt("ArrowDown",N=>{N.preventDefault(),(p.focused.value||m.focused.value)&&D()}),rt("ArrowLeft",N=>{N.preventDefault(),(p.focused.value||m.focused.value)&&D()}),rt("ArrowUp",N=>{N.preventDefault(),(p.focused.value||m.focused.value)&&L()}),rt("ArrowRight",N=>{N.preventDefault(),(p.focused.value||m.focused.value)&&L()}),$e(l,N=>{Number(N)>=Number(f.value)&&(l.value=f.value),Number(N)<=Number(h.value)&&(l.value=h.value)}),l.value=C(),(N,K)=>(ie(),le("div",{class:q([N.$style.inputWrapper,,k(o)?N.$style.disabled:""]),onWheel:j,"aria-labelledby":k(s),"aria-describedby":k(a)},[ee("span",{class:q(N.$style.track)},null,2),ee("span",{class:q([N.$style.track,N.$style["track--active"]]),style:qt(T.value)},null,6),ee("span",{class:q([N.$style.valueLabel,N.$style[`valueLabel--${t.valueLabelPosition}`]]),style:qt({left:`${w.value.label}%`}),ref_key:"valueLabel",ref:c,tabindex:"0"},Oe(b.value),7),xt(ee("input",{type:"range",min:t.min,max:t.max,step:t.step,id:k(r),class:q(N.$style.input),"onUpdate:modelValue":K[0]||(K[0]=se=>ze(l)?l.value=se:null),ref_key:"slider",ref:u,disabled:k(o)},null,10,B1),[[dn,k(l)]])],42,H1))}},V1={$style:z1},j1=ht(U1,[["__cssModules",V1]]),W1="zoa__textbox__input",G1="zoa__textbox__inputWrapper",q1="zoa__textbox__disabled",K1={input:W1,inputWrapper:G1,disabled:q1},Z1=["aria-labelledby","aria-describedby"],Y1=["placeholder","id","disabled"],X1={__name:"Textbox",props:{modelValue:{type:String},delay:{type:Number,default:200},placeholder:{type:[String,void 0],default:null}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=ye("inputId"),s=ye("labelId"),a=ye("helpId"),o=ye("disabled"),{value:l}=Rt(e,n),u=$(null);return i({target:u}),(c,h)=>(ie(),le("div",{class:q([c.$style.inputWrapper,k(o)?c.$style.disabled:""]),"aria-labelledby":k(s),"aria-describedby":k(a)},[xt(ee("input",{type:"text",placeholder:t.placeholder,id:k(r),class:q(c.$style.input),"onUpdate:modelValue":h[0]||(h[0]=f=>ze(l)?l.value=f:null),ref_key:"target",ref:u,disabled:k(o)},null,10,Y1),[[dn,k(l)]])],10,Z1))}},J1={$style:K1},Q1=ht(X1,[["__cssModules",J1]]),hd={checkbox:{component:YT,multi:!1,delay:0,tabLabel:!0},"date-ambiguous":{component:gx,multi:!1,delay:200},"date-simple":{component:Ex,multi:!1,delay:200},dropdown:{component:Fx,multi:!1,delay:0},multiselect:{component:g1,multi:!1,delay:0},empty:{component:null,multi:!0},number:{component:E1,multi:!1,delay:200},"range-slider":{component:k1,multi:!0,delay:200},slider:{component:j1,multi:!1,delay:200,wrapperProps:["valueLabelPosition"]},"autocomplete-textbox":{component:FT,multi:!1,delay:200},textbox:{component:Q1,multi:!1,delay:200}},$1="zoa__input__input",eS="zoa__input__inputWrapper",tS="zoa__input__rootWrapper",iS="zoa__input__checkbox",nS="zoa__input__slider",rS="zoa__input__emptyGrid",sS="zoa__input__fieldset",oS={input:$1,inputWrapper:eS,rootWrapper:tS,"rootWrapper--above":"zoa__input__rootWrapper--above","rootWrapper--help":"zoa__input__rootWrapper--help","rootWrapper--below":"zoa__input__rootWrapper--below","rootWrapper--left":"zoa__input__rootWrapper--left","rootWrapper--right":"zoa__input__rootWrapper--right","rootWrapper--none":"zoa__input__rootWrapper--none",checkbox:iS,slider:nS,"rootWrapper-valueLabelPosition--below":"zoa__input__rootWrapper-valueLabelPosition--below","rootWrapper-valueLabelPosition--above":"zoa__input__rootWrapper-valueLabelPosition--above","range-slider":"zoa__input__range-slider",emptyGrid:rS,fieldset:sS},aS=["id"],lS={__name:"Input",props:{modelValue:{default:void 0},zoaType:{type:String,default:"empty"},class:{type:[String,Array,null],default:null},label:{type:String,default:"Input"},labelPosition:{type:String,default:"above"},options:{type:Object,default:()=>({})},gridClass:{type:[String,Array,null],default:null},help:{type:[String,null],default:null},helpPosition:{type:String,default:"right"},disabled:{type:Boolean,default:!1}},emits:["change","update:modelValue"],setup(t,{expose:i,emit:e}){const n=t,r=Y(()=>{let N=hd[n.zoaType];return N==null&&(N=hd.empty),N}),s=Y(()=>r.value.component),{componentId:a,subId:o}=dl(),l=o("input"),u=o("label"),c=o("help"),h=Y(()=>{let N=["rootWrapper",`rootWrapper--${n.labelPosition}`,n.zoaType];return n.help&&N.push("rootWrapper--help"),r.value.wrapperProps&&r.value.wrapperProps.forEach(K=>{n.options[K]!=null&&N.push(`rootWrapper-${K}--${n.options[K]}`)}),N}),{addPropClasses:f}=Sr(n),{value:p}=Rt(e,n),m=$(null),b=Y(()=>n.label),T=Y(()=>n.labelPosition),y=Y(()=>n.help?c:null),w=Y(()=>n.disabled);St("label",b),St("labelPosition",T),St("componentId",a),St("subId",o),St("inputId",l),St("labelId",u),St("helpId",y),St("rootContainer",m),St("disabled",w);const S=$(null);function C(){S.value&&S.value.target.focus()}function L(){S.value&&S.value.target.blur()}const D=Y(()=>{if(S.value)return S.value.target}),j=Y(()=>S.value&&S.value.elements?S.value.elements:{});return i({focus:C,blur:L,target:D,elements:j}),(N,K)=>(ie(),le("div",{id:k(a),ref_key:"rootContainer",ref:m,class:q(k(f)(h.value.map(se=>N.$style[se])))},[r.value.multi?(ie(),le("fieldset",{key:0,class:q(N.$style.fieldset)},[be($f,{"input-id":k(l),legend:!0,label:t.label,"label-position":t.labelPosition,tabbable:r.value.tabLabel},null,8,["input-id","label","label-position","tabbable"]),t.help?(ie(),bt(sd,{key:0,text:t.help,position:t.helpPosition},null,8,["text","position"])):qe("",!0),s.value==null?(ie(),le("div",{key:1,class:q([t.gridClass||N.$style.emptyGrid,N.$style.inputWrapper])},[Ei(N.$slots,"default")],2)):(ie(),bt(k(s),ns({key:2},t.options,{modelValue:k(p),"onUpdate:modelValue":K[0]||(K[0]=se=>ze(p)?p.value=se:null),ref_key:"inputComponent",ref:S}),null,16,["modelValue"]))],2)):(ie(),le(De,{key:1},[be($f,{"input-id":k(l),legend:!1,label:t.label,"label-position":t.labelPosition,tabbable:r.value.tabLabel,help:t.help},null,8,["input-id","label","label-position","tabbable","help"]),t.help?(ie(),bt(sd,{key:0,text:t.help,position:t.helpPosition},null,8,["text","position"])):qe("",!0),be(k(s),ns(t.options,{modelValue:k(p),"onUpdate:modelValue":K[1]||(K[1]=se=>ze(p)?p.value=se:null),ref_key:"inputComponent",ref:S}),null,16,["modelValue"])],64))],10,aS))}},uS={$style:oS},st=ht(lS,[["__cssModules",uS]]);function cS(t){return{icon:Y(()=>{switch(t.kind){case"info":return"fa-circle-info";case"warning":return"fa-circle-exclamation";case"error":return"fa-circle-xmark";case"success":return"fa-circle-check";default:return"fa-circle-question"}})}}const hS="zoa__modal__main",fS="zoa__modal__container",dS="zoa__modal__header",pS="zoa__modal__icon",mS="zoa__modal__headerText",gS="zoa__modal__content",vS="zoa__modal__form",yS="zoa__modal__close",bS={main:hS,container:fS,header:dS,icon:pS,headerText:mS,content:gS,"kind--info":"zoa__modal__kind--info","kind--warning":"zoa__modal__kind--warning","kind--error":"zoa__modal__kind--error","kind--success":"zoa__modal__kind--success",form:vS,close:yS},wS={__name:"Modal",props:{class:{type:[String,Array,null],default:null},kind:{type:String,default:"info"},header:{type:String,default:"Here is an informational message."},message:{type:String,default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Duis at tellus at urna condimentum."},buttonArgs:{type:Object,default:()=>({label:"Open modal"})}},emits:["opened","closed"],setup(t,{emit:i}){const e=t,{icon:n}=cS(e),{addPropClasses:r}=Sr(e),s=$(null);function a(){s.value.show(),i("opened")}return pl(s,()=>{s.value.close(),i("closed")}),(o,l)=>(ie(),le(De,null,[be(k(Vt),ns(t.buttonArgs,{onClick:a}),{default:ut(()=>[Ei(o.$slots,"button")]),_:3},16),ee("dialog",{ref_key:"modal",ref:s,class:q(k(r)([o.$style.main,o.$style[`kind--${t.kind}`]]))},[ee("div",{class:q(o.$style.container)},[ee("div",{class:q(o.$style.header)},[be(k(In),{icon:["fa-solid",k(n)],class:q(o.$style.icon)},null,8,["icon","class"]),ee("h2",{class:q(o.$style.headerText)},[Ei(o.$slots,"header",{},()=>[mt(Oe(t.header),1)])],2),ee("form",{method:"dialog",class:q(o.$style.form),onSubmit:l[0]||(l[0]=u=>i("closed"))},[ee("button",{class:q(o.$style.close)},[be(k(In),{icon:"fa-solid fa-xmark"})],2)],34)],2),ee("div",{class:q(o.$style.content)},[Ei(o.$slots,"default",{},()=>[mt(Oe(t.message),1)])],2)],2)],2)],64))}},_S={$style:bS},TS=ht(wS,[["__cssModules",_S]]),xS={main:"liv_search__main",input:"liv_search__input",buttons:"liv_search__buttons"},nn=(t,i)=>{const e=t.__vccOpts||t;for(const[n,r]of i)e[n]=r;return e},SS=nn({__name:"Search",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(t){const i=Qu(t,"modelValue"),e=zi(),n=qf(),r=$(null),s=$([]),a=Y(()=>e.resourceRepo.all().map(S=>({label:S.name,value:S.id,group:S.packageName}))),o=Y(()=>s.value.map(S=>e.resourceRepo.find(S)).filter(S=>S!=null)),l=Y(()=>o.value.length>0?o.value.every(S=>S.dwc||S.id==="bb909597-dedf-427d-8c04-4c02b3a24db3"):!1),u=$(null),c=["scientificName","currentScientificName","kingdom","phylum","class","order","family","genus","specificEpithet","infraspecificEpithet","higherClassification"],h=$([]),f=$([{value:"Type",order:0},{value:"Non-type",order:1},{value:"Paratype",order:2},{value:"Holotype",order:3},{value:"Syntype",order:4},{value:"Isotype",order:5},{value:"Lectotype",order:6},{value:"Paralectotype",order:7},{value:"Original material",order:8},{value:"Isolectotype",order:9},{value:"Cotype",order:10},{value:"Figured",order:11},{value:"Isosyntype",order:12}]),p=$([]),m=$([{value:"Drawer scan",order:0},{value:"Specimen",order:1},{value:"Register",order:2},{value:"Label",order:3},{value:"Document",order:4},{value:"Other",order:5}]);function b(S,C,L="string_equals"){if(S.length===1){let D={};return D[L]={fields:C,value:S[0]},D}else return{or:S.map(D=>{let j={};return j[L]={fields:C,value:D},j})}}function T(){let S={query:{},resource_ids:[...e.query.resource_ids]},C={};n.mode.enableFilters&&(r.value&&(S.query.search=r.value),l.value&&((u.value||h.value||p.value)&&(S.query.filters={and:[]}),u.value&&S.query.filters.and.push(b([u.value],c,"string_contains")),h.value.length>0&&S.query.filters.and.push(b(h.value,["typeStatus","materialType"])),p.value.length>0&&(S.query.filters.and.push(b(p.value,["associatedMedia.category"])),C.category=p.value))),n.mode.enableResources&&(S.resource_ids=[...s.value]),e.setQuery(S,C),i.value=!1}function y(){if(e.query.query&&(r.value=e.query.query.search,e.query.query.filters&&e.query.query.filters.and)){let j=function(N){N.forEach(K=>{const se=Object.entries(K)[0];se[0]==="or"&&j(se[1]),se[0]==="string_equals"&&(se[1].fields[0]==="typeStatus"?S.push(se[1].value):se[1].fields[0]==="associatedMedia.category"?C.push(se[1].value):JSON.stringify(se[1].fields.sort())===D&&(L=se[1].value))})},S=[],C=[],L=null;const D=JSON.stringify(c.sort());j(e.query.query.filters.and),h.value=S,p.value=C,u.value=L}}function w(){r.value=null,u.value=null,h.value=[],p.value=[],n.mode.enableResources&&(s.value=[])}return Fi.on(br.querySet,S=>{y()}),oi(()=>{s.value=[...e.query.resource_ids],setTimeout(y,200)}),(S,C)=>(ie(),le("div",{class:q(S.$style.main)},[k(n).mode&&k(n).mode.enableFilters?(ie(),le(De,{key:0},[be(k(st),{"zoa-type":"textbox",label:"Keywords",options:{placeholder:"Search everything"},modelValue:r.value,"onUpdate:modelValue":C[0]||(C[0]=L=>r.value=L),class:q(S.$style.input)},null,8,["modelValue","class"]),l.value?(ie(),le(De,{key:0},[be(k(st),{"zoa-type":"textbox",label:"Search taxa",options:{placeholder:"e.g. coleoptera"},modelValue:u.value,"onUpdate:modelValue":C[1]||(C[1]=L=>u.value=L),class:q(S.$style.input)},null,8,["options","modelValue","class"]),be(k(st),{"zoa-type":"multiselect",label:"Type status",options:{options:f.value,enableSearch:!0},modelValue:h.value,"onUpdate:modelValue":C[2]||(C[2]=L=>h.value=L),class:q(S.$style.input)},null,8,["options","modelValue","class"]),be(k(st),{"zoa-type":"multiselect",label:"Image category",options:{options:m.value,enableSearch:!0},modelValue:p.value,"onUpdate:modelValue":C[3]||(C[3]=L=>p.value=L),class:q(S.$style.input)},null,8,["options","modelValue","class"])],64)):qe("",!0)],64)):qe("",!0),k(n).mode&&k(n).mode.enableResources?(ie(),bt(k(st),{key:1,"zoa-type":"multiselect",label:"Resources",options:{options:a.value,enableSearch:!0},modelValue:s.value,"onUpdate:modelValue":C[4]||(C[4]=L=>s.value=L),class:q(S.$style.input)},null,8,["options","modelValue","class"])):qe("",!0),ee("div",{class:q(S.$style.buttons)},[be(k(Vt),{onClick:w},{default:ut(()=>[mt("Clear")]),_:1}),be(k(Vt),{onClick:T},{default:ut(()=>[mt("Apply")]),_:1})],2)],2))}},[["__cssModules",{$style:xS}]]),ES={resultsHeader:"liv_results__resultsHeader",status:"liv_results__status",viewTabs:"liv_results__viewTabs",buttons:"liv_results__buttons",resetButton:"liv_results__resetButton",filterButton:"liv_results__filterButton",noResults:"liv_results__noResults"},PS={key:0,class:"fas fa-spinner fa-spin fa-lg"},RS=ee("i",{class:"fas fa-undo-alt"},null,-1),CS=ee("span",{class:"sr-only"},"Reset to defaults",-1),fd=nn({__name:"Results",setup(t){const i=zi(),e=qf(),n=d0(),r=$l({gallery:bu({loader:()=>Promise.resolve().then(()=>mR)}),list:bu({loader:()=>Promise.resolve().then(()=>yR)})}),s=[{label:"Gallery",value:"gallery",order:0},{label:"List",value:"list",order:1}],a=$(null),o=Y(()=>r.value[a.value]),l=$(!1);function u(){n.push("/").then(()=>{window.location.reload()})}return oi(()=>{e.loadData()}),(c,h)=>(ie(),le("div",null,[ee("div",{class:q(c.$style.resultsHeader)},[ee("span",{class:q(c.$style.status)},"Loaded "+Oe(k(i).allImages.length)+" images from "+Oe(k(i).totalRecords)+" total records",3),k(i).state.loading?(ie(),le("i",PS)):qe("",!0)],2),ee("div",{class:q(c.$style.buttons)},[be(k(eT),{options:s,modelValue:a.value,"onUpdate:modelValue":h[0]||(h[0]=f=>a.value=f),class:q(c.$style.viewTabs)},null,8,["modelValue","class"]),be(k(Vt),{onClick:u,size:"sm",class:q(c.$style.resetButton)},{default:ut(()=>[RS,CS]),_:1},8,["class"]),k(e).mode&&!k(e).mode.lockAll?(ie(),bt(k(G0),{key:0,label:"Filters",modelValue:l.value,"onUpdate:modelValue":h[1]||(h[1]=f=>l.value=f),class:q(c.$style.filterButton)},null,8,["modelValue","class"])):qe("",!0)],2),(ie(),bt(wu,null,[l.value?(ie(),bt(SS,{key:0,modelValue:l.value,"onUpdate:modelValue":h[2]||(h[2]=f=>l.value=f)},null,8,["modelValue"])):qe("",!0)],1024)),k(i).totalRecords>0?(ie(),bt(wu,{key:0},[be(k(o))],1024)):k(i).state.attempted&&!k(i).state.loading?(ie(),le("div",{key:1,class:q(c.$style.noResults)}," No results. ",2)):qe("",!0)]))}},[["__cssModules",{$style:ES}]]),OS=h0({routes:[{path:"/",component:fd},{path:"/:mode*",component:fd}],history:C_("/image-viewer/")});var dd={exports:{}};(function(t){//! openseadragon 4.0.0 //! Built on 2022-12-16 //! Git commit: v4.0.0-0-8e6196a //! http://openseadragon.github.io //! License: http://openseadragon.github.io/license/ -function i(e){return new i.Viewer(e)}(function(e){e.version={versionStr:"4.0.0",major:parseInt("4",10),minor:parseInt("0",10),revision:parseInt("0",10)};var n={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"},r=Object.prototype.toString,s=Object.prototype.hasOwnProperty;e.isFunction=function(a){return e.type(a)==="function"},e.isArray=Array.isArray||function(a){return e.type(a)==="array"},e.isWindow=function(a){return a&&typeof a=="object"&&"setInterval"in a},e.type=function(a){return a==null?String(a):n[r.call(a)]||"object"},e.isPlainObject=function(a){if(!a||i.type(a)!=="object"||a.nodeType||e.isWindow(a)||a.constructor&&!s.call(a,"constructor")&&!s.call(a.constructor.prototype,"isPrototypeOf"))return!1;var o;for(var l in a)o=l;return o===void 0||s.call(a,o)},e.isEmptyObject=function(a){for(var o in a)return!1;return!0},e.freezeObject=function(a){return Object.freeze?e.freezeObject=Object.freeze:e.freezeObject=function(o){return o},e.freezeObject(a)},e.supportsCanvas=function(){var a=document.createElement("canvas");return!!(e.isFunction(a.getContext)&&a.getContext("2d"))}(),e.isCanvasTainted=function(a){var o=!1;try{a.getContext("2d").getImageData(0,0,1,1)}catch{o=!0}return o},e.supportsAddEventListener=function(){return!!(document.documentElement.addEventListener&&document.addEventListener)}(),e.supportsRemoveEventListener=function(){return!!(document.documentElement.removeEventListener&&document.removeEventListener)}(),e.supportsEventListenerOptions=function(){var a=0;if(e.supportsAddEventListener)try{var o={get capture(){return a++,!1},get once(){return a++,!1},get passive(){return a++,!1}};window.addEventListener("test",null,o),window.removeEventListener("test",null,o)}catch{a=0}return a>=3}(),e.getCurrentPixelDensityRatio=function(){if(e.supportsCanvas){var a=document.createElement("canvas").getContext("2d"),o=window.devicePixelRatio||1,l=a.webkitBackingStorePixelRatio||a.mozBackingStorePixelRatio||a.msBackingStorePixelRatio||a.oBackingStorePixelRatio||a.backingStorePixelRatio||1;return Math.max(o,1)/l}else return 1},e.pixelDensityRatio=e.getCurrentPixelDensityRatio()})(i),function(e){e.extend=function(){var l,u,c,h,f,p,m=arguments[0]||{},b=arguments.length,T=!1,y=1;for(typeof m=="boolean"&&(T=m,m=arguments[1]||{},y=2),typeof m!="object"&&!i.isFunction(m)&&(m={}),b===y&&(m=this,--y);y=c.x&&u.x=c.y},getMousePosition:function(l){if(typeof l.pageX=="number")e.getMousePosition=function(u){var c=new e.Point;return c.x=u.pageX,c.y=u.pageY,c};else if(typeof l.clientX=="number")e.getMousePosition=function(u){var c=new e.Point;return c.x=u.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,c.y=u.clientY+document.body.scrollTop+document.documentElement.scrollTop,c};else throw new Error("Unknown event mouse position, no known technique.");return e.getMousePosition(l)},getPageScroll:function(){var l=document.documentElement||{},u=document.body||{};if(typeof window.pageXOffset=="number")e.getPageScroll=function(){return new e.Point(window.pageXOffset,window.pageYOffset)};else if(u.scrollLeft||u.scrollTop)e.getPageScroll=function(){return new e.Point(document.body.scrollLeft,document.body.scrollTop)};else if(l.scrollLeft||l.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(l){if(typeof window.scrollTo<"u")e.setPageScroll=function(h){window.scrollTo(h.x,h.y)};else{var u=e.getPageScroll();if(u.x===l.x&&u.y===l.y)return;document.body.scrollLeft=l.x,document.body.scrollTop=l.y;var c=e.getPageScroll();if(c.x!==u.x&&c.y!==u.y){e.setPageScroll=function(h){document.body.scrollLeft=h.x,document.body.scrollTop=h.y};return}if(document.documentElement.scrollLeft=l.x,document.documentElement.scrollTop=l.y,c=e.getPageScroll(),c.x!==u.x&&c.y!==u.y){e.setPageScroll=function(h){document.documentElement.scrollLeft=h.x,document.documentElement.scrollTop=h.y};return}e.setPageScroll=function(h){}}e.setPageScroll(l)},getWindowSize:function(){var l=document.documentElement||{},u=document.body||{};if(typeof window.innerWidth=="number")e.getWindowSize=function(){return new e.Point(window.innerWidth,window.innerHeight)};else if(l.clientWidth||l.clientHeight)e.getWindowSize=function(){return new e.Point(document.documentElement.clientWidth,document.documentElement.clientHeight)};else if(u.clientWidth||u.clientHeight)e.getWindowSize=function(){return new e.Point(document.body.clientWidth,document.body.clientHeight)};else throw new Error("Unknown window size, no known technique.");return e.getWindowSize()},makeCenteredNode:function(l){l=e.getElement(l);var u=[e.makeNeutralElement("div"),e.makeNeutralElement("div"),e.makeNeutralElement("div")];return e.extend(u[0].style,{display:"table",height:"100%",width:"100%"}),e.extend(u[1].style,{display:"table-row"}),e.extend(u[2].style,{display:"table-cell",verticalAlign:"middle",textAlign:"center"}),u[0].appendChild(u[1]),u[1].appendChild(u[2]),u[2].appendChild(l),u[0]},makeNeutralElement:function(l){var u=document.createElement(l),c=u.style;return c.background="transparent none",c.border="none",c.margin="0px",c.padding="0px",c.position="static",u},now:function(){return Date.now?e.now=Date.now:e.now=function(){return new Date().getTime()},e.now()},makeTransparentImage:function(l){var u=e.makeNeutralElement("img");return u.src=l,u},setElementOpacity:function(l,u,c){var h,f;l=e.getElement(l),c&&!e.Browser.alpha&&(u=Math.round(u)),e.Browser.opacity?l.style.opacity=u<1?u:"":u<1?(h=Math.round(100*u),f="alpha(opacity="+h+")",l.style.filter=f):l.style.filter=""},setElementTouchActionNone:function(l){l=e.getElement(l),typeof l.style.touchAction<"u"?l.style.touchAction="none":typeof l.style.msTouchAction<"u"&&(l.style.msTouchAction="none")},setElementPointerEvents:function(l,u){l=e.getElement(l),typeof l.style<"u"&&typeof l.style.pointerEvents<"u"&&(l.style.pointerEvents=u)},setElementPointerEventsNone:function(l){e.setElementPointerEvents(l,"none")},addClass:function(l,u){l=e.getElement(l),l.className?(" "+l.className+" ").indexOf(" "+u+" ")===-1&&(l.className+=" "+u):l.className=u},indexOf:function(l,u,c){return Array.prototype.indexOf?this.indexOf=function(h,f,p){return h.indexOf(f,p)}:this.indexOf=function(h,f,p){var m,b=p||0,T;if(!h)throw new TypeError;if(T=h.length,T===0||b>=T)return-1;for(b<0&&(b=T-Math.abs(b)),m=b;m=200&&T.status<300||T.status===0&&b!=="http:"&&b!=="https:"?u(T):e.isFunction(c)?c(T):e.console.error("AJAX request returned %d: %s",T.status,l))};var y=m?"POST":"GET";try{if(T.open(y,l,!0),p&&(T.responseType=p),f)for(var w in f)Object.prototype.hasOwnProperty.call(f,w)&&f[w]&&T.setRequestHeader(w,f[w]);h&&(T.withCredentials=!0),T.send(m)}catch(S){e.console.error("%s while making AJAX request: %s",S.name,S.message),T.onreadystatechange=function(){},e.isFunction(c)&&c(T,S)}return T},jsonp:function(l){var u,c=l.url,h=document.head||document.getElementsByTagName("head")[0]||document.documentElement,f=l.callbackName||"openseadragon"+e.now(),p=window[f],m="$1"+f+"$2",b=l.param||"callback",T=l.callback;c=c.replace(/(=)\?(&|$)|\?\?/i,m),c+=(/\?/.test(c)?"&":"?")+b+"="+f,window[f]=function(y){if(p)window[f]=p;else try{delete window[f]}catch{}T&&e.isFunction(T)&&T(y)},u=document.createElement("script"),(l.async!==void 0||l.async!==!1)&&(u.async="async"),l.scriptCharset&&(u.charset=l.scriptCharset),u.src=c,u.onload=u.onreadystatechange=function(y,w){(w||!u.readyState||/loaded|complete/.test(u.readyState))&&(u.onload=u.onreadystatechange=null,h&&u.parentNode&&h.removeChild(u),u=void 0)},h.insertBefore(u,h.firstChild)},createFromDZI:function(){throw"OpenSeadragon.createFromDZI is deprecated, use Viewer.open."},parseXml:function(l){if(window.DOMParser)e.parseXml=function(u){var c=null,h;return h=new DOMParser,c=h.parseFromString(u,"text/xml"),c};else if(window.ActiveXObject)e.parseXml=function(u){var c=null;return c=new ActiveXObject("Microsoft.XMLDOM"),c.async=!1,c.loadXML(u),c};else throw new Error("Browser doesn't support XML DOM.");return e.parseXml(l)},parseJSON:function(l){return e.parseJSON=window.JSON.parse,e.parseJSON(l)},imageFormatSupported:function(l){return l=l||"",!!s[l.toLowerCase()]},setImageFormatsSupported:function(l){e.extend(s,l)}});var r=function(l){};e.console=window.console||{log:r,debug:r,info:r,warn:r,error:r,assert:r},e.Browser={vendor:e.BROWSERS.UNKNOWN,version:0,alpha:!0};var s={bmp:!1,jpeg:!0,jpg:!0,png:!0,tif:!1,wdp:!1},a={};(function(){var l=navigator.appVersion,u=navigator.userAgent,c;switch(navigator.appName){case"Microsoft Internet Explorer":window.attachEvent&&window.ActiveXObject&&(e.Browser.vendor=e.BROWSERS.IE,e.Browser.version=parseFloat(u.substring(u.indexOf("MSIE")+5,u.indexOf(";",u.indexOf("MSIE")))));break;case"Netscape":window.addEventListener&&(u.indexOf("Edge")>=0?(e.Browser.vendor=e.BROWSERS.EDGE,e.Browser.version=parseFloat(u.substring(u.indexOf("Edge")+5))):u.indexOf("Edg")>=0?(e.Browser.vendor=e.BROWSERS.CHROMEEDGE,e.Browser.version=parseFloat(u.substring(u.indexOf("Edg")+4))):u.indexOf("Firefox")>=0?(e.Browser.vendor=e.BROWSERS.FIREFOX,e.Browser.version=parseFloat(u.substring(u.indexOf("Firefox")+8))):u.indexOf("Safari")>=0?(e.Browser.vendor=u.indexOf("Chrome")>=0?e.BROWSERS.CHROME:e.BROWSERS.SAFARI,e.Browser.version=parseFloat(u.substring(u.substring(0,u.indexOf("Safari")).lastIndexOf("/")+1,u.indexOf("Safari")))):(c=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})"),c.exec(u)!==null&&(e.Browser.vendor=e.BROWSERS.IE,e.Browser.version=parseFloat(RegExp.$1))));break;case"Opera":e.Browser.vendor=e.BROWSERS.OPERA,e.Browser.version=parseFloat(l);break}var h=window.location.search.substring(1),f=h.split("&"),p,m,b;for(b=0;b0){var T=p.substring(0,m),y=p.substring(m+1);try{a[T]=decodeURIComponent(y)}catch{e.console.error("Ignoring malformed URL parameter: %s=%s",T,y)}}e.Browser.alpha=!(e.Browser.vendor===e.BROWSERS.CHROME&&e.Browser.version<2),e.Browser.opacity=!0,e.Browser.vendor===e.BROWSERS.IE&&e.Browser.version<11&&e.console.error("Internet Explorer versions < 11 are not supported by OpenSeadragon")})(),function(l){var u=l.requestAnimationFrame||l.mozRequestAnimationFrame||l.webkitRequestAnimationFrame||l.msRequestAnimationFrame,c=l.cancelAnimationFrame||l.mozCancelAnimationFrame||l.webkitCancelAnimationFrame||l.msCancelAnimationFrame;if(u&&c)e.requestAnimationFrame=function(){return u.apply(l,arguments)},e.cancelAnimationFrame=function(){return c.apply(l,arguments)};else{var h=[],f=[],p=0,m;e.requestAnimationFrame=function(b){return h.push([++p,b]),m||(m=setInterval(function(){if(h.length){var T=e.now(),y=f;for(f=h,h=y;f.length;)f.shift()[1](T)}else clearInterval(m),m=void 0},1e3/50)),p},e.cancelAnimationFrame=function(b){var T,y;for(T=0,y=h.length;T8||"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 v=document.createElement("div");return e.isFunction(v.setPointerCapture)&&e.isFunction(v.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 v=document.createElement("div");return e.isFunction(v.setCapture)&&e.isFunction(v.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(v){this._gPoints=[],this.type=v,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(v){return this._gPoints.push(v)},removeById:function(v){var g,x=this._gPoints.length;for(g=0;g1&&(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 a(v){var g=n[v.hash],x,E,B,J,fe,xe=g.activePointersLists.length;for(x=0;x0){for(fe=[],J=B.asArray(),E=0;Eg.touches.length-B&&e.console.warn("Tracked touch contact count doesn't match event.touches.length");var xe={originalEvent:g,eventType:"pointerdown",pointerType:"touch",isEmulated:!1};for(A(v,xe),E=0;E"u"?!0:r.attachToViewer,this.autoFade=typeof r.autoFade>"u"?!0:r.autoFade,this.element=n,this.anchor=r.anchor,this.container=s,this.anchor===e.ControlAnchor.ABSOLUTE?(this.wrapper=e.makeNeutralElement("div"),this.wrapper.style.position="absolute",this.wrapper.style.top=typeof r.top=="number"?r.top+"px":r.top,this.wrapper.style.left=typeof r.left=="number"?r.left+"px":r.left,this.wrapper.style.height=typeof r.height=="number"?r.height+"px":r.height,this.wrapper.style.width=typeof r.width=="number"?r.width+"px":r.width,this.wrapper.style.margin="0px",this.wrapper.style.padding="0px",this.element.style.position="relative",this.element.style.top="0px",this.element.style.left="0px",this.element.style.height="100%",this.element.style.width="100%"):(this.wrapper=e.makeNeutralElement("div"),this.wrapper.style.display="inline-block",this.anchor===e.ControlAnchor.NONE&&(this.wrapper.style.width=this.wrapper.style.height="100%")),this.wrapper.appendChild(this.element),r.attachToViewer?this.anchor===e.ControlAnchor.TOP_RIGHT||this.anchor===e.ControlAnchor.BOTTOM_RIGHT?this.container.insertBefore(this.wrapper,this.container.firstChild):this.container.appendChild(this.wrapper):a.appendChild(this.wrapper)},e.Control.prototype={destroy:function(){this.wrapper.removeChild(this.element),this.anchor!==e.ControlAnchor.NONE&&this.container.removeChild(this.wrapper)},isVisible:function(){return this.wrapper.style.display!=="none"},setVisible:function(n){this.wrapper.style.display=n?this.anchor===e.ControlAnchor.ABSOLUTE?"block":"inline-block":"none"},setOpacity:function(n){this.element[e.SIGNAL]&&e.Browser.vendor===e.BROWSERS.IE?e.setElementOpacity(this.element,n,!0):e.setElementOpacity(this.wrapper,n,!0)}}}(i),function(e){e.ControlDock=function(r){var s=["topleft","topright","bottomright","bottomleft"],a,o;for(e.extend(!0,this,{id:"controldock-"+e.now()+"-"+Math.floor(Math.random()*1e6),container:e.makeNeutralElement("div"),controls:[]},r),this.container.onsubmit=function(){return!1},this.element&&(this.element=e.getElement(this.element),this.element.appendChild(this.container),this.element.style.position="relative",this.container.style.width="100%",this.container.style.height="100%"),o=0;o=0)){switch(s.anchor){case e.ControlAnchor.TOP_RIGHT:a=this.controls.topright,r.style.position="relative",r.style.paddingRight="0px",r.style.paddingTop="0px";break;case e.ControlAnchor.BOTTOM_RIGHT:a=this.controls.bottomright,r.style.position="relative",r.style.paddingRight="0px",r.style.paddingBottom="0px";break;case e.ControlAnchor.BOTTOM_LEFT:a=this.controls.bottomleft,r.style.position="relative",r.style.paddingLeft="0px",r.style.paddingBottom="0px";break;case e.ControlAnchor.TOP_LEFT:a=this.controls.topleft,r.style.position="relative",r.style.paddingLeft="0px",r.style.paddingTop="0px";break;case e.ControlAnchor.ABSOLUTE:a=this.container,r.style.margin="0px",r.style.padding="0px";break;default:case e.ControlAnchor.NONE:a=this.container,r.style.margin="0px",r.style.padding="0px";break}this.controls.push(new e.Control(r,s,a)),r.style.display="inline-block"}},removeControl:function(r){r=e.getElement(r);var s=n(this,r);return s>=0&&(this.controls[s].destroy(),this.controls.splice(s,1)),this},clearControls:function(){for(;this.controls.length>0;)this.controls.pop().destroy();return this},areControlsEnabled:function(){var r;for(r=this.controls.length-1;r>=0;r--)if(this.controls[r].isVisible())return!0;return!1},setControlsEnabled:function(r){var s;for(s=this.controls.length-1;s>=0;s--)this.controls[s].setVisible(r);return this}};function n(r,s){var a=r.controls,o;for(o=a.length-1;o>=0;o--)if(a[o].element===s)return o;return-1}}(i),function(e){e.Placement=e.freezeObject({CENTER:0,TOP_LEFT:1,TOP:2,TOP_RIGHT:3,RIGHT:4,BOTTOM_RIGHT:5,BOTTOM:6,BOTTOM_LEFT:7,LEFT:8,properties:{0:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!1,isVerticallyCentered:!0,isBottom:!1},1:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!0,isVerticallyCentered:!1,isBottom:!1},2:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!0,isVerticallyCentered:!1,isBottom:!1},3:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!0,isVerticallyCentered:!1,isBottom:!1},4:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!1,isVerticallyCentered:!0,isBottom:!1},5:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!1,isVerticallyCentered:!1,isBottom:!0},6:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!1,isVerticallyCentered:!1,isBottom:!0},7:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!1,isVerticallyCentered:!1,isBottom:!0},8:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!1,isVerticallyCentered:!0,isBottom:!1}}})}(i),function(e){var n={},r=1;e.Viewer=function(d){var _=arguments,R=this,A;if(e.isPlainObject(d)||(d={id:_[0],xmlPath:_.length>1?_[1]:void 0,prefixUrl:_.length>2?_[2]:void 0,controls:_.length>3?_[3]:void 0,overlays:_.length>4?_[4]:void 0}),d.config&&(e.extend(!0,d,d.config),delete d.config),e.extend(!0,this,{id:d.id,hash:d.hash||r++,initialPage:0,element:null,container:null,canvas:null,overlays:[],overlaysContainer:null,previousBody:[],customControls:[],source:null,drawer:null,world:null,viewport:null,navigator:null,collectionViewport:null,collectionDrawer:null,navImages:null,buttonGroup:null,profiler:null},e.DEFAULT_SETTINGS,d),typeof this.hash>"u")throw new Error("A hash must be defined, either by specifying options.id or options.hash.");for(typeof n[this.hash]<"u"&&e.console.warn("Hash "+this.hash+" has already been used."),n[this.hash]={fsBoundsDelta:new e.Point(1,1),prevContainerSize:null,animating:!1,forceRedraw:!1,needsResize:!1,forceResize:!1,mouseInside:!1,group:null,zooming:!1,zoomFactor:null,lastZoomTime:null,fullPage:!1,onfullscreenchange:null,lastClickTime:null,draggingToZoom:!1},this._sequenceIndex=0,this._firstOpen=!0,this._updateRequestId=null,this._loadQueue=[],this.currentOverlays=[],this._updatePixelDensityRatioBind=null,this._lastScrollTime=e.now(),e.EventSource.call(this),this.addHandler("open-failed",function(M){var H=e.getString("Errors.OpenFailed",M.eventSource,M.message);R._showMessage(H)}),e.ControlDock.call(this,d),this.xmlPath&&(this.tileSources=[this.xmlPath]),this.element=this.element||document.getElementById(this.id),this.canvas=e.makeNeutralElement("div"),this.canvas.className="openseadragon-canvas",function(M){M.width="100%",M.height="100%",M.overflow="hidden",M.position="absolute",M.top="0px",M.left="0px"}(this.canvas.style),e.setElementTouchActionNone(this.canvas),d.tabIndex!==""&&(this.canvas.tabIndex=d.tabIndex===void 0?0:d.tabIndex),this.container.className="openseadragon-container",function(M){M.width="100%",M.height="100%",M.position="relative",M.overflow="hidden",M.left="0px",M.top="0px",M.textAlign="left"}(this.container.style),e.setElementTouchActionNone(this.container),this.container.insertBefore(this.canvas,this.container.firstChild),this.element.appendChild(this.container),this.bodyWidth=document.body.style.width,this.bodyHeight=document.body.style.height,this.bodyOverflow=document.body.style.overflow,this.docOverflow=document.documentElement.style.overflow,this.innerTracker=new e.MouseTracker({userData:"Viewer.innerTracker",element:this.canvas,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,contextMenuHandler:e.delegate(this,T),keyDownHandler:e.delegate(this,y),keyHandler:e.delegate(this,w),clickHandler:e.delegate(this,S),dblClickHandler:e.delegate(this,C),dragHandler:e.delegate(this,L),dragEndHandler:e.delegate(this,D),enterHandler:e.delegate(this,j),leaveHandler:e.delegate(this,N),pressHandler:e.delegate(this,K),releaseHandler:e.delegate(this,se),nonPrimaryPressHandler:e.delegate(this,ue),nonPrimaryReleaseHandler:e.delegate(this,Se),scrollHandler:e.delegate(this,Ee),pinchHandler:e.delegate(this,Re)}),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,Me),leaveHandler:e.delegate(this,ge)}),this.toolbar&&(this.toolbar=new e.ControlDock({element:this.toolbar})),this.bindStandardControls(),n[this.hash].prevContainerSize=s(this.container),window.ResizeObserver?(this._autoResizePolling=!1,this._resizeObserver=new ResizeObserver(function(){n[R.hash].needsResize=!0}),this._resizeObserver.observe(this.container,{})):this._autoResizePolling=!0,this.world=new e.World({viewer:this}),this.world.addHandler("add-item",function(M){R.source=R.world.getItemAt(0).source,n[R.hash].forceRedraw=!0,R._updateRequestId||(R._updateRequestId=u(R,ne))}),this.world.addHandler("remove-item",function(M){R.world.getItemCount()?R.source=R.world.getItemAt(0).source:R.source=null,n[R.hash].forceRedraw=!0}),this.world.addHandler("metrics-change",function(M){R.viewport&&R.viewport._setContentBounds(R.world.getHomeBounds(),R.world.getContentFactor())}),this.world.addHandler("item-index-change",function(M){R.source=R.world.getItemAt(0).source}),this.viewport=new e.Viewport({containerSize:n[this.hash].prevContainerSize,springStiffness:this.springStiffness,animationTime:this.animationTime,minZoomImageRatio:this.minZoomImageRatio,maxZoomPixelRatio:this.maxZoomPixelRatio,visibilityRatio:this.visibilityRatio,wrapHorizontal:this.wrapHorizontal,wrapVertical:this.wrapVertical,defaultZoomLevel:this.defaultZoomLevel,minZoomLevel:this.minZoomLevel,maxZoomLevel:this.maxZoomLevel,viewer:this,degrees:this.degrees,flipped:this.flipped,navigatorRotate:this.navigatorRotate,homeFillsViewer:this.homeFillsViewer,margins:this.viewportMargins,silenceMultiImageWarnings:this.silenceMultiImageWarnings}),this.viewport._setContentBounds(this.world.getHomeBounds(),this.world.getContentFactor()),this.imageLoader=new e.ImageLoader({jobLimit:this.imageLoaderLimit,timeout:d.timeout}),this.tileCache=new e.TileCache({maxImageCacheCount:this.maxImageCacheCount}),this.drawer=new e.Drawer({viewer:this,viewport:this.viewport,element:this.canvas,debugGridColor:this.debugGridColor}),this.overlaysContainer=e.makeNeutralElement("div"),this.canvas.appendChild(this.overlaysContainer),this.drawer.canRotate()||(this.rotateLeft&&(A=this.buttonGroup.buttons.indexOf(this.rotateLeft),this.buttonGroup.buttons.splice(A,1),this.buttonGroup.element.removeChild(this.rotateLeft.element)),this.rotateRight&&(A=this.buttonGroup.buttons.indexOf(this.rotateRight),this.buttonGroup.buttons.splice(A,1),this.buttonGroup.element.removeChild(this.rotateRight.element))),this._addUpdatePixelDensityRatioEvent(),this.showNavigator&&(this.navigator=new e.Navigator({element:this.navigatorElement,id:this.navigatorId,position:this.navigatorPosition,sizeRatio:this.navigatorSizeRatio,maintainSizeRatio:this.navigatorMaintainSizeRatio,top:this.navigatorTop,left:this.navigatorLeft,width:this.navigatorWidth,height:this.navigatorHeight,autoResize:this.navigatorAutoResize,autoFade:this.navigatorAutoFade,prefixUrl:this.prefixUrl,viewer:this,navigatorRotate:this.navigatorRotate,background:this.navigatorBackground,opacity:this.navigatorOpacity,borderColor:this.navigatorBorderColor,displayRegionColor:this.navigatorDisplayRegionColor,crossOriginPolicy:this.crossOriginPolicy,animationTime:this.animationTime})),this.sequenceMode&&this.bindSequenceControls(),this.tileSources&&this.open(this.tileSources),A=0;A-1&&d.index=0&&d=0)return this;var H=o(this,M);return this.currentOverlays.push(H),H.drawHTML(this.overlaysContainer,this.viewport),this.raiseEvent("add-overlay",{element:d,location:M.location,placement:M.placement}),this},updateOverlay:function(d,_,R){var A;return d=e.getElement(d),A=l(this.currentOverlays,d),A>=0&&(this.currentOverlays[A].update(_,R),n[this.hash].forceRedraw=!0,this.raiseEvent("update-overlay",{element:d,location:_,placement:R})),this},removeOverlay:function(d){var _;return d=e.getElement(d),_=l(this.currentOverlays,d),_>=0&&(this.currentOverlays[_].destroy(),this.currentOverlays.splice(_,1),n[this.hash].forceRedraw=!0,this.raiseEvent("remove-overlay",{element:d})),this},clearOverlays:function(){for(;this.currentOverlays.length>0;)this.currentOverlays.pop().destroy();return n[this.hash].forceRedraw=!0,this.raiseEvent("clear-overlay",{}),this},getOverlayById:function(d){var _;return d=e.getElement(d),_=l(this.currentOverlays,d),_>=0?this.currentOverlays[_]:null},_updateSequenceButtons:function(d){this.nextButton&&(!this.tileSources||this.tileSources.length-1===d?this.navPrevNextWrap||this.nextButton.disable():this.nextButton.enable()),this.previousButton&&(d>0?this.previousButton.enable():this.navPrevNextWrap||this.previousButton.disable())},_showMessage:function(d){this._hideMessage();var _=e.makeNeutralElement("div");_.appendChild(document.createTextNode(d)),this.messageDiv=e.makeCenteredNode(_),e.addClass(this.messageDiv,"openseadragon-message"),this.container.appendChild(this.messageDiv)},_hideMessage:function(){var d=this.messageDiv;d&&(d.parentNode.removeChild(d),delete this.messageDiv)},gestureSettingsByDeviceType:function(d){switch(d){case"mouse":return this.gestureSettingsMouse;case"touch":return this.gestureSettingsTouch;case"pen":return this.gestureSettingsPen;default:return this.gestureSettingsUnknown}},_drawOverlays:function(){var d,_=this.currentOverlays.length;for(d=0;d<_;d++)this.currentOverlays[d].drawHTML(this.overlaysContainer,this.viewport)},_cancelPendingImages:function(){this._loadQueue=[]},removeReferenceStrip:function(){this.showReferenceStrip=!1,this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null)},addReferenceStrip:function(){if(this.showReferenceStrip=!0,this.sequenceMode){if(this.referenceStrip)return;this.tileSources.length&&this.tileSources.length>1&&(this.referenceStrip=new e.ReferenceStrip({id:this.referenceStripElement,position:this.referenceStripPosition,sizeRatio:this.referenceStripSizeRatio,scroll:this.referenceStripScroll,height:this.referenceStripHeight,width:this.referenceStripWidth,tileSources:this.tileSources,prefixUrl:this.prefixUrl,useCanvas:this.useCanvas,viewer:this}),this.referenceStrip.setFocus(this._sequenceIndex))}else e.console.warn('Attempting to display a reference strip while "sequenceMode" is off.')},_addUpdatePixelDensityRatioEvent:function(){this._updatePixelDensityRatioBind=this._updatePixelDensityRatio.bind(this),e.addEvent(window,"resize",this._updatePixelDensityRatioBind)},_removeUpdatePixelDensityRatioEvent:function(){e.removeEvent(window,"resize",this._updatePixelDensityRatioBind)},_updatePixelDensityRatio:function(){var d=e.pixelDensityRatio,_=e.getCurrentPixelDensityRatio();d!==_&&(e.pixelDensityRatio=_,this.world.resetItems(),this.forceRedraw())},goToPreviousPage:function(){var d=this._sequenceIndex-1;this.navPrevNextWrap&&d<0&&(d+=this.tileSources.length),this.goToPage(d)},goToNextPage:function(){var d=this._sequenceIndex+1;this.navPrevNextWrap&&d>=this.tileSources.length&&(d=0),this.goToPage(d)},isAnimating:function(){return n[this.hash].animating}});function s(d){return d=e.getElement(d),new e.Point(d.clientWidth===0?1:d.clientWidth,d.clientHeight===0?1:d.clientHeight)}function a(d,_,R,A,M){var H=d;if(e.type(_)==="string"){if(_.match(/^\s*<.*>\s*$/))_=e.parseXml(_);else if(_.match(/^\s*[{[].*[}\]]\s*$/))try{var z=e.parseJSON(_);_=z}catch{}}function G(te,I){te.ready?A(te):(te.addHandler("ready",function(){A(te)}),te.addHandler("open-failed",function(F){M({message:F.message,source:I})}))}setTimeout(function(){if(e.type(_)==="string")_=new e.TileSource({url:_,crossOriginPolicy:R.crossOriginPolicy!==void 0?R.crossOriginPolicy:d.crossOriginPolicy,ajaxWithCredentials:d.ajaxWithCredentials,ajaxHeaders:R.ajaxHeaders?R.ajaxHeaders:d.ajaxHeaders,splitHashDataForPost:d.splitHashDataForPost,useCanvas:d.useCanvas,success:function(V){A(V.tileSource)}}),_.addHandler("open-failed",function(V){M(V)});else if(e.isPlainObject(_)||_.nodeType)if(_.crossOriginPolicy===void 0&&(R.crossOriginPolicy!==void 0||d.crossOriginPolicy!==void 0)&&(_.crossOriginPolicy=R.crossOriginPolicy!==void 0?R.crossOriginPolicy:d.crossOriginPolicy),_.ajaxWithCredentials===void 0&&(_.ajaxWithCredentials=d.ajaxWithCredentials),_.useCanvas===void 0&&(_.useCanvas=d.useCanvas),e.isFunction(_.getTileUrl)){var te=new e.TileSource(_);te.getTileUrl=_.getTileUrl,A(te)}else{var I=e.TileSource.determineType(H,_);if(!I){M({message:"Unable to load TileSource",source:_});return}var F=I.prototype.configure.apply(H,[_]);G(new I(F),_)}else G(_,_)})}function o(d,_){if(_ instanceof e.Overlay)return _;var R=null;if(_.element)R=e.getElement(_.element);else{var A=_.id?_.id:"openseadragon-overlay-"+Math.floor(Math.random()*1e7);R=e.getElement(_.id),R||(R=document.createElement("a"),R.href="#/overlay/"+A),R.id=A,e.addClass(R,_.className?_.className:"openseadragon-overlay")}var M=_.location,H=_.width,z=_.height;if(!M){var G=_.x,te=_.y;if(_.px!==void 0){var I=d.viewport.imageToViewportRectangle(new e.Rect(_.px,_.py,H||0,z||0));G=I.x,te=I.y,H=H!==void 0?I.width:void 0,z=z!==void 0?I.height:void 0}M=new e.Point(G,te)}var F=_.placement;return F&&e.type(F)==="string"&&(F=e.Placement[_.placement.toUpperCase()]),new e.Overlay({element:R,location:M,placement:F,onDraw:_.onDraw,checkResize:_.checkResize,width:H,height:z,rotationMode:_.rotationMode})}function l(d,_){var R;for(R=d.length-1;R>=0;R--)if(d[R].element===_)return R;return-1}function u(d,_){return e.requestAnimationFrame(function(){_(d)})}function c(d){e.requestAnimationFrame(function(){f(d)})}function h(d){d.autoHideControls&&(d.controlsShouldFade=!0,d.controlsFadeBeginTime=e.now()+d.controlsFadeDelay,window.setTimeout(function(){c(d)},d.controlsFadeDelay))}function f(d){var _,R,A,M;if(d.controlsShouldFade){for(_=e.now(),R=_-d.controlsFadeBeginTime,A=1-R/d.controlsFadeLength,A=Math.min(1,A),A=Math.max(0,A),M=d.controls.length-1;M>=0;M--)d.controls[M].autoFade&&d.controls[M].setOpacity(A);A>0&&c(d)}}function p(d){var _;for(d.controlsShouldFade=!1,_=d.controls.length-1;_>=0;_--)d.controls[_].setOpacity(1)}function m(){p(this)}function b(){h(this)}function T(d){var _={tracker:d.eventSource,position:d.position,originalEvent:d.originalEvent,preventDefault:d.preventDefault};this.raiseEvent("canvas-contextmenu",_),d.preventDefault=_.preventDefault}function y(d){var _={originalEvent:d.originalEvent,preventDefaultAction:!1,preventVerticalPan:d.preventVerticalPan||!this.panVertical,preventHorizontalPan:d.preventHorizontalPan||!this.panHorizontal};if(this.raiseEvent("canvas-key",_),!_.preventDefaultAction&&!d.ctrl&&!d.alt&&!d.meta)switch(d.keyCode){case 38:_.preventVerticalPan||(d.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-this.pixelsPerArrowPress))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 40:_.preventVerticalPan||(d.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,this.pixelsPerArrowPress))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 37:_.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 39:_.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),d.preventDefault=!0;break;default:d.preventDefault=!1;break}else d.preventDefault=!1}function w(d){var _={originalEvent:d.originalEvent,preventDefaultAction:!1,preventVerticalPan:d.preventVerticalPan||!this.panVertical,preventHorizontalPan:d.preventHorizontalPan||!this.panHorizontal};if(this.raiseEvent("canvas-key",_),!_.preventDefaultAction&&!d.ctrl&&!d.alt&&!d.meta)switch(d.keyCode){case 43:case 61:this.viewport.zoomBy(1.1),this.viewport.applyConstraints(),d.preventDefault=!0;break;case 45:this.viewport.zoomBy(.9),this.viewport.applyConstraints(),d.preventDefault=!0;break;case 48:this.viewport.goHome(),this.viewport.applyConstraints(),d.preventDefault=!0;break;case 119:case 87:_.preventVerticalPan||(d.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-40))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 115:case 83:_.preventVerticalPan||(d.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,40))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 97:_.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-40,0))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 100:_.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(40,0))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 114:this.viewport.flipped?this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement):this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement),this.viewport.applyConstraints(),d.preventDefault=!0;break;case 82:this.viewport.flipped?this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement):this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement),this.viewport.applyConstraints(),d.preventDefault=!0;break;case 102:this.viewport.toggleFlip(),d.preventDefault=!0;break;case 106:this.goToPreviousPage();break;case 107:this.goToNextPage();break;default:d.preventDefault=!1;break}else d.preventDefault=!1}function S(d){var _,R=document.activeElement===this.canvas;R||this.canvas.focus(),this.viewport.flipped&&(d.position.x=this.viewport.getContainerSize().x-d.position.x);var A={tracker:d.eventSource,position:d.position,quick:d.quick,shift:d.shift,originalEvent:d.originalEvent,originalTarget:d.originalTarget,preventDefaultAction:!1};this.raiseEvent("canvas-click",A),!A.preventDefaultAction&&this.viewport&&d.quick&&(_=this.gestureSettingsByDeviceType(d.pointerType),_.clickToZoom===!0&&(this.viewport.zoomBy(d.shift?1/this.zoomPerClick:this.zoomPerClick,_.zoomToRefPoint?this.viewport.pointFromPixel(d.position,!0):null),this.viewport.applyConstraints()),_.dblClickDragToZoom&&(n[this.hash].draggingToZoom===!0?(n[this.hash].lastClickTime=null,n[this.hash].draggingToZoom=!1):n[this.hash].lastClickTime=e.now()))}function C(d){var _,R={tracker:d.eventSource,position:d.position,shift:d.shift,originalEvent:d.originalEvent,preventDefaultAction:!1};this.raiseEvent("canvas-double-click",R),!R.preventDefaultAction&&this.viewport&&(_=this.gestureSettingsByDeviceType(d.pointerType),_.dblClickToZoom&&(this.viewport.zoomBy(d.shift?1/this.zoomPerClick:this.zoomPerClick,_.zoomToRefPoint?this.viewport.pointFromPixel(d.position,!0):null),this.viewport.applyConstraints()))}function L(d){var _,R={tracker:d.eventSource,pointerType:d.pointerType,position:d.position,delta:d.delta,speed:d.speed,direction:d.direction,shift:d.shift,originalEvent:d.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag",R),_=this.gestureSettingsByDeviceType(d.pointerType),!R.preventDefaultAction&&this.viewport){if(_.dblClickDragToZoom&&n[this.hash].draggingToZoom){var A=Math.pow(this.zoomPerDblClickDrag,d.delta.y/50);this.viewport.zoomBy(A)}else if(_.dragToPan&&!n[this.hash].draggingToZoom){if(this.panHorizontal||(d.delta.x=0),this.panVertical||(d.delta.y=0),this.viewport.flipped&&(d.delta.x=-d.delta.x),this.constrainDuringPan){var M=this.viewport.deltaPointsFromPixels(d.delta.negate());this.viewport.centerSpringX.target.value+=M.x,this.viewport.centerSpringY.target.value+=M.y;var H=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=M.x,this.viewport.centerSpringY.target.value-=M.y,H.xConstrained&&(d.delta.x=0),H.yConstrained&&(d.delta.y=0)}this.viewport.panBy(this.viewport.deltaPointsFromPixels(d.delta.negate()),_.flickEnabled&&!this.constrainDuringPan)}}}function D(d){var _,R={tracker:d.eventSource,pointerType:d.pointerType,position:d.position,speed:d.speed,direction:d.direction,shift:d.shift,originalEvent:d.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag-end",R),_=this.gestureSettingsByDeviceType(d.pointerType),!R.preventDefaultAction&&this.viewport){if(!n[this.hash].draggingToZoom&&_.flickEnabled&&d.speed>=_.flickMinSpeed){var A=0;this.panHorizontal&&(A=_.flickMomentum*d.speed*Math.cos(d.direction));var M=0;this.panVertical&&(M=_.flickMomentum*d.speed*Math.sin(d.direction));var H=this.viewport.pixelFromPoint(this.viewport.getCenter(!0)),z=this.viewport.pointFromPixel(new e.Point(H.x-A,H.y-M));this.viewport.panTo(z,!1)}this.viewport.applyConstraints()}_.dblClickDragToZoom&&n[this.hash].draggingToZoom===!0&&(n[this.hash].draggingToZoom=!1)}function j(d){this.raiseEvent("canvas-enter",{tracker:d.eventSource,pointerType:d.pointerType,position:d.position,buttons:d.buttons,pointers:d.pointers,insideElementPressed:d.insideElementPressed,buttonDownAny:d.buttonDownAny,originalEvent:d.originalEvent})}function N(d){this.raiseEvent("canvas-exit",{tracker:d.eventSource,pointerType:d.pointerType,position:d.position,buttons:d.buttons,pointers:d.pointers,insideElementPressed:d.insideElementPressed,buttonDownAny:d.buttonDownAny,originalEvent:d.originalEvent})}function K(d){var _;if(this.raiseEvent("canvas-press",{tracker:d.eventSource,pointerType:d.pointerType,position:d.position,insideElementPressed:d.insideElementPressed,insideElementReleased:d.insideElementReleased,originalEvent:d.originalEvent}),_=this.gestureSettingsByDeviceType(d.pointerType),_.dblClickDragToZoom){var R=n[this.hash].lastClickTime,A=e.now();if(R===null)return;A-Rthis.minScrollDeltaTime?(this._lastScrollTime=M,_={tracker:d.eventSource,position:d.position,scroll:d.scroll,shift:d.shift,originalEvent:d.originalEvent,preventDefaultAction:!1,preventDefault:!0},this.raiseEvent("canvas-scroll",_),!_.preventDefaultAction&&this.viewport&&(this.viewport.flipped&&(d.position.x=this.viewport.getContainerSize().x-d.position.x),R=this.gestureSettingsByDeviceType(d.pointerType),R.scrollToZoom&&(A=Math.pow(this.zoomPerScroll,d.scroll),this.viewport.zoomBy(A,R.zoomToRefPoint?this.viewport.pointFromPixel(d.position,!0):null),this.viewport.applyConstraints())),d.preventDefault=_.preventDefault):d.preventDefault=!0}function Me(d){n[this.hash].mouseInside=!0,p(this),this.raiseEvent("container-enter",{tracker:d.eventSource,pointerType:d.pointerType,position:d.position,buttons:d.buttons,pointers:d.pointers,insideElementPressed:d.insideElementPressed,buttonDownAny:d.buttonDownAny,originalEvent:d.originalEvent})}function ge(d){d.pointers<1&&(n[this.hash].mouseInside=!1,n[this.hash].animating||h(this)),this.raiseEvent("container-exit",{tracker:d.eventSource,pointerType:d.pointerType,position:d.position,buttons:d.buttons,pointers:d.pointers,insideElementPressed:d.insideElementPressed,buttonDownAny:d.buttonDownAny,originalEvent:d.originalEvent})}function ne(d){re(d),d.isOpen()?d._updateRequestId=u(d,ne):d._updateRequestId=!1}function U(d,_){var R=d.viewport,A=R.getZoom(),M=R.getCenter();R.resize(_,d.preserveImageSizeOnResize),R.panTo(M,!0);var H;if(d.preserveImageSizeOnResize)H=n[d.hash].prevContainerSize.x/_.x;else{var z=new e.Point(0,0),G=new e.Point(n[d.hash].prevContainerSize.x,n[d.hash].prevContainerSize.y).distanceTo(z),te=new e.Point(_.x,_.y).distanceTo(z);H=te/G*n[d.hash].prevContainerSize.x/_.x}R.zoomTo(A*H,null,!0),n[d.hash].prevContainerSize=_,n[d.hash].forceRedraw=!0,n[d.hash].needsResize=!1,n[d.hash].forceResize=!1}function re(d){if(!(d._opening||!n[d.hash])){if(d.autoResize||n[d.hash].forceResize){var _;if(d._autoResizePolling){_=s(d.container);var R=n[d.hash].prevContainerSize;_.equals(R)||(n[d.hash].needsResize=!0)}n[d.hash].needsResize&&U(d,_||s(d.container))}var A=d.viewport.update(),M=d.world.update()||A;A&&d.raiseEvent("viewport-change"),d.referenceStrip&&(M=d.referenceStrip.update(d.viewport)||M);var H=n[d.hash].animating;!H&&M&&(d.raiseEvent("animation-start"),p(d));var z=H&&!M;z&&(n[d.hash].animating=!1),(M||z||n[d.hash].forceRedraw||d.world.needsDraw())&&(ce(d),d._drawOverlays(),d.navigator&&d.navigator.update(d.viewport),n[d.hash].forceRedraw=!1,M&&d.raiseEvent("animation")),z&&(d.raiseEvent("animation-finish"),n[d.hash].mouseInside||h(d)),n[d.hash].animating=M}}function ce(d){d.imageLoader.clear(),d.drawer.clear(),d.world.draw(),d.raiseEvent("update-viewport",{})}function Q(d,_){return d?d+_:_}function _e(){n[this.hash].lastZoomTime=e.now(),n[this.hash].zoomFactor=this.zoomPerSecond,n[this.hash].zooming=!0,Ae(this)}function He(){n[this.hash].lastZoomTime=e.now(),n[this.hash].zoomFactor=1/this.zoomPerSecond,n[this.hash].zooming=!0,Ae(this)}function Ve(){n[this.hash].zooming=!1}function Ae(d){e.requestAnimationFrame(e.delegate(d,Te))}function Te(){var d,_,R;n[this.hash].zooming&&this.viewport&&(d=e.now(),_=d-n[this.hash].lastZoomTime,R=Math.pow(n[this.hash].zoomFactor,_/1e3),this.viewport.zoomBy(R),this.viewport.applyConstraints(),n[this.hash].lastZoomTime=d,Ae(this))}function W(){this.viewport&&(n[this.hash].zooming=!1,this.viewport.zoomBy(this.zoomPerClick/1),this.viewport.applyConstraints())}function oe(){this.viewport&&(n[this.hash].zooming=!1,this.viewport.zoomBy(1/this.zoomPerClick),this.viewport.applyConstraints())}function ae(){this.buttonGroup&&(this.buttonGroup.emulateEnter(),this.buttonGroup.emulateLeave())}function he(){this.viewport&&this.viewport.goHome()}function ke(){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 Ce(){if(this.viewport){var d=this.viewport.getRotation();this.viewport.flipped?d+=this.rotationIncrement:d-=this.rotationIncrement,this.viewport.setRotation(d)}}function P(){if(this.viewport){var d=this.viewport.getRotation();this.viewport.flipped?d-=this.rotationIncrement:d+=this.rotationIncrement,this.viewport.setRotation(d)}}function O(){this.viewport.toggleFlip()}}(i),function(e){e.Navigator=function(u){var c=u.viewer,h=this,f,p;u.element||u.id?(u.element?(u.id&&e.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead."),u.element.id?u.id=u.element.id:u.id="navigator-"+e.now(),this.element=u.element):this.element=document.getElementById(u.id),u.controlOptions={anchor:e.ControlAnchor.NONE,attachToViewer:!1,autoFade:!1}):(u.id="navigator-"+e.now(),this.element=e.makeNeutralElement("div"),u.controlOptions={anchor:e.ControlAnchor.TOP_RIGHT,attachToViewer:!0,autoFade:u.autoFade},u.position&&(u.position==="BOTTOM_RIGHT"?u.controlOptions.anchor=e.ControlAnchor.BOTTOM_RIGHT:u.position==="BOTTOM_LEFT"?u.controlOptions.anchor=e.ControlAnchor.BOTTOM_LEFT:u.position==="TOP_RIGHT"?u.controlOptions.anchor=e.ControlAnchor.TOP_RIGHT:u.position==="TOP_LEFT"?u.controlOptions.anchor=e.ControlAnchor.TOP_LEFT:u.position==="ABSOLUTE"&&(u.controlOptions.anchor=e.ControlAnchor.ABSOLUTE,u.controlOptions.top=u.top,u.controlOptions.left=u.left,u.controlOptions.height=u.height,u.controlOptions.width=u.width))),this.element.id=u.id,this.element.className+=" navigator",u=e.extend(!0,{sizeRatio:e.DEFAULT_SETTINGS.navigatorSizeRatio},u,{element:this.element,tabIndex:-1,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:u.animationTime,autoResize:!1,minZoomImageRatio:1,background:u.background,opacity:u.opacity,borderColor:u.borderColor,displayRegionColor:u.displayRegionColor}),u.minPixelRatio=this.minPixelRatio=c.minPixelRatio,e.setElementTouchActionNone(this.element),this.borderWidth=2,this.fudge=new e.Point(1,1),this.totalBorderWidths=new e.Point(this.borderWidth*2,this.borderWidth*2).minus(this.fudge),u.controlOptions.anchor!==e.ControlAnchor.NONE&&function(T,y){T.margin="0px",T.border=y+"px solid "+u.borderColor,T.padding="0px",T.background=u.background,T.opacity=u.opacity,T.overflow="hidden"}(this.element.style,this.borderWidth),this.displayRegion=e.makeNeutralElement("div"),this.displayRegion.id=this.element.id+"-displayregion",this.displayRegion.className="displayregion",function(T,y){T.position="relative",T.top="0px",T.left="0px",T.fontSize="0px",T.overflow="hidden",T.border=y+"px solid "+u.displayRegionColor,T.margin="0px",T.padding="0px",T.background="transparent",T.float="left",T.cssFloat="left",T.styleFloat="left",T.zIndex=999999999,T.cursor="default"}(this.displayRegion.style,this.borderWidth),e.setElementPointerEventsNone(this.displayRegion),e.setElementTouchActionNone(this.displayRegion),this.displayRegionContainer=e.makeNeutralElement("div"),this.displayRegionContainer.id=this.element.id+"-displayregioncontainer",this.displayRegionContainer.className="displayregioncontainer",this.displayRegionContainer.style.width="100%",this.displayRegionContainer.style.height="100%",e.setElementPointerEventsNone(this.displayRegionContainer),e.setElementTouchActionNone(this.displayRegionContainer),c.addControl(this.element,u.controlOptions),this._resizeWithViewer=u.controlOptions.anchor!==e.ControlAnchor.ABSOLUTE&&u.controlOptions.anchor!==e.ControlAnchor.NONE,u.width&&u.height?(this.setWidth(u.width),this.setHeight(u.height)):this._resizeWithViewer&&(f=e.getElementSize(c.element),this.element.style.height=Math.round(f.y*u.sizeRatio)+"px",this.element.style.width=Math.round(f.x*u.sizeRatio)+"px",this.oldViewerSize=f,p=e.getElementSize(this.element),this.elementArea=p.x*p.y),this.oldContainerSize=new e.Point(0,0),e.Viewer.apply(this,[u]),this.displayRegionContainer.appendChild(this.displayRegion),this.element.getElementsByTagName("div")[0].appendChild(this.displayRegionContainer);function m(T){o(h.displayRegionContainer,T),o(h.displayRegion,-T),h.viewport.setRotation(T)}if(u.navigatorRotate){var b=u.viewer.viewport?u.viewer.viewport.getRotation():u.viewer.degrees||0;m(b),u.viewer.addHandler("rotate",function(T){m(T.degrees)})}this.innerTracker.destroy(),this.innerTracker=new e.MouseTracker({userData:"Navigator.innerTracker",element:this.element,dragHandler:e.delegate(this,r),clickHandler:e.delegate(this,n),releaseHandler:e.delegate(this,s),scrollHandler:e.delegate(this,a),preProcessEventHandler:function(T){T.eventType==="wheel"&&(T.preventDefault=!0)}}),this.outerTracker.userData="Navigator.outerTracker",e.setElementPointerEventsNone(this.canvas),e.setElementPointerEventsNone(this.container),this.addHandler("reset-size",function(){h.viewport&&h.viewport.goHome(!0)}),c.world.addHandler("item-index-change",function(T){window.setTimeout(function(){var y=h.world.getItemAt(T.previousIndex);h.world.setItemIndex(y,T.newIndex)},1)}),c.world.addHandler("remove-item",function(T){var y=T.item,w=h._getMatchingItem(y);w&&h.world.removeItem(w)}),this.update(c.viewport)},e.extend(e.Navigator.prototype,e.EventSource.prototype,e.Viewer.prototype,{updateSize:function(){if(this.viewport){var u=new e.Point(this.container.clientWidth===0?1:this.container.clientWidth,this.container.clientHeight===0?1:this.container.clientHeight);u.equals(this.oldContainerSize)||(this.viewport.resize(u,!0),this.viewport.goHome(!0),this.oldContainerSize=u,this.drawer.clear(),this.world.draw())}},setWidth:function(u){this.width=u,this.element.style.width=typeof u=="number"?u+"px":u,this._resizeWithViewer=!1},setHeight:function(u){this.height=u,this.element.style.height=typeof u=="number"?u+"px":u,this._resizeWithViewer=!1},setFlip:function(u){return this.viewport.setFlip(u),this.setDisplayTransform(this.viewer.viewport.getFlip()?"scale(-1,1)":"scale(1,1)"),this},setDisplayTransform:function(u){l(this.displayRegion,u),l(this.canvas,u),l(this.element,u)},update:function(u){var c,h,f,p,m,b;if(c=e.getElementSize(this.viewer.element),this._resizeWithViewer&&c.x&&c.y&&!c.equals(this.oldViewerSize)&&(this.oldViewerSize=c,this.maintainSizeRatio||!this.elementArea?(h=c.x*this.sizeRatio,f=c.y*this.sizeRatio):(h=Math.sqrt(this.elementArea*(c.x/c.y)),f=this.elementArea/h),this.element.style.width=Math.round(h)+"px",this.element.style.height=Math.round(f)+"px",this.elementArea||(this.elementArea=h*f),this.updateSize()),u&&this.viewport){p=u.getBoundsNoRotate(!0),m=this.viewport.pixelFromPointNoRotate(p.getTopLeft(),!1),b=this.viewport.pixelFromPointNoRotate(p.getBottomRight(),!1).minus(this.totalBorderWidths);var T=this.displayRegion.style;T.display=this.world.getItemCount()?"block":"none",T.top=Math.round(m.y)+"px",T.left=Math.round(m.x)+"px";var y=Math.abs(m.x-b.x),w=Math.abs(m.y-b.y);T.width=Math.round(Math.max(y,0))+"px",T.height=Math.round(Math.max(w,0))+"px"}},addTiledImage:function(u){var c=this,h=u.originalTiledImage;delete u.original;var f=e.extend({},u,{success:function(p){var m=p.item;m._originalForNavigator=h,c._matchBounds(m,h,!0),c._matchOpacity(m,h),c._matchCompositeOperation(m,h);function b(){c._matchBounds(m,h)}function T(){c._matchOpacity(m,h)}function y(){c._matchCompositeOperation(m,h)}h.addHandler("bounds-change",b),h.addHandler("clip-change",b),h.addHandler("opacity-change",T),h.addHandler("composite-operation-change",y)}});return e.Viewer.prototype.addTiledImage.apply(this,[f])},destroy:function(){return e.Viewer.prototype.destroy.apply(this)},_getMatchingItem:function(u){for(var c=this.world.getItemCount(),h,f=0;f1||s.y>1));r++);return r-1},getTileAtPoint:function(r,s){var a=s.x>=0&&s.x<=1&&s.y>=0&&s.y<=1/this.aspectRatio;e.console.assert(a,"[TileSource.getTileAtPoint] must be called with a valid point.");var o=this.dimensions.x*this.getLevelScale(r),l=s.x*o,u=s.y*o,c=Math.floor(l/this.getTileWidth(r)),h=Math.floor(u/this.getTileHeight(r));s.x>=1&&(c=this.getNumTiles(r).x-1);var f=1e-15;return s.y>=1/this.aspectRatio-f&&(h=this.getNumTiles(r).y-1),new e.Point(c,h)},getTileBounds:function(r,s,a,o){var l=this.dimensions.times(this.getLevelScale(r)),u=this.getTileWidth(r),c=this.getTileHeight(r),h=s===0?0:u*s-this.tileOverlap,f=a===0?0:c*a-this.tileOverlap,p=u+(s===0?1:2)*this.tileOverlap,m=c+(a===0?1:2)*this.tileOverlap,b=1/l.x;return p=Math.min(p,l.x-h),m=Math.min(m,l.y-f),o?new e.Rect(0,0,p,m):new e.Rect(h*b,f*b,p*b,m*b)},getImageInfo:function(r){var s=this,a,o,l,u,c,h,f;r&&(c=r.split("/"),h=c[c.length-1],f=h.lastIndexOf("."),f>-1&&(c[c.length-1]=h.slice(0,f)));var p=null;if(this.splitHashDataForPost){var m=r.indexOf("#");m!==-1&&(p=r.substring(m+1),r=r.substr(0,m))}o=function(b){typeof b=="string"&&(b=e.parseXml(b));var T=e.TileSource.determineType(s,b,r);if(!T){s.raiseEvent("open-failed",{message:"Unable to load TileSource",source:r});return}u=T.prototype.configure.apply(s,[b,r,p]),u.ajaxWithCredentials===void 0&&(u.ajaxWithCredentials=s.ajaxWithCredentials),l=new T(u),s.ready=!0,s.raiseEvent("ready",{tileSource:l})},r.match(/\.js$/)?(a=r.split("/").pop().replace(".js",""),e.jsonp({url:r,async:!1,callbackName:a,callback:o})):e.makeAjaxRequest({url:r,postData:p,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(b){var T=n(b);o(T)},error:function(b,T){var y;try{y="HTTP "+b.status+" attempting to load TileSource: "+r}catch{var w;typeof T>"u"||!T.toString?w="Unknown error":w=T.toString(),y=w+" attempting to load TileSource: "+r}e.console.error(y),s.raiseEvent("open-failed",{message:y,source:r,postData:p})}})},supports:function(r,s){return!1},configure:function(r,s,a){throw new Error("Method not implemented.")},getTileUrl:function(r,s,a){throw new Error("Method not implemented.")},getTilePostData:function(r,s,a){return null},getTileAjaxHeaders:function(r,s,a){return{}},getTileHashKey:function(r,s,a,o,l,u){function c(h){return l?h+"+"+JSON.stringify(l):h}return c(typeof o!="string"?r+"/"+s+"_"+a:o)},tileExists:function(r,s,a){var o=this.getNumTiles(r);return r>=this.minLevel&&r<=this.maxLevel&&s>=0&&a>=0&&s=0;m--)for(b=this.displayRects[m],T=b.minLevel;T<=b.maxLevel;T++)this._levelRects[T]||(this._levelRects[T]=[]),this._levelRects[T].push(b);e.TileSource.apply(this,[y])},e.extend(e.DziTileSource.prototype,e.TileSource.prototype,{supports:function(s,a){var o;return s.Image?o=s.Image.xmlns:s.documentElement&&(s.documentElement.localName==="Image"||s.documentElement.tagName==="Image")&&(o=s.documentElement.namespaceURI),o=(o||"").toLowerCase(),o.indexOf("schemas.microsoft.com/deepzoom/2008")!==-1||o.indexOf("schemas.microsoft.com/deepzoom/2009")!==-1},configure:function(s,a,o){var l;return e.isPlainObject(s)?l=r(this,s):l=n(this,s),a&&!l.tilesUrl&&(l.tilesUrl=a.replace(/([^/]+?)(\.(dzi|xml|js)?(\?[^/]*)?)?\/?$/,"$1_files/"),a.search(/\.(dzi|xml|js)\?/)!==-1?l.queryParams=a.match(/\?.*/):l.queryParams=""),l},getTileUrl:function(s,a,o){return[this.tilesUrl,s,"/",a,"_",o,".",this.fileFormat,this.queryParams].join("")},tileExists:function(s,a,o){var l=this._levelRects[s],u,c,h,f,p,m,b;if(this.minLevel&&sthis.maxLevel)return!1;if(!l||!l.length)return!0;for(b=l.length-1;b>=0;b--)if(u=l[b],!(su.maxLevel)&&(c=this.getLevelScale(s),h=u.x*c,f=u.y*c,p=h+u.width*c,m=f+u.height*c,h=Math.floor(h/this._tileWidth),f=Math.floor(f/this._tileWidth),p=Math.ceil(p/this._tileWidth),m=Math.ceil(m/this._tileWidth),h<=a&&a0?o.tileSize=Math.max.apply(null,p):o.tileSize=h}else this.sizes&&this.sizes.length>0?(this.emulateLegacyImagePyramid=!0,o.levels=r(this),e.extend(!0,o,{width:o.levels[o.levels.length-1].width,height:o.levels[o.levels.length-1].height,tileSize:Math.max(o.height,o.width),tileOverlap:0,minLevel:0,maxLevel:o.levels.length-1}),this.levels=o.levels):e.console.error("Nothing in the info.json to construct image pyramids from");if(!o.maxLevel&&!this.emulateLegacyImagePyramid)if(!this.scale_factors)o.maxLevel=Number(Math.round(Math.log(Math.max(this.width,this.height),2)));else{var b=Math.max.apply(null,this.scale_factors);o.maxLevel=Math.round(Math.log(b)*Math.LOG2E)}e.TileSource.apply(this,[o])},e.extend(e.IIIFTileSource.prototype,e.TileSource.prototype,{supports:function(o,l){return o.protocol&&o.protocol==="http://iiif.io/api/image"||o["@context"]&&(o["@context"]==="http://library.stanford.edu/iiif/image-api/1.1/context.json"||o["@context"]==="http://iiif.io/api/image/1/context.json")||o.profile&&o.profile.indexOf("http://library.stanford.edu/iiif/image-api/compliance.html")===0||o.identifier&&o.width&&o.height?!0:!!(o.documentElement&&o.documentElement.tagName==="info"&&o.documentElement.namespaceURI==="http://library.stanford.edu/iiif/image-api/ns/")},configure:function(o,l,u){if(e.isPlainObject(o)){if(!o["@context"])o["@context"]="http://iiif.io/api/image/1.0/context.json",o["@id"]=l.replace("/info.json",""),o.version=1;else{var h=o["@context"];if(Array.isArray(h)){for(var f=0;f0&&o>=this.minLevel&&o<=this.maxLevel&&(l=this.levels[o].width/this.levels[this.maxLevel].width),l}return e.TileSource.prototype.getLevelScale.call(this,o)},getNumTiles:function(o){if(this.emulateLegacyImagePyramid){var l=this.getLevelScale(o);return l?new e.Point(1,1):new e.Point(0,0)}return e.TileSource.prototype.getNumTiles.call(this,o)},getTileAtPoint:function(o,l){return this.emulateLegacyImagePyramid?new e.Point(0,0):e.TileSource.prototype.getTileAtPoint.call(this,o,l)},getTileUrl:function(o,l,u){if(this.emulateLegacyImagePyramid){var c=null;return this.levels.length>0&&o>=this.minLevel&&o<=this.maxLevel&&(c=this.levels[o].url),c}var h="0",f=Math.pow(.5,this.maxLevel-o),p=Math.round(this.width*f),m=Math.round(this.height*f),b,T,y,w,S,C,L,D,j,N,K,se,ue,Se;return b=this.getTileWidth(o),T=this.getTileHeight(o),y=Math.round(b/f),w=Math.round(T/f),this.version===1?ue="native."+this.tileFormat:ue="default."+this.tileFormat,p1&&o.profile[1].supports&&(h=o.profile[1].supports.indexOf("sizeByW")!==-1),o.version===3&&o.extraFeatures&&(h=o.extraFeatures.indexOf("sizeByWh")!==-1),!c||h}function r(o){for(var l=[],u=0;uc?h=u/256:h=c/256,l.maxLevel=Math.ceil(Math.log(h)/Math.log(2))-1,l.tileSize=256,l.width=u,l.height=c,e.TileSource.apply(this,[l])},e.extend(e.TmsTileSource.prototype,e.TileSource.prototype,{supports:function(n,r){return n.type&&n.type==="tiledmapservice"},configure:function(n,r,s){return n},getTileUrl:function(n,r,s){var a=this.getNumTiles(n).y-1;return this.tilesUrl+n+"/"+r+"/"+(a-s)+".png"}})}(i),function(e){e.ZoomifyTileSource=function(n){typeof n.tileSize>"u"&&(n.tileSize=256),typeof n.fileFormat>"u"&&(n.fileFormat="jpg",this.fileFormat=n.fileFormat);var r={x:n.width,y:n.height};for(n.imageSizes=[{x:n.width,y:n.height}],n.gridSize=[this._getGridSize(n.width,n.height,n.tileSize)];parseInt(r.x,10)>n.tileSize||parseInt(r.y,10)>n.tileSize;)r.x=Math.floor(r.x/2),r.y=Math.floor(r.y/2),n.imageSizes.push({x:r.x,y:r.y}),n.gridSize.push(this._getGridSize(r.x,r.y,n.tileSize));n.imageSizes.reverse(),n.gridSize.reverse(),n.minLevel=0,n.maxLevel=n.gridSize.length-1,i.TileSource.apply(this,[n])},e.extend(e.ZoomifyTileSource.prototype,e.TileSource.prototype,{_getGridSize:function(n,r,s){return{x:Math.ceil(n/s),y:Math.ceil(r/s)}},_calculateAbsoluteTileNumber:function(n,r,s){for(var a=0,o={},l=0;l0?(l=o.levels[o.levels.length-1].width,u=o.levels[o.levels.length-1].height):(l=0,u=0,e.console.error("No supported image formats found")),e.extend(!0,o,{width:l,height:u,tileSize:Math.max(u,l),tileOverlap:0,minLevel:0,maxLevel:o.levels.length>0?o.levels.length-1:0}),e.TileSource.apply(this,[o]),this.levels=o.levels},e.extend(e.LegacyTileSource.prototype,e.TileSource.prototype,{supports:function(a,o){return a.type&&a.type==="legacy-image-pyramid"||a.documentElement&&a.documentElement.getAttribute("type")==="legacy-image-pyramid"},configure:function(a,o,l){var u;return e.isPlainObject(a)?u=s(this,a):u=r(this,a),u},getLevelScale:function(a){var o=NaN;return this.levels.length>0&&a>=this.minLevel&&a<=this.maxLevel&&(o=this.levels[a].width/this.levels[this.maxLevel].width),o},getNumTiles:function(a){var o=this.getLevelScale(a);return o?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(a,o,l){var u=null;return this.levels.length>0&&a>=this.minLevel&&a<=this.maxLevel&&(u=this.levels[a].url),u}});function n(a){var o=[],l,u;for(u=0;u");return o.sort(function(c,h){return c.height-h.height})}function r(a,o){if(!o||!o.documentElement)throw new Error(e.getString("Errors.Xml"));var l=o.documentElement,u=l.tagName,c=null,h=[],f,p;if(u==="image")try{for(c={type:l.getAttribute("type"),levels:[]},h=l.getElementsByTagName("level"),p=0;p=this.minLevel&&n<=this.maxLevel&&(r=this.levels[n].width/this.levels[this.maxLevel].width),r},getNumTiles:function(n){var r=this.getLevelScale(n);return r?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(n,r,s){var a=null;return n>=this.minLevel&&n<=this.maxLevel&&(a=this.levels[n].url),a},getContext2D:function(n,r,s){var a=null;return n>=this.minLevel&&n<=this.maxLevel&&(a=this.levels[n].context2D),a},destroy:function(){this._freeupCanvasMemory()},_buildLevels:function(){var n=[{url:this._image.src,width:this._image.naturalWidth,height:this._image.naturalHeight}];if(!this.buildPyramid||!e.supportsCanvas||!this.useCanvas)return delete this._image,n;var r=this._image.naturalWidth,s=this._image.naturalHeight,a=document.createElement("canvas"),o=a.getContext("2d");if(a.width=r,a.height=s,o.drawImage(this._image,0,0,r,s),n[0].context2D=o,delete this._image,e.isCanvasTainted(a))return n;for(;r>=2&&s>=2;){r=Math.floor(r/2),s=Math.floor(s/2);var l=document.createElement("canvas"),u=l.getContext("2d");l.width=r,l.height=s,u.drawImage(a,0,0,r,s),n.splice(0,0,{context2D:u,width:r,height:s}),a=l,o=u}return n},_freeupCanvasMemory:function(){for(var n=0;n0&&n(u))}function s(u){u.shouldFade=!0,u.fadeBeginTime=e.now()+u.fadeDelay,window.setTimeout(function(){n(u)},u.fadeDelay)}function a(u){u.shouldFade=!1,u.imgGroup&&e.setElementOpacity(u.imgGroup,1,!0)}function o(u,c){u.element.disabled||(c>=e.ButtonState.GROUP&&u.currentState===e.ButtonState.REST&&(a(u),u.currentState=e.ButtonState.GROUP),c>=e.ButtonState.HOVER&&u.currentState===e.ButtonState.GROUP&&(u.imgHover&&(u.imgHover.style.visibility=""),u.currentState=e.ButtonState.HOVER),c>=e.ButtonState.DOWN&&u.currentState===e.ButtonState.HOVER&&(u.imgDown&&(u.imgDown.style.visibility=""),u.currentState=e.ButtonState.DOWN))}function l(u,c){u.element.disabled||(c<=e.ButtonState.HOVER&&u.currentState===e.ButtonState.DOWN&&(u.imgDown&&(u.imgDown.style.visibility="hidden"),u.currentState=e.ButtonState.HOVER),c<=e.ButtonState.GROUP&&u.currentState===e.ButtonState.HOVER&&(u.imgHover&&(u.imgHover.style.visibility="hidden"),u.currentState=e.ButtonState.GROUP),c<=e.ButtonState.REST&&u.currentState===e.ButtonState.GROUP&&(s(u),u.currentState=e.ButtonState.REST))}}(i),function(e){e.ButtonGroup=function(n){e.extend(!0,this,{buttons:[],clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},n);var r=this.buttons.concat([]),s=this,a;if(this.element=n.element||e.makeNeutralElement("div"),!n.group)for(this.element.style.display="inline-block",a=0;a=270?(l=this.getTopRight(),this.x=l.x,this.y=l.y,u=this.height,this.height=this.width,this.width=u,this.degrees-=270):this.degrees>=180?(l=this.getBottomRight(),this.x=l.x,this.y=l.y,this.degrees-=180):this.degrees>=90&&(l=this.getBottomLeft(),this.x=l.x,this.y=l.y,u=this.height,this.height=this.width,this.width=u,this.degrees-=90)},e.Rect.fromSummits=function(n,r,s){var a=n.distanceTo(r),o=n.distanceTo(s),l=r.minus(n),u=Math.atan(l.y/l.x);return l.x<0?u+=Math.PI:l.y<0&&(u+=2*Math.PI),new e.Rect(n.x,n.y,a,o,u/Math.PI*180)},e.Rect.prototype={clone:function(){return new e.Rect(this.x,this.y,this.width,this.height,this.degrees)},getAspectRatio:function(){return this.width/this.height},getTopLeft:function(){return new e.Point(this.x,this.y)},getBottomRight:function(){return new e.Point(this.x+this.width,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getTopRight:function(){return new e.Point(this.x+this.width,this.y).rotate(this.degrees,this.getTopLeft())},getBottomLeft:function(){return new e.Point(this.x,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getCenter:function(){return new e.Point(this.x+this.width/2,this.y+this.height/2).rotate(this.degrees,this.getTopLeft())},getSize:function(){return new e.Point(this.width,this.height)},equals:function(n){return n instanceof e.Rect&&this.x===n.x&&this.y===n.y&&this.width===n.width&&this.height===n.height&&this.degrees===n.degrees},times:function(n){return new e.Rect(this.x*n,this.y*n,this.width*n,this.height*n,this.degrees)},translate:function(n){return new e.Rect(this.x+n.x,this.y+n.y,this.width,this.height,this.degrees)},union:function(n){var r=this.getBoundingBox(),s=n.getBoundingBox(),a=Math.min(r.x,s.x),o=Math.min(r.y,s.y),l=Math.max(r.x+r.width,s.x+s.width),u=Math.max(r.y+r.height,s.y+s.height);return new e.Rect(a,o,l-a,u-o)},intersection:function(n){var r=1e-10,s=[],a=this.getTopLeft();n.containsPoint(a,r)&&s.push(a);var o=this.getTopRight();n.containsPoint(o,r)&&s.push(o);var l=this.getBottomLeft();n.containsPoint(l,r)&&s.push(l);var u=this.getBottomRight();n.containsPoint(u,r)&&s.push(u);var c=n.getTopLeft();this.containsPoint(c,r)&&s.push(c);var h=n.getTopRight();this.containsPoint(h,r)&&s.push(h);var f=n.getBottomLeft();this.containsPoint(f,r)&&s.push(f);var p=n.getBottomRight();this.containsPoint(p,r)&&s.push(p);for(var m=this._getSegments(),b=n._getSegments(),T=0;Tj&&(j=ue.x),ue.yK&&(K=ue.y)}return new e.Rect(D,N,j-D,K-N)},_getSegments:function(){var n=this.getTopLeft(),r=this.getTopRight(),s=this.getBottomLeft(),a=this.getBottomRight();return[[n,r],[r,a],[a,s],[s,n]]},rotate:function(n,r){if(n=e.positiveModulo(n,360),n===0)return this.clone();r=r||this.getCenter();var s=this.getTopLeft().rotate(n,r),a=this.getTopRight().rotate(n,r),o=a.minus(s);o=o.apply(function(u){var c=1e-15;return Math.abs(u)=-r&&(n.x-a.x)*l.x+(n.y-a.y)*l.y<=r&&(n.x-s.x)*u.x+(n.y-s.y)*u.y>=-r&&(n.x-o.x)*u.x+(n.y-o.y)*u.y<=r},toString:function(){return"["+Math.round(this.x*100)/100+", "+Math.round(this.y*100)/100+", "+Math.round(this.width*100)/100+"x"+Math.round(this.height*100)/100+", "+Math.round(this.degrees*100)/100+"deg]"}}}(i),function(e){var n={};e.ReferenceStrip=function(f){var p=this,m=f.viewer,b=e.getElementSize(m.element),T,y,w;for(f.id||(f.id="referencestrip-"+e.now(),this.element=e.makeNeutralElement("div"),this.element.id=f.id,this.element.className="referencestrip"),f=e.extend(!0,{sizeRatio:e.DEFAULT_SETTINGS.referenceStripSizeRatio,position:e.DEFAULT_SETTINGS.referenceStripPosition,scroll:e.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold},f,{element:this.element}),e.extend(this,f),n[this.id]={animating:!1},this.minPixelRatio=this.viewer.minPixelRatio,this.element.tabIndex=0,y=this.element.style,y.marginTop="0px",y.marginRight="0px",y.marginBottom="0px",y.marginLeft="0px",y.left="0px",y.bottom="0px",y.border="0px",y.background="#000",y.position="relative",e.setElementTouchActionNone(this.element),e.setElementOpacity(this.element,.8),this.viewer=m,this.tracker=new e.MouseTracker({userData:"ReferenceStrip.tracker",element:this.element,clickHandler:e.delegate(this,r),dragHandler:e.delegate(this,s),scrollHandler:e.delegate(this,a),enterHandler:e.delegate(this,l),leaveHandler:e.delegate(this,u),keyDownHandler:e.delegate(this,c),keyHandler:e.delegate(this,h),preProcessEventHandler:function(S){S.eventType==="wheel"&&(S.preventDefault=!0)}}),f.width&&f.height?(this.element.style.width=f.width+"px",this.element.style.height=f.height+"px",m.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})):f.scroll==="horizontal"?(this.element.style.width=b.x*f.sizeRatio*m.tileSources.length+12*m.tileSources.length+"px",this.element.style.height=b.y*f.sizeRatio+"px",m.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})):(this.element.style.height=b.y*f.sizeRatio*m.tileSources.length+12*m.tileSources.length+"px",this.element.style.width=b.x*f.sizeRatio+"px",m.addControl(this.element,{anchor:e.ControlAnchor.TOP_LEFT})),this.panelWidth=b.x*this.sizeRatio+8,this.panelHeight=b.y*this.sizeRatio+8,this.panels=[],this.miniViewers={},w=0;wy+m.x-this.panelWidth?(S=Math.min(S,b-m.x),this.element.style.marginLeft=-S+"px",o(this,m.x,-S)):Sw+m.y-this.panelHeight?(S=Math.min(S,T-m.y),this.element.style.marginTop=-S+"px",o(this,m.y,-S)):S0?p>-(b-y.x)&&(this.element.style.marginLeft=p+f.delta.x*2+"px",o(this,y.x,p+f.delta.x*2)):-f.delta.x<0&&p<0&&(this.element.style.marginLeft=p+f.delta.x*2+"px",o(this,y.x,p+f.delta.x*2)):-f.delta.y>0?m>-(T-y.y)&&(this.element.style.marginTop=m+f.delta.y*2+"px",o(this,y.y,m+f.delta.y*2)):-f.delta.y<0&&m<0&&(this.element.style.marginTop=m+f.delta.y*2+"px",o(this,y.y,m+f.delta.y*2))}}function a(f){if(this.element){var p=Number(this.element.style.marginLeft.replace("px","")),m=Number(this.element.style.marginTop.replace("px","")),b=Number(this.element.style.width.replace("px","")),T=Number(this.element.style.height.replace("px","")),y=e.getElementSize(this.viewer.canvas);this.scroll==="horizontal"?f.scroll>0?p>-(b-y.x)&&(this.element.style.marginLeft=p-f.scroll*60+"px",o(this,y.x,p-f.scroll*60)):f.scroll<0&&p<0&&(this.element.style.marginLeft=p-f.scroll*60+"px",o(this,y.x,p-f.scroll*60)):f.scroll<0?m>y.y-T&&(this.element.style.marginTop=m+f.scroll*60+"px",o(this,y.y,m+f.scroll*60)):f.scroll>0&&m<0&&(this.element.style.marginTop=m+f.scroll*60+"px",o(this,y.y,m+f.scroll*60)),f.preventDefault=!0}}function o(f,p,m){var b,T,y,w,S,C;for(f.scroll==="horizontal"?b=f.panelWidth:b=f.panelHeight,T=Math.ceil(p/b)+5,y=Math.ceil((Math.abs(m)+p)/b)+1,T=y-T,T=T<0?0:T,S=T;S1?s[1].springStiffness:5,animationTime:s.length>1?s[1].animationTime:1.5}),e.console.assert(typeof r.springStiffness=="number"&&r.springStiffness!==0,"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number"),e.console.assert(typeof r.animationTime=="number"&&r.animationTime>=0,"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0"),r.exponential&&(this._exponential=!0,delete r.exponential),e.extend(!0,this,r),this.current={value:typeof this.initial=="number"?this.initial:this._exponential?0:1,time:e.now()},e.console.assert(!this._exponential||this.current.value!==0,"[OpenSeadragon.Spring] value must be non-zero for exponential springs"),this.start={value:this.current.value,time:this.current.time},this.target={value:this.current.value,time:this.current.time},this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},e.Spring.prototype={resetTo:function(r){e.console.assert(!this._exponential||r!==0,"[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs"),this.start.value=this.target.value=this.current.value=r,this.start.time=this.target.time=this.current.time=e.now(),this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},springTo:function(r){e.console.assert(!this._exponential||r!==0,"[OpenSeadragon.Spring.springTo] target must be non-zero for exponential springs"),this.start.value=this.current.value,this.start.time=this.current.time,this.target.value=r,this.target.time=this.start.time+1e3*this.animationTime,this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value))},shiftBy:function(r){this.start.value+=r,this.target.value+=r,this._exponential&&(e.console.assert(this.target.value!==0&&this.start.value!==0,"[OpenSeadragon.Spring.shiftBy] spring value must be non-zero for exponential springs"),this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value))},setExponential:function(r){this._exponential=r,this._exponential&&(e.console.assert(this.current.value!==0&&this.target.value!==0&&this.start.value!==0,"[OpenSeadragon.Spring.setExponential] spring value must be non-zero for exponential springs"),this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},update:function(){this.current.time=e.now();var r,s;this._exponential?(r=this.start._logValue,s=this.target._logValue):(r=this.start.value,s=this.target.value);var a=this.current.time>=this.target.time?s:r+(s-r)*n(this.springStiffness,(this.current.time-this.start.time)/(this.target.time-this.start.time)),o=this.current.value;return this._exponential?this.current.value=Math.exp(a):this.current.value=a,o!==this.current.value},isAtTargetValue:function(){return this.current.value===this.target.value}};function n(r,s){return(1-Math.exp(r*-s))/(1-Math.exp(-r))}}(i),function(e){e.ImageJob=function(r){e.extend(!0,this,{timeout:e.DEFAULT_SETTINGS.timeout,jobId:null},r),this.data=null,this.userData={},this.errorMsg=null},e.ImageJob.prototype={start:function(){var r=this,s=this.abort;this.jobId=window.setTimeout(function(){r.finish(null,null,"Image load exceeded timeout ("+r.timeout+" ms)")},this.timeout),this.abort=function(){r.source.downloadTileAbort(r),typeof s=="function"&&s()},this.source.downloadTileStart(this)},finish:function(r,s,a){this.data=r,this.request=s,this.errorMsg=a,this.jobId&&window.clearTimeout(this.jobId),this.callback(this)}},e.ImageLoader=function(r){e.extend(!0,this,{jobLimit:e.DEFAULT_SETTINGS.imageLoaderLimit,timeout:e.DEFAULT_SETTINGS.timeout,jobQueue:[],jobsInProgress:0},r)},e.ImageLoader.prototype={addJob:function(r){if(!r.source){e.console.error("ImageLoader.prototype.addJob() requires [options.source]. TileSource since new API defines how images are fetched. Creating a dummy TileSource.");var s=e.TileSource.prototype;r.source={downloadTileStart:s.downloadTileStart,downloadTileAbort:s.downloadTileAbort}}var a=this,o=function(c){n(a,c,r.callback)},l={src:r.src,tile:r.tile||{},source:r.source,loadWithAjax:r.loadWithAjax,ajaxHeaders:r.loadWithAjax?r.ajaxHeaders:null,crossOriginPolicy:r.crossOriginPolicy,ajaxWithCredentials:r.ajaxWithCredentials,postData:r.postData,callback:o,abort:r.abort,timeout:this.timeout},u=new e.ImageJob(l);!this.jobLimit||this.jobsInProgress0&&(o=r.jobQueue.shift(),o.start(),r.jobsInProgress++),a(s.data,s.errorMsg,s.request)}}(i),function(e){e.Tile=function(n,r,s,a,o,l,u,c,h,f,p,m){this.level=n,this.x=r,this.y=s,this.bounds=a,this.sourceBounds=f,this.exists=o,this._url=l,this.postData=p,this.context2D=u,this.loadWithAjax=c,this.ajaxHeaders=h,m===void 0&&(e.console.warn("Tile constructor needs 'cacheKey' variable: creation tile cache in Tile class is deprecated. TileSource.prototype.getTileHashKey will be used."),m=e.TileSource.prototype.getTileHashKey(n,r,s,l,h,p)),this.cacheKey=m,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")},drawHTML:function(n){if(!this.cacheImageRecord){e.console.warn("[Tile.drawHTML] attempting to draw tile %s when it's not cached",this.toString());return}if(!this.loaded){e.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString());return}if(!this.element){var r=this.getImage();if(!r)return;this.element=e.makeNeutralElement("div"),this.imgElement=r.cloneNode(),this.imgElement.style.msInterpolationMode="nearest-neighbor",this.imgElement.style.width="100%",this.imgElement.style.height="100%",this.style=this.element.style,this.style.position="absolute"}this.element.parentNode!==n&&n.appendChild(this.element),this.imgElement.parentNode!==this.element&&this.element.appendChild(this.imgElement),this.style.top=this.position.y+"px",this.style.left=this.position.x+"px",this.style.height=this.size.y+"px",this.style.width=this.size.x+"px",this.flipped&&(this.style.transform="scaleX(-1)"),e.setElementOpacity(this.element,this.opacity)},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.getRenderedContext()},drawCanvas:function(n,r,s,a,o,l){var u=this.position.times(e.pixelDensityRatio),c=this.size.times(e.pixelDensityRatio),h;if(!this.context2D&&!this.cacheImageRecord){e.console.warn("[Tile.drawCanvas] attempting to draw tile %s when it's not cached",this.toString());return}if(h=this.getCanvasContext(),!this.loaded||!h){e.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString());return}n.save(),n.globalAlpha=this.opacity,typeof s=="number"&&s!==1&&(u=u.times(s),c=c.times(s)),a instanceof e.Point&&(u=u.plus(a)),n.globalAlpha===1&&this.hasTransparency&&(o&&(u.x=Math.round(u.x),u.y=Math.round(u.y),c.x=Math.round(c.x),c.y=Math.round(c.y)),n.clearRect(u.x,u.y,c.x,c.y)),r({context:n,tile:this,rendered:h});var f,p;this.sourceBounds?(f=Math.min(this.sourceBounds.width,h.canvas.width),p=Math.min(this.sourceBounds.height,h.canvas.height)):(f=h.canvas.width,p=h.canvas.height),n.translate(u.x+c.x/2,0),this.flipped&&n.scale(-1,1),n.drawImage(h.canvas,0,0,f,p,-c.x/2,u.y,c.x,c.y),n.restore()},getScaleForEdgeSmoothing:function(){var n;if(this.cacheImageRecord)n=this.cacheImageRecord.getRenderedContext();else if(this.context2D)n=this.context2D;else return e.console.warn("[Tile.drawCanvas] attempting to get tile scale %s when tile's not cached",this.toString()),1;return n.canvas.width/(this.size.x*e.pixelDensityRatio)},getTranslationForEdgeSmoothing:function(n,r,s){var a=Math.max(1,Math.ceil((s.x-r.x)/2)),o=Math.max(1,Math.ceil((s.y-r.y)/2));return new e.Point(a,o).minus(this.position.times(e.pixelDensityRatio).times(n||1).apply(function(l){return l%1}))},unload:function(){this.imgElement&&this.imgElement.parentNode&&this.imgElement.parentNode.removeChild(this.imgElement),this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null,this.imgElement=null,this.loaded=!1,this.loading=!1}}}(i),function(e){e.OverlayPlacement=e.Placement,e.OverlayRotationMode=e.freezeObject({NO_ROTATION:1,EXACT:2,BOUNDING_BOX:3}),e.Overlay=function(n,r,s){var a;e.isPlainObject(n)?a=n:a={element:n,location:r,placement:s},this.element=a.element,this.style=a.element.style,this._init(a)},e.Overlay.prototype={_init:function(n){this.location=n.location,this.placement=n.placement===void 0?e.Placement.TOP_LEFT:n.placement,this.onDraw=n.onDraw,this.checkResize=n.checkResize===void 0?!0:n.checkResize,this.width=n.width===void 0?null:n.width,this.height=n.height===void 0?null:n.height,this.rotationMode=n.rotationMode||e.OverlayRotationMode.EXACT,this.location instanceof e.Rect&&(this.width=this.location.width,this.height=this.location.height,this.location=this.location.getTopLeft(),this.placement=e.Placement.TOP_LEFT),this.scales=this.width!==null&&this.height!==null,this.bounds=new e.Rect(this.location.x,this.location.y,this.width,this.height),this.position=this.location},adjust:function(n,r){var s=e.Placement.properties[this.placement];s&&(s.isHorizontallyCentered?n.x-=r.x/2:s.isRight&&(n.x-=r.x),s.isVerticallyCentered?n.y-=r.y/2:s.isBottom&&(n.y-=r.y))},destroy:function(){var n=this.element,r=this.style;n.parentNode&&(n.parentNode.removeChild(n),n.prevElementParent&&(r.display="none",document.body.appendChild(n))),this.onDraw=null,r.top="",r.left="",r.position="",this.width!==null&&(r.width=""),this.height!==null&&(r.height="");var s=e.getCssPropertyWithVendorPrefix("transformOrigin"),a=e.getCssPropertyWithVendorPrefix("transform");s&&a&&(r[s]="",r[a]="")},drawHTML:function(n,r){var s=this.element;s.parentNode!==n&&(s.prevElementParent=s.parentNode,s.prevNextSibling=s.nextSibling,n.appendChild(s),this.style.position="absolute",this.size=e.getElementSize(s));var a=this._getOverlayPositionAndSize(r),o=a.position,l=this.size=a.size,u=a.rotate;if(this.onDraw)this.onDraw(o,l,this.element);else{var c=this.style;c.left=o.x+"px",c.top=o.y+"px",this.width!==null&&(c.width=l.x+"px"),this.height!==null&&(c.height=l.y+"px");var h=e.getCssPropertyWithVendorPrefix("transformOrigin"),f=e.getCssPropertyWithVendorPrefix("transform");h&&f&&(u?(c[h]=this._getTransformOrigin(),c[f]="rotate("+u+"deg)"):(c[h]="",c[f]="")),c.display="block"}},_getOverlayPositionAndSize:function(n){var r=n.pixelFromPoint(this.location,!0),s=this._getSizeInPixels(n);this.adjust(r,s);var a=0;if(n.getRotation(!0)&&this.rotationMode!==e.OverlayRotationMode.NO_ROTATION)if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX&&this.width!==null&&this.height!==null){var o=new e.Rect(r.x,r.y,s.x,s.y),l=this._getBoundingBox(o,n.getRotation(!0));r=l.getTopLeft(),s=l.getSize()}else a=n.getRotation(!0);return{position:r,size:s,rotate:a}},_getSizeInPixels:function(n){var r=this.size.x,s=this.size.y;if(this.width!==null||this.height!==null){var a=n.deltaPixelsFromPointsNoRotate(new e.Point(this.width||0,this.height||0),!0);this.width!==null&&(r=a.x),this.height!==null&&(s=a.y)}if(this.checkResize&&(this.width===null||this.height===null)){var o=this.size=e.getElementSize(this.element);this.width===null&&(r=o.x),this.height===null&&(s=o.y)}return new e.Point(r,s)},_getBoundingBox:function(n,r){var s=this._getPlacementPoint(n);return n.rotate(r,s).getBoundingBox()},_getPlacementPoint:function(n){var r=new e.Point(n.x,n.y),s=e.Placement.properties[this.placement];return s&&(s.isHorizontallyCentered?r.x+=n.width/2:s.isRight&&(r.x+=n.width),s.isVerticallyCentered?r.y+=n.height/2:s.isBottom&&(r.y+=n.height)),r},_getTransformOrigin:function(){var n="",r=e.Placement.properties[this.placement];return r&&(r.isLeft?n="left":r.isRight&&(n="right"),r.isTop?n+=" top":r.isBottom&&(n+=" bottom")),n},update:function(n,r){var s=e.isPlainObject(n)?n:{location:n,placement:r};this._init({location:s.location||this.location,placement:s.placement!==void 0?s.placement:this.placement,onDraw:s.onDraw||this.onDraw,checkResize:s.checkResize||this.checkResize,width:s.width!==void 0?s.width:this.width,height:s.height!==void 0?s.height:this.height,rotationMode:s.rotationMode||this.rotationMode})},getBounds:function(n){e.console.assert(n,"A viewport must now be passed to Overlay.getBounds.");var r=this.width,s=this.height;if(r===null||s===null){var a=n.deltaPointsFromPixelsNoRotate(this.size,!0);r===null&&(r=a.x),s===null&&(s=a.y)}var o=this.location.clone();return this.adjust(o,new e.Point(r,s)),this._adjustBoundsForRotation(n,new e.Rect(o.x,o.y,r,s))},_adjustBoundsForRotation:function(n,r){if(!n||n.getRotation(!0)===0||this.rotationMode===e.OverlayRotationMode.EXACT)return r;if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX){if(this.width===null||this.height===null)return r;var s=this._getOverlayPositionAndSize(n);return n.viewerElementToViewportRectangle(new e.Rect(s.position.x,s.position.y,s.size.x,s.size.y))}return r.rotate(-n.getRotation(!0),this._getPlacementPoint(r))}}}(i),function(e){e.Drawer=function(n){e.console.assert(n.viewer,"[Drawer] options.viewer is required");var r=arguments;if(e.isPlainObject(n)||(n={source:r[0],viewport:r[1],element:r[2]}),e.console.assert(n.viewport,"[Drawer] options.viewport is required"),e.console.assert(n.element,"[Drawer] options.element is required"),n.source&&e.console.error("[Drawer] options.source is no longer accepted; use TiledImage instead"),this.viewer=n.viewer,this.viewport=n.viewport,this.debugGridColor=typeof n.debugGridColor=="string"?[n.debugGridColor]:n.debugGridColor||e.DEFAULT_SETTINGS.debugGridColor,n.opacity&&e.console.error("[Drawer] options.opacity is no longer accepted; set the opacity on the TiledImage instead"),this.useCanvas=e.supportsCanvas&&(this.viewer?this.viewer.useCanvas:!0),this.container=e.getElement(n.element),this.canvas=e.makeNeutralElement(this.useCanvas?"canvas":"div"),this.context=this.useCanvas?this.canvas.getContext("2d"):null,this.sketchCanvas=null,this.sketchContext=null,this.element=this.container,this.container.dir="ltr",this.useCanvas){var s=this._calculateCanvasSize();this.canvas.width=s.x,this.canvas.height=s.y}this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.position="absolute",e.setElementOpacity(this.canvas,this.opacity,!0),e.setElementPointerEventsNone(this.canvas),e.setElementTouchActionNone(this.canvas),this.container.style.textAlign="left",this.container.appendChild(this.canvas),this._imageSmoothingEnabled=!0},e.Drawer.prototype={addOverlay:function(n,r,s,a){return e.console.error("drawer.addOverlay is deprecated. Use viewer.addOverlay instead."),this.viewer.addOverlay(n,r,s,a),this},updateOverlay:function(n,r,s){return e.console.error("drawer.updateOverlay is deprecated. Use viewer.updateOverlay instead."),this.viewer.updateOverlay(n,r,s),this},removeOverlay:function(n){return e.console.error("drawer.removeOverlay is deprecated. Use viewer.removeOverlay instead."),this.viewer.removeOverlay(n),this},clearOverlays:function(){return e.console.error("drawer.clearOverlays is deprecated. Use viewer.clearOverlays instead."),this.viewer.clearOverlays(),this},viewportCoordToDrawerCoord:function(n){var r=this.viewport.pixelFromPointNoRotate(n,!0);return new e.Point(r.x*e.pixelDensityRatio,r.y*e.pixelDensityRatio)},clipWithPolygons:function(n,r){if(this.useCanvas){var s=this._getContext(r);s.beginPath(),n.forEach(function(a){a.forEach(function(o,l){s[l===0?"moveTo":"lineTo"](o.x,o.y)})}),s.clip()}},setOpacity:function(n){e.console.error("drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead.");for(var r=this.viewer.world,s=0;sr&&(r=a)}return r},needsUpdate:function(){return e.console.error("[Drawer.needsUpdate] this function is deprecated. Use World.needsDraw instead."),this.viewer.world.needsDraw()},numTilesLoaded:function(){return e.console.error("[Drawer.numTilesLoaded] this function is deprecated. Use TileCache.numTilesLoaded instead."),this.viewer.tileCache.numTilesLoaded()},reset:function(){return e.console.error("[Drawer.reset] this function is deprecated. Use World.resetItems instead."),this.viewer.world.resetItems(),this},update:function(){return e.console.error("[Drawer.update] this function is deprecated. Use Drawer.clear and World.draw instead."),this.clear(),this.viewer.world.draw(),this},canRotate:function(){return this.useCanvas},destroy:function(){this.canvas.width=1,this.canvas.height=1,this.sketchCanvas=null,this.sketchContext=null},clear:function(){if(this.canvas.innerHTML="",this.useCanvas){var n=this._calculateCanvasSize();if((this.canvas.width!==n.x||this.canvas.height!==n.y)&&(this.canvas.width=n.x,this.canvas.height=n.y,this._updateImageSmoothingEnabled(this.context),this.sketchCanvas!==null)){var r=this._calculateSketchCanvasSize();this.sketchCanvas.width=r.x,this.sketchCanvas.height=r.y,this._updateImageSmoothingEnabled(this.sketchContext)}this._clear()}},_clear:function(n,r){if(this.useCanvas){var s=this._getContext(n);if(r)s.clearRect(r.x,r.y,r.width,r.height);else{var a=s.canvas;s.clearRect(0,0,a.width,a.height)}}},viewportToDrawerRectangle:function(n){var r=this.viewport.pixelFromPointNoRotate(n.getTopLeft(),!0),s=this.viewport.deltaPixelsFromPointsNoRotate(n.getSize(),!0);return new e.Rect(r.x*e.pixelDensityRatio,r.y*e.pixelDensityRatio,s.x*e.pixelDensityRatio,s.y*e.pixelDensityRatio)},drawTile:function(n,r,s,a,o,l,u){if(e.console.assert(n,"[Drawer.drawTile] tile is required"),e.console.assert(r,"[Drawer.drawTile] drawingHandler is required"),this.useCanvas){var c=this._getContext(s);a=a||1,n.drawCanvas(c,r,a,o,l,u)}else n.drawHTML(this.canvas)},_getContext:function(n){var r=this.context;if(n){if(this.sketchCanvas===null){this.sketchCanvas=document.createElement("canvas");var s=this._calculateSketchCanvasSize();if(this.sketchCanvas.width=s.x,this.sketchCanvas.height=s.y,this.sketchContext=this.sketchCanvas.getContext("2d"),this.viewport.getRotation()===0){var a=this;this.viewer.addHandler("rotate",function o(){if(a.viewport.getRotation()!==0){a.viewer.removeHandler("rotate",o);var l=a._calculateSketchCanvasSize();a.sketchCanvas.width=l.x,a.sketchCanvas.height=l.y}})}this._updateImageSmoothingEnabled(this.sketchContext)}r=this.sketchContext}return r},saveContext:function(n){this.useCanvas&&this._getContext(n).save()},restoreContext:function(n){this.useCanvas&&this._getContext(n).restore()},setClip:function(n,r){if(this.useCanvas){var s=this._getContext(r);s.beginPath(),s.rect(n.x,n.y,n.width,n.height),s.clip()}},drawRectangle:function(n,r,s){if(this.useCanvas){var a=this._getContext(s);a.save(),a.fillStyle=r,a.fillRect(n.x,n.y,n.width,n.height),a.restore()}},blendSketch:function(n,r,s,a){var o=n;if(e.isPlainObject(o)||(o={opacity:n,scale:r,translate:s,compositeOperation:a}),!(!this.useCanvas||!this.sketchCanvas)){n=o.opacity,a=o.compositeOperation;var l=o.bounds;if(this.context.save(),this.context.globalAlpha=n,a&&(this.context.globalCompositeOperation=a),l)l.x<0&&(l.width+=l.x,l.x=0),l.x+l.width>this.canvas.width&&(l.width=this.canvas.width-l.x),l.y<0&&(l.height+=l.y,l.y=0),l.y+l.height>this.canvas.height&&(l.height=this.canvas.height-l.y),this.context.drawImage(this.sketchCanvas,l.x,l.y,l.width,l.height,l.x,l.y,l.width,l.height);else{r=o.scale||1,s=o.translate;var u=s instanceof e.Point?s:new e.Point(0,0),c=0,h=0;if(s){var f=this.sketchCanvas.width-this.canvas.width,p=this.sketchCanvas.height-this.canvas.height;c=Math.round(f/2),h=Math.round(p/2)}this.context.drawImage(this.sketchCanvas,u.x-c*r,u.y-h*r,(this.canvas.width+2*c)*r,(this.canvas.height+2*h)*r,-c,-h,this.canvas.width+2*c,this.canvas.height+2*h)}this.context.restore()}},drawDebugInfo:function(n,r,s,a){if(this.useCanvas){var o=this.viewer.world.getIndexOfItem(a)%this.debugGridColor.length,l=this.context;l.save(),l.lineWidth=2*e.pixelDensityRatio,l.font="small-caps bold "+13*e.pixelDensityRatio+"px arial",l.strokeStyle=this.debugGridColor[o],l.fillStyle=this.debugGridColor[o],this.viewport.getRotation(!0)%360!==0&&this._offsetForRotation({degrees:this.viewport.getRotation(!0)}),a.getRotation(!0)%360!==0&&this._offsetForRotation({degrees:a.getRotation(!0),point:a.viewport.pixelFromPointNoRotate(a._getRotationPoint(!0),!0)}),a.viewport.getRotation(!0)%360===0&&a.getRotation(!0)%360===0&&a._drawer.viewer.viewport.getFlip()&&a._drawer._flip(),l.strokeRect(n.position.x*e.pixelDensityRatio,n.position.y*e.pixelDensityRatio,n.size.x*e.pixelDensityRatio,n.size.y*e.pixelDensityRatio);var u=(n.position.x+n.size.x/2)*e.pixelDensityRatio,c=(n.position.y+n.size.y/2)*e.pixelDensityRatio;l.translate(u,c),l.rotate(Math.PI/180*-this.viewport.getRotation(!0)),l.translate(-u,-c),n.x===0&&n.y===0&&(l.fillText("Zoom: "+this.viewport.getZoom(),n.position.x*e.pixelDensityRatio,(n.position.y-30)*e.pixelDensityRatio),l.fillText("Pan: "+this.viewport.getBounds().toString(),n.position.x*e.pixelDensityRatio,(n.position.y-20)*e.pixelDensityRatio)),l.fillText("Level: "+n.level,(n.position.x+10)*e.pixelDensityRatio,(n.position.y+20)*e.pixelDensityRatio),l.fillText("Column: "+n.x,(n.position.x+10)*e.pixelDensityRatio,(n.position.y+30)*e.pixelDensityRatio),l.fillText("Row: "+n.y,(n.position.x+10)*e.pixelDensityRatio,(n.position.y+40)*e.pixelDensityRatio),l.fillText("Order: "+s+" of "+r,(n.position.x+10)*e.pixelDensityRatio,(n.position.y+50)*e.pixelDensityRatio),l.fillText("Size: "+n.size.toString(),(n.position.x+10)*e.pixelDensityRatio,(n.position.y+60)*e.pixelDensityRatio),l.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(),a.getRotation(!0)%360!==0&&this._restoreRotationChanges(),a.viewport.getRotation(!0)%360===0&&a.getRotation(!0)%360===0&&a._drawer.viewer.viewport.getFlip()&&a._drawer._flip(),l.restore()}},debugRect:function(n){if(this.useCanvas){var r=this.context;r.save(),r.lineWidth=2*e.pixelDensityRatio,r.strokeStyle=this.debugGridColor[0],r.fillStyle=this.debugGridColor[0],r.strokeRect(n.x*e.pixelDensityRatio,n.y*e.pixelDensityRatio,n.width*e.pixelDensityRatio,n.height*e.pixelDensityRatio),r.restore()}},setImageSmoothingEnabled:function(n){this.useCanvas&&(this._imageSmoothingEnabled=n,this._updateImageSmoothingEnabled(this.context),this.viewer.forceRedraw())},_updateImageSmoothingEnabled:function(n){n.msImageSmoothingEnabled=this._imageSmoothingEnabled,n.imageSmoothingEnabled=this._imageSmoothingEnabled},getCanvasSize:function(n){var r=this._getContext(n).canvas;return new e.Point(r.width,r.height)},getCanvasCenter:function(){return new e.Point(this.canvas.width/2,this.canvas.height/2)},_offsetForRotation:function(n){var r=n.point?n.point.times(e.pixelDensityRatio):this.getCanvasCenter(),s=this._getContext(n.useSketch);s.save(),s.translate(r.x,r.y),this.viewer.viewport.flipped?(s.rotate(Math.PI/180*-n.degrees),s.scale(-1,1)):s.rotate(Math.PI/180*n.degrees),s.translate(-r.x,-r.y)},_flip:function(n){n=n||{};var r=n.point?n.point.times(e.pixelDensityRatio):this.getCanvasCenter(),s=this._getContext(n.useSketch);s.translate(r.x,0),s.scale(-1,1),s.translate(-r.x,0)},_restoreRotationChanges:function(n){var r=this._getContext(n);r.restore()},_calculateCanvasSize:function(){var n=e.pixelDensityRatio,r=this.viewport.getContainerSize();return{x:Math.round(r.x*n),y:Math.round(r.y*n)}},_calculateSketchCanvasSize:function(){var n=this._calculateCanvasSize();if(this.viewport.getRotation()===0)return n;var r=Math.ceil(Math.sqrt(n.x*n.x+n.y*n.y));return{x:r,y:r}}}}(i),function(e){e.Viewport=function(n){var r=arguments;r.length&&r[0]instanceof e.Point&&(n={containerSize:r[0],contentSize:r[1],config:r[2]}),n.config&&(e.extend(!0,n,n.config),delete n.config),this._margins=e.extend({left:0,top:0,right:0,bottom:0},n.margins||{}),delete n.margins,n.initialDegrees=n.degrees,delete n.degrees,e.extend(!0,this,{containerSize:null,contentSize:null,zoomPoint:null,rotationPivot:null,viewer:null,springStiffness:e.DEFAULT_SETTINGS.springStiffness,animationTime:e.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:e.DEFAULT_SETTINGS.minZoomImageRatio,maxZoomPixelRatio:e.DEFAULT_SETTINGS.maxZoomPixelRatio,visibilityRatio:e.DEFAULT_SETTINGS.visibilityRatio,wrapHorizontal:e.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:e.DEFAULT_SETTINGS.wrapVertical,defaultZoomLevel:e.DEFAULT_SETTINGS.defaultZoomLevel,minZoomLevel:e.DEFAULT_SETTINGS.minZoomLevel,maxZoomLevel:e.DEFAULT_SETTINGS.maxZoomLevel,initialDegrees:e.DEFAULT_SETTINGS.degrees,flipped:e.DEFAULT_SETTINGS.flipped,homeFillsViewer:e.DEFAULT_SETTINGS.homeFillsViewer,silenceMultiImageWarnings:e.DEFAULT_SETTINGS.silenceMultiImageWarnings},n),this._updateContainerInnerSize(),this.centerSpringX=new e.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.centerSpringY=new e.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.zoomSpring=new e.Spring({exponential:!0,initial:1,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.degreesSpring=new e.Spring({initial:n.initialDegrees,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._oldCenterX=this.centerSpringX.current.value,this._oldCenterY=this.centerSpringY.current.value,this._oldZoom=this.zoomSpring.current.value,this._oldDegrees=this.degreesSpring.current.value,this._setContentBounds(new e.Rect(0,0,1,1),1),this.goHome(!0),this.update()},e.Viewport.prototype={get degrees(){return e.console.warn("Accessing [Viewport.degrees] is deprecated. Use viewport.getRotation instead."),this.getRotation()},set degrees(n){e.console.warn("Setting [Viewport.degrees] is deprecated. Use viewport.rotateTo, viewport.rotateBy, or viewport.setRotation instead."),this.rotateTo(n)},resetContentSize:function(n){return e.console.assert(n,"[Viewport.resetContentSize] contentSize is required"),e.console.assert(n instanceof e.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point"),e.console.assert(n.x>0,"[Viewport.resetContentSize] contentSize.x must be greater than 0"),e.console.assert(n.y>0,"[Viewport.resetContentSize] contentSize.y must be greater than 0"),this._setContentBounds(new e.Rect(0,0,1,n.y/n.x),n.x),this},setHomeBounds:function(n,r){e.console.error("[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually."),this._setContentBounds(n,r)},_setContentBounds:function(n,r){e.console.assert(n,"[Viewport._setContentBounds] bounds is required"),e.console.assert(n instanceof e.Rect,"[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect"),e.console.assert(n.width>0,"[Viewport._setContentBounds] bounds.width must be greater than 0"),e.console.assert(n.height>0,"[Viewport._setContentBounds] bounds.height must be greater than 0"),this._contentBoundsNoRotate=n.clone(),this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(r),this._contentBounds=n.rotate(this.getRotation()).getBoundingBox(),this._contentSize=this._contentBounds.getSize().times(r),this._contentAspectRatio=this._contentSize.x/this._contentSize.y,this.viewer&&this.viewer.raiseEvent("reset-size",{contentSize:this._contentSizeNoRotate.clone(),contentFactor:r,homeBounds:this._contentBoundsNoRotate.clone(),contentBounds:this._contentBounds.clone()})},getHomeZoom:function(){if(this.defaultZoomLevel)return this.defaultZoomLevel;var n=this._contentAspectRatio/this.getAspectRatio(),r;return this.homeFillsViewer?r=n>=1?n:1:r=n>=1?1:n,r/this._contentBounds.width},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation())},getHomeBoundsNoRotate:function(){var n=this._contentBounds.getCenter(),r=1/this.getHomeZoom(),s=r/this.getAspectRatio();return new e.Rect(n.x-r/2,n.y-s/2,r,s)},goHome:function(n){return this.viewer&&this.viewer.raiseEvent("home",{immediately:n}),this.fitBounds(this.getHomeBounds(),n)},getMinZoom:function(){var n=this.getHomeZoom(),r=this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*n;return r},getMaxZoom:function(){var n=this.maxZoomLevel;return n||(n=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x,n/=this._contentBounds.width),Math.max(n,this.getHomeZoom())},getAspectRatio:function(){return this._containerInnerSize.x/this._containerInnerSize.y},getContainerSize:function(){return new e.Point(this.containerSize.x,this.containerSize.y)},getMargins:function(){return e.extend({},this._margins)},setMargins:function(n){e.console.assert(e.type(n)==="object","[Viewport.setMargins] margins must be an object"),this._margins=e.extend({left:0,top:0,right:0,bottom:0},n),this._updateContainerInnerSize(),this.viewer&&this.viewer.forceRedraw()},getBounds:function(n){return this.getBoundsNoRotate(n).rotate(-this.getRotation(n))},getBoundsNoRotate:function(n){var r=this.getCenter(n),s=1/this.getZoom(n),a=s/this.getAspectRatio();return new e.Rect(r.x-s/2,r.y-a/2,s,a)},getBoundsWithMargins:function(n){return this.getBoundsNoRotateWithMargins(n).rotate(-this.getRotation(n),this.getCenter(n))},getBoundsNoRotateWithMargins:function(n){var r=this.getBoundsNoRotate(n),s=this._containerInnerSize.x*this.getZoom(n);return r.x-=this._margins.left/s,r.y-=this._margins.top/s,r.width+=(this._margins.left+this._margins.right)/s,r.height+=(this._margins.top+this._margins.bottom)/s,r},getCenter:function(n){var r=new e.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),s=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value),a,o,l,u,c,h,f,p;return n?r:this.zoomPoint?(a=this.pixelFromPoint(this.zoomPoint,!0),o=this.getZoom(),l=1/o,u=l/this.getAspectRatio(),c=new e.Rect(r.x-l/2,r.y-u/2,l,u),h=this._pixelFromPoint(this.zoomPoint,c),f=h.minus(a).rotate(-this.getRotation(!0)),p=f.divide(this._containerInnerSize.x*o),s.plus(p)):s},getZoom:function(n){return n?this.zoomSpring.current.value:this.zoomSpring.target.value},_applyZoomConstraints:function(n){return Math.max(Math.min(n,this.getMaxZoom()),this.getMinZoom())},_applyBoundaryConstraints:function(n){var r=this.viewportToViewerElementRectangle(n).getBoundingBox(),s=this.viewportToViewerElementRectangle(this._contentBoundsNoRotate).getBoundingBox(),a=!1,o=!1;if(!this.wrapHorizontal){var l=r.x+r.width,u=s.x+s.width,c,h,f;r.width>s.width?c=this.visibilityRatio*s.width:c=this.visibilityRatio*r.width,h=s.x-l+c,f=u-r.x-c,c>s.width?(r.x+=(h+f)/2,a=!0):f<0?(r.x+=f,a=!0):h>0&&(r.x+=h,a=!0)}if(!this.wrapVertical){var p=r.y+r.height,m=s.y+s.height,b,T,y;r.height>s.height?b=this.visibilityRatio*s.height:b=this.visibilityRatio*r.height,T=s.y-p+b,y=m-r.y-b,b>s.height?(r.y+=(T+y)/2,o=!0):y<0?(r.y+=y,o=!0):T>0&&(r.y+=T,o=!0)}var w=a||o,S=w?this.viewerElementToViewportRectangle(r):n.clone();return S.xConstrained=a,S.yConstrained=o,S.constraintApplied=w,S},_raiseConstraintsEvent:function(n){this.viewer&&this.viewer.raiseEvent("constrain",{immediately:n})},applyConstraints:function(n){var r=this.getZoom(),s=this._applyZoomConstraints(r);r!==s&&this.zoomTo(s,this.zoomPoint,n);var a=this.getConstrainedBounds(!1);return a.constraintApplied&&(this.fitBounds(a,n),this._raiseConstraintsEvent(n)),this},ensureVisible:function(n){return this.applyConstraints(n)},_fitBounds:function(n,r){r=r||{};var s=r.immediately||!1,a=r.constraints||!1,o=this.getAspectRatio(),l=n.getCenter(),u=new e.Rect(n.x,n.y,n.width,n.height,n.degrees+this.getRotation()).getBoundingBox();u.getAspectRatio()>=o?u.height=u.width/o:u.width=u.height*o,u.x=l.x-u.width/2,u.y=l.y-u.height/2;var c=1/u.width;if(s)return this.panTo(l,!0),this.zoomTo(c,null,!0),a&&this.applyConstraints(!0),this;var h=this.getCenter(!0),f=this.getZoom(!0);this.panTo(h,!0),this.zoomTo(f,null,!0);var p=this.getBounds(),m=this.getZoom();if(m===0||Math.abs(c/m-1)<1e-8)return this.zoomTo(c,null,!0),this.panTo(l,s),a&&this.applyConstraints(!1),this;if(a){this.panTo(l,!1),this.zoomTo(c,null,!1);var b=this.getConstrainedBounds();this.panTo(h,!0),this.zoomTo(f,null,!0),this.fitBounds(b)}else{var T=u.rotate(-this.getRotation()),y=T.getTopLeft().times(c).minus(p.getTopLeft().times(m)).divide(c-m);this.zoomTo(c,y,s)}return this},fitBounds:function(n,r){return this._fitBounds(n,{immediately:r,constraints:!1})},fitBoundsWithConstraints:function(n,r){return this._fitBounds(n,{immediately:r,constraints:!0})},fitVertically:function(n){var r=new e.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(r,n)},fitHorizontally:function(n){var r=new e.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(r,n)},getConstrainedBounds:function(n){var r,s;return r=this.getBounds(n),s=this._applyBoundaryConstraints(r),s},panBy:function(n,r){var s=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(s.plus(n),r)},panTo:function(n,r){return r?(this.centerSpringX.resetTo(n.x),this.centerSpringY.resetTo(n.y)):(this.centerSpringX.springTo(n.x),this.centerSpringY.springTo(n.y)),this.viewer&&this.viewer.raiseEvent("pan",{center:n,immediately:r}),this},zoomBy:function(n,r,s){return this.zoomTo(this.zoomSpring.target.value*n,r,s)},zoomTo:function(n,r,s){var a=this;return this.zoomPoint=r instanceof e.Point&&!isNaN(r.x)&&!isNaN(r.y)?r:null,s?this._adjustCenterSpringsForZoomPoint(function(){a.zoomSpring.resetTo(n)}):this.zoomSpring.springTo(n),this.viewer&&this.viewer.raiseEvent("zoom",{zoom:n,refPoint:r,immediately:s}),this},setRotation:function(n,r){return this.rotateTo(n,null,r)},getRotation:function(n){return n?this.degreesSpring.current.value:this.degreesSpring.target.value},setRotationWithPivot:function(n,r,s){return this.rotateTo(n,r,s)},rotateTo:function(n,r,s){if(!this.viewer||!this.viewer.drawer.canRotate())return this;if(this.degreesSpring.target.value===n&&this.degreesSpring.isAtTargetValue())return this;if(this.rotationPivot=r instanceof e.Point&&!isNaN(r.x)&&!isNaN(r.y)?r:null,s)if(this.rotationPivot){var a=n-this._oldDegrees;if(!a)return this.rotationPivot=null,this;this._rotateAboutPivot(n)}else this.degreesSpring.resetTo(n);else{var o=e.positiveModulo(this.degreesSpring.current.value,360),l=e.positiveModulo(n,360),u=l-o;u>180?l-=360:u<-180&&(l+=360);var c=o-l;this.degreesSpring.resetTo(n+c),this.degreesSpring.springTo(n)}return this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor()),this.viewer.forceRedraw(),this.viewer.raiseEvent("rotate",{degrees:n,immediately:!!s,pivot:this.rotationPivot||this.getCenter()}),this},rotateBy:function(n,r,s){return this.rotateTo(this.degreesSpring.target.value+n,r,s)},resize:function(n,r){var s=this.getBoundsNoRotate(),a=s,o;return this.containerSize.x=n.x,this.containerSize.y=n.y,this._updateContainerInnerSize(),r&&(o=n.x/this.containerSize.x,a.width=s.width*o,a.height=a.width/this.getAspectRatio()),this.viewer&&this.viewer.raiseEvent("resize",{newContainerSize:n,maintain:r}),this.fitBounds(a,!0)},_updateContainerInnerSize:function(){this._containerInnerSize=new e.Point(Math.max(1,this.containerSize.x-(this._margins.left+this._margins.right)),Math.max(1,this.containerSize.y-(this._margins.top+this._margins.bottom)))},update:function(){var n=this;this._adjustCenterSpringsForZoomPoint(function(){n.zoomSpring.update()}),this.degreesSpring.isAtTargetValue()&&(this.rotationPivot=null),this.centerSpringX.update(),this.centerSpringY.update(),this.rotationPivot?this._rotateAboutPivot(!0):this.degreesSpring.update();var r=this.centerSpringX.current.value!==this._oldCenterX||this.centerSpringY.current.value!==this._oldCenterY||this.zoomSpring.current.value!==this._oldZoom||this.degreesSpring.current.value!==this._oldDegrees;return this._oldCenterX=this.centerSpringX.current.value,this._oldCenterY=this.centerSpringY.current.value,this._oldZoom=this.zoomSpring.current.value,this._oldDegrees=this.degreesSpring.current.value,r},_rotateAboutPivot:function(n){var r=n===!0,s=this.rotationPivot.minus(this.getCenter());this.centerSpringX.shiftBy(s.x),this.centerSpringY.shiftBy(s.y),r?this.degreesSpring.update():this.degreesSpring.resetTo(n);var a=this.degreesSpring.current.value-this._oldDegrees,o=s.rotate(a*-1).times(-1);this.centerSpringX.shiftBy(o.x),this.centerSpringY.shiftBy(o.y)},_adjustCenterSpringsForZoomPoint:function(n){if(this.zoomPoint){var r=this.pixelFromPoint(this.zoomPoint,!0);n();var s=this.pixelFromPoint(this.zoomPoint,!0),a=s.minus(r),o=this.deltaPointsFromPixels(a,!0);this.centerSpringX.shiftBy(o.x),this.centerSpringY.shiftBy(o.y),this.zoomSpring.isAtTargetValue()&&(this.zoomPoint=null)}else n()},deltaPixelsFromPointsNoRotate:function(n,r){return n.times(this._containerInnerSize.x*this.getZoom(r))},deltaPixelsFromPoints:function(n,r){return this.deltaPixelsFromPointsNoRotate(n.rotate(this.getRotation(r)),r)},deltaPointsFromPixelsNoRotate:function(n,r){return n.divide(this._containerInnerSize.x*this.getZoom(r))},deltaPointsFromPixels:function(n,r){return this.deltaPointsFromPixelsNoRotate(n,r).rotate(-this.getRotation(r))},pixelFromPointNoRotate:function(n,r){return this._pixelFromPointNoRotate(n,this.getBoundsNoRotate(r))},pixelFromPoint:function(n,r){return this._pixelFromPoint(n,this.getBoundsNoRotate(r))},_pixelFromPointNoRotate:function(n,r){return n.minus(r.getTopLeft()).times(this._containerInnerSize.x/r.width).plus(new e.Point(this._margins.left,this._margins.top))},_pixelFromPoint:function(n,r){return this._pixelFromPointNoRotate(n.rotate(this.getRotation(!0),this.getCenter(!0)),r)},pointFromPixelNoRotate:function(n,r){var s=this.getBoundsNoRotate(r);return n.minus(new e.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/s.width).plus(s.getTopLeft())},pointFromPixel:function(n,r){return this.pointFromPixelNoRotate(n,r).rotate(-this.getRotation(r),this.getCenter(r))},_viewportToImageDelta:function(n,r){var s=this._contentBoundsNoRotate.width;return new e.Point(n*this._contentSizeNoRotate.x/s,r*this._contentSizeNoRotate.x/s)},viewportToImageCoordinates:function(n,r){if(n instanceof e.Point)return this.viewportToImageCoordinates(n.x,n.y);if(this.viewer){var s=this.viewer.world.getItemCount();if(s>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.viewportToImageCoordinates] is not accurate with multi-image; use TiledImage.viewportToImageCoordinates instead.");else if(s===1){var a=this.viewer.world.getItemAt(0);return a.viewportToImageCoordinates(n,r,!0)}}return this._viewportToImageDelta(n-this._contentBoundsNoRotate.x,r-this._contentBoundsNoRotate.y)},_imageToViewportDelta:function(n,r){var s=this._contentBoundsNoRotate.width;return new e.Point(n/this._contentSizeNoRotate.x*s,r/this._contentSizeNoRotate.x*s)},imageToViewportCoordinates:function(n,r){if(n instanceof e.Point)return this.imageToViewportCoordinates(n.x,n.y);if(this.viewer){var s=this.viewer.world.getItemCount();if(s>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.imageToViewportCoordinates] is not accurate with multi-image; use TiledImage.imageToViewportCoordinates instead.");else if(s===1){var a=this.viewer.world.getItemAt(0);return a.imageToViewportCoordinates(n,r,!0)}}var o=this._imageToViewportDelta(n,r);return o.x+=this._contentBoundsNoRotate.x,o.y+=this._contentBoundsNoRotate.y,o},imageToViewportRectangle:function(n,r,s,a){var o=n;if(o instanceof e.Rect||(o=new e.Rect(n,r,s,a)),this.viewer){var l=this.viewer.world.getItemCount();if(l>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.imageToViewportRectangle] is not accurate with multi-image; use TiledImage.imageToViewportRectangle instead.");else if(l===1){var u=this.viewer.world.getItemAt(0);return u.imageToViewportRectangle(n,r,s,a,!0)}}var c=this.imageToViewportCoordinates(o.x,o.y),h=this._imageToViewportDelta(o.width,o.height);return new e.Rect(c.x,c.y,h.x,h.y,o.degrees)},viewportToImageRectangle:function(n,r,s,a){var o=n;if(o instanceof e.Rect||(o=new e.Rect(n,r,s,a)),this.viewer){var l=this.viewer.world.getItemCount();if(l>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.viewportToImageRectangle] is not accurate with multi-image; use TiledImage.viewportToImageRectangle instead.");else if(l===1){var u=this.viewer.world.getItemAt(0);return u.viewportToImageRectangle(n,r,s,a,!0)}}var c=this.viewportToImageCoordinates(o.x,o.y),h=this._viewportToImageDelta(o.width,o.height);return new e.Rect(c.x,c.y,h.x,h.y,o.degrees)},viewerElementToImageCoordinates:function(n){var r=this.pointFromPixel(n,!0);return this.viewportToImageCoordinates(r)},imageToViewerElementCoordinates:function(n){var r=this.imageToViewportCoordinates(n);return this.pixelFromPoint(r,!0)},windowToImageCoordinates:function(n){e.console.assert(this.viewer,"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");var r=n.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(r)},imageToWindowCoordinates:function(n){e.console.assert(this.viewer,"[Viewport.imageToWindowCoordinates] the viewport must have a viewer.");var r=this.imageToViewerElementCoordinates(n);return r.plus(e.getElementPosition(this.viewer.element))},viewerElementToViewportCoordinates:function(n){return this.pointFromPixel(n,!0)},viewportToViewerElementCoordinates:function(n){return this.pixelFromPoint(n,!0)},viewerElementToViewportRectangle:function(n){return e.Rect.fromSummits(this.pointFromPixel(n.getTopLeft(),!0),this.pointFromPixel(n.getTopRight(),!0),this.pointFromPixel(n.getBottomLeft(),!0))},viewportToViewerElementRectangle:function(n){return e.Rect.fromSummits(this.pixelFromPoint(n.getTopLeft(),!0),this.pixelFromPoint(n.getTopRight(),!0),this.pixelFromPoint(n.getBottomLeft(),!0))},windowToViewportCoordinates:function(n){e.console.assert(this.viewer,"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");var r=n.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(r)},viewportToWindowCoordinates:function(n){e.console.assert(this.viewer,"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer.");var r=this.viewportToViewerElementCoordinates(n);return r.plus(e.getElementPosition(this.viewer.element))},viewportToImageZoom:function(n){if(this.viewer){var r=this.viewer.world.getItemCount();if(r>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.viewportToImageZoom] is not accurate with multi-image.");else if(r===1){var s=this.viewer.world.getItemAt(0);return s.viewportToImageZoom(n)}}var a=this._contentSizeNoRotate.x,o=this._containerInnerSize.x,l=this._contentBoundsNoRotate.width,u=o/a*l;return n*u},imageToViewportZoom:function(n){if(this.viewer){var r=this.viewer.world.getItemCount();if(r>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.imageToViewportZoom] is not accurate with multi-image.");else if(r===1){var s=this.viewer.world.getItemAt(0);return s.imageToViewportZoom(n)}}var a=this._contentSizeNoRotate.x,o=this._containerInnerSize.x,l=this._contentBoundsNoRotate.width,u=a/o/l;return n*u},toggleFlip:function(){return this.setFlip(!this.getFlip()),this},getFlip:function(){return this.flipped},setFlip:function(n){return this.flipped===n?this:(this.flipped=n,this.viewer.navigator&&this.viewer.navigator.setFlip(this.getFlip()),this.viewer.forceRedraw(),this.viewer.raiseEvent("flip",{flipped:n}),this)}}}(i),function(e){e.TiledImage=function(o){var l=this;e.console.assert(o.tileCache,"[TiledImage] options.tileCache is required"),e.console.assert(o.drawer,"[TiledImage] options.drawer is required"),e.console.assert(o.viewer,"[TiledImage] options.viewer is required"),e.console.assert(o.imageLoader,"[TiledImage] options.imageLoader is required"),e.console.assert(o.source,"[TiledImage] options.source is required"),e.console.assert(!o.clip||o.clip instanceof e.Rect,"[TiledImage] options.clip must be an OpenSeadragon.Rect if present"),e.EventSource.call(this),this._tileCache=o.tileCache,delete o.tileCache,this._drawer=o.drawer,delete o.drawer,this._imageLoader=o.imageLoader,delete o.imageLoader,o.clip instanceof e.Rect&&(this._clip=o.clip.clone()),delete o.clip;var u=o.x||0;delete o.x;var c=o.y||0;delete o.y,this.normHeight=o.source.dimensions.y/o.source.dimensions.x,this.contentAspectX=o.source.dimensions.x/o.source.dimensions.y;var h=1;o.width?(h=o.width,delete o.width,o.height&&(e.console.error("specifying both width and height to a tiledImage is not supported"),delete o.height)):o.height&&(h=o.height/this.normHeight,delete o.height);var f=o.fitBounds;delete o.fitBounds;var p=o.fitBoundsPlacement||i.Placement.CENTER;delete o.fitBoundsPlacement;var m=o.degrees||0;delete o.degrees,e.extend(!0,this,{viewer:null,tilesMatrix:{},coverage:{},loadingCoverage:{},lastDrawn:[],lastResetTime:0,_midDraw:!1,_needsDraw:!0,_hasOpaqueTile:!1,_tilesLoading:0,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},o),this._preload=this.preload,delete this.preload,this._fullyLoaded=!1,this._xSpring=new e.Spring({initial:u,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._ySpring=new e.Spring({initial:c,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._scaleSpring=new e.Spring({initial:h,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._degreesSpring=new e.Spring({initial:m,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._updateForScale(),f&&this.fitBounds(f,p,!0),this._drawingHandler=function(b){l.viewer.raiseEvent("tile-drawing",e.extend({tiledImage:l},b))}},e.extend(e.TiledImage.prototype,e.EventSource.prototype,{needsDraw:function(){return this._needsDraw},getFullyLoaded:function(){return this._fullyLoaded},_setFullyLoaded:function(o){o!==this._fullyLoaded&&(this._fullyLoaded=o,this.raiseEvent("fully-loaded-change",{fullyLoaded:this._fullyLoaded}))},reset:function(){this._tileCache.clearTilesFor(this),this.lastResetTime=e.now(),this._needsDraw=!0},update:function(){var o=this._xSpring.update(),l=this._ySpring.update(),u=this._scaleSpring.update(),c=this._degreesSpring.update();return o||l||u||c?(this._updateForScale(),this._needsDraw=!0,!0):!1},draw:function(){this.opacity!==0||this._preload?(this._midDraw=!0,this._updateViewport(),this._midDraw=!1):this._needsDraw=!1},destroy:function(){this.reset(),this.source.destroy&&this.source.destroy()},getBounds:function(o){return this.getBoundsNoRotate(o).rotate(this.getRotation(o),this._getRotationPoint(o))},getBoundsNoRotate:function(o){return o?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(o){var l=this.getBoundsNoRotate(o);if(this._clip){var u=o?this._worldWidthCurrent:this._worldWidthTarget,c=u/this.source.dimensions.x,h=this._clip.times(c);l=new e.Rect(l.x+h.x,l.y+h.y,h.width,h.height)}return l.rotate(this.getRotation(o),this._getRotationPoint(o))},getTileBounds:function(o,l,u){var c=this.source.getNumTiles(o),h=(c.x+l%c.x)%c.x,f=(c.y+u%c.y)%c.y,p=this.source.getTileBounds(o,h,f);return this.getFlip()&&(p.x=1-p.x-p.width),p.x+=(l-h)/c.x,p.y+=this._worldHeightCurrent/this._worldWidthCurrent*((u-f)/c.y),p},getContentSize:function(){return new e.Point(this.source.dimensions.x,this.source.dimensions.y)},getSizeInWindowCoordinates:function(){var o=this.imageToWindowCoordinates(new e.Point(0,0)),l=this.imageToWindowCoordinates(this.getContentSize());return new e.Point(l.x-o.x,l.y-o.y)},_viewportToImageDelta:function(o,l,u){var c=u?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(o*(this.source.dimensions.x/c),l*(this.source.dimensions.y*this.contentAspectX/c))},viewportToImageCoordinates:function(o,l,u){var c;return o instanceof e.Point?(u=l,c=o):c=new e.Point(o,l),c=c.rotate(-this.getRotation(u),this._getRotationPoint(u)),u?this._viewportToImageDelta(c.x-this._xSpring.current.value,c.y-this._ySpring.current.value):this._viewportToImageDelta(c.x-this._xSpring.target.value,c.y-this._ySpring.target.value)},_imageToViewportDelta:function(o,l,u){var c=u?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(o/this.source.dimensions.x*c,l/this.source.dimensions.y/this.contentAspectX*c)},imageToViewportCoordinates:function(o,l,u){o instanceof e.Point&&(u=l,l=o.y,o=o.x);var c=this._imageToViewportDelta(o,l);return u?(c.x+=this._xSpring.current.value,c.y+=this._ySpring.current.value):(c.x+=this._xSpring.target.value,c.y+=this._ySpring.target.value),c.rotate(this.getRotation(u),this._getRotationPoint(u))},imageToViewportRectangle:function(o,l,u,c,h){var f=o;f instanceof e.Rect?h=l:f=new e.Rect(o,l,u,c);var p=this.imageToViewportCoordinates(f.getTopLeft(),h),m=this._imageToViewportDelta(f.width,f.height,h);return new e.Rect(p.x,p.y,m.x,m.y,f.degrees+this.getRotation(h))},viewportToImageRectangle:function(o,l,u,c,h){var f=o;o instanceof e.Rect?h=l:f=new e.Rect(o,l,u,c);var p=this.viewportToImageCoordinates(f.getTopLeft(),h),m=this._viewportToImageDelta(f.width,f.height,h);return new e.Rect(p.x,p.y,m.x,m.y,f.degrees-this.getRotation(h))},viewerElementToImageCoordinates:function(o){var l=this.viewport.pointFromPixel(o,!0);return this.viewportToImageCoordinates(l)},imageToViewerElementCoordinates:function(o){var l=this.imageToViewportCoordinates(o);return this.viewport.pixelFromPoint(l,!0)},windowToImageCoordinates:function(o){var l=o.minus(i.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(l)},imageToWindowCoordinates:function(o){var l=this.imageToViewerElementCoordinates(o);return l.plus(i.getElementPosition(this.viewer.element))},_viewportToTiledImageRectangle:function(o){var l=this._scaleSpring.current.value;return o=o.rotate(-this.getRotation(!0),this._getRotationPoint(!0)),new e.Rect((o.x-this._xSpring.current.value)/l,(o.y-this._ySpring.current.value)/l,o.width/l,o.height/l,o.degrees)},viewportToImageZoom:function(o){var l=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return l*o},imageToViewportZoom:function(o){var l=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return o/l},setPosition:function(o,l){var u=this._xSpring.target.value===o.x&&this._ySpring.target.value===o.y;if(l){if(u&&this._xSpring.current.value===o.x&&this._ySpring.current.value===o.y)return;this._xSpring.resetTo(o.x),this._ySpring.resetTo(o.y),this._needsDraw=!0}else{if(u)return;this._xSpring.springTo(o.x),this._ySpring.springTo(o.y),this._needsDraw=!0}u||this._raiseBoundsChange()},setWidth:function(o,l){this._setScale(o,l)},setHeight:function(o,l){this._setScale(o/this.normHeight,l)},setCroppingPolygons:function(o){var l=function(c){return c instanceof e.Point||typeof c.x=="number"&&typeof c.y=="number"},u=function(c){return c.map(function(h){try{if(l(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(o))throw new Error("Provided cropping polygon is not an array");this._croppingPolygons=o.map(function(c){return u(c)})}catch(c){e.console.error("[TiledImage.setCroppingPolygons] Cropping polygon format not supported"),e.console.error(c),this._croppingPolygons=null}},resetCroppingPolygons:function(){this._croppingPolygons=null},fitBounds:function(o,l,u){l=l||e.Placement.CENTER;var c=e.Placement.properties[l],h=this.contentAspectX,f=0,p=0,m=1,b=1;if(this._clip&&(h=this._clip.getAspectRatio(),m=this._clip.width/this.source.dimensions.x,b=this._clip.height/this.source.dimensions.y,o.getAspectRatio()>h?(f=this._clip.x/this._clip.height*o.height,p=this._clip.y/this._clip.height*o.height):(f=this._clip.x/this._clip.width*o.width,p=this._clip.y/this._clip.width*o.width)),o.getAspectRatio()>h){var T=o.height/b,y=0;c.isHorizontallyCentered?y=(o.width-o.height*h)/2:c.isRight&&(y=o.width-o.height*h),this.setPosition(new e.Point(o.x-f+y,o.y-p),u),this.setHeight(T,u)}else{var w=o.width/m,S=0;c.isVerticallyCentered?S=(o.height-o.width/h)/2:c.isBottom&&(S=o.height-o.width/h),this.setPosition(new e.Point(o.x-f,o.y-p+S),u),this.setWidth(w,u)}},getClip:function(){return this._clip?this._clip.clone():null},setClip:function(o){e.console.assert(!o||o instanceof e.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null"),o instanceof e.Rect?this._clip=o.clone():this._clip=null,this._needsDraw=!0,this.raiseEvent("clip-change")},getFlip:function(){return!!this.flipped},setFlip:function(o){this.flipped=!!o,this._needsDraw=!0,this._raiseBoundsChange()},getOpacity:function(){return this.opacity},setOpacity:function(o){o!==this.opacity&&(this.opacity=o,this._needsDraw=!0,this.raiseEvent("opacity-change",{opacity:this.opacity}))},getPreload:function(){return this._preload},setPreload:function(o){this._preload=!!o,this._needsDraw=!0},getRotation:function(o){return o?this._degreesSpring.current.value:this._degreesSpring.target.value},setRotation:function(o,l){this._degreesSpring.target.value===o&&this._degreesSpring.isAtTargetValue()||(l?this._degreesSpring.resetTo(o):this._degreesSpring.springTo(o),this._needsDraw=!0,this._raiseBoundsChange())},_getRotationPoint:function(o){return this.getBoundsNoRotate(o).getCenter()},getCompositeOperation:function(){return this.compositeOperation},setCompositeOperation:function(o){o!==this.compositeOperation&&(this.compositeOperation=o,this._needsDraw=!0,this.raiseEvent("composite-operation-change",{compositeOperation:this.compositeOperation}))},_setScale:function(o,l){var u=this._scaleSpring.target.value===o;if(l){if(u&&this._scaleSpring.current.value===o)return;this._scaleSpring.resetTo(o),this._updateForScale(),this._needsDraw=!0}else{if(u)return;this._scaleSpring.springTo(o),this._updateForScale(),this._needsDraw=!0}u||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 o=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2))),l=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),!0).x*this._scaleSpring.current.value,u=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(l/this.minPixelRatio)/Math.log(2))));return u=Math.max(u,this.source.minLevel||0),o=Math.min(o,u),{lowestLevel:o,highestLevel:u}},_updateViewport:function(){for(this._needsDraw=!1,this._tilesLoading=0,this.loadingCoverage={};this.lastDrawn.length>0;){var o=this.lastDrawn.pop();o.beingDrawn=!1}var l=this.viewport,u=this._viewportToTiledImageRectangle(l.getBoundsWithMargins(!0));if(!this.wrapHorizontal&&!this.wrapVertical){var c=this._viewportToTiledImageRectangle(this.getClippedBounds(!0));if(u=u.intersection(c),u===null)return}for(var h=this._getLevelsInterval(),f=h.lowestLevel,p=h.highestLevel,m=null,b=!1,T=e.now(),y=p;y>=f;y--){var w=!1,S=l.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(y),!0).x*this._scaleSpring.current.value;if(y===f||!b&&S>=this.minPixelRatio)w=!0,b=!0;else if(!b)continue;var C=l.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(y),!1).x*this._scaleSpring.current.value,L=l.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),!1).x*this._scaleSpring.current.value,D=this.immediateRender?1:L,j=Math.min(1,(S-.5)/.5),N=D/Math.abs(D-C);if(m=this._updateLevel(b,w,y,j,N,u,T,m),this._providesCoverage(this.coverage,y))break}this._drawTiles(this.lastDrawn),m&&!m.context2D?(this._loadTile(m,T),this._needsDraw=!0,this._setFullyLoaded(!1)):this._setFullyLoaded(this._tilesLoading===0)},_getCornerTiles:function(o,l,u){var c,h;this.wrapHorizontal?(c=e.positiveModulo(l.x,1),h=e.positiveModulo(u.x,1)):(c=Math.max(0,l.x),h=Math.min(1,u.x));var f,p,m=1/this.source.aspectRatio;this.wrapVertical?(f=e.positiveModulo(l.y,m),p=e.positiveModulo(u.y,m)):(f=Math.max(0,l.y),p=Math.min(m,u.y));var b=this.source.getTileAtPoint(o,new e.Point(c,f)),T=this.source.getTileAtPoint(o,new e.Point(h,p)),y=this.source.getNumTiles(o);return this.wrapHorizontal&&(b.x+=y.x*Math.floor(l.x),T.x+=y.x*Math.floor(u.x)),this.wrapVertical&&(b.y+=y.y*Math.floor(l.y/m),T.y+=y.y*Math.floor(u.y/m)),{topLeft:b,bottomRight:T}},_updateLevel:function(o,l,u,c,h,f,p,m){var b=f.getBoundingBox().getTopLeft(),T=f.getBoundingBox().getBottomRight();this.viewer&&this.viewer.raiseEvent("update-level",{tiledImage:this,havedrawn:o,level:u,opacity:c,visibility:h,drawArea:f,topleft:b,bottomright:T,currenttime:p,best:m}),this._resetCoverage(this.coverage,u),this._resetCoverage(this.loadingCoverage,u);var y=this._getCornerTiles(u,b,T),w=y.topLeft,S=y.bottomRight,C=this.source.getNumTiles(u),L=this.viewport.pixelFromPoint(this.viewport.getCenter());this.getFlip()&&(S.x+=1,this.wrapHorizontal||(S.x=Math.min(S.x,C.x-1)));for(var D=w.x;D<=S.x;D++)for(var j=w.y;j<=S.y;j++){var N;if(this.getFlip()){var K=(C.x+D%C.x)%C.x;N=D+C.x-K-K-1}else N=D;f.intersection(this.getTileBounds(u,N,j))!==null&&(m=this._updateTile(l,o,N,j,u,c,h,L,C,p,m))}return m},_updateTile:function(o,l,u,c,h,f,p,m,b,T,y){var w=this._getTile(u,c,h,T,b,this._worldWidthCurrent,this._worldHeightCurrent),S=l;this.viewer&&this.viewer.raiseEvent("update-tile",{tiledImage:this,tile:w}),this._setCoverage(this.coverage,h,u,c,!1);var C=w.loaded||w.loading||this._isCovered(this.loadingCoverage,h,u,c);if(this._setCoverage(this.loadingCoverage,h,u,c,C),!w.exists||(o&&!S&&(this._isCovered(this.coverage,h,u,c)?this._setCoverage(this.coverage,h,u,c,!0):S=!0),!S))return y;if(this._positionTile(w,this.source.tileOverlap,this.viewport,m,p),!w.loaded)if(w.context2D)this._setTileLoaded(w);else{var L=this._tileCache.getImageRecord(w.cacheKey);L&&this._setTileLoaded(w,L.getData())}if(w.loaded){var D=this._blendTile(w,u,c,h,f,T);D&&(this._needsDraw=!0)}else w.loading?this._tilesLoading++:C||(y=this._compareTiles(y,w));return y},_getTile:function(o,l,u,c,h,f,p){var m,b,T,y,w,S,C,L,D,j,N=this.tilesMatrix,K=this.source;return N[u]||(N[u]={}),N[u][o]||(N[u][o]={}),(!N[u][o][l]||!N[u][o][l].flipped!=!this.flipped)&&(m=(h.x+o%h.x)%h.x,b=(h.y+l%h.y)%h.y,T=this.getTileBounds(u,o,l),y=K.getTileBounds(u,m,b,!0),w=K.tileExists(u,m,b),S=K.getTileUrl(u,m,b),C=K.getTilePostData(u,m,b),this.loadTilesWithAjax?(L=K.getTileAjaxHeaders(u,m,b),e.isPlainObject(this.ajaxHeaders)&&(L=e.extend({},this.ajaxHeaders,L))):L=null,D=K.getContext2D?K.getContext2D(u,m,b):void 0,j=new e.Tile(u,o,l,T,w,S,D,this.loadTilesWithAjax,L,y,C,K.getTileHashKey(u,m,b,S,L,C)),this.getFlip()?m===0&&(j.isRightMost=!0):m===h.x-1&&(j.isRightMost=!0),b===h.y-1&&(j.isBottomMost=!0),j.flipped=this.flipped,N[u][o][l]=j),j=N[u][o][l],j.lastTouchTime=c,j},_loadTile:function(o,l){var u=this;o.loading=!0,this._imageLoader.addJob({src:o.getUrl(),tile:o,source:this.source,postData:o.postData,loadWithAjax:o.loadWithAjax,ajaxHeaders:o.ajaxHeaders,crossOriginPolicy:this.crossOriginPolicy,ajaxWithCredentials:this.ajaxWithCredentials,callback:function(c,h,f){u._onTileLoad(o,l,c,h,f)},abort:function(){o.loading=!1}})},_onTileLoad:function(o,l,u,c,h){if(!u){e.console.error("Tile %s failed to load: %s - error: %s",o,o.getUrl(),c),this.viewer.raiseEvent("tile-load-failed",{tile:o,tiledImage:this,time:l,message:c,tileRequest:h}),o.loading=!1,o.exists=!1;return}if(lo.visibility||l.visibility===o.visibility&&l.squaredDistance1&&p>this.smoothTileEdgesMinZoom&&!this.iOSDevice&&this.getRotation(!0)%360===0&&e.supportsCanvas&&this.viewer.useCanvas&&(u=!0,c=l.getScaleForEdgeSmoothing(),h=l.getTranslationForEdgeSmoothing(c,this._drawer.getCanvasSize(!1),this._drawer.getCanvasSize(!0)));var m;u&&(c||(m=this.viewport.viewportToViewerElementRectangle(this.getClippedBounds(!0)).getIntegerBoundingBox(),this._drawer.viewer.viewport.getFlip()&&(this.viewport.getRotation(!0)%360!==0||this.getRotation(!0)%360!==0)&&(m.x=this._drawer.viewer.container.clientWidth-(m.x+m.width)),m=m.times(e.pixelDensityRatio)),this._drawer._clear(!0,m)),c||(this.viewport.getRotation(!0)%360!==0&&this._drawer._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:u}),this.getRotation(!0)%360!==0&&this._drawer._offsetForRotation({degrees:this.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(!0),!0),useSketch:u}),this.viewport.getRotation(!0)%360===0&&this.getRotation(!0)%360===0&&this._drawer.viewer.viewport.getFlip()&&this._drawer._flip());var b=!1;if(this._clip){this._drawer.saveContext(u);var T=this.imageToViewportRectangle(this._clip,!0);T=T.rotate(-this.getRotation(!0),this._getRotationPoint(!0));var y=this._drawer.viewportToDrawerRectangle(T);c&&(y=y.times(c)),h&&(y=y.translate(h)),this._drawer.setClip(y,u),b=!0}if(this._croppingPolygons){var w=this;this._drawer.saveContext(u);try{var S=this._croppingPolygons.map(function(se){return se.map(function(ue){var Se=w.imageToViewportCoordinates(ue.x,ue.y,!0).rotate(-w.getRotation(!0),w._getRotationPoint(!0)),Re=w._drawer.viewportCoordToDrawerCoord(Se);return c&&(Re=Re.times(c)),Re})});this._drawer.clipWithPolygons(S,u)}catch(se){e.console.error(se)}b=!0}if(this.placeholderFillStyle&&this._hasOpaqueTile===!1){var C=this._drawer.viewportToDrawerRectangle(this.getBounds(!0));c&&(C=C.times(c)),h&&(C=C.translate(h));var L=null;typeof this.placeholderFillStyle=="function"?L=this.placeholderFillStyle(this,this._drawer.context):L=this.placeholderFillStyle,this._drawer.drawRectangle(C,L,u)}var D=a(this.subPixelRoundingForTransparency),j=!1;if(D===e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS)j=!0;else if(D===e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST){var N=this.viewer&&this.viewer.isAnimating();j=!N}for(var K=o.length-1;K>=0;K--)l=o[K],this._drawer.drawTile(l,this._drawingHandler,u,c,h,j,this.source),l.beingDrawn=!0,this.viewer&&this.viewer.raiseEvent("tile-drawn",{tiledImage:this,tile:l});b&&this._drawer.restoreContext(u),c||(this.getRotation(!0)%360!==0&&this._drawer._restoreRotationChanges(u),this.viewport.getRotation(!0)%360!==0&&this._drawer._restoreRotationChanges(u)),u&&(c&&(this.viewport.getRotation(!0)%360!==0&&this._drawer._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:!1}),this.getRotation(!0)%360!==0&&this._drawer._offsetForRotation({degrees:this.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(!0),!0),useSketch:!1})),this._drawer.blendSketch({opacity:this.opacity,scale:c,translate:h,compositeOperation:this.compositeOperation,bounds:m}),c&&(this.getRotation(!0)%360!==0&&this._drawer._restoreRotationChanges(!1),this.viewport.getRotation(!0)%360!==0&&this._drawer._restoreRotationChanges(!1))),c||this.viewport.getRotation(!0)%360===0&&this.getRotation(!0)%360===0&&this._drawer.viewer.viewport.getFlip()&&this._drawer._flip(),this._drawDebugInfo(o)}},_drawDebugInfo:function(o){if(this.debugMode)for(var l=o.length-1;l>=0;l--){var u=o[l];try{this._drawer.drawDebugInfo(u,o.length,l,this)}catch(c){e.console.error(c)}}},_providesCoverage:function(o,l,u,c){var h,f,p,m;if(!o[l])return!1;if(u===void 0||c===void 0){h=o[l];for(p in h)if(Object.prototype.hasOwnProperty.call(h,p)){f=h[p];for(m in f)if(Object.prototype.hasOwnProperty.call(f,m)&&!f[m])return!1}return!0}return o[l][u]===void 0||o[l][u][c]===void 0||o[l][u][c]===!0},_isCovered:function(o,l,u,c){return u===void 0||c===void 0?this._providesCoverage(o,l+1):this._providesCoverage(o,l+1,2*u,2*c)&&this._providesCoverage(o,l+1,2*u,2*c+1)&&this._providesCoverage(o,l+1,2*u+1,2*c)&&this._providesCoverage(o,l+1,2*u+1,2*c+1)},_setCoverage:function(o,l,u,c,h){if(!o[l]){e.console.warn("Setting coverage for a tile before its level's coverage has been reset: %s",l);return}o[l][u]||(o[l][u]={}),o[l][u][c]=h},_resetCoverage:function(o,l){o[l]={}}});var n=e.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER;function r(o){return o!==e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS&&o!==e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST&&o!==e.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER}function s(o){return r(o)?n:o}function a(o){if(typeof o=="number")return s(o);if(!o||!e.Browser)return n;var l=o[e.Browser.vendor];return r(l)&&(l=o["*"]),s(l)}}(i),function(e){var n=function(s){e.console.assert(s,"[TileCache.cacheTile] options is required"),e.console.assert(s.tile,"[TileCache.cacheTile] options.tile is required"),e.console.assert(s.tiledImage,"[TileCache.cacheTile] options.tiledImage is required"),this.tile=s.tile,this.tiledImage=s.tiledImage},r=function(s){e.console.assert(s,"[ImageRecord] options is required"),e.console.assert(s.data,"[ImageRecord] options.data is required"),this._tiles=[],s.create.apply(null,[this,s.data,s.ownerTile]),this._destroyImplementation=s.destroy.bind(null,this),this.getImage=s.getImage.bind(null,this),this.getData=s.getData.bind(null,this),this.getRenderedContext=s.getRenderedContext.bind(null,this)};r.prototype={destroy:function(){this._destroyImplementation(),this._tiles=null},addTile:function(s){e.console.assert(s,"[ImageRecord.addTile] tile is required"),this._tiles.push(s)},removeTile:function(s){for(var a=0;athis._maxImageCacheCount){for(var u=null,c=-1,h=null,f,p,m,b,T,y,w=this._tilesLoaded.length-1;w>=0;w--)if(y=this._tilesLoaded[w],f=y.tile,!(f.level<=a||f.beingDrawn)){if(!u){u=f,c=w,h=y;continue}b=f.lastTouchTime,p=u.lastTouchTime,T=f.level,m=u.level,(bm)&&(u=f,c=w,h=y)}u&&c>=0&&(this._unloadTile(h),o=c)}this._tilesLoaded[o]=new n({tile:s.tile,tiledImage:s.tiledImage})},clearTilesFor:function(s){e.console.assert(s,"[TileCache.clearTilesFor] tiledImage is required");for(var a,o=0;o=this._items.length)throw new Error("Index bigger than number of layers.");r===s||s===-1||(this._items.splice(s,1),this._items.splice(r,0,n),this._needsDraw=!0,this.raiseEvent("item-index-change",{item:n,previousIndex:s,newIndex:r}))},removeItem:function(n){e.console.assert(n,"[World.removeItem] item is required");var r=e.indexOf(this._items,n);r!==-1&&(n.removeHandler("bounds-change",this._delegatedFigureSizes),n.removeHandler("clip-change",this._delegatedFigureSizes),n.destroy(),this._items.splice(r,1),this._figureSizes(),this._needsDraw=!0,this._raiseRemoveItem(n))},removeAll:function(){this.viewer._cancelPendingImages();var n,r;for(r=0;rb.height?T=l:T=l*(b.width/b.height),y=T*(b.height/b.width),w=new e.Point(f+(l-T)/2,p+(l-y)/2),m.setPosition(w,r),m.setWidth(T,r),s==="horizontal"?f+=c:p+=c;this.setAutoRefigureSizes(!0)},_figureSizes:function(){var n=this._homeBounds?this._homeBounds.clone():null,r=this._contentSize?this._contentSize.clone():null,s=this._contentFactor||0;if(!this._items.length)this._homeBounds=new e.Rect(0,0,1,1),this._contentSize=new e.Point(1,1),this._contentFactor=1;else{var a=this._items[0],o=a.getBounds();this._contentFactor=a.getContentSize().x/o.width;for(var l=a.getClippedBounds().getBoundingBox(),u=l.x,c=l.y,h=l.x+l.width,f=l.y+l.height,p=1;p{i.value=AS({id:"osdViewer",prefixUrl:"https://cdn.jsdelivr.net/gh/Benomrans/openseadragon-icons@main/images/",sequenceMode:!1,showRotationControl:!0,tileSources:[],defaultZoomLevel:.8,minZoomLevel:.2})}),gu(()=>{e.currentImage!=null&&Je.get(e.currentImage.info).then(n=>{i.value.open(n.data)})}),(n,r)=>(ie(),le("div",{id:"osdViewer",class:q(n.$style.viewer)},null,2))}},[["__cssModules",{$style:{viewer:"liv_viewer__viewer"}}]]),DS=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),MS=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),NS=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),LS=/[^\p{L}\d]+/giu,pd="$1\0$2",md="";function gd(t){let i=t.trim();i=i.replace(DS,pd).replace(MS,pd),i=i.replace(LS,"\0");let e=0,n=i.length;for(;i.charAt(e)==="\0";)e++;if(e===n)return[];for(;i.charAt(n-1)==="\0";)n--;return i.slice(e,n).split(/\0/g)}function FS(t){const i=gd(t);for(let e=0;eu===0?o(l):s(l)).join((i==null?void 0:i.delimiter)??" ")+r}function zS(t){return t===!1?i=>i.toLowerCase():i=>i.toLocaleLowerCase(t)}function HS(t){return t===!1?i=>i.toUpperCase():i=>i.toLocaleUpperCase(t)}function BS(t,i){return e=>`${i(e[0])}${t(e.slice(1))}`}function US(t,i={}){const e=i.split??(i.separateNumbers?FS:gd),n=i.prefixCharacters??md,r=i.suffixCharacters??md;let s=0,a=t.length;for(;ss;){const o=a-1,l=t.charAt(o);if(!r.includes(l))break;a=o}return[t.slice(0,s),e(t.slice(s,a)),t.slice(a)]}function Zs(t){return Lr()?(uo(t),!0):!1}function gt(t){return typeof t=="function"?t():k(t)}const Ys=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const VS=t=>t!=null,jS=Object.prototype.toString,WS=t=>jS.call(t)==="[object Object]",Ct=()=>{},GS=qS();function qS(){var t,i;return Ys&&((t=window==null?void 0:window.navigator)==null?void 0:t.userAgent)&&(/iP(ad|hone|od)/.test(window.navigator.userAgent)||((i=window==null?void 0:window.navigator)==null?void 0:i.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function yd(t,i){function e(...n){return new Promise((r,s)=>{Promise.resolve(t(()=>i.apply(this,n),{fn:i,thisArg:this,args:n})).then(r).catch(s)})}return e}function KS(t,i={}){let e,n,r=Ct;const s=o=>{clearTimeout(o),r(),r=Ct};return o=>{const l=gt(t),u=gt(i.maxWait);return e&&s(e),l<=0||u!==void 0&&u<=0?(n&&(s(n),n=null),Promise.resolve(o())):new Promise((c,h)=>{r=i.rejectOnCancel?h:c,u&&!n&&(n=setTimeout(()=>{e&&s(e),n=null,c(o())},u)),e=setTimeout(()=>{n&&s(n),n=null,c(o())},l)})}}function ZS(t,i=!0,e=!0,n=!1){let r=0,s,a=!0,o=Ct,l;const u=()=>{s&&(clearTimeout(s),s=void 0,o(),o=Ct)};return h=>{const f=gt(t),p=Date.now()-r,m=()=>l=h();return u(),f<=0?(r=Date.now(),m()):(p>f&&(e||!a)?(r=Date.now(),m()):i&&(l=new Promise((b,T)=>{o=n?T:b,s=setTimeout(()=>{r=Date.now(),a=!0,b(m()),u()},Math.max(0,f-p))})),!e&&!s&&(s=setTimeout(()=>a=!0,f)),a=!1,l)}}function YS(t){let i;function e(){return i||(i=t()),i}return e.reset=async()=>{const n=i;i=void 0,n&&await n},e}function XS(t){return t||rs()}function JS(t,i=200,e={}){return yd(KS(i,e),t)}function QS(t,i=200,e=!1,n=!0,r=!1){return yd(ZS(i,e,n,r),t)}function $S(t,i=!0,e){XS()?oi(t,e):i?t():Fn(t)}function eE(t,i,e={}){const{immediate:n=!0}=e,r=$(!1);let s=null;function a(){s&&(clearTimeout(s),s=null)}function o(){r.value=!1,a()}function l(...u){a(),r.value=!0,s=setTimeout(()=>{r.value=!1,s=null,t(...u)},gt(i))}return n&&(r.value=!0,Ys&&l()),Zs(o),{isPending:bo(r),start:l,stop:o}}function ti(t){var i;const e=gt(t);return(i=e==null?void 0:e.$el)!=null?i:e}const An=Ys?window:void 0,bd=Ys?window.navigator:void 0;function rn(...t){let i,e,n,r;if(typeof t[0]=="string"||Array.isArray(t[0])?([e,n,r]=t,i=An):[i,e,n,r]=t,!i)return Ct;Array.isArray(e)||(e=[e]),Array.isArray(n)||(n=[n]);const s=[],a=()=>{s.forEach(c=>c()),s.length=0},o=(c,h,f,p)=>(c.addEventListener(h,f,p),()=>c.removeEventListener(h,f,p)),l=$e(()=>[ti(i),gt(r)],([c,h])=>{if(a(),!c)return;const f=WS(h)?{...h}:h;s.push(...e.flatMap(p=>n.map(m=>o(c,p,m,f))))},{immediate:!0,flush:"post"}),u=()=>{l(),a()};return Zs(u),u}let wd=!1;function tE(t,i,e={}){const{window:n=An,ignore:r=[],capture:s=!0,detectIframe:a=!1}=e;if(!n)return Ct;GS&&!wd&&(wd=!0,Array.from(n.document.body.children).forEach(f=>f.addEventListener("click",Ct)),n.document.documentElement.addEventListener("click",Ct));let o=!0;const l=f=>r.some(p=>{if(typeof p=="string")return Array.from(n.document.querySelectorAll(p)).some(m=>m===f.target||f.composedPath().includes(m));{const m=ti(p);return m&&(f.target===m||f.composedPath().includes(m))}}),c=[rn(n,"click",f=>{const p=ti(t);if(!(!p||p===f.target||f.composedPath().includes(p))){if(f.detail===0&&(o=!l(f)),!o){o=!0;return}i(f)}},{passive:!0,capture:s}),rn(n,"pointerdown",f=>{const p=ti(t);o=!l(f)&&!!(p&&!f.composedPath().includes(p))},{passive:!0}),a&&rn(n,"blur",f=>{setTimeout(()=>{var p;const m=ti(t);((p=n.document.activeElement)==null?void 0:p.tagName)==="IFRAME"&&!(m!=null&&m.contains(n.document.activeElement))&&i(f)},0)})].filter(Boolean);return()=>c.forEach(f=>f())}function iE(){const t=$(!1);return rs()&&oi(()=>{t.value=!0}),t}function Xs(t){const i=iE();return Y(()=>(i.value,!!t()))}function _d(t,i={}){const{controls:e=!1,navigator:n=bd}=i,r=Xs(()=>n&&"permissions"in n);let s;const a=typeof t=="string"?{name:t}:t,o=$(),l=()=>{s&&(o.value=s.state)},u=YS(async()=>{if(r.value){if(!s)try{s=await n.permissions.query(a),rn(s,"change",l),l()}catch{o.value="prompt"}return s}});return u(),e?{state:o,isSupported:r,query:u}:o}function nE(t={}){const{navigator:i=bd,read:e=!1,source:n,copiedDuring:r=1500,legacy:s=!1}=t,a=Xs(()=>i&&"clipboard"in i),o=_d("clipboard-read"),l=_d("clipboard-write"),u=Y(()=>a.value||s),c=$(""),h=$(!1),f=eE(()=>h.value=!1,r);function p(){a.value&&o.value!=="denied"?i.clipboard.readText().then(y=>{c.value=y}):c.value=T()}u.value&&e&&rn(["copy","cut"],p);async function m(y=gt(n)){u.value&&y!=null&&(a.value&&l.value!=="denied"?await i.clipboard.writeText(y):b(y),c.value=y,h.value=!0,f.start())}function b(y){const w=document.createElement("textarea");w.value=y??"",w.style.position="absolute",w.style.opacity="0",document.body.appendChild(w),w.select(),document.execCommand("copy"),w.remove()}function T(){var y,w,S;return(S=(w=(y=document==null?void 0:document.getSelection)==null?void 0:y.call(document))==null?void 0:w.toString())!=null?S:""}return{isSupported:u,text:c,copied:h,copy:m}}function rE(t,i,e={}){const{window:n=An,...r}=e;let s;const a=Xs(()=>n&&"ResizeObserver"in n),o=()=>{s&&(s.disconnect(),s=void 0)},l=Y(()=>Array.isArray(t)?t.map(h=>ti(h)):[ti(t)]),u=$e(l,h=>{if(o(),a.value&&n){s=new ResizeObserver(i);for(const f of h)f&&s.observe(f,r)}},{immediate:!0,flush:"post",deep:!0}),c=()=>{o(),u()};return Zs(c),{isSupported:a,stop:c}}function sE(t,i,e={}){const{root:n,rootMargin:r="0px",threshold:s=.1,window:a=An,immediate:o=!0}=e,l=Xs(()=>a&&"IntersectionObserver"in a),u=Y(()=>{const m=gt(t);return(Array.isArray(m)?m:[m]).map(ti).filter(VS)});let c=Ct;const h=$(o),f=l.value?$e(()=>[u.value,ti(n),h.value],([m,b])=>{if(c(),!h.value||!m.length)return;const T=new IntersectionObserver(i,{root:ti(b),rootMargin:r,threshold:s});m.forEach(y=>y&&T.observe(y)),c=()=>{T.disconnect(),c=Ct}},{immediate:o,flush:"post"}):Ct,p=()=>{c(),f(),h.value=!1};return Zs(p),{isSupported:l,isActive:h,pause(){c(),h.value=!1},resume(){h.value=!0},stop:p}}function oE(t,i={}){const{window:e=An,scrollTarget:n}=i,r=$(!1);return sE(t,s=>{let a=r.value,o=0;for(const l of s)l.time>=o&&(o=l.time,a=l.isIntersecting);r.value=a},{root:n,window:e,threshold:0}),r}const Td=1;function aE(t,i={}){const{throttle:e=0,idle:n=200,onStop:r=Ct,onScroll:s=Ct,offset:a={left:0,right:0,top:0,bottom:0},eventListenerOptions:o={capture:!1,passive:!0},behavior:l="auto",window:u=An}=i,c=$(0),h=$(0),f=Y({get(){return c.value},set(D){m(D,void 0)}}),p=Y({get(){return h.value},set(D){m(void 0,D)}});function m(D,j){var N,K,se;if(!u)return;const ue=gt(t);ue&&((se=ue instanceof Document?u.document.body:ue)==null||se.scrollTo({top:(N=gt(j))!=null?N:p.value,left:(K=gt(D))!=null?K:f.value,behavior:gt(l)}))}const b=$(!1),T=Kt({left:!0,right:!1,top:!0,bottom:!1}),y=Kt({left:!1,right:!1,top:!1,bottom:!1}),w=D=>{b.value&&(b.value=!1,y.left=!1,y.right=!1,y.top=!1,y.bottom=!1,r(D))},S=JS(w,e+n),C=D=>{var j;if(!u)return;const N=D.document?D.document.documentElement:(j=D.documentElement)!=null?j:D,{display:K,flexDirection:se}=getComputedStyle(N),ue=N.scrollLeft;y.left=uec.value;const Se=Math.abs(ue)<=0+(a.left||0),Re=Math.abs(ue)+N.clientWidth>=N.scrollWidth-(a.right||0)-Td;K==="flex"&&se==="row-reverse"?(T.left=Re,T.right=Se):(T.left=Se,T.right=Re),c.value=ue;let Ee=N.scrollTop;D===u.document&&!Ee&&(Ee=u.document.body.scrollTop),y.top=Eeh.value;const Me=Math.abs(Ee)<=0+(a.top||0),ge=Math.abs(Ee)+N.clientHeight>=N.scrollHeight-(a.bottom||0)-Td;K==="flex"&&se==="column-reverse"?(T.top=ge,T.bottom=Me):(T.top=Me,T.bottom=ge),h.value=Ee},L=D=>{var j;if(!u)return;const N=(j=D.target.documentElement)!=null?j:D.target;C(N),b.value=!0,S(D),s(D)};return rn(t,"scroll",e?QS(L,e,!0,!1):L,o),$S(()=>{const D=gt(t);D&&C(D)}),rn(t,"scrollend",w,o),{x:f,y:p,isScrolling:b,arrivedState:T,directions:y,measure(){const D=gt(t);u&&D&&C(D)}}}function lE(t){return typeof Window<"u"&&t instanceof Window?t.document.documentElement:typeof Document<"u"&&t instanceof Document?t.documentElement:t}function xd(t,i,e={}){var n;const{direction:r="bottom",interval:s=100,canLoadMore:a=()=>!0}=e,o=Kt(aE(t,{...e,offset:{[r]:(n=e.distance)!=null?n:0,...e.offset}})),l=$(),u=Y(()=>!!l.value),c=Y(()=>lE(gt(t))),h=oE(c);function f(){if(o.measure(),!c.value||!h.value||!a(c.value))return;const{scrollHeight:p,clientHeight:m,scrollWidth:b,clientWidth:T}=c.value,y=r==="bottom"||r==="top"?p<=m:b<=T;(o.arrivedState[r]||y)&&(l.value||(l.value=Promise.all([i(o),new Promise(w=>setTimeout(w,s))]).finally(()=>{l.value=null,Fn(()=>f())})))}return $e(()=>[o.arrivedState[r],h.value],f,{immediate:!0}),{isLoading:u}}const uE={main:"liv_copyable__main",button:"liv_copyable__button"},cE={key:0},Sd=nn({__name:"Copyable",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(t){const i=Qu(t,"modelValue"),{text:e,copy:n,copied:r,isSupported:s}=nE({model:i,legacy:!0});return(a,o)=>(ie(),le("div",{class:q(a.$style.main)},[ee("div",{class:q(a.$style.body)},[Ei(a.$slots,"default",{},()=>[mt(Oe(i.value),1)])],2),k(s)?(ie(),le("div",cE,[be(k(Vt),{size:"sm",onClick:o[0]||(o[0]=l=>k(n)(i.value))},{default:ut(()=>[ee("i",{class:q(["fas",k(r)?"fa-check":"fa-clipboard"])},null,2)]),_:1})])):qe("",!0)],2))}},[["__cssModules",{$style:uE}]]),hE={overlay:"liv_overlay__overlay",main:"liv_overlay__main",close:"liv_overlay__close",closed:"liv_overlay__closed",record:"liv_overlay__record",header:"liv_overlay__header",title:"liv_overlay__title",subtitle:"liv_overlay__subtitle",fieldToggle:"liv_overlay__fieldToggle",recordLinks:"liv_overlay__recordLinks",recordLink:"liv_overlay__recordLink",shareBtn:"liv_overlay__shareBtn",manifestBtn:"liv_overlay__manifestBtn",shareLinks:"liv_overlay__shareLinks",dataBlock:"liv_overlay__dataBlock"},fE=["href"],dE=["action"],pE=ee("i",{class:"fas fa-download"},null,-1),mE=ee("span",{class:"sr-only"},"Download image",-1),gE=ee("i",{class:"fas fa-share-alt"},null,-1),vE=ee("span",{class:"sr-only"},"Share",-1),yE=ee("span",null,"Record",-1),bE=["href"],wE=ee("span",null,"Image",-1),_E=["href"],TE=["href"],xE=[ee("img",{src:"/images/iiif.png",alt:"IIIF Manifest"},null,-1)],SE=ee("h3",null,"Record",-1),EE=ee("h3",null,"Image",-1),PE=ee("dt",null,"URL",-1),RE=["href"],CE=["href"],OE=nn({__name:"Overlay",setup(t){const i=zi(),{showOverlay:e,currentRecord:n,currentImage:r}=_g(i),s=$(!0),a=$(!1),o=$(null),l=Y(()=>c(n.value?n.value.imageViewerUrl:"")),u=Y(()=>c(r.value?r.value.imageViewerUrl:""));function c(h){return[window.location.origin,h].join("")}return tE(o,()=>{e.value&&(e.value=!1)}),$e(e,()=>{e.value?s.value=!1:setTimeout(()=>{s.value=!0},350)}),(h,f)=>(ie(),le(De,null,[ee("div",{class:q([h.$style.overlay,h.$style.main]),style:qt({top:k(e)?"20%":"100%"}),ref_key:"container",ref:o},[be(k(Vt),{size:"sm",onClick:f[0]||(f[0]=p=>e.value=!1),class:q(h.$style.close)},{default:ut(()=>[mt("close ")]),_:1},8,["class"]),xt(be(kS,null,null,512),[[us,k(e)]]),k(e)&&(k(n)||k(r))?(ie(),le("div",{key:0,class:q(h.$style.record)},[ee("div",{class:q(h.$style.header)},[ee("h2",{class:q(h.$style.title)},Oe(k(n)?k(n).title:k(r).name),3),k(n)?(ie(),le(De,{key:0},[ee("span",{class:q(h.$style.subtitle)},Oe(k(n).subtitle),3),ee("div",{class:q(h.$style.recordLinks)},[k(n)&&k(n).url?(ie(),le("a",{key:0,href:k(n).url,class:q(h.$style.recordLink)},"View record",10,fE)):qe("",!0),ee("form",{method:"get",action:`${k(r).url}/original`},[be(k(Vt),{size:"sm"},{default:ut(()=>[pE,mE]),_:1})],8,dE),be(k(TS),{header:"Sharing links","button-args":{size:"sm"}},{button:ut(()=>[gE,vE]),default:ut(()=>[ee("div",{class:q(h.$style.shareLinks)},[yE,be(Sd,{modelValue:l.value,"onUpdate:modelValue":f[1]||(f[1]=p=>l.value=p)},{default:ut(()=>[ee("a",{href:k(n).imageViewerUrl},Oe(l.value),9,bE)]),_:1},8,["modelValue"]),wE,be(Sd,{modelValue:u.value,"onUpdate:modelValue":f[2]||(f[2]=p=>u.value=p)},{default:ut(()=>[ee("a",{href:k(r).imageViewerUrl},Oe(u.value),9,_E)]),_:1},8,["modelValue"])],2)]),_:1}),ee("a",{target:"_blank",href:k(n).manifest,class:q(h.$style.manifestBtn)},xE,10,TE)],2)],64)):qe("",!0)],2),ee("div",{class:q(h.$style.fieldToggle)},[be(k(st),{"zoa-type":"checkbox",modelValue:a.value,"onUpdate:modelValue":f[3]||(f[3]=p=>a.value=p),label:"Use original field names","label-position":"left"},null,8,["modelValue"])],2),k(n)?(ie(),le("div",{key:0,class:q(h.$style.dataBlock)},[SE,ee("dl",null,[(ie(!0),le(De,null,yt(k(n).displayData,p=>(ie(),le(De,null,[ee("dt",null,Oe(a.value?p.key:k(vd)(p.key)),1),ee("dd",null,Oe(p.value),1)],64))),256))])],2)):qe("",!0),k(r)?(ie(),le("div",{key:1,class:q(h.$style.dataBlock)},[EE,ee("dl",null,[PE,ee("dd",null,[ee("a",{href:k(r).url},Oe(k(r).url),9,RE)]),(ie(!0),le(De,null,yt(k(r).displayData,p=>(ie(),le(De,null,[ee("dt",null,Oe(a.value?p.key:k(vd)(p.key)),1),ee("dd",null,[p.value.toString().startsWith("http")?(ie(),le("a",{key:0,href:p.value},Oe(p.value),9,CE)):(ie(),le(De,{key:1},[mt(Oe(p.value),1)],64))])],64))),256))])],2)):qe("",!0)],2)):qe("",!0)],6),s.value?(ie(),le("div",{key:0,class:q([h.$style.overlay,h.$style.closed])},[be(k(Vt),{size:"sm",onClick:f[4]||(f[4]=p=>e.value=!0),class:q(h.$style.open)},{default:ut(()=>[mt("open viewer ")]),_:1},8,["class"])],2)):qe("",!0)],64))}},[["__cssModules",{$style:hE}]]),IE={class:"container"},AE=ee("h1",null,"Image viewer",-1),kE={__name:"App",setup(t){const i=zi();return oi(i.getAllResources),(e,n)=>{const r=jp("router-view");return ie(),le("div",IE,[AE,be(OE),be(r)])}}},DE=mg().use(xv()),Er=hg(kE);Er.config.performance=!0,Er.component("fa-icon",Ub),Er.use(DE),Er.use(OS),Er.mount("#liv-app");function ME(t){t=t.replace(/_/g,"-"),t=t.replace(/[.:][\w-]*$/,"");try{return new Intl.Locale(t).baseName}catch{return"en-US"}}var NE=ME;const LE=NE;let Pr;if(typeof navigator<"u"){const t=navigator;Pr=Array.isArray(t.languages)?t.languages[0]:t.language}else if(typeof process<"u"){const t={GITHUB_STATE:"/home/runner/work/_temp/_runner_file_commands/save_state_153acb89-c152-4f4d-b3b1-6467bca6c856",STATS_TRP:"true",DEPLOYMENT_BASEPATH:"/opt/runner",DOTNET_NOLOGO:"1",USER:"runner",npm_config_user_agent:"npm/8.19.4 node/v16.20.2 linux x64 workspaces/false ci/github-actions",CI:"true",RUNNER_ENVIRONMENT:"github-hosted",GITHUB_ENV:"/home/runner/work/_temp/_runner_file_commands/set_env_153acb89-c152-4f4d-b3b1-6467bca6c856",PIPX_HOME:"/opt/pipx",npm_node_execpath:"/opt/hostedtoolcache/node/16.20.2/x64/bin/node",JAVA_HOME_8_X64:"/usr/lib/jvm/temurin-8-jdk-amd64",SHLVL:"1",npm_config_noproxy:"",HOME:"/home/runner",RUNNER_TEMP:"/home/runner/work/_temp",GITHUB_EVENT_PATH:"/home/runner/work/_temp/_github_workflow/event.json",npm_package_json:"/home/runner/work/zoa/zoa/package.json",JAVA_HOME_11_X64:"/usr/lib/jvm/temurin-11-jdk-amd64",PIPX_BIN_DIR:"/opt/pipx_bin",GITHUB_REPOSITORY_OWNER:"NaturalHistoryMuseum",GRADLE_HOME:"/usr/share/gradle-8.6",ANDROID_NDK_LATEST_HOME:"/usr/local/lib/android/sdk/ndk/26.2.11394342",JAVA_HOME_21_X64:"/usr/lib/jvm/temurin-21-jdk-amd64",STATS_RDCL:"true",GITHUB_RETENTION_DAYS:"90",GITHUB_REPOSITORY_OWNER_ID:"5260760",POWERSHELL_DISTRIBUTION_CHANNEL:"GitHub-Actions-ubuntu22",AZURE_EXTENSION_DIR:"/opt/az/azcliextensions",GITHUB_HEAD_REF:"",npm_config_userconfig:"/home/runner/.npmrc",npm_config_local_prefix:"/home/runner/work/zoa/zoa",SYSTEMD_EXEC_PID:"590",GITHUB_GRAPHQL_URL:"https://api.github.com/graphql",COLOR:"0",GOROOT_1_20_X64:"/opt/hostedtoolcache/go/1.20.14/x64",NVM_DIR:"/home/runner/.nvm",npm_config_metrics_registry:"https://registry.npmjs.org/",DOTNET_SKIP_FIRST_TIME_EXPERIENCE:"1",GOROOT_1_21_X64:"/opt/hostedtoolcache/go/1.21.7/x64",JAVA_HOME_17_X64:"/usr/lib/jvm/temurin-17-jdk-amd64",ImageVersion:"20240225.1.0",RUNNER_OS:"Linux",GITHUB_API_URL:"https://api.github.com",GOROOT_1_22_X64:"/opt/hostedtoolcache/go/1.22.0/x64",SWIFT_PATH:"/usr/share/swift/usr/bin",RUNNER_USER:"runner",STATS_V3PS:"true",CHROMEWEBDRIVER:"/usr/local/share/chromedriver-linux64",JOURNAL_STREAM:"8:1900",GITHUB_WORKFLOW:"Bump version",_:"/opt/hostedtoolcache/node/16.20.2/x64/bin/npm",npm_config_prefix:"/opt/hostedtoolcache/node/16.20.2/x64",ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE:"/opt/actionarchivecache",GITHUB_RUN_ID:"8154276901",npm_config_cache:"/home/runner/.npm",GITHUB_REF_TYPE:"branch",BOOTSTRAP_HASKELL_NONINTERACTIVE:"1",GITHUB_WORKFLOW_SHA:"31171e01c4ef6ee26a531892f61ee4c47b853953",GITHUB_BASE_REF:"",ImageOS:"ubuntu22",STATS_BLT:"true",GITHUB_WORKFLOW_REF:"NaturalHistoryMuseum/zoa/.github/workflows/bump.yml@refs/heads/main",PERFLOG_LOCATION_SETTING:"RUNNER_PERFLOG",GITHUB_ACTION_REPOSITORY:"",npm_config_node_gyp:"/opt/hostedtoolcache/node/16.20.2/x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",PATH:"/home/runner/work/zoa/zoa/node_modules/.bin:/home/runner/work/zoa/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/16.20.2/x64/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/opt/hostedtoolcache/node/16.20.2/x64/bin:/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",ANT_HOME:"/usr/share/ant",DOTNET_MULTILEVEL_LOOKUP:"0",RUNNER_TRACKING_ID:"github_3e812db5-5506-4146-8c04-c401635a73f2",INVOCATION_ID:"4832b2da6c0341a7aed099611ef2c802",RUNNER_TOOL_CACHE:"/opt/hostedtoolcache",NODE:"/opt/hostedtoolcache/node/16.20.2/x64/bin/node",npm_package_name:"@nhm-data/zoa",GITHUB_ACTION:"__run_2",GITHUB_RUN_NUMBER:"31",GITHUB_TRIGGERING_ACTOR:"alycejenni",RUNNER_ARCH:"X64",XDG_RUNTIME_DIR:"/run/user/1001",AGENT_TOOLSDIRECTORY:"/opt/hostedtoolcache",LANG:"C.UTF-8",VCPKG_INSTALLATION_ROOT:"/usr/local/share/vcpkg",CONDA:"/usr/share/miniconda",RUNNER_NAME:"GitHub Actions 2",XDG_CONFIG_HOME:"/home/runner/.config",STATS_VMD:"true",GITHUB_REF_NAME:"main",GITHUB_REPOSITORY:"NaturalHistoryMuseum/zoa",npm_lifecycle_script:"vite build",STATS_UE:"true",ANDROID_NDK_ROOT:"/usr/local/lib/android/sdk/ndk/25.2.9519653",GITHUB_ACTION_REF:"",DEBIAN_FRONTEND:"noninteractive",GITHUB_REPOSITORY_ID:"630464665",GITHUB_ACTIONS:"true",npm_package_version:"0.8.0",npm_lifecycle_event:"build",GITHUB_REF_PROTECTED:"false",GITHUB_WORKSPACE:"/home/runner/work/zoa/zoa",ACCEPT_EULA:"Y",GITHUB_JOB:"build-then-bump",RUNNER_PERFLOG:"/home/runner/perflog",GITHUB_SHA:"31171e01c4ef6ee26a531892f61ee4c47b853953",GITHUB_RUN_ATTEMPT:"1",GITHUB_REF:"refs/heads/main",GITHUB_ACTOR:"alycejenni",ANDROID_SDK_ROOT:"/usr/local/lib/android/sdk",LEIN_HOME:"/usr/local/lib/lein",npm_config_globalconfig:"/opt/hostedtoolcache/node/16.20.2/x64/etc/npmrc",npm_config_init_module:"/home/runner/.npm-init.js",GITHUB_PATH:"/home/runner/work/_temp/_runner_file_commands/add_path_153acb89-c152-4f4d-b3b1-6467bca6c856",JAVA_HOME:"/usr/lib/jvm/temurin-11-jdk-amd64",PWD:"/home/runner/work/zoa/zoa",GITHUB_ACTOR_ID:"23579762",RUNNER_WORKSPACE:"/home/runner/work/zoa",npm_execpath:"/opt/hostedtoolcache/node/16.20.2/x64/lib/node_modules/npm/bin/npm-cli.js",HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS:"3650",STATS_TIS:"mining",GITHUB_EVENT_NAME:"push",HOMEBREW_NO_AUTO_UPDATE:"1",ANDROID_HOME:"/usr/local/lib/android/sdk",GITHUB_SERVER_URL:"https://github.com",GECKOWEBDRIVER:"/usr/local/share/gecko_driver",LEIN_JAR:"/usr/local/lib/lein/self-installs/leiningen-2.11.2-standalone.jar",GHCUP_INSTALL_BASE_PREFIX:"/usr/local",GITHUB_OUTPUT:"/home/runner/work/_temp/_runner_file_commands/set_output_153acb89-c152-4f4d-b3b1-6467bca6c856",npm_config_global_prefix:"/opt/hostedtoolcache/node/16.20.2/x64",EDGEWEBDRIVER:"/usr/local/share/edge_driver",STATS_EXT:"true",npm_command:"run-script",ANDROID_NDK:"/usr/local/lib/android/sdk/ndk/25.2.9519653",SGX_AESM_ADDR:"1",CHROME_BIN:"/usr/bin/google-chrome",SELENIUM_JAR_PATH:"/usr/share/java/selenium-server.jar",STATS_EXTP:"https://provjobdsettingscdn.blob.core.windows.net/settings/provjobdsettings-0.5.154/provjobd.data",ANDROID_NDK_HOME:"/usr/local/lib/android/sdk/ndk/25.2.9519653",GITHUB_STEP_SUMMARY:"/home/runner/work/_temp/_runner_file_commands/step_summary_153acb89-c152-4f4d-b3b1-6467bca6c856",INIT_CWD:"/home/runner/work/zoa/zoa",EDITOR:"vi",NODE_ENV:"production"};Pr=t.LC_ALL||t.LC_MESSAGES||t.LANG||t.LANGUAGE}Pr||(Pr="en-US");var Js=LE(Pr);const Ed={};for(let t=1;t<100;t++){const i=(t<9?"0":"")+t;Ed[i]=t+(t>51?1900:2e3)}var FE=Ed,vl={"Eastern Daylight Time":-240,"Eastern Standard Time":-300,"Central Daylight Time":-300,"Central Standard Time":-360,"Mountain Daylight Time":-360,"Mountain Standard Time":-420,"Pacific Daylight Time":-420,"Pacific Standard Time":-480,ACDT:630,ACST:570,ACT:480,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,AMST:-180,AMT:-240,ART:-180,AST:180,AWDT:540,AWST:480,AZOST:-60,AZT:240,BDT:360,BIOT:360,BIT:-720,BOT:-240,BRST:-120,BRT:-180,BTT:360,CAT:120,CCT:390,CDT:-300,CEDT:120,CEST:120,CET:60,CHADT:825,CHAST:765,CHOT:480,ChST:600,CHUT:600,CIST:-480,CIT:480,CKT:-600,CLST:-180,CLT:-240,COST:-240,COT:-300,CST:-360,CT:480,CVT:-60,CXT:420,DAVT:420,DDUT:600,DFT:60,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEDT:180,EEST:180,EET:120,EGST:0,EGT:-60,EIT:540,EST:-300,FET:180,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GIT:-540,GMT:0,GST:-120,GYT:-240,HADT:-540,HAEC:120,HAST:-600,HKT:480,HMT:300,HOVT:420,HST:-600,IBST:0,ICT:420,IDT:180,IOT:180,IRDT:270,IRKT:480,IRST:210,IST:120,JST:540,KGT:360,KOST:660,KRAT:420,KST:540,LHST:630,LINT:840,MAGT:720,MART:-510,MAWT:300,MDT:-360,MET:60,MEST:120,MHT:720,MIST:660,MIT:-510,MMT:390,MSK:180,MST:-420,MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:660,NPT:345,NST:-150,NT:-150,NUT:-660,NZDT:780,NZST:720,OMST:360,ORAT:300,PDT:-420,PET:-300,PETT:720,PGT:600,PHOT:780,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PYST:-180,PYT:-240,RET:240,ROTT:-180,SAKT:660,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SLST:330,SRET:660,SRT:-180,SST:480,SYOT:180,TAHT:-600,THA:420,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TOT:780,TVT:720,UCT:0,ULAT:480,USZ1:120,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-240,VLAT:600,VOLT:240,VOST:360,VUT:660,WAKT:720,WAST:120,WAT:60,WEDT:60,WEST:60,WET:0,WIT:420,WST:480,YAKT:540,YEKT:300,Z:0},zE={zone:vl,year:FE,meridiem:{am:0,pm:12,"a.m.":0,"p.m.":12},month:{january:1,jan:1,february:2,feb:2,march:3,mar:3,april:4,apr:4,may:5,june:6,jun:6,july:7,jul:7,august:8,aug:8,september:9,sep:9,october:10,oct:10,november:11,nov:11,december:12,dec:12},dayname:{sunday:0,sun:0,monday:1,mon:1,tuesday:2,tue:2,wednesday:3,wed:3,thursday:4,thu:4,friday:5,fri:5,saturday:6,sat:6},digit:{}};const HE=vl,Pd={MONTHNAME:"january|february|march|april|may|june|july|august|september|october|november|december|jan\\.?|feb\\.?|mar\\.?|apr\\.?|may\\.?|jun\\.?|jul\\.?|aug\\.?|sep\\.?|oct\\.?|nov\\.?|dec\\.?",DAYNAME:"sunday|monday|tuesday|wednesday|thursday|friday|saturday|sun\\.?|mon\\.?|tue\\.?|wed\\.?|thu\\.?|fri\\.?|sat\\.?",ZONE:"\\(?("+Object.keys(HE).join("|")+")\\)?",MERIDIEM:"[ap]\\.?m?\\.?",ORDINAL:"st|nd|rd|th|\\.",YEAR:"[1-9]\\d{3}|\\d{2}",MONTH:"1[0-2]|0?[1-9]",MONTH2:"1[0-2]|0[1-9]",DAY:"3[01]|[12]\\d|0?[1-9]",DAY2:"3[01]|[12]\\d|0[1-9]",OFFSET:"[+-][01]?\\d?\\:?(?:[0-5]\\d)?",H24:"[01]\\d|2[0-3]",H12:"0?[1-9]|1[012]",MIN:"[0-5]\\d",SEC:"[0-5]\\d|60",MS:"\\d{9}|\\d{6}|\\d{1,3}",SPACE:"[\\s,-]"},BE={...Pd,YEAR:"*{4}|*{2}",MONTH:"*{1,2}",MONTH2:"*{2}",DAY:"*{1,2}",DAY2:"*{2}",OFFSET:"[+-]*{1,2}\\:?*{0,2}",H24:"*{2}",H12:"*{1,2}",MIN:"*{2}",SEC:"*{2}",MS:"*{9}|*{6}|*{3}"};var UE={latn:Pd,other:BE};const Rd={arab:1632,arabext:1776,bali:6992,beng:2534,deva:2406,fullwide:65296,gujr:2790,khmr:6112,knda:3302,laoo:3792,limb:6470,mlym:3430,mong:6160,mymr:4160,orya:2918,tamldec:3046,telu:3174,thai:3664,tibt:3872},Cd="[0123456789〇一二三四五六七八九\\d]",yl={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,"〇":0,一:1,二:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9},Qs={};function VE(t){if(Qs[t])return Qs[t];if(t==="fullwide"||t==="hanidec")return{group:Cd,lookup:{...yl}};const i=Rd[t];if(!i)return{group:"\\d",lookup:{...yl}};const e=String.fromCharCode(i),n=String.fromCharCode(i+9),r={};for(let s=0;s<10;s++)r[String.fromCharCode(i+s)]=s;return Qs[t]={group:`[${e}-${n}]`,lookup:r},Qs[t]}var Od={chineseGroup:Cd,defaultLookup:yl,startCodes:Rd,buildDigits:VE},jE=["year","month","day","hour","minute","second","millisecond"];const WE=zE,{latn:GE,other:bl}=UE,{buildDigits:qE}=Od,Id=Js,KE=jE,wl={};var Rr=class Ud{static factory(i=Id){return wl[i.toLowerCase()]||(wl[i.toLowerCase()]=new Ud(i)),wl[i.toLowerCase()]}constructor(i=Id){this.locale=i,this.lookups={...WE},this.vars={...GE};const e=new Intl.NumberFormat(this.locale);this.numberingSystem=e.resolvedOptions().numberingSystem,this.build()}toInt(i){if(typeof i=="number")return i;if(this.numberingSystem==="latn")return parseInt(i,10);let e="";for(let n=0;n{["","k","kuu","kuuta"].forEach((s,a)=>{const o=a<2?"\\.?":"";i[n+s+o]=!0,e[n+s]=r+1})});else{const n=[],r=o=>o.type==="month";for(let o=0;o<12;o++)n.push(new Date(2017,o,1));const s=["full","long","medium"];for(const o of s){const l=Intl.DateTimeFormat(this.locale,{dateStyle:o});for(let u=0;u<12;u++){let c=l.formatToParts(n[u]).find(r).value.toLowerCase();if(/^ko/i.test(this.locale)&&(c+="월"),o==="medium"){if(/^ar|zh/i.test(this.locale))return;c=c.replace(/\.$/,""),i[`${c}\\.?`]=!0}else i[c]=!0;e[c]=u+1}}const a=Intl.DateTimeFormat(this.locale,{month:"short"});for(let o=0;o<12;o++){let l=a.formatToParts(n[o]).find(r).value.toLowerCase();l=l.replace(/\.$/,""),i[`${l}\\.?`]=!0,e[l]=o+1}}this.vars.MONTHNAME=Object.keys(i).join("|"),this.lookups.month=e}buildDaynames(){const i=[],e=a=>a.type==="weekday";for(let a=0;a<7;a++)i.push(new Date(2017,0,a+1));const n=["long","short"],r=[],s={};for(const a of n){const o=Intl.DateTimeFormat(this.locale,{weekday:a});for(let l=0;l<7;l++){let u=o.formatToParts(i[l]).find(e).value.toLowerCase();a==="short"?(u=u.replace(/\.$/,""),r.push(`${u}\\.?`)):r.push(u),s[u]=l}}this.vars.DAYNAME=r.join("|"),this.lookups.dayname=s}buildMeridiems(){const i=[new Date(2017,0,1),new Date(2017,0,1,23,0,0)],e=a=>a.type==="dayPeriod",n=[],r={},s=Intl.DateTimeFormat(this.locale,{timeStyle:"long"});for(let a=0;a<2;a++){const o=s.formatToParts(i[a]).find(e);if(!o)return;const l=o.value.toLowerCase();n.push(l),r[l]=a*12}this.vars.MERIDIEM=n.join("|"),this.lookups.meridiem=r}getObject(i,e){const n={};return i.forEach((r,s)=>{if(!r)return;let a=e[s+1];a=a.toLowerCase(),a=a.replace(/\.$/,""),r==="offset"?n.offset=this.offsetToMinutes(a):this.lookups[r]?n[r]=this.lookups[r][a]||this.toInt(a):n[r]=this.toInt(a)}),n}castObject(i){const e={};return KE.forEach(n=>{n in i&&(e[n]=this.toInt(i[n]))}),typeof i.offset=="string"?e.offset=this.offsetToMinutes(i.offset):typeof i.offset=="number"&&(e.offset=i.offset),e}offsetToMinutes(i){const e=i.match(/^([+-])(..?):?(..)?$/);if(e){const[,n,r,s]=e;return(n==="-"?-1:1)*(this.toInt(r)*60+this.toInt(s||0))}return 0}compile(i){const e=i.replace(/_([A-Z0-9]+)_/g,(n,r)=>{if(!this.vars[r])throw new Error(`Template string contains invalid variable _${r}_`);return this.vars[r]});return new RegExp(e,"i")}};const Ad=Rr,$s=Js;var ot=class{constructor({template:t=null,matcher:i=null,units:e=null,handler:n=null,locales:r=null}){if(!Array.isArray(e)&&typeof n!="function")throw new Error('new Format must receive a "units" array or "handler" function');if(typeof t!="string"&&!(i instanceof RegExp))throw new Error('new Format must receive a "template" string or "matcher" RegExp');this.template=t,this.units=e,this.matcher=i,this.handler=n,this.locales=r,this.regexByLocale={}}getRegExp(t=$s){return this.template?(this.regexByLocale[t]||(this.regexByLocale[t]=Ad.factory(t).compile(this.template)),this.regexByLocale[t]):this.matcher}getMatches(t,i=$s){return t.match(this.getRegExp(i))}toDateTime(t,i=$s){const e=Ad.factory(i);if(this.units)return e.getObject(this.units,t);const n=this.handler(t,i);return!n||n.invalid?n:e.castObject(n)}attempt(t,i=$s){t=String(t).trim();const e=this.getMatches(t,i);if(e){const n=this.toDateTime(e,i);if(n&&!n.invalid)return n}return null}now(){return new Date}};function ZE(t,i){return function(e,n=i){const r=t.attempt(e,n);if(r.invalid)return r;const s=new Date(2e3,0,1);return typeof r.day=="number"&&s.setUTCDate(r.day),typeof r.year=="number"&&s.setUTCFullYear(r.year),typeof r.month=="number"&&s.setUTCMonth(r.month-1),s.setUTCHours(r.hour||0),s.setUTCMinutes(r.minute||0),s.setUTCSeconds(r.second||0),s.setUTCMilliseconds(r.millisecond||0),typeof r.offset=="number"?new Date(s-r.offset*60*1e3):s}}var YE=ZE;function XE(t){return function(i,e){return i instanceof Date?i:typeof i=="number"?new Date(i):t(i,e)}}var JE=XE;const _l=Js,kd=YE,QE=JE;var $E=class{constructor(){this.formats=[]}addFormat(t){return this.formats.push(t),t.parser=this,this}addFormats(t){return t.forEach(i=>this.addFormat(i)),this}removeFormat(t){const i=this.formats.indexOf(t);if(i>-1){const e=this.formats[i];return this.formats.splice(i,1),e.parser=null,!0}return!1}attempt(t,i=_l){for(const n of this.formats){if(Array.isArray(n.locales)&&n.locales.length>0&&!n.locales.includes(new Intl.Locale(i).baseName))continue;const r=n.attempt(t,i);if(r)return r}let e=String(t).slice(0,200);return e===""&&(e="empty string"),{invalid:`Unable to parse ${e}`}}exportAsFunction(t=_l){return kd(this,t)}exportAsFunctionAny(t=_l){return QE(kd(this,t))}};const eP=ot;var tP=new eP({template:"^@(\\d+)$",handler:function(t){const i=parseInt(t[1],10),e=new Date(i*1e3);return{year:e.getUTCFullYear(),month:e.getUTCMonth()+1,day:e.getUTCDate(),hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds()}}});const iP=ot;var nP=new iP({matcher:/^\/Date\((\d+)([+-]\d{4})?\)\/$/,handler:function(t){const i=parseInt(t[1],10),e=new Date(i);return{year:e.getUTCFullYear(),month:e.getUTCMonth()+1,day:e.getUTCDate(),hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds(),millisecond:e.getUTCMilliseconds(),offset:t[2]||0}}}),rP={y:"year",M:"month",d:"day",w:"week",h:"hour",m:"minute",s:"second",ms:"millisecond"};const sP=ot,oP=rP;var aP=new sP({matcher:/^(\+|-|in|) ?([\d.]+) ?(years?|months?|weeks?|days?|hours?|minutes?|seconds?|milliseconds?|ms|s|m|h|w|d|M|y)( ago)?$/i,handler:function([,t,i,e,n]){i=parseFloat(i),e.length<=2?e=oP[e]:(e=e.replace(/s$/,""),e=e.toLowerCase()),e==="week"&&(e="day",i*=7),(t==="-"||n)&&(i*=-1);const r=this.now();return e==="millisecond"?r.setUTCMilliseconds(r.getUTCMilliseconds()+i):e==="second"?r.setUTCSeconds(r.getUTCSeconds()+i):e==="minute"?r.setUTCMinutes(r.getUTCMinutes()+i):e==="hour"?r.setUTCHours(r.getUTCHours()+i):e==="day"?r.setUTCDate(r.getUTCDate()+i):e==="month"?r.setUTCMonth(r.getUTCMonth()+i):e==="year"&&r.setUTCFullYear(r.getUTCFullYear()+i),{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}});const lP=ot,uP=Rr,{chineseGroup:eo}=Od;let Cr;var cP=new lP({template:`^(${eo}{4}|${eo}{2})\\s*年\\s*(${eo}{1,2})\\s*月\\s*(${eo}{1,2})\\s*日$`,handler:function([,t,i,e]){return Cr||(Cr=new uP("zh"),Cr.numberingSystem="hanidec",Cr.buildNumbers()),Cr.castObject({year:t,month:i,day:e})}});const hP=ot;var fP=new hP({template:"^(_DAY_)[\\/. ](_MONTH_)$",units:["day","month"]});const dP=ot;var pP=new dP({template:"^(_DAY_)(?:_ORDINAL_)?[ -](_MONTHNAME_)$",units:["day","month"]});const mP=ot;var gP=new mP({template:"^(?:(?:_DAYNAME_),? )?(_DAY_)(?:_ORDINAL_)?([ -])(_MONTHNAME_)\\2(_YEAR_)$",units:["day",null,"month","year"]});const vP=ot;var yP=new vP({template:"^(_DAY_)([\\/. -])(_MONTH_)\\2(_YEAR_)$",units:["day",null,"month","year"]});const bP=ot;var wP=new bP({template:"^(_MONTH_)(?:[\\/-])(_DAY_)$",units:["month","day"]});const _P=ot;var TP=new _P({template:"^(_MONTH_)([\\/-])(_DAY_)\\2(_YEAR_)$",units:["month",null,"day","year"],locales:["ee-TG","en-AS","en-CA","en-FM","en-GH","en-GU","en-KE","en-KY","en-MH","en-MP","en-US","en-VI","en-WS","sm-AS","sm-SM"]});const xP=ot;var SP=new xP({template:"^(?:(?:_DAYNAME_),? )?(_MONTHNAME_)? (_DAY_)(?:_ORDINAL_)?$",units:["month","day"]});const EP=ot;var PP=new EP({template:"^(?:(?:_DAYNAME_),? )?(_MONTHNAME_)? (_DAY_)(?:_ORDINAL_)?,? (_YEAR_)$",units:["month","day","year"]});const RP=Rr,CP=ot;var OP=new CP({template:"^(.*?)_SPACE_*(?:at|on|T|)_SPACE_*(_H12_|_H24_)(?:\\:(_MIN_)(?:\\:(_SEC_))?)?_SPACE_*(_MERIDIEM_)$",handler:function(t,i){let[,e,n,r,s,a]=t,o={};if(e&&(o=this.parser.attempt(e,i),o.invalid))return null;const l=RP.factory(i);if(a){const u=l.lookups.meridiem[a.toLowerCase()]||0;n=parseFloat(n),n===12?n=u:n>12&&u===12?n+=0:n+=u}return o.hour=n,r&&(o.minute=r),s&&(o.second=s),o}});const IP=Rr,AP=ot,Dd=vl;var kP=new AP({template:"^(.*?)_SPACE_*(?:at|on|T|)_SPACE_*(_H24_)\\:(_MIN_)(?:\\:(_SEC_)(?:[\\.,](_MS_))?)?_SPACE_*(?:GMT)?_SPACE_*(_OFFSET_)?_SPACE_*(_ZONE_)?$",handler:function(t,i){let[,e,n,r,s,a,o,l]=t,u={};if(e&&(u=this.parser.attempt(e,i),u.invalid))return u;if(u.hour=n,u.minute=r,s&&(u.second=s),a&&a.length>3?u.millisecond=a.slice(0,3):a&&(u.millisecond=a),l&&!o&&l in Dd)u.offset=Dd[l];else if(o){const c=IP.factory(i);u.offset=c.offsetToMinutes(o)}return u}});const DP=ot;var MP=new DP({matcher:/^(now|today|tomorrow|yesterday)/i,handler:function(t){const i=this.now(),e=t[1].toLowerCase();switch(e){case"tomorrow":i.setUTCDate(i.getUTCDate()+1);break;case"yesterday":i.setUTCDate(i.getUTCDate()-1);break}const n={year:i.getUTCFullYear(),month:i.getUTCMonth()+1,day:i.getUTCDate()};return e==="now"&&(n.hour=i.getUTCHours(),n.minute=i.getUTCMinutes(),n.second=i.getUTCSeconds(),n.millisecond=i.getUTCMilliseconds()),n}});const NP=ot;var LP=new NP({template:"^(?:_DAYNAME_) (_MONTHNAME_) (_DAY_) (_H24_):(_MIN_):(_SEC_) (_OFFSET_) (_YEAR_)$",units:["month","day","hour","minute","second","offset","year"]});const FP=ot;var zP=new FP({template:"^(_YEAR_)(-?)(_MONTH_)\\2(_DAY_)$",units:["year",null,"month","day"]});const Md=$E,HP=ot,BP=Rr,UP=tP,VP=nP,jP=aP,WP=cP,GP=fP,qP=pP,KP=gP,ZP=yP,YP=Js,XP=wP,JP=TP,QP=SP,$P=PP,eR=OP,tR=kP,iR=MP,nR=LP,rR=zP,Wt=new Md;Wt.addFormats([tR,eR,rR,KP,$P,JP,ZP,WP,nR,iR,jP,QP,qP,XP,GP,UP,VP]),Wt.Parser=Md,Wt.Format=HP,Wt.LocaleHelper=BP,Wt.defaultLocale=YP,Wt.fromString=Date.fromString=Wt.exportAsFunction(),Wt.fromAny=Date.fromAny=Wt.exportAsFunctionAny(),typeof window<"u"&&(window.anyDateParser=Wt);var to=Wt;const sR=od(to),oR=new RegExp(`(${gl.abbreviated_months.map(t=>t.toLowerCase()).join("|")})`),aR=new to.Format({matcher:/^'?(\d{2}|\d{4})$/,units:["year"]}),lR=new to.Format({matcher:/^(\d{1,2})\D*'?(\d{2}|\d{4})$/,units:["month","year"]}),Nd=new to.Parser;Nd.addFormats([aR,lR]);function uR(t){t=t.trim();let i=[],e;return e=Nd.attempt(t),e.invalid||i.push({year:e.year,month:e.month,day:e.day}),e=sR.attempt(t),e.invalid||i.push({year:e.year,month:e.month,day:e.day}),oR.test(t.toLowerCase())||[...i].forEach(n=>{n.day<=12&&n.day!==n.month&&i.push({year:n.year,month:n.day,day:n.month})}),i}const cR=Object.freeze(Object.defineProperty({__proto__:null,parseDate:uR},Symbol.toStringTag,{value:"Module"})),{now:Ld}=Date,hR=(t,i=1,e)=>{i=Math.max(1,i);const n=(e==null?void 0:e.leading)??!1,r=(e==null?void 0:e.trailing)??!0,s=Math.max((e==null?void 0:e.maxWait)??1/0,i);let a,o,l=0,u=0;const c=()=>{const C=Ld(),L=C-l,D=C-u,j=L>=i||D>=s;return[C,j]},h=C=>{if(u=C,!a)return;const L=a;a=void 0,t.apply(void 0,L)},f=()=>{w(0)},p=()=>{o&&(f(),h(Ld()))},m=C=>{if(u=C,n)return h(C)},b=C=>{if(r&&a)return h(C);a=void 0},T=()=>{o=void 0;const[C,L]=c();return L?b(C):y(C)},y=C=>{const L=C-l,D=C-u,j=i-L,N=s-D,K=Math.min(j,N);return w(K)},w=C=>{o&&clearTimeout(o),!(C<=0)&&(o=setTimeout(T,C))},S=(...C)=>{const[L,D]=c(),j=!!o;if(a=C,l=L,(D||!o)&&w(i),D)return j?h(L):m(L)};return S.cancel=f,S.flush=p,S},fR={gallery:"liv_gallery__gallery",tile:"liv_gallery__tile",thumbnailImage:"liv_gallery__thumbnailImage",thumbnailLabel:"liv_gallery__thumbnailLabel",thumbnailLabelTitle:"liv_gallery__thumbnailLabelTitle",thumbnailLabelSubtitle:"liv_gallery__thumbnailLabelSubtitle",loadMore:"liv_gallery__loadMore"},dR=["src","alt","onClick"],pR=[ee("span",null,[ee("b",null,"Load more...")],-1)],Fd=200,Or=10,mR=Object.freeze(Object.defineProperty({__proto__:null,default:nn({__name:"Gallery",setup(t){const i=zi(),e=$(null),n=$(0);xd(e,()=>{e.value&&i.more&&!i.pending&&!i.disableAutoLoad&&i.getRecords()},{distance:50,interval:1e3});function r(a){const l=(n.value/(a.iiifData.width/a.iiifData.height)+Or)/Or;return Math.ceil(l)}function s(){let a=0;try{a=e.value.clientWidth}catch{}a===0&&(a=window.innerWidth*.88);let o=0,l=0;for(;l+=Fd,!(l>a||(o++,l+Or+Fd>a));)l+=Or;n.value=Math.ceil(a/o)-Or}return oi(()=>{setTimeout(s,500)}),rE(e,hR(s,200)),(a,o)=>(ie(),le(De,null,[ee("div",{class:q(a.$style.gallery),ref_key:"galleryContainer",ref:e},[(ie(!0),le(De,null,yt(k(i).allImages,l=>(ie(),le("div",{class:q(a.$style.tile),style:qt({gridRowEnd:`span ${r(l)}`}),role:"button",key:l.id},[ee("img",{src:l.thumbnail,alt:l.record.title,onClick:u=>k(i).changeImage(l),class:q(a.$style.thumbnailImage)},null,10,dR),ee("div",{class:q(a.$style.thumbnailLabel)},[ee("div",{class:q(a.$style.thumbnailLabelTitle)},Oe(l.record.title),3),l.record.subtitle?(ie(),le("div",{key:0,class:q(a.$style.thumbnailLabelSubtitle)},Oe(l.record.subtitle),3)):qe("",!0)],2)],6))),128))],2),k(i).more&&!k(i).pending?(ie(),le("div",{key:0,class:q(a.$style.loadMore),onClick:o[0]||(o[0]=l=>k(i).getRecords())},pR,2)):qe("",!0)],64))}},[["__cssModules",{$style:fR}]])},Symbol.toStringTag,{value:"Module"})),gR={list:"liv_list__list",item:"liv_list__item",body:"liv_list__body",data:"liv_list__data",header:"liv_list__header",title:"liv_list__title",subtitle:"liv_list__subtitle",tinyGallery:"liv_list__tinyGallery",multiImg:"liv_list__multiImg"},vR=["src","alt","onClick"],yR=Object.freeze(Object.defineProperty({__proto__:null,default:nn({__name:"List",setup(t){const i=zi(),e=$(null);return xd(e,()=>{e.value&&i.more&&!i.pending&&!i.disableAutoLoad&&i.getRecords()},{distance:50,interval:1e3}),(n,r)=>(ie(),le("div",{class:q(n.$style.list),ref_key:"listContainer",ref:e},[(ie(!0),le(De,null,yt(k(i).allRecords,s=>(ie(),le("div",{class:q(n.$style.item),key:s.id},[ee("div",{class:q(n.$style.header)},[ee("span",{class:q(n.$style.title)},Oe(s.title),3),ee("span",{class:q(n.$style.subtitle)},Oe(s.subtitle),3)],2),ee("div",{class:q(n.$style.body)},[ee("div",{class:q(n.$style.data)},[ee("dl",null,[(ie(!0),le(De,null,yt(s.dataSummary,a=>(ie(),le(De,null,[ee("dt",null,Oe(a.key),1),ee("dd",null,Oe(a.value),1)],64))),256))])],2),ee("div",{class:q([n.$style.tinyGallery,s.images&&s.images.length>1?n.$style.multiImg:""])},[(ie(!0),le(De,null,yt(s.images,a=>(ie(),le("img",{src:a.thumbnail,alt:s.title,onClick:o=>k(i).changeImage(a)},null,8,vR))),256))],2)],2)],2))),128))],2))}},[["__cssModules",{$style:gR}]])},Symbol.toStringTag,{value:"Module"}))}); +function i(e){return new i.Viewer(e)}(function(e){e.version={versionStr:"4.0.0",major:parseInt("4",10),minor:parseInt("0",10),revision:parseInt("0",10)};var n={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"},r=Object.prototype.toString,s=Object.prototype.hasOwnProperty;e.isFunction=function(a){return e.type(a)==="function"},e.isArray=Array.isArray||function(a){return e.type(a)==="array"},e.isWindow=function(a){return a&&typeof a=="object"&&"setInterval"in a},e.type=function(a){return a==null?String(a):n[r.call(a)]||"object"},e.isPlainObject=function(a){if(!a||i.type(a)!=="object"||a.nodeType||e.isWindow(a)||a.constructor&&!s.call(a,"constructor")&&!s.call(a.constructor.prototype,"isPrototypeOf"))return!1;var o;for(var l in a)o=l;return o===void 0||s.call(a,o)},e.isEmptyObject=function(a){for(var o in a)return!1;return!0},e.freezeObject=function(a){return Object.freeze?e.freezeObject=Object.freeze:e.freezeObject=function(o){return o},e.freezeObject(a)},e.supportsCanvas=function(){var a=document.createElement("canvas");return!!(e.isFunction(a.getContext)&&a.getContext("2d"))}(),e.isCanvasTainted=function(a){var o=!1;try{a.getContext("2d").getImageData(0,0,1,1)}catch{o=!0}return o},e.supportsAddEventListener=function(){return!!(document.documentElement.addEventListener&&document.addEventListener)}(),e.supportsRemoveEventListener=function(){return!!(document.documentElement.removeEventListener&&document.removeEventListener)}(),e.supportsEventListenerOptions=function(){var a=0;if(e.supportsAddEventListener)try{var o={get capture(){return a++,!1},get once(){return a++,!1},get passive(){return a++,!1}};window.addEventListener("test",null,o),window.removeEventListener("test",null,o)}catch{a=0}return a>=3}(),e.getCurrentPixelDensityRatio=function(){if(e.supportsCanvas){var a=document.createElement("canvas").getContext("2d"),o=window.devicePixelRatio||1,l=a.webkitBackingStorePixelRatio||a.mozBackingStorePixelRatio||a.msBackingStorePixelRatio||a.oBackingStorePixelRatio||a.backingStorePixelRatio||1;return Math.max(o,1)/l}else return 1},e.pixelDensityRatio=e.getCurrentPixelDensityRatio()})(i),function(e){e.extend=function(){var l,u,c,h,f,p,m=arguments[0]||{},b=arguments.length,T=!1,y=1;for(typeof m=="boolean"&&(T=m,m=arguments[1]||{},y=2),typeof m!="object"&&!i.isFunction(m)&&(m={}),b===y&&(m=this,--y);y=c.x&&u.x=c.y},getMousePosition:function(l){if(typeof l.pageX=="number")e.getMousePosition=function(u){var c=new e.Point;return c.x=u.pageX,c.y=u.pageY,c};else if(typeof l.clientX=="number")e.getMousePosition=function(u){var c=new e.Point;return c.x=u.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,c.y=u.clientY+document.body.scrollTop+document.documentElement.scrollTop,c};else throw new Error("Unknown event mouse position, no known technique.");return e.getMousePosition(l)},getPageScroll:function(){var l=document.documentElement||{},u=document.body||{};if(typeof window.pageXOffset=="number")e.getPageScroll=function(){return new e.Point(window.pageXOffset,window.pageYOffset)};else if(u.scrollLeft||u.scrollTop)e.getPageScroll=function(){return new e.Point(document.body.scrollLeft,document.body.scrollTop)};else if(l.scrollLeft||l.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(l){if(typeof window.scrollTo<"u")e.setPageScroll=function(h){window.scrollTo(h.x,h.y)};else{var u=e.getPageScroll();if(u.x===l.x&&u.y===l.y)return;document.body.scrollLeft=l.x,document.body.scrollTop=l.y;var c=e.getPageScroll();if(c.x!==u.x&&c.y!==u.y){e.setPageScroll=function(h){document.body.scrollLeft=h.x,document.body.scrollTop=h.y};return}if(document.documentElement.scrollLeft=l.x,document.documentElement.scrollTop=l.y,c=e.getPageScroll(),c.x!==u.x&&c.y!==u.y){e.setPageScroll=function(h){document.documentElement.scrollLeft=h.x,document.documentElement.scrollTop=h.y};return}e.setPageScroll=function(h){}}e.setPageScroll(l)},getWindowSize:function(){var l=document.documentElement||{},u=document.body||{};if(typeof window.innerWidth=="number")e.getWindowSize=function(){return new e.Point(window.innerWidth,window.innerHeight)};else if(l.clientWidth||l.clientHeight)e.getWindowSize=function(){return new e.Point(document.documentElement.clientWidth,document.documentElement.clientHeight)};else if(u.clientWidth||u.clientHeight)e.getWindowSize=function(){return new e.Point(document.body.clientWidth,document.body.clientHeight)};else throw new Error("Unknown window size, no known technique.");return e.getWindowSize()},makeCenteredNode:function(l){l=e.getElement(l);var u=[e.makeNeutralElement("div"),e.makeNeutralElement("div"),e.makeNeutralElement("div")];return e.extend(u[0].style,{display:"table",height:"100%",width:"100%"}),e.extend(u[1].style,{display:"table-row"}),e.extend(u[2].style,{display:"table-cell",verticalAlign:"middle",textAlign:"center"}),u[0].appendChild(u[1]),u[1].appendChild(u[2]),u[2].appendChild(l),u[0]},makeNeutralElement:function(l){var u=document.createElement(l),c=u.style;return c.background="transparent none",c.border="none",c.margin="0px",c.padding="0px",c.position="static",u},now:function(){return Date.now?e.now=Date.now:e.now=function(){return new Date().getTime()},e.now()},makeTransparentImage:function(l){var u=e.makeNeutralElement("img");return u.src=l,u},setElementOpacity:function(l,u,c){var h,f;l=e.getElement(l),c&&!e.Browser.alpha&&(u=Math.round(u)),e.Browser.opacity?l.style.opacity=u<1?u:"":u<1?(h=Math.round(100*u),f="alpha(opacity="+h+")",l.style.filter=f):l.style.filter=""},setElementTouchActionNone:function(l){l=e.getElement(l),typeof l.style.touchAction<"u"?l.style.touchAction="none":typeof l.style.msTouchAction<"u"&&(l.style.msTouchAction="none")},setElementPointerEvents:function(l,u){l=e.getElement(l),typeof l.style<"u"&&typeof l.style.pointerEvents<"u"&&(l.style.pointerEvents=u)},setElementPointerEventsNone:function(l){e.setElementPointerEvents(l,"none")},addClass:function(l,u){l=e.getElement(l),l.className?(" "+l.className+" ").indexOf(" "+u+" ")===-1&&(l.className+=" "+u):l.className=u},indexOf:function(l,u,c){return Array.prototype.indexOf?this.indexOf=function(h,f,p){return h.indexOf(f,p)}:this.indexOf=function(h,f,p){var m,b=p||0,T;if(!h)throw new TypeError;if(T=h.length,T===0||b>=T)return-1;for(b<0&&(b=T-Math.abs(b)),m=b;m=200&&T.status<300||T.status===0&&b!=="http:"&&b!=="https:"?u(T):e.isFunction(c)?c(T):e.console.error("AJAX request returned %d: %s",T.status,l))};var y=m?"POST":"GET";try{if(T.open(y,l,!0),p&&(T.responseType=p),f)for(var w in f)Object.prototype.hasOwnProperty.call(f,w)&&f[w]&&T.setRequestHeader(w,f[w]);h&&(T.withCredentials=!0),T.send(m)}catch(S){e.console.error("%s while making AJAX request: %s",S.name,S.message),T.onreadystatechange=function(){},e.isFunction(c)&&c(T,S)}return T},jsonp:function(l){var u,c=l.url,h=document.head||document.getElementsByTagName("head")[0]||document.documentElement,f=l.callbackName||"openseadragon"+e.now(),p=window[f],m="$1"+f+"$2",b=l.param||"callback",T=l.callback;c=c.replace(/(=)\?(&|$)|\?\?/i,m),c+=(/\?/.test(c)?"&":"?")+b+"="+f,window[f]=function(y){if(p)window[f]=p;else try{delete window[f]}catch{}T&&e.isFunction(T)&&T(y)},u=document.createElement("script"),(l.async!==void 0||l.async!==!1)&&(u.async="async"),l.scriptCharset&&(u.charset=l.scriptCharset),u.src=c,u.onload=u.onreadystatechange=function(y,w){(w||!u.readyState||/loaded|complete/.test(u.readyState))&&(u.onload=u.onreadystatechange=null,h&&u.parentNode&&h.removeChild(u),u=void 0)},h.insertBefore(u,h.firstChild)},createFromDZI:function(){throw"OpenSeadragon.createFromDZI is deprecated, use Viewer.open."},parseXml:function(l){if(window.DOMParser)e.parseXml=function(u){var c=null,h;return h=new DOMParser,c=h.parseFromString(u,"text/xml"),c};else if(window.ActiveXObject)e.parseXml=function(u){var c=null;return c=new ActiveXObject("Microsoft.XMLDOM"),c.async=!1,c.loadXML(u),c};else throw new Error("Browser doesn't support XML DOM.");return e.parseXml(l)},parseJSON:function(l){return e.parseJSON=window.JSON.parse,e.parseJSON(l)},imageFormatSupported:function(l){return l=l||"",!!s[l.toLowerCase()]},setImageFormatsSupported:function(l){e.extend(s,l)}});var r=function(l){};e.console=window.console||{log:r,debug:r,info:r,warn:r,error:r,assert:r},e.Browser={vendor:e.BROWSERS.UNKNOWN,version:0,alpha:!0};var s={bmp:!1,jpeg:!0,jpg:!0,png:!0,tif:!1,wdp:!1},a={};(function(){var l=navigator.appVersion,u=navigator.userAgent,c;switch(navigator.appName){case"Microsoft Internet Explorer":window.attachEvent&&window.ActiveXObject&&(e.Browser.vendor=e.BROWSERS.IE,e.Browser.version=parseFloat(u.substring(u.indexOf("MSIE")+5,u.indexOf(";",u.indexOf("MSIE")))));break;case"Netscape":window.addEventListener&&(u.indexOf("Edge")>=0?(e.Browser.vendor=e.BROWSERS.EDGE,e.Browser.version=parseFloat(u.substring(u.indexOf("Edge")+5))):u.indexOf("Edg")>=0?(e.Browser.vendor=e.BROWSERS.CHROMEEDGE,e.Browser.version=parseFloat(u.substring(u.indexOf("Edg")+4))):u.indexOf("Firefox")>=0?(e.Browser.vendor=e.BROWSERS.FIREFOX,e.Browser.version=parseFloat(u.substring(u.indexOf("Firefox")+8))):u.indexOf("Safari")>=0?(e.Browser.vendor=u.indexOf("Chrome")>=0?e.BROWSERS.CHROME:e.BROWSERS.SAFARI,e.Browser.version=parseFloat(u.substring(u.substring(0,u.indexOf("Safari")).lastIndexOf("/")+1,u.indexOf("Safari")))):(c=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})"),c.exec(u)!==null&&(e.Browser.vendor=e.BROWSERS.IE,e.Browser.version=parseFloat(RegExp.$1))));break;case"Opera":e.Browser.vendor=e.BROWSERS.OPERA,e.Browser.version=parseFloat(l);break}var h=window.location.search.substring(1),f=h.split("&"),p,m,b;for(b=0;b0){var T=p.substring(0,m),y=p.substring(m+1);try{a[T]=decodeURIComponent(y)}catch{e.console.error("Ignoring malformed URL parameter: %s=%s",T,y)}}e.Browser.alpha=!(e.Browser.vendor===e.BROWSERS.CHROME&&e.Browser.version<2),e.Browser.opacity=!0,e.Browser.vendor===e.BROWSERS.IE&&e.Browser.version<11&&e.console.error("Internet Explorer versions < 11 are not supported by OpenSeadragon")})(),function(l){var u=l.requestAnimationFrame||l.mozRequestAnimationFrame||l.webkitRequestAnimationFrame||l.msRequestAnimationFrame,c=l.cancelAnimationFrame||l.mozCancelAnimationFrame||l.webkitCancelAnimationFrame||l.msCancelAnimationFrame;if(u&&c)e.requestAnimationFrame=function(){return u.apply(l,arguments)},e.cancelAnimationFrame=function(){return c.apply(l,arguments)};else{var h=[],f=[],p=0,m;e.requestAnimationFrame=function(b){return h.push([++p,b]),m||(m=setInterval(function(){if(h.length){var T=e.now(),y=f;for(f=h,h=y;f.length;)f.shift()[1](T)}else clearInterval(m),m=void 0},1e3/50)),p},e.cancelAnimationFrame=function(b){var T,y;for(T=0,y=h.length;T8||"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 v=document.createElement("div");return e.isFunction(v.setPointerCapture)&&e.isFunction(v.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 v=document.createElement("div");return e.isFunction(v.setCapture)&&e.isFunction(v.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(v){this._gPoints=[],this.type=v,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(v){return this._gPoints.push(v)},removeById:function(v){var g,x=this._gPoints.length;for(g=0;g1&&(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 a(v){var g=n[v.hash],x,E,B,J,fe,Te=g.activePointersLists.length;for(x=0;x0){for(fe=[],J=B.asArray(),E=0;Eg.touches.length-B&&e.console.warn("Tracked touch contact count doesn't match event.touches.length");var Te={originalEvent:g,eventType:"pointerdown",pointerType:"touch",isEmulated:!1};for(A(v,Te),E=0;E"u"?!0:r.attachToViewer,this.autoFade=typeof r.autoFade>"u"?!0:r.autoFade,this.element=n,this.anchor=r.anchor,this.container=s,this.anchor===e.ControlAnchor.ABSOLUTE?(this.wrapper=e.makeNeutralElement("div"),this.wrapper.style.position="absolute",this.wrapper.style.top=typeof r.top=="number"?r.top+"px":r.top,this.wrapper.style.left=typeof r.left=="number"?r.left+"px":r.left,this.wrapper.style.height=typeof r.height=="number"?r.height+"px":r.height,this.wrapper.style.width=typeof r.width=="number"?r.width+"px":r.width,this.wrapper.style.margin="0px",this.wrapper.style.padding="0px",this.element.style.position="relative",this.element.style.top="0px",this.element.style.left="0px",this.element.style.height="100%",this.element.style.width="100%"):(this.wrapper=e.makeNeutralElement("div"),this.wrapper.style.display="inline-block",this.anchor===e.ControlAnchor.NONE&&(this.wrapper.style.width=this.wrapper.style.height="100%")),this.wrapper.appendChild(this.element),r.attachToViewer?this.anchor===e.ControlAnchor.TOP_RIGHT||this.anchor===e.ControlAnchor.BOTTOM_RIGHT?this.container.insertBefore(this.wrapper,this.container.firstChild):this.container.appendChild(this.wrapper):a.appendChild(this.wrapper)},e.Control.prototype={destroy:function(){this.wrapper.removeChild(this.element),this.anchor!==e.ControlAnchor.NONE&&this.container.removeChild(this.wrapper)},isVisible:function(){return this.wrapper.style.display!=="none"},setVisible:function(n){this.wrapper.style.display=n?this.anchor===e.ControlAnchor.ABSOLUTE?"block":"inline-block":"none"},setOpacity:function(n){this.element[e.SIGNAL]&&e.Browser.vendor===e.BROWSERS.IE?e.setElementOpacity(this.element,n,!0):e.setElementOpacity(this.wrapper,n,!0)}}}(i),function(e){e.ControlDock=function(r){var s=["topleft","topright","bottomright","bottomleft"],a,o;for(e.extend(!0,this,{id:"controldock-"+e.now()+"-"+Math.floor(Math.random()*1e6),container:e.makeNeutralElement("div"),controls:[]},r),this.container.onsubmit=function(){return!1},this.element&&(this.element=e.getElement(this.element),this.element.appendChild(this.container),this.element.style.position="relative",this.container.style.width="100%",this.container.style.height="100%"),o=0;o=0)){switch(s.anchor){case e.ControlAnchor.TOP_RIGHT:a=this.controls.topright,r.style.position="relative",r.style.paddingRight="0px",r.style.paddingTop="0px";break;case e.ControlAnchor.BOTTOM_RIGHT:a=this.controls.bottomright,r.style.position="relative",r.style.paddingRight="0px",r.style.paddingBottom="0px";break;case e.ControlAnchor.BOTTOM_LEFT:a=this.controls.bottomleft,r.style.position="relative",r.style.paddingLeft="0px",r.style.paddingBottom="0px";break;case e.ControlAnchor.TOP_LEFT:a=this.controls.topleft,r.style.position="relative",r.style.paddingLeft="0px",r.style.paddingTop="0px";break;case e.ControlAnchor.ABSOLUTE:a=this.container,r.style.margin="0px",r.style.padding="0px";break;default:case e.ControlAnchor.NONE:a=this.container,r.style.margin="0px",r.style.padding="0px";break}this.controls.push(new e.Control(r,s,a)),r.style.display="inline-block"}},removeControl:function(r){r=e.getElement(r);var s=n(this,r);return s>=0&&(this.controls[s].destroy(),this.controls.splice(s,1)),this},clearControls:function(){for(;this.controls.length>0;)this.controls.pop().destroy();return this},areControlsEnabled:function(){var r;for(r=this.controls.length-1;r>=0;r--)if(this.controls[r].isVisible())return!0;return!1},setControlsEnabled:function(r){var s;for(s=this.controls.length-1;s>=0;s--)this.controls[s].setVisible(r);return this}};function n(r,s){var a=r.controls,o;for(o=a.length-1;o>=0;o--)if(a[o].element===s)return o;return-1}}(i),function(e){e.Placement=e.freezeObject({CENTER:0,TOP_LEFT:1,TOP:2,TOP_RIGHT:3,RIGHT:4,BOTTOM_RIGHT:5,BOTTOM:6,BOTTOM_LEFT:7,LEFT:8,properties:{0:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!1,isVerticallyCentered:!0,isBottom:!1},1:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!0,isVerticallyCentered:!1,isBottom:!1},2:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!0,isVerticallyCentered:!1,isBottom:!1},3:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!0,isVerticallyCentered:!1,isBottom:!1},4:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!1,isVerticallyCentered:!0,isBottom:!1},5:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!1,isVerticallyCentered:!1,isBottom:!0},6:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!1,isVerticallyCentered:!1,isBottom:!0},7:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!1,isVerticallyCentered:!1,isBottom:!0},8:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!1,isVerticallyCentered:!0,isBottom:!1}}})}(i),function(e){var n={},r=1;e.Viewer=function(d){var _=arguments,R=this,A;if(e.isPlainObject(d)||(d={id:_[0],xmlPath:_.length>1?_[1]:void 0,prefixUrl:_.length>2?_[2]:void 0,controls:_.length>3?_[3]:void 0,overlays:_.length>4?_[4]:void 0}),d.config&&(e.extend(!0,d,d.config),delete d.config),e.extend(!0,this,{id:d.id,hash:d.hash||r++,initialPage:0,element:null,container:null,canvas:null,overlays:[],overlaysContainer:null,previousBody:[],customControls:[],source:null,drawer:null,world:null,viewport:null,navigator:null,collectionViewport:null,collectionDrawer:null,navImages:null,buttonGroup:null,profiler:null},e.DEFAULT_SETTINGS,d),typeof this.hash>"u")throw new Error("A hash must be defined, either by specifying options.id or options.hash.");for(typeof n[this.hash]<"u"&&e.console.warn("Hash "+this.hash+" has already been used."),n[this.hash]={fsBoundsDelta:new e.Point(1,1),prevContainerSize:null,animating:!1,forceRedraw:!1,needsResize:!1,forceResize:!1,mouseInside:!1,group:null,zooming:!1,zoomFactor:null,lastZoomTime:null,fullPage:!1,onfullscreenchange:null,lastClickTime:null,draggingToZoom:!1},this._sequenceIndex=0,this._firstOpen=!0,this._updateRequestId=null,this._loadQueue=[],this.currentOverlays=[],this._updatePixelDensityRatioBind=null,this._lastScrollTime=e.now(),e.EventSource.call(this),this.addHandler("open-failed",function(M){var H=e.getString("Errors.OpenFailed",M.eventSource,M.message);R._showMessage(H)}),e.ControlDock.call(this,d),this.xmlPath&&(this.tileSources=[this.xmlPath]),this.element=this.element||document.getElementById(this.id),this.canvas=e.makeNeutralElement("div"),this.canvas.className="openseadragon-canvas",function(M){M.width="100%",M.height="100%",M.overflow="hidden",M.position="absolute",M.top="0px",M.left="0px"}(this.canvas.style),e.setElementTouchActionNone(this.canvas),d.tabIndex!==""&&(this.canvas.tabIndex=d.tabIndex===void 0?0:d.tabIndex),this.container.className="openseadragon-container",function(M){M.width="100%",M.height="100%",M.position="relative",M.overflow="hidden",M.left="0px",M.top="0px",M.textAlign="left"}(this.container.style),e.setElementTouchActionNone(this.container),this.container.insertBefore(this.canvas,this.container.firstChild),this.element.appendChild(this.container),this.bodyWidth=document.body.style.width,this.bodyHeight=document.body.style.height,this.bodyOverflow=document.body.style.overflow,this.docOverflow=document.documentElement.style.overflow,this.innerTracker=new e.MouseTracker({userData:"Viewer.innerTracker",element:this.canvas,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,contextMenuHandler:e.delegate(this,T),keyDownHandler:e.delegate(this,y),keyHandler:e.delegate(this,w),clickHandler:e.delegate(this,S),dblClickHandler:e.delegate(this,C),dragHandler:e.delegate(this,L),dragEndHandler:e.delegate(this,D),enterHandler:e.delegate(this,j),leaveHandler:e.delegate(this,N),pressHandler:e.delegate(this,K),releaseHandler:e.delegate(this,se),nonPrimaryPressHandler:e.delegate(this,ue),nonPrimaryReleaseHandler:e.delegate(this,Se),scrollHandler:e.delegate(this,Ee),pinchHandler:e.delegate(this,Re)}),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,Me),leaveHandler:e.delegate(this,ge)}),this.toolbar&&(this.toolbar=new e.ControlDock({element:this.toolbar})),this.bindStandardControls(),n[this.hash].prevContainerSize=s(this.container),window.ResizeObserver?(this._autoResizePolling=!1,this._resizeObserver=new ResizeObserver(function(){n[R.hash].needsResize=!0}),this._resizeObserver.observe(this.container,{})):this._autoResizePolling=!0,this.world=new e.World({viewer:this}),this.world.addHandler("add-item",function(M){R.source=R.world.getItemAt(0).source,n[R.hash].forceRedraw=!0,R._updateRequestId||(R._updateRequestId=u(R,ne))}),this.world.addHandler("remove-item",function(M){R.world.getItemCount()?R.source=R.world.getItemAt(0).source:R.source=null,n[R.hash].forceRedraw=!0}),this.world.addHandler("metrics-change",function(M){R.viewport&&R.viewport._setContentBounds(R.world.getHomeBounds(),R.world.getContentFactor())}),this.world.addHandler("item-index-change",function(M){R.source=R.world.getItemAt(0).source}),this.viewport=new e.Viewport({containerSize:n[this.hash].prevContainerSize,springStiffness:this.springStiffness,animationTime:this.animationTime,minZoomImageRatio:this.minZoomImageRatio,maxZoomPixelRatio:this.maxZoomPixelRatio,visibilityRatio:this.visibilityRatio,wrapHorizontal:this.wrapHorizontal,wrapVertical:this.wrapVertical,defaultZoomLevel:this.defaultZoomLevel,minZoomLevel:this.minZoomLevel,maxZoomLevel:this.maxZoomLevel,viewer:this,degrees:this.degrees,flipped:this.flipped,navigatorRotate:this.navigatorRotate,homeFillsViewer:this.homeFillsViewer,margins:this.viewportMargins,silenceMultiImageWarnings:this.silenceMultiImageWarnings}),this.viewport._setContentBounds(this.world.getHomeBounds(),this.world.getContentFactor()),this.imageLoader=new e.ImageLoader({jobLimit:this.imageLoaderLimit,timeout:d.timeout}),this.tileCache=new e.TileCache({maxImageCacheCount:this.maxImageCacheCount}),this.drawer=new e.Drawer({viewer:this,viewport:this.viewport,element:this.canvas,debugGridColor:this.debugGridColor}),this.overlaysContainer=e.makeNeutralElement("div"),this.canvas.appendChild(this.overlaysContainer),this.drawer.canRotate()||(this.rotateLeft&&(A=this.buttonGroup.buttons.indexOf(this.rotateLeft),this.buttonGroup.buttons.splice(A,1),this.buttonGroup.element.removeChild(this.rotateLeft.element)),this.rotateRight&&(A=this.buttonGroup.buttons.indexOf(this.rotateRight),this.buttonGroup.buttons.splice(A,1),this.buttonGroup.element.removeChild(this.rotateRight.element))),this._addUpdatePixelDensityRatioEvent(),this.showNavigator&&(this.navigator=new e.Navigator({element:this.navigatorElement,id:this.navigatorId,position:this.navigatorPosition,sizeRatio:this.navigatorSizeRatio,maintainSizeRatio:this.navigatorMaintainSizeRatio,top:this.navigatorTop,left:this.navigatorLeft,width:this.navigatorWidth,height:this.navigatorHeight,autoResize:this.navigatorAutoResize,autoFade:this.navigatorAutoFade,prefixUrl:this.prefixUrl,viewer:this,navigatorRotate:this.navigatorRotate,background:this.navigatorBackground,opacity:this.navigatorOpacity,borderColor:this.navigatorBorderColor,displayRegionColor:this.navigatorDisplayRegionColor,crossOriginPolicy:this.crossOriginPolicy,animationTime:this.animationTime})),this.sequenceMode&&this.bindSequenceControls(),this.tileSources&&this.open(this.tileSources),A=0;A-1&&d.index=0&&d=0)return this;var H=o(this,M);return this.currentOverlays.push(H),H.drawHTML(this.overlaysContainer,this.viewport),this.raiseEvent("add-overlay",{element:d,location:M.location,placement:M.placement}),this},updateOverlay:function(d,_,R){var A;return d=e.getElement(d),A=l(this.currentOverlays,d),A>=0&&(this.currentOverlays[A].update(_,R),n[this.hash].forceRedraw=!0,this.raiseEvent("update-overlay",{element:d,location:_,placement:R})),this},removeOverlay:function(d){var _;return d=e.getElement(d),_=l(this.currentOverlays,d),_>=0&&(this.currentOverlays[_].destroy(),this.currentOverlays.splice(_,1),n[this.hash].forceRedraw=!0,this.raiseEvent("remove-overlay",{element:d})),this},clearOverlays:function(){for(;this.currentOverlays.length>0;)this.currentOverlays.pop().destroy();return n[this.hash].forceRedraw=!0,this.raiseEvent("clear-overlay",{}),this},getOverlayById:function(d){var _;return d=e.getElement(d),_=l(this.currentOverlays,d),_>=0?this.currentOverlays[_]:null},_updateSequenceButtons:function(d){this.nextButton&&(!this.tileSources||this.tileSources.length-1===d?this.navPrevNextWrap||this.nextButton.disable():this.nextButton.enable()),this.previousButton&&(d>0?this.previousButton.enable():this.navPrevNextWrap||this.previousButton.disable())},_showMessage:function(d){this._hideMessage();var _=e.makeNeutralElement("div");_.appendChild(document.createTextNode(d)),this.messageDiv=e.makeCenteredNode(_),e.addClass(this.messageDiv,"openseadragon-message"),this.container.appendChild(this.messageDiv)},_hideMessage:function(){var d=this.messageDiv;d&&(d.parentNode.removeChild(d),delete this.messageDiv)},gestureSettingsByDeviceType:function(d){switch(d){case"mouse":return this.gestureSettingsMouse;case"touch":return this.gestureSettingsTouch;case"pen":return this.gestureSettingsPen;default:return this.gestureSettingsUnknown}},_drawOverlays:function(){var d,_=this.currentOverlays.length;for(d=0;d<_;d++)this.currentOverlays[d].drawHTML(this.overlaysContainer,this.viewport)},_cancelPendingImages:function(){this._loadQueue=[]},removeReferenceStrip:function(){this.showReferenceStrip=!1,this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null)},addReferenceStrip:function(){if(this.showReferenceStrip=!0,this.sequenceMode){if(this.referenceStrip)return;this.tileSources.length&&this.tileSources.length>1&&(this.referenceStrip=new e.ReferenceStrip({id:this.referenceStripElement,position:this.referenceStripPosition,sizeRatio:this.referenceStripSizeRatio,scroll:this.referenceStripScroll,height:this.referenceStripHeight,width:this.referenceStripWidth,tileSources:this.tileSources,prefixUrl:this.prefixUrl,useCanvas:this.useCanvas,viewer:this}),this.referenceStrip.setFocus(this._sequenceIndex))}else e.console.warn('Attempting to display a reference strip while "sequenceMode" is off.')},_addUpdatePixelDensityRatioEvent:function(){this._updatePixelDensityRatioBind=this._updatePixelDensityRatio.bind(this),e.addEvent(window,"resize",this._updatePixelDensityRatioBind)},_removeUpdatePixelDensityRatioEvent:function(){e.removeEvent(window,"resize",this._updatePixelDensityRatioBind)},_updatePixelDensityRatio:function(){var d=e.pixelDensityRatio,_=e.getCurrentPixelDensityRatio();d!==_&&(e.pixelDensityRatio=_,this.world.resetItems(),this.forceRedraw())},goToPreviousPage:function(){var d=this._sequenceIndex-1;this.navPrevNextWrap&&d<0&&(d+=this.tileSources.length),this.goToPage(d)},goToNextPage:function(){var d=this._sequenceIndex+1;this.navPrevNextWrap&&d>=this.tileSources.length&&(d=0),this.goToPage(d)},isAnimating:function(){return n[this.hash].animating}});function s(d){return d=e.getElement(d),new e.Point(d.clientWidth===0?1:d.clientWidth,d.clientHeight===0?1:d.clientHeight)}function a(d,_,R,A,M){var H=d;if(e.type(_)==="string"){if(_.match(/^\s*<.*>\s*$/))_=e.parseXml(_);else if(_.match(/^\s*[{[].*[}\]]\s*$/))try{var z=e.parseJSON(_);_=z}catch{}}function G(te,I){te.ready?A(te):(te.addHandler("ready",function(){A(te)}),te.addHandler("open-failed",function(F){M({message:F.message,source:I})}))}setTimeout(function(){if(e.type(_)==="string")_=new e.TileSource({url:_,crossOriginPolicy:R.crossOriginPolicy!==void 0?R.crossOriginPolicy:d.crossOriginPolicy,ajaxWithCredentials:d.ajaxWithCredentials,ajaxHeaders:R.ajaxHeaders?R.ajaxHeaders:d.ajaxHeaders,splitHashDataForPost:d.splitHashDataForPost,useCanvas:d.useCanvas,success:function(V){A(V.tileSource)}}),_.addHandler("open-failed",function(V){M(V)});else if(e.isPlainObject(_)||_.nodeType)if(_.crossOriginPolicy===void 0&&(R.crossOriginPolicy!==void 0||d.crossOriginPolicy!==void 0)&&(_.crossOriginPolicy=R.crossOriginPolicy!==void 0?R.crossOriginPolicy:d.crossOriginPolicy),_.ajaxWithCredentials===void 0&&(_.ajaxWithCredentials=d.ajaxWithCredentials),_.useCanvas===void 0&&(_.useCanvas=d.useCanvas),e.isFunction(_.getTileUrl)){var te=new e.TileSource(_);te.getTileUrl=_.getTileUrl,A(te)}else{var I=e.TileSource.determineType(H,_);if(!I){M({message:"Unable to load TileSource",source:_});return}var F=I.prototype.configure.apply(H,[_]);G(new I(F),_)}else G(_,_)})}function o(d,_){if(_ instanceof e.Overlay)return _;var R=null;if(_.element)R=e.getElement(_.element);else{var A=_.id?_.id:"openseadragon-overlay-"+Math.floor(Math.random()*1e7);R=e.getElement(_.id),R||(R=document.createElement("a"),R.href="#/overlay/"+A),R.id=A,e.addClass(R,_.className?_.className:"openseadragon-overlay")}var M=_.location,H=_.width,z=_.height;if(!M){var G=_.x,te=_.y;if(_.px!==void 0){var I=d.viewport.imageToViewportRectangle(new e.Rect(_.px,_.py,H||0,z||0));G=I.x,te=I.y,H=H!==void 0?I.width:void 0,z=z!==void 0?I.height:void 0}M=new e.Point(G,te)}var F=_.placement;return F&&e.type(F)==="string"&&(F=e.Placement[_.placement.toUpperCase()]),new e.Overlay({element:R,location:M,placement:F,onDraw:_.onDraw,checkResize:_.checkResize,width:H,height:z,rotationMode:_.rotationMode})}function l(d,_){var R;for(R=d.length-1;R>=0;R--)if(d[R].element===_)return R;return-1}function u(d,_){return e.requestAnimationFrame(function(){_(d)})}function c(d){e.requestAnimationFrame(function(){f(d)})}function h(d){d.autoHideControls&&(d.controlsShouldFade=!0,d.controlsFadeBeginTime=e.now()+d.controlsFadeDelay,window.setTimeout(function(){c(d)},d.controlsFadeDelay))}function f(d){var _,R,A,M;if(d.controlsShouldFade){for(_=e.now(),R=_-d.controlsFadeBeginTime,A=1-R/d.controlsFadeLength,A=Math.min(1,A),A=Math.max(0,A),M=d.controls.length-1;M>=0;M--)d.controls[M].autoFade&&d.controls[M].setOpacity(A);A>0&&c(d)}}function p(d){var _;for(d.controlsShouldFade=!1,_=d.controls.length-1;_>=0;_--)d.controls[_].setOpacity(1)}function m(){p(this)}function b(){h(this)}function T(d){var _={tracker:d.eventSource,position:d.position,originalEvent:d.originalEvent,preventDefault:d.preventDefault};this.raiseEvent("canvas-contextmenu",_),d.preventDefault=_.preventDefault}function y(d){var _={originalEvent:d.originalEvent,preventDefaultAction:!1,preventVerticalPan:d.preventVerticalPan||!this.panVertical,preventHorizontalPan:d.preventHorizontalPan||!this.panHorizontal};if(this.raiseEvent("canvas-key",_),!_.preventDefaultAction&&!d.ctrl&&!d.alt&&!d.meta)switch(d.keyCode){case 38:_.preventVerticalPan||(d.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-this.pixelsPerArrowPress))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 40:_.preventVerticalPan||(d.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,this.pixelsPerArrowPress))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 37:_.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 39:_.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),d.preventDefault=!0;break;default:d.preventDefault=!1;break}else d.preventDefault=!1}function w(d){var _={originalEvent:d.originalEvent,preventDefaultAction:!1,preventVerticalPan:d.preventVerticalPan||!this.panVertical,preventHorizontalPan:d.preventHorizontalPan||!this.panHorizontal};if(this.raiseEvent("canvas-key",_),!_.preventDefaultAction&&!d.ctrl&&!d.alt&&!d.meta)switch(d.keyCode){case 43:case 61:this.viewport.zoomBy(1.1),this.viewport.applyConstraints(),d.preventDefault=!0;break;case 45:this.viewport.zoomBy(.9),this.viewport.applyConstraints(),d.preventDefault=!0;break;case 48:this.viewport.goHome(),this.viewport.applyConstraints(),d.preventDefault=!0;break;case 119:case 87:_.preventVerticalPan||(d.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-40))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 115:case 83:_.preventVerticalPan||(d.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,40))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 97:_.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-40,0))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 100:_.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(40,0))),this.viewport.applyConstraints()),d.preventDefault=!0;break;case 114:this.viewport.flipped?this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement):this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement),this.viewport.applyConstraints(),d.preventDefault=!0;break;case 82:this.viewport.flipped?this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement):this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement),this.viewport.applyConstraints(),d.preventDefault=!0;break;case 102:this.viewport.toggleFlip(),d.preventDefault=!0;break;case 106:this.goToPreviousPage();break;case 107:this.goToNextPage();break;default:d.preventDefault=!1;break}else d.preventDefault=!1}function S(d){var _,R=document.activeElement===this.canvas;R||this.canvas.focus(),this.viewport.flipped&&(d.position.x=this.viewport.getContainerSize().x-d.position.x);var A={tracker:d.eventSource,position:d.position,quick:d.quick,shift:d.shift,originalEvent:d.originalEvent,originalTarget:d.originalTarget,preventDefaultAction:!1};this.raiseEvent("canvas-click",A),!A.preventDefaultAction&&this.viewport&&d.quick&&(_=this.gestureSettingsByDeviceType(d.pointerType),_.clickToZoom===!0&&(this.viewport.zoomBy(d.shift?1/this.zoomPerClick:this.zoomPerClick,_.zoomToRefPoint?this.viewport.pointFromPixel(d.position,!0):null),this.viewport.applyConstraints()),_.dblClickDragToZoom&&(n[this.hash].draggingToZoom===!0?(n[this.hash].lastClickTime=null,n[this.hash].draggingToZoom=!1):n[this.hash].lastClickTime=e.now()))}function C(d){var _,R={tracker:d.eventSource,position:d.position,shift:d.shift,originalEvent:d.originalEvent,preventDefaultAction:!1};this.raiseEvent("canvas-double-click",R),!R.preventDefaultAction&&this.viewport&&(_=this.gestureSettingsByDeviceType(d.pointerType),_.dblClickToZoom&&(this.viewport.zoomBy(d.shift?1/this.zoomPerClick:this.zoomPerClick,_.zoomToRefPoint?this.viewport.pointFromPixel(d.position,!0):null),this.viewport.applyConstraints()))}function L(d){var _,R={tracker:d.eventSource,pointerType:d.pointerType,position:d.position,delta:d.delta,speed:d.speed,direction:d.direction,shift:d.shift,originalEvent:d.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag",R),_=this.gestureSettingsByDeviceType(d.pointerType),!R.preventDefaultAction&&this.viewport){if(_.dblClickDragToZoom&&n[this.hash].draggingToZoom){var A=Math.pow(this.zoomPerDblClickDrag,d.delta.y/50);this.viewport.zoomBy(A)}else if(_.dragToPan&&!n[this.hash].draggingToZoom){if(this.panHorizontal||(d.delta.x=0),this.panVertical||(d.delta.y=0),this.viewport.flipped&&(d.delta.x=-d.delta.x),this.constrainDuringPan){var M=this.viewport.deltaPointsFromPixels(d.delta.negate());this.viewport.centerSpringX.target.value+=M.x,this.viewport.centerSpringY.target.value+=M.y;var H=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=M.x,this.viewport.centerSpringY.target.value-=M.y,H.xConstrained&&(d.delta.x=0),H.yConstrained&&(d.delta.y=0)}this.viewport.panBy(this.viewport.deltaPointsFromPixels(d.delta.negate()),_.flickEnabled&&!this.constrainDuringPan)}}}function D(d){var _,R={tracker:d.eventSource,pointerType:d.pointerType,position:d.position,speed:d.speed,direction:d.direction,shift:d.shift,originalEvent:d.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag-end",R),_=this.gestureSettingsByDeviceType(d.pointerType),!R.preventDefaultAction&&this.viewport){if(!n[this.hash].draggingToZoom&&_.flickEnabled&&d.speed>=_.flickMinSpeed){var A=0;this.panHorizontal&&(A=_.flickMomentum*d.speed*Math.cos(d.direction));var M=0;this.panVertical&&(M=_.flickMomentum*d.speed*Math.sin(d.direction));var H=this.viewport.pixelFromPoint(this.viewport.getCenter(!0)),z=this.viewport.pointFromPixel(new e.Point(H.x-A,H.y-M));this.viewport.panTo(z,!1)}this.viewport.applyConstraints()}_.dblClickDragToZoom&&n[this.hash].draggingToZoom===!0&&(n[this.hash].draggingToZoom=!1)}function j(d){this.raiseEvent("canvas-enter",{tracker:d.eventSource,pointerType:d.pointerType,position:d.position,buttons:d.buttons,pointers:d.pointers,insideElementPressed:d.insideElementPressed,buttonDownAny:d.buttonDownAny,originalEvent:d.originalEvent})}function N(d){this.raiseEvent("canvas-exit",{tracker:d.eventSource,pointerType:d.pointerType,position:d.position,buttons:d.buttons,pointers:d.pointers,insideElementPressed:d.insideElementPressed,buttonDownAny:d.buttonDownAny,originalEvent:d.originalEvent})}function K(d){var _;if(this.raiseEvent("canvas-press",{tracker:d.eventSource,pointerType:d.pointerType,position:d.position,insideElementPressed:d.insideElementPressed,insideElementReleased:d.insideElementReleased,originalEvent:d.originalEvent}),_=this.gestureSettingsByDeviceType(d.pointerType),_.dblClickDragToZoom){var R=n[this.hash].lastClickTime,A=e.now();if(R===null)return;A-Rthis.minScrollDeltaTime?(this._lastScrollTime=M,_={tracker:d.eventSource,position:d.position,scroll:d.scroll,shift:d.shift,originalEvent:d.originalEvent,preventDefaultAction:!1,preventDefault:!0},this.raiseEvent("canvas-scroll",_),!_.preventDefaultAction&&this.viewport&&(this.viewport.flipped&&(d.position.x=this.viewport.getContainerSize().x-d.position.x),R=this.gestureSettingsByDeviceType(d.pointerType),R.scrollToZoom&&(A=Math.pow(this.zoomPerScroll,d.scroll),this.viewport.zoomBy(A,R.zoomToRefPoint?this.viewport.pointFromPixel(d.position,!0):null),this.viewport.applyConstraints())),d.preventDefault=_.preventDefault):d.preventDefault=!0}function Me(d){n[this.hash].mouseInside=!0,p(this),this.raiseEvent("container-enter",{tracker:d.eventSource,pointerType:d.pointerType,position:d.position,buttons:d.buttons,pointers:d.pointers,insideElementPressed:d.insideElementPressed,buttonDownAny:d.buttonDownAny,originalEvent:d.originalEvent})}function ge(d){d.pointers<1&&(n[this.hash].mouseInside=!1,n[this.hash].animating||h(this)),this.raiseEvent("container-exit",{tracker:d.eventSource,pointerType:d.pointerType,position:d.position,buttons:d.buttons,pointers:d.pointers,insideElementPressed:d.insideElementPressed,buttonDownAny:d.buttonDownAny,originalEvent:d.originalEvent})}function ne(d){re(d),d.isOpen()?d._updateRequestId=u(d,ne):d._updateRequestId=!1}function U(d,_){var R=d.viewport,A=R.getZoom(),M=R.getCenter();R.resize(_,d.preserveImageSizeOnResize),R.panTo(M,!0);var H;if(d.preserveImageSizeOnResize)H=n[d.hash].prevContainerSize.x/_.x;else{var z=new e.Point(0,0),G=new e.Point(n[d.hash].prevContainerSize.x,n[d.hash].prevContainerSize.y).distanceTo(z),te=new e.Point(_.x,_.y).distanceTo(z);H=te/G*n[d.hash].prevContainerSize.x/_.x}R.zoomTo(A*H,null,!0),n[d.hash].prevContainerSize=_,n[d.hash].forceRedraw=!0,n[d.hash].needsResize=!1,n[d.hash].forceResize=!1}function re(d){if(!(d._opening||!n[d.hash])){if(d.autoResize||n[d.hash].forceResize){var _;if(d._autoResizePolling){_=s(d.container);var R=n[d.hash].prevContainerSize;_.equals(R)||(n[d.hash].needsResize=!0)}n[d.hash].needsResize&&U(d,_||s(d.container))}var A=d.viewport.update(),M=d.world.update()||A;A&&d.raiseEvent("viewport-change"),d.referenceStrip&&(M=d.referenceStrip.update(d.viewport)||M);var H=n[d.hash].animating;!H&&M&&(d.raiseEvent("animation-start"),p(d));var z=H&&!M;z&&(n[d.hash].animating=!1),(M||z||n[d.hash].forceRedraw||d.world.needsDraw())&&(ce(d),d._drawOverlays(),d.navigator&&d.navigator.update(d.viewport),n[d.hash].forceRedraw=!1,M&&d.raiseEvent("animation")),z&&(d.raiseEvent("animation-finish"),n[d.hash].mouseInside||h(d)),n[d.hash].animating=M}}function ce(d){d.imageLoader.clear(),d.drawer.clear(),d.world.draw(),d.raiseEvent("update-viewport",{})}function Q(d,_){return d?d+_:_}function _e(){n[this.hash].lastZoomTime=e.now(),n[this.hash].zoomFactor=this.zoomPerSecond,n[this.hash].zooming=!0,Ie(this)}function He(){n[this.hash].lastZoomTime=e.now(),n[this.hash].zoomFactor=1/this.zoomPerSecond,n[this.hash].zooming=!0,Ie(this)}function Ve(){n[this.hash].zooming=!1}function Ie(d){e.requestAnimationFrame(e.delegate(d,xe))}function xe(){var d,_,R;n[this.hash].zooming&&this.viewport&&(d=e.now(),_=d-n[this.hash].lastZoomTime,R=Math.pow(n[this.hash].zoomFactor,_/1e3),this.viewport.zoomBy(R),this.viewport.applyConstraints(),n[this.hash].lastZoomTime=d,Ie(this))}function W(){this.viewport&&(n[this.hash].zooming=!1,this.viewport.zoomBy(this.zoomPerClick/1),this.viewport.applyConstraints())}function oe(){this.viewport&&(n[this.hash].zooming=!1,this.viewport.zoomBy(1/this.zoomPerClick),this.viewport.applyConstraints())}function ae(){this.buttonGroup&&(this.buttonGroup.emulateEnter(),this.buttonGroup.emulateLeave())}function he(){this.viewport&&this.viewport.goHome()}function ke(){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 Ce(){if(this.viewport){var d=this.viewport.getRotation();this.viewport.flipped?d+=this.rotationIncrement:d-=this.rotationIncrement,this.viewport.setRotation(d)}}function P(){if(this.viewport){var d=this.viewport.getRotation();this.viewport.flipped?d-=this.rotationIncrement:d+=this.rotationIncrement,this.viewport.setRotation(d)}}function O(){this.viewport.toggleFlip()}}(i),function(e){e.Navigator=function(u){var c=u.viewer,h=this,f,p;u.element||u.id?(u.element?(u.id&&e.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead."),u.element.id?u.id=u.element.id:u.id="navigator-"+e.now(),this.element=u.element):this.element=document.getElementById(u.id),u.controlOptions={anchor:e.ControlAnchor.NONE,attachToViewer:!1,autoFade:!1}):(u.id="navigator-"+e.now(),this.element=e.makeNeutralElement("div"),u.controlOptions={anchor:e.ControlAnchor.TOP_RIGHT,attachToViewer:!0,autoFade:u.autoFade},u.position&&(u.position==="BOTTOM_RIGHT"?u.controlOptions.anchor=e.ControlAnchor.BOTTOM_RIGHT:u.position==="BOTTOM_LEFT"?u.controlOptions.anchor=e.ControlAnchor.BOTTOM_LEFT:u.position==="TOP_RIGHT"?u.controlOptions.anchor=e.ControlAnchor.TOP_RIGHT:u.position==="TOP_LEFT"?u.controlOptions.anchor=e.ControlAnchor.TOP_LEFT:u.position==="ABSOLUTE"&&(u.controlOptions.anchor=e.ControlAnchor.ABSOLUTE,u.controlOptions.top=u.top,u.controlOptions.left=u.left,u.controlOptions.height=u.height,u.controlOptions.width=u.width))),this.element.id=u.id,this.element.className+=" navigator",u=e.extend(!0,{sizeRatio:e.DEFAULT_SETTINGS.navigatorSizeRatio},u,{element:this.element,tabIndex:-1,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:u.animationTime,autoResize:!1,minZoomImageRatio:1,background:u.background,opacity:u.opacity,borderColor:u.borderColor,displayRegionColor:u.displayRegionColor}),u.minPixelRatio=this.minPixelRatio=c.minPixelRatio,e.setElementTouchActionNone(this.element),this.borderWidth=2,this.fudge=new e.Point(1,1),this.totalBorderWidths=new e.Point(this.borderWidth*2,this.borderWidth*2).minus(this.fudge),u.controlOptions.anchor!==e.ControlAnchor.NONE&&function(T,y){T.margin="0px",T.border=y+"px solid "+u.borderColor,T.padding="0px",T.background=u.background,T.opacity=u.opacity,T.overflow="hidden"}(this.element.style,this.borderWidth),this.displayRegion=e.makeNeutralElement("div"),this.displayRegion.id=this.element.id+"-displayregion",this.displayRegion.className="displayregion",function(T,y){T.position="relative",T.top="0px",T.left="0px",T.fontSize="0px",T.overflow="hidden",T.border=y+"px solid "+u.displayRegionColor,T.margin="0px",T.padding="0px",T.background="transparent",T.float="left",T.cssFloat="left",T.styleFloat="left",T.zIndex=999999999,T.cursor="default"}(this.displayRegion.style,this.borderWidth),e.setElementPointerEventsNone(this.displayRegion),e.setElementTouchActionNone(this.displayRegion),this.displayRegionContainer=e.makeNeutralElement("div"),this.displayRegionContainer.id=this.element.id+"-displayregioncontainer",this.displayRegionContainer.className="displayregioncontainer",this.displayRegionContainer.style.width="100%",this.displayRegionContainer.style.height="100%",e.setElementPointerEventsNone(this.displayRegionContainer),e.setElementTouchActionNone(this.displayRegionContainer),c.addControl(this.element,u.controlOptions),this._resizeWithViewer=u.controlOptions.anchor!==e.ControlAnchor.ABSOLUTE&&u.controlOptions.anchor!==e.ControlAnchor.NONE,u.width&&u.height?(this.setWidth(u.width),this.setHeight(u.height)):this._resizeWithViewer&&(f=e.getElementSize(c.element),this.element.style.height=Math.round(f.y*u.sizeRatio)+"px",this.element.style.width=Math.round(f.x*u.sizeRatio)+"px",this.oldViewerSize=f,p=e.getElementSize(this.element),this.elementArea=p.x*p.y),this.oldContainerSize=new e.Point(0,0),e.Viewer.apply(this,[u]),this.displayRegionContainer.appendChild(this.displayRegion),this.element.getElementsByTagName("div")[0].appendChild(this.displayRegionContainer);function m(T){o(h.displayRegionContainer,T),o(h.displayRegion,-T),h.viewport.setRotation(T)}if(u.navigatorRotate){var b=u.viewer.viewport?u.viewer.viewport.getRotation():u.viewer.degrees||0;m(b),u.viewer.addHandler("rotate",function(T){m(T.degrees)})}this.innerTracker.destroy(),this.innerTracker=new e.MouseTracker({userData:"Navigator.innerTracker",element:this.element,dragHandler:e.delegate(this,r),clickHandler:e.delegate(this,n),releaseHandler:e.delegate(this,s),scrollHandler:e.delegate(this,a),preProcessEventHandler:function(T){T.eventType==="wheel"&&(T.preventDefault=!0)}}),this.outerTracker.userData="Navigator.outerTracker",e.setElementPointerEventsNone(this.canvas),e.setElementPointerEventsNone(this.container),this.addHandler("reset-size",function(){h.viewport&&h.viewport.goHome(!0)}),c.world.addHandler("item-index-change",function(T){window.setTimeout(function(){var y=h.world.getItemAt(T.previousIndex);h.world.setItemIndex(y,T.newIndex)},1)}),c.world.addHandler("remove-item",function(T){var y=T.item,w=h._getMatchingItem(y);w&&h.world.removeItem(w)}),this.update(c.viewport)},e.extend(e.Navigator.prototype,e.EventSource.prototype,e.Viewer.prototype,{updateSize:function(){if(this.viewport){var u=new e.Point(this.container.clientWidth===0?1:this.container.clientWidth,this.container.clientHeight===0?1:this.container.clientHeight);u.equals(this.oldContainerSize)||(this.viewport.resize(u,!0),this.viewport.goHome(!0),this.oldContainerSize=u,this.drawer.clear(),this.world.draw())}},setWidth:function(u){this.width=u,this.element.style.width=typeof u=="number"?u+"px":u,this._resizeWithViewer=!1},setHeight:function(u){this.height=u,this.element.style.height=typeof u=="number"?u+"px":u,this._resizeWithViewer=!1},setFlip:function(u){return this.viewport.setFlip(u),this.setDisplayTransform(this.viewer.viewport.getFlip()?"scale(-1,1)":"scale(1,1)"),this},setDisplayTransform:function(u){l(this.displayRegion,u),l(this.canvas,u),l(this.element,u)},update:function(u){var c,h,f,p,m,b;if(c=e.getElementSize(this.viewer.element),this._resizeWithViewer&&c.x&&c.y&&!c.equals(this.oldViewerSize)&&(this.oldViewerSize=c,this.maintainSizeRatio||!this.elementArea?(h=c.x*this.sizeRatio,f=c.y*this.sizeRatio):(h=Math.sqrt(this.elementArea*(c.x/c.y)),f=this.elementArea/h),this.element.style.width=Math.round(h)+"px",this.element.style.height=Math.round(f)+"px",this.elementArea||(this.elementArea=h*f),this.updateSize()),u&&this.viewport){p=u.getBoundsNoRotate(!0),m=this.viewport.pixelFromPointNoRotate(p.getTopLeft(),!1),b=this.viewport.pixelFromPointNoRotate(p.getBottomRight(),!1).minus(this.totalBorderWidths);var T=this.displayRegion.style;T.display=this.world.getItemCount()?"block":"none",T.top=Math.round(m.y)+"px",T.left=Math.round(m.x)+"px";var y=Math.abs(m.x-b.x),w=Math.abs(m.y-b.y);T.width=Math.round(Math.max(y,0))+"px",T.height=Math.round(Math.max(w,0))+"px"}},addTiledImage:function(u){var c=this,h=u.originalTiledImage;delete u.original;var f=e.extend({},u,{success:function(p){var m=p.item;m._originalForNavigator=h,c._matchBounds(m,h,!0),c._matchOpacity(m,h),c._matchCompositeOperation(m,h);function b(){c._matchBounds(m,h)}function T(){c._matchOpacity(m,h)}function y(){c._matchCompositeOperation(m,h)}h.addHandler("bounds-change",b),h.addHandler("clip-change",b),h.addHandler("opacity-change",T),h.addHandler("composite-operation-change",y)}});return e.Viewer.prototype.addTiledImage.apply(this,[f])},destroy:function(){return e.Viewer.prototype.destroy.apply(this)},_getMatchingItem:function(u){for(var c=this.world.getItemCount(),h,f=0;f1||s.y>1));r++);return r-1},getTileAtPoint:function(r,s){var a=s.x>=0&&s.x<=1&&s.y>=0&&s.y<=1/this.aspectRatio;e.console.assert(a,"[TileSource.getTileAtPoint] must be called with a valid point.");var o=this.dimensions.x*this.getLevelScale(r),l=s.x*o,u=s.y*o,c=Math.floor(l/this.getTileWidth(r)),h=Math.floor(u/this.getTileHeight(r));s.x>=1&&(c=this.getNumTiles(r).x-1);var f=1e-15;return s.y>=1/this.aspectRatio-f&&(h=this.getNumTiles(r).y-1),new e.Point(c,h)},getTileBounds:function(r,s,a,o){var l=this.dimensions.times(this.getLevelScale(r)),u=this.getTileWidth(r),c=this.getTileHeight(r),h=s===0?0:u*s-this.tileOverlap,f=a===0?0:c*a-this.tileOverlap,p=u+(s===0?1:2)*this.tileOverlap,m=c+(a===0?1:2)*this.tileOverlap,b=1/l.x;return p=Math.min(p,l.x-h),m=Math.min(m,l.y-f),o?new e.Rect(0,0,p,m):new e.Rect(h*b,f*b,p*b,m*b)},getImageInfo:function(r){var s=this,a,o,l,u,c,h,f;r&&(c=r.split("/"),h=c[c.length-1],f=h.lastIndexOf("."),f>-1&&(c[c.length-1]=h.slice(0,f)));var p=null;if(this.splitHashDataForPost){var m=r.indexOf("#");m!==-1&&(p=r.substring(m+1),r=r.substr(0,m))}o=function(b){typeof b=="string"&&(b=e.parseXml(b));var T=e.TileSource.determineType(s,b,r);if(!T){s.raiseEvent("open-failed",{message:"Unable to load TileSource",source:r});return}u=T.prototype.configure.apply(s,[b,r,p]),u.ajaxWithCredentials===void 0&&(u.ajaxWithCredentials=s.ajaxWithCredentials),l=new T(u),s.ready=!0,s.raiseEvent("ready",{tileSource:l})},r.match(/\.js$/)?(a=r.split("/").pop().replace(".js",""),e.jsonp({url:r,async:!1,callbackName:a,callback:o})):e.makeAjaxRequest({url:r,postData:p,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(b){var T=n(b);o(T)},error:function(b,T){var y;try{y="HTTP "+b.status+" attempting to load TileSource: "+r}catch{var w;typeof T>"u"||!T.toString?w="Unknown error":w=T.toString(),y=w+" attempting to load TileSource: "+r}e.console.error(y),s.raiseEvent("open-failed",{message:y,source:r,postData:p})}})},supports:function(r,s){return!1},configure:function(r,s,a){throw new Error("Method not implemented.")},getTileUrl:function(r,s,a){throw new Error("Method not implemented.")},getTilePostData:function(r,s,a){return null},getTileAjaxHeaders:function(r,s,a){return{}},getTileHashKey:function(r,s,a,o,l,u){function c(h){return l?h+"+"+JSON.stringify(l):h}return c(typeof o!="string"?r+"/"+s+"_"+a:o)},tileExists:function(r,s,a){var o=this.getNumTiles(r);return r>=this.minLevel&&r<=this.maxLevel&&s>=0&&a>=0&&s=0;m--)for(b=this.displayRects[m],T=b.minLevel;T<=b.maxLevel;T++)this._levelRects[T]||(this._levelRects[T]=[]),this._levelRects[T].push(b);e.TileSource.apply(this,[y])},e.extend(e.DziTileSource.prototype,e.TileSource.prototype,{supports:function(s,a){var o;return s.Image?o=s.Image.xmlns:s.documentElement&&(s.documentElement.localName==="Image"||s.documentElement.tagName==="Image")&&(o=s.documentElement.namespaceURI),o=(o||"").toLowerCase(),o.indexOf("schemas.microsoft.com/deepzoom/2008")!==-1||o.indexOf("schemas.microsoft.com/deepzoom/2009")!==-1},configure:function(s,a,o){var l;return e.isPlainObject(s)?l=r(this,s):l=n(this,s),a&&!l.tilesUrl&&(l.tilesUrl=a.replace(/([^/]+?)(\.(dzi|xml|js)?(\?[^/]*)?)?\/?$/,"$1_files/"),a.search(/\.(dzi|xml|js)\?/)!==-1?l.queryParams=a.match(/\?.*/):l.queryParams=""),l},getTileUrl:function(s,a,o){return[this.tilesUrl,s,"/",a,"_",o,".",this.fileFormat,this.queryParams].join("")},tileExists:function(s,a,o){var l=this._levelRects[s],u,c,h,f,p,m,b;if(this.minLevel&&sthis.maxLevel)return!1;if(!l||!l.length)return!0;for(b=l.length-1;b>=0;b--)if(u=l[b],!(su.maxLevel)&&(c=this.getLevelScale(s),h=u.x*c,f=u.y*c,p=h+u.width*c,m=f+u.height*c,h=Math.floor(h/this._tileWidth),f=Math.floor(f/this._tileWidth),p=Math.ceil(p/this._tileWidth),m=Math.ceil(m/this._tileWidth),h<=a&&a0?o.tileSize=Math.max.apply(null,p):o.tileSize=h}else this.sizes&&this.sizes.length>0?(this.emulateLegacyImagePyramid=!0,o.levels=r(this),e.extend(!0,o,{width:o.levels[o.levels.length-1].width,height:o.levels[o.levels.length-1].height,tileSize:Math.max(o.height,o.width),tileOverlap:0,minLevel:0,maxLevel:o.levels.length-1}),this.levels=o.levels):e.console.error("Nothing in the info.json to construct image pyramids from");if(!o.maxLevel&&!this.emulateLegacyImagePyramid)if(!this.scale_factors)o.maxLevel=Number(Math.round(Math.log(Math.max(this.width,this.height),2)));else{var b=Math.max.apply(null,this.scale_factors);o.maxLevel=Math.round(Math.log(b)*Math.LOG2E)}e.TileSource.apply(this,[o])},e.extend(e.IIIFTileSource.prototype,e.TileSource.prototype,{supports:function(o,l){return o.protocol&&o.protocol==="http://iiif.io/api/image"||o["@context"]&&(o["@context"]==="http://library.stanford.edu/iiif/image-api/1.1/context.json"||o["@context"]==="http://iiif.io/api/image/1/context.json")||o.profile&&o.profile.indexOf("http://library.stanford.edu/iiif/image-api/compliance.html")===0||o.identifier&&o.width&&o.height?!0:!!(o.documentElement&&o.documentElement.tagName==="info"&&o.documentElement.namespaceURI==="http://library.stanford.edu/iiif/image-api/ns/")},configure:function(o,l,u){if(e.isPlainObject(o)){if(!o["@context"])o["@context"]="http://iiif.io/api/image/1.0/context.json",o["@id"]=l.replace("/info.json",""),o.version=1;else{var h=o["@context"];if(Array.isArray(h)){for(var f=0;f0&&o>=this.minLevel&&o<=this.maxLevel&&(l=this.levels[o].width/this.levels[this.maxLevel].width),l}return e.TileSource.prototype.getLevelScale.call(this,o)},getNumTiles:function(o){if(this.emulateLegacyImagePyramid){var l=this.getLevelScale(o);return l?new e.Point(1,1):new e.Point(0,0)}return e.TileSource.prototype.getNumTiles.call(this,o)},getTileAtPoint:function(o,l){return this.emulateLegacyImagePyramid?new e.Point(0,0):e.TileSource.prototype.getTileAtPoint.call(this,o,l)},getTileUrl:function(o,l,u){if(this.emulateLegacyImagePyramid){var c=null;return this.levels.length>0&&o>=this.minLevel&&o<=this.maxLevel&&(c=this.levels[o].url),c}var h="0",f=Math.pow(.5,this.maxLevel-o),p=Math.round(this.width*f),m=Math.round(this.height*f),b,T,y,w,S,C,L,D,j,N,K,se,ue,Se;return b=this.getTileWidth(o),T=this.getTileHeight(o),y=Math.round(b/f),w=Math.round(T/f),this.version===1?ue="native."+this.tileFormat:ue="default."+this.tileFormat,p1&&o.profile[1].supports&&(h=o.profile[1].supports.indexOf("sizeByW")!==-1),o.version===3&&o.extraFeatures&&(h=o.extraFeatures.indexOf("sizeByWh")!==-1),!c||h}function r(o){for(var l=[],u=0;uc?h=u/256:h=c/256,l.maxLevel=Math.ceil(Math.log(h)/Math.log(2))-1,l.tileSize=256,l.width=u,l.height=c,e.TileSource.apply(this,[l])},e.extend(e.TmsTileSource.prototype,e.TileSource.prototype,{supports:function(n,r){return n.type&&n.type==="tiledmapservice"},configure:function(n,r,s){return n},getTileUrl:function(n,r,s){var a=this.getNumTiles(n).y-1;return this.tilesUrl+n+"/"+r+"/"+(a-s)+".png"}})}(i),function(e){e.ZoomifyTileSource=function(n){typeof n.tileSize>"u"&&(n.tileSize=256),typeof n.fileFormat>"u"&&(n.fileFormat="jpg",this.fileFormat=n.fileFormat);var r={x:n.width,y:n.height};for(n.imageSizes=[{x:n.width,y:n.height}],n.gridSize=[this._getGridSize(n.width,n.height,n.tileSize)];parseInt(r.x,10)>n.tileSize||parseInt(r.y,10)>n.tileSize;)r.x=Math.floor(r.x/2),r.y=Math.floor(r.y/2),n.imageSizes.push({x:r.x,y:r.y}),n.gridSize.push(this._getGridSize(r.x,r.y,n.tileSize));n.imageSizes.reverse(),n.gridSize.reverse(),n.minLevel=0,n.maxLevel=n.gridSize.length-1,i.TileSource.apply(this,[n])},e.extend(e.ZoomifyTileSource.prototype,e.TileSource.prototype,{_getGridSize:function(n,r,s){return{x:Math.ceil(n/s),y:Math.ceil(r/s)}},_calculateAbsoluteTileNumber:function(n,r,s){for(var a=0,o={},l=0;l0?(l=o.levels[o.levels.length-1].width,u=o.levels[o.levels.length-1].height):(l=0,u=0,e.console.error("No supported image formats found")),e.extend(!0,o,{width:l,height:u,tileSize:Math.max(u,l),tileOverlap:0,minLevel:0,maxLevel:o.levels.length>0?o.levels.length-1:0}),e.TileSource.apply(this,[o]),this.levels=o.levels},e.extend(e.LegacyTileSource.prototype,e.TileSource.prototype,{supports:function(a,o){return a.type&&a.type==="legacy-image-pyramid"||a.documentElement&&a.documentElement.getAttribute("type")==="legacy-image-pyramid"},configure:function(a,o,l){var u;return e.isPlainObject(a)?u=s(this,a):u=r(this,a),u},getLevelScale:function(a){var o=NaN;return this.levels.length>0&&a>=this.minLevel&&a<=this.maxLevel&&(o=this.levels[a].width/this.levels[this.maxLevel].width),o},getNumTiles:function(a){var o=this.getLevelScale(a);return o?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(a,o,l){var u=null;return this.levels.length>0&&a>=this.minLevel&&a<=this.maxLevel&&(u=this.levels[a].url),u}});function n(a){var o=[],l,u;for(u=0;u");return o.sort(function(c,h){return c.height-h.height})}function r(a,o){if(!o||!o.documentElement)throw new Error(e.getString("Errors.Xml"));var l=o.documentElement,u=l.tagName,c=null,h=[],f,p;if(u==="image")try{for(c={type:l.getAttribute("type"),levels:[]},h=l.getElementsByTagName("level"),p=0;p=this.minLevel&&n<=this.maxLevel&&(r=this.levels[n].width/this.levels[this.maxLevel].width),r},getNumTiles:function(n){var r=this.getLevelScale(n);return r?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(n,r,s){var a=null;return n>=this.minLevel&&n<=this.maxLevel&&(a=this.levels[n].url),a},getContext2D:function(n,r,s){var a=null;return n>=this.minLevel&&n<=this.maxLevel&&(a=this.levels[n].context2D),a},destroy:function(){this._freeupCanvasMemory()},_buildLevels:function(){var n=[{url:this._image.src,width:this._image.naturalWidth,height:this._image.naturalHeight}];if(!this.buildPyramid||!e.supportsCanvas||!this.useCanvas)return delete this._image,n;var r=this._image.naturalWidth,s=this._image.naturalHeight,a=document.createElement("canvas"),o=a.getContext("2d");if(a.width=r,a.height=s,o.drawImage(this._image,0,0,r,s),n[0].context2D=o,delete this._image,e.isCanvasTainted(a))return n;for(;r>=2&&s>=2;){r=Math.floor(r/2),s=Math.floor(s/2);var l=document.createElement("canvas"),u=l.getContext("2d");l.width=r,l.height=s,u.drawImage(a,0,0,r,s),n.splice(0,0,{context2D:u,width:r,height:s}),a=l,o=u}return n},_freeupCanvasMemory:function(){for(var n=0;n0&&n(u))}function s(u){u.shouldFade=!0,u.fadeBeginTime=e.now()+u.fadeDelay,window.setTimeout(function(){n(u)},u.fadeDelay)}function a(u){u.shouldFade=!1,u.imgGroup&&e.setElementOpacity(u.imgGroup,1,!0)}function o(u,c){u.element.disabled||(c>=e.ButtonState.GROUP&&u.currentState===e.ButtonState.REST&&(a(u),u.currentState=e.ButtonState.GROUP),c>=e.ButtonState.HOVER&&u.currentState===e.ButtonState.GROUP&&(u.imgHover&&(u.imgHover.style.visibility=""),u.currentState=e.ButtonState.HOVER),c>=e.ButtonState.DOWN&&u.currentState===e.ButtonState.HOVER&&(u.imgDown&&(u.imgDown.style.visibility=""),u.currentState=e.ButtonState.DOWN))}function l(u,c){u.element.disabled||(c<=e.ButtonState.HOVER&&u.currentState===e.ButtonState.DOWN&&(u.imgDown&&(u.imgDown.style.visibility="hidden"),u.currentState=e.ButtonState.HOVER),c<=e.ButtonState.GROUP&&u.currentState===e.ButtonState.HOVER&&(u.imgHover&&(u.imgHover.style.visibility="hidden"),u.currentState=e.ButtonState.GROUP),c<=e.ButtonState.REST&&u.currentState===e.ButtonState.GROUP&&(s(u),u.currentState=e.ButtonState.REST))}}(i),function(e){e.ButtonGroup=function(n){e.extend(!0,this,{buttons:[],clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},n);var r=this.buttons.concat([]),s=this,a;if(this.element=n.element||e.makeNeutralElement("div"),!n.group)for(this.element.style.display="inline-block",a=0;a=270?(l=this.getTopRight(),this.x=l.x,this.y=l.y,u=this.height,this.height=this.width,this.width=u,this.degrees-=270):this.degrees>=180?(l=this.getBottomRight(),this.x=l.x,this.y=l.y,this.degrees-=180):this.degrees>=90&&(l=this.getBottomLeft(),this.x=l.x,this.y=l.y,u=this.height,this.height=this.width,this.width=u,this.degrees-=90)},e.Rect.fromSummits=function(n,r,s){var a=n.distanceTo(r),o=n.distanceTo(s),l=r.minus(n),u=Math.atan(l.y/l.x);return l.x<0?u+=Math.PI:l.y<0&&(u+=2*Math.PI),new e.Rect(n.x,n.y,a,o,u/Math.PI*180)},e.Rect.prototype={clone:function(){return new e.Rect(this.x,this.y,this.width,this.height,this.degrees)},getAspectRatio:function(){return this.width/this.height},getTopLeft:function(){return new e.Point(this.x,this.y)},getBottomRight:function(){return new e.Point(this.x+this.width,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getTopRight:function(){return new e.Point(this.x+this.width,this.y).rotate(this.degrees,this.getTopLeft())},getBottomLeft:function(){return new e.Point(this.x,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getCenter:function(){return new e.Point(this.x+this.width/2,this.y+this.height/2).rotate(this.degrees,this.getTopLeft())},getSize:function(){return new e.Point(this.width,this.height)},equals:function(n){return n instanceof e.Rect&&this.x===n.x&&this.y===n.y&&this.width===n.width&&this.height===n.height&&this.degrees===n.degrees},times:function(n){return new e.Rect(this.x*n,this.y*n,this.width*n,this.height*n,this.degrees)},translate:function(n){return new e.Rect(this.x+n.x,this.y+n.y,this.width,this.height,this.degrees)},union:function(n){var r=this.getBoundingBox(),s=n.getBoundingBox(),a=Math.min(r.x,s.x),o=Math.min(r.y,s.y),l=Math.max(r.x+r.width,s.x+s.width),u=Math.max(r.y+r.height,s.y+s.height);return new e.Rect(a,o,l-a,u-o)},intersection:function(n){var r=1e-10,s=[],a=this.getTopLeft();n.containsPoint(a,r)&&s.push(a);var o=this.getTopRight();n.containsPoint(o,r)&&s.push(o);var l=this.getBottomLeft();n.containsPoint(l,r)&&s.push(l);var u=this.getBottomRight();n.containsPoint(u,r)&&s.push(u);var c=n.getTopLeft();this.containsPoint(c,r)&&s.push(c);var h=n.getTopRight();this.containsPoint(h,r)&&s.push(h);var f=n.getBottomLeft();this.containsPoint(f,r)&&s.push(f);var p=n.getBottomRight();this.containsPoint(p,r)&&s.push(p);for(var m=this._getSegments(),b=n._getSegments(),T=0;Tj&&(j=ue.x),ue.yK&&(K=ue.y)}return new e.Rect(D,N,j-D,K-N)},_getSegments:function(){var n=this.getTopLeft(),r=this.getTopRight(),s=this.getBottomLeft(),a=this.getBottomRight();return[[n,r],[r,a],[a,s],[s,n]]},rotate:function(n,r){if(n=e.positiveModulo(n,360),n===0)return this.clone();r=r||this.getCenter();var s=this.getTopLeft().rotate(n,r),a=this.getTopRight().rotate(n,r),o=a.minus(s);o=o.apply(function(u){var c=1e-15;return Math.abs(u)=-r&&(n.x-a.x)*l.x+(n.y-a.y)*l.y<=r&&(n.x-s.x)*u.x+(n.y-s.y)*u.y>=-r&&(n.x-o.x)*u.x+(n.y-o.y)*u.y<=r},toString:function(){return"["+Math.round(this.x*100)/100+", "+Math.round(this.y*100)/100+", "+Math.round(this.width*100)/100+"x"+Math.round(this.height*100)/100+", "+Math.round(this.degrees*100)/100+"deg]"}}}(i),function(e){var n={};e.ReferenceStrip=function(f){var p=this,m=f.viewer,b=e.getElementSize(m.element),T,y,w;for(f.id||(f.id="referencestrip-"+e.now(),this.element=e.makeNeutralElement("div"),this.element.id=f.id,this.element.className="referencestrip"),f=e.extend(!0,{sizeRatio:e.DEFAULT_SETTINGS.referenceStripSizeRatio,position:e.DEFAULT_SETTINGS.referenceStripPosition,scroll:e.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold},f,{element:this.element}),e.extend(this,f),n[this.id]={animating:!1},this.minPixelRatio=this.viewer.minPixelRatio,this.element.tabIndex=0,y=this.element.style,y.marginTop="0px",y.marginRight="0px",y.marginBottom="0px",y.marginLeft="0px",y.left="0px",y.bottom="0px",y.border="0px",y.background="#000",y.position="relative",e.setElementTouchActionNone(this.element),e.setElementOpacity(this.element,.8),this.viewer=m,this.tracker=new e.MouseTracker({userData:"ReferenceStrip.tracker",element:this.element,clickHandler:e.delegate(this,r),dragHandler:e.delegate(this,s),scrollHandler:e.delegate(this,a),enterHandler:e.delegate(this,l),leaveHandler:e.delegate(this,u),keyDownHandler:e.delegate(this,c),keyHandler:e.delegate(this,h),preProcessEventHandler:function(S){S.eventType==="wheel"&&(S.preventDefault=!0)}}),f.width&&f.height?(this.element.style.width=f.width+"px",this.element.style.height=f.height+"px",m.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})):f.scroll==="horizontal"?(this.element.style.width=b.x*f.sizeRatio*m.tileSources.length+12*m.tileSources.length+"px",this.element.style.height=b.y*f.sizeRatio+"px",m.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})):(this.element.style.height=b.y*f.sizeRatio*m.tileSources.length+12*m.tileSources.length+"px",this.element.style.width=b.x*f.sizeRatio+"px",m.addControl(this.element,{anchor:e.ControlAnchor.TOP_LEFT})),this.panelWidth=b.x*this.sizeRatio+8,this.panelHeight=b.y*this.sizeRatio+8,this.panels=[],this.miniViewers={},w=0;wy+m.x-this.panelWidth?(S=Math.min(S,b-m.x),this.element.style.marginLeft=-S+"px",o(this,m.x,-S)):Sw+m.y-this.panelHeight?(S=Math.min(S,T-m.y),this.element.style.marginTop=-S+"px",o(this,m.y,-S)):S0?p>-(b-y.x)&&(this.element.style.marginLeft=p+f.delta.x*2+"px",o(this,y.x,p+f.delta.x*2)):-f.delta.x<0&&p<0&&(this.element.style.marginLeft=p+f.delta.x*2+"px",o(this,y.x,p+f.delta.x*2)):-f.delta.y>0?m>-(T-y.y)&&(this.element.style.marginTop=m+f.delta.y*2+"px",o(this,y.y,m+f.delta.y*2)):-f.delta.y<0&&m<0&&(this.element.style.marginTop=m+f.delta.y*2+"px",o(this,y.y,m+f.delta.y*2))}}function a(f){if(this.element){var p=Number(this.element.style.marginLeft.replace("px","")),m=Number(this.element.style.marginTop.replace("px","")),b=Number(this.element.style.width.replace("px","")),T=Number(this.element.style.height.replace("px","")),y=e.getElementSize(this.viewer.canvas);this.scroll==="horizontal"?f.scroll>0?p>-(b-y.x)&&(this.element.style.marginLeft=p-f.scroll*60+"px",o(this,y.x,p-f.scroll*60)):f.scroll<0&&p<0&&(this.element.style.marginLeft=p-f.scroll*60+"px",o(this,y.x,p-f.scroll*60)):f.scroll<0?m>y.y-T&&(this.element.style.marginTop=m+f.scroll*60+"px",o(this,y.y,m+f.scroll*60)):f.scroll>0&&m<0&&(this.element.style.marginTop=m+f.scroll*60+"px",o(this,y.y,m+f.scroll*60)),f.preventDefault=!0}}function o(f,p,m){var b,T,y,w,S,C;for(f.scroll==="horizontal"?b=f.panelWidth:b=f.panelHeight,T=Math.ceil(p/b)+5,y=Math.ceil((Math.abs(m)+p)/b)+1,T=y-T,T=T<0?0:T,S=T;S1?s[1].springStiffness:5,animationTime:s.length>1?s[1].animationTime:1.5}),e.console.assert(typeof r.springStiffness=="number"&&r.springStiffness!==0,"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number"),e.console.assert(typeof r.animationTime=="number"&&r.animationTime>=0,"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0"),r.exponential&&(this._exponential=!0,delete r.exponential),e.extend(!0,this,r),this.current={value:typeof this.initial=="number"?this.initial:this._exponential?0:1,time:e.now()},e.console.assert(!this._exponential||this.current.value!==0,"[OpenSeadragon.Spring] value must be non-zero for exponential springs"),this.start={value:this.current.value,time:this.current.time},this.target={value:this.current.value,time:this.current.time},this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},e.Spring.prototype={resetTo:function(r){e.console.assert(!this._exponential||r!==0,"[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs"),this.start.value=this.target.value=this.current.value=r,this.start.time=this.target.time=this.current.time=e.now(),this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},springTo:function(r){e.console.assert(!this._exponential||r!==0,"[OpenSeadragon.Spring.springTo] target must be non-zero for exponential springs"),this.start.value=this.current.value,this.start.time=this.current.time,this.target.value=r,this.target.time=this.start.time+1e3*this.animationTime,this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value))},shiftBy:function(r){this.start.value+=r,this.target.value+=r,this._exponential&&(e.console.assert(this.target.value!==0&&this.start.value!==0,"[OpenSeadragon.Spring.shiftBy] spring value must be non-zero for exponential springs"),this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value))},setExponential:function(r){this._exponential=r,this._exponential&&(e.console.assert(this.current.value!==0&&this.target.value!==0&&this.start.value!==0,"[OpenSeadragon.Spring.setExponential] spring value must be non-zero for exponential springs"),this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},update:function(){this.current.time=e.now();var r,s;this._exponential?(r=this.start._logValue,s=this.target._logValue):(r=this.start.value,s=this.target.value);var a=this.current.time>=this.target.time?s:r+(s-r)*n(this.springStiffness,(this.current.time-this.start.time)/(this.target.time-this.start.time)),o=this.current.value;return this._exponential?this.current.value=Math.exp(a):this.current.value=a,o!==this.current.value},isAtTargetValue:function(){return this.current.value===this.target.value}};function n(r,s){return(1-Math.exp(r*-s))/(1-Math.exp(-r))}}(i),function(e){e.ImageJob=function(r){e.extend(!0,this,{timeout:e.DEFAULT_SETTINGS.timeout,jobId:null},r),this.data=null,this.userData={},this.errorMsg=null},e.ImageJob.prototype={start:function(){var r=this,s=this.abort;this.jobId=window.setTimeout(function(){r.finish(null,null,"Image load exceeded timeout ("+r.timeout+" ms)")},this.timeout),this.abort=function(){r.source.downloadTileAbort(r),typeof s=="function"&&s()},this.source.downloadTileStart(this)},finish:function(r,s,a){this.data=r,this.request=s,this.errorMsg=a,this.jobId&&window.clearTimeout(this.jobId),this.callback(this)}},e.ImageLoader=function(r){e.extend(!0,this,{jobLimit:e.DEFAULT_SETTINGS.imageLoaderLimit,timeout:e.DEFAULT_SETTINGS.timeout,jobQueue:[],jobsInProgress:0},r)},e.ImageLoader.prototype={addJob:function(r){if(!r.source){e.console.error("ImageLoader.prototype.addJob() requires [options.source]. TileSource since new API defines how images are fetched. Creating a dummy TileSource.");var s=e.TileSource.prototype;r.source={downloadTileStart:s.downloadTileStart,downloadTileAbort:s.downloadTileAbort}}var a=this,o=function(c){n(a,c,r.callback)},l={src:r.src,tile:r.tile||{},source:r.source,loadWithAjax:r.loadWithAjax,ajaxHeaders:r.loadWithAjax?r.ajaxHeaders:null,crossOriginPolicy:r.crossOriginPolicy,ajaxWithCredentials:r.ajaxWithCredentials,postData:r.postData,callback:o,abort:r.abort,timeout:this.timeout},u=new e.ImageJob(l);!this.jobLimit||this.jobsInProgress0&&(o=r.jobQueue.shift(),o.start(),r.jobsInProgress++),a(s.data,s.errorMsg,s.request)}}(i),function(e){e.Tile=function(n,r,s,a,o,l,u,c,h,f,p,m){this.level=n,this.x=r,this.y=s,this.bounds=a,this.sourceBounds=f,this.exists=o,this._url=l,this.postData=p,this.context2D=u,this.loadWithAjax=c,this.ajaxHeaders=h,m===void 0&&(e.console.warn("Tile constructor needs 'cacheKey' variable: creation tile cache in Tile class is deprecated. TileSource.prototype.getTileHashKey will be used."),m=e.TileSource.prototype.getTileHashKey(n,r,s,l,h,p)),this.cacheKey=m,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")},drawHTML:function(n){if(!this.cacheImageRecord){e.console.warn("[Tile.drawHTML] attempting to draw tile %s when it's not cached",this.toString());return}if(!this.loaded){e.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString());return}if(!this.element){var r=this.getImage();if(!r)return;this.element=e.makeNeutralElement("div"),this.imgElement=r.cloneNode(),this.imgElement.style.msInterpolationMode="nearest-neighbor",this.imgElement.style.width="100%",this.imgElement.style.height="100%",this.style=this.element.style,this.style.position="absolute"}this.element.parentNode!==n&&n.appendChild(this.element),this.imgElement.parentNode!==this.element&&this.element.appendChild(this.imgElement),this.style.top=this.position.y+"px",this.style.left=this.position.x+"px",this.style.height=this.size.y+"px",this.style.width=this.size.x+"px",this.flipped&&(this.style.transform="scaleX(-1)"),e.setElementOpacity(this.element,this.opacity)},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.getRenderedContext()},drawCanvas:function(n,r,s,a,o,l){var u=this.position.times(e.pixelDensityRatio),c=this.size.times(e.pixelDensityRatio),h;if(!this.context2D&&!this.cacheImageRecord){e.console.warn("[Tile.drawCanvas] attempting to draw tile %s when it's not cached",this.toString());return}if(h=this.getCanvasContext(),!this.loaded||!h){e.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString());return}n.save(),n.globalAlpha=this.opacity,typeof s=="number"&&s!==1&&(u=u.times(s),c=c.times(s)),a instanceof e.Point&&(u=u.plus(a)),n.globalAlpha===1&&this.hasTransparency&&(o&&(u.x=Math.round(u.x),u.y=Math.round(u.y),c.x=Math.round(c.x),c.y=Math.round(c.y)),n.clearRect(u.x,u.y,c.x,c.y)),r({context:n,tile:this,rendered:h});var f,p;this.sourceBounds?(f=Math.min(this.sourceBounds.width,h.canvas.width),p=Math.min(this.sourceBounds.height,h.canvas.height)):(f=h.canvas.width,p=h.canvas.height),n.translate(u.x+c.x/2,0),this.flipped&&n.scale(-1,1),n.drawImage(h.canvas,0,0,f,p,-c.x/2,u.y,c.x,c.y),n.restore()},getScaleForEdgeSmoothing:function(){var n;if(this.cacheImageRecord)n=this.cacheImageRecord.getRenderedContext();else if(this.context2D)n=this.context2D;else return e.console.warn("[Tile.drawCanvas] attempting to get tile scale %s when tile's not cached",this.toString()),1;return n.canvas.width/(this.size.x*e.pixelDensityRatio)},getTranslationForEdgeSmoothing:function(n,r,s){var a=Math.max(1,Math.ceil((s.x-r.x)/2)),o=Math.max(1,Math.ceil((s.y-r.y)/2));return new e.Point(a,o).minus(this.position.times(e.pixelDensityRatio).times(n||1).apply(function(l){return l%1}))},unload:function(){this.imgElement&&this.imgElement.parentNode&&this.imgElement.parentNode.removeChild(this.imgElement),this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null,this.imgElement=null,this.loaded=!1,this.loading=!1}}}(i),function(e){e.OverlayPlacement=e.Placement,e.OverlayRotationMode=e.freezeObject({NO_ROTATION:1,EXACT:2,BOUNDING_BOX:3}),e.Overlay=function(n,r,s){var a;e.isPlainObject(n)?a=n:a={element:n,location:r,placement:s},this.element=a.element,this.style=a.element.style,this._init(a)},e.Overlay.prototype={_init:function(n){this.location=n.location,this.placement=n.placement===void 0?e.Placement.TOP_LEFT:n.placement,this.onDraw=n.onDraw,this.checkResize=n.checkResize===void 0?!0:n.checkResize,this.width=n.width===void 0?null:n.width,this.height=n.height===void 0?null:n.height,this.rotationMode=n.rotationMode||e.OverlayRotationMode.EXACT,this.location instanceof e.Rect&&(this.width=this.location.width,this.height=this.location.height,this.location=this.location.getTopLeft(),this.placement=e.Placement.TOP_LEFT),this.scales=this.width!==null&&this.height!==null,this.bounds=new e.Rect(this.location.x,this.location.y,this.width,this.height),this.position=this.location},adjust:function(n,r){var s=e.Placement.properties[this.placement];s&&(s.isHorizontallyCentered?n.x-=r.x/2:s.isRight&&(n.x-=r.x),s.isVerticallyCentered?n.y-=r.y/2:s.isBottom&&(n.y-=r.y))},destroy:function(){var n=this.element,r=this.style;n.parentNode&&(n.parentNode.removeChild(n),n.prevElementParent&&(r.display="none",document.body.appendChild(n))),this.onDraw=null,r.top="",r.left="",r.position="",this.width!==null&&(r.width=""),this.height!==null&&(r.height="");var s=e.getCssPropertyWithVendorPrefix("transformOrigin"),a=e.getCssPropertyWithVendorPrefix("transform");s&&a&&(r[s]="",r[a]="")},drawHTML:function(n,r){var s=this.element;s.parentNode!==n&&(s.prevElementParent=s.parentNode,s.prevNextSibling=s.nextSibling,n.appendChild(s),this.style.position="absolute",this.size=e.getElementSize(s));var a=this._getOverlayPositionAndSize(r),o=a.position,l=this.size=a.size,u=a.rotate;if(this.onDraw)this.onDraw(o,l,this.element);else{var c=this.style;c.left=o.x+"px",c.top=o.y+"px",this.width!==null&&(c.width=l.x+"px"),this.height!==null&&(c.height=l.y+"px");var h=e.getCssPropertyWithVendorPrefix("transformOrigin"),f=e.getCssPropertyWithVendorPrefix("transform");h&&f&&(u?(c[h]=this._getTransformOrigin(),c[f]="rotate("+u+"deg)"):(c[h]="",c[f]="")),c.display="block"}},_getOverlayPositionAndSize:function(n){var r=n.pixelFromPoint(this.location,!0),s=this._getSizeInPixels(n);this.adjust(r,s);var a=0;if(n.getRotation(!0)&&this.rotationMode!==e.OverlayRotationMode.NO_ROTATION)if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX&&this.width!==null&&this.height!==null){var o=new e.Rect(r.x,r.y,s.x,s.y),l=this._getBoundingBox(o,n.getRotation(!0));r=l.getTopLeft(),s=l.getSize()}else a=n.getRotation(!0);return{position:r,size:s,rotate:a}},_getSizeInPixels:function(n){var r=this.size.x,s=this.size.y;if(this.width!==null||this.height!==null){var a=n.deltaPixelsFromPointsNoRotate(new e.Point(this.width||0,this.height||0),!0);this.width!==null&&(r=a.x),this.height!==null&&(s=a.y)}if(this.checkResize&&(this.width===null||this.height===null)){var o=this.size=e.getElementSize(this.element);this.width===null&&(r=o.x),this.height===null&&(s=o.y)}return new e.Point(r,s)},_getBoundingBox:function(n,r){var s=this._getPlacementPoint(n);return n.rotate(r,s).getBoundingBox()},_getPlacementPoint:function(n){var r=new e.Point(n.x,n.y),s=e.Placement.properties[this.placement];return s&&(s.isHorizontallyCentered?r.x+=n.width/2:s.isRight&&(r.x+=n.width),s.isVerticallyCentered?r.y+=n.height/2:s.isBottom&&(r.y+=n.height)),r},_getTransformOrigin:function(){var n="",r=e.Placement.properties[this.placement];return r&&(r.isLeft?n="left":r.isRight&&(n="right"),r.isTop?n+=" top":r.isBottom&&(n+=" bottom")),n},update:function(n,r){var s=e.isPlainObject(n)?n:{location:n,placement:r};this._init({location:s.location||this.location,placement:s.placement!==void 0?s.placement:this.placement,onDraw:s.onDraw||this.onDraw,checkResize:s.checkResize||this.checkResize,width:s.width!==void 0?s.width:this.width,height:s.height!==void 0?s.height:this.height,rotationMode:s.rotationMode||this.rotationMode})},getBounds:function(n){e.console.assert(n,"A viewport must now be passed to Overlay.getBounds.");var r=this.width,s=this.height;if(r===null||s===null){var a=n.deltaPointsFromPixelsNoRotate(this.size,!0);r===null&&(r=a.x),s===null&&(s=a.y)}var o=this.location.clone();return this.adjust(o,new e.Point(r,s)),this._adjustBoundsForRotation(n,new e.Rect(o.x,o.y,r,s))},_adjustBoundsForRotation:function(n,r){if(!n||n.getRotation(!0)===0||this.rotationMode===e.OverlayRotationMode.EXACT)return r;if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX){if(this.width===null||this.height===null)return r;var s=this._getOverlayPositionAndSize(n);return n.viewerElementToViewportRectangle(new e.Rect(s.position.x,s.position.y,s.size.x,s.size.y))}return r.rotate(-n.getRotation(!0),this._getPlacementPoint(r))}}}(i),function(e){e.Drawer=function(n){e.console.assert(n.viewer,"[Drawer] options.viewer is required");var r=arguments;if(e.isPlainObject(n)||(n={source:r[0],viewport:r[1],element:r[2]}),e.console.assert(n.viewport,"[Drawer] options.viewport is required"),e.console.assert(n.element,"[Drawer] options.element is required"),n.source&&e.console.error("[Drawer] options.source is no longer accepted; use TiledImage instead"),this.viewer=n.viewer,this.viewport=n.viewport,this.debugGridColor=typeof n.debugGridColor=="string"?[n.debugGridColor]:n.debugGridColor||e.DEFAULT_SETTINGS.debugGridColor,n.opacity&&e.console.error("[Drawer] options.opacity is no longer accepted; set the opacity on the TiledImage instead"),this.useCanvas=e.supportsCanvas&&(this.viewer?this.viewer.useCanvas:!0),this.container=e.getElement(n.element),this.canvas=e.makeNeutralElement(this.useCanvas?"canvas":"div"),this.context=this.useCanvas?this.canvas.getContext("2d"):null,this.sketchCanvas=null,this.sketchContext=null,this.element=this.container,this.container.dir="ltr",this.useCanvas){var s=this._calculateCanvasSize();this.canvas.width=s.x,this.canvas.height=s.y}this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.position="absolute",e.setElementOpacity(this.canvas,this.opacity,!0),e.setElementPointerEventsNone(this.canvas),e.setElementTouchActionNone(this.canvas),this.container.style.textAlign="left",this.container.appendChild(this.canvas),this._imageSmoothingEnabled=!0},e.Drawer.prototype={addOverlay:function(n,r,s,a){return e.console.error("drawer.addOverlay is deprecated. Use viewer.addOverlay instead."),this.viewer.addOverlay(n,r,s,a),this},updateOverlay:function(n,r,s){return e.console.error("drawer.updateOverlay is deprecated. Use viewer.updateOverlay instead."),this.viewer.updateOverlay(n,r,s),this},removeOverlay:function(n){return e.console.error("drawer.removeOverlay is deprecated. Use viewer.removeOverlay instead."),this.viewer.removeOverlay(n),this},clearOverlays:function(){return e.console.error("drawer.clearOverlays is deprecated. Use viewer.clearOverlays instead."),this.viewer.clearOverlays(),this},viewportCoordToDrawerCoord:function(n){var r=this.viewport.pixelFromPointNoRotate(n,!0);return new e.Point(r.x*e.pixelDensityRatio,r.y*e.pixelDensityRatio)},clipWithPolygons:function(n,r){if(this.useCanvas){var s=this._getContext(r);s.beginPath(),n.forEach(function(a){a.forEach(function(o,l){s[l===0?"moveTo":"lineTo"](o.x,o.y)})}),s.clip()}},setOpacity:function(n){e.console.error("drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead.");for(var r=this.viewer.world,s=0;sr&&(r=a)}return r},needsUpdate:function(){return e.console.error("[Drawer.needsUpdate] this function is deprecated. Use World.needsDraw instead."),this.viewer.world.needsDraw()},numTilesLoaded:function(){return e.console.error("[Drawer.numTilesLoaded] this function is deprecated. Use TileCache.numTilesLoaded instead."),this.viewer.tileCache.numTilesLoaded()},reset:function(){return e.console.error("[Drawer.reset] this function is deprecated. Use World.resetItems instead."),this.viewer.world.resetItems(),this},update:function(){return e.console.error("[Drawer.update] this function is deprecated. Use Drawer.clear and World.draw instead."),this.clear(),this.viewer.world.draw(),this},canRotate:function(){return this.useCanvas},destroy:function(){this.canvas.width=1,this.canvas.height=1,this.sketchCanvas=null,this.sketchContext=null},clear:function(){if(this.canvas.innerHTML="",this.useCanvas){var n=this._calculateCanvasSize();if((this.canvas.width!==n.x||this.canvas.height!==n.y)&&(this.canvas.width=n.x,this.canvas.height=n.y,this._updateImageSmoothingEnabled(this.context),this.sketchCanvas!==null)){var r=this._calculateSketchCanvasSize();this.sketchCanvas.width=r.x,this.sketchCanvas.height=r.y,this._updateImageSmoothingEnabled(this.sketchContext)}this._clear()}},_clear:function(n,r){if(this.useCanvas){var s=this._getContext(n);if(r)s.clearRect(r.x,r.y,r.width,r.height);else{var a=s.canvas;s.clearRect(0,0,a.width,a.height)}}},viewportToDrawerRectangle:function(n){var r=this.viewport.pixelFromPointNoRotate(n.getTopLeft(),!0),s=this.viewport.deltaPixelsFromPointsNoRotate(n.getSize(),!0);return new e.Rect(r.x*e.pixelDensityRatio,r.y*e.pixelDensityRatio,s.x*e.pixelDensityRatio,s.y*e.pixelDensityRatio)},drawTile:function(n,r,s,a,o,l,u){if(e.console.assert(n,"[Drawer.drawTile] tile is required"),e.console.assert(r,"[Drawer.drawTile] drawingHandler is required"),this.useCanvas){var c=this._getContext(s);a=a||1,n.drawCanvas(c,r,a,o,l,u)}else n.drawHTML(this.canvas)},_getContext:function(n){var r=this.context;if(n){if(this.sketchCanvas===null){this.sketchCanvas=document.createElement("canvas");var s=this._calculateSketchCanvasSize();if(this.sketchCanvas.width=s.x,this.sketchCanvas.height=s.y,this.sketchContext=this.sketchCanvas.getContext("2d"),this.viewport.getRotation()===0){var a=this;this.viewer.addHandler("rotate",function o(){if(a.viewport.getRotation()!==0){a.viewer.removeHandler("rotate",o);var l=a._calculateSketchCanvasSize();a.sketchCanvas.width=l.x,a.sketchCanvas.height=l.y}})}this._updateImageSmoothingEnabled(this.sketchContext)}r=this.sketchContext}return r},saveContext:function(n){this.useCanvas&&this._getContext(n).save()},restoreContext:function(n){this.useCanvas&&this._getContext(n).restore()},setClip:function(n,r){if(this.useCanvas){var s=this._getContext(r);s.beginPath(),s.rect(n.x,n.y,n.width,n.height),s.clip()}},drawRectangle:function(n,r,s){if(this.useCanvas){var a=this._getContext(s);a.save(),a.fillStyle=r,a.fillRect(n.x,n.y,n.width,n.height),a.restore()}},blendSketch:function(n,r,s,a){var o=n;if(e.isPlainObject(o)||(o={opacity:n,scale:r,translate:s,compositeOperation:a}),!(!this.useCanvas||!this.sketchCanvas)){n=o.opacity,a=o.compositeOperation;var l=o.bounds;if(this.context.save(),this.context.globalAlpha=n,a&&(this.context.globalCompositeOperation=a),l)l.x<0&&(l.width+=l.x,l.x=0),l.x+l.width>this.canvas.width&&(l.width=this.canvas.width-l.x),l.y<0&&(l.height+=l.y,l.y=0),l.y+l.height>this.canvas.height&&(l.height=this.canvas.height-l.y),this.context.drawImage(this.sketchCanvas,l.x,l.y,l.width,l.height,l.x,l.y,l.width,l.height);else{r=o.scale||1,s=o.translate;var u=s instanceof e.Point?s:new e.Point(0,0),c=0,h=0;if(s){var f=this.sketchCanvas.width-this.canvas.width,p=this.sketchCanvas.height-this.canvas.height;c=Math.round(f/2),h=Math.round(p/2)}this.context.drawImage(this.sketchCanvas,u.x-c*r,u.y-h*r,(this.canvas.width+2*c)*r,(this.canvas.height+2*h)*r,-c,-h,this.canvas.width+2*c,this.canvas.height+2*h)}this.context.restore()}},drawDebugInfo:function(n,r,s,a){if(this.useCanvas){var o=this.viewer.world.getIndexOfItem(a)%this.debugGridColor.length,l=this.context;l.save(),l.lineWidth=2*e.pixelDensityRatio,l.font="small-caps bold "+13*e.pixelDensityRatio+"px arial",l.strokeStyle=this.debugGridColor[o],l.fillStyle=this.debugGridColor[o],this.viewport.getRotation(!0)%360!==0&&this._offsetForRotation({degrees:this.viewport.getRotation(!0)}),a.getRotation(!0)%360!==0&&this._offsetForRotation({degrees:a.getRotation(!0),point:a.viewport.pixelFromPointNoRotate(a._getRotationPoint(!0),!0)}),a.viewport.getRotation(!0)%360===0&&a.getRotation(!0)%360===0&&a._drawer.viewer.viewport.getFlip()&&a._drawer._flip(),l.strokeRect(n.position.x*e.pixelDensityRatio,n.position.y*e.pixelDensityRatio,n.size.x*e.pixelDensityRatio,n.size.y*e.pixelDensityRatio);var u=(n.position.x+n.size.x/2)*e.pixelDensityRatio,c=(n.position.y+n.size.y/2)*e.pixelDensityRatio;l.translate(u,c),l.rotate(Math.PI/180*-this.viewport.getRotation(!0)),l.translate(-u,-c),n.x===0&&n.y===0&&(l.fillText("Zoom: "+this.viewport.getZoom(),n.position.x*e.pixelDensityRatio,(n.position.y-30)*e.pixelDensityRatio),l.fillText("Pan: "+this.viewport.getBounds().toString(),n.position.x*e.pixelDensityRatio,(n.position.y-20)*e.pixelDensityRatio)),l.fillText("Level: "+n.level,(n.position.x+10)*e.pixelDensityRatio,(n.position.y+20)*e.pixelDensityRatio),l.fillText("Column: "+n.x,(n.position.x+10)*e.pixelDensityRatio,(n.position.y+30)*e.pixelDensityRatio),l.fillText("Row: "+n.y,(n.position.x+10)*e.pixelDensityRatio,(n.position.y+40)*e.pixelDensityRatio),l.fillText("Order: "+s+" of "+r,(n.position.x+10)*e.pixelDensityRatio,(n.position.y+50)*e.pixelDensityRatio),l.fillText("Size: "+n.size.toString(),(n.position.x+10)*e.pixelDensityRatio,(n.position.y+60)*e.pixelDensityRatio),l.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(),a.getRotation(!0)%360!==0&&this._restoreRotationChanges(),a.viewport.getRotation(!0)%360===0&&a.getRotation(!0)%360===0&&a._drawer.viewer.viewport.getFlip()&&a._drawer._flip(),l.restore()}},debugRect:function(n){if(this.useCanvas){var r=this.context;r.save(),r.lineWidth=2*e.pixelDensityRatio,r.strokeStyle=this.debugGridColor[0],r.fillStyle=this.debugGridColor[0],r.strokeRect(n.x*e.pixelDensityRatio,n.y*e.pixelDensityRatio,n.width*e.pixelDensityRatio,n.height*e.pixelDensityRatio),r.restore()}},setImageSmoothingEnabled:function(n){this.useCanvas&&(this._imageSmoothingEnabled=n,this._updateImageSmoothingEnabled(this.context),this.viewer.forceRedraw())},_updateImageSmoothingEnabled:function(n){n.msImageSmoothingEnabled=this._imageSmoothingEnabled,n.imageSmoothingEnabled=this._imageSmoothingEnabled},getCanvasSize:function(n){var r=this._getContext(n).canvas;return new e.Point(r.width,r.height)},getCanvasCenter:function(){return new e.Point(this.canvas.width/2,this.canvas.height/2)},_offsetForRotation:function(n){var r=n.point?n.point.times(e.pixelDensityRatio):this.getCanvasCenter(),s=this._getContext(n.useSketch);s.save(),s.translate(r.x,r.y),this.viewer.viewport.flipped?(s.rotate(Math.PI/180*-n.degrees),s.scale(-1,1)):s.rotate(Math.PI/180*n.degrees),s.translate(-r.x,-r.y)},_flip:function(n){n=n||{};var r=n.point?n.point.times(e.pixelDensityRatio):this.getCanvasCenter(),s=this._getContext(n.useSketch);s.translate(r.x,0),s.scale(-1,1),s.translate(-r.x,0)},_restoreRotationChanges:function(n){var r=this._getContext(n);r.restore()},_calculateCanvasSize:function(){var n=e.pixelDensityRatio,r=this.viewport.getContainerSize();return{x:Math.round(r.x*n),y:Math.round(r.y*n)}},_calculateSketchCanvasSize:function(){var n=this._calculateCanvasSize();if(this.viewport.getRotation()===0)return n;var r=Math.ceil(Math.sqrt(n.x*n.x+n.y*n.y));return{x:r,y:r}}}}(i),function(e){e.Viewport=function(n){var r=arguments;r.length&&r[0]instanceof e.Point&&(n={containerSize:r[0],contentSize:r[1],config:r[2]}),n.config&&(e.extend(!0,n,n.config),delete n.config),this._margins=e.extend({left:0,top:0,right:0,bottom:0},n.margins||{}),delete n.margins,n.initialDegrees=n.degrees,delete n.degrees,e.extend(!0,this,{containerSize:null,contentSize:null,zoomPoint:null,rotationPivot:null,viewer:null,springStiffness:e.DEFAULT_SETTINGS.springStiffness,animationTime:e.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:e.DEFAULT_SETTINGS.minZoomImageRatio,maxZoomPixelRatio:e.DEFAULT_SETTINGS.maxZoomPixelRatio,visibilityRatio:e.DEFAULT_SETTINGS.visibilityRatio,wrapHorizontal:e.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:e.DEFAULT_SETTINGS.wrapVertical,defaultZoomLevel:e.DEFAULT_SETTINGS.defaultZoomLevel,minZoomLevel:e.DEFAULT_SETTINGS.minZoomLevel,maxZoomLevel:e.DEFAULT_SETTINGS.maxZoomLevel,initialDegrees:e.DEFAULT_SETTINGS.degrees,flipped:e.DEFAULT_SETTINGS.flipped,homeFillsViewer:e.DEFAULT_SETTINGS.homeFillsViewer,silenceMultiImageWarnings:e.DEFAULT_SETTINGS.silenceMultiImageWarnings},n),this._updateContainerInnerSize(),this.centerSpringX=new e.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.centerSpringY=new e.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.zoomSpring=new e.Spring({exponential:!0,initial:1,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.degreesSpring=new e.Spring({initial:n.initialDegrees,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._oldCenterX=this.centerSpringX.current.value,this._oldCenterY=this.centerSpringY.current.value,this._oldZoom=this.zoomSpring.current.value,this._oldDegrees=this.degreesSpring.current.value,this._setContentBounds(new e.Rect(0,0,1,1),1),this.goHome(!0),this.update()},e.Viewport.prototype={get degrees(){return e.console.warn("Accessing [Viewport.degrees] is deprecated. Use viewport.getRotation instead."),this.getRotation()},set degrees(n){e.console.warn("Setting [Viewport.degrees] is deprecated. Use viewport.rotateTo, viewport.rotateBy, or viewport.setRotation instead."),this.rotateTo(n)},resetContentSize:function(n){return e.console.assert(n,"[Viewport.resetContentSize] contentSize is required"),e.console.assert(n instanceof e.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point"),e.console.assert(n.x>0,"[Viewport.resetContentSize] contentSize.x must be greater than 0"),e.console.assert(n.y>0,"[Viewport.resetContentSize] contentSize.y must be greater than 0"),this._setContentBounds(new e.Rect(0,0,1,n.y/n.x),n.x),this},setHomeBounds:function(n,r){e.console.error("[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually."),this._setContentBounds(n,r)},_setContentBounds:function(n,r){e.console.assert(n,"[Viewport._setContentBounds] bounds is required"),e.console.assert(n instanceof e.Rect,"[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect"),e.console.assert(n.width>0,"[Viewport._setContentBounds] bounds.width must be greater than 0"),e.console.assert(n.height>0,"[Viewport._setContentBounds] bounds.height must be greater than 0"),this._contentBoundsNoRotate=n.clone(),this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(r),this._contentBounds=n.rotate(this.getRotation()).getBoundingBox(),this._contentSize=this._contentBounds.getSize().times(r),this._contentAspectRatio=this._contentSize.x/this._contentSize.y,this.viewer&&this.viewer.raiseEvent("reset-size",{contentSize:this._contentSizeNoRotate.clone(),contentFactor:r,homeBounds:this._contentBoundsNoRotate.clone(),contentBounds:this._contentBounds.clone()})},getHomeZoom:function(){if(this.defaultZoomLevel)return this.defaultZoomLevel;var n=this._contentAspectRatio/this.getAspectRatio(),r;return this.homeFillsViewer?r=n>=1?n:1:r=n>=1?1:n,r/this._contentBounds.width},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation())},getHomeBoundsNoRotate:function(){var n=this._contentBounds.getCenter(),r=1/this.getHomeZoom(),s=r/this.getAspectRatio();return new e.Rect(n.x-r/2,n.y-s/2,r,s)},goHome:function(n){return this.viewer&&this.viewer.raiseEvent("home",{immediately:n}),this.fitBounds(this.getHomeBounds(),n)},getMinZoom:function(){var n=this.getHomeZoom(),r=this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*n;return r},getMaxZoom:function(){var n=this.maxZoomLevel;return n||(n=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x,n/=this._contentBounds.width),Math.max(n,this.getHomeZoom())},getAspectRatio:function(){return this._containerInnerSize.x/this._containerInnerSize.y},getContainerSize:function(){return new e.Point(this.containerSize.x,this.containerSize.y)},getMargins:function(){return e.extend({},this._margins)},setMargins:function(n){e.console.assert(e.type(n)==="object","[Viewport.setMargins] margins must be an object"),this._margins=e.extend({left:0,top:0,right:0,bottom:0},n),this._updateContainerInnerSize(),this.viewer&&this.viewer.forceRedraw()},getBounds:function(n){return this.getBoundsNoRotate(n).rotate(-this.getRotation(n))},getBoundsNoRotate:function(n){var r=this.getCenter(n),s=1/this.getZoom(n),a=s/this.getAspectRatio();return new e.Rect(r.x-s/2,r.y-a/2,s,a)},getBoundsWithMargins:function(n){return this.getBoundsNoRotateWithMargins(n).rotate(-this.getRotation(n),this.getCenter(n))},getBoundsNoRotateWithMargins:function(n){var r=this.getBoundsNoRotate(n),s=this._containerInnerSize.x*this.getZoom(n);return r.x-=this._margins.left/s,r.y-=this._margins.top/s,r.width+=(this._margins.left+this._margins.right)/s,r.height+=(this._margins.top+this._margins.bottom)/s,r},getCenter:function(n){var r=new e.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),s=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value),a,o,l,u,c,h,f,p;return n?r:this.zoomPoint?(a=this.pixelFromPoint(this.zoomPoint,!0),o=this.getZoom(),l=1/o,u=l/this.getAspectRatio(),c=new e.Rect(r.x-l/2,r.y-u/2,l,u),h=this._pixelFromPoint(this.zoomPoint,c),f=h.minus(a).rotate(-this.getRotation(!0)),p=f.divide(this._containerInnerSize.x*o),s.plus(p)):s},getZoom:function(n){return n?this.zoomSpring.current.value:this.zoomSpring.target.value},_applyZoomConstraints:function(n){return Math.max(Math.min(n,this.getMaxZoom()),this.getMinZoom())},_applyBoundaryConstraints:function(n){var r=this.viewportToViewerElementRectangle(n).getBoundingBox(),s=this.viewportToViewerElementRectangle(this._contentBoundsNoRotate).getBoundingBox(),a=!1,o=!1;if(!this.wrapHorizontal){var l=r.x+r.width,u=s.x+s.width,c,h,f;r.width>s.width?c=this.visibilityRatio*s.width:c=this.visibilityRatio*r.width,h=s.x-l+c,f=u-r.x-c,c>s.width?(r.x+=(h+f)/2,a=!0):f<0?(r.x+=f,a=!0):h>0&&(r.x+=h,a=!0)}if(!this.wrapVertical){var p=r.y+r.height,m=s.y+s.height,b,T,y;r.height>s.height?b=this.visibilityRatio*s.height:b=this.visibilityRatio*r.height,T=s.y-p+b,y=m-r.y-b,b>s.height?(r.y+=(T+y)/2,o=!0):y<0?(r.y+=y,o=!0):T>0&&(r.y+=T,o=!0)}var w=a||o,S=w?this.viewerElementToViewportRectangle(r):n.clone();return S.xConstrained=a,S.yConstrained=o,S.constraintApplied=w,S},_raiseConstraintsEvent:function(n){this.viewer&&this.viewer.raiseEvent("constrain",{immediately:n})},applyConstraints:function(n){var r=this.getZoom(),s=this._applyZoomConstraints(r);r!==s&&this.zoomTo(s,this.zoomPoint,n);var a=this.getConstrainedBounds(!1);return a.constraintApplied&&(this.fitBounds(a,n),this._raiseConstraintsEvent(n)),this},ensureVisible:function(n){return this.applyConstraints(n)},_fitBounds:function(n,r){r=r||{};var s=r.immediately||!1,a=r.constraints||!1,o=this.getAspectRatio(),l=n.getCenter(),u=new e.Rect(n.x,n.y,n.width,n.height,n.degrees+this.getRotation()).getBoundingBox();u.getAspectRatio()>=o?u.height=u.width/o:u.width=u.height*o,u.x=l.x-u.width/2,u.y=l.y-u.height/2;var c=1/u.width;if(s)return this.panTo(l,!0),this.zoomTo(c,null,!0),a&&this.applyConstraints(!0),this;var h=this.getCenter(!0),f=this.getZoom(!0);this.panTo(h,!0),this.zoomTo(f,null,!0);var p=this.getBounds(),m=this.getZoom();if(m===0||Math.abs(c/m-1)<1e-8)return this.zoomTo(c,null,!0),this.panTo(l,s),a&&this.applyConstraints(!1),this;if(a){this.panTo(l,!1),this.zoomTo(c,null,!1);var b=this.getConstrainedBounds();this.panTo(h,!0),this.zoomTo(f,null,!0),this.fitBounds(b)}else{var T=u.rotate(-this.getRotation()),y=T.getTopLeft().times(c).minus(p.getTopLeft().times(m)).divide(c-m);this.zoomTo(c,y,s)}return this},fitBounds:function(n,r){return this._fitBounds(n,{immediately:r,constraints:!1})},fitBoundsWithConstraints:function(n,r){return this._fitBounds(n,{immediately:r,constraints:!0})},fitVertically:function(n){var r=new e.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(r,n)},fitHorizontally:function(n){var r=new e.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(r,n)},getConstrainedBounds:function(n){var r,s;return r=this.getBounds(n),s=this._applyBoundaryConstraints(r),s},panBy:function(n,r){var s=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(s.plus(n),r)},panTo:function(n,r){return r?(this.centerSpringX.resetTo(n.x),this.centerSpringY.resetTo(n.y)):(this.centerSpringX.springTo(n.x),this.centerSpringY.springTo(n.y)),this.viewer&&this.viewer.raiseEvent("pan",{center:n,immediately:r}),this},zoomBy:function(n,r,s){return this.zoomTo(this.zoomSpring.target.value*n,r,s)},zoomTo:function(n,r,s){var a=this;return this.zoomPoint=r instanceof e.Point&&!isNaN(r.x)&&!isNaN(r.y)?r:null,s?this._adjustCenterSpringsForZoomPoint(function(){a.zoomSpring.resetTo(n)}):this.zoomSpring.springTo(n),this.viewer&&this.viewer.raiseEvent("zoom",{zoom:n,refPoint:r,immediately:s}),this},setRotation:function(n,r){return this.rotateTo(n,null,r)},getRotation:function(n){return n?this.degreesSpring.current.value:this.degreesSpring.target.value},setRotationWithPivot:function(n,r,s){return this.rotateTo(n,r,s)},rotateTo:function(n,r,s){if(!this.viewer||!this.viewer.drawer.canRotate())return this;if(this.degreesSpring.target.value===n&&this.degreesSpring.isAtTargetValue())return this;if(this.rotationPivot=r instanceof e.Point&&!isNaN(r.x)&&!isNaN(r.y)?r:null,s)if(this.rotationPivot){var a=n-this._oldDegrees;if(!a)return this.rotationPivot=null,this;this._rotateAboutPivot(n)}else this.degreesSpring.resetTo(n);else{var o=e.positiveModulo(this.degreesSpring.current.value,360),l=e.positiveModulo(n,360),u=l-o;u>180?l-=360:u<-180&&(l+=360);var c=o-l;this.degreesSpring.resetTo(n+c),this.degreesSpring.springTo(n)}return this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor()),this.viewer.forceRedraw(),this.viewer.raiseEvent("rotate",{degrees:n,immediately:!!s,pivot:this.rotationPivot||this.getCenter()}),this},rotateBy:function(n,r,s){return this.rotateTo(this.degreesSpring.target.value+n,r,s)},resize:function(n,r){var s=this.getBoundsNoRotate(),a=s,o;return this.containerSize.x=n.x,this.containerSize.y=n.y,this._updateContainerInnerSize(),r&&(o=n.x/this.containerSize.x,a.width=s.width*o,a.height=a.width/this.getAspectRatio()),this.viewer&&this.viewer.raiseEvent("resize",{newContainerSize:n,maintain:r}),this.fitBounds(a,!0)},_updateContainerInnerSize:function(){this._containerInnerSize=new e.Point(Math.max(1,this.containerSize.x-(this._margins.left+this._margins.right)),Math.max(1,this.containerSize.y-(this._margins.top+this._margins.bottom)))},update:function(){var n=this;this._adjustCenterSpringsForZoomPoint(function(){n.zoomSpring.update()}),this.degreesSpring.isAtTargetValue()&&(this.rotationPivot=null),this.centerSpringX.update(),this.centerSpringY.update(),this.rotationPivot?this._rotateAboutPivot(!0):this.degreesSpring.update();var r=this.centerSpringX.current.value!==this._oldCenterX||this.centerSpringY.current.value!==this._oldCenterY||this.zoomSpring.current.value!==this._oldZoom||this.degreesSpring.current.value!==this._oldDegrees;return this._oldCenterX=this.centerSpringX.current.value,this._oldCenterY=this.centerSpringY.current.value,this._oldZoom=this.zoomSpring.current.value,this._oldDegrees=this.degreesSpring.current.value,r},_rotateAboutPivot:function(n){var r=n===!0,s=this.rotationPivot.minus(this.getCenter());this.centerSpringX.shiftBy(s.x),this.centerSpringY.shiftBy(s.y),r?this.degreesSpring.update():this.degreesSpring.resetTo(n);var a=this.degreesSpring.current.value-this._oldDegrees,o=s.rotate(a*-1).times(-1);this.centerSpringX.shiftBy(o.x),this.centerSpringY.shiftBy(o.y)},_adjustCenterSpringsForZoomPoint:function(n){if(this.zoomPoint){var r=this.pixelFromPoint(this.zoomPoint,!0);n();var s=this.pixelFromPoint(this.zoomPoint,!0),a=s.minus(r),o=this.deltaPointsFromPixels(a,!0);this.centerSpringX.shiftBy(o.x),this.centerSpringY.shiftBy(o.y),this.zoomSpring.isAtTargetValue()&&(this.zoomPoint=null)}else n()},deltaPixelsFromPointsNoRotate:function(n,r){return n.times(this._containerInnerSize.x*this.getZoom(r))},deltaPixelsFromPoints:function(n,r){return this.deltaPixelsFromPointsNoRotate(n.rotate(this.getRotation(r)),r)},deltaPointsFromPixelsNoRotate:function(n,r){return n.divide(this._containerInnerSize.x*this.getZoom(r))},deltaPointsFromPixels:function(n,r){return this.deltaPointsFromPixelsNoRotate(n,r).rotate(-this.getRotation(r))},pixelFromPointNoRotate:function(n,r){return this._pixelFromPointNoRotate(n,this.getBoundsNoRotate(r))},pixelFromPoint:function(n,r){return this._pixelFromPoint(n,this.getBoundsNoRotate(r))},_pixelFromPointNoRotate:function(n,r){return n.minus(r.getTopLeft()).times(this._containerInnerSize.x/r.width).plus(new e.Point(this._margins.left,this._margins.top))},_pixelFromPoint:function(n,r){return this._pixelFromPointNoRotate(n.rotate(this.getRotation(!0),this.getCenter(!0)),r)},pointFromPixelNoRotate:function(n,r){var s=this.getBoundsNoRotate(r);return n.minus(new e.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/s.width).plus(s.getTopLeft())},pointFromPixel:function(n,r){return this.pointFromPixelNoRotate(n,r).rotate(-this.getRotation(r),this.getCenter(r))},_viewportToImageDelta:function(n,r){var s=this._contentBoundsNoRotate.width;return new e.Point(n*this._contentSizeNoRotate.x/s,r*this._contentSizeNoRotate.x/s)},viewportToImageCoordinates:function(n,r){if(n instanceof e.Point)return this.viewportToImageCoordinates(n.x,n.y);if(this.viewer){var s=this.viewer.world.getItemCount();if(s>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.viewportToImageCoordinates] is not accurate with multi-image; use TiledImage.viewportToImageCoordinates instead.");else if(s===1){var a=this.viewer.world.getItemAt(0);return a.viewportToImageCoordinates(n,r,!0)}}return this._viewportToImageDelta(n-this._contentBoundsNoRotate.x,r-this._contentBoundsNoRotate.y)},_imageToViewportDelta:function(n,r){var s=this._contentBoundsNoRotate.width;return new e.Point(n/this._contentSizeNoRotate.x*s,r/this._contentSizeNoRotate.x*s)},imageToViewportCoordinates:function(n,r){if(n instanceof e.Point)return this.imageToViewportCoordinates(n.x,n.y);if(this.viewer){var s=this.viewer.world.getItemCount();if(s>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.imageToViewportCoordinates] is not accurate with multi-image; use TiledImage.imageToViewportCoordinates instead.");else if(s===1){var a=this.viewer.world.getItemAt(0);return a.imageToViewportCoordinates(n,r,!0)}}var o=this._imageToViewportDelta(n,r);return o.x+=this._contentBoundsNoRotate.x,o.y+=this._contentBoundsNoRotate.y,o},imageToViewportRectangle:function(n,r,s,a){var o=n;if(o instanceof e.Rect||(o=new e.Rect(n,r,s,a)),this.viewer){var l=this.viewer.world.getItemCount();if(l>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.imageToViewportRectangle] is not accurate with multi-image; use TiledImage.imageToViewportRectangle instead.");else if(l===1){var u=this.viewer.world.getItemAt(0);return u.imageToViewportRectangle(n,r,s,a,!0)}}var c=this.imageToViewportCoordinates(o.x,o.y),h=this._imageToViewportDelta(o.width,o.height);return new e.Rect(c.x,c.y,h.x,h.y,o.degrees)},viewportToImageRectangle:function(n,r,s,a){var o=n;if(o instanceof e.Rect||(o=new e.Rect(n,r,s,a)),this.viewer){var l=this.viewer.world.getItemCount();if(l>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.viewportToImageRectangle] is not accurate with multi-image; use TiledImage.viewportToImageRectangle instead.");else if(l===1){var u=this.viewer.world.getItemAt(0);return u.viewportToImageRectangle(n,r,s,a,!0)}}var c=this.viewportToImageCoordinates(o.x,o.y),h=this._viewportToImageDelta(o.width,o.height);return new e.Rect(c.x,c.y,h.x,h.y,o.degrees)},viewerElementToImageCoordinates:function(n){var r=this.pointFromPixel(n,!0);return this.viewportToImageCoordinates(r)},imageToViewerElementCoordinates:function(n){var r=this.imageToViewportCoordinates(n);return this.pixelFromPoint(r,!0)},windowToImageCoordinates:function(n){e.console.assert(this.viewer,"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");var r=n.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(r)},imageToWindowCoordinates:function(n){e.console.assert(this.viewer,"[Viewport.imageToWindowCoordinates] the viewport must have a viewer.");var r=this.imageToViewerElementCoordinates(n);return r.plus(e.getElementPosition(this.viewer.element))},viewerElementToViewportCoordinates:function(n){return this.pointFromPixel(n,!0)},viewportToViewerElementCoordinates:function(n){return this.pixelFromPoint(n,!0)},viewerElementToViewportRectangle:function(n){return e.Rect.fromSummits(this.pointFromPixel(n.getTopLeft(),!0),this.pointFromPixel(n.getTopRight(),!0),this.pointFromPixel(n.getBottomLeft(),!0))},viewportToViewerElementRectangle:function(n){return e.Rect.fromSummits(this.pixelFromPoint(n.getTopLeft(),!0),this.pixelFromPoint(n.getTopRight(),!0),this.pixelFromPoint(n.getBottomLeft(),!0))},windowToViewportCoordinates:function(n){e.console.assert(this.viewer,"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");var r=n.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(r)},viewportToWindowCoordinates:function(n){e.console.assert(this.viewer,"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer.");var r=this.viewportToViewerElementCoordinates(n);return r.plus(e.getElementPosition(this.viewer.element))},viewportToImageZoom:function(n){if(this.viewer){var r=this.viewer.world.getItemCount();if(r>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.viewportToImageZoom] is not accurate with multi-image.");else if(r===1){var s=this.viewer.world.getItemAt(0);return s.viewportToImageZoom(n)}}var a=this._contentSizeNoRotate.x,o=this._containerInnerSize.x,l=this._contentBoundsNoRotate.width,u=o/a*l;return n*u},imageToViewportZoom:function(n){if(this.viewer){var r=this.viewer.world.getItemCount();if(r>1)this.silenceMultiImageWarnings||e.console.error("[Viewport.imageToViewportZoom] is not accurate with multi-image.");else if(r===1){var s=this.viewer.world.getItemAt(0);return s.imageToViewportZoom(n)}}var a=this._contentSizeNoRotate.x,o=this._containerInnerSize.x,l=this._contentBoundsNoRotate.width,u=a/o/l;return n*u},toggleFlip:function(){return this.setFlip(!this.getFlip()),this},getFlip:function(){return this.flipped},setFlip:function(n){return this.flipped===n?this:(this.flipped=n,this.viewer.navigator&&this.viewer.navigator.setFlip(this.getFlip()),this.viewer.forceRedraw(),this.viewer.raiseEvent("flip",{flipped:n}),this)}}}(i),function(e){e.TiledImage=function(o){var l=this;e.console.assert(o.tileCache,"[TiledImage] options.tileCache is required"),e.console.assert(o.drawer,"[TiledImage] options.drawer is required"),e.console.assert(o.viewer,"[TiledImage] options.viewer is required"),e.console.assert(o.imageLoader,"[TiledImage] options.imageLoader is required"),e.console.assert(o.source,"[TiledImage] options.source is required"),e.console.assert(!o.clip||o.clip instanceof e.Rect,"[TiledImage] options.clip must be an OpenSeadragon.Rect if present"),e.EventSource.call(this),this._tileCache=o.tileCache,delete o.tileCache,this._drawer=o.drawer,delete o.drawer,this._imageLoader=o.imageLoader,delete o.imageLoader,o.clip instanceof e.Rect&&(this._clip=o.clip.clone()),delete o.clip;var u=o.x||0;delete o.x;var c=o.y||0;delete o.y,this.normHeight=o.source.dimensions.y/o.source.dimensions.x,this.contentAspectX=o.source.dimensions.x/o.source.dimensions.y;var h=1;o.width?(h=o.width,delete o.width,o.height&&(e.console.error("specifying both width and height to a tiledImage is not supported"),delete o.height)):o.height&&(h=o.height/this.normHeight,delete o.height);var f=o.fitBounds;delete o.fitBounds;var p=o.fitBoundsPlacement||i.Placement.CENTER;delete o.fitBoundsPlacement;var m=o.degrees||0;delete o.degrees,e.extend(!0,this,{viewer:null,tilesMatrix:{},coverage:{},loadingCoverage:{},lastDrawn:[],lastResetTime:0,_midDraw:!1,_needsDraw:!0,_hasOpaqueTile:!1,_tilesLoading:0,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},o),this._preload=this.preload,delete this.preload,this._fullyLoaded=!1,this._xSpring=new e.Spring({initial:u,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._ySpring=new e.Spring({initial:c,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._scaleSpring=new e.Spring({initial:h,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._degreesSpring=new e.Spring({initial:m,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._updateForScale(),f&&this.fitBounds(f,p,!0),this._drawingHandler=function(b){l.viewer.raiseEvent("tile-drawing",e.extend({tiledImage:l},b))}},e.extend(e.TiledImage.prototype,e.EventSource.prototype,{needsDraw:function(){return this._needsDraw},getFullyLoaded:function(){return this._fullyLoaded},_setFullyLoaded:function(o){o!==this._fullyLoaded&&(this._fullyLoaded=o,this.raiseEvent("fully-loaded-change",{fullyLoaded:this._fullyLoaded}))},reset:function(){this._tileCache.clearTilesFor(this),this.lastResetTime=e.now(),this._needsDraw=!0},update:function(){var o=this._xSpring.update(),l=this._ySpring.update(),u=this._scaleSpring.update(),c=this._degreesSpring.update();return o||l||u||c?(this._updateForScale(),this._needsDraw=!0,!0):!1},draw:function(){this.opacity!==0||this._preload?(this._midDraw=!0,this._updateViewport(),this._midDraw=!1):this._needsDraw=!1},destroy:function(){this.reset(),this.source.destroy&&this.source.destroy()},getBounds:function(o){return this.getBoundsNoRotate(o).rotate(this.getRotation(o),this._getRotationPoint(o))},getBoundsNoRotate:function(o){return o?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(o){var l=this.getBoundsNoRotate(o);if(this._clip){var u=o?this._worldWidthCurrent:this._worldWidthTarget,c=u/this.source.dimensions.x,h=this._clip.times(c);l=new e.Rect(l.x+h.x,l.y+h.y,h.width,h.height)}return l.rotate(this.getRotation(o),this._getRotationPoint(o))},getTileBounds:function(o,l,u){var c=this.source.getNumTiles(o),h=(c.x+l%c.x)%c.x,f=(c.y+u%c.y)%c.y,p=this.source.getTileBounds(o,h,f);return this.getFlip()&&(p.x=1-p.x-p.width),p.x+=(l-h)/c.x,p.y+=this._worldHeightCurrent/this._worldWidthCurrent*((u-f)/c.y),p},getContentSize:function(){return new e.Point(this.source.dimensions.x,this.source.dimensions.y)},getSizeInWindowCoordinates:function(){var o=this.imageToWindowCoordinates(new e.Point(0,0)),l=this.imageToWindowCoordinates(this.getContentSize());return new e.Point(l.x-o.x,l.y-o.y)},_viewportToImageDelta:function(o,l,u){var c=u?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(o*(this.source.dimensions.x/c),l*(this.source.dimensions.y*this.contentAspectX/c))},viewportToImageCoordinates:function(o,l,u){var c;return o instanceof e.Point?(u=l,c=o):c=new e.Point(o,l),c=c.rotate(-this.getRotation(u),this._getRotationPoint(u)),u?this._viewportToImageDelta(c.x-this._xSpring.current.value,c.y-this._ySpring.current.value):this._viewportToImageDelta(c.x-this._xSpring.target.value,c.y-this._ySpring.target.value)},_imageToViewportDelta:function(o,l,u){var c=u?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(o/this.source.dimensions.x*c,l/this.source.dimensions.y/this.contentAspectX*c)},imageToViewportCoordinates:function(o,l,u){o instanceof e.Point&&(u=l,l=o.y,o=o.x);var c=this._imageToViewportDelta(o,l);return u?(c.x+=this._xSpring.current.value,c.y+=this._ySpring.current.value):(c.x+=this._xSpring.target.value,c.y+=this._ySpring.target.value),c.rotate(this.getRotation(u),this._getRotationPoint(u))},imageToViewportRectangle:function(o,l,u,c,h){var f=o;f instanceof e.Rect?h=l:f=new e.Rect(o,l,u,c);var p=this.imageToViewportCoordinates(f.getTopLeft(),h),m=this._imageToViewportDelta(f.width,f.height,h);return new e.Rect(p.x,p.y,m.x,m.y,f.degrees+this.getRotation(h))},viewportToImageRectangle:function(o,l,u,c,h){var f=o;o instanceof e.Rect?h=l:f=new e.Rect(o,l,u,c);var p=this.viewportToImageCoordinates(f.getTopLeft(),h),m=this._viewportToImageDelta(f.width,f.height,h);return new e.Rect(p.x,p.y,m.x,m.y,f.degrees-this.getRotation(h))},viewerElementToImageCoordinates:function(o){var l=this.viewport.pointFromPixel(o,!0);return this.viewportToImageCoordinates(l)},imageToViewerElementCoordinates:function(o){var l=this.imageToViewportCoordinates(o);return this.viewport.pixelFromPoint(l,!0)},windowToImageCoordinates:function(o){var l=o.minus(i.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(l)},imageToWindowCoordinates:function(o){var l=this.imageToViewerElementCoordinates(o);return l.plus(i.getElementPosition(this.viewer.element))},_viewportToTiledImageRectangle:function(o){var l=this._scaleSpring.current.value;return o=o.rotate(-this.getRotation(!0),this._getRotationPoint(!0)),new e.Rect((o.x-this._xSpring.current.value)/l,(o.y-this._ySpring.current.value)/l,o.width/l,o.height/l,o.degrees)},viewportToImageZoom:function(o){var l=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return l*o},imageToViewportZoom:function(o){var l=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return o/l},setPosition:function(o,l){var u=this._xSpring.target.value===o.x&&this._ySpring.target.value===o.y;if(l){if(u&&this._xSpring.current.value===o.x&&this._ySpring.current.value===o.y)return;this._xSpring.resetTo(o.x),this._ySpring.resetTo(o.y),this._needsDraw=!0}else{if(u)return;this._xSpring.springTo(o.x),this._ySpring.springTo(o.y),this._needsDraw=!0}u||this._raiseBoundsChange()},setWidth:function(o,l){this._setScale(o,l)},setHeight:function(o,l){this._setScale(o/this.normHeight,l)},setCroppingPolygons:function(o){var l=function(c){return c instanceof e.Point||typeof c.x=="number"&&typeof c.y=="number"},u=function(c){return c.map(function(h){try{if(l(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(o))throw new Error("Provided cropping polygon is not an array");this._croppingPolygons=o.map(function(c){return u(c)})}catch(c){e.console.error("[TiledImage.setCroppingPolygons] Cropping polygon format not supported"),e.console.error(c),this._croppingPolygons=null}},resetCroppingPolygons:function(){this._croppingPolygons=null},fitBounds:function(o,l,u){l=l||e.Placement.CENTER;var c=e.Placement.properties[l],h=this.contentAspectX,f=0,p=0,m=1,b=1;if(this._clip&&(h=this._clip.getAspectRatio(),m=this._clip.width/this.source.dimensions.x,b=this._clip.height/this.source.dimensions.y,o.getAspectRatio()>h?(f=this._clip.x/this._clip.height*o.height,p=this._clip.y/this._clip.height*o.height):(f=this._clip.x/this._clip.width*o.width,p=this._clip.y/this._clip.width*o.width)),o.getAspectRatio()>h){var T=o.height/b,y=0;c.isHorizontallyCentered?y=(o.width-o.height*h)/2:c.isRight&&(y=o.width-o.height*h),this.setPosition(new e.Point(o.x-f+y,o.y-p),u),this.setHeight(T,u)}else{var w=o.width/m,S=0;c.isVerticallyCentered?S=(o.height-o.width/h)/2:c.isBottom&&(S=o.height-o.width/h),this.setPosition(new e.Point(o.x-f,o.y-p+S),u),this.setWidth(w,u)}},getClip:function(){return this._clip?this._clip.clone():null},setClip:function(o){e.console.assert(!o||o instanceof e.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null"),o instanceof e.Rect?this._clip=o.clone():this._clip=null,this._needsDraw=!0,this.raiseEvent("clip-change")},getFlip:function(){return!!this.flipped},setFlip:function(o){this.flipped=!!o,this._needsDraw=!0,this._raiseBoundsChange()},getOpacity:function(){return this.opacity},setOpacity:function(o){o!==this.opacity&&(this.opacity=o,this._needsDraw=!0,this.raiseEvent("opacity-change",{opacity:this.opacity}))},getPreload:function(){return this._preload},setPreload:function(o){this._preload=!!o,this._needsDraw=!0},getRotation:function(o){return o?this._degreesSpring.current.value:this._degreesSpring.target.value},setRotation:function(o,l){this._degreesSpring.target.value===o&&this._degreesSpring.isAtTargetValue()||(l?this._degreesSpring.resetTo(o):this._degreesSpring.springTo(o),this._needsDraw=!0,this._raiseBoundsChange())},_getRotationPoint:function(o){return this.getBoundsNoRotate(o).getCenter()},getCompositeOperation:function(){return this.compositeOperation},setCompositeOperation:function(o){o!==this.compositeOperation&&(this.compositeOperation=o,this._needsDraw=!0,this.raiseEvent("composite-operation-change",{compositeOperation:this.compositeOperation}))},_setScale:function(o,l){var u=this._scaleSpring.target.value===o;if(l){if(u&&this._scaleSpring.current.value===o)return;this._scaleSpring.resetTo(o),this._updateForScale(),this._needsDraw=!0}else{if(u)return;this._scaleSpring.springTo(o),this._updateForScale(),this._needsDraw=!0}u||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 o=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2))),l=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),!0).x*this._scaleSpring.current.value,u=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(l/this.minPixelRatio)/Math.log(2))));return u=Math.max(u,this.source.minLevel||0),o=Math.min(o,u),{lowestLevel:o,highestLevel:u}},_updateViewport:function(){for(this._needsDraw=!1,this._tilesLoading=0,this.loadingCoverage={};this.lastDrawn.length>0;){var o=this.lastDrawn.pop();o.beingDrawn=!1}var l=this.viewport,u=this._viewportToTiledImageRectangle(l.getBoundsWithMargins(!0));if(!this.wrapHorizontal&&!this.wrapVertical){var c=this._viewportToTiledImageRectangle(this.getClippedBounds(!0));if(u=u.intersection(c),u===null)return}for(var h=this._getLevelsInterval(),f=h.lowestLevel,p=h.highestLevel,m=null,b=!1,T=e.now(),y=p;y>=f;y--){var w=!1,S=l.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(y),!0).x*this._scaleSpring.current.value;if(y===f||!b&&S>=this.minPixelRatio)w=!0,b=!0;else if(!b)continue;var C=l.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(y),!1).x*this._scaleSpring.current.value,L=l.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),!1).x*this._scaleSpring.current.value,D=this.immediateRender?1:L,j=Math.min(1,(S-.5)/.5),N=D/Math.abs(D-C);if(m=this._updateLevel(b,w,y,j,N,u,T,m),this._providesCoverage(this.coverage,y))break}this._drawTiles(this.lastDrawn),m&&!m.context2D?(this._loadTile(m,T),this._needsDraw=!0,this._setFullyLoaded(!1)):this._setFullyLoaded(this._tilesLoading===0)},_getCornerTiles:function(o,l,u){var c,h;this.wrapHorizontal?(c=e.positiveModulo(l.x,1),h=e.positiveModulo(u.x,1)):(c=Math.max(0,l.x),h=Math.min(1,u.x));var f,p,m=1/this.source.aspectRatio;this.wrapVertical?(f=e.positiveModulo(l.y,m),p=e.positiveModulo(u.y,m)):(f=Math.max(0,l.y),p=Math.min(m,u.y));var b=this.source.getTileAtPoint(o,new e.Point(c,f)),T=this.source.getTileAtPoint(o,new e.Point(h,p)),y=this.source.getNumTiles(o);return this.wrapHorizontal&&(b.x+=y.x*Math.floor(l.x),T.x+=y.x*Math.floor(u.x)),this.wrapVertical&&(b.y+=y.y*Math.floor(l.y/m),T.y+=y.y*Math.floor(u.y/m)),{topLeft:b,bottomRight:T}},_updateLevel:function(o,l,u,c,h,f,p,m){var b=f.getBoundingBox().getTopLeft(),T=f.getBoundingBox().getBottomRight();this.viewer&&this.viewer.raiseEvent("update-level",{tiledImage:this,havedrawn:o,level:u,opacity:c,visibility:h,drawArea:f,topleft:b,bottomright:T,currenttime:p,best:m}),this._resetCoverage(this.coverage,u),this._resetCoverage(this.loadingCoverage,u);var y=this._getCornerTiles(u,b,T),w=y.topLeft,S=y.bottomRight,C=this.source.getNumTiles(u),L=this.viewport.pixelFromPoint(this.viewport.getCenter());this.getFlip()&&(S.x+=1,this.wrapHorizontal||(S.x=Math.min(S.x,C.x-1)));for(var D=w.x;D<=S.x;D++)for(var j=w.y;j<=S.y;j++){var N;if(this.getFlip()){var K=(C.x+D%C.x)%C.x;N=D+C.x-K-K-1}else N=D;f.intersection(this.getTileBounds(u,N,j))!==null&&(m=this._updateTile(l,o,N,j,u,c,h,L,C,p,m))}return m},_updateTile:function(o,l,u,c,h,f,p,m,b,T,y){var w=this._getTile(u,c,h,T,b,this._worldWidthCurrent,this._worldHeightCurrent),S=l;this.viewer&&this.viewer.raiseEvent("update-tile",{tiledImage:this,tile:w}),this._setCoverage(this.coverage,h,u,c,!1);var C=w.loaded||w.loading||this._isCovered(this.loadingCoverage,h,u,c);if(this._setCoverage(this.loadingCoverage,h,u,c,C),!w.exists||(o&&!S&&(this._isCovered(this.coverage,h,u,c)?this._setCoverage(this.coverage,h,u,c,!0):S=!0),!S))return y;if(this._positionTile(w,this.source.tileOverlap,this.viewport,m,p),!w.loaded)if(w.context2D)this._setTileLoaded(w);else{var L=this._tileCache.getImageRecord(w.cacheKey);L&&this._setTileLoaded(w,L.getData())}if(w.loaded){var D=this._blendTile(w,u,c,h,f,T);D&&(this._needsDraw=!0)}else w.loading?this._tilesLoading++:C||(y=this._compareTiles(y,w));return y},_getTile:function(o,l,u,c,h,f,p){var m,b,T,y,w,S,C,L,D,j,N=this.tilesMatrix,K=this.source;return N[u]||(N[u]={}),N[u][o]||(N[u][o]={}),(!N[u][o][l]||!N[u][o][l].flipped!=!this.flipped)&&(m=(h.x+o%h.x)%h.x,b=(h.y+l%h.y)%h.y,T=this.getTileBounds(u,o,l),y=K.getTileBounds(u,m,b,!0),w=K.tileExists(u,m,b),S=K.getTileUrl(u,m,b),C=K.getTilePostData(u,m,b),this.loadTilesWithAjax?(L=K.getTileAjaxHeaders(u,m,b),e.isPlainObject(this.ajaxHeaders)&&(L=e.extend({},this.ajaxHeaders,L))):L=null,D=K.getContext2D?K.getContext2D(u,m,b):void 0,j=new e.Tile(u,o,l,T,w,S,D,this.loadTilesWithAjax,L,y,C,K.getTileHashKey(u,m,b,S,L,C)),this.getFlip()?m===0&&(j.isRightMost=!0):m===h.x-1&&(j.isRightMost=!0),b===h.y-1&&(j.isBottomMost=!0),j.flipped=this.flipped,N[u][o][l]=j),j=N[u][o][l],j.lastTouchTime=c,j},_loadTile:function(o,l){var u=this;o.loading=!0,this._imageLoader.addJob({src:o.getUrl(),tile:o,source:this.source,postData:o.postData,loadWithAjax:o.loadWithAjax,ajaxHeaders:o.ajaxHeaders,crossOriginPolicy:this.crossOriginPolicy,ajaxWithCredentials:this.ajaxWithCredentials,callback:function(c,h,f){u._onTileLoad(o,l,c,h,f)},abort:function(){o.loading=!1}})},_onTileLoad:function(o,l,u,c,h){if(!u){e.console.error("Tile %s failed to load: %s - error: %s",o,o.getUrl(),c),this.viewer.raiseEvent("tile-load-failed",{tile:o,tiledImage:this,time:l,message:c,tileRequest:h}),o.loading=!1,o.exists=!1;return}if(lo.visibility||l.visibility===o.visibility&&l.squaredDistance1&&p>this.smoothTileEdgesMinZoom&&!this.iOSDevice&&this.getRotation(!0)%360===0&&e.supportsCanvas&&this.viewer.useCanvas&&(u=!0,c=l.getScaleForEdgeSmoothing(),h=l.getTranslationForEdgeSmoothing(c,this._drawer.getCanvasSize(!1),this._drawer.getCanvasSize(!0)));var m;u&&(c||(m=this.viewport.viewportToViewerElementRectangle(this.getClippedBounds(!0)).getIntegerBoundingBox(),this._drawer.viewer.viewport.getFlip()&&(this.viewport.getRotation(!0)%360!==0||this.getRotation(!0)%360!==0)&&(m.x=this._drawer.viewer.container.clientWidth-(m.x+m.width)),m=m.times(e.pixelDensityRatio)),this._drawer._clear(!0,m)),c||(this.viewport.getRotation(!0)%360!==0&&this._drawer._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:u}),this.getRotation(!0)%360!==0&&this._drawer._offsetForRotation({degrees:this.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(!0),!0),useSketch:u}),this.viewport.getRotation(!0)%360===0&&this.getRotation(!0)%360===0&&this._drawer.viewer.viewport.getFlip()&&this._drawer._flip());var b=!1;if(this._clip){this._drawer.saveContext(u);var T=this.imageToViewportRectangle(this._clip,!0);T=T.rotate(-this.getRotation(!0),this._getRotationPoint(!0));var y=this._drawer.viewportToDrawerRectangle(T);c&&(y=y.times(c)),h&&(y=y.translate(h)),this._drawer.setClip(y,u),b=!0}if(this._croppingPolygons){var w=this;this._drawer.saveContext(u);try{var S=this._croppingPolygons.map(function(se){return se.map(function(ue){var Se=w.imageToViewportCoordinates(ue.x,ue.y,!0).rotate(-w.getRotation(!0),w._getRotationPoint(!0)),Re=w._drawer.viewportCoordToDrawerCoord(Se);return c&&(Re=Re.times(c)),Re})});this._drawer.clipWithPolygons(S,u)}catch(se){e.console.error(se)}b=!0}if(this.placeholderFillStyle&&this._hasOpaqueTile===!1){var C=this._drawer.viewportToDrawerRectangle(this.getBounds(!0));c&&(C=C.times(c)),h&&(C=C.translate(h));var L=null;typeof this.placeholderFillStyle=="function"?L=this.placeholderFillStyle(this,this._drawer.context):L=this.placeholderFillStyle,this._drawer.drawRectangle(C,L,u)}var D=a(this.subPixelRoundingForTransparency),j=!1;if(D===e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS)j=!0;else if(D===e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST){var N=this.viewer&&this.viewer.isAnimating();j=!N}for(var K=o.length-1;K>=0;K--)l=o[K],this._drawer.drawTile(l,this._drawingHandler,u,c,h,j,this.source),l.beingDrawn=!0,this.viewer&&this.viewer.raiseEvent("tile-drawn",{tiledImage:this,tile:l});b&&this._drawer.restoreContext(u),c||(this.getRotation(!0)%360!==0&&this._drawer._restoreRotationChanges(u),this.viewport.getRotation(!0)%360!==0&&this._drawer._restoreRotationChanges(u)),u&&(c&&(this.viewport.getRotation(!0)%360!==0&&this._drawer._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:!1}),this.getRotation(!0)%360!==0&&this._drawer._offsetForRotation({degrees:this.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(!0),!0),useSketch:!1})),this._drawer.blendSketch({opacity:this.opacity,scale:c,translate:h,compositeOperation:this.compositeOperation,bounds:m}),c&&(this.getRotation(!0)%360!==0&&this._drawer._restoreRotationChanges(!1),this.viewport.getRotation(!0)%360!==0&&this._drawer._restoreRotationChanges(!1))),c||this.viewport.getRotation(!0)%360===0&&this.getRotation(!0)%360===0&&this._drawer.viewer.viewport.getFlip()&&this._drawer._flip(),this._drawDebugInfo(o)}},_drawDebugInfo:function(o){if(this.debugMode)for(var l=o.length-1;l>=0;l--){var u=o[l];try{this._drawer.drawDebugInfo(u,o.length,l,this)}catch(c){e.console.error(c)}}},_providesCoverage:function(o,l,u,c){var h,f,p,m;if(!o[l])return!1;if(u===void 0||c===void 0){h=o[l];for(p in h)if(Object.prototype.hasOwnProperty.call(h,p)){f=h[p];for(m in f)if(Object.prototype.hasOwnProperty.call(f,m)&&!f[m])return!1}return!0}return o[l][u]===void 0||o[l][u][c]===void 0||o[l][u][c]===!0},_isCovered:function(o,l,u,c){return u===void 0||c===void 0?this._providesCoverage(o,l+1):this._providesCoverage(o,l+1,2*u,2*c)&&this._providesCoverage(o,l+1,2*u,2*c+1)&&this._providesCoverage(o,l+1,2*u+1,2*c)&&this._providesCoverage(o,l+1,2*u+1,2*c+1)},_setCoverage:function(o,l,u,c,h){if(!o[l]){e.console.warn("Setting coverage for a tile before its level's coverage has been reset: %s",l);return}o[l][u]||(o[l][u]={}),o[l][u][c]=h},_resetCoverage:function(o,l){o[l]={}}});var n=e.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER;function r(o){return o!==e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS&&o!==e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST&&o!==e.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER}function s(o){return r(o)?n:o}function a(o){if(typeof o=="number")return s(o);if(!o||!e.Browser)return n;var l=o[e.Browser.vendor];return r(l)&&(l=o["*"]),s(l)}}(i),function(e){var n=function(s){e.console.assert(s,"[TileCache.cacheTile] options is required"),e.console.assert(s.tile,"[TileCache.cacheTile] options.tile is required"),e.console.assert(s.tiledImage,"[TileCache.cacheTile] options.tiledImage is required"),this.tile=s.tile,this.tiledImage=s.tiledImage},r=function(s){e.console.assert(s,"[ImageRecord] options is required"),e.console.assert(s.data,"[ImageRecord] options.data is required"),this._tiles=[],s.create.apply(null,[this,s.data,s.ownerTile]),this._destroyImplementation=s.destroy.bind(null,this),this.getImage=s.getImage.bind(null,this),this.getData=s.getData.bind(null,this),this.getRenderedContext=s.getRenderedContext.bind(null,this)};r.prototype={destroy:function(){this._destroyImplementation(),this._tiles=null},addTile:function(s){e.console.assert(s,"[ImageRecord.addTile] tile is required"),this._tiles.push(s)},removeTile:function(s){for(var a=0;athis._maxImageCacheCount){for(var u=null,c=-1,h=null,f,p,m,b,T,y,w=this._tilesLoaded.length-1;w>=0;w--)if(y=this._tilesLoaded[w],f=y.tile,!(f.level<=a||f.beingDrawn)){if(!u){u=f,c=w,h=y;continue}b=f.lastTouchTime,p=u.lastTouchTime,T=f.level,m=u.level,(bm)&&(u=f,c=w,h=y)}u&&c>=0&&(this._unloadTile(h),o=c)}this._tilesLoaded[o]=new n({tile:s.tile,tiledImage:s.tiledImage})},clearTilesFor:function(s){e.console.assert(s,"[TileCache.clearTilesFor] tiledImage is required");for(var a,o=0;o=this._items.length)throw new Error("Index bigger than number of layers.");r===s||s===-1||(this._items.splice(s,1),this._items.splice(r,0,n),this._needsDraw=!0,this.raiseEvent("item-index-change",{item:n,previousIndex:s,newIndex:r}))},removeItem:function(n){e.console.assert(n,"[World.removeItem] item is required");var r=e.indexOf(this._items,n);r!==-1&&(n.removeHandler("bounds-change",this._delegatedFigureSizes),n.removeHandler("clip-change",this._delegatedFigureSizes),n.destroy(),this._items.splice(r,1),this._figureSizes(),this._needsDraw=!0,this._raiseRemoveItem(n))},removeAll:function(){this.viewer._cancelPendingImages();var n,r;for(r=0;rb.height?T=l:T=l*(b.width/b.height),y=T*(b.height/b.width),w=new e.Point(f+(l-T)/2,p+(l-y)/2),m.setPosition(w,r),m.setWidth(T,r),s==="horizontal"?f+=c:p+=c;this.setAutoRefigureSizes(!0)},_figureSizes:function(){var n=this._homeBounds?this._homeBounds.clone():null,r=this._contentSize?this._contentSize.clone():null,s=this._contentFactor||0;if(!this._items.length)this._homeBounds=new e.Rect(0,0,1,1),this._contentSize=new e.Point(1,1),this._contentFactor=1;else{var a=this._items[0],o=a.getBounds();this._contentFactor=a.getContentSize().x/o.width;for(var l=a.getClippedBounds().getBoundingBox(),u=l.x,c=l.y,h=l.x+l.width,f=l.y+l.height,p=1;p{i.value=AS({id:"osdViewer",prefixUrl:"https://cdn.jsdelivr.net/gh/Benomrans/openseadragon-icons@main/images/",sequenceMode:!1,showRotationControl:!0,tileSources:[],defaultZoomLevel:.8,minZoomLevel:.2})}),gu(()=>{e.currentImage!=null&&Je.get(e.currentImage.info).then(n=>{i.value.open(n.data)})}),(n,r)=>(ie(),le("div",{id:"osdViewer",class:q(n.$style.viewer)},null,2))}},[["__cssModules",{$style:{viewer:"liv_viewer__viewer"}}]]),DS=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),MS=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),NS=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),LS=/[^\p{L}\d]+/giu,pd="$1\0$2",md="";function gd(t){let i=t.trim();i=i.replace(DS,pd).replace(MS,pd),i=i.replace(LS,"\0");let e=0,n=i.length;for(;i.charAt(e)==="\0";)e++;if(e===n)return[];for(;i.charAt(n-1)==="\0";)n--;return i.slice(e,n).split(/\0/g)}function FS(t){const i=gd(t);for(let e=0;eu===0?o(l):s(l)).join((i==null?void 0:i.delimiter)??" ")+r}function zS(t){return t===!1?i=>i.toLowerCase():i=>i.toLocaleLowerCase(t)}function HS(t){return t===!1?i=>i.toUpperCase():i=>i.toLocaleUpperCase(t)}function BS(t,i){return e=>`${i(e[0])}${t(e.slice(1))}`}function US(t,i={}){const e=i.split??(i.separateNumbers?FS:gd),n=i.prefixCharacters??md,r=i.suffixCharacters??md;let s=0,a=t.length;for(;ss;){const o=a-1,l=t.charAt(o);if(!r.includes(l))break;a=o}return[t.slice(0,s),e(t.slice(s,a)),t.slice(a)]}function Zs(t){return Lr()?(uo(t),!0):!1}function gt(t){return typeof t=="function"?t():k(t)}const Ys=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const VS=t=>t!=null,jS=Object.prototype.toString,WS=t=>jS.call(t)==="[object Object]",Ct=()=>{},GS=qS();function qS(){var t,i;return Ys&&((t=window==null?void 0:window.navigator)==null?void 0:t.userAgent)&&(/iP(ad|hone|od)/.test(window.navigator.userAgent)||((i=window==null?void 0:window.navigator)==null?void 0:i.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function yd(t,i){function e(...n){return new Promise((r,s)=>{Promise.resolve(t(()=>i.apply(this,n),{fn:i,thisArg:this,args:n})).then(r).catch(s)})}return e}function KS(t,i={}){let e,n,r=Ct;const s=o=>{clearTimeout(o),r(),r=Ct};return o=>{const l=gt(t),u=gt(i.maxWait);return e&&s(e),l<=0||u!==void 0&&u<=0?(n&&(s(n),n=null),Promise.resolve(o())):new Promise((c,h)=>{r=i.rejectOnCancel?h:c,u&&!n&&(n=setTimeout(()=>{e&&s(e),n=null,c(o())},u)),e=setTimeout(()=>{n&&s(n),n=null,c(o())},l)})}}function ZS(t,i=!0,e=!0,n=!1){let r=0,s,a=!0,o=Ct,l;const u=()=>{s&&(clearTimeout(s),s=void 0,o(),o=Ct)};return h=>{const f=gt(t),p=Date.now()-r,m=()=>l=h();return u(),f<=0?(r=Date.now(),m()):(p>f&&(e||!a)?(r=Date.now(),m()):i&&(l=new Promise((b,T)=>{o=n?T:b,s=setTimeout(()=>{r=Date.now(),a=!0,b(m()),u()},Math.max(0,f-p))})),!e&&!s&&(s=setTimeout(()=>a=!0,f)),a=!1,l)}}function YS(t){let i;function e(){return i||(i=t()),i}return e.reset=async()=>{const n=i;i=void 0,n&&await n},e}function XS(t){return t||rs()}function JS(t,i=200,e={}){return yd(KS(i,e),t)}function QS(t,i=200,e=!1,n=!0,r=!1){return yd(ZS(i,e,n,r),t)}function $S(t,i=!0,e){XS()?oi(t,e):i?t():Fn(t)}function eE(t,i,e={}){const{immediate:n=!0}=e,r=$(!1);let s=null;function a(){s&&(clearTimeout(s),s=null)}function o(){r.value=!1,a()}function l(...u){a(),r.value=!0,s=setTimeout(()=>{r.value=!1,s=null,t(...u)},gt(i))}return n&&(r.value=!0,Ys&&l()),Zs(o),{isPending:bo(r),start:l,stop:o}}function ti(t){var i;const e=gt(t);return(i=e==null?void 0:e.$el)!=null?i:e}const An=Ys?window:void 0,bd=Ys?window.navigator:void 0;function rn(...t){let i,e,n,r;if(typeof t[0]=="string"||Array.isArray(t[0])?([e,n,r]=t,i=An):[i,e,n,r]=t,!i)return Ct;Array.isArray(e)||(e=[e]),Array.isArray(n)||(n=[n]);const s=[],a=()=>{s.forEach(c=>c()),s.length=0},o=(c,h,f,p)=>(c.addEventListener(h,f,p),()=>c.removeEventListener(h,f,p)),l=$e(()=>[ti(i),gt(r)],([c,h])=>{if(a(),!c)return;const f=WS(h)?{...h}:h;s.push(...e.flatMap(p=>n.map(m=>o(c,p,m,f))))},{immediate:!0,flush:"post"}),u=()=>{l(),a()};return Zs(u),u}let wd=!1;function tE(t,i,e={}){const{window:n=An,ignore:r=[],capture:s=!0,detectIframe:a=!1}=e;if(!n)return Ct;GS&&!wd&&(wd=!0,Array.from(n.document.body.children).forEach(f=>f.addEventListener("click",Ct)),n.document.documentElement.addEventListener("click",Ct));let o=!0;const l=f=>r.some(p=>{if(typeof p=="string")return Array.from(n.document.querySelectorAll(p)).some(m=>m===f.target||f.composedPath().includes(m));{const m=ti(p);return m&&(f.target===m||f.composedPath().includes(m))}}),c=[rn(n,"click",f=>{const p=ti(t);if(!(!p||p===f.target||f.composedPath().includes(p))){if(f.detail===0&&(o=!l(f)),!o){o=!0;return}i(f)}},{passive:!0,capture:s}),rn(n,"pointerdown",f=>{const p=ti(t);o=!l(f)&&!!(p&&!f.composedPath().includes(p))},{passive:!0}),a&&rn(n,"blur",f=>{setTimeout(()=>{var p;const m=ti(t);((p=n.document.activeElement)==null?void 0:p.tagName)==="IFRAME"&&!(m!=null&&m.contains(n.document.activeElement))&&i(f)},0)})].filter(Boolean);return()=>c.forEach(f=>f())}function iE(){const t=$(!1);return rs()&&oi(()=>{t.value=!0}),t}function Xs(t){const i=iE();return Y(()=>(i.value,!!t()))}function _d(t,i={}){const{controls:e=!1,navigator:n=bd}=i,r=Xs(()=>n&&"permissions"in n);let s;const a=typeof t=="string"?{name:t}:t,o=$(),l=()=>{s&&(o.value=s.state)},u=YS(async()=>{if(r.value){if(!s)try{s=await n.permissions.query(a),rn(s,"change",l),l()}catch{o.value="prompt"}return s}});return u(),e?{state:o,isSupported:r,query:u}:o}function nE(t={}){const{navigator:i=bd,read:e=!1,source:n,copiedDuring:r=1500,legacy:s=!1}=t,a=Xs(()=>i&&"clipboard"in i),o=_d("clipboard-read"),l=_d("clipboard-write"),u=Y(()=>a.value||s),c=$(""),h=$(!1),f=eE(()=>h.value=!1,r);function p(){a.value&&o.value!=="denied"?i.clipboard.readText().then(y=>{c.value=y}):c.value=T()}u.value&&e&&rn(["copy","cut"],p);async function m(y=gt(n)){u.value&&y!=null&&(a.value&&l.value!=="denied"?await i.clipboard.writeText(y):b(y),c.value=y,h.value=!0,f.start())}function b(y){const w=document.createElement("textarea");w.value=y??"",w.style.position="absolute",w.style.opacity="0",document.body.appendChild(w),w.select(),document.execCommand("copy"),w.remove()}function T(){var y,w,S;return(S=(w=(y=document==null?void 0:document.getSelection)==null?void 0:y.call(document))==null?void 0:w.toString())!=null?S:""}return{isSupported:u,text:c,copied:h,copy:m}}function rE(t,i,e={}){const{window:n=An,...r}=e;let s;const a=Xs(()=>n&&"ResizeObserver"in n),o=()=>{s&&(s.disconnect(),s=void 0)},l=Y(()=>Array.isArray(t)?t.map(h=>ti(h)):[ti(t)]),u=$e(l,h=>{if(o(),a.value&&n){s=new ResizeObserver(i);for(const f of h)f&&s.observe(f,r)}},{immediate:!0,flush:"post",deep:!0}),c=()=>{o(),u()};return Zs(c),{isSupported:a,stop:c}}function sE(t,i,e={}){const{root:n,rootMargin:r="0px",threshold:s=.1,window:a=An,immediate:o=!0}=e,l=Xs(()=>a&&"IntersectionObserver"in a),u=Y(()=>{const m=gt(t);return(Array.isArray(m)?m:[m]).map(ti).filter(VS)});let c=Ct;const h=$(o),f=l.value?$e(()=>[u.value,ti(n),h.value],([m,b])=>{if(c(),!h.value||!m.length)return;const T=new IntersectionObserver(i,{root:ti(b),rootMargin:r,threshold:s});m.forEach(y=>y&&T.observe(y)),c=()=>{T.disconnect(),c=Ct}},{immediate:o,flush:"post"}):Ct,p=()=>{c(),f(),h.value=!1};return Zs(p),{isSupported:l,isActive:h,pause(){c(),h.value=!1},resume(){h.value=!0},stop:p}}function oE(t,i={}){const{window:e=An,scrollTarget:n}=i,r=$(!1);return sE(t,s=>{let a=r.value,o=0;for(const l of s)l.time>=o&&(o=l.time,a=l.isIntersecting);r.value=a},{root:n,window:e,threshold:0}),r}const Td=1;function aE(t,i={}){const{throttle:e=0,idle:n=200,onStop:r=Ct,onScroll:s=Ct,offset:a={left:0,right:0,top:0,bottom:0},eventListenerOptions:o={capture:!1,passive:!0},behavior:l="auto",window:u=An}=i,c=$(0),h=$(0),f=Y({get(){return c.value},set(D){m(D,void 0)}}),p=Y({get(){return h.value},set(D){m(void 0,D)}});function m(D,j){var N,K,se;if(!u)return;const ue=gt(t);ue&&((se=ue instanceof Document?u.document.body:ue)==null||se.scrollTo({top:(N=gt(j))!=null?N:p.value,left:(K=gt(D))!=null?K:f.value,behavior:gt(l)}))}const b=$(!1),T=Kt({left:!0,right:!1,top:!0,bottom:!1}),y=Kt({left:!1,right:!1,top:!1,bottom:!1}),w=D=>{b.value&&(b.value=!1,y.left=!1,y.right=!1,y.top=!1,y.bottom=!1,r(D))},S=JS(w,e+n),C=D=>{var j;if(!u)return;const N=D.document?D.document.documentElement:(j=D.documentElement)!=null?j:D,{display:K,flexDirection:se}=getComputedStyle(N),ue=N.scrollLeft;y.left=uec.value;const Se=Math.abs(ue)<=0+(a.left||0),Re=Math.abs(ue)+N.clientWidth>=N.scrollWidth-(a.right||0)-Td;K==="flex"&&se==="row-reverse"?(T.left=Re,T.right=Se):(T.left=Se,T.right=Re),c.value=ue;let Ee=N.scrollTop;D===u.document&&!Ee&&(Ee=u.document.body.scrollTop),y.top=Eeh.value;const Me=Math.abs(Ee)<=0+(a.top||0),ge=Math.abs(Ee)+N.clientHeight>=N.scrollHeight-(a.bottom||0)-Td;K==="flex"&&se==="column-reverse"?(T.top=ge,T.bottom=Me):(T.top=Me,T.bottom=ge),h.value=Ee},L=D=>{var j;if(!u)return;const N=(j=D.target.documentElement)!=null?j:D.target;C(N),b.value=!0,S(D),s(D)};return rn(t,"scroll",e?QS(L,e,!0,!1):L,o),$S(()=>{const D=gt(t);D&&C(D)}),rn(t,"scrollend",w,o),{x:f,y:p,isScrolling:b,arrivedState:T,directions:y,measure(){const D=gt(t);u&&D&&C(D)}}}function lE(t){return typeof Window<"u"&&t instanceof Window?t.document.documentElement:typeof Document<"u"&&t instanceof Document?t.documentElement:t}function xd(t,i,e={}){var n;const{direction:r="bottom",interval:s=100,canLoadMore:a=()=>!0}=e,o=Kt(aE(t,{...e,offset:{[r]:(n=e.distance)!=null?n:0,...e.offset}})),l=$(),u=Y(()=>!!l.value),c=Y(()=>lE(gt(t))),h=oE(c);function f(){if(o.measure(),!c.value||!h.value||!a(c.value))return;const{scrollHeight:p,clientHeight:m,scrollWidth:b,clientWidth:T}=c.value,y=r==="bottom"||r==="top"?p<=m:b<=T;(o.arrivedState[r]||y)&&(l.value||(l.value=Promise.all([i(o),new Promise(w=>setTimeout(w,s))]).finally(()=>{l.value=null,Fn(()=>f())})))}return $e(()=>[o.arrivedState[r],h.value],f,{immediate:!0}),{isLoading:u}}const uE={main:"liv_copyable__main",button:"liv_copyable__button"},cE={key:0},Sd=nn({__name:"Copyable",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(t){const i=Qu(t,"modelValue"),{text:e,copy:n,copied:r,isSupported:s}=nE({model:i,legacy:!0});return(a,o)=>(ie(),le("div",{class:q(a.$style.main)},[ee("div",{class:q(a.$style.body)},[Ei(a.$slots,"default",{},()=>[mt(Oe(i.value),1)])],2),k(s)?(ie(),le("div",cE,[be(k(Vt),{size:"sm",onClick:o[0]||(o[0]=l=>k(n)(i.value))},{default:ut(()=>[ee("i",{class:q(["fas",k(r)?"fa-check":"fa-clipboard"])},null,2)]),_:1})])):qe("",!0)],2))}},[["__cssModules",{$style:uE}]]),hE={overlay:"liv_overlay__overlay",main:"liv_overlay__main",close:"liv_overlay__close",closed:"liv_overlay__closed",record:"liv_overlay__record",header:"liv_overlay__header",title:"liv_overlay__title",subtitle:"liv_overlay__subtitle",fieldToggle:"liv_overlay__fieldToggle",recordLinks:"liv_overlay__recordLinks",recordLink:"liv_overlay__recordLink",shareBtn:"liv_overlay__shareBtn",manifestBtn:"liv_overlay__manifestBtn",shareLinks:"liv_overlay__shareLinks",dataBlock:"liv_overlay__dataBlock"},fE=["href"],dE=["action"],pE=ee("i",{class:"fas fa-download"},null,-1),mE=ee("span",{class:"sr-only"},"Download image",-1),gE=ee("i",{class:"fas fa-share-alt"},null,-1),vE=ee("span",{class:"sr-only"},"Share",-1),yE=ee("span",null,"Record",-1),bE=["href"],wE=ee("span",null,"Image",-1),_E=["href"],TE=["href"],xE=[ee("img",{src:"/images/iiif.png",alt:"IIIF Manifest"},null,-1)],SE=ee("h3",null,"Record",-1),EE=ee("h3",null,"Image",-1),PE=ee("dt",null,"URL",-1),RE=["href"],CE=["href"],OE=nn({__name:"Overlay",setup(t){const i=zi(),{showOverlay:e,currentRecord:n,currentImage:r}=_g(i),s=$(!0),a=$(!1),o=$(null),l=Y(()=>c(n.value?n.value.imageViewerUrl:"")),u=Y(()=>c(r.value?r.value.imageViewerUrl:""));function c(h){return[window.location.origin,h].join("")}return tE(o,()=>{e.value&&(e.value=!1)}),$e(e,()=>{e.value?s.value=!1:setTimeout(()=>{s.value=!0},350)}),(h,f)=>(ie(),le(De,null,[ee("div",{class:q([h.$style.overlay,h.$style.main]),style:qt({top:k(e)?"20%":"100%"}),ref_key:"container",ref:o},[be(k(Vt),{size:"sm",onClick:f[0]||(f[0]=p=>e.value=!1),class:q(h.$style.close)},{default:ut(()=>[mt("close ")]),_:1},8,["class"]),xt(be(kS,null,null,512),[[us,k(e)]]),k(e)&&(k(n)||k(r))?(ie(),le("div",{key:0,class:q(h.$style.record)},[ee("div",{class:q(h.$style.header)},[ee("h2",{class:q(h.$style.title)},Oe(k(n)?k(n).title:k(r).name),3),k(n)?(ie(),le(De,{key:0},[ee("span",{class:q(h.$style.subtitle)},Oe(k(n).subtitle),3),ee("div",{class:q(h.$style.recordLinks)},[k(n)&&k(n).url?(ie(),le("a",{key:0,href:k(n).url,class:q(h.$style.recordLink)},"View record",10,fE)):qe("",!0),ee("form",{method:"get",action:`${k(r).url}/original`},[be(k(Vt),{size:"sm"},{default:ut(()=>[pE,mE]),_:1})],8,dE),be(k(TS),{header:"Sharing links","button-args":{size:"sm"}},{button:ut(()=>[gE,vE]),default:ut(()=>[ee("div",{class:q(h.$style.shareLinks)},[yE,be(Sd,{modelValue:l.value,"onUpdate:modelValue":f[1]||(f[1]=p=>l.value=p)},{default:ut(()=>[ee("a",{href:k(n).imageViewerUrl},Oe(l.value),9,bE)]),_:1},8,["modelValue"]),wE,be(Sd,{modelValue:u.value,"onUpdate:modelValue":f[2]||(f[2]=p=>u.value=p)},{default:ut(()=>[ee("a",{href:k(r).imageViewerUrl},Oe(u.value),9,_E)]),_:1},8,["modelValue"])],2)]),_:1}),ee("a",{target:"_blank",href:k(n).manifest,class:q(h.$style.manifestBtn)},xE,10,TE)],2)],64)):qe("",!0)],2),ee("div",{class:q(h.$style.fieldToggle)},[be(k(st),{"zoa-type":"checkbox",modelValue:a.value,"onUpdate:modelValue":f[3]||(f[3]=p=>a.value=p),label:"Use original field names","label-position":"left"},null,8,["modelValue"])],2),k(n)?(ie(),le("div",{key:0,class:q(h.$style.dataBlock)},[SE,ee("dl",null,[(ie(!0),le(De,null,yt(k(n).displayData,p=>(ie(),le(De,null,[ee("dt",null,Oe(a.value?p.key:k(vd)(p.key)),1),ee("dd",null,Oe(p.value),1)],64))),256))])],2)):qe("",!0),k(r)?(ie(),le("div",{key:1,class:q(h.$style.dataBlock)},[EE,ee("dl",null,[PE,ee("dd",null,[ee("a",{href:k(r).url},Oe(k(r).url),9,RE)]),(ie(!0),le(De,null,yt(k(r).displayData,p=>(ie(),le(De,null,[ee("dt",null,Oe(a.value?p.key:k(vd)(p.key)),1),ee("dd",null,[p.value.toString().startsWith("http")?(ie(),le("a",{key:0,href:p.value},Oe(p.value),9,CE)):(ie(),le(De,{key:1},[mt(Oe(p.value),1)],64))])],64))),256))])],2)):qe("",!0)],2)):qe("",!0)],6),s.value?(ie(),le("div",{key:0,class:q([h.$style.overlay,h.$style.closed])},[be(k(Vt),{size:"sm",onClick:f[4]||(f[4]=p=>e.value=!0),class:q(h.$style.open)},{default:ut(()=>[mt("open viewer ")]),_:1},8,["class"])],2)):qe("",!0)],64))}},[["__cssModules",{$style:hE}]]),IE={class:"container"},AE=ee("h1",null,"Image viewer",-1),kE={__name:"App",setup(t){const i=zi();return oi(i.getAllResources),(e,n)=>{const r=jp("router-view");return ie(),le("div",IE,[AE,be(OE),be(r)])}}},DE=mg().use(xv()),Er=hg(kE);Er.config.performance=!0,Er.component("fa-icon",Ub),Er.use(DE),Er.use(OS),Er.mount("#liv-app");function ME(t){t=t.replace(/_/g,"-"),t=t.replace(/[.:][\w-]*$/,"");try{return new Intl.Locale(t).baseName}catch{return"en-US"}}var NE=ME;const LE=NE;let Pr;if(typeof navigator<"u"){const t=navigator;Pr=Array.isArray(t.languages)?t.languages[0]:t.language}else if(typeof process<"u"){const t={GITHUB_STATE:"/home/runner/work/_temp/_runner_file_commands/save_state_153acb89-c152-4f4d-b3b1-6467bca6c856",STATS_TRP:"true",DEPLOYMENT_BASEPATH:"/opt/runner",DOTNET_NOLOGO:"1",USER:"runner",npm_config_user_agent:"npm/8.19.4 node/v16.20.2 linux x64 workspaces/false ci/github-actions",CI:"true",RUNNER_ENVIRONMENT:"github-hosted",GITHUB_ENV:"/home/runner/work/_temp/_runner_file_commands/set_env_153acb89-c152-4f4d-b3b1-6467bca6c856",PIPX_HOME:"/opt/pipx",npm_node_execpath:"/opt/hostedtoolcache/node/16.20.2/x64/bin/node",JAVA_HOME_8_X64:"/usr/lib/jvm/temurin-8-jdk-amd64",SHLVL:"1",npm_config_noproxy:"",HOME:"/home/runner",RUNNER_TEMP:"/home/runner/work/_temp",GITHUB_EVENT_PATH:"/home/runner/work/_temp/_github_workflow/event.json",npm_package_json:"/home/runner/work/zoa/zoa/package.json",JAVA_HOME_11_X64:"/usr/lib/jvm/temurin-11-jdk-amd64",PIPX_BIN_DIR:"/opt/pipx_bin",GITHUB_REPOSITORY_OWNER:"NaturalHistoryMuseum",GRADLE_HOME:"/usr/share/gradle-8.6",ANDROID_NDK_LATEST_HOME:"/usr/local/lib/android/sdk/ndk/26.2.11394342",JAVA_HOME_21_X64:"/usr/lib/jvm/temurin-21-jdk-amd64",STATS_RDCL:"true",GITHUB_RETENTION_DAYS:"90",GITHUB_REPOSITORY_OWNER_ID:"5260760",POWERSHELL_DISTRIBUTION_CHANNEL:"GitHub-Actions-ubuntu22",AZURE_EXTENSION_DIR:"/opt/az/azcliextensions",GITHUB_HEAD_REF:"",npm_config_userconfig:"/home/runner/.npmrc",npm_config_local_prefix:"/home/runner/work/zoa/zoa",SYSTEMD_EXEC_PID:"590",GITHUB_GRAPHQL_URL:"https://api.github.com/graphql",COLOR:"0",GOROOT_1_20_X64:"/opt/hostedtoolcache/go/1.20.14/x64",NVM_DIR:"/home/runner/.nvm",npm_config_metrics_registry:"https://registry.npmjs.org/",DOTNET_SKIP_FIRST_TIME_EXPERIENCE:"1",GOROOT_1_21_X64:"/opt/hostedtoolcache/go/1.21.7/x64",JAVA_HOME_17_X64:"/usr/lib/jvm/temurin-17-jdk-amd64",ImageVersion:"20240225.1.0",RUNNER_OS:"Linux",GITHUB_API_URL:"https://api.github.com",GOROOT_1_22_X64:"/opt/hostedtoolcache/go/1.22.0/x64",SWIFT_PATH:"/usr/share/swift/usr/bin",RUNNER_USER:"runner",STATS_V3PS:"true",CHROMEWEBDRIVER:"/usr/local/share/chromedriver-linux64",JOURNAL_STREAM:"8:1900",GITHUB_WORKFLOW:"Bump version",_:"/opt/hostedtoolcache/node/16.20.2/x64/bin/npm",npm_config_prefix:"/opt/hostedtoolcache/node/16.20.2/x64",ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE:"/opt/actionarchivecache",GITHUB_RUN_ID:"8154276901",npm_config_cache:"/home/runner/.npm",GITHUB_REF_TYPE:"branch",BOOTSTRAP_HASKELL_NONINTERACTIVE:"1",GITHUB_WORKFLOW_SHA:"31171e01c4ef6ee26a531892f61ee4c47b853953",GITHUB_BASE_REF:"",ImageOS:"ubuntu22",STATS_BLT:"true",GITHUB_WORKFLOW_REF:"NaturalHistoryMuseum/zoa/.github/workflows/bump.yml@refs/heads/main",PERFLOG_LOCATION_SETTING:"RUNNER_PERFLOG",GITHUB_ACTION_REPOSITORY:"",npm_config_node_gyp:"/opt/hostedtoolcache/node/16.20.2/x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",PATH:"/home/runner/work/zoa/zoa/node_modules/.bin:/home/runner/work/zoa/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/16.20.2/x64/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/opt/hostedtoolcache/node/16.20.2/x64/bin:/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",ANT_HOME:"/usr/share/ant",DOTNET_MULTILEVEL_LOOKUP:"0",RUNNER_TRACKING_ID:"github_3e812db5-5506-4146-8c04-c401635a73f2",INVOCATION_ID:"4832b2da6c0341a7aed099611ef2c802",RUNNER_TOOL_CACHE:"/opt/hostedtoolcache",NODE:"/opt/hostedtoolcache/node/16.20.2/x64/bin/node",npm_package_name:"@nhm-data/zoa",GITHUB_ACTION:"__run_2",GITHUB_RUN_NUMBER:"31",GITHUB_TRIGGERING_ACTOR:"alycejenni",RUNNER_ARCH:"X64",XDG_RUNTIME_DIR:"/run/user/1001",AGENT_TOOLSDIRECTORY:"/opt/hostedtoolcache",LANG:"C.UTF-8",VCPKG_INSTALLATION_ROOT:"/usr/local/share/vcpkg",CONDA:"/usr/share/miniconda",RUNNER_NAME:"GitHub Actions 2",XDG_CONFIG_HOME:"/home/runner/.config",STATS_VMD:"true",GITHUB_REF_NAME:"main",GITHUB_REPOSITORY:"NaturalHistoryMuseum/zoa",npm_lifecycle_script:"vite build",STATS_UE:"true",ANDROID_NDK_ROOT:"/usr/local/lib/android/sdk/ndk/25.2.9519653",GITHUB_ACTION_REF:"",DEBIAN_FRONTEND:"noninteractive",GITHUB_REPOSITORY_ID:"630464665",GITHUB_ACTIONS:"true",npm_package_version:"0.8.0",npm_lifecycle_event:"build",GITHUB_REF_PROTECTED:"false",GITHUB_WORKSPACE:"/home/runner/work/zoa/zoa",ACCEPT_EULA:"Y",GITHUB_JOB:"build-then-bump",RUNNER_PERFLOG:"/home/runner/perflog",GITHUB_SHA:"31171e01c4ef6ee26a531892f61ee4c47b853953",GITHUB_RUN_ATTEMPT:"1",GITHUB_REF:"refs/heads/main",GITHUB_ACTOR:"alycejenni",ANDROID_SDK_ROOT:"/usr/local/lib/android/sdk",LEIN_HOME:"/usr/local/lib/lein",npm_config_globalconfig:"/opt/hostedtoolcache/node/16.20.2/x64/etc/npmrc",npm_config_init_module:"/home/runner/.npm-init.js",GITHUB_PATH:"/home/runner/work/_temp/_runner_file_commands/add_path_153acb89-c152-4f4d-b3b1-6467bca6c856",JAVA_HOME:"/usr/lib/jvm/temurin-11-jdk-amd64",PWD:"/home/runner/work/zoa/zoa",GITHUB_ACTOR_ID:"23579762",RUNNER_WORKSPACE:"/home/runner/work/zoa",npm_execpath:"/opt/hostedtoolcache/node/16.20.2/x64/lib/node_modules/npm/bin/npm-cli.js",HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS:"3650",STATS_TIS:"mining",GITHUB_EVENT_NAME:"push",HOMEBREW_NO_AUTO_UPDATE:"1",ANDROID_HOME:"/usr/local/lib/android/sdk",GITHUB_SERVER_URL:"https://github.com",GECKOWEBDRIVER:"/usr/local/share/gecko_driver",LEIN_JAR:"/usr/local/lib/lein/self-installs/leiningen-2.11.2-standalone.jar",GHCUP_INSTALL_BASE_PREFIX:"/usr/local",GITHUB_OUTPUT:"/home/runner/work/_temp/_runner_file_commands/set_output_153acb89-c152-4f4d-b3b1-6467bca6c856",npm_config_global_prefix:"/opt/hostedtoolcache/node/16.20.2/x64",EDGEWEBDRIVER:"/usr/local/share/edge_driver",STATS_EXT:"true",npm_command:"run-script",ANDROID_NDK:"/usr/local/lib/android/sdk/ndk/25.2.9519653",SGX_AESM_ADDR:"1",CHROME_BIN:"/usr/bin/google-chrome",SELENIUM_JAR_PATH:"/usr/share/java/selenium-server.jar",STATS_EXTP:"https://provjobdsettingscdn.blob.core.windows.net/settings/provjobdsettings-0.5.154/provjobd.data",ANDROID_NDK_HOME:"/usr/local/lib/android/sdk/ndk/25.2.9519653",GITHUB_STEP_SUMMARY:"/home/runner/work/_temp/_runner_file_commands/step_summary_153acb89-c152-4f4d-b3b1-6467bca6c856",INIT_CWD:"/home/runner/work/zoa/zoa",EDITOR:"vi",NODE_ENV:"production"};Pr=t.LC_ALL||t.LC_MESSAGES||t.LANG||t.LANGUAGE}Pr||(Pr="en-US");var Js=LE(Pr);const Ed={};for(let t=1;t<100;t++){const i=(t<9?"0":"")+t;Ed[i]=t+(t>51?1900:2e3)}var FE=Ed,vl={"Eastern Daylight Time":-240,"Eastern Standard Time":-300,"Central Daylight Time":-300,"Central Standard Time":-360,"Mountain Daylight Time":-360,"Mountain Standard Time":-420,"Pacific Daylight Time":-420,"Pacific Standard Time":-480,ACDT:630,ACST:570,ACT:480,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,AMST:-180,AMT:-240,ART:-180,AST:180,AWDT:540,AWST:480,AZOST:-60,AZT:240,BDT:360,BIOT:360,BIT:-720,BOT:-240,BRST:-120,BRT:-180,BTT:360,CAT:120,CCT:390,CDT:-300,CEDT:120,CEST:120,CET:60,CHADT:825,CHAST:765,CHOT:480,ChST:600,CHUT:600,CIST:-480,CIT:480,CKT:-600,CLST:-180,CLT:-240,COST:-240,COT:-300,CST:-360,CT:480,CVT:-60,CXT:420,DAVT:420,DDUT:600,DFT:60,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEDT:180,EEST:180,EET:120,EGST:0,EGT:-60,EIT:540,EST:-300,FET:180,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GIT:-540,GMT:0,GST:-120,GYT:-240,HADT:-540,HAEC:120,HAST:-600,HKT:480,HMT:300,HOVT:420,HST:-600,IBST:0,ICT:420,IDT:180,IOT:180,IRDT:270,IRKT:480,IRST:210,IST:120,JST:540,KGT:360,KOST:660,KRAT:420,KST:540,LHST:630,LINT:840,MAGT:720,MART:-510,MAWT:300,MDT:-360,MET:60,MEST:120,MHT:720,MIST:660,MIT:-510,MMT:390,MSK:180,MST:-420,MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:660,NPT:345,NST:-150,NT:-150,NUT:-660,NZDT:780,NZST:720,OMST:360,ORAT:300,PDT:-420,PET:-300,PETT:720,PGT:600,PHOT:780,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PYST:-180,PYT:-240,RET:240,ROTT:-180,SAKT:660,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SLST:330,SRET:660,SRT:-180,SST:480,SYOT:180,TAHT:-600,THA:420,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TOT:780,TVT:720,UCT:0,ULAT:480,USZ1:120,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-240,VLAT:600,VOLT:240,VOST:360,VUT:660,WAKT:720,WAST:120,WAT:60,WEDT:60,WEST:60,WET:0,WIT:420,WST:480,YAKT:540,YEKT:300,Z:0},zE={zone:vl,year:FE,meridiem:{am:0,pm:12,"a.m.":0,"p.m.":12},month:{january:1,jan:1,february:2,feb:2,march:3,mar:3,april:4,apr:4,may:5,june:6,jun:6,july:7,jul:7,august:8,aug:8,september:9,sep:9,october:10,oct:10,november:11,nov:11,december:12,dec:12},dayname:{sunday:0,sun:0,monday:1,mon:1,tuesday:2,tue:2,wednesday:3,wed:3,thursday:4,thu:4,friday:5,fri:5,saturday:6,sat:6},digit:{}};const HE=vl,Pd={MONTHNAME:"january|february|march|april|may|june|july|august|september|october|november|december|jan\\.?|feb\\.?|mar\\.?|apr\\.?|may\\.?|jun\\.?|jul\\.?|aug\\.?|sep\\.?|oct\\.?|nov\\.?|dec\\.?",DAYNAME:"sunday|monday|tuesday|wednesday|thursday|friday|saturday|sun\\.?|mon\\.?|tue\\.?|wed\\.?|thu\\.?|fri\\.?|sat\\.?",ZONE:"\\(?("+Object.keys(HE).join("|")+")\\)?",MERIDIEM:"[ap]\\.?m?\\.?",ORDINAL:"st|nd|rd|th|\\.",YEAR:"[1-9]\\d{3}|\\d{2}",MONTH:"1[0-2]|0?[1-9]",MONTH2:"1[0-2]|0[1-9]",DAY:"3[01]|[12]\\d|0?[1-9]",DAY2:"3[01]|[12]\\d|0[1-9]",OFFSET:"[+-][01]?\\d?\\:?(?:[0-5]\\d)?",H24:"[01]\\d|2[0-3]",H12:"0?[1-9]|1[012]",MIN:"[0-5]\\d",SEC:"[0-5]\\d|60",MS:"\\d{9}|\\d{6}|\\d{1,3}",SPACE:"[\\s,-]"},BE={...Pd,YEAR:"*{4}|*{2}",MONTH:"*{1,2}",MONTH2:"*{2}",DAY:"*{1,2}",DAY2:"*{2}",OFFSET:"[+-]*{1,2}\\:?*{0,2}",H24:"*{2}",H12:"*{1,2}",MIN:"*{2}",SEC:"*{2}",MS:"*{9}|*{6}|*{3}"};var UE={latn:Pd,other:BE};const Rd={arab:1632,arabext:1776,bali:6992,beng:2534,deva:2406,fullwide:65296,gujr:2790,khmr:6112,knda:3302,laoo:3792,limb:6470,mlym:3430,mong:6160,mymr:4160,orya:2918,tamldec:3046,telu:3174,thai:3664,tibt:3872},Cd="[0123456789〇一二三四五六七八九\\d]",yl={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,"〇":0,一:1,二:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9},Qs={};function VE(t){if(Qs[t])return Qs[t];if(t==="fullwide"||t==="hanidec")return{group:Cd,lookup:{...yl}};const i=Rd[t];if(!i)return{group:"\\d",lookup:{...yl}};const e=String.fromCharCode(i),n=String.fromCharCode(i+9),r={};for(let s=0;s<10;s++)r[String.fromCharCode(i+s)]=s;return Qs[t]={group:`[${e}-${n}]`,lookup:r},Qs[t]}var Od={chineseGroup:Cd,defaultLookup:yl,startCodes:Rd,buildDigits:VE},jE=["year","month","day","hour","minute","second","millisecond"];const WE=zE,{latn:GE,other:bl}=UE,{buildDigits:qE}=Od,Id=Js,KE=jE,wl={};var Rr=class Ud{static factory(i=Id){return wl[i.toLowerCase()]||(wl[i.toLowerCase()]=new Ud(i)),wl[i.toLowerCase()]}constructor(i=Id){this.locale=i,this.lookups={...WE},this.vars={...GE};const e=new Intl.NumberFormat(this.locale);this.numberingSystem=e.resolvedOptions().numberingSystem,this.build()}toInt(i){if(typeof i=="number")return i;if(this.numberingSystem==="latn")return parseInt(i,10);let e="";for(let n=0;n{["","k","kuu","kuuta"].forEach((s,a)=>{const o=a<2?"\\.?":"";i[n+s+o]=!0,e[n+s]=r+1})});else{const n=[],r=o=>o.type==="month";for(let o=0;o<12;o++)n.push(new Date(2017,o,1));const s=["full","long","medium"];for(const o of s){const l=Intl.DateTimeFormat(this.locale,{dateStyle:o});for(let u=0;u<12;u++){let c=l.formatToParts(n[u]).find(r).value.toLowerCase();if(/^ko/i.test(this.locale)&&(c+="월"),o==="medium"){if(/^ar|zh/i.test(this.locale))return;c=c.replace(/\.$/,""),i[`${c}\\.?`]=!0}else i[c]=!0;e[c]=u+1}}const a=Intl.DateTimeFormat(this.locale,{month:"short"});for(let o=0;o<12;o++){let l=a.formatToParts(n[o]).find(r).value.toLowerCase();l=l.replace(/\.$/,""),i[`${l}\\.?`]=!0,e[l]=o+1}}this.vars.MONTHNAME=Object.keys(i).join("|"),this.lookups.month=e}buildDaynames(){const i=[],e=a=>a.type==="weekday";for(let a=0;a<7;a++)i.push(new Date(2017,0,a+1));const n=["long","short"],r=[],s={};for(const a of n){const o=Intl.DateTimeFormat(this.locale,{weekday:a});for(let l=0;l<7;l++){let u=o.formatToParts(i[l]).find(e).value.toLowerCase();a==="short"?(u=u.replace(/\.$/,""),r.push(`${u}\\.?`)):r.push(u),s[u]=l}}this.vars.DAYNAME=r.join("|"),this.lookups.dayname=s}buildMeridiems(){const i=[new Date(2017,0,1),new Date(2017,0,1,23,0,0)],e=a=>a.type==="dayPeriod",n=[],r={},s=Intl.DateTimeFormat(this.locale,{timeStyle:"long"});for(let a=0;a<2;a++){const o=s.formatToParts(i[a]).find(e);if(!o)return;const l=o.value.toLowerCase();n.push(l),r[l]=a*12}this.vars.MERIDIEM=n.join("|"),this.lookups.meridiem=r}getObject(i,e){const n={};return i.forEach((r,s)=>{if(!r)return;let a=e[s+1];a=a.toLowerCase(),a=a.replace(/\.$/,""),r==="offset"?n.offset=this.offsetToMinutes(a):this.lookups[r]?n[r]=this.lookups[r][a]||this.toInt(a):n[r]=this.toInt(a)}),n}castObject(i){const e={};return KE.forEach(n=>{n in i&&(e[n]=this.toInt(i[n]))}),typeof i.offset=="string"?e.offset=this.offsetToMinutes(i.offset):typeof i.offset=="number"&&(e.offset=i.offset),e}offsetToMinutes(i){const e=i.match(/^([+-])(..?):?(..)?$/);if(e){const[,n,r,s]=e;return(n==="-"?-1:1)*(this.toInt(r)*60+this.toInt(s||0))}return 0}compile(i){const e=i.replace(/_([A-Z0-9]+)_/g,(n,r)=>{if(!this.vars[r])throw new Error(`Template string contains invalid variable _${r}_`);return this.vars[r]});return new RegExp(e,"i")}};const Ad=Rr,$s=Js;var ot=class{constructor({template:t=null,matcher:i=null,units:e=null,handler:n=null,locales:r=null}){if(!Array.isArray(e)&&typeof n!="function")throw new Error('new Format must receive a "units" array or "handler" function');if(typeof t!="string"&&!(i instanceof RegExp))throw new Error('new Format must receive a "template" string or "matcher" RegExp');this.template=t,this.units=e,this.matcher=i,this.handler=n,this.locales=r,this.regexByLocale={}}getRegExp(t=$s){return this.template?(this.regexByLocale[t]||(this.regexByLocale[t]=Ad.factory(t).compile(this.template)),this.regexByLocale[t]):this.matcher}getMatches(t,i=$s){return t.match(this.getRegExp(i))}toDateTime(t,i=$s){const e=Ad.factory(i);if(this.units)return e.getObject(this.units,t);const n=this.handler(t,i);return!n||n.invalid?n:e.castObject(n)}attempt(t,i=$s){t=String(t).trim();const e=this.getMatches(t,i);if(e){const n=this.toDateTime(e,i);if(n&&!n.invalid)return n}return null}now(){return new Date}};function ZE(t,i){return function(e,n=i){const r=t.attempt(e,n);if(r.invalid)return r;const s=new Date(2e3,0,1);return typeof r.day=="number"&&s.setUTCDate(r.day),typeof r.year=="number"&&s.setUTCFullYear(r.year),typeof r.month=="number"&&s.setUTCMonth(r.month-1),s.setUTCHours(r.hour||0),s.setUTCMinutes(r.minute||0),s.setUTCSeconds(r.second||0),s.setUTCMilliseconds(r.millisecond||0),typeof r.offset=="number"?new Date(s-r.offset*60*1e3):s}}var YE=ZE;function XE(t){return function(i,e){return i instanceof Date?i:typeof i=="number"?new Date(i):t(i,e)}}var JE=XE;const _l=Js,kd=YE,QE=JE;var $E=class{constructor(){this.formats=[]}addFormat(t){return this.formats.push(t),t.parser=this,this}addFormats(t){return t.forEach(i=>this.addFormat(i)),this}removeFormat(t){const i=this.formats.indexOf(t);if(i>-1){const e=this.formats[i];return this.formats.splice(i,1),e.parser=null,!0}return!1}attempt(t,i=_l){for(const n of this.formats){if(Array.isArray(n.locales)&&n.locales.length>0&&!n.locales.includes(new Intl.Locale(i).baseName))continue;const r=n.attempt(t,i);if(r)return r}let e=String(t).slice(0,200);return e===""&&(e="empty string"),{invalid:`Unable to parse ${e}`}}exportAsFunction(t=_l){return kd(this,t)}exportAsFunctionAny(t=_l){return QE(kd(this,t))}};const eP=ot;var tP=new eP({template:"^@(\\d+)$",handler:function(t){const i=parseInt(t[1],10),e=new Date(i*1e3);return{year:e.getUTCFullYear(),month:e.getUTCMonth()+1,day:e.getUTCDate(),hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds()}}});const iP=ot;var nP=new iP({matcher:/^\/Date\((\d+)([+-]\d{4})?\)\/$/,handler:function(t){const i=parseInt(t[1],10),e=new Date(i);return{year:e.getUTCFullYear(),month:e.getUTCMonth()+1,day:e.getUTCDate(),hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds(),millisecond:e.getUTCMilliseconds(),offset:t[2]||0}}}),rP={y:"year",M:"month",d:"day",w:"week",h:"hour",m:"minute",s:"second",ms:"millisecond"};const sP=ot,oP=rP;var aP=new sP({matcher:/^(\+|-|in|) ?([\d.]+) ?(years?|months?|weeks?|days?|hours?|minutes?|seconds?|milliseconds?|ms|s|m|h|w|d|M|y)( ago)?$/i,handler:function([,t,i,e,n]){i=parseFloat(i),e.length<=2?e=oP[e]:(e=e.replace(/s$/,""),e=e.toLowerCase()),e==="week"&&(e="day",i*=7),(t==="-"||n)&&(i*=-1);const r=this.now();return e==="millisecond"?r.setUTCMilliseconds(r.getUTCMilliseconds()+i):e==="second"?r.setUTCSeconds(r.getUTCSeconds()+i):e==="minute"?r.setUTCMinutes(r.getUTCMinutes()+i):e==="hour"?r.setUTCHours(r.getUTCHours()+i):e==="day"?r.setUTCDate(r.getUTCDate()+i):e==="month"?r.setUTCMonth(r.getUTCMonth()+i):e==="year"&&r.setUTCFullYear(r.getUTCFullYear()+i),{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}});const lP=ot,uP=Rr,{chineseGroup:eo}=Od;let Cr;var cP=new lP({template:`^(${eo}{4}|${eo}{2})\\s*年\\s*(${eo}{1,2})\\s*月\\s*(${eo}{1,2})\\s*日$`,handler:function([,t,i,e]){return Cr||(Cr=new uP("zh"),Cr.numberingSystem="hanidec",Cr.buildNumbers()),Cr.castObject({year:t,month:i,day:e})}});const hP=ot;var fP=new hP({template:"^(_DAY_)[\\/. ](_MONTH_)$",units:["day","month"]});const dP=ot;var pP=new dP({template:"^(_DAY_)(?:_ORDINAL_)?[ -](_MONTHNAME_)$",units:["day","month"]});const mP=ot;var gP=new mP({template:"^(?:(?:_DAYNAME_),? )?(_DAY_)(?:_ORDINAL_)?([ -])(_MONTHNAME_)\\2(_YEAR_)$",units:["day",null,"month","year"]});const vP=ot;var yP=new vP({template:"^(_DAY_)([\\/. -])(_MONTH_)\\2(_YEAR_)$",units:["day",null,"month","year"]});const bP=ot;var wP=new bP({template:"^(_MONTH_)(?:[\\/-])(_DAY_)$",units:["month","day"]});const _P=ot;var TP=new _P({template:"^(_MONTH_)([\\/-])(_DAY_)\\2(_YEAR_)$",units:["month",null,"day","year"],locales:["ee-TG","en-AS","en-CA","en-FM","en-GH","en-GU","en-KE","en-KY","en-MH","en-MP","en-US","en-VI","en-WS","sm-AS","sm-SM"]});const xP=ot;var SP=new xP({template:"^(?:(?:_DAYNAME_),? )?(_MONTHNAME_)? (_DAY_)(?:_ORDINAL_)?$",units:["month","day"]});const EP=ot;var PP=new EP({template:"^(?:(?:_DAYNAME_),? )?(_MONTHNAME_)? (_DAY_)(?:_ORDINAL_)?,? (_YEAR_)$",units:["month","day","year"]});const RP=Rr,CP=ot;var OP=new CP({template:"^(.*?)_SPACE_*(?:at|on|T|)_SPACE_*(_H12_|_H24_)(?:\\:(_MIN_)(?:\\:(_SEC_))?)?_SPACE_*(_MERIDIEM_)$",handler:function(t,i){let[,e,n,r,s,a]=t,o={};if(e&&(o=this.parser.attempt(e,i),o.invalid))return null;const l=RP.factory(i);if(a){const u=l.lookups.meridiem[a.toLowerCase()]||0;n=parseFloat(n),n===12?n=u:n>12&&u===12?n+=0:n+=u}return o.hour=n,r&&(o.minute=r),s&&(o.second=s),o}});const IP=Rr,AP=ot,Dd=vl;var kP=new AP({template:"^(.*?)_SPACE_*(?:at|on|T|)_SPACE_*(_H24_)\\:(_MIN_)(?:\\:(_SEC_)(?:[\\.,](_MS_))?)?_SPACE_*(?:GMT)?_SPACE_*(_OFFSET_)?_SPACE_*(_ZONE_)?$",handler:function(t,i){let[,e,n,r,s,a,o,l]=t,u={};if(e&&(u=this.parser.attempt(e,i),u.invalid))return u;if(u.hour=n,u.minute=r,s&&(u.second=s),a&&a.length>3?u.millisecond=a.slice(0,3):a&&(u.millisecond=a),l&&!o&&l in Dd)u.offset=Dd[l];else if(o){const c=IP.factory(i);u.offset=c.offsetToMinutes(o)}return u}});const DP=ot;var MP=new DP({matcher:/^(now|today|tomorrow|yesterday)/i,handler:function(t){const i=this.now(),e=t[1].toLowerCase();switch(e){case"tomorrow":i.setUTCDate(i.getUTCDate()+1);break;case"yesterday":i.setUTCDate(i.getUTCDate()-1);break}const n={year:i.getUTCFullYear(),month:i.getUTCMonth()+1,day:i.getUTCDate()};return e==="now"&&(n.hour=i.getUTCHours(),n.minute=i.getUTCMinutes(),n.second=i.getUTCSeconds(),n.millisecond=i.getUTCMilliseconds()),n}});const NP=ot;var LP=new NP({template:"^(?:_DAYNAME_) (_MONTHNAME_) (_DAY_) (_H24_):(_MIN_):(_SEC_) (_OFFSET_) (_YEAR_)$",units:["month","day","hour","minute","second","offset","year"]});const FP=ot;var zP=new FP({template:"^(_YEAR_)(-?)(_MONTH_)\\2(_DAY_)$",units:["year",null,"month","day"]});const Md=$E,HP=ot,BP=Rr,UP=tP,VP=nP,jP=aP,WP=cP,GP=fP,qP=pP,KP=gP,ZP=yP,YP=Js,XP=wP,JP=TP,QP=SP,$P=PP,eR=OP,tR=kP,iR=MP,nR=LP,rR=zP,Wt=new Md;Wt.addFormats([tR,eR,rR,KP,$P,JP,ZP,WP,nR,iR,jP,QP,qP,XP,GP,UP,VP]),Wt.Parser=Md,Wt.Format=HP,Wt.LocaleHelper=BP,Wt.defaultLocale=YP,Wt.fromString=Date.fromString=Wt.exportAsFunction(),Wt.fromAny=Date.fromAny=Wt.exportAsFunctionAny(),typeof window<"u"&&(window.anyDateParser=Wt);var to=Wt;const sR=od(to),oR=new RegExp(`(${gl.abbreviated_months.map(t=>t.toLowerCase()).join("|")})`),aR=new to.Format({matcher:/^'?(\d{2}|\d{4})$/,units:["year"]}),lR=new to.Format({matcher:/^(\d{1,2})\D*'?(\d{2}|\d{4})$/,units:["month","year"]}),Nd=new to.Parser;Nd.addFormats([aR,lR]);function uR(t){t=t.trim();let i=[],e;return e=Nd.attempt(t),e.invalid||i.push({year:e.year,month:e.month,day:e.day}),e=sR.attempt(t),e.invalid||i.push({year:e.year,month:e.month,day:e.day}),oR.test(t.toLowerCase())||[...i].forEach(n=>{n.day<=12&&n.day!==n.month&&i.push({year:n.year,month:n.day,day:n.month})}),i}const cR=Object.freeze(Object.defineProperty({__proto__:null,parseDate:uR},Symbol.toStringTag,{value:"Module"})),{now:Ld}=Date,hR=(t,i=1,e)=>{i=Math.max(1,i);const n=(e==null?void 0:e.leading)??!1,r=(e==null?void 0:e.trailing)??!0,s=Math.max((e==null?void 0:e.maxWait)??1/0,i);let a,o,l=0,u=0;const c=()=>{const C=Ld(),L=C-l,D=C-u,j=L>=i||D>=s;return[C,j]},h=C=>{if(u=C,!a)return;const L=a;a=void 0,t.apply(void 0,L)},f=()=>{w(0)},p=()=>{o&&(f(),h(Ld()))},m=C=>{if(u=C,n)return h(C)},b=C=>{if(r&&a)return h(C);a=void 0},T=()=>{o=void 0;const[C,L]=c();return L?b(C):y(C)},y=C=>{const L=C-l,D=C-u,j=i-L,N=s-D,K=Math.min(j,N);return w(K)},w=C=>{o&&clearTimeout(o),!(C<=0)&&(o=setTimeout(T,C))},S=(...C)=>{const[L,D]=c(),j=!!o;if(a=C,l=L,(D||!o)&&w(i),D)return j?h(L):m(L)};return S.cancel=f,S.flush=p,S},fR={gallery:"liv_gallery__gallery",tile:"liv_gallery__tile",thumbnailImage:"liv_gallery__thumbnailImage",thumbnailLabel:"liv_gallery__thumbnailLabel",thumbnailLabelTitle:"liv_gallery__thumbnailLabelTitle",thumbnailLabelSubtitle:"liv_gallery__thumbnailLabelSubtitle",loadMore:"liv_gallery__loadMore"},dR=["src","alt","onClick"],pR=[ee("span",null,[ee("b",null,"Load more...")],-1)],Fd=200,Or=10,mR=Object.freeze(Object.defineProperty({__proto__:null,default:nn({__name:"Gallery",setup(t){const i=zi(),e=$(null),n=$(0);xd(e,()=>{e.value&&i.more&&!i.pending&&!i.disableAutoLoad&&i.getRecords()},{distance:50,interval:1e3});function r(a){const l=(n.value/(a.iiifData.width/a.iiifData.height)+Or)/Or;return Math.ceil(l)}function s(){let a=0;try{a=e.value.clientWidth}catch{}a===0&&(a=window.innerWidth*.88);let o=0,l=0;for(;l+=Fd,!(l>a||(o++,l+Or+Fd>a));)l+=Or;n.value=Math.ceil(a/o)-Or}return oi(()=>{setTimeout(s,500)}),rE(e,hR(s,200)),(a,o)=>(ie(),le(De,null,[ee("div",{class:q(a.$style.gallery),ref_key:"galleryContainer",ref:e},[(ie(!0),le(De,null,yt(k(i).allImages,l=>(ie(),le("div",{class:q(a.$style.tile),style:qt({gridRowEnd:`span ${r(l)}`}),role:"button",key:l.id},[ee("img",{src:l.thumbnail,alt:l.record.title,onClick:u=>k(i).changeImage(l),class:q(a.$style.thumbnailImage)},null,10,dR),ee("div",{class:q(a.$style.thumbnailLabel)},[ee("div",{class:q(a.$style.thumbnailLabelTitle)},Oe(l.record.title),3),l.record.subtitle?(ie(),le("div",{key:0,class:q(a.$style.thumbnailLabelSubtitle)},Oe(l.record.subtitle),3)):qe("",!0)],2)],6))),128))],2),k(i).more&&!k(i).pending?(ie(),le("div",{key:0,class:q(a.$style.loadMore),onClick:o[0]||(o[0]=l=>k(i).getRecords())},pR,2)):qe("",!0)],64))}},[["__cssModules",{$style:fR}]])},Symbol.toStringTag,{value:"Module"})),gR={list:"liv_list__list",item:"liv_list__item",body:"liv_list__body",data:"liv_list__data",header:"liv_list__header",title:"liv_list__title",subtitle:"liv_list__subtitle",tinyGallery:"liv_list__tinyGallery",multiImg:"liv_list__multiImg"},vR=["src","alt","onClick"],yR=Object.freeze(Object.defineProperty({__proto__:null,default:nn({__name:"List",setup(t){const i=zi(),e=$(null);return xd(e,()=>{e.value&&i.more&&!i.pending&&!i.disableAutoLoad&&i.getRecords()},{distance:50,interval:1e3}),(n,r)=>(ie(),le("div",{class:q(n.$style.list),ref_key:"listContainer",ref:e},[(ie(!0),le(De,null,yt(k(i).allRecords,s=>(ie(),le("div",{class:q(n.$style.item),key:s.id},[ee("div",{class:q(n.$style.header)},[ee("span",{class:q(n.$style.title)},Oe(s.title),3),ee("span",{class:q(n.$style.subtitle)},Oe(s.subtitle),3)],2),ee("div",{class:q(n.$style.body)},[ee("div",{class:q(n.$style.data)},[ee("dl",null,[(ie(!0),le(De,null,yt(s.dataSummary,a=>(ie(),le(De,null,[ee("dt",null,Oe(a.key),1),ee("dd",null,Oe(a.value),1)],64))),256))])],2),ee("div",{class:q([n.$style.tinyGallery,s.images&&s.images.length>1?n.$style.multiImg:""])},[(ie(!0),le(De,null,yt(s.images,a=>(ie(),le("img",{src:a.thumbnail,alt:s.title,onClick:o=>k(i).changeImage(a)},null,8,vR))),256))],2)],2)],2))),128))],2))}},[["__cssModules",{$style:gR}]])},Symbol.toStringTag,{value:"Module"}))}); diff --git a/ckanext/nhm/theme/assets/scripts/apps/liv/src/store/main.js b/ckanext/nhm/theme/assets/scripts/apps/liv/src/store/main.js index d4f04222..c1866a2b 100644 --- a/ckanext/nhm/theme/assets/scripts/apps/liv/src/store/main.js +++ b/ckanext/nhm/theme/assets/scripts/apps/liv/src/store/main.js @@ -246,7 +246,7 @@ export const useStore = defineStore('liv', () => { if (addImage) { record.images.push({ - id: imgUrl, + id: `${recordData.resource}/${recordId}/${ix}`, ix, url: imgUrl, recordId: recordId,