react-iiif-vault 2.0.2 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,27 @@
1
- "use strict";var ReactIIIFVault=(()=>{var LI=Object.create;var Yu=Object.defineProperty;var FI=Object.getOwnPropertyDescriptor;var NI=Object.getOwnPropertyNames;var zI=Object.getPrototypeOf,DI=Object.prototype.hasOwnProperty;var Dt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),BI=(e,t)=>{for(var n in t)Yu(e,n,{get:t[n],enumerable:!0})},wx=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of NI(t))!DI.call(e,r)&&r!==n&&Yu(e,r,{get:()=>t[r],enumerable:!(i=FI(t,r))||i.enumerable});return e};var A=(e,t,n)=>(n=e!=null?LI(zI(e)):{},wx(t||!e||!e.__esModule?Yu(n,"default",{value:e,enumerable:!0}):n,e)),VI=e=>wx(Yu({},"__esModule",{value:!0}),e);var Q=Dt((Ik,Tx)=>{"use strict";Tx.exports=React});var _x=Dt(Zu=>{"use strict";var hC=Q(),pC=Symbol.for("react.element"),mC=Symbol.for("react.fragment"),gC=Object.prototype.hasOwnProperty,yC=hC.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,vC={key:!0,ref:!0,__self:!0,__source:!0};function Mx(e,t,n){var i,r={},s=null,l=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(l=t.ref);for(i in t)gC.call(t,i)&&!vC.hasOwnProperty(i)&&(r[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps,t)r[i]===void 0&&(r[i]=t[i]);return{$$typeof:pC,type:e,key:s,ref:l,props:r,_owner:yC.current}}Zu.Fragment=mC;Zu.jsx=Mx;Zu.jsxs=Mx});var D=Dt((Pk,Ox)=>{"use strict";Ox.exports=_x()});var GS=Dt(qS=>{"use strict";var Ps=Q();function BP(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var VP=typeof Object.is=="function"?Object.is:BP,jP=Ps.useState,HP=Ps.useEffect,WP=Ps.useLayoutEffect,UP=Ps.useDebugValue;function qP(e,t){var n=t(),i=jP({inst:{value:n,getSnapshot:t}}),r=i[0].inst,s=i[1];return WP(function(){r.value=n,r.getSnapshot=t,am(r)&&s({inst:r})},[e,n,t]),HP(function(){return am(r)&&s({inst:r}),e(function(){am(r)&&s({inst:r})})},[e]),UP(n),n}function am(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!VP(e,n)}catch{return!0}}function GP(e,t){return t()}var $P=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?GP:qP;qS.useSyncExternalStore=Ps.useSyncExternalStore!==void 0?Ps.useSyncExternalStore:$P});var QS=Dt((f2,$S)=>{"use strict";$S.exports=GS()});var KS=Dt(YS=>{"use strict";var Tc=Q(),QP=QS();function YP(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var KP=typeof Object.is=="function"?Object.is:YP,XP=QP.useSyncExternalStore,ZP=Tc.useRef,JP=Tc.useEffect,eA=Tc.useMemo,tA=Tc.useDebugValue;YS.useSyncExternalStoreWithSelector=function(e,t,n,i,r){var s=ZP(null);if(s.current===null){var l={hasValue:!1,value:null};s.current=l}else l=s.current;s=eA(function(){function f(w){if(!p){if(p=!0,c=w,w=i(w),r!==void 0&&l.hasValue){var v=l.value;if(r(v,w))return m=v}return m=w}if(v=m,KP(c,w))return v;var S=i(w);return r!==void 0&&r(v,S)?v:(c=w,m=S)}var p=!1,c,m,y=n===void 0?null:n;return[function(){return f(t())},y===null?void 0:function(){return f(y())}]},[t,n,i,r]);var u=XP(e,s[0],s[1]);return JP(function(){l.hasValue=!0,l.value=u},[u]),tA(u),u}});var ZS=Dt((p2,XS)=>{"use strict";XS.exports=KS()});var C0=Dt((hF,I0)=>{"use strict";var S0=!1,Ao,Em,Im,Nc,zc,w0,Dc,Cm,Pm,Am,b0,Tm,Mm,R0,E0;function Tn(){if(!S0){S0=!0;var e=navigator.userAgent,t=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),n=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(Tm=/\b(iPhone|iP[ao]d)/.exec(e),Mm=/\b(iP[ao]d)/.exec(e),Am=/Android/i.exec(e),R0=/FBAN\/\w+;/i.exec(e),E0=/Mobile/i.exec(e),b0=!!/Win64/.exec(e),t){Ao=t[1]?parseFloat(t[1]):t[5]?parseFloat(t[5]):NaN,Ao&&document&&document.documentMode&&(Ao=document.documentMode);var i=/(?:Trident\/(\d+.\d+))/.exec(e);w0=i?parseFloat(i[1])+4:Ao,Em=t[2]?parseFloat(t[2]):NaN,Im=t[3]?parseFloat(t[3]):NaN,Nc=t[4]?parseFloat(t[4]):NaN,Nc?(t=/(?:Chrome\/(\d+\.\d+))/.exec(e),zc=t&&t[1]?parseFloat(t[1]):NaN):zc=NaN}else Ao=Em=Im=zc=Nc=NaN;if(n){if(n[1]){var r=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);Dc=r?parseFloat(r[1].replace("_",".")):!0}else Dc=!1;Cm=!!n[2],Pm=!!n[3]}else Dc=Cm=Pm=!1}}var _m={ie:function(){return Tn()||Ao},ieCompatibilityMode:function(){return Tn()||w0>Ao},ie64:function(){return _m.ie()&&b0},firefox:function(){return Tn()||Em},opera:function(){return Tn()||Im},webkit:function(){return Tn()||Nc},safari:function(){return _m.webkit()},chrome:function(){return Tn()||zc},windows:function(){return Tn()||Cm},osx:function(){return Tn()||Dc},linux:function(){return Tn()||Pm},iphone:function(){return Tn()||Tm},mobile:function(){return Tn()||Tm||Mm||Am||E0},nativeApp:function(){return Tn()||R0},android:function(){return Tn()||Am},ipad:function(){return Tn()||Mm}};I0.exports=_m});var A0=Dt((pF,P0)=>{"use strict";var Bc=!!(typeof window<"u"&&window.document&&window.document.createElement),gA={canUseDOM:Bc,canUseWorkers:typeof Worker<"u",canUseEventListeners:Bc&&!!(window.addEventListener||window.attachEvent),canUseViewport:Bc&&!!window.screen,isInWorker:!Bc};P0.exports=gA});var O0=Dt((mF,_0)=>{"use strict";var T0=A0(),M0;T0.canUseDOM&&(M0=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);function yA(e,t){if(!T0.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,i=n in document;if(!i){var r=document.createElement("div");r.setAttribute(n,"return;"),i=typeof r[n]=="function"}return!i&&M0&&e==="wheel"&&(i=document.implementation.hasFeature("Events.wheel","3.0")),i}_0.exports=yA});var D0=Dt((gF,z0)=>{"use strict";var vA=C0(),xA=O0(),k0=10,L0=40,F0=800;function N0(e){var t=0,n=0,i=0,r=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),i=t*k0,r=n*k0,"deltaY"in e&&(r=e.deltaY),"deltaX"in e&&(i=e.deltaX),(i||r)&&e.deltaMode&&(e.deltaMode==1?(i*=L0,r*=L0):(i*=F0,r*=F0)),i&&!t&&(t=i<1?-1:1),r&&!n&&(n=r<1?-1:1),{spinX:t,spinY:n,pixelX:i,pixelY:r}}N0.getEventType=function(){return vA.firefox()?"DOMMouseScroll":xA("wheel")?"wheel":"mousewheel"};z0.exports=N0});var V0=Dt((yF,B0)=>{"use strict";B0.exports=D0()});var Z0=Dt(et=>{"use strict";function Fm(e,t){var n=e.length;e.push(t);e:for(;0<n;){var i=n-1>>>1,r=e[i];if(0<jc(r,t))e[i]=t,e[n]=r,n=i;else break e}}function Ri(e){return e.length===0?null:e[0]}function Wc(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var i=0,r=e.length,s=r>>>1;i<s;){var l=2*(i+1)-1,u=e[l],f=l+1,p=e[f];if(0>jc(u,n))f<r&&0>jc(p,u)?(e[i]=p,e[f]=n,i=f):(e[i]=u,e[l]=n,i=l);else if(f<r&&0>jc(p,n))e[i]=p,e[f]=n,i=f;else break e}}return t}function jc(e,t){var n=e.sortIndex-t.sortIndex;return n!==0?n:e.id-t.id}typeof performance=="object"&&typeof performance.now=="function"?(W0=performance,et.unstable_now=function(){return W0.now()}):(Om=Date,U0=Om.now(),et.unstable_now=function(){return Om.now()-U0});var W0,Om,U0,ji=[],Or=[],EA=1,ri=null,on=3,Uc=!1,To=!1,Xa=!1,$0=typeof setTimeout=="function"?setTimeout:null,Q0=typeof clearTimeout=="function"?clearTimeout:null,q0=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Nm(e){for(var t=Ri(Or);t!==null;){if(t.callback===null)Wc(Or);else if(t.startTime<=e)Wc(Or),t.sortIndex=t.expirationTime,Fm(ji,t);else break;t=Ri(Or)}}function zm(e){if(Xa=!1,Nm(e),!To)if(Ri(ji)!==null)To=!0,Bm(Dm);else{var t=Ri(Or);t!==null&&Vm(zm,t.startTime-e)}}function Dm(e,t){To=!1,Xa&&(Xa=!1,Q0(Za),Za=-1),Uc=!0;var n=on;try{for(Nm(t),ri=Ri(ji);ri!==null&&(!(ri.expirationTime>t)||e&&!X0());){var i=ri.callback;if(typeof i=="function"){ri.callback=null,on=ri.priorityLevel;var r=i(ri.expirationTime<=t);t=et.unstable_now(),typeof r=="function"?ri.callback=r:ri===Ri(ji)&&Wc(ji),Nm(t)}else Wc(ji);ri=Ri(ji)}if(ri!==null)var s=!0;else{var l=Ri(Or);l!==null&&Vm(zm,l.startTime-t),s=!1}return s}finally{ri=null,on=n,Uc=!1}}var qc=!1,Hc=null,Za=-1,Y0=5,K0=-1;function X0(){return!(et.unstable_now()-K0<Y0)}function km(){if(Hc!==null){var e=et.unstable_now();K0=e;var t=!0;try{t=Hc(!0,e)}finally{t?Ka():(qc=!1,Hc=null)}}else qc=!1}var Ka;typeof q0=="function"?Ka=function(){q0(km)}:typeof MessageChannel<"u"?(Lm=new MessageChannel,G0=Lm.port2,Lm.port1.onmessage=km,Ka=function(){G0.postMessage(null)}):Ka=function(){$0(km,0)};var Lm,G0;function Bm(e){Hc=e,qc||(qc=!0,Ka())}function Vm(e,t){Za=$0(function(){e(et.unstable_now())},t)}et.unstable_IdlePriority=5;et.unstable_ImmediatePriority=1;et.unstable_LowPriority=4;et.unstable_NormalPriority=3;et.unstable_Profiling=null;et.unstable_UserBlockingPriority=2;et.unstable_cancelCallback=function(e){e.callback=null};et.unstable_continueExecution=function(){To||Uc||(To=!0,Bm(Dm))};et.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y0=0<e?Math.floor(1e3/e):5};et.unstable_getCurrentPriorityLevel=function(){return on};et.unstable_getFirstCallbackNode=function(){return Ri(ji)};et.unstable_next=function(e){switch(on){case 1:case 2:case 3:var t=3;break;default:t=on}var n=on;on=t;try{return e()}finally{on=n}};et.unstable_pauseExecution=function(){};et.unstable_requestPaint=function(){};et.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=on;on=e;try{return t()}finally{on=n}};et.unstable_scheduleCallback=function(e,t,n){var i=et.unstable_now();switch(typeof n=="object"&&n!==null?(n=n.delay,n=typeof n=="number"&&0<n?i+n:i):n=i,e){case 1:var r=-1;break;case 2:r=250;break;case 5:r=1073741823;break;case 4:r=1e4;break;default:r=5e3}return r=n+r,e={id:EA++,callback:t,priorityLevel:e,startTime:n,expirationTime:r,sortIndex:-1},n>i?(e.sortIndex=n,Fm(Or,e),Ri(ji)===null&&e===Ri(Or)&&(Xa?(Q0(Za),Za=-1):Xa=!0,Vm(zm,n-i))):(e.sortIndex=r,Fm(ji,e),To||Uc||(To=!0,Bm(Dm))),e};et.unstable_shouldYield=X0;et.unstable_wrapCallback=function(e){var t=on;return function(){var n=on;on=t;try{return e.apply(this,arguments)}finally{on=n}}}});var ew=Dt((wF,J0)=>{"use strict";J0.exports=Z0()});var nw=Dt((bF,tw)=>{"use strict";tw.exports=function(t){var n={},i=Q(),r=ew(),s=Object.assign;function l(o){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+o,d=1;d<arguments.length;d++)a+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+o+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var u=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,f=Symbol.for("react.element"),p=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),m=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),w=Symbol.for("react.provider"),v=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),I=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var M=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var T=Symbol.iterator;function _(o){return o===null||typeof o!="object"?null:(o=T&&o[T]||o["@@iterator"],typeof o=="function"?o:null)}function U(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case c:return"Fragment";case p:return"Portal";case y:return"Profiler";case m:return"StrictMode";case E:return"Suspense";case R:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case v:return(o.displayName||"Context")+".Consumer";case w:return(o._context.displayName||"Context")+".Provider";case S:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case b:return a=o.displayName||null,a!==null?a:U(o.type)||"Memo";case I:a=o._payload,o=o._init;try{return U(o(a))}catch{}}return null}function H(o){var a=o.type;switch(o.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=a.render,o=o.displayName||o.name||"",a.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return U(a);case 8:return a===m?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function Z(o){var a=o,d=o;if(o.alternate)for(;a.return;)a=a.return;else{o=a;do a=o,a.flags&4098&&(d=a.return),o=a.return;while(o)}return a.tag===3?d:null}function B(o){if(Z(o)!==o)throw Error(l(188))}function G(o){var a=o.alternate;if(!a){if(a=Z(o),a===null)throw Error(l(188));return a!==o?null:o}for(var d=o,h=a;;){var g=d.return;if(g===null)break;var x=g.alternate;if(x===null){if(h=g.return,h!==null){d=h;continue}break}if(g.child===x.child){for(x=g.child;x;){if(x===d)return B(g),o;if(x===h)return B(g),a;x=x.sibling}throw Error(l(188))}if(d.return!==h.return)d=g,h=x;else{for(var C=!1,O=g.child;O;){if(O===d){C=!0,d=g,h=x;break}if(O===h){C=!0,h=g,d=x;break}O=O.sibling}if(!C){for(O=x.child;O;){if(O===d){C=!0,d=x,h=g;break}if(O===h){C=!0,h=x,d=g;break}O=O.sibling}if(!C)throw Error(l(189))}}if(d.alternate!==h)throw Error(l(190))}if(d.tag!==3)throw Error(l(188));return d.stateNode.current===d?o:a}function K(o){return o=G(o),o!==null?ce(o):null}function ce(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var a=ce(o);if(a!==null)return a;o=o.sibling}return null}function J(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){if(o.tag!==4){var a=J(o);if(a!==null)return a}o=o.sibling}return null}var te=Array.isArray,oe=t.getPublicInstance,Re=t.getRootHostContext,de=t.getChildHostContext,N=t.prepareForCommit,re=t.resetAfterCommit,Le=t.createInstance,je=t.appendInitialChild,Ge=t.finalizeInitialChildren,$e=t.prepareUpdate,Qe=t.shouldSetTextContent,Ze=t.createTextInstance,Ct=t.scheduleTimeout,xt=t.cancelTimeout,xn=t.noTimeout,Pt=t.isPrimaryRenderer,Ne=t.supportsMutation,fe=t.supportsPersistence,ae=t.supportsHydration,De=t.getInstanceFromNode,Rt=t.preparePortalMount,ui=t.getCurrentEventPriority,un=t.detachDeletedInstance,Sn=t.supportsMicrotasks,aa=t.scheduleMicrotask,kn=t.supportsTestSelectors,la=t.findFiberRoot,F=t.getBoundingRect,$=t.getTextContent,ie=t.isHiddenSubtree,le=t.matchAccessibilityRole,Se=t.setFocusIfFocusable,V=t.setupIntersectionObserver,k=t.appendChild,X=t.appendChildToContainer,ee=t.commitTextUpdate,Ie=t.commitMount,_e=t.commitUpdate,Be=t.insertBefore,W=t.insertInContainerBefore,Y=t.removeChild,ge=t.removeChildFromContainer,he=t.resetTextContent,pe=t.hideInstance,ke=t.hideTextInstance,tt=t.unhideInstance,nt=t.unhideTextInstance,Ye=t.clearContainer,Lt=t.cloneInstance,ct=t.createContainerChildSet,Ft=t.appendChildToContainerChildSet,hr=t.finalizeContainerChildren,ci=t.replaceContainerChildren,to=t.cloneHiddenInstance,ua=t.cloneHiddenTextInstance,nu=t.canHydrateInstance,EE=t.canHydrateTextInstance,IE=t.canHydrateSuspenseInstance,Dy=t.isSuspenseInstancePending,Mf=t.isSuspenseInstanceFallback,CE=t.getSuspenseInstanceFallbackErrorDetails,PE=t.registerSuspenseInstanceRetry,iu=t.getNextHydratableSibling,AE=t.getFirstHydratableChild,TE=t.getFirstHydratableChildWithinContainer,ME=t.getFirstHydratableChildWithinSuspenseInstance,_E=t.hydrateInstance,OE=t.hydrateTextInstance,kE=t.hydrateSuspenseInstance,LE=t.getNextHydratableInstanceAfterSuspenseInstance,FE=t.commitHydratedContainer,NE=t.commitHydratedSuspenseInstance,zE=t.clearSuspenseBoundary,DE=t.clearSuspenseBoundaryFromContainer,BE=t.shouldDeleteUnhydratedTailInstances,VE=t.didNotMatchHydratedContainerTextInstance,jE=t.didNotMatchHydratedTextInstance,_f;function ca(o){if(_f===void 0)try{throw Error()}catch(d){var a=d.stack.trim().match(/\n( *(at )?)/);_f=a&&a[1]||""}return`
2
- `+_f+o}var Of=!1;function kf(o,a){if(!o||Of)return"";Of=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(ne){var h=ne}Reflect.construct(o,[],a)}else{try{a.call()}catch(ne){h=ne}o.call(a.prototype)}else{try{throw Error()}catch(ne){h=ne}o()}}catch(ne){if(ne&&h&&typeof ne.stack=="string"){for(var g=ne.stack.split(`
3
- `),x=h.stack.split(`
4
- `),C=g.length-1,O=x.length-1;1<=C&&0<=O&&g[C]!==x[O];)O--;for(;1<=C&&0<=O;C--,O--)if(g[C]!==x[O]){if(C!==1||O!==1)do if(C--,O--,0>O||g[C]!==x[O]){var j=`
5
- `+g[C].replace(" at new "," at ");return o.displayName&&j.includes("<anonymous>")&&(j=j.replace("<anonymous>",o.displayName)),j}while(1<=C&&0<=O);break}}}finally{Of=!1,Error.prepareStackTrace=d}return(o=o?o.displayName||o.name:"")?ca(o):""}var HE=Object.prototype.hasOwnProperty,Lf=[],Zo=-1;function pr(o){return{current:o}}function it(o){0>Zo||(o.current=Lf[Zo],Lf[Zo]=null,Zo--)}function Je(o,a){Zo++,Lf[Zo]=o.current,o.current=a}var mr={},Zt=pr(mr),wn=pr(!1),no=mr;function Jo(o,a){var d=o.type.contextTypes;if(!d)return mr;var h=o.stateNode;if(h&&h.__reactInternalMemoizedUnmaskedChildContext===a)return h.__reactInternalMemoizedMaskedChildContext;var g={},x;for(x in d)g[x]=a[x];return h&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=a,o.__reactInternalMemoizedMaskedChildContext=g),g}function bn(o){return o=o.childContextTypes,o!=null}function ru(){it(wn),it(Zt)}function By(o,a,d){if(Zt.current!==mr)throw Error(l(168));Je(Zt,a),Je(wn,d)}function Vy(o,a,d){var h=o.stateNode;if(a=a.childContextTypes,typeof h.getChildContext!="function")return d;h=h.getChildContext();for(var g in h)if(!(g in a))throw Error(l(108,H(o)||"Unknown",g));return s({},d,h)}function ou(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||mr,no=Zt.current,Je(Zt,o),Je(wn,wn.current),!0}function jy(o,a,d){var h=o.stateNode;if(!h)throw Error(l(169));d?(o=Vy(o,a,no),h.__reactInternalMemoizedMergedChildContext=o,it(wn),it(Zt),Je(Zt,o)):it(wn),Je(wn,d)}var di=Math.clz32?Math.clz32:qE,WE=Math.log,UE=Math.LN2;function qE(o){return o>>>=0,o===0?32:31-(WE(o)/UE|0)|0}var su=64,au=4194304;function da(o){switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function lu(o,a){var d=o.pendingLanes;if(d===0)return 0;var h=0,g=o.suspendedLanes,x=o.pingedLanes,C=d&268435455;if(C!==0){var O=C&~g;O!==0?h=da(O):(x&=C,x!==0&&(h=da(x)))}else C=d&~g,C!==0?h=da(C):x!==0&&(h=da(x));if(h===0)return 0;if(a!==0&&a!==h&&!(a&g)&&(g=h&-h,x=a&-a,g>=x||g===16&&(x&4194240)!==0))return a;if(h&4&&(h|=d&16),a=o.entangledLanes,a!==0)for(o=o.entanglements,a&=h;0<a;)d=31-di(a),g=1<<d,h|=o[d],a&=~g;return h}function GE(o,a){switch(o){case 1:case 2:case 4:return a+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function $E(o,a){for(var d=o.suspendedLanes,h=o.pingedLanes,g=o.expirationTimes,x=o.pendingLanes;0<x;){var C=31-di(x),O=1<<C,j=g[C];j===-1?(!(O&d)||O&h)&&(g[C]=GE(O,a)):j<=a&&(o.expiredLanes|=O),x&=~O}}function Ff(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function Hy(){var o=su;return su<<=1,!(su&4194240)&&(su=64),o}function Nf(o){for(var a=[],d=0;31>d;d++)a.push(o);return a}function fa(o,a,d){o.pendingLanes|=a,a!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,a=31-di(a),o[a]=d}function QE(o,a){var d=o.pendingLanes&~a;o.pendingLanes=a,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=a,o.mutableReadLanes&=a,o.entangledLanes&=a,a=o.entanglements;var h=o.eventTimes;for(o=o.expirationTimes;0<d;){var g=31-di(d),x=1<<g;a[g]=0,h[g]=-1,o[g]=-1,d&=~x}}function zf(o,a){var d=o.entangledLanes|=a;for(o=o.entanglements;d;){var h=31-di(d),g=1<<h;g&a|o[h]&a&&(o[h]|=a),d&=~g}}var He=0;function Wy(o){return o&=-o,1<o?4<o?o&268435455?16:536870912:4:1}var Df=r.unstable_scheduleCallback,Uy=r.unstable_cancelCallback,YE=r.unstable_shouldYield,KE=r.unstable_requestPaint,Ht=r.unstable_now,Bf=r.unstable_ImmediatePriority,XE=r.unstable_UserBlockingPriority,Vf=r.unstable_NormalPriority,ZE=r.unstable_IdlePriority,uu=null,Oi=null;function JE(o){if(Oi&&typeof Oi.onCommitFiberRoot=="function")try{Oi.onCommitFiberRoot(uu,o,void 0,(o.current.flags&128)===128)}catch{}}function eI(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var fi=typeof Object.is=="function"?Object.is:eI,$i=null,cu=!1,jf=!1;function qy(o){$i===null?$i=[o]:$i.push(o)}function tI(o){cu=!0,qy(o)}function ki(){if(!jf&&$i!==null){jf=!0;var o=0,a=He;try{var d=$i;for(He=1;o<d.length;o++){var h=d[o];do h=h(!0);while(h!==null)}$i=null,cu=!1}catch(g){throw $i!==null&&($i=$i.slice(o+1)),Df(Bf,ki),g}finally{He=a,jf=!1}}return null}var es=[],ts=0,du=null,fu=0,$n=[],Qn=0,io=null,Qi=1,Yi="";function ro(o,a){es[ts++]=fu,es[ts++]=du,du=o,fu=a}function Gy(o,a,d){$n[Qn++]=Qi,$n[Qn++]=Yi,$n[Qn++]=io,io=o;var h=Qi;o=Yi;var g=32-di(h)-1;h&=~(1<<g),d+=1;var x=32-di(a)+g;if(30<x){var C=g-g%5;x=(h&(1<<C)-1).toString(32),h>>=C,g-=C,Qi=1<<32-di(a)+g|d<<g|h,Yi=x+o}else Qi=1<<x|d<<g|h,Yi=o}function Hf(o){o.return!==null&&(ro(o,1),Gy(o,1,0))}function Wf(o){for(;o===du;)du=es[--ts],es[ts]=null,fu=es[--ts],es[ts]=null;for(;o===io;)io=$n[--Qn],$n[Qn]=null,Yi=$n[--Qn],$n[Qn]=null,Qi=$n[--Qn],$n[Qn]=null}var Ln=null,Yn=null,at=!1,ha=!1,hi=null;function $y(o,a){var d=ei(5,null,null,0);d.elementType="DELETED",d.stateNode=a,d.return=o,a=o.deletions,a===null?(o.deletions=[d],o.flags|=16):a.push(d)}function Qy(o,a){switch(o.tag){case 5:return a=nu(a,o.type,o.pendingProps),a!==null?(o.stateNode=a,Ln=o,Yn=AE(a),!0):!1;case 6:return a=EE(a,o.pendingProps),a!==null?(o.stateNode=a,Ln=o,Yn=null,!0):!1;case 13:if(a=IE(a),a!==null){var d=io!==null?{id:Qi,overflow:Yi}:null;return o.memoizedState={dehydrated:a,treeContext:d,retryLane:1073741824},d=ei(18,null,null,0),d.stateNode=a,d.return=o,o.child=d,Ln=o,Yn=null,!0}return!1;default:return!1}}function Uf(o){return(o.mode&1)!==0&&(o.flags&128)===0}function qf(o){if(at){var a=Yn;if(a){var d=a;if(!Qy(o,a)){if(Uf(o))throw Error(l(418));a=iu(d);var h=Ln;a&&Qy(o,a)?$y(h,d):(o.flags=o.flags&-4097|2,at=!1,Ln=o)}}else{if(Uf(o))throw Error(l(418));o.flags=o.flags&-4097|2,at=!1,Ln=o}}}function Yy(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;Ln=o}function hu(o){if(!ae||o!==Ln)return!1;if(!at)return Yy(o),at=!0,!1;if(o.tag!==3&&(o.tag!==5||BE(o.type)&&!Qe(o.type,o.memoizedProps))){var a=Yn;if(a){if(Uf(o))throw Ky(),Error(l(418));for(;a;)$y(o,a),a=iu(a)}}if(Yy(o),o.tag===13){if(!ae)throw Error(l(316));if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(l(317));Yn=LE(o)}else Yn=Ln?iu(o.stateNode):null;return!0}function Ky(){for(var o=Yn;o;)o=iu(o)}function ns(){ae&&(Yn=Ln=null,ha=at=!1)}function Gf(o){hi===null?hi=[o]:hi.push(o)}var nI=u.ReactCurrentBatchConfig;function pu(o,a){if(fi(o,a))return!0;if(typeof o!="object"||o===null||typeof a!="object"||a===null)return!1;var d=Object.keys(o),h=Object.keys(a);if(d.length!==h.length)return!1;for(h=0;h<d.length;h++){var g=d[h];if(!HE.call(a,g)||!fi(o[g],a[g]))return!1}return!0}function iI(o){switch(o.tag){case 5:return ca(o.type);case 16:return ca("Lazy");case 13:return ca("Suspense");case 19:return ca("SuspenseList");case 0:case 2:case 15:return o=kf(o.type,!1),o;case 11:return o=kf(o.type.render,!1),o;case 1:return o=kf(o.type,!0),o;default:return""}}function pi(o,a){if(o&&o.defaultProps){a=s({},a),o=o.defaultProps;for(var d in o)a[d]===void 0&&(a[d]=o[d]);return a}return a}var mu=pr(null),gu=null,is=null,$f=null;function Qf(){$f=is=gu=null}function Xy(o,a,d){Pt?(Je(mu,a._currentValue),a._currentValue=d):(Je(mu,a._currentValue2),a._currentValue2=d)}function Yf(o){var a=mu.current;it(mu),Pt?o._currentValue=a:o._currentValue2=a}function Kf(o,a,d){for(;o!==null;){var h=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,h!==null&&(h.childLanes|=a)):h!==null&&(h.childLanes&a)!==a&&(h.childLanes|=a),o===d)break;o=o.return}}function rs(o,a){gu=o,$f=is=null,o=o.dependencies,o!==null&&o.firstContext!==null&&(o.lanes&a&&(Rn=!0),o.firstContext=null)}function Kn(o){var a=Pt?o._currentValue:o._currentValue2;if($f!==o)if(o={context:o,memoizedValue:a,next:null},is===null){if(gu===null)throw Error(l(308));is=o,gu.dependencies={lanes:0,firstContext:o}}else is=is.next=o;return a}var oo=null;function Xf(o){oo===null?oo=[o]:oo.push(o)}function Zy(o,a,d,h){var g=a.interleaved;return g===null?(d.next=d,Xf(a)):(d.next=g.next,g.next=d),a.interleaved=d,Li(o,h)}function Li(o,a){o.lanes|=a;var d=o.alternate;for(d!==null&&(d.lanes|=a),d=o,o=o.return;o!==null;)o.childLanes|=a,d=o.alternate,d!==null&&(d.childLanes|=a),d=o,o=o.return;return d.tag===3?d.stateNode:null}var gr=!1;function Zf(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Jy(o,a){o=o.updateQueue,a.updateQueue===o&&(a.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function Ki(o,a){return{eventTime:o,lane:a,tag:0,payload:null,callback:null,next:null}}function yr(o,a,d){var h=o.updateQueue;if(h===null)return null;if(h=h.shared,Fe&2){var g=h.pending;return g===null?a.next=a:(a.next=g.next,g.next=a),h.pending=a,Li(o,d)}return g=h.interleaved,g===null?(a.next=a,Xf(h)):(a.next=g.next,g.next=a),h.interleaved=a,Li(o,d)}function yu(o,a,d){if(a=a.updateQueue,a!==null&&(a=a.shared,(d&4194240)!==0)){var h=a.lanes;h&=o.pendingLanes,d|=h,a.lanes=d,zf(o,d)}}function ev(o,a){var d=o.updateQueue,h=o.alternate;if(h!==null&&(h=h.updateQueue,d===h)){var g=null,x=null;if(d=d.firstBaseUpdate,d!==null){do{var C={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};x===null?g=x=C:x=x.next=C,d=d.next}while(d!==null);x===null?g=x=a:x=x.next=a}else g=x=a;d={baseState:h.baseState,firstBaseUpdate:g,lastBaseUpdate:x,shared:h.shared,effects:h.effects},o.updateQueue=d;return}o=d.lastBaseUpdate,o===null?d.firstBaseUpdate=a:o.next=a,d.lastBaseUpdate=a}function vu(o,a,d,h){var g=o.updateQueue;gr=!1;var x=g.firstBaseUpdate,C=g.lastBaseUpdate,O=g.shared.pending;if(O!==null){g.shared.pending=null;var j=O,ne=j.next;j.next=null,C===null?x=ne:C.next=ne,C=j;var xe=o.alternate;xe!==null&&(xe=xe.updateQueue,O=xe.lastBaseUpdate,O!==C&&(O===null?xe.firstBaseUpdate=ne:O.next=ne,xe.lastBaseUpdate=j))}if(x!==null){var Te=g.baseState;C=0,xe=ne=j=null,O=x;do{var se=O.lane,rt=O.eventTime;if((h&se)===se){xe!==null&&(xe=xe.next={eventTime:rt,lane:0,tag:O.tag,payload:O.payload,callback:O.callback,next:null});e:{var Ke=o,Cn=O;switch(se=a,rt=d,Cn.tag){case 1:if(Ke=Cn.payload,typeof Ke=="function"){Te=Ke.call(rt,Te,se);break e}Te=Ke;break e;case 3:Ke.flags=Ke.flags&-65537|128;case 0:if(Ke=Cn.payload,se=typeof Ke=="function"?Ke.call(rt,Te,se):Ke,se==null)break e;Te=s({},Te,se);break e;case 2:gr=!0}}O.callback!==null&&O.lane!==0&&(o.flags|=64,se=g.effects,se===null?g.effects=[O]:se.push(O))}else rt={eventTime:rt,lane:se,tag:O.tag,payload:O.payload,callback:O.callback,next:null},xe===null?(ne=xe=rt,j=Te):xe=xe.next=rt,C|=se;if(O=O.next,O===null){if(O=g.shared.pending,O===null)break;se=O,O=se.next,se.next=null,g.lastBaseUpdate=se,g.shared.pending=null}}while(!0);if(xe===null&&(j=Te),g.baseState=j,g.firstBaseUpdate=ne,g.lastBaseUpdate=xe,a=g.shared.interleaved,a!==null){g=a;do C|=g.lane,g=g.next;while(g!==a)}else x===null&&(g.shared.lanes=0);ao|=C,o.lanes=C,o.memoizedState=Te}}function tv(o,a,d){if(o=a.effects,a.effects=null,o!==null)for(a=0;a<o.length;a++){var h=o[a],g=h.callback;if(g!==null){if(h.callback=null,h=d,typeof g!="function")throw Error(l(191,g));g.call(h)}}}var nv=new i.Component().refs;function Jf(o,a,d,h){a=o.memoizedState,d=d(h,a),d=d==null?a:s({},a,d),o.memoizedState=d,o.lanes===0&&(o.updateQueue.baseState=d)}var xu={isMounted:function(o){return(o=o._reactInternals)?Z(o)===o:!1},enqueueSetState:function(o,a,d){o=o._reactInternals;var h=nn(),g=Sr(o),x=Ki(h,g);x.payload=a,d!=null&&(x.callback=d),a=yr(o,x,g),a!==null&&(Jn(a,o,g,h),yu(a,o,g))},enqueueReplaceState:function(o,a,d){o=o._reactInternals;var h=nn(),g=Sr(o),x=Ki(h,g);x.tag=1,x.payload=a,d!=null&&(x.callback=d),a=yr(o,x,g),a!==null&&(Jn(a,o,g,h),yu(a,o,g))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var d=nn(),h=Sr(o),g=Ki(d,h);g.tag=2,a!=null&&(g.callback=a),a=yr(o,g,h),a!==null&&(Jn(a,o,h,d),yu(a,o,h))}};function iv(o,a,d,h,g,x,C){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(h,x,C):a.prototype&&a.prototype.isPureReactComponent?!pu(d,h)||!pu(g,x):!0}function rv(o,a,d){var h=!1,g=mr,x=a.contextType;return typeof x=="object"&&x!==null?x=Kn(x):(g=bn(a)?no:Zt.current,h=a.contextTypes,x=(h=h!=null)?Jo(o,g):mr),a=new a(d,x),o.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=xu,o.stateNode=a,a._reactInternals=o,h&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=g,o.__reactInternalMemoizedMaskedChildContext=x),a}function ov(o,a,d,h){o=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(d,h),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(d,h),a.state!==o&&xu.enqueueReplaceState(a,a.state,null)}function eh(o,a,d,h){var g=o.stateNode;g.props=d,g.state=o.memoizedState,g.refs=nv,Zf(o);var x=a.contextType;typeof x=="object"&&x!==null?g.context=Kn(x):(x=bn(a)?no:Zt.current,g.context=Jo(o,x)),g.state=o.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(Jf(o,a,x,d),g.state=o.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(a=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),a!==g.state&&xu.enqueueReplaceState(g,g.state,null),vu(o,d,g,h),g.state=o.memoizedState),typeof g.componentDidMount=="function"&&(o.flags|=4194308)}function pa(o,a,d){if(o=d.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(l(309));var h=d.stateNode}if(!h)throw Error(l(147,o));var g=h,x=""+o;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===x?a.ref:(a=function(C){var O=g.refs;O===nv&&(O=g.refs={}),C===null?delete O[x]:O[x]=C},a._stringRef=x,a)}if(typeof o!="string")throw Error(l(284));if(!d._owner)throw Error(l(290,o))}return o}function Su(o,a){throw o=Object.prototype.toString.call(a),Error(l(31,o==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":o))}function sv(o){var a=o._init;return a(o._payload)}function av(o){function a(z,L){if(o){var q=z.deletions;q===null?(z.deletions=[L],z.flags|=16):q.push(L)}}function d(z,L){if(!o)return null;for(;L!==null;)a(z,L),L=L.sibling;return null}function h(z,L){for(z=new Map;L!==null;)L.key!==null?z.set(L.key,L):z.set(L.index,L),L=L.sibling;return z}function g(z,L){return z=br(z,L),z.index=0,z.sibling=null,z}function x(z,L,q){return z.index=q,o?(q=z.alternate,q!==null?(q=q.index,q<L?(z.flags|=2,L):q):(z.flags|=2,L)):(z.flags|=1048576,L)}function C(z){return o&&z.alternate===null&&(z.flags|=2),z}function O(z,L,q,ue){return L===null||L.tag!==6?(L=jh(q,z.mode,ue),L.return=z,L):(L=g(L,q),L.return=z,L)}function j(z,L,q,ue){var Ee=q.type;return Ee===c?xe(z,L,q.props.children,ue,q.key):L!==null&&(L.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===I&&sv(Ee)===L.type)?(ue=g(L,q.props),ue.ref=pa(z,L,q),ue.return=z,ue):(ue=Gu(q.type,q.key,q.props,null,z.mode,ue),ue.ref=pa(z,L,q),ue.return=z,ue)}function ne(z,L,q,ue){return L===null||L.tag!==4||L.stateNode.containerInfo!==q.containerInfo||L.stateNode.implementation!==q.implementation?(L=Hh(q,z.mode,ue),L.return=z,L):(L=g(L,q.children||[]),L.return=z,L)}function xe(z,L,q,ue,Ee){return L===null||L.tag!==7?(L=fo(q,z.mode,ue,Ee),L.return=z,L):(L=g(L,q),L.return=z,L)}function Te(z,L,q){if(typeof L=="string"&&L!==""||typeof L=="number")return L=jh(""+L,z.mode,q),L.return=z,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case f:return q=Gu(L.type,L.key,L.props,null,z.mode,q),q.ref=pa(z,null,L),q.return=z,q;case p:return L=Hh(L,z.mode,q),L.return=z,L;case I:var ue=L._init;return Te(z,ue(L._payload),q)}if(te(L)||_(L))return L=fo(L,z.mode,q,null),L.return=z,L;Su(z,L)}return null}function se(z,L,q,ue){var Ee=L!==null?L.key:null;if(typeof q=="string"&&q!==""||typeof q=="number")return Ee!==null?null:O(z,L,""+q,ue);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case f:return q.key===Ee?j(z,L,q,ue):null;case p:return q.key===Ee?ne(z,L,q,ue):null;case I:return Ee=q._init,se(z,L,Ee(q._payload),ue)}if(te(q)||_(q))return Ee!==null?null:xe(z,L,q,ue,null);Su(z,q)}return null}function rt(z,L,q,ue,Ee){if(typeof ue=="string"&&ue!==""||typeof ue=="number")return z=z.get(q)||null,O(L,z,""+ue,Ee);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case f:return z=z.get(ue.key===null?q:ue.key)||null,j(L,z,ue,Ee);case p:return z=z.get(ue.key===null?q:ue.key)||null,ne(L,z,ue,Ee);case I:var Oe=ue._init;return rt(z,L,q,Oe(ue._payload),Ee)}if(te(ue)||_(ue))return z=z.get(q)||null,xe(L,z,ue,Ee,null);Su(L,ue)}return null}function Ke(z,L,q,ue){for(var Ee=null,Oe=null,Me=L,We=L=0,qt=null;Me!==null&&We<q.length;We++){Me.index>We?(qt=Me,Me=null):qt=Me.sibling;var Ue=se(z,Me,q[We],ue);if(Ue===null){Me===null&&(Me=qt);break}o&&Me&&Ue.alternate===null&&a(z,Me),L=x(Ue,L,We),Oe===null?Ee=Ue:Oe.sibling=Ue,Oe=Ue,Me=qt}if(We===q.length)return d(z,Me),at&&ro(z,We),Ee;if(Me===null){for(;We<q.length;We++)Me=Te(z,q[We],ue),Me!==null&&(L=x(Me,L,We),Oe===null?Ee=Me:Oe.sibling=Me,Oe=Me);return at&&ro(z,We),Ee}for(Me=h(z,Me);We<q.length;We++)qt=rt(Me,z,We,q[We],ue),qt!==null&&(o&&qt.alternate!==null&&Me.delete(qt.key===null?We:qt.key),L=x(qt,L,We),Oe===null?Ee=qt:Oe.sibling=qt,Oe=qt);return o&&Me.forEach(function(Rr){return a(z,Rr)}),at&&ro(z,We),Ee}function Cn(z,L,q,ue){var Ee=_(q);if(typeof Ee!="function")throw Error(l(150));if(q=Ee.call(q),q==null)throw Error(l(151));for(var Oe=Ee=null,Me=L,We=L=0,qt=null,Ue=q.next();Me!==null&&!Ue.done;We++,Ue=q.next()){Me.index>We?(qt=Me,Me=null):qt=Me.sibling;var Rr=se(z,Me,Ue.value,ue);if(Rr===null){Me===null&&(Me=qt);break}o&&Me&&Rr.alternate===null&&a(z,Me),L=x(Rr,L,We),Oe===null?Ee=Rr:Oe.sibling=Rr,Oe=Rr,Me=qt}if(Ue.done)return d(z,Me),at&&ro(z,We),Ee;if(Me===null){for(;!Ue.done;We++,Ue=q.next())Ue=Te(z,Ue.value,ue),Ue!==null&&(L=x(Ue,L,We),Oe===null?Ee=Ue:Oe.sibling=Ue,Oe=Ue);return at&&ro(z,We),Ee}for(Me=h(z,Me);!Ue.done;We++,Ue=q.next())Ue=rt(Me,z,We,Ue.value,ue),Ue!==null&&(o&&Ue.alternate!==null&&Me.delete(Ue.key===null?We:Ue.key),L=x(Ue,L,We),Oe===null?Ee=Ue:Oe.sibling=Ue,Oe=Ue);return o&&Me.forEach(function(kI){return a(z,kI)}),at&&ro(z,We),Ee}function Ji(z,L,q,ue){if(typeof q=="object"&&q!==null&&q.type===c&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case f:e:{for(var Ee=q.key,Oe=L;Oe!==null;){if(Oe.key===Ee){if(Ee=q.type,Ee===c){if(Oe.tag===7){d(z,Oe.sibling),L=g(Oe,q.props.children),L.return=z,z=L;break e}}else if(Oe.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===I&&sv(Ee)===Oe.type){d(z,Oe.sibling),L=g(Oe,q.props),L.ref=pa(z,Oe,q),L.return=z,z=L;break e}d(z,Oe);break}else a(z,Oe);Oe=Oe.sibling}q.type===c?(L=fo(q.props.children,z.mode,ue,q.key),L.return=z,z=L):(ue=Gu(q.type,q.key,q.props,null,z.mode,ue),ue.ref=pa(z,L,q),ue.return=z,z=ue)}return C(z);case p:e:{for(Oe=q.key;L!==null;){if(L.key===Oe)if(L.tag===4&&L.stateNode.containerInfo===q.containerInfo&&L.stateNode.implementation===q.implementation){d(z,L.sibling),L=g(L,q.children||[]),L.return=z,z=L;break e}else{d(z,L);break}else a(z,L);L=L.sibling}L=Hh(q,z.mode,ue),L.return=z,z=L}return C(z);case I:return Oe=q._init,Ji(z,L,Oe(q._payload),ue)}if(te(q))return Ke(z,L,q,ue);if(_(q))return Cn(z,L,q,ue);Su(z,q)}return typeof q=="string"&&q!==""||typeof q=="number"?(q=""+q,L!==null&&L.tag===6?(d(z,L.sibling),L=g(L,q),L.return=z,z=L):(d(z,L),L=jh(q,z.mode,ue),L.return=z,z=L),C(z)):d(z,L)}return Ji}var os=av(!0),lv=av(!1),ma={},Xn=pr(ma),ga=pr(ma),ss=pr(ma);function Fi(o){if(o===ma)throw Error(l(174));return o}function th(o,a){Je(ss,a),Je(ga,o),Je(Xn,ma),o=Re(a),it(Xn),Je(Xn,o)}function as(){it(Xn),it(ga),it(ss)}function uv(o){var a=Fi(ss.current),d=Fi(Xn.current);a=de(d,o.type,a),d!==a&&(Je(ga,o),Je(Xn,a))}function nh(o){ga.current===o&&(it(Xn),it(ga))}var dt=pr(0);function wu(o){for(var a=o;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Dy(d)||Mf(d)))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if(a.flags&128)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var ih=[];function rh(){for(var o=0;o<ih.length;o++){var a=ih[o];Pt?a._workInProgressVersionPrimary=null:a._workInProgressVersionSecondary=null}ih.length=0}var bu=u.ReactCurrentDispatcher,oh=u.ReactCurrentBatchConfig,so=0,ft=null,Nt=null,Wt=null,Ru=!1,ya=!1,va=0,rI=0;function Jt(){throw Error(l(321))}function sh(o,a){if(a===null)return!1;for(var d=0;d<a.length&&d<o.length;d++)if(!fi(o[d],a[d]))return!1;return!0}function ah(o,a,d,h,g,x){if(so=x,ft=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,bu.current=o===null||o.memoizedState===null?lI:uI,o=d(h,g),ya){x=0;do{if(ya=!1,va=0,25<=x)throw Error(l(301));x+=1,Wt=Nt=null,a.updateQueue=null,bu.current=cI,o=d(h,g)}while(ya)}if(bu.current=Cu,a=Nt!==null&&Nt.next!==null,so=0,Wt=Nt=ft=null,Ru=!1,a)throw Error(l(300));return o}function lh(){var o=va!==0;return va=0,o}function Ni(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Wt===null?ft.memoizedState=Wt=o:Wt=Wt.next=o,Wt}function Zn(){if(Nt===null){var o=ft.alternate;o=o!==null?o.memoizedState:null}else o=Nt.next;var a=Wt===null?ft.memoizedState:Wt.next;if(a!==null)Wt=a,Nt=o;else{if(o===null)throw Error(l(310));Nt=o,o={memoizedState:Nt.memoizedState,baseState:Nt.baseState,baseQueue:Nt.baseQueue,queue:Nt.queue,next:null},Wt===null?ft.memoizedState=Wt=o:Wt=Wt.next=o}return Wt}function xa(o,a){return typeof a=="function"?a(o):a}function uh(o){var a=Zn(),d=a.queue;if(d===null)throw Error(l(311));d.lastRenderedReducer=o;var h=Nt,g=h.baseQueue,x=d.pending;if(x!==null){if(g!==null){var C=g.next;g.next=x.next,x.next=C}h.baseQueue=g=x,d.pending=null}if(g!==null){x=g.next,h=h.baseState;var O=C=null,j=null,ne=x;do{var xe=ne.lane;if((so&xe)===xe)j!==null&&(j=j.next={lane:0,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),h=ne.hasEagerState?ne.eagerState:o(h,ne.action);else{var Te={lane:xe,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null};j===null?(O=j=Te,C=h):j=j.next=Te,ft.lanes|=xe,ao|=xe}ne=ne.next}while(ne!==null&&ne!==x);j===null?C=h:j.next=O,fi(h,a.memoizedState)||(Rn=!0),a.memoizedState=h,a.baseState=C,a.baseQueue=j,d.lastRenderedState=h}if(o=d.interleaved,o!==null){g=o;do x=g.lane,ft.lanes|=x,ao|=x,g=g.next;while(g!==o)}else g===null&&(d.lanes=0);return[a.memoizedState,d.dispatch]}function ch(o){var a=Zn(),d=a.queue;if(d===null)throw Error(l(311));d.lastRenderedReducer=o;var h=d.dispatch,g=d.pending,x=a.memoizedState;if(g!==null){d.pending=null;var C=g=g.next;do x=o(x,C.action),C=C.next;while(C!==g);fi(x,a.memoizedState)||(Rn=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),d.lastRenderedState=x}return[x,h]}function cv(){}function dv(o,a){var d=ft,h=Zn(),g=a(),x=!fi(h.memoizedState,g);if(x&&(h.memoizedState=g,Rn=!0),h=h.queue,dh(pv.bind(null,d,h,o),[o]),h.getSnapshot!==a||x||Wt!==null&&Wt.memoizedState.tag&1){if(d.flags|=2048,Sa(9,hv.bind(null,d,h,g,a),void 0,null),Ut===null)throw Error(l(349));so&30||fv(d,a,g)}return g}function fv(o,a,d){o.flags|=16384,o={getSnapshot:a,value:d},a=ft.updateQueue,a===null?(a={lastEffect:null,stores:null},ft.updateQueue=a,a.stores=[o]):(d=a.stores,d===null?a.stores=[o]:d.push(o))}function hv(o,a,d,h){a.value=d,a.getSnapshot=h,mv(a)&&gv(o)}function pv(o,a,d){return d(function(){mv(a)&&gv(o)})}function mv(o){var a=o.getSnapshot;o=o.value;try{var d=a();return!fi(o,d)}catch{return!0}}function gv(o){var a=Li(o,1);a!==null&&Jn(a,o,1,-1)}function yv(o){var a=Ni();return typeof o=="function"&&(o=o()),a.memoizedState=a.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:xa,lastRenderedState:o},a.queue=o,o=o.dispatch=aI.bind(null,ft,o),[a.memoizedState,o]}function Sa(o,a,d,h){return o={tag:o,create:a,destroy:d,deps:h,next:null},a=ft.updateQueue,a===null?(a={lastEffect:null,stores:null},ft.updateQueue=a,a.lastEffect=o.next=o):(d=a.lastEffect,d===null?a.lastEffect=o.next=o:(h=d.next,d.next=o,o.next=h,a.lastEffect=o)),o}function vv(){return Zn().memoizedState}function Eu(o,a,d,h){var g=Ni();ft.flags|=o,g.memoizedState=Sa(1|a,d,void 0,h===void 0?null:h)}function Iu(o,a,d,h){var g=Zn();h=h===void 0?null:h;var x=void 0;if(Nt!==null){var C=Nt.memoizedState;if(x=C.destroy,h!==null&&sh(h,C.deps)){g.memoizedState=Sa(a,d,x,h);return}}ft.flags|=o,g.memoizedState=Sa(1|a,d,x,h)}function xv(o,a){return Eu(8390656,8,o,a)}function dh(o,a){return Iu(2048,8,o,a)}function Sv(o,a){return Iu(4,2,o,a)}function wv(o,a){return Iu(4,4,o,a)}function bv(o,a){if(typeof a=="function")return o=o(),a(o),function(){a(null)};if(a!=null)return o=o(),a.current=o,function(){a.current=null}}function Rv(o,a,d){return d=d!=null?d.concat([o]):null,Iu(4,4,bv.bind(null,a,o),d)}function fh(){}function Ev(o,a){var d=Zn();a=a===void 0?null:a;var h=d.memoizedState;return h!==null&&a!==null&&sh(a,h[1])?h[0]:(d.memoizedState=[o,a],o)}function Iv(o,a){var d=Zn();a=a===void 0?null:a;var h=d.memoizedState;return h!==null&&a!==null&&sh(a,h[1])?h[0]:(o=o(),d.memoizedState=[o,a],o)}function Cv(o,a,d){return so&21?(fi(d,a)||(d=Hy(),ft.lanes|=d,ao|=d,o.baseState=!0),a):(o.baseState&&(o.baseState=!1,Rn=!0),o.memoizedState=d)}function oI(o,a){var d=He;He=d!==0&&4>d?d:4,o(!0);var h=oh.transition;oh.transition={};try{o(!1),a()}finally{He=d,oh.transition=h}}function Pv(){return Zn().memoizedState}function sI(o,a,d){var h=Sr(o);if(d={lane:h,action:d,hasEagerState:!1,eagerState:null,next:null},Av(o))Tv(a,d);else if(d=Zy(o,a,d,h),d!==null){var g=nn();Jn(d,o,h,g),Mv(d,a,h)}}function aI(o,a,d){var h=Sr(o),g={lane:h,action:d,hasEagerState:!1,eagerState:null,next:null};if(Av(o))Tv(a,g);else{var x=o.alternate;if(o.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var C=a.lastRenderedState,O=x(C,d);if(g.hasEagerState=!0,g.eagerState=O,fi(O,C)){var j=a.interleaved;j===null?(g.next=g,Xf(a)):(g.next=j.next,j.next=g),a.interleaved=g;return}}catch{}finally{}d=Zy(o,a,g,h),d!==null&&(g=nn(),Jn(d,o,h,g),Mv(d,a,h))}}function Av(o){var a=o.alternate;return o===ft||a!==null&&a===ft}function Tv(o,a){ya=Ru=!0;var d=o.pending;d===null?a.next=a:(a.next=d.next,d.next=a),o.pending=a}function Mv(o,a,d){if(d&4194240){var h=a.lanes;h&=o.pendingLanes,d|=h,a.lanes=d,zf(o,d)}}var Cu={readContext:Kn,useCallback:Jt,useContext:Jt,useEffect:Jt,useImperativeHandle:Jt,useInsertionEffect:Jt,useLayoutEffect:Jt,useMemo:Jt,useReducer:Jt,useRef:Jt,useState:Jt,useDebugValue:Jt,useDeferredValue:Jt,useTransition:Jt,useMutableSource:Jt,useSyncExternalStore:Jt,useId:Jt,unstable_isNewReconciler:!1},lI={readContext:Kn,useCallback:function(o,a){return Ni().memoizedState=[o,a===void 0?null:a],o},useContext:Kn,useEffect:xv,useImperativeHandle:function(o,a,d){return d=d!=null?d.concat([o]):null,Eu(4194308,4,bv.bind(null,a,o),d)},useLayoutEffect:function(o,a){return Eu(4194308,4,o,a)},useInsertionEffect:function(o,a){return Eu(4,2,o,a)},useMemo:function(o,a){var d=Ni();return a=a===void 0?null:a,o=o(),d.memoizedState=[o,a],o},useReducer:function(o,a,d){var h=Ni();return a=d!==void 0?d(a):a,h.memoizedState=h.baseState=a,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:a},h.queue=o,o=o.dispatch=sI.bind(null,ft,o),[h.memoizedState,o]},useRef:function(o){var a=Ni();return o={current:o},a.memoizedState=o},useState:yv,useDebugValue:fh,useDeferredValue:function(o){return Ni().memoizedState=o},useTransition:function(){var o=yv(!1),a=o[0];return o=oI.bind(null,o[1]),Ni().memoizedState=o,[a,o]},useMutableSource:function(){},useSyncExternalStore:function(o,a,d){var h=ft,g=Ni();if(at){if(d===void 0)throw Error(l(407));d=d()}else{if(d=a(),Ut===null)throw Error(l(349));so&30||fv(h,a,d)}g.memoizedState=d;var x={value:d,getSnapshot:a};return g.queue=x,xv(pv.bind(null,h,x,o),[o]),h.flags|=2048,Sa(9,hv.bind(null,h,x,d,a),void 0,null),d},useId:function(){var o=Ni(),a=Ut.identifierPrefix;if(at){var d=Yi,h=Qi;d=(h&~(1<<32-di(h)-1)).toString(32)+d,a=":"+a+"R"+d,d=va++,0<d&&(a+="H"+d.toString(32)),a+=":"}else d=rI++,a=":"+a+"r"+d.toString(32)+":";return o.memoizedState=a},unstable_isNewReconciler:!1},uI={readContext:Kn,useCallback:Ev,useContext:Kn,useEffect:dh,useImperativeHandle:Rv,useInsertionEffect:Sv,useLayoutEffect:wv,useMemo:Iv,useReducer:uh,useRef:vv,useState:function(){return uh(xa)},useDebugValue:fh,useDeferredValue:function(o){var a=Zn();return Cv(a,Nt.memoizedState,o)},useTransition:function(){var o=uh(xa)[0],a=Zn().memoizedState;return[o,a]},useMutableSource:cv,useSyncExternalStore:dv,useId:Pv,unstable_isNewReconciler:!1},cI={readContext:Kn,useCallback:Ev,useContext:Kn,useEffect:dh,useImperativeHandle:Rv,useInsertionEffect:Sv,useLayoutEffect:wv,useMemo:Iv,useReducer:ch,useRef:vv,useState:function(){return ch(xa)},useDebugValue:fh,useDeferredValue:function(o){var a=Zn();return Nt===null?a.memoizedState=o:Cv(a,Nt.memoizedState,o)},useTransition:function(){var o=ch(xa)[0],a=Zn().memoizedState;return[o,a]},useMutableSource:cv,useSyncExternalStore:dv,useId:Pv,unstable_isNewReconciler:!1};function ls(o,a){try{var d="",h=a;do d+=iI(h),h=h.return;while(h);var g=d}catch(x){g=`
6
- Error generating stack: `+x.message+`
7
- `+x.stack}return{value:o,source:a,stack:g,digest:null}}function hh(o,a,d){return{value:o,source:null,stack:d??null,digest:a??null}}function ph(o,a){try{console.error(a.value)}catch(d){setTimeout(function(){throw d})}}var dI=typeof WeakMap=="function"?WeakMap:Map;function _v(o,a,d){d=Ki(-1,d),d.tag=3,d.payload={element:null};var h=a.value;return d.callback=function(){Vu||(Vu=!0,Lh=h),ph(o,a)},d}function Ov(o,a,d){d=Ki(-1,d),d.tag=3;var h=o.type.getDerivedStateFromError;if(typeof h=="function"){var g=a.value;d.payload=function(){return h(g)},d.callback=function(){ph(o,a)}}var x=o.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(d.callback=function(){ph(o,a),typeof h!="function"&&(vr===null?vr=new Set([this]):vr.add(this));var C=a.stack;this.componentDidCatch(a.value,{componentStack:C!==null?C:""})}),d}function kv(o,a,d){var h=o.pingCache;if(h===null){h=o.pingCache=new dI;var g=new Set;h.set(a,g)}else g=h.get(a),g===void 0&&(g=new Set,h.set(a,g));g.has(d)||(g.add(d),o=II.bind(null,o,a,d),a.then(o,o))}function Lv(o){do{var a;if((a=o.tag===13)&&(a=o.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return o;o=o.return}while(o!==null);return null}function Fv(o,a,d,h,g){return o.mode&1?(o.flags|=65536,o.lanes=g,o):(o===a?o.flags|=65536:(o.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(a=Ki(-1,1),a.tag=2,yr(d,a,1))),d.lanes|=1),o)}var fI=u.ReactCurrentOwner,Rn=!1;function cn(o,a,d,h){a.child=o===null?lv(a,null,d,h):os(a,o.child,d,h)}function Nv(o,a,d,h,g){d=d.render;var x=a.ref;return rs(a,g),h=ah(o,a,d,h,x,g),d=lh(),o!==null&&!Rn?(a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~g,Xi(o,a,g)):(at&&d&&Hf(a),a.flags|=1,cn(o,a,h,g),a.child)}function zv(o,a,d,h,g){if(o===null){var x=d.type;return typeof x=="function"&&!Vh(x)&&x.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(a.tag=15,a.type=x,Dv(o,a,x,h,g)):(o=Gu(d.type,null,h,a,a.mode,g),o.ref=a.ref,o.return=a,a.child=o)}if(x=o.child,!(o.lanes&g)){var C=x.memoizedProps;if(d=d.compare,d=d!==null?d:pu,d(C,h)&&o.ref===a.ref)return Xi(o,a,g)}return a.flags|=1,o=br(x,h),o.ref=a.ref,o.return=a,a.child=o}function Dv(o,a,d,h,g){if(o!==null){var x=o.memoizedProps;if(pu(x,h)&&o.ref===a.ref)if(Rn=!1,a.pendingProps=h=x,(o.lanes&g)!==0)o.flags&131072&&(Rn=!0);else return a.lanes=o.lanes,Xi(o,a,g)}return mh(o,a,d,h,g)}function Bv(o,a,d){var h=a.pendingProps,g=h.children,x=o!==null?o.memoizedState:null;if(h.mode==="hidden")if(!(a.mode&1))a.memoizedState={baseLanes:0,cachePool:null,transitions:null},Je(cs,Fn),Fn|=d;else{if(!(d&1073741824))return o=x!==null?x.baseLanes|d:d,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:o,cachePool:null,transitions:null},a.updateQueue=null,Je(cs,Fn),Fn|=o,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},h=x!==null?x.baseLanes:d,Je(cs,Fn),Fn|=h}else x!==null?(h=x.baseLanes|d,a.memoizedState=null):h=d,Je(cs,Fn),Fn|=h;return cn(o,a,g,d),a.child}function Vv(o,a){var d=a.ref;(o===null&&d!==null||o!==null&&o.ref!==d)&&(a.flags|=512,a.flags|=2097152)}function mh(o,a,d,h,g){var x=bn(d)?no:Zt.current;return x=Jo(a,x),rs(a,g),d=ah(o,a,d,h,x,g),h=lh(),o!==null&&!Rn?(a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~g,Xi(o,a,g)):(at&&h&&Hf(a),a.flags|=1,cn(o,a,d,g),a.child)}function jv(o,a,d,h,g){if(bn(d)){var x=!0;ou(a)}else x=!1;if(rs(a,g),a.stateNode===null)Au(o,a),rv(a,d,h),eh(a,d,h,g),h=!0;else if(o===null){var C=a.stateNode,O=a.memoizedProps;C.props=O;var j=C.context,ne=d.contextType;typeof ne=="object"&&ne!==null?ne=Kn(ne):(ne=bn(d)?no:Zt.current,ne=Jo(a,ne));var xe=d.getDerivedStateFromProps,Te=typeof xe=="function"||typeof C.getSnapshotBeforeUpdate=="function";Te||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(O!==h||j!==ne)&&ov(a,C,h,ne),gr=!1;var se=a.memoizedState;C.state=se,vu(a,h,C,g),j=a.memoizedState,O!==h||se!==j||wn.current||gr?(typeof xe=="function"&&(Jf(a,d,xe,h),j=a.memoizedState),(O=gr||iv(a,d,O,h,se,j,ne))?(Te||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount()),typeof C.componentDidMount=="function"&&(a.flags|=4194308)):(typeof C.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=j),C.props=h,C.state=j,C.context=ne,h=O):(typeof C.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{C=a.stateNode,Jy(o,a),O=a.memoizedProps,ne=a.type===a.elementType?O:pi(a.type,O),C.props=ne,Te=a.pendingProps,se=C.context,j=d.contextType,typeof j=="object"&&j!==null?j=Kn(j):(j=bn(d)?no:Zt.current,j=Jo(a,j));var rt=d.getDerivedStateFromProps;(xe=typeof rt=="function"||typeof C.getSnapshotBeforeUpdate=="function")||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(O!==Te||se!==j)&&ov(a,C,h,j),gr=!1,se=a.memoizedState,C.state=se,vu(a,h,C,g);var Ke=a.memoizedState;O!==Te||se!==Ke||wn.current||gr?(typeof rt=="function"&&(Jf(a,d,rt,h),Ke=a.memoizedState),(ne=gr||iv(a,d,ne,h,se,Ke,j)||!1)?(xe||typeof C.UNSAFE_componentWillUpdate!="function"&&typeof C.componentWillUpdate!="function"||(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(h,Ke,j),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(h,Ke,j)),typeof C.componentDidUpdate=="function"&&(a.flags|=4),typeof C.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof C.componentDidUpdate!="function"||O===o.memoizedProps&&se===o.memoizedState||(a.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||O===o.memoizedProps&&se===o.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=Ke),C.props=h,C.state=Ke,C.context=j,h=ne):(typeof C.componentDidUpdate!="function"||O===o.memoizedProps&&se===o.memoizedState||(a.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||O===o.memoizedProps&&se===o.memoizedState||(a.flags|=1024),h=!1)}return gh(o,a,d,h,x,g)}function gh(o,a,d,h,g,x){Vv(o,a);var C=(a.flags&128)!==0;if(!h&&!C)return g&&jy(a,d,!1),Xi(o,a,x);h=a.stateNode,fI.current=a;var O=C&&typeof d.getDerivedStateFromError!="function"?null:h.render();return a.flags|=1,o!==null&&C?(a.child=os(a,o.child,null,x),a.child=os(a,null,O,x)):cn(o,a,O,x),a.memoizedState=h.state,g&&jy(a,d,!0),a.child}function Hv(o){var a=o.stateNode;a.pendingContext?By(o,a.pendingContext,a.pendingContext!==a.context):a.context&&By(o,a.context,!1),th(o,a.containerInfo)}function Wv(o,a,d,h,g){return ns(),Gf(g),a.flags|=256,cn(o,a,d,h),a.child}var yh={dehydrated:null,treeContext:null,retryLane:0};function vh(o){return{baseLanes:o,cachePool:null,transitions:null}}function Uv(o,a,d){var h=a.pendingProps,g=dt.current,x=!1,C=(a.flags&128)!==0,O;if((O=C)||(O=o!==null&&o.memoizedState===null?!1:(g&2)!==0),O?(x=!0,a.flags&=-129):(o===null||o.memoizedState!==null)&&(g|=1),Je(dt,g&1),o===null)return qf(a),o=a.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?(a.mode&1?Mf(o)?a.lanes=8:a.lanes=1073741824:a.lanes=1,null):(C=h.children,o=h.fallback,x?(h=a.mode,x=a.child,C={mode:"hidden",children:C},!(h&1)&&x!==null?(x.childLanes=0,x.pendingProps=C):x=$u(C,h,0,null),o=fo(o,h,d,null),x.return=a,o.return=a,x.sibling=o,a.child=x,a.child.memoizedState=vh(d),a.memoizedState=yh,o):xh(a,C));if(g=o.memoizedState,g!==null&&(O=g.dehydrated,O!==null))return hI(o,a,C,h,O,g,d);if(x){x=h.fallback,C=a.mode,g=o.child,O=g.sibling;var j={mode:"hidden",children:h.children};return!(C&1)&&a.child!==g?(h=a.child,h.childLanes=0,h.pendingProps=j,a.deletions=null):(h=br(g,j),h.subtreeFlags=g.subtreeFlags&14680064),O!==null?x=br(O,x):(x=fo(x,C,d,null),x.flags|=2),x.return=a,h.return=a,h.sibling=x,a.child=h,h=x,x=a.child,C=o.child.memoizedState,C=C===null?vh(d):{baseLanes:C.baseLanes|d,cachePool:null,transitions:C.transitions},x.memoizedState=C,x.childLanes=o.childLanes&~d,a.memoizedState=yh,h}return x=o.child,o=x.sibling,h=br(x,{mode:"visible",children:h.children}),!(a.mode&1)&&(h.lanes=d),h.return=a,h.sibling=null,o!==null&&(d=a.deletions,d===null?(a.deletions=[o],a.flags|=16):d.push(o)),a.child=h,a.memoizedState=null,h}function xh(o,a){return a=$u({mode:"visible",children:a},o.mode,0,null),a.return=o,o.child=a}function Pu(o,a,d,h){return h!==null&&Gf(h),os(a,o.child,null,d),o=xh(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function hI(o,a,d,h,g,x,C){if(d)return a.flags&256?(a.flags&=-257,h=hh(Error(l(422))),Pu(o,a,C,h)):a.memoizedState!==null?(a.child=o.child,a.flags|=128,null):(x=h.fallback,g=a.mode,h=$u({mode:"visible",children:h.children},g,0,null),x=fo(x,g,C,null),x.flags|=2,h.return=a,x.return=a,h.sibling=x,a.child=h,a.mode&1&&os(a,o.child,null,C),a.child.memoizedState=vh(C),a.memoizedState=yh,x);if(!(a.mode&1))return Pu(o,a,C,null);if(Mf(g))return h=CE(g).digest,x=Error(l(419)),h=hh(x,h,void 0),Pu(o,a,C,h);if(d=(C&o.childLanes)!==0,Rn||d){if(h=Ut,h!==null){switch(C&-C){case 4:g=2;break;case 16:g=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:g=32;break;case 536870912:g=268435456;break;default:g=0}g=g&(h.suspendedLanes|C)?0:g,g!==0&&g!==x.retryLane&&(x.retryLane=g,Li(o,g),Jn(h,o,g,-1))}return Bh(),h=hh(Error(l(421))),Pu(o,a,C,h)}return Dy(g)?(a.flags|=128,a.child=o.child,a=CI.bind(null,o),PE(g,a),null):(o=x.treeContext,ae&&(Yn=ME(g),Ln=a,at=!0,hi=null,ha=!1,o!==null&&($n[Qn++]=Qi,$n[Qn++]=Yi,$n[Qn++]=io,Qi=o.id,Yi=o.overflow,io=a)),a=xh(a,h.children),a.flags|=4096,a)}function qv(o,a,d){o.lanes|=a;var h=o.alternate;h!==null&&(h.lanes|=a),Kf(o.return,a,d)}function Sh(o,a,d,h,g){var x=o.memoizedState;x===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:d,tailMode:g}:(x.isBackwards=a,x.rendering=null,x.renderingStartTime=0,x.last=h,x.tail=d,x.tailMode=g)}function Gv(o,a,d){var h=a.pendingProps,g=h.revealOrder,x=h.tail;if(cn(o,a,h.children,d),h=dt.current,h&2)h=h&1|2,a.flags|=128;else{if(o!==null&&o.flags&128)e:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&qv(o,d,a);else if(o.tag===19)qv(o,d,a);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break e;for(;o.sibling===null;){if(o.return===null||o.return===a)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}h&=1}if(Je(dt,h),!(a.mode&1))a.memoizedState=null;else switch(g){case"forwards":for(d=a.child,g=null;d!==null;)o=d.alternate,o!==null&&wu(o)===null&&(g=d),d=d.sibling;d=g,d===null?(g=a.child,a.child=null):(g=d.sibling,d.sibling=null),Sh(a,!1,g,d,x);break;case"backwards":for(d=null,g=a.child,a.child=null;g!==null;){if(o=g.alternate,o!==null&&wu(o)===null){a.child=g;break}o=g.sibling,g.sibling=d,d=g,g=o}Sh(a,!0,d,null,x);break;case"together":Sh(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function Au(o,a){!(a.mode&1)&&o!==null&&(o.alternate=null,a.alternate=null,a.flags|=2)}function Xi(o,a,d){if(o!==null&&(a.dependencies=o.dependencies),ao|=a.lanes,!(d&a.childLanes))return null;if(o!==null&&a.child!==o.child)throw Error(l(153));if(a.child!==null){for(o=a.child,d=br(o,o.pendingProps),a.child=d,d.return=a;o.sibling!==null;)o=o.sibling,d=d.sibling=br(o,o.pendingProps),d.return=a;d.sibling=null}return a.child}function pI(o,a,d){switch(a.tag){case 3:Hv(a),ns();break;case 5:uv(a);break;case 1:bn(a.type)&&ou(a);break;case 4:th(a,a.stateNode.containerInfo);break;case 10:Xy(a,a.type._context,a.memoizedProps.value);break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(Je(dt,dt.current&1),a.flags|=128,null):d&a.child.childLanes?Uv(o,a,d):(Je(dt,dt.current&1),o=Xi(o,a,d),o!==null?o.sibling:null);Je(dt,dt.current&1);break;case 19:if(h=(d&a.childLanes)!==0,o.flags&128){if(h)return Gv(o,a,d);a.flags|=128}var g=a.memoizedState;if(g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),Je(dt,dt.current),h)break;return null;case 22:case 23:return a.lanes=0,Bv(o,a,d)}return Xi(o,a,d)}function zi(o){o.flags|=4}function $v(o,a){if(o!==null&&o.child===a.child)return!0;if(a.flags&16)return!1;for(o=a.child;o!==null;){if(o.flags&12854||o.subtreeFlags&12854)return!1;o=o.sibling}return!0}var wa,ba,Tu,Mu;if(Ne)wa=function(o,a){for(var d=a.child;d!==null;){if(d.tag===5||d.tag===6)je(o,d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===a)break;for(;d.sibling===null;){if(d.return===null||d.return===a)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},ba=function(){},Tu=function(o,a,d,h,g){if(o=o.memoizedProps,o!==h){var x=a.stateNode,C=Fi(Xn.current);d=$e(x,d,o,h,g,C),(a.updateQueue=d)&&zi(a)}},Mu=function(o,a,d,h){d!==h&&zi(a)};else if(fe){wa=function(o,a,d,h){for(var g=a.child;g!==null;){if(g.tag===5){var x=g.stateNode;d&&h&&(x=to(x,g.type,g.memoizedProps,g)),je(o,x)}else if(g.tag===6)x=g.stateNode,d&&h&&(x=ua(x,g.memoizedProps,g)),je(o,x);else if(g.tag!==4){if(g.tag===22&&g.memoizedState!==null)x=g.child,x!==null&&(x.return=g),wa(o,g,!0,!0);else if(g.child!==null){g.child.return=g,g=g.child;continue}}if(g===a)break;for(;g.sibling===null;){if(g.return===null||g.return===a)return;g=g.return}g.sibling.return=g.return,g=g.sibling}};var Qv=function(o,a,d,h){for(var g=a.child;g!==null;){if(g.tag===5){var x=g.stateNode;d&&h&&(x=to(x,g.type,g.memoizedProps,g)),Ft(o,x)}else if(g.tag===6)x=g.stateNode,d&&h&&(x=ua(x,g.memoizedProps,g)),Ft(o,x);else if(g.tag!==4){if(g.tag===22&&g.memoizedState!==null)x=g.child,x!==null&&(x.return=g),Qv(o,g,!0,!0);else if(g.child!==null){g.child.return=g,g=g.child;continue}}if(g===a)break;for(;g.sibling===null;){if(g.return===null||g.return===a)return;g=g.return}g.sibling.return=g.return,g=g.sibling}};ba=function(o,a){var d=a.stateNode;if(!$v(o,a)){o=d.containerInfo;var h=ct(o);Qv(h,a,!1,!1),d.pendingChildren=h,zi(a),hr(o,h)}},Tu=function(o,a,d,h,g){var x=o.stateNode,C=o.memoizedProps;if((o=$v(o,a))&&C===h)a.stateNode=x;else{var O=a.stateNode,j=Fi(Xn.current),ne=null;C!==h&&(ne=$e(O,d,C,h,g,j)),o&&ne===null?a.stateNode=x:(x=Lt(x,ne,d,C,h,a,o,O),Ge(x,d,h,g,j)&&zi(a),a.stateNode=x,o?zi(a):wa(x,a,!1,!1))}},Mu=function(o,a,d,h){d!==h?(o=Fi(ss.current),d=Fi(Xn.current),a.stateNode=Ze(h,o,d,a),zi(a)):a.stateNode=o.stateNode}}else ba=function(){},Tu=function(){},Mu=function(){};function Ra(o,a){if(!at)switch(o.tailMode){case"hidden":a=o.tail;for(var d=null;a!==null;)a.alternate!==null&&(d=a),a=a.sibling;d===null?o.tail=null:d.sibling=null;break;case"collapsed":d=o.tail;for(var h=null;d!==null;)d.alternate!==null&&(h=d),d=d.sibling;h===null?a||o.tail===null?o.tail=null:o.tail.sibling=null:h.sibling=null}}function en(o){var a=o.alternate!==null&&o.alternate.child===o.child,d=0,h=0;if(a)for(var g=o.child;g!==null;)d|=g.lanes|g.childLanes,h|=g.subtreeFlags&14680064,h|=g.flags&14680064,g.return=o,g=g.sibling;else for(g=o.child;g!==null;)d|=g.lanes|g.childLanes,h|=g.subtreeFlags,h|=g.flags,g.return=o,g=g.sibling;return o.subtreeFlags|=h,o.childLanes=d,a}function mI(o,a,d){var h=a.pendingProps;switch(Wf(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return en(a),null;case 1:return bn(a.type)&&ru(),en(a),null;case 3:return d=a.stateNode,as(),it(wn),it(Zt),rh(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(o===null||o.child===null)&&(hu(a)?zi(a):o===null||o.memoizedState.isDehydrated&&!(a.flags&256)||(a.flags|=1024,hi!==null&&(zh(hi),hi=null))),ba(o,a),en(a),null;case 5:nh(a),d=Fi(ss.current);var g=a.type;if(o!==null&&a.stateNode!=null)Tu(o,a,g,h,d),o.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!h){if(a.stateNode===null)throw Error(l(166));return en(a),null}if(o=Fi(Xn.current),hu(a)){if(!ae)throw Error(l(175));o=_E(a.stateNode,a.type,a.memoizedProps,d,o,a,!ha),a.updateQueue=o,o!==null&&zi(a)}else{var x=Le(g,h,d,o,a);wa(x,a,!1,!1),a.stateNode=x,Ge(x,g,h,d,o)&&zi(a)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return en(a),null;case 6:if(o&&a.stateNode!=null)Mu(o,a,o.memoizedProps,h);else{if(typeof h!="string"&&a.stateNode===null)throw Error(l(166));if(o=Fi(ss.current),d=Fi(Xn.current),hu(a)){if(!ae)throw Error(l(176));if(o=a.stateNode,d=a.memoizedProps,(h=OE(o,d,a,!ha))&&(g=Ln,g!==null))switch(g.tag){case 3:VE(g.stateNode.containerInfo,o,d,(g.mode&1)!==0);break;case 5:jE(g.type,g.memoizedProps,g.stateNode,o,d,(g.mode&1)!==0)}h&&zi(a)}else a.stateNode=Ze(h,o,d,a)}return en(a),null;case 13:if(it(dt),h=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(at&&Yn!==null&&a.mode&1&&!(a.flags&128))Ky(),ns(),a.flags|=98560,g=!1;else if(g=hu(a),h!==null&&h.dehydrated!==null){if(o===null){if(!g)throw Error(l(318));if(!ae)throw Error(l(344));if(g=a.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(l(317));kE(g,a)}else ns(),!(a.flags&128)&&(a.memoizedState=null),a.flags|=4;en(a),g=!1}else hi!==null&&(zh(hi),hi=null),g=!0;if(!g)return a.flags&65536?a:null}return a.flags&128?(a.lanes=d,a):(d=h!==null,d!==(o!==null&&o.memoizedState!==null)&&d&&(a.child.flags|=8192,a.mode&1&&(o===null||dt.current&1?zt===0&&(zt=3):Bh())),a.updateQueue!==null&&(a.flags|=4),en(a),null);case 4:return as(),ba(o,a),o===null&&Rt(a.stateNode.containerInfo),en(a),null;case 10:return Yf(a.type._context),en(a),null;case 17:return bn(a.type)&&ru(),en(a),null;case 19:if(it(dt),g=a.memoizedState,g===null)return en(a),null;if(h=(a.flags&128)!==0,x=g.rendering,x===null)if(h)Ra(g,!1);else{if(zt!==0||o!==null&&o.flags&128)for(o=a.child;o!==null;){if(x=wu(o),x!==null){for(a.flags|=128,Ra(g,!1),o=x.updateQueue,o!==null&&(a.updateQueue=o,a.flags|=4),a.subtreeFlags=0,o=d,d=a.child;d!==null;)h=d,g=o,h.flags&=14680066,x=h.alternate,x===null?(h.childLanes=0,h.lanes=g,h.child=null,h.subtreeFlags=0,h.memoizedProps=null,h.memoizedState=null,h.updateQueue=null,h.dependencies=null,h.stateNode=null):(h.childLanes=x.childLanes,h.lanes=x.lanes,h.child=x.child,h.subtreeFlags=0,h.deletions=null,h.memoizedProps=x.memoizedProps,h.memoizedState=x.memoizedState,h.updateQueue=x.updateQueue,h.type=x.type,g=x.dependencies,h.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext}),d=d.sibling;return Je(dt,dt.current&1|2),a.child}o=o.sibling}g.tail!==null&&Ht()>kh&&(a.flags|=128,h=!0,Ra(g,!1),a.lanes=4194304)}else{if(!h)if(o=wu(x),o!==null){if(a.flags|=128,h=!0,o=o.updateQueue,o!==null&&(a.updateQueue=o,a.flags|=4),Ra(g,!0),g.tail===null&&g.tailMode==="hidden"&&!x.alternate&&!at)return en(a),null}else 2*Ht()-g.renderingStartTime>kh&&d!==1073741824&&(a.flags|=128,h=!0,Ra(g,!1),a.lanes=4194304);g.isBackwards?(x.sibling=a.child,a.child=x):(o=g.last,o!==null?o.sibling=x:a.child=x,g.last=x)}return g.tail!==null?(a=g.tail,g.rendering=a,g.tail=a.sibling,g.renderingStartTime=Ht(),a.sibling=null,o=dt.current,Je(dt,h?o&1|2:o&1),a):(en(a),null);case 22:case 23:return Dh(),d=a.memoizedState!==null,o!==null&&o.memoizedState!==null!==d&&(a.flags|=8192),d&&a.mode&1?Fn&1073741824&&(en(a),Ne&&a.subtreeFlags&6&&(a.flags|=8192)):en(a),null;case 24:return null;case 25:return null}throw Error(l(156,a.tag))}function gI(o,a){switch(Wf(a),a.tag){case 1:return bn(a.type)&&ru(),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return as(),it(wn),it(Zt),rh(),o=a.flags,o&65536&&!(o&128)?(a.flags=o&-65537|128,a):null;case 5:return nh(a),null;case 13:if(it(dt),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(l(340));ns()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return it(dt),null;case 4:return as(),null;case 10:return Yf(a.type._context),null;case 22:case 23:return Dh(),null;case 24:return null;default:return null}}var _u=!1,tn=!1,yI=typeof WeakSet=="function"?WeakSet:Set,ye=null;function us(o,a){var d=o.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(h){lt(o,a,h)}else d.current=null}function wh(o,a,d){try{d()}catch(h){lt(o,a,h)}}var Yv=!1;function vI(o,a){for(N(o.containerInfo),ye=a;ye!==null;)if(o=ye,a=o.child,(o.subtreeFlags&1028)!==0&&a!==null)a.return=o,ye=a;else for(;ye!==null;){o=ye;try{var d=o.alternate;if(o.flags&1024)switch(o.tag){case 0:case 11:case 15:break;case 1:if(d!==null){var h=d.memoizedProps,g=d.memoizedState,x=o.stateNode,C=x.getSnapshotBeforeUpdate(o.elementType===o.type?h:pi(o.type,h),g);x.__reactInternalSnapshotBeforeUpdate=C}break;case 3:Ne&&Ye(o.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(l(163))}}catch(O){lt(o,o.return,O)}if(a=o.sibling,a!==null){a.return=o.return,ye=a;break}ye=o.return}return d=Yv,Yv=!1,d}function Ea(o,a,d){var h=a.updateQueue;if(h=h!==null?h.lastEffect:null,h!==null){var g=h=h.next;do{if((g.tag&o)===o){var x=g.destroy;g.destroy=void 0,x!==void 0&&wh(a,d,x)}g=g.next}while(g!==h)}}function Ou(o,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var d=a=a.next;do{if((d.tag&o)===o){var h=d.create;d.destroy=h()}d=d.next}while(d!==a)}}function bh(o){var a=o.ref;if(a!==null){var d=o.stateNode;switch(o.tag){case 5:o=oe(d);break;default:o=d}typeof a=="function"?a(o):a.current=o}}function Kv(o){var a=o.alternate;a!==null&&(o.alternate=null,Kv(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&un(a)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function Xv(o){return o.tag===5||o.tag===3||o.tag===4}function Zv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Xv(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Rh(o,a,d){var h=o.tag;if(h===5||h===6)o=o.stateNode,a?W(d,o,a):X(d,o);else if(h!==4&&(o=o.child,o!==null))for(Rh(o,a,d),o=o.sibling;o!==null;)Rh(o,a,d),o=o.sibling}function Eh(o,a,d){var h=o.tag;if(h===5||h===6)o=o.stateNode,a?Be(d,o,a):k(d,o);else if(h!==4&&(o=o.child,o!==null))for(Eh(o,a,d),o=o.sibling;o!==null;)Eh(o,a,d),o=o.sibling}var Qt=null,mi=!1;function Di(o,a,d){for(d=d.child;d!==null;)Ih(o,a,d),d=d.sibling}function Ih(o,a,d){if(Oi&&typeof Oi.onCommitFiberUnmount=="function")try{Oi.onCommitFiberUnmount(uu,d)}catch{}switch(d.tag){case 5:tn||us(d,a);case 6:if(Ne){var h=Qt,g=mi;Qt=null,Di(o,a,d),Qt=h,mi=g,Qt!==null&&(mi?ge(Qt,d.stateNode):Y(Qt,d.stateNode))}else Di(o,a,d);break;case 18:Ne&&Qt!==null&&(mi?DE(Qt,d.stateNode):zE(Qt,d.stateNode));break;case 4:Ne?(h=Qt,g=mi,Qt=d.stateNode.containerInfo,mi=!0,Di(o,a,d),Qt=h,mi=g):(fe&&(h=d.stateNode.containerInfo,g=ct(h),ci(h,g)),Di(o,a,d));break;case 0:case 11:case 14:case 15:if(!tn&&(h=d.updateQueue,h!==null&&(h=h.lastEffect,h!==null))){g=h=h.next;do{var x=g,C=x.destroy;x=x.tag,C!==void 0&&(x&2||x&4)&&wh(d,a,C),g=g.next}while(g!==h)}Di(o,a,d);break;case 1:if(!tn&&(us(d,a),h=d.stateNode,typeof h.componentWillUnmount=="function"))try{h.props=d.memoizedProps,h.state=d.memoizedState,h.componentWillUnmount()}catch(O){lt(d,a,O)}Di(o,a,d);break;case 21:Di(o,a,d);break;case 22:d.mode&1?(tn=(h=tn)||d.memoizedState!==null,Di(o,a,d),tn=h):Di(o,a,d);break;default:Di(o,a,d)}}function Jv(o){var a=o.updateQueue;if(a!==null){o.updateQueue=null;var d=o.stateNode;d===null&&(d=o.stateNode=new yI),a.forEach(function(h){var g=PI.bind(null,o,h);d.has(h)||(d.add(h),h.then(g,g))})}}function gi(o,a){var d=a.deletions;if(d!==null)for(var h=0;h<d.length;h++){var g=d[h];try{var x=o,C=a;if(Ne){var O=C;e:for(;O!==null;){switch(O.tag){case 5:Qt=O.stateNode,mi=!1;break e;case 3:Qt=O.stateNode.containerInfo,mi=!0;break e;case 4:Qt=O.stateNode.containerInfo,mi=!0;break e}O=O.return}if(Qt===null)throw Error(l(160));Ih(x,C,g),Qt=null,mi=!1}else Ih(x,C,g);var j=g.alternate;j!==null&&(j.return=null),g.return=null}catch(ne){lt(g,a,ne)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)ex(a,o),a=a.sibling}function ex(o,a){var d=o.alternate,h=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(gi(a,o),Bi(o),h&4){try{Ea(3,o,o.return),Ou(3,o)}catch(se){lt(o,o.return,se)}try{Ea(5,o,o.return)}catch(se){lt(o,o.return,se)}}break;case 1:gi(a,o),Bi(o),h&512&&d!==null&&us(d,d.return);break;case 5:if(gi(a,o),Bi(o),h&512&&d!==null&&us(d,d.return),Ne){if(o.flags&32){var g=o.stateNode;try{he(g)}catch(se){lt(o,o.return,se)}}if(h&4&&(g=o.stateNode,g!=null)){var x=o.memoizedProps;if(d=d!==null?d.memoizedProps:x,h=o.type,a=o.updateQueue,o.updateQueue=null,a!==null)try{_e(g,a,h,d,x,o)}catch(se){lt(o,o.return,se)}}}break;case 6:if(gi(a,o),Bi(o),h&4&&Ne){if(o.stateNode===null)throw Error(l(162));g=o.stateNode,x=o.memoizedProps,d=d!==null?d.memoizedProps:x;try{ee(g,d,x)}catch(se){lt(o,o.return,se)}}break;case 3:if(gi(a,o),Bi(o),h&4){if(Ne&&ae&&d!==null&&d.memoizedState.isDehydrated)try{FE(a.containerInfo)}catch(se){lt(o,o.return,se)}if(fe){g=a.containerInfo,x=a.pendingChildren;try{ci(g,x)}catch(se){lt(o,o.return,se)}}}break;case 4:if(gi(a,o),Bi(o),h&4&&fe){x=o.stateNode,g=x.containerInfo,x=x.pendingChildren;try{ci(g,x)}catch(se){lt(o,o.return,se)}}break;case 13:gi(a,o),Bi(o),g=o.child,g.flags&8192&&(x=g.memoizedState!==null,g.stateNode.isHidden=x,!x||g.alternate!==null&&g.alternate.memoizedState!==null||(Oh=Ht())),h&4&&Jv(o);break;case 22:var C=d!==null&&d.memoizedState!==null;if(o.mode&1?(tn=(d=tn)||C,gi(a,o),tn=d):gi(a,o),Bi(o),h&8192){if(d=o.memoizedState!==null,(o.stateNode.isHidden=d)&&!C&&o.mode&1)for(ye=o,h=o.child;h!==null;){for(a=ye=h;ye!==null;){C=ye;var O=C.child;switch(C.tag){case 0:case 11:case 14:case 15:Ea(4,C,C.return);break;case 1:us(C,C.return);var j=C.stateNode;if(typeof j.componentWillUnmount=="function"){var ne=C,xe=C.return;try{var Te=ne;j.props=Te.memoizedProps,j.state=Te.memoizedState,j.componentWillUnmount()}catch(se){lt(ne,xe,se)}}break;case 5:us(C,C.return);break;case 22:if(C.memoizedState!==null){ix(a);continue}}O!==null?(O.return=C,ye=O):ix(a)}h=h.sibling}if(Ne){e:if(h=null,Ne)for(a=o;;){if(a.tag===5){if(h===null){h=a;try{g=a.stateNode,d?pe(g):tt(a.stateNode,a.memoizedProps)}catch(se){lt(o,o.return,se)}}}else if(a.tag===6){if(h===null)try{x=a.stateNode,d?ke(x):nt(x,a.memoizedProps)}catch(se){lt(o,o.return,se)}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===o)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break e;for(;a.sibling===null;){if(a.return===null||a.return===o)break e;h===a&&(h=null),a=a.return}h===a&&(h=null),a.sibling.return=a.return,a=a.sibling}}}break;case 19:gi(a,o),Bi(o),h&4&&Jv(o);break;case 21:break;default:gi(a,o),Bi(o)}}function Bi(o){var a=o.flags;if(a&2){try{if(Ne){e:{for(var d=o.return;d!==null;){if(Xv(d)){var h=d;break e}d=d.return}throw Error(l(160))}switch(h.tag){case 5:var g=h.stateNode;h.flags&32&&(he(g),h.flags&=-33);var x=Zv(o);Eh(o,x,g);break;case 3:case 4:var C=h.stateNode.containerInfo,O=Zv(o);Rh(o,O,C);break;default:throw Error(l(161))}}}catch(j){lt(o,o.return,j)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function xI(o,a,d){ye=o,tx(o,a,d)}function tx(o,a,d){for(var h=(o.mode&1)!==0;ye!==null;){var g=ye,x=g.child;if(g.tag===22&&h){var C=g.memoizedState!==null||_u;if(!C){var O=g.alternate,j=O!==null&&O.memoizedState!==null||tn;O=_u;var ne=tn;if(_u=C,(tn=j)&&!ne)for(ye=g;ye!==null;)C=ye,j=C.child,C.tag===22&&C.memoizedState!==null?rx(g):j!==null?(j.return=C,ye=j):rx(g);for(;x!==null;)ye=x,tx(x,a,d),x=x.sibling;ye=g,_u=O,tn=ne}nx(o,a,d)}else g.subtreeFlags&8772&&x!==null?(x.return=g,ye=x):nx(o,a,d)}}function nx(o){for(;ye!==null;){var a=ye;if(a.flags&8772){var d=a.alternate;try{if(a.flags&8772)switch(a.tag){case 0:case 11:case 15:tn||Ou(5,a);break;case 1:var h=a.stateNode;if(a.flags&4&&!tn)if(d===null)h.componentDidMount();else{var g=a.elementType===a.type?d.memoizedProps:pi(a.type,d.memoizedProps);h.componentDidUpdate(g,d.memoizedState,h.__reactInternalSnapshotBeforeUpdate)}var x=a.updateQueue;x!==null&&tv(a,x,h);break;case 3:var C=a.updateQueue;if(C!==null){if(d=null,a.child!==null)switch(a.child.tag){case 5:d=oe(a.child.stateNode);break;case 1:d=a.child.stateNode}tv(a,C,d)}break;case 5:var O=a.stateNode;d===null&&a.flags&4&&Ie(O,a.type,a.memoizedProps,a);break;case 6:break;case 4:break;case 12:break;case 13:if(ae&&a.memoizedState===null){var j=a.alternate;if(j!==null){var ne=j.memoizedState;if(ne!==null){var xe=ne.dehydrated;xe!==null&&NE(xe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(l(163))}tn||a.flags&512&&bh(a)}catch(Te){lt(a,a.return,Te)}}if(a===o){ye=null;break}if(d=a.sibling,d!==null){d.return=a.return,ye=d;break}ye=a.return}}function ix(o){for(;ye!==null;){var a=ye;if(a===o){ye=null;break}var d=a.sibling;if(d!==null){d.return=a.return,ye=d;break}ye=a.return}}function rx(o){for(;ye!==null;){var a=ye;try{switch(a.tag){case 0:case 11:case 15:var d=a.return;try{Ou(4,a)}catch(j){lt(a,d,j)}break;case 1:var h=a.stateNode;if(typeof h.componentDidMount=="function"){var g=a.return;try{h.componentDidMount()}catch(j){lt(a,g,j)}}var x=a.return;try{bh(a)}catch(j){lt(a,x,j)}break;case 5:var C=a.return;try{bh(a)}catch(j){lt(a,C,j)}}}catch(j){lt(a,a.return,j)}if(a===o){ye=null;break}var O=a.sibling;if(O!==null){O.return=a.return,ye=O;break}ye=a.return}}var ku=0,Lu=1,Fu=2,Nu=3,zu=4;if(typeof Symbol=="function"&&Symbol.for){var Ia=Symbol.for;ku=Ia("selector.component"),Lu=Ia("selector.has_pseudo_class"),Fu=Ia("selector.role"),Nu=Ia("selector.test_id"),zu=Ia("selector.text")}function Ch(o){var a=De(o);if(a!=null){if(typeof a.memoizedProps["data-testname"]!="string")throw Error(l(364));return a}if(o=la(o),o===null)throw Error(l(362));return o.stateNode.current}function Ph(o,a){switch(a.$$typeof){case ku:if(o.type===a.value)return!0;break;case Lu:e:{a=a.value,o=[o,0];for(var d=0;d<o.length;){var h=o[d++],g=o[d++],x=a[g];if(h.tag!==5||!ie(h)){for(;x!=null&&Ph(h,x);)g++,x=a[g];if(g===a.length){a=!0;break e}else for(h=h.child;h!==null;)o.push(h,g),h=h.sibling}}a=!1}return a;case Fu:if(o.tag===5&&le(o.stateNode,a.value))return!0;break;case zu:if((o.tag===5||o.tag===6)&&(o=$(o),o!==null&&0<=o.indexOf(a.value)))return!0;break;case Nu:if(o.tag===5&&(o=o.memoizedProps["data-testname"],typeof o=="string"&&o.toLowerCase()===a.value.toLowerCase()))return!0;break;default:throw Error(l(365))}return!1}function Ah(o){switch(o.$$typeof){case ku:return"<"+(U(o.value)||"Unknown")+">";case Lu:return":has("+(Ah(o)||"")+")";case Fu:return'[role="'+o.value+'"]';case zu:return'"'+o.value+'"';case Nu:return'[data-testname="'+o.value+'"]';default:throw Error(l(365))}}function ox(o,a){var d=[];o=[o,0];for(var h=0;h<o.length;){var g=o[h++],x=o[h++],C=a[x];if(g.tag!==5||!ie(g)){for(;C!=null&&Ph(g,C);)x++,C=a[x];if(x===a.length)d.push(g);else for(g=g.child;g!==null;)o.push(g,x),g=g.sibling}}return d}function Th(o,a){if(!kn)throw Error(l(363));o=Ch(o),o=ox(o,a),a=[],o=Array.from(o);for(var d=0;d<o.length;){var h=o[d++];if(h.tag===5)ie(h)||a.push(h.stateNode);else for(h=h.child;h!==null;)o.push(h),h=h.sibling}return a}var SI=Math.ceil,Du=u.ReactCurrentDispatcher,Mh=u.ReactCurrentOwner,Et=u.ReactCurrentBatchConfig,Fe=0,Ut=null,At=null,Yt=0,Fn=0,cs=pr(0),zt=0,Ca=null,ao=0,Bu=0,_h=0,Pa=null,En=null,Oh=0,kh=1/0,Zi=null;function ds(){kh=Ht()+500}var Vu=!1,Lh=null,vr=null,ju=!1,xr=null,Hu=0,Aa=0,Fh=null,Wu=-1,Uu=0;function nn(){return Fe&6?Ht():Wu!==-1?Wu:Wu=Ht()}function Sr(o){return o.mode&1?Fe&2&&Yt!==0?Yt&-Yt:nI.transition!==null?(Uu===0&&(Uu=Hy()),Uu):(o=He,o!==0?o:ui()):1}function Jn(o,a,d,h){if(50<Aa)throw Aa=0,Fh=null,Error(l(185));fa(o,d,h),(!(Fe&2)||o!==Ut)&&(o===Ut&&(!(Fe&2)&&(Bu|=d),zt===4&&wr(o,Yt)),In(o,h),d===1&&Fe===0&&!(a.mode&1)&&(ds(),cu&&ki()))}function In(o,a){var d=o.callbackNode;$E(o,a);var h=lu(o,o===Ut?Yt:0);if(h===0)d!==null&&Uy(d),o.callbackNode=null,o.callbackPriority=0;else if(a=h&-h,o.callbackPriority!==a){if(d!=null&&Uy(d),a===1)o.tag===0?tI(ax.bind(null,o)):qy(ax.bind(null,o)),Sn?aa(function(){!(Fe&6)&&ki()}):Df(Bf,ki),d=null;else{switch(Wy(h)){case 1:d=Bf;break;case 4:d=XE;break;case 16:d=Vf;break;case 536870912:d=ZE;break;default:d=Vf}d=gx(d,sx.bind(null,o))}o.callbackPriority=a,o.callbackNode=d}}function sx(o,a){if(Wu=-1,Uu=0,Fe&6)throw Error(l(327));var d=o.callbackNode;if(co()&&o.callbackNode!==d)return null;var h=lu(o,o===Ut?Yt:0);if(h===0)return null;if(h&30||h&o.expiredLanes||a)a=qu(o,h);else{a=h;var g=Fe;Fe|=2;var x=cx();(Ut!==o||Yt!==a)&&(Zi=null,ds(),lo(o,a));do try{RI();break}catch(O){ux(o,O)}while(!0);Qf(),Du.current=x,Fe=g,At!==null?a=0:(Ut=null,Yt=0,a=zt)}if(a!==0){if(a===2&&(g=Ff(o),g!==0&&(h=g,a=Nh(o,g))),a===1)throw d=Ca,lo(o,0),wr(o,h),In(o,Ht()),d;if(a===6)wr(o,h);else{if(g=o.current.alternate,!(h&30)&&!wI(g)&&(a=qu(o,h),a===2&&(x=Ff(o),x!==0&&(h=x,a=Nh(o,x))),a===1))throw d=Ca,lo(o,0),wr(o,h),In(o,Ht()),d;switch(o.finishedWork=g,o.finishedLanes=h,a){case 0:case 1:throw Error(l(345));case 2:uo(o,En,Zi);break;case 3:if(wr(o,h),(h&130023424)===h&&(a=Oh+500-Ht(),10<a)){if(lu(o,0)!==0)break;if(g=o.suspendedLanes,(g&h)!==h){nn(),o.pingedLanes|=o.suspendedLanes&g;break}o.timeoutHandle=Ct(uo.bind(null,o,En,Zi),a);break}uo(o,En,Zi);break;case 4:if(wr(o,h),(h&4194240)===h)break;for(a=o.eventTimes,g=-1;0<h;){var C=31-di(h);x=1<<C,C=a[C],C>g&&(g=C),h&=~x}if(h=g,h=Ht()-h,h=(120>h?120:480>h?480:1080>h?1080:1920>h?1920:3e3>h?3e3:4320>h?4320:1960*SI(h/1960))-h,10<h){o.timeoutHandle=Ct(uo.bind(null,o,En,Zi),h);break}uo(o,En,Zi);break;case 5:uo(o,En,Zi);break;default:throw Error(l(329))}}}return In(o,Ht()),o.callbackNode===d?sx.bind(null,o):null}function Nh(o,a){var d=Pa;return o.current.memoizedState.isDehydrated&&(lo(o,a).flags|=256),o=qu(o,a),o!==2&&(a=En,En=d,a!==null&&zh(a)),o}function zh(o){En===null?En=o:En.push.apply(En,o)}function wI(o){for(var a=o;;){if(a.flags&16384){var d=a.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var h=0;h<d.length;h++){var g=d[h],x=g.getSnapshot;g=g.value;try{if(!fi(x(),g))return!1}catch{return!1}}}if(d=a.child,a.subtreeFlags&16384&&d!==null)d.return=a,a=d;else{if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function wr(o,a){for(a&=~_h,a&=~Bu,o.suspendedLanes|=a,o.pingedLanes&=~a,o=o.expirationTimes;0<a;){var d=31-di(a),h=1<<d;o[d]=-1,a&=~h}}function ax(o){if(Fe&6)throw Error(l(327));co();var a=lu(o,0);if(!(a&1))return In(o,Ht()),null;var d=qu(o,a);if(o.tag!==0&&d===2){var h=Ff(o);h!==0&&(a=h,d=Nh(o,h))}if(d===1)throw d=Ca,lo(o,0),wr(o,a),In(o,Ht()),d;if(d===6)throw Error(l(345));return o.finishedWork=o.current.alternate,o.finishedLanes=a,uo(o,En,Zi),In(o,Ht()),null}function lx(o){xr!==null&&xr.tag===0&&!(Fe&6)&&co();var a=Fe;Fe|=1;var d=Et.transition,h=He;try{if(Et.transition=null,He=1,o)return o()}finally{He=h,Et.transition=d,Fe=a,!(Fe&6)&&ki()}}function Dh(){Fn=cs.current,it(cs)}function lo(o,a){o.finishedWork=null,o.finishedLanes=0;var d=o.timeoutHandle;if(d!==xn&&(o.timeoutHandle=xn,xt(d)),At!==null)for(d=At.return;d!==null;){var h=d;switch(Wf(h),h.tag){case 1:h=h.type.childContextTypes,h!=null&&ru();break;case 3:as(),it(wn),it(Zt),rh();break;case 5:nh(h);break;case 4:as();break;case 13:it(dt);break;case 19:it(dt);break;case 10:Yf(h.type._context);break;case 22:case 23:Dh()}d=d.return}if(Ut=o,At=o=br(o.current,null),Yt=Fn=a,zt=0,Ca=null,_h=Bu=ao=0,En=Pa=null,oo!==null){for(a=0;a<oo.length;a++)if(d=oo[a],h=d.interleaved,h!==null){d.interleaved=null;var g=h.next,x=d.pending;if(x!==null){var C=x.next;x.next=g,h.next=C}d.pending=h}oo=null}return o}function ux(o,a){do{var d=At;try{if(Qf(),bu.current=Cu,Ru){for(var h=ft.memoizedState;h!==null;){var g=h.queue;g!==null&&(g.pending=null),h=h.next}Ru=!1}if(so=0,Wt=Nt=ft=null,ya=!1,va=0,Mh.current=null,d===null||d.return===null){zt=1,Ca=a,At=null;break}e:{var x=o,C=d.return,O=d,j=a;if(a=Yt,O.flags|=32768,j!==null&&typeof j=="object"&&typeof j.then=="function"){var ne=j,xe=O,Te=xe.tag;if(!(xe.mode&1)&&(Te===0||Te===11||Te===15)){var se=xe.alternate;se?(xe.updateQueue=se.updateQueue,xe.memoizedState=se.memoizedState,xe.lanes=se.lanes):(xe.updateQueue=null,xe.memoizedState=null)}var rt=Lv(C);if(rt!==null){rt.flags&=-257,Fv(rt,C,O,x,a),rt.mode&1&&kv(x,ne,a),a=rt,j=ne;var Ke=a.updateQueue;if(Ke===null){var Cn=new Set;Cn.add(j),a.updateQueue=Cn}else Ke.add(j);break e}else{if(!(a&1)){kv(x,ne,a),Bh();break e}j=Error(l(426))}}else if(at&&O.mode&1){var Ji=Lv(C);if(Ji!==null){!(Ji.flags&65536)&&(Ji.flags|=256),Fv(Ji,C,O,x,a),Gf(ls(j,O));break e}}x=j=ls(j,O),zt!==4&&(zt=2),Pa===null?Pa=[x]:Pa.push(x),x=C;do{switch(x.tag){case 3:x.flags|=65536,a&=-a,x.lanes|=a;var z=_v(x,j,a);ev(x,z);break e;case 1:O=j;var L=x.type,q=x.stateNode;if(!(x.flags&128)&&(typeof L.getDerivedStateFromError=="function"||q!==null&&typeof q.componentDidCatch=="function"&&(vr===null||!vr.has(q)))){x.flags|=65536,a&=-a,x.lanes|=a;var ue=Ov(x,O,a);ev(x,ue);break e}}x=x.return}while(x!==null)}fx(d)}catch(Ee){a=Ee,At===d&&d!==null&&(At=d=d.return);continue}break}while(!0)}function cx(){var o=Du.current;return Du.current=Cu,o===null?Cu:o}function Bh(){(zt===0||zt===3||zt===2)&&(zt=4),Ut===null||!(ao&268435455)&&!(Bu&268435455)||wr(Ut,Yt)}function qu(o,a){var d=Fe;Fe|=2;var h=cx();(Ut!==o||Yt!==a)&&(Zi=null,lo(o,a));do try{bI();break}catch(g){ux(o,g)}while(!0);if(Qf(),Fe=d,Du.current=h,At!==null)throw Error(l(261));return Ut=null,Yt=0,zt}function bI(){for(;At!==null;)dx(At)}function RI(){for(;At!==null&&!YE();)dx(At)}function dx(o){var a=mx(o.alternate,o,Fn);o.memoizedProps=o.pendingProps,a===null?fx(o):At=a,Mh.current=null}function fx(o){var a=o;do{var d=a.alternate;if(o=a.return,a.flags&32768){if(d=gI(d,a),d!==null){d.flags&=32767,At=d;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{zt=6,At=null;return}}else if(d=mI(d,a,Fn),d!==null){At=d;return}if(a=a.sibling,a!==null){At=a;return}At=a=o}while(a!==null);zt===0&&(zt=5)}function uo(o,a,d){var h=He,g=Et.transition;try{Et.transition=null,He=1,EI(o,a,d,h)}finally{Et.transition=g,He=h}return null}function EI(o,a,d,h){do co();while(xr!==null);if(Fe&6)throw Error(l(327));d=o.finishedWork;var g=o.finishedLanes;if(d===null)return null;if(o.finishedWork=null,o.finishedLanes=0,d===o.current)throw Error(l(177));o.callbackNode=null,o.callbackPriority=0;var x=d.lanes|d.childLanes;if(QE(o,x),o===Ut&&(At=Ut=null,Yt=0),!(d.subtreeFlags&2064)&&!(d.flags&2064)||ju||(ju=!0,gx(Vf,function(){return co(),null})),x=(d.flags&15990)!==0,d.subtreeFlags&15990||x){x=Et.transition,Et.transition=null;var C=He;He=1;var O=Fe;Fe|=4,Mh.current=null,vI(o,d),ex(d,o),re(o.containerInfo),o.current=d,xI(d,o,g),KE(),Fe=O,He=C,Et.transition=x}else o.current=d;if(ju&&(ju=!1,xr=o,Hu=g),x=o.pendingLanes,x===0&&(vr=null),JE(d.stateNode,h),In(o,Ht()),a!==null)for(h=o.onRecoverableError,d=0;d<a.length;d++)g=a[d],h(g.value,{componentStack:g.stack,digest:g.digest});if(Vu)throw Vu=!1,o=Lh,Lh=null,o;return Hu&1&&o.tag!==0&&co(),x=o.pendingLanes,x&1?o===Fh?Aa++:(Aa=0,Fh=o):Aa=0,ki(),null}function co(){if(xr!==null){var o=Wy(Hu),a=Et.transition,d=He;try{if(Et.transition=null,He=16>o?16:o,xr===null)var h=!1;else{if(o=xr,xr=null,Hu=0,Fe&6)throw Error(l(331));var g=Fe;for(Fe|=4,ye=o.current;ye!==null;){var x=ye,C=x.child;if(ye.flags&16){var O=x.deletions;if(O!==null){for(var j=0;j<O.length;j++){var ne=O[j];for(ye=ne;ye!==null;){var xe=ye;switch(xe.tag){case 0:case 11:case 15:Ea(8,xe,x)}var Te=xe.child;if(Te!==null)Te.return=xe,ye=Te;else for(;ye!==null;){xe=ye;var se=xe.sibling,rt=xe.return;if(Kv(xe),xe===ne){ye=null;break}if(se!==null){se.return=rt,ye=se;break}ye=rt}}}var Ke=x.alternate;if(Ke!==null){var Cn=Ke.child;if(Cn!==null){Ke.child=null;do{var Ji=Cn.sibling;Cn.sibling=null,Cn=Ji}while(Cn!==null)}}ye=x}}if(x.subtreeFlags&2064&&C!==null)C.return=x,ye=C;else e:for(;ye!==null;){if(x=ye,x.flags&2048)switch(x.tag){case 0:case 11:case 15:Ea(9,x,x.return)}var z=x.sibling;if(z!==null){z.return=x.return,ye=z;break e}ye=x.return}}var L=o.current;for(ye=L;ye!==null;){C=ye;var q=C.child;if(C.subtreeFlags&2064&&q!==null)q.return=C,ye=q;else e:for(C=L;ye!==null;){if(O=ye,O.flags&2048)try{switch(O.tag){case 0:case 11:case 15:Ou(9,O)}}catch(Ee){lt(O,O.return,Ee)}if(O===C){ye=null;break e}var ue=O.sibling;if(ue!==null){ue.return=O.return,ye=ue;break e}ye=O.return}}if(Fe=g,ki(),Oi&&typeof Oi.onPostCommitFiberRoot=="function")try{Oi.onPostCommitFiberRoot(uu,o)}catch{}h=!0}return h}finally{He=d,Et.transition=a}}return!1}function hx(o,a,d){a=ls(d,a),a=_v(o,a,1),o=yr(o,a,1),a=nn(),o!==null&&(fa(o,1,a),In(o,a))}function lt(o,a,d){if(o.tag===3)hx(o,o,d);else for(;a!==null;){if(a.tag===3){hx(a,o,d);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(vr===null||!vr.has(h))){o=ls(d,o),o=Ov(a,o,1),a=yr(a,o,1),o=nn(),a!==null&&(fa(a,1,o),In(a,o));break}}a=a.return}}function II(o,a,d){var h=o.pingCache;h!==null&&h.delete(a),a=nn(),o.pingedLanes|=o.suspendedLanes&d,Ut===o&&(Yt&d)===d&&(zt===4||zt===3&&(Yt&130023424)===Yt&&500>Ht()-Oh?lo(o,0):_h|=d),In(o,a)}function px(o,a){a===0&&(o.mode&1?(a=au,au<<=1,!(au&130023424)&&(au=4194304)):a=1);var d=nn();o=Li(o,a),o!==null&&(fa(o,a,d),In(o,d))}function CI(o){var a=o.memoizedState,d=0;a!==null&&(d=a.retryLane),px(o,d)}function PI(o,a){var d=0;switch(o.tag){case 13:var h=o.stateNode,g=o.memoizedState;g!==null&&(d=g.retryLane);break;case 19:h=o.stateNode;break;default:throw Error(l(314))}h!==null&&h.delete(a),px(o,d)}var mx;mx=function(o,a,d){if(o!==null)if(o.memoizedProps!==a.pendingProps||wn.current)Rn=!0;else{if(!(o.lanes&d)&&!(a.flags&128))return Rn=!1,pI(o,a,d);Rn=!!(o.flags&131072)}else Rn=!1,at&&a.flags&1048576&&Gy(a,fu,a.index);switch(a.lanes=0,a.tag){case 2:var h=a.type;Au(o,a),o=a.pendingProps;var g=Jo(a,Zt.current);rs(a,d),g=ah(null,a,h,o,g,d);var x=lh();return a.flags|=1,typeof g=="object"&&g!==null&&typeof g.render=="function"&&g.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,bn(h)?(x=!0,ou(a)):x=!1,a.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,Zf(a),g.updater=xu,a.stateNode=g,g._reactInternals=a,eh(a,h,o,d),a=gh(null,a,h,!0,x,d)):(a.tag=0,at&&x&&Hf(a),cn(null,a,g,d),a=a.child),a;case 16:h=a.elementType;e:{switch(Au(o,a),o=a.pendingProps,g=h._init,h=g(h._payload),a.type=h,g=a.tag=TI(h),o=pi(h,o),g){case 0:a=mh(null,a,h,o,d);break e;case 1:a=jv(null,a,h,o,d);break e;case 11:a=Nv(null,a,h,o,d);break e;case 14:a=zv(null,a,h,pi(h.type,o),d);break e}throw Error(l(306,h,""))}return a;case 0:return h=a.type,g=a.pendingProps,g=a.elementType===h?g:pi(h,g),mh(o,a,h,g,d);case 1:return h=a.type,g=a.pendingProps,g=a.elementType===h?g:pi(h,g),jv(o,a,h,g,d);case 3:e:{if(Hv(a),o===null)throw Error(l(387));h=a.pendingProps,x=a.memoizedState,g=x.element,Jy(o,a),vu(a,h,null,d);var C=a.memoizedState;if(h=C.element,ae&&x.isDehydrated)if(x={element:h,isDehydrated:!1,cache:C.cache,pendingSuspenseBoundaries:C.pendingSuspenseBoundaries,transitions:C.transitions},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){g=ls(Error(l(423)),a),a=Wv(o,a,h,d,g);break e}else if(h!==g){g=ls(Error(l(424)),a),a=Wv(o,a,h,d,g);break e}else for(ae&&(Yn=TE(a.stateNode.containerInfo),Ln=a,at=!0,hi=null,ha=!1),d=lv(a,null,h,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(ns(),h===g){a=Xi(o,a,d);break e}cn(o,a,h,d)}a=a.child}return a;case 5:return uv(a),o===null&&qf(a),h=a.type,g=a.pendingProps,x=o!==null?o.memoizedProps:null,C=g.children,Qe(h,g)?C=null:x!==null&&Qe(h,x)&&(a.flags|=32),Vv(o,a),cn(o,a,C,d),a.child;case 6:return o===null&&qf(a),null;case 13:return Uv(o,a,d);case 4:return th(a,a.stateNode.containerInfo),h=a.pendingProps,o===null?a.child=os(a,null,h,d):cn(o,a,h,d),a.child;case 11:return h=a.type,g=a.pendingProps,g=a.elementType===h?g:pi(h,g),Nv(o,a,h,g,d);case 7:return cn(o,a,a.pendingProps,d),a.child;case 8:return cn(o,a,a.pendingProps.children,d),a.child;case 12:return cn(o,a,a.pendingProps.children,d),a.child;case 10:e:{if(h=a.type._context,g=a.pendingProps,x=a.memoizedProps,C=g.value,Xy(a,h,C),x!==null)if(fi(x.value,C)){if(x.children===g.children&&!wn.current){a=Xi(o,a,d);break e}}else for(x=a.child,x!==null&&(x.return=a);x!==null;){var O=x.dependencies;if(O!==null){C=x.child;for(var j=O.firstContext;j!==null;){if(j.context===h){if(x.tag===1){j=Ki(-1,d&-d),j.tag=2;var ne=x.updateQueue;if(ne!==null){ne=ne.shared;var xe=ne.pending;xe===null?j.next=j:(j.next=xe.next,xe.next=j),ne.pending=j}}x.lanes|=d,j=x.alternate,j!==null&&(j.lanes|=d),Kf(x.return,d,a),O.lanes|=d;break}j=j.next}}else if(x.tag===10)C=x.type===a.type?null:x.child;else if(x.tag===18){if(C=x.return,C===null)throw Error(l(341));C.lanes|=d,O=C.alternate,O!==null&&(O.lanes|=d),Kf(C,d,a),C=x.sibling}else C=x.child;if(C!==null)C.return=x;else for(C=x;C!==null;){if(C===a){C=null;break}if(x=C.sibling,x!==null){x.return=C.return,C=x;break}C=C.return}x=C}cn(o,a,g.children,d),a=a.child}return a;case 9:return g=a.type,h=a.pendingProps.children,rs(a,d),g=Kn(g),h=h(g),a.flags|=1,cn(o,a,h,d),a.child;case 14:return h=a.type,g=pi(h,a.pendingProps),g=pi(h.type,g),zv(o,a,h,g,d);case 15:return Dv(o,a,a.type,a.pendingProps,d);case 17:return h=a.type,g=a.pendingProps,g=a.elementType===h?g:pi(h,g),Au(o,a),a.tag=1,bn(h)?(o=!0,ou(a)):o=!1,rs(a,d),rv(a,h,g),eh(a,h,g,d),gh(null,a,h,!0,o,d);case 19:return Gv(o,a,d);case 22:return Bv(o,a,d)}throw Error(l(156,a.tag))};function gx(o,a){return Df(o,a)}function AI(o,a,d,h){this.tag=o,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ei(o,a,d,h){return new AI(o,a,d,h)}function Vh(o){return o=o.prototype,!(!o||!o.isReactComponent)}function TI(o){if(typeof o=="function")return Vh(o)?1:0;if(o!=null){if(o=o.$$typeof,o===S)return 11;if(o===b)return 14}return 2}function br(o,a){var d=o.alternate;return d===null?(d=ei(o.tag,a,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=a,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&14680064,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,a=o.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d}function Gu(o,a,d,h,g,x){var C=2;if(h=o,typeof o=="function")Vh(o)&&(C=1);else if(typeof o=="string")C=5;else e:switch(o){case c:return fo(d.children,g,x,a);case m:C=8,g|=8;break;case y:return o=ei(12,d,a,g|2),o.elementType=y,o.lanes=x,o;case E:return o=ei(13,d,a,g),o.elementType=E,o.lanes=x,o;case R:return o=ei(19,d,a,g),o.elementType=R,o.lanes=x,o;case M:return $u(d,g,x,a);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case w:C=10;break e;case v:C=9;break e;case S:C=11;break e;case b:C=14;break e;case I:C=16,h=null;break e}throw Error(l(130,o==null?o:typeof o,""))}return a=ei(C,d,a,g),a.elementType=o,a.type=h,a.lanes=x,a}function fo(o,a,d,h){return o=ei(7,o,h,a),o.lanes=d,o}function $u(o,a,d,h){return o=ei(22,o,h,a),o.elementType=M,o.lanes=d,o.stateNode={isHidden:!1},o}function jh(o,a,d){return o=ei(6,o,null,a),o.lanes=d,o}function Hh(o,a,d){return a=ei(4,o.children!==null?o.children:[],o.key,a),a.lanes=d,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}function MI(o,a,d,h,g){this.tag=a,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=xn,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Nf(0),this.expirationTimes=Nf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nf(0),this.identifierPrefix=h,this.onRecoverableError=g,ae&&(this.mutableSourceEagerHydrationData=null)}function yx(o,a,d,h,g,x,C,O,j){return o=new MI(o,a,d,O,j),a===1?(a=1,x===!0&&(a|=8)):a=0,x=ei(3,null,null,a),o.current=x,x.stateNode=o,x.memoizedState={element:h,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Zf(x),o}function vx(o){if(!o)return mr;o=o._reactInternals;e:{if(Z(o)!==o||o.tag!==1)throw Error(l(170));var a=o;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(bn(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(l(171))}if(o.tag===1){var d=o.type;if(bn(d))return Vy(o,d,a)}return a}function xx(o){var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(l(188)):(o=Object.keys(o).join(","),Error(l(268,o)));return o=K(a),o===null?null:o.stateNode}function Sx(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d<a?d:a}}function Qu(o,a){Sx(o,a),(o=o.alternate)&&Sx(o,a)}function _I(o){return o=K(o),o===null?null:o.stateNode}function OI(){return null}return n.attemptContinuousHydration=function(o){if(o.tag===13){var a=Li(o,134217728);if(a!==null){var d=nn();Jn(a,o,134217728,d)}Qu(o,134217728)}},n.attemptDiscreteHydration=function(o){if(o.tag===13){var a=Li(o,1);if(a!==null){var d=nn();Jn(a,o,1,d)}Qu(o,1)}},n.attemptHydrationAtCurrentPriority=function(o){if(o.tag===13){var a=Sr(o),d=Li(o,a);if(d!==null){var h=nn();Jn(d,o,a,h)}Qu(o,a)}},n.attemptSynchronousHydration=function(o){switch(o.tag){case 3:var a=o.stateNode;if(a.current.memoizedState.isDehydrated){var d=da(a.pendingLanes);d!==0&&(zf(a,d|1),In(a,Ht()),!(Fe&6)&&(ds(),ki()))}break;case 13:lx(function(){var h=Li(o,1);if(h!==null){var g=nn();Jn(h,o,1,g)}}),Qu(o,1)}},n.batchedUpdates=function(o,a){var d=Fe;Fe|=1;try{return o(a)}finally{Fe=d,Fe===0&&(ds(),cu&&ki())}},n.createComponentSelector=function(o){return{$$typeof:ku,value:o}},n.createContainer=function(o,a,d,h,g,x,C){return yx(o,a,!1,null,d,h,g,x,C)},n.createHasPseudoClassSelector=function(o){return{$$typeof:Lu,value:o}},n.createHydrationContainer=function(o,a,d,h,g,x,C,O,j){return o=yx(d,h,!0,o,g,x,C,O,j),o.context=vx(null),d=o.current,h=nn(),g=Sr(d),x=Ki(h,g),x.callback=a??null,yr(d,x,g),o.current.lanes=g,fa(o,g,h),In(o,h),o},n.createPortal=function(o,a,d){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:p,key:h==null?null:""+h,children:o,containerInfo:a,implementation:d}},n.createRoleSelector=function(o){return{$$typeof:Fu,value:o}},n.createTestNameSelector=function(o){return{$$typeof:Nu,value:o}},n.createTextSelector=function(o){return{$$typeof:zu,value:o}},n.deferredUpdates=function(o){var a=He,d=Et.transition;try{return Et.transition=null,He=16,o()}finally{He=a,Et.transition=d}},n.discreteUpdates=function(o,a,d,h,g){var x=He,C=Et.transition;try{return Et.transition=null,He=1,o(a,d,h,g)}finally{He=x,Et.transition=C,Fe===0&&ds()}},n.findAllNodes=Th,n.findBoundingRects=function(o,a){if(!kn)throw Error(l(363));a=Th(o,a),o=[];for(var d=0;d<a.length;d++)o.push(F(a[d]));for(a=o.length-1;0<a;a--){d=o[a];for(var h=d.x,g=h+d.width,x=d.y,C=x+d.height,O=a-1;0<=O;O--)if(a!==O){var j=o[O],ne=j.x,xe=ne+j.width,Te=j.y,se=Te+j.height;if(h>=ne&&x>=Te&&g<=xe&&C<=se){o.splice(a,1);break}else if(h!==ne||d.width!==j.width||se<x||Te>C){if(!(x!==Te||d.height!==j.height||xe<h||ne>g)){ne>h&&(j.width+=ne-h,j.x=h),xe<g&&(j.width=g-ne),o.splice(a,1);break}}else{Te>x&&(j.height+=Te-x,j.y=x),se<C&&(j.height=C-Te),o.splice(a,1);break}}}return o},n.findHostInstance=xx,n.findHostInstanceWithNoPortals=function(o){return o=G(o),o=o!==null?J(o):null,o===null?null:o.stateNode},n.findHostInstanceWithWarning=function(o){return xx(o)},n.flushControlled=function(o){var a=Fe;Fe|=1;var d=Et.transition,h=He;try{Et.transition=null,He=1,o()}finally{He=h,Et.transition=d,Fe=a,Fe===0&&(ds(),ki())}},n.flushPassiveEffects=co,n.flushSync=lx,n.focusWithin=function(o,a){if(!kn)throw Error(l(363));for(o=Ch(o),a=ox(o,a),a=Array.from(a),o=0;o<a.length;){var d=a[o++];if(!ie(d)){if(d.tag===5&&Se(d.stateNode))return!0;for(d=d.child;d!==null;)a.push(d),d=d.sibling}}return!1},n.getCurrentUpdatePriority=function(){return He},n.getFindAllNodesFailureDescription=function(o,a){if(!kn)throw Error(l(363));var d=0,h=[];o=[Ch(o),0];for(var g=0;g<o.length;){var x=o[g++],C=o[g++],O=a[C];if((x.tag!==5||!ie(x))&&(Ph(x,O)&&(h.push(Ah(O)),C++,C>d&&(d=C)),C<a.length))for(x=x.child;x!==null;)o.push(x,C),x=x.sibling}if(d<a.length){for(o=[];d<a.length;d++)o.push(Ah(a[d]));return`findAllNodes was able to match part of the selector:
1
+ "use strict";var ReactIIIFVault=(()=>{var WB=Object.create;var rm=Object.defineProperty;var $B=Object.getOwnPropertyDescriptor;var tP=Object.getOwnPropertyNames;var eP=Object.getPrototypeOf,nP=Object.prototype.hasOwnProperty;var li=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),iP=(t,e)=>{for(var n in e)rm(t,n,{get:e[n],enumerable:!0})},jw=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of tP(e))!nP.call(t,a)&&a!==n&&rm(t,a,{get:()=>e[a],enumerable:!(i=$B(e,a))||i.enumerable});return t};var _=(t,e,n)=>(n=t!=null?WB(eP(t)):{},jw(e||!t||!t.__esModule?rm(n,"default",{value:t,enumerable:!0}):n,t)),aP=t=>jw(rm({},"__esModule",{value:!0}),t);var X=li((w9,Zw)=>{"use strict";Zw.exports=React});var Ww=li(um=>{"use strict";var IP=Symbol.for("react.transitional.element"),DP=Symbol.for("react.fragment");function Jw(t,e,n){var i=null;if(n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),"key"in e){n={};for(var a in e)a!=="key"&&(n[a]=e[a])}else n=e;return e=n.ref,{$$typeof:IP,type:t,key:i,ref:e!==void 0?e:null,props:n}}um.Fragment=DP;um.jsx=Jw;um.jsxs=Jw});var V=li((O9,$w)=>{"use strict";$w.exports=Ww()});var mM=li(pM=>{"use strict";var ju=X();function eH(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var nH=typeof Object.is=="function"?Object.is:eH,iH=ju.useState,aH=ju.useEffect,oH=ju.useLayoutEffect,rH=ju.useDebugValue;function lH(t,e){var n=e(),i=iH({inst:{value:n,getSnapshot:e}}),a=i[0].inst,o=i[1];return oH(function(){a.value=n,a.getSnapshot=e,sb(a)&&o({inst:a})},[t,n,e]),aH(function(){return sb(a)&&o({inst:a}),t(function(){sb(a)&&o({inst:a})})},[t]),rH(n),n}function sb(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!nH(t,n)}catch{return!0}}function sH(t,e){return e()}var uH=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?sH:lH;pM.useSyncExternalStore=ju.useSyncExternalStore!==void 0?ju.useSyncExternalStore:uH});var yM=li((yk,gM)=>{"use strict";gM.exports=mM()});var SM=li(vM=>{"use strict";var Fm=X(),cH=yM();function fH(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var dH=typeof Object.is=="function"?Object.is:fH,hH=cH.useSyncExternalStore,pH=Fm.useRef,mH=Fm.useEffect,gH=Fm.useMemo,yH=Fm.useDebugValue;vM.useSyncExternalStoreWithSelector=function(t,e,n,i,a){var o=pH(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=gH(function(){function d(v){if(!p){if(p=!0,f=v,v=i(v),a!==void 0&&s.hasValue){var S=s.value;if(a(S,v))return m=S}return m=v}if(S=m,dH(f,v))return S;var R=i(v);return a!==void 0&&a(S,R)?S:(f=v,m=R)}var p=!1,f,m,g=n===void 0?null:n;return[function(){return d(e())},g===null?void 0:function(){return d(g())}]},[e,n,i,a]);var u=hH(t,o[0],o[1]);return mH(function(){s.hasValue=!0,s.value=u},[u]),yH(u),u}});var xM=li((Sk,bM)=>{"use strict";bM.exports=SM()});var KM=li(De=>{"use strict";function Rb(t,e){var n=t.length;t.push(e);t:for(;0<n;){var i=n-1>>>1,a=t[i];if(0<Zm(a,e))t[i]=e,t[n]=a,n=i;else break t}}function uo(t){return t.length===0?null:t[0]}function Wm(t){if(t.length===0)return null;var e=t[0],n=t.pop();if(n!==e){t[0]=n;t:for(var i=0,a=t.length,o=a>>>1;i<o;){var s=2*(i+1)-1,u=t[s],d=s+1,p=t[d];if(0>Zm(u,n))d<a&&0>Zm(p,u)?(t[i]=p,t[d]=n,i=d):(t[i]=u,t[s]=n,i=s);else if(d<a&&0>Zm(p,n))t[i]=p,t[d]=n,i=d;else break t}}return e}function Zm(t,e){var n=t.sortIndex-e.sortIndex;return n!==0?n:t.id-e.id}De.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(VM=performance,De.unstable_now=function(){return VM.now()}):(bb=Date,jM=bb.now(),De.unstable_now=function(){return bb.now()-jM});var VM,bb,jM,Ho=[],Ur=[],NH=1,xa=null,$n=3,Ab=!1,od=!1,rd=!1,Tb=!1,GM=typeof setTimeout=="function"?setTimeout:null,kM=typeof clearTimeout=="function"?clearTimeout:null,qM=typeof setImmediate<"u"?setImmediate:null;function Jm(t){for(var e=uo(Ur);e!==null;){if(e.callback===null)Wm(Ur);else if(e.startTime<=t)Wm(Ur),e.sortIndex=e.expirationTime,Rb(Ho,e);else break;e=uo(Ur)}}function Cb(t){if(rd=!1,Jm(t),!od)if(uo(Ho)!==null)od=!0,Qu||(Qu=!0,Yu());else{var e=uo(Ur);e!==null&&wb(Cb,e.startTime-t)}}var Qu=!1,ld=-1,YM=5,QM=-1;function XM(){return Tb?!0:!(De.unstable_now()-QM<YM)}function xb(){if(Tb=!1,Qu){var t=De.unstable_now();QM=t;var e=!0;try{t:{od=!1,rd&&(rd=!1,kM(ld),ld=-1),Ab=!0;var n=$n;try{e:{for(Jm(t),xa=uo(Ho);xa!==null&&!(xa.expirationTime>t&&XM());){var i=xa.callback;if(typeof i=="function"){xa.callback=null,$n=xa.priorityLevel;var a=i(xa.expirationTime<=t);if(t=De.unstable_now(),typeof a=="function"){xa.callback=a,Jm(t),e=!0;break e}xa===uo(Ho)&&Wm(Ho),Jm(t)}else Wm(Ho);xa=uo(Ho)}if(xa!==null)e=!0;else{var o=uo(Ur);o!==null&&wb(Cb,o.startTime-t),e=!1}}break t}finally{xa=null,$n=n,Ab=!1}e=void 0}}finally{e?Yu():Qu=!1}}}var Yu;typeof qM=="function"?Yu=function(){qM(xb)}:typeof MessageChannel<"u"?(Eb=new MessageChannel,FM=Eb.port2,Eb.port1.onmessage=xb,Yu=function(){FM.postMessage(null)}):Yu=function(){GM(xb,0)};var Eb,FM;function wb(t,e){ld=GM(function(){t(De.unstable_now())},e)}De.unstable_IdlePriority=5;De.unstable_ImmediatePriority=1;De.unstable_LowPriority=4;De.unstable_NormalPriority=3;De.unstable_Profiling=null;De.unstable_UserBlockingPriority=2;De.unstable_cancelCallback=function(t){t.callback=null};De.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):YM=0<t?Math.floor(1e3/t):5};De.unstable_getCurrentPriorityLevel=function(){return $n};De.unstable_next=function(t){switch($n){case 1:case 2:case 3:var e=3;break;default:e=$n}var n=$n;$n=e;try{return t()}finally{$n=n}};De.unstable_requestPaint=function(){Tb=!0};De.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var n=$n;$n=t;try{return e()}finally{$n=n}};De.unstable_scheduleCallback=function(t,e,n){var i=De.unstable_now();switch(typeof n=="object"&&n!==null?(n=n.delay,n=typeof n=="number"&&0<n?i+n:i):n=i,t){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return a=n+a,t={id:NH++,callback:e,priorityLevel:t,startTime:n,expirationTime:a,sortIndex:-1},n>i?(t.sortIndex=n,Rb(Ur,t),uo(Ho)===null&&t===uo(Ur)&&(rd?(kM(ld),ld=-1):rd=!0,wb(Cb,n-i))):(t.sortIndex=a,Rb(Ho,t),od||Ab||(od=!0,Qu||(Qu=!0,Yu()))),t};De.unstable_shouldYield=XM;De.unstable_wrapCallback=function(t){var e=$n;return function(){var n=$n;$n=e;try{return t.apply(this,arguments)}finally{$n=n}}}});var Mb=li((vY,ZM)=>{"use strict";ZM.exports=KM()});var JM=li((SY,sd)=>{"use strict";sd.exports=function(t){function e(r,l,c,h){return new i5(r,l,c,h)}function n(){}function i(r){var l="https://react.dev/errors/"+r;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)l+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+r+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(r){var l=r,c=r;if(r.alternate)for(;l.return;)l=l.return;else{r=l;do l=r,l.flags&4098&&(c=l.return),r=l.return;while(r)}return l.tag===3?c:null}function o(r){if(a(r)!==r)throw Error(i(188))}function s(r){var l=r.alternate;if(!l){if(l=a(r),l===null)throw Error(i(188));return l!==r?null:r}for(var c=r,h=l;;){var y=c.return;if(y===null)break;var b=y.alternate;if(b===null){if(h=y.return,h!==null){c=h;continue}break}if(y.child===b.child){for(b=y.child;b;){if(b===c)return o(y),r;if(b===h)return o(y),l;b=b.sibling}throw Error(i(188))}if(c.return!==h.return)c=y,h=b;else{for(var w=!1,N=y.child;N;){if(N===c){w=!0,c=y,h=b;break}if(N===h){w=!0,h=y,c=b;break}N=N.sibling}if(!w){for(N=b.child;N;){if(N===c){w=!0,c=b,h=y;break}if(N===h){w=!0,h=b,c=y;break}N=N.sibling}if(!w)throw Error(i(189))}}if(c.alternate!==h)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?r:l}function u(r){var l=r.tag;if(l===5||l===26||l===27||l===6)return r;for(r=r.child;r!==null;){if(l=u(r),l!==null)return l;r=r.sibling}return null}function d(r){var l=r.tag;if(l===5||l===26||l===27||l===6)return r;for(r=r.child;r!==null;){if(r.tag!==4&&(l=d(r),l!==null))return l;r=r.sibling}return null}function p(r){return r===null||typeof r!="object"?null:(r=rw&&r[rw]||r["@@iterator"],typeof r=="function"?r:null)}function f(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===s5?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case ou:return"Fragment";case cS:return"Profiler";case aw:return"StrictMode";case dS:return"Suspense";case hS:return"SuspenseList";case mS:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case au:return"Portal";case xr:return r.displayName||"Context";case ow:return(r._context.displayName||"Context")+".Consumer";case fS:var l=r.render;return r=r.displayName,r||(r=l.displayName||l.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case pS:return l=r.displayName||null,l!==null?l:f(r.type)||"Memo";case Er:l=r._payload,r=r._init;try{return f(r(l))}catch{}}return null}function m(r){return{current:r}}function g(r){0>su||(r.current=xS[su],xS[su]=null,su--)}function v(r,l){su++,xS[su]=r.current,r.current=l}function S(r){return r>>>=0,r===0?32:31-(BB(r)/PB|0)|0}function R(r){var l=r&42;if(l!==0)return l;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function T(r,l,c){var h=r.pendingLanes;if(h===0)return 0;var y=0,b=r.suspendedLanes,w=r.pingedLanes;r=r.warmLanes;var N=h&134217727;return N!==0?(h=N&~b,h!==0?y=R(h):(w&=N,w!==0?y=R(w):c||(c=N&~r,c!==0&&(y=R(c))))):(N=h&~b,N!==0?y=R(N):w!==0?y=R(w):c||(c=h&~r,c!==0&&(y=R(c)))),y===0?0:l!==0&&l!==y&&!(l&b)&&(b=y&-y,c=l&-l,b>=c||b===32&&(c&4194048)!==0)?l:y}function E(r,l){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&l)===0}function x(r,l){switch(r){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function A(){var r=jp;return jp<<=1,!(jp&62914560)&&(jp=4194304),r}function C(r){for(var l=[],c=0;31>c;c++)l.push(r);return l}function M(r,l){r.pendingLanes|=l,l!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function I(r,l,c,h,y,b){var w=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var N=r.entanglements,G=r.expirationTimes,tt=r.hiddenUpdates;for(c=w&~c;0<c;){var ut=31-Ui(c),at=1<<ut;N[ut]=0,G[ut]=-1;var mt=tt[ut];if(mt!==null)for(tt[ut]=null,ut=0;ut<mt.length;ut++){var Lt=mt[ut];Lt!==null&&(Lt.lane&=-536870913)}c&=~at}h!==0&&z(r,h,0),b!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=b&~(w&~l))}function z(r,l,c){r.pendingLanes|=l,r.suspendedLanes&=~l;var h=31-Ui(l);r.entangledLanes|=l,r.entanglements[h]=r.entanglements[h]|1073741824|c&261930}function D(r,l){var c=r.entangledLanes|=l;for(r=r.entanglements;c;){var h=31-Ui(c),y=1<<h;y&l|r[h]&l&&(r[h]|=l),c&=~y}}function k(r,l){var c=l&-l;return c=c&42?1:B(c),c&(r.suspendedLanes|l)?0:c}function B(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Q(r){return r&=-r,2<r?8<r?r&134217727?32:268435456:8:2}function it(r){if(typeof qB=="function"&&FB(r),Vi&&typeof Vi.setStrictMode=="function")try{Vi.setStrictMode(Mf,r)}catch{}}function lt(r,l){return r===l&&(r!==0||1/r===1/l)||r!==r&&l!==l}function et(r){if(AS===void 0)try{throw Error()}catch(c){var l=c.stack.trim().match(/\n( *(at )?)/);AS=l&&l[1]||"",Nw=-1<c.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+AS+r+Nw}function $(r,l){if(!r||TS)return"";TS=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(l){var at=function(){throw Error()};if(Object.defineProperty(at.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(at,[])}catch(Lt){var mt=Lt}Reflect.construct(r,[],at)}else{try{at.call()}catch(Lt){mt=Lt}r.call(at.prototype)}}else{try{throw Error()}catch(Lt){mt=Lt}(at=r())&&typeof at.catch=="function"&&at.catch(function(){})}}catch(Lt){if(Lt&&mt&&typeof Lt.stack=="string")return[Lt.stack,mt.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=h.DetermineComponentFrameRoot(),w=b[0],N=b[1];if(w&&N){var G=w.split(`
4
+ `),tt=N.split(`
5
+ `);for(y=h=0;h<G.length&&!G[h].includes("DetermineComponentFrameRoot");)h++;for(;y<tt.length&&!tt[y].includes("DetermineComponentFrameRoot");)y++;if(h===G.length||y===tt.length)for(h=G.length-1,y=tt.length-1;1<=h&&0<=y&&G[h]!==tt[y];)y--;for(;1<=h&&0<=y;h--,y--)if(G[h]!==tt[y]){if(h!==1||y!==1)do if(h--,y--,0>y||G[h]!==tt[y]){var ut=`
6
+ `+G[h].replace(" at new "," at ");return r.displayName&&ut.includes("<anonymous>")&&(ut=ut.replace("<anonymous>",r.displayName)),ut}while(1<=h&&0<=y);break}}}finally{TS=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?et(c):""}function ht(r,l){switch(r.tag){case 26:case 27:case 5:return et(r.type);case 16:return et("Lazy");case 13:return r.child!==l&&l!==null?et("Suspense Fallback"):et("Suspense");case 19:return et("SuspenseList");case 0:case 15:return $(r.type,!1);case 11:return $(r.type.render,!1);case 1:return $(r.type,!0);case 31:return et("Activity");default:return""}}function bt(r){try{var l="",c=null;do l+=ht(r,c),c=r,r=r.return;while(r);return l}catch(h){return`
7
+ Error generating stack: `+h.message+`
8
+ `+h.stack}}function st(r,l){if(typeof r=="object"&&r!==null){var c=Iw.get(r);return c!==void 0?c:(l={value:r,source:l,stack:bt(l)},Iw.set(r,l),l)}return{value:r,source:l,stack:bt(l)}}function rt(r,l){cu[fu++]=Of,cu[fu++]=Fp,Fp=r,Of=l}function Y(r,l,c){ha[pa++]=ro,ha[pa++]=lo,ha[pa++]=Rr,Rr=r;var h=ro;r=lo;var y=32-Ui(h)-1;h&=~(1<<y),c+=1;var b=32-Ui(l)+y;if(30<b){var w=y-y%5;b=(h&(1<<w)-1).toString(32),h>>=w,y-=w,ro=1<<32-Ui(l)+y|c<<y|h,lo=b+r}else ro=1<<b|c<<y|h,lo=r}function At(r){r.return!==null&&(rt(r,1),Y(r,1,0))}function Qt(r){for(;r===Fp;)Fp=cu[--fu],cu[fu]=null,Of=cu[--fu],cu[fu]=null;for(;r===Rr;)Rr=ha[--pa],ha[pa]=null,lo=ha[--pa],ha[pa]=null,ro=ha[--pa],ha[pa]=null}function ce(r,l){ha[pa++]=ro,ha[pa++]=lo,ha[pa++]=Rr,ro=l.id,lo=l.overflow,Rr=r}function se(r,l){v(Ar,l),v(_f,r),v(Un,null),r=f5(l),g(Un),v(Un,r)}function ae(){g(Un),g(_f),g(Ar)}function me(r){r.memoizedState!==null&&v(Gp,r);var l=Un.current,c=d5(l,r.type);l!==c&&(v(_f,r),v(Un,c))}function Ie(r){_f.current===r&&(g(Un),g(_f)),Gp.current===r&&(g(Gp),wo?Fl._currentValue=ru:Fl._currentValue2=ru)}function oe(r){var l=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Et(st(l,r)),CS}function da(r,l){if(!Jn)throw Error(i(175));dB(r.stateNode,r.type,r.memoizedProps,l,r)||oe(r,!0)}function ii(r){for(Vn=r.return;Vn;)switch(Vn.tag){case 5:case 31:case 13:ma=!1;return;case 27:case 3:ma=!0;return;default:Vn=Vn.return}}function fe(r){if(!Jn||r!==Vn)return!1;if(!Zt)return ii(r),Zt=!0,!1;var l=r.tag;if(En?l!==3&&l!==27&&(l!==5||Sw(r.type)&&!Hp(r.type,r.memoizedProps))&&He&&oe(r):l!==3&&(l!==5||Sw(r.type)&&!Hp(r.type,r.memoizedProps))&&He&&oe(r),ii(r),l===13){if(!Jn)throw Error(i(316));if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));He=yB(r)}else if(l===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));He=gB(r)}else He=En&&l===27?nB(r.type,He):Vn?vw(r.stateNode):null;return!0}function ue(){Jn&&(He=Vn=null,Zt=!1)}function $t(){var r=Tr;return r!==null&&(Ei===null?Ei=r:Ei.push.apply(Ei,r),Tr=null),r}function Et(r){Tr===null?Tr=[r]:Tr.push(r)}function Tt(r,l,c){wo?(v(kp,l._currentValue),l._currentValue=c):(v(kp,l._currentValue2),l._currentValue2=c)}function Vt(r){var l=kp.current;wo?r._currentValue=l:r._currentValue2=l,g(kp)}function Pn(r,l,c){for(;r!==null;){var h=r.alternate;if((r.childLanes&l)!==l?(r.childLanes|=l,h!==null&&(h.childLanes|=l)):h!==null&&(h.childLanes&l)!==l&&(h.childLanes|=l),r===c)break;r=r.return}}function yi(r,l,c,h){var y=r.child;for(y!==null&&(y.return=r);y!==null;){var b=y.dependencies;if(b!==null){var w=y.child;b=b.firstContext;t:for(;b!==null;){var N=b;b=y;for(var G=0;G<l.length;G++)if(N.context===l[G]){b.lanes|=c,N=b.alternate,N!==null&&(N.lanes|=c),Pn(b.return,c,r),h||(w=null);break t}b=N.next}}else if(y.tag===18){if(w=y.return,w===null)throw Error(i(341));w.lanes|=c,b=w.alternate,b!==null&&(b.lanes|=c),Pn(w,c,r),w=null}else w=y.child;if(w!==null)w.return=y;else for(w=y;w!==null;){if(w===r){w=null;break}if(y=w.sibling,y!==null){y.return=w.return,w=y;break}w=w.return}y=w}}function bn(r,l,c,h){r=null;for(var y=l,b=!1;y!==null;){if(!b){if(y.flags&524288)b=!0;else if(y.flags&262144)break}if(y.tag===10){var w=y.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var N=y.type;ji(y.pendingProps.value,w.value)||(r!==null?r.push(N):r=[N])}}else if(y===Gp.current){if(w=y.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(r!==null?r.push(Fl):r=[Fl])}y=y.return}r!==null&&yi(l,r,c,h),l.flags|=262144}function ln(r){for(r=r.firstContext;r!==null;){var l=r.context;if(!ji(wo?l._currentValue:l._currentValue2,r.memoizedValue))return!0;r=r.next}return!1}function ai(r){Gl=r,Oo=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function P(r){return ct(Gl,r)}function K(r,l){return Gl===null&&ai(r),ct(r,l)}function ct(r,l){var c=wo?l._currentValue:l._currentValue2;if(l={context:l,memoizedValue:c,next:null},Oo===null){if(r===null)throw Error(i(308));Oo=l,r.dependencies={lanes:0,firstContext:l},r.flags|=524288}else Oo=Oo.next=l;return c}function ft(){return{controller:new kB,data:new Map,refCount:0}}function vt(r){r.refCount--,r.refCount===0&&YB(QB,function(){r.controller.abort()})}function j(){}function L(r){r!==du&&r.next===null&&(du===null?Yp=du=r:du=du.next=r),Qp=!0,wS||(wS=!0,Z())}function W(r,l){if(!MS&&Qp){MS=!0;do for(var c=!1,h=Yp;h!==null;){if(!l)if(r!==0){var y=h.pendingLanes;if(y===0)var b=0;else{var w=h.suspendedLanes,N=h.pingedLanes;b=(1<<31-Ui(42|r)+1)-1,b&=y&~(w&~N),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(c=!0,F(h,b))}else b=Xt,b=T(h,h===Ee?b:0,h.cancelPendingCommit!==null||h.timeoutHandle!==ql),!(b&3)||E(h,b)||(c=!0,F(h,b));h=h.next}while(c);MS=!1}}function nt(){zt()}function zt(){Qp=wS=!1;var r=0;kl!==0&&x5()&&(r=kl);for(var l=bi(),c=null,h=Yp;h!==null;){var y=h.next,b=Dt(h,l);b===0?(h.next=null,c===null?Yp=y:c.next=y,y===null&&(du=c)):(c=h,(r!==0||b&3)&&(Qp=!0)),h=y}Rn!==0&&Rn!==5||W(r,!1),kl!==0&&(kl=0)}function Dt(r,l){for(var c=r.suspendedLanes,h=r.pingedLanes,y=r.expirationTimes,b=r.pendingLanes&-62914561;0<b;){var w=31-Ui(b),N=1<<w,G=y[w];G===-1?(!(N&c)||N&h)&&(y[w]=x(N,l)):G<=l&&(r.expiredLanes|=N),b&=~N}if(l=Ee,c=Xt,c=T(r,r===l?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==ql),h=r.callbackNode,c===0||r===l&&(de===2||de===9)||r.cancelPendingCommit!==null)return h!==null&&h!==null&&ES(h),r.callbackNode=null,r.callbackPriority=0;if(!(c&3)||E(r,c)){if(l=c&-c,l===r.callbackPriority)return l;switch(h!==null&&ES(h),Q(c)){case 2:case 8:c=VB;break;case 32:c=RS;break;case 268435456:c=jB;break;default:c=RS}return h=jt.bind(null,r),c=qp(c,h),r.callbackPriority=l,r.callbackNode=c,l}return h!==null&&h!==null&&ES(h),r.callbackPriority=2,r.callbackNode=null,2}function jt(r,l){if(Rn!==0&&Rn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(Af()&&r.callbackNode!==c)return null;var h=Xt;return h=T(r,r===Ee?h:0,r.cancelPendingCommit!==null||r.timeoutHandle!==ql),h===0?null:(IC(r,h,l),Dt(r,bi()),r.callbackNode!=null&&r.callbackNode===c?jt.bind(null,r):null)}function F(r,l){if(Af())return null;IC(r,l,!0)}function Z(){M5?O5(function(){Ft&6?qp(_w,nt):zt()}):qp(_w,nt)}function pt(){if(kl===0){var r=hu;r===0&&(r=Up,Up<<=1,!(Up&261888)&&(Up=256)),kl=r}return kl}function yt(r,l){if(zf===null){var c=zf=[];OS=0,hu=pt(),pu={status:"pending",value:void 0,then:function(h){c.push(h)}}}return OS++,l.then(dt,dt),l}function dt(){if(--OS===0&&zf!==null){pu!==null&&(pu.status="fulfilled");var r=zf;zf=null,hu=0,pu=null;for(var l=0;l<r.length;l++)(0,r[l])()}}function Ht(r,l){var c=[],h={status:"pending",value:null,reason:null,then:function(y){c.push(y)}};return r.then(function(){h.status="fulfilled",h.value=l;for(var y=0;y<c.length;y++)(0,c[y])(l)},function(y){for(h.status="rejected",h.reason=y,y=0;y<c.length;y++)(0,c[y])(void 0)}),h}function xe(){var r=Yl.current;return r!==null?r:Ee.pooledCache}function ge(r,l){l===null?v(Yl,Yl.current):v(Yl,l.pool)}function ye(){var r=xe();return r===null?null:{parent:wo?Ue._currentValue:Ue._currentValue2,pool:r}}function Ye(r,l){if(ji(r,l))return!0;if(typeof r!="object"||r===null||typeof l!="object"||l===null)return!1;var c=Object.keys(r),h=Object.keys(l);if(c.length!==h.length)return!1;for(h=0;h<c.length;h++){var y=c[h];if(!GB.call(l,y)||!ji(r[y],l[y]))return!1}return!0}function Pe(r){return r=r.status,r==="fulfilled"||r==="rejected"}function xn(r,l,c){switch(c=r[c],c===void 0?r.push(l):c!==l&&(l.then(j,j),l=c),l.status){case"fulfilled":return l.value;case"rejected":throw r=l.reason,Ll(r),r;default:if(typeof l.status=="string")l.then(j,j);else{if(r=Ee,r!==null&&100<r.shellSuspendCounter)throw Error(i(482));r=l,r.status="pending",r.then(function(h){if(l.status==="pending"){var y=l;y.status="fulfilled",y.value=h}},function(h){if(l.status==="pending"){var y=l;y.status="rejected",y.reason=h}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw r=l.reason,Ll(r),r}throw Ql=l,mu}}function vi(r){try{var l=r._init;return l(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Ql=c,mu):c}}function io(){if(Ql===null)throw Error(i(459));var r=Ql;return Ql=null,r}function Ll(r){if(r===mu||r===Xp)throw Error(i(483))}function Bl(r){var l=Nf;return Nf+=1,gu===null&&(gu=[]),xn(gu,r,l)}function pr(r,l){l=l.props.ref,r.ref=l!==void 0?l:null}function hp(r,l){throw l.$$typeof===r5?Error(i(525)):(r=Object.prototype.toString.call(l),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":r)))}function aT(r){function l(U,H){if(r){var q=U.deletions;q===null?(U.deletions=[H],U.flags|=16):q.push(H)}}function c(U,H){if(!r)return null;for(;H!==null;)l(U,H),H=H.sibling;return null}function h(U){for(var H=new Map;U!==null;)U.key!==null?H.set(U.key,U):H.set(U.index,U),U=U.sibling;return H}function y(U,H){return U=Co(U,H),U.index=0,U.sibling=null,U}function b(U,H,q){return U.index=q,r?(q=U.alternate,q!==null?(q=q.index,q<H?(U.flags|=67108866,H):q):(U.flags|=67108866,H)):(U.flags|=1048576,H)}function w(U){return r&&U.alternate===null&&(U.flags|=67108866),U}function N(U,H,q,ot){return H===null||H.tag!==6?(H=rS(q,U.mode,ot),H.return=U,H):(H=y(H,q),H.return=U,H)}function G(U,H,q,ot){var wt=q.type;return wt===ou?ut(U,H,q.props.children,ot,q.key):H!==null&&(H.elementType===wt||typeof wt=="object"&&wt!==null&&wt.$$typeof===Er&&vi(wt)===H.type)?(H=y(H,q.props),pr(H,q),H.return=U,H):(H=Lp(q.type,q.key,q.props,null,U.mode,ot),pr(H,q),H.return=U,H)}function tt(U,H,q,ot){return H===null||H.tag!==4||H.stateNode.containerInfo!==q.containerInfo||H.stateNode.implementation!==q.implementation?(H=lS(q,U.mode,ot),H.return=U,H):(H=y(H,q.children||[]),H.return=U,H)}function ut(U,H,q,ot,wt){return H===null||H.tag!==7?(H=jl(q,U.mode,ot,wt),H.return=U,H):(H=y(H,q),H.return=U,H)}function at(U,H,q){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=rS(""+H,U.mode,q),H.return=U,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case Bp:return q=Lp(H.type,H.key,H.props,null,U.mode,q),pr(q,H),q.return=U,q;case au:return H=lS(H,U.mode,q),H.return=U,H;case Er:return H=vi(H),at(U,H,q)}if(Pp(H)||p(H))return H=jl(H,U.mode,q,null),H.return=U,H;if(typeof H.then=="function")return at(U,Bl(H),q);if(H.$$typeof===xr)return at(U,K(U,H),q);hp(U,H)}return null}function mt(U,H,q,ot){var wt=H!==null?H.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return wt!==null?null:N(U,H,""+q,ot);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case Bp:return q.key===wt?G(U,H,q,ot):null;case au:return q.key===wt?tt(U,H,q,ot):null;case Er:return q=vi(q),mt(U,H,q,ot)}if(Pp(q)||p(q))return wt!==null?null:ut(U,H,q,ot,null);if(typeof q.then=="function")return mt(U,H,Bl(q),ot);if(q.$$typeof===xr)return mt(U,H,K(U,q),ot);hp(U,q)}return null}function Lt(U,H,q,ot,wt){if(typeof ot=="string"&&ot!==""||typeof ot=="number"||typeof ot=="bigint")return U=U.get(q)||null,N(H,U,""+ot,wt);if(typeof ot=="object"&&ot!==null){switch(ot.$$typeof){case Bp:return U=U.get(ot.key===null?q:ot.key)||null,G(H,U,ot,wt);case au:return U=U.get(ot.key===null?q:ot.key)||null,tt(H,U,ot,wt);case Er:return ot=vi(ot),Lt(U,H,q,ot,wt)}if(Pp(ot)||p(ot))return U=U.get(q)||null,ut(H,U,ot,wt,null);if(typeof ot.then=="function")return Lt(U,H,q,Bl(ot),wt);if(ot.$$typeof===xr)return Lt(U,H,q,K(H,ot),wt);hp(H,ot)}return null}function jn(U,H,q,ot){for(var wt=null,Ve=null,Mt=H,ee=H=0,zn=null;Mt!==null&&ee<q.length;ee++){Mt.index>ee?(zn=Mt,Mt=null):zn=Mt.sibling;var ne=mt(U,Mt,q[ee],ot);if(ne===null){Mt===null&&(Mt=zn);break}r&&Mt&&ne.alternate===null&&l(U,Mt),H=b(ne,H,ee),Ve===null?wt=ne:Ve.sibling=ne,Ve=ne,Mt=zn}if(ee===q.length)return c(U,Mt),Zt&&rt(U,ee),wt;if(Mt===null){for(;ee<q.length;ee++)Mt=at(U,q[ee],ot),Mt!==null&&(H=b(Mt,H,ee),Ve===null?wt=Mt:Ve.sibling=Mt,Ve=Mt);return Zt&&rt(U,ee),wt}for(Mt=h(Mt);ee<q.length;ee++)zn=Lt(Mt,U,ee,q[ee],ot),zn!==null&&(r&&zn.alternate!==null&&Mt.delete(zn.key===null?ee:zn.key),H=b(zn,H,ee),Ve===null?wt=zn:Ve.sibling=zn,Ve=zn);return r&&Mt.forEach(function(zr){return l(U,zr)}),Zt&&rt(U,ee),wt}function Uf(U,H,q,ot){if(q==null)throw Error(i(151));for(var wt=null,Ve=null,Mt=H,ee=H=0,zn=null,ne=q.next();Mt!==null&&!ne.done;ee++,ne=q.next()){Mt.index>ee?(zn=Mt,Mt=null):zn=Mt.sibling;var zr=mt(U,Mt,ne.value,ot);if(zr===null){Mt===null&&(Mt=zn);break}r&&Mt&&zr.alternate===null&&l(U,Mt),H=b(zr,H,ee),Ve===null?wt=zr:Ve.sibling=zr,Ve=zr,Mt=zn}if(ne.done)return c(U,Mt),Zt&&rt(U,ee),wt;if(Mt===null){for(;!ne.done;ee++,ne=q.next())ne=at(U,ne.value,ot),ne!==null&&(H=b(ne,H,ee),Ve===null?wt=ne:Ve.sibling=ne,Ve=ne);return Zt&&rt(U,ee),wt}for(Mt=h(Mt);!ne.done;ee++,ne=q.next())ne=Lt(Mt,U,ee,ne.value,ot),ne!==null&&(r&&ne.alternate!==null&&Mt.delete(ne.key===null?ee:ne.key),H=b(ne,H,ee),Ve===null?wt=ne:Ve.sibling=ne,Ve=ne);return r&&Mt.forEach(function(JB){return l(U,JB)}),Zt&&rt(U,ee),wt}function Jl(U,H,q,ot){if(typeof q=="object"&&q!==null&&q.type===ou&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case Bp:t:{for(var wt=q.key;H!==null;){if(H.key===wt){if(wt=q.type,wt===ou){if(H.tag===7){c(U,H.sibling),ot=y(H,q.props.children),ot.return=U,U=ot;break t}}else if(H.elementType===wt||typeof wt=="object"&&wt!==null&&wt.$$typeof===Er&&vi(wt)===H.type){c(U,H.sibling),ot=y(H,q.props),pr(ot,q),ot.return=U,U=ot;break t}c(U,H);break}else l(U,H);H=H.sibling}q.type===ou?(ot=jl(q.props.children,U.mode,ot,q.key),ot.return=U,U=ot):(ot=Lp(q.type,q.key,q.props,null,U.mode,ot),pr(ot,q),ot.return=U,U=ot)}return w(U);case au:t:{for(wt=q.key;H!==null;){if(H.key===wt)if(H.tag===4&&H.stateNode.containerInfo===q.containerInfo&&H.stateNode.implementation===q.implementation){c(U,H.sibling),ot=y(H,q.children||[]),ot.return=U,U=ot;break t}else{c(U,H);break}else l(U,H);H=H.sibling}ot=lS(q,U.mode,ot),ot.return=U,U=ot}return w(U);case Er:return q=vi(q),Jl(U,H,q,ot)}if(Pp(q))return jn(U,H,q,ot);if(p(q)){if(wt=p(q),typeof wt!="function")throw Error(i(150));return q=wt.call(q),Uf(U,H,q,ot)}if(typeof q.then=="function")return Jl(U,H,Bl(q),ot);if(q.$$typeof===xr)return Jl(U,H,K(U,q),ot);hp(U,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,H!==null&&H.tag===6?(c(U,H.sibling),ot=y(H,q),ot.return=U,U=ot):(c(U,H),ot=rS(q,U.mode,ot),ot.return=U,U=ot),w(U)):c(U,H)}return function(U,H,q,ot){try{Nf=0;var wt=Jl(U,H,q,ot);return gu=null,wt}catch(Mt){if(Mt===mu||Mt===Xp)throw Mt;var Ve=e(29,Mt,null,U.mode);return Ve.lanes=ot,Ve.return=U,Ve}finally{}}}function pp(){for(var r=yu,l=zS=yu=0;l<r;){var c=ga[l];ga[l++]=null;var h=ga[l];ga[l++]=null;var y=ga[l];ga[l++]=null;var b=ga[l];if(ga[l++]=null,h!==null&&y!==null){var w=h.pending;w===null?y.next=y:(y.next=w.next,w.next=y),h.pending=y}b!==0&&oT(c,y,b)}}function mp(r,l,c,h){ga[yu++]=r,ga[yu++]=l,ga[yu++]=c,ga[yu++]=h,zS|=h,r.lanes|=h,r=r.alternate,r!==null&&(r.lanes|=h)}function d0(r,l,c,h){return mp(r,l,c,h),gp(r)}function Pl(r,l){return mp(r,null,null,l),gp(r)}function oT(r,l,c){r.lanes|=c;var h=r.alternate;h!==null&&(h.lanes|=c);for(var y=!1,b=r.return;b!==null;)b.childLanes|=c,h=b.alternate,h!==null&&(h.childLanes|=c),b.tag===22&&(r=b.stateNode,r===null||r._visibility&1||(y=!0)),r=b,b=b.return;return r.tag===3?(b=r.stateNode,y&&l!==null&&(y=31-Ui(c),r=b.hiddenUpdates,h=r[y],h===null?r[y]=[l]:h.push(l),l.lane=c|536870912),b):null}function gp(r){if(50<Hf)throw Hf=0,FS=null,Error(i(185));for(var l=r.return;l!==null;)r=l,l=r.return;return r.tag===3?r.stateNode:null}function h0(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function p0(r,l){r=r.updateQueue,l.updateQueue===r&&(l.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function mr(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function gr(r,l,c){var h=r.updateQueue;if(h===null)return null;if(h=h.shared,Ft&2){var y=h.pending;return y===null?l.next=l:(l.next=y.next,y.next=l),h.pending=l,l=gp(r),oT(r,null,c),l}return mp(r,h,l,c),gp(r)}function hf(r,l,c){if(l=l.updateQueue,l!==null&&(l=l.shared,(c&4194048)!==0)){var h=l.lanes;h&=r.pendingLanes,c|=h,l.lanes=c,D(r,c)}}function m0(r,l){var c=r.updateQueue,h=r.alternate;if(h!==null&&(h=h.updateQueue,c===h)){var y=null,b=null;if(c=c.firstBaseUpdate,c!==null){do{var w={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};b===null?y=b=w:b=b.next=w,c=c.next}while(c!==null);b===null?y=b=l:b=b.next=l}else y=b=l;c={baseState:h.baseState,firstBaseUpdate:y,lastBaseUpdate:b,shared:h.shared,callbacks:h.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=l:r.next=l,c.lastBaseUpdate=l}function pf(){if(NS){var r=pu;if(r!==null)throw r}}function mf(r,l,c,h){NS=!1;var y=r.updateQueue;Cr=!1;var b=y.firstBaseUpdate,w=y.lastBaseUpdate,N=y.shared.pending;if(N!==null){y.shared.pending=null;var G=N,tt=G.next;G.next=null,w===null?b=tt:w.next=tt,w=G;var ut=r.alternate;ut!==null&&(ut=ut.updateQueue,N=ut.lastBaseUpdate,N!==w&&(N===null?ut.firstBaseUpdate=tt:N.next=tt,ut.lastBaseUpdate=G))}if(b!==null){var at=y.baseState;w=0,ut=tt=G=null,N=b;do{var mt=N.lane&-536870913,Lt=mt!==N.lane;if(Lt?(Xt&mt)===mt:(h&mt)===mt){mt!==0&&mt===hu&&(NS=!0),ut!==null&&(ut=ut.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});t:{var jn=r,Uf=N;mt=l;var Jl=c;switch(Uf.tag){case 1:if(jn=Uf.payload,typeof jn=="function"){at=jn.call(Jl,at,mt);break t}at=jn;break t;case 3:jn.flags=jn.flags&-65537|128;case 0:if(jn=Uf.payload,mt=typeof jn=="function"?jn.call(Jl,at,mt):jn,mt==null)break t;at=uS({},at,mt);break t;case 2:Cr=!0}}mt=N.callback,mt!==null&&(r.flags|=64,Lt&&(r.flags|=8192),Lt=y.callbacks,Lt===null?y.callbacks=[mt]:Lt.push(mt))}else Lt={lane:mt,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ut===null?(tt=ut=Lt,G=at):ut=ut.next=Lt,w|=mt;if(N=N.next,N===null){if(N=y.shared.pending,N===null)break;Lt=N,N=Lt.next,Lt.next=null,y.lastBaseUpdate=Lt,y.shared.pending=null}}while(!0);ut===null&&(G=at),y.baseState=G,y.firstBaseUpdate=tt,y.lastBaseUpdate=ut,b===null&&(y.shared.lanes=0),Mr|=w,r.lanes=w,r.memoizedState=at}}function rT(r,l){if(typeof r!="function")throw Error(i(191,r));r.call(l)}function lT(r,l){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)rT(c[r],l)}function sT(r,l){r=No,v(Zp,r),v(vu,l),No=r|l.baseLanes}function g0(){v(Zp,No),v(vu,vu.current)}function y0(){No=Zp.current,g(vu),g(Zp)}function yr(r){var l=r.alternate;v(en,en.current&1),v(qi,r),ya===null&&(l===null||vu.current!==null||l.memoizedState!==null)&&(ya=r)}function v0(r){v(en,en.current),v(qi,r),ya===null&&(ya=r)}function uT(r){r.tag===22?(v(en,en.current),v(qi,r),ya===null&&(ya=r)):vr(r)}function vr(){v(en,en.current),v(qi,qi.current)}function Bi(r){g(qi),ya===r&&(ya=null),g(en)}function yp(r){for(var l=r;l!==null;){if(l.tag===13){var c=l.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||vS(c)||SS(c)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if(l.flags&128)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===r)break;for(;l.sibling===null;){if(l.return===null||l.return===r)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}function Qe(){throw Error(i(321))}function S0(r,l){if(l===null)return!1;for(var c=0;c<l.length&&c<r.length;c++)if(!ji(r[c],l[c]))return!1;return!0}function b0(r,l,c,h,y,b){return _o=b,Bt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,Ct.H=r===null||r.memoizedState===null?Bw:IS,Kl=!1,b=c(h,y),Kl=!1,Su&&(b=fT(l,c,h,y)),cT(r),b}function cT(r){Ct.H=Df;var l=ve!==null&&ve.next!==null;if(_o=0,sn=ve=Bt=null,Jp=!1,If=0,bu=null,l)throw Error(i(300));r===null||un||(r=r.dependencies,r!==null&&ln(r)&&(un=!0))}function fT(r,l,c,h){Bt=r;var y=0;do{if(Su&&(bu=null),If=0,Su=!1,25<=y)throw Error(i(301));if(y+=1,sn=ve=null,r.updateQueue!=null){var b=r.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}Ct.H=Pw,b=l(c,h)}while(Su);return b}function B4(){var r=Ct.H,l=r.useState()[0];return l=typeof l.then=="function"?gf(l):l,r=r.useState()[0],(ve!==null?ve.memoizedState:null)!==r&&(Bt.flags|=1024),l}function x0(){var r=Wp!==0;return Wp=0,r}function E0(r,l,c){l.updateQueue=r.updateQueue,l.flags&=-2053,r.lanes&=~c}function R0(r){if(Jp){for(r=r.memoizedState;r!==null;){var l=r.queue;l!==null&&(l.pending=null),r=r.next}Jp=!1}_o=0,sn=ve=Bt=null,Su=!1,If=Wp=0,bu=null}function oi(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return sn===null?Bt.memoizedState=sn=r:sn=sn.next=r,sn}function tn(){if(ve===null){var r=Bt.alternate;r=r!==null?r.memoizedState:null}else r=ve.next;var l=sn===null?Bt.memoizedState:sn.next;if(l!==null)sn=l,ve=r;else{if(r===null)throw Bt.alternate===null?Error(i(467)):Error(i(310));ve=r,r={memoizedState:ve.memoizedState,baseState:ve.baseState,baseQueue:ve.baseQueue,queue:ve.queue,next:null},sn===null?Bt.memoizedState=sn=r:sn=sn.next=r}return sn}function vp(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function gf(r){var l=If;return If+=1,bu===null&&(bu=[]),r=xn(bu,r,l),l=Bt,(sn===null?l.memoizedState:sn.next)===null&&(l=l.alternate,Ct.H=l===null||l.memoizedState===null?Bw:IS),r}function Sp(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return gf(r);if(r.$$typeof===xr)return P(r)}throw Error(i(438,String(r)))}function A0(r){var l=null,c=Bt.updateQueue;if(c!==null&&(l=c.memoCache),l==null){var h=Bt.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(l={data:h.data.map(function(y){return y.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),c===null&&(c=vp(),Bt.updateQueue=c),c.memoCache=l,c=l.data[l.index],c===void 0)for(c=l.data[l.index]=Array(r),h=0;h<r;h++)c[h]=l5;return l.index++,c}function Eo(r,l){return typeof l=="function"?l(r):l}function bp(r){var l=tn();return T0(l,ve,r)}function T0(r,l,c){var h=r.queue;if(h===null)throw Error(i(311));h.lastRenderedReducer=c;var y=r.baseQueue,b=h.pending;if(b!==null){if(y!==null){var w=y.next;y.next=b.next,b.next=w}l.baseQueue=y=b,h.pending=null}if(b=r.baseState,y===null)r.memoizedState=b;else{l=y.next;var N=w=null,G=null,tt=l,ut=!1;do{var at=tt.lane&-536870913;if(at!==tt.lane?(Xt&at)===at:(_o&at)===at){var mt=tt.revertLane;if(mt===0)G!==null&&(G=G.next={lane:0,revertLane:0,gesture:null,action:tt.action,hasEagerState:tt.hasEagerState,eagerState:tt.eagerState,next:null}),at===hu&&(ut=!0);else if((_o&mt)===mt){tt=tt.next,mt===hu&&(ut=!0);continue}else at={lane:0,revertLane:tt.revertLane,gesture:null,action:tt.action,hasEagerState:tt.hasEagerState,eagerState:tt.eagerState,next:null},G===null?(N=G=at,w=b):G=G.next=at,Bt.lanes|=mt,Mr|=mt;at=tt.action,Kl&&c(b,at),b=tt.hasEagerState?tt.eagerState:c(b,at)}else mt={lane:at,revertLane:tt.revertLane,gesture:tt.gesture,action:tt.action,hasEagerState:tt.hasEagerState,eagerState:tt.eagerState,next:null},G===null?(N=G=mt,w=b):G=G.next=mt,Bt.lanes|=at,Mr|=at;tt=tt.next}while(tt!==null&&tt!==l);if(G===null?w=b:G.next=N,!ji(b,r.memoizedState)&&(un=!0,ut&&(c=pu,c!==null)))throw c;r.memoizedState=b,r.baseState=w,r.baseQueue=G,h.lastRenderedState=b}return y===null&&(h.lanes=0),[r.memoizedState,h.dispatch]}function C0(r){var l=tn(),c=l.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=r;var h=c.dispatch,y=c.pending,b=l.memoizedState;if(y!==null){c.pending=null;var w=y=y.next;do b=r(b,w.action),w=w.next;while(w!==y);ji(b,l.memoizedState)||(un=!0),l.memoizedState=b,l.baseQueue===null&&(l.baseState=b),c.lastRenderedState=b}return[b,h]}function dT(r,l,c){var h=Bt,y=tn(),b=Zt;if(b){if(c===void 0)throw Error(i(407));c=c()}else c=l();var w=!ji((ve||y).memoizedState,c);if(w&&(y.memoizedState=c,un=!0),y=y.queue,O0(mT.bind(null,h,y,r),[r]),y.getSnapshot!==l||w||sn!==null&&sn.memoizedState.tag&1){if(h.flags|=2048,tu(9,{destroy:void 0},pT.bind(null,h,y,c,l),null),Ee===null)throw Error(i(349));b||_o&127||hT(h,l,c)}return c}function hT(r,l,c){r.flags|=16384,r={getSnapshot:l,value:c},l=Bt.updateQueue,l===null?(l=vp(),Bt.updateQueue=l,l.stores=[r]):(c=l.stores,c===null?l.stores=[r]:c.push(r))}function pT(r,l,c,h){l.value=c,l.getSnapshot=h,gT(l)&&yT(r)}function mT(r,l,c){return c(function(){gT(l)&&yT(r)})}function gT(r){var l=r.getSnapshot;r=r.value;try{var c=l();return!ji(r,c)}catch{return!0}}function yT(r){var l=Pl(r,2);l!==null&&Si(l,r,2)}function w0(r){var l=oi();if(typeof r=="function"){var c=r;if(r=c(),Kl){it(!0);try{c()}finally{it(!1)}}}return l.memoizedState=l.baseState=r,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:r},l}function vT(r,l,c,h){return r.baseState=c,T0(r,ve,typeof h=="function"?h:Eo)}function P4(r,l,c,h,y){if(Rp(r))throw Error(i(485));if(r=l.action,r!==null){var b={payload:y,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){b.listeners.push(w)}};Ct.T!==null?c(!0):b.isTransition=!1,h(b),c=l.pending,c===null?(b.next=l.pending=b,ST(l,b)):(b.next=c.next,l.pending=c.next=b)}}function ST(r,l){var c=l.action,h=l.payload,y=r.state;if(l.isTransition){var b=Ct.T,w={};Ct.T=w;try{var N=c(y,h),G=Ct.S;G!==null&&G(w,N),bT(r,l,N)}catch(tt){M0(r,l,tt)}finally{b!==null&&w.types!==null&&(b.types=w.types),Ct.T=b}}else try{b=c(y,h),bT(r,l,b)}catch(tt){M0(r,l,tt)}}function bT(r,l,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(h){xT(r,l,h)},function(h){return M0(r,l,h)}):xT(r,l,c)}function xT(r,l,c){l.status="fulfilled",l.value=c,ET(l),r.state=c,l=r.pending,l!==null&&(c=l.next,c===l?r.pending=null:(c=c.next,l.next=c,ST(r,c)))}function M0(r,l,c){var h=r.pending;if(r.pending=null,h!==null){h=h.next;do l.status="rejected",l.reason=c,ET(l),l=l.next;while(l!==h)}r.action=null}function ET(r){r=r.listeners;for(var l=0;l<r.length;l++)(0,r[l])()}function RT(r,l){return l}function AT(r,l){if(Zt){var c=Ee.formState;if(c!==null){t:{var h=Bt;if(Zt){if(He){var y=tB(He,ma);if(y){He=vw(y),h=eB(y);break t}}oe(h)}h=!1}h&&(l=c[0])}}c=oi(),c.memoizedState=c.baseState=l,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:RT,lastRenderedState:l},c.queue=h,c=qT.bind(null,Bt,h),h.dispatch=c,h=w0(!1);var b=I0.bind(null,Bt,!1,h.queue);return h=oi(),y={state:l,dispatch:null,action:r,pending:null},h.queue=y,c=P4.bind(null,Bt,y,b,c),y.dispatch=c,h.memoizedState=r,[l,c,!1]}function TT(r){var l=tn();return CT(l,ve,r)}function CT(r,l,c){if(l=T0(r,l,RT)[0],r=bp(Eo)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var h=gf(l)}catch(w){throw w===mu?Xp:w}else h=l;l=tn();var y=l.queue,b=y.dispatch;return c!==l.memoizedState&&(Bt.flags|=2048,tu(9,{destroy:void 0},H4.bind(null,y,c),null)),[h,b,r]}function H4(r,l){r.action=l}function wT(r){var l=tn(),c=ve;if(c!==null)return CT(l,c,r);tn(),l=l.memoizedState,c=tn();var h=c.queue.dispatch;return c.memoizedState=r,[l,h,!1]}function tu(r,l,c,h){return r={tag:r,create:c,deps:h,inst:l,next:null},l=Bt.updateQueue,l===null&&(l=vp(),Bt.updateQueue=l),c=l.lastEffect,c===null?l.lastEffect=r.next=r:(h=c.next,c.next=r,r.next=h,l.lastEffect=r),r}function MT(){return tn().memoizedState}function xp(r,l,c,h){var y=oi();Bt.flags|=r,y.memoizedState=tu(1|l,{destroy:void 0},c,h===void 0?null:h)}function Ep(r,l,c,h){var y=tn();h=h===void 0?null:h;var b=y.memoizedState.inst;ve!==null&&h!==null&&S0(h,ve.memoizedState.deps)?y.memoizedState=tu(l,b,c,h):(Bt.flags|=r,y.memoizedState=tu(1|l,b,c,h))}function OT(r,l){xp(8390656,8,r,l)}function O0(r,l){Ep(2048,8,r,l)}function U4(r){Bt.flags|=4;var l=Bt.updateQueue;if(l===null)l=vp(),Bt.updateQueue=l,l.events=[r];else{var c=l.events;c===null?l.events=[r]:c.push(r)}}function _T(r){var l=tn().memoizedState;return U4({ref:l,nextImpl:r}),function(){if(Ft&2)throw Error(i(440));return l.impl.apply(void 0,arguments)}}function zT(r,l){return Ep(4,2,r,l)}function NT(r,l){return Ep(4,4,r,l)}function IT(r,l){if(typeof l=="function"){r=r();var c=l(r);return function(){typeof c=="function"?c():l(null)}}if(l!=null)return r=r(),l.current=r,function(){l.current=null}}function DT(r,l,c){c=c!=null?c.concat([r]):null,Ep(4,4,IT.bind(null,l,r),c)}function _0(){}function LT(r,l){var c=tn();l=l===void 0?null:l;var h=c.memoizedState;return l!==null&&S0(l,h[1])?h[0]:(c.memoizedState=[r,l],r)}function BT(r,l){var c=tn();l=l===void 0?null:l;var h=c.memoizedState;if(l!==null&&S0(l,h[1]))return h[0];if(h=r(),Kl){it(!0);try{r()}finally{it(!1)}}return c.memoizedState=[h,l],h}function z0(r,l,c){return c===void 0||_o&1073741824&&!(Xt&261930)?r.memoizedState=l:(r.memoizedState=c,r=NC(),Bt.lanes|=r,Mr|=r,c)}function PT(r,l,c,h){return ji(c,l)?c:vu.current!==null?(r=z0(r,c,h),ji(r,l)||(un=!0),r):!(_o&42)||_o&1073741824&&!(Xt&261930)?(un=!0,r.memoizedState=c):(r=NC(),Bt.lanes|=r,Mr|=r,l)}function HT(r,l,c,h,y){var b=Mo();On(b!==0&&8>b?b:8);var w=Ct.T,N={};Ct.T=N,I0(r,!1,l,c);try{var G=y(),tt=Ct.S;if(tt!==null&&tt(N,G),G!==null&&typeof G=="object"&&typeof G.then=="function"){var ut=Ht(G,h);yf(r,l,ut,Pi(r))}else yf(r,l,h,Pi(r))}catch(at){yf(r,l,{then:function(){},status:"rejected",reason:at},Pi())}finally{On(b),w!==null&&N.types!==null&&(w.types=N.types),Ct.T=w}}function UT(r){var l=r.memoizedState;if(l!==null)return l;l={memoizedState:ru,baseState:ru,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:ru},next:null};var c={};return l.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:c},next:null},r.memoizedState=l,r=r.alternate,r!==null&&(r.memoizedState=l),l}function N0(){return P(Fl)}function VT(){return tn().memoizedState}function jT(){return tn().memoizedState}function V4(r){for(var l=r.return;l!==null;){switch(l.tag){case 24:case 3:var c=Pi();r=mr(c);var h=gr(l,r,c);h!==null&&(Si(h,l,c),hf(h,l,c)),l={cache:ft()},r.payload=l;return}l=l.return}}function j4(r,l,c){var h=Pi();c={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Rp(r)?FT(l,c):(c=d0(r,l,c,h),c!==null&&(Si(c,r,h),GT(c,l,h)))}function qT(r,l,c){var h=Pi();yf(r,l,c,h)}function yf(r,l,c,h){var y={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Rp(r))FT(l,y);else{var b=r.alternate;if(r.lanes===0&&(b===null||b.lanes===0)&&(b=l.lastRenderedReducer,b!==null))try{var w=l.lastRenderedState,N=b(w,c);if(y.hasEagerState=!0,y.eagerState=N,ji(N,w))return mp(r,l,y,0),Ee===null&&pp(),!1}catch{}finally{}if(c=d0(r,l,y,h),c!==null)return Si(c,r,h),GT(c,l,h),!0}return!1}function I0(r,l,c,h){if(h={lane:2,revertLane:pt(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Rp(r)){if(l)throw Error(i(479))}else l=d0(r,c,h,2),l!==null&&Si(l,r,2)}function Rp(r){var l=r.alternate;return r===Bt||l!==null&&l===Bt}function FT(r,l){Su=Jp=!0;var c=r.pending;c===null?l.next=l:(l.next=c.next,c.next=l),r.pending=l}function GT(r,l,c){if(c&4194048){var h=l.lanes;h&=r.pendingLanes,c|=h,l.lanes=c,D(r,c)}}function D0(r,l,c,h){l=r.memoizedState,c=c(h,l),c=c==null?l:uS({},l,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}function kT(r,l,c,h,y,b,w){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(h,b,w):l.prototype&&l.prototype.isPureReactComponent?!Ye(c,h)||!Ye(y,b):!0}function YT(r,l,c,h){r=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(c,h),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(c,h),l.state!==r&&DS.enqueueReplaceState(l,l.state,null)}function Hl(r,l){var c=l;if("ref"in l){c={};for(var h in l)h!=="ref"&&(c[h]=l[h])}if(r=r.defaultProps){c===l&&(c=uS({},c));for(var y in r)c[y]===void 0&&(c[y]=r[y])}return c}function Ap(r,l){try{var c=r.onUncaughtError;c(l.value,{componentStack:l.stack})}catch(h){setTimeout(function(){throw h})}}function QT(r,l,c){try{var h=r.onCaughtError;h(c.value,{componentStack:c.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function L0(r,l,c){return c=mr(c),c.tag=3,c.payload={element:null},c.callback=function(){Ap(r,l)},c}function XT(r){return r=mr(r),r.tag=3,r}function KT(r,l,c,h){var y=c.type.getDerivedStateFromError;if(typeof y=="function"){var b=h.value;r.payload=function(){return y(b)},r.callback=function(){QT(l,c,h)}}var w=c.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(r.callback=function(){QT(l,c,h),typeof y!="function"&&(Or===null?Or=new Set([this]):Or.add(this));var N=h.stack;this.componentDidCatch(h.value,{componentStack:N!==null?N:""})})}function q4(r,l,c,h,y){if(c.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(l=c.alternate,l!==null&&bn(l,c,y,!0),c=qi.current,c!==null){switch(c.tag){case 31:case 13:return ya===null?Ip():c.alternate===null&&Xe===0&&(Xe=3),c.flags&=-257,c.flags|=65536,c.lanes=y,h===Kp?c.flags|=16384:(l=c.updateQueue,l===null?c.updateQueue=new Set([h]):l.add(h),aS(r,h,y)),!1;case 22:return c.flags|=65536,h===Kp?c.flags|=16384:(l=c.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([h])},c.updateQueue=l):(c=l.retryQueue,c===null?l.retryQueue=new Set([h]):c.add(h)),aS(r,h,y)),!1}throw Error(i(435,c.tag))}return aS(r,h,y),Ip(),!1}if(Zt)return l=qi.current,l!==null?(!(l.flags&65536)&&(l.flags|=256),l.flags|=65536,l.lanes=y,h!==CS&&(r=Error(i(422),{cause:h}),Et(st(r,c)))):(h!==CS&&(l=Error(i(423),{cause:h}),Et(st(l,c))),r=r.current.alternate,r.flags|=65536,y&=-y,r.lanes|=y,h=st(h,c),y=L0(r.stateNode,h,y),m0(r,y),Xe!==4&&(Xe=2)),!1;var b=Error(i(520),{cause:h});if(b=st(b,c),Bf===null?Bf=[b]:Bf.push(b),Xe!==4&&(Xe=2),l===null)return!0;h=st(h,c),c=l;do{switch(c.tag){case 3:return c.flags|=65536,r=y&-y,c.lanes|=r,r=L0(c.stateNode,h,r),m0(c,r),!1;case 1:if(l=c.type,b=c.stateNode,(c.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(Or===null||!Or.has(b))))return c.flags|=65536,y&=-y,c.lanes|=y,y=XT(y),KT(y,r,c,h),m0(c,y),!1}c=c.return}while(c!==null);return!1}function Hn(r,l,c,h){l.child=r===null?Lw(l,null,c,h):Xl(l,r.child,c,h)}function ZT(r,l,c,h,y){c=c.render;var b=l.ref;if("ref"in h){var w={};for(var N in h)N!=="ref"&&(w[N]=h[N])}else w=h;return ai(l),h=b0(r,l,c,w,b,y),N=x0(),r!==null&&!un?(E0(r,l,y),Ro(r,l,y)):(Zt&&N&&At(l),l.flags|=1,Hn(r,l,h,y),l.child)}function JT(r,l,c,h,y){if(r===null){var b=c.type;return typeof b=="function"&&!oS(b)&&b.defaultProps===void 0&&c.compare===null?(l.tag=15,l.type=b,WT(r,l,b,h,y)):(r=Lp(c.type,null,h,l,l.mode,y),r.ref=l.ref,r.return=l,l.child=r)}if(b=r.child,!q0(r,y)){var w=b.memoizedProps;if(c=c.compare,c=c!==null?c:Ye,c(w,h)&&r.ref===l.ref)return Ro(r,l,y)}return l.flags|=1,r=Co(b,h),r.ref=l.ref,r.return=l,l.child=r}function WT(r,l,c,h,y){if(r!==null){var b=r.memoizedProps;if(Ye(b,h)&&r.ref===l.ref)if(un=!1,l.pendingProps=h=b,q0(r,y))r.flags&131072&&(un=!0);else return l.lanes=r.lanes,Ro(r,l,y)}return B0(r,l,c,h,y)}function $T(r,l,c,h){var y=h.children,b=r!==null?r.memoizedState:null;if(r===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if(l.flags&128){if(b=b!==null?b.baseLanes|c:c,r!==null){for(h=l.child=r.child,y=0;h!==null;)y=y|h.lanes|h.childLanes,h=h.sibling;h=y&~b}else h=0,l.child=null;return tC(r,l,b,c,h)}if(c&536870912)l.memoizedState={baseLanes:0,cachePool:null},r!==null&&ge(l,b!==null?b.cachePool:null),b!==null?sT(l,b):g0(),uT(l);else return h=l.lanes=536870912,tC(r,l,b!==null?b.baseLanes|c:c,c,h)}else b!==null?(ge(l,b.cachePool),sT(l,b),vr(l),l.memoizedState=null):(r!==null&&ge(l,null),g0(),vr(l));return Hn(r,l,y,c),l.child}function vf(r,l){return r!==null&&r.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function tC(r,l,c,h,y){var b=xe();return b=b===null?null:{parent:wo?Ue._currentValue:Ue._currentValue2,pool:b},l.memoizedState={baseLanes:c,cachePool:b},r!==null&&ge(l,null),g0(),uT(l),r!==null&&bn(r,l,h,!0),l.childLanes=y,null}function Tp(r,l){return l=wp({mode:l.mode,children:l.children},r.mode),l.ref=r.ref,r.child=l,l.return=r,l}function eC(r,l,c){return Xl(l,r.child,null,c),r=Tp(l,l.pendingProps),r.flags|=2,Bi(l),l.memoizedState=null,r}function F4(r,l,c){var h=l.pendingProps,y=(l.flags&128)!==0;if(l.flags&=-129,r===null){if(Zt){if(h.mode==="hidden")return r=Tp(l,h),l.lanes=536870912,vf(null,r);if(v0(l),(r=He)?(r=cB(r,ma),r!==null&&(l.memoizedState={dehydrated:r,treeContext:Rr!==null?{id:ro,overflow:lo}:null,retryLane:536870912,hydrationErrors:null},c=WC(r),c.return=l,l.child=c,Vn=l,He=null)):r=null,r===null)throw oe(l);return l.lanes=536870912,null}return Tp(l,h)}var b=r.memoizedState;if(b!==null){var w=b.dehydrated;if(v0(l),y)if(l.flags&256)l.flags&=-257,l=eC(r,l,c);else if(l.memoizedState!==null)l.child=r.child,l.flags|=128,l=null;else throw Error(i(558));else if(un||bn(r,l,c,!1),y=(c&r.childLanes)!==0,un||y){if(h=Ee,h!==null&&(w=k(h,c),w!==0&&w!==b.retryLane))throw b.retryLane=w,Pl(r,w),Si(h,r,w),LS;Ip(),l=eC(r,l,c)}else r=b.treeContext,Jn&&(He=oB(w),Vn=l,Zt=!0,Tr=null,ma=!1,r!==null&&ce(l,r)),l=Tp(l,h),l.flags|=4096;return l}return r=Co(r.child,{mode:h.mode,children:h.children}),r.ref=l.ref,l.child=r,r.return=l,r}function Cp(r,l){var c=l.ref;if(c===null)r!==null&&r.ref!==null&&(l.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(r===null||r.ref!==c)&&(l.flags|=4194816)}}function B0(r,l,c,h,y){return ai(l),c=b0(r,l,c,h,void 0,y),h=x0(),r!==null&&!un?(E0(r,l,y),Ro(r,l,y)):(Zt&&h&&At(l),l.flags|=1,Hn(r,l,c,y),l.child)}function nC(r,l,c,h,y,b){return ai(l),l.updateQueue=null,c=fT(l,h,c,y),cT(r),h=x0(),r!==null&&!un?(E0(r,l,b),Ro(r,l,b)):(Zt&&h&&At(l),l.flags|=1,Hn(r,l,c,b),l.child)}function iC(r,l,c,h,y){if(ai(l),l.stateNode===null){var b=uu,w=c.contextType;typeof w=="object"&&w!==null&&(b=P(w)),b=new c(h,b),l.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=DS,l.stateNode=b,b._reactInternals=l,b=l.stateNode,b.props=h,b.state=l.memoizedState,b.refs={},h0(l),w=c.contextType,b.context=typeof w=="object"&&w!==null?P(w):uu,b.state=l.memoizedState,w=c.getDerivedStateFromProps,typeof w=="function"&&(D0(l,c,w,h),b.state=l.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(w=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),w!==b.state&&DS.enqueueReplaceState(b,b.state,null),mf(l,h,b,y),pf(),b.state=l.memoizedState),typeof b.componentDidMount=="function"&&(l.flags|=4194308),h=!0}else if(r===null){b=l.stateNode;var N=l.memoizedProps,G=Hl(c,N);b.props=G;var tt=b.context,ut=c.contextType;w=uu,typeof ut=="object"&&ut!==null&&(w=P(ut));var at=c.getDerivedStateFromProps;ut=typeof at=="function"||typeof b.getSnapshotBeforeUpdate=="function",N=l.pendingProps!==N,ut||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(N||tt!==w)&&YT(l,b,h,w),Cr=!1;var mt=l.memoizedState;b.state=mt,mf(l,h,b,y),pf(),tt=l.memoizedState,N||mt!==tt||Cr?(typeof at=="function"&&(D0(l,c,at,h),tt=l.memoizedState),(G=Cr||kT(l,c,G,h,mt,tt,w))?(ut||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(l.flags|=4194308)):(typeof b.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=h,l.memoizedState=tt),b.props=h,b.state=tt,b.context=w,h=G):(typeof b.componentDidMount=="function"&&(l.flags|=4194308),h=!1)}else{b=l.stateNode,p0(r,l),w=l.memoizedProps,ut=Hl(c,w),b.props=ut,at=l.pendingProps,mt=b.context,tt=c.contextType,G=uu,typeof tt=="object"&&tt!==null&&(G=P(tt)),N=c.getDerivedStateFromProps,(tt=typeof N=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(w!==at||mt!==G)&&YT(l,b,h,G),Cr=!1,mt=l.memoizedState,b.state=mt,mf(l,h,b,y),pf();var Lt=l.memoizedState;w!==at||mt!==Lt||Cr||r!==null&&r.dependencies!==null&&ln(r.dependencies)?(typeof N=="function"&&(D0(l,c,N,h),Lt=l.memoizedState),(ut=Cr||kT(l,c,ut,h,mt,Lt,G)||r!==null&&r.dependencies!==null&&ln(r.dependencies))?(tt||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(h,Lt,G),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(h,Lt,G)),typeof b.componentDidUpdate=="function"&&(l.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof b.componentDidUpdate!="function"||w===r.memoizedProps&&mt===r.memoizedState||(l.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&mt===r.memoizedState||(l.flags|=1024),l.memoizedProps=h,l.memoizedState=Lt),b.props=h,b.state=Lt,b.context=G,h=ut):(typeof b.componentDidUpdate!="function"||w===r.memoizedProps&&mt===r.memoizedState||(l.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&mt===r.memoizedState||(l.flags|=1024),h=!1)}return b=h,Cp(r,l),h=(l.flags&128)!==0,b||h?(b=l.stateNode,c=h&&typeof c.getDerivedStateFromError!="function"?null:b.render(),l.flags|=1,r!==null&&h?(l.child=Xl(l,r.child,null,y),l.child=Xl(l,null,c,y)):Hn(r,l,c,y),l.memoizedState=b.state,r=l.child):r=Ro(r,l,y),r}function aC(r,l,c,h){return ue(),l.flags|=256,Hn(r,l,c,h),l.child}function P0(r){return{baseLanes:r,cachePool:ye()}}function H0(r,l,c){return r=r!==null?r.childLanes&~c:0,l&&(r|=Gi),r}function oC(r,l,c){var h=l.pendingProps,y=!1,b=(l.flags&128)!==0,w;if((w=b)||(w=r!==null&&r.memoizedState===null?!1:(en.current&2)!==0),w&&(y=!0,l.flags&=-129),w=(l.flags&32)!==0,l.flags&=-33,r===null){if(Zt){if(y?yr(l):vr(l),(r=He)?(r=fB(r,ma),r!==null&&(l.memoizedState={dehydrated:r,treeContext:Rr!==null?{id:ro,overflow:lo}:null,retryLane:536870912,hydrationErrors:null},c=WC(r),c.return=l,l.child=c,Vn=l,He=null)):r=null,r===null)throw oe(l);return SS(r)?l.lanes=32:l.lanes=536870912,null}var N=h.children;return h=h.fallback,y?(vr(l),y=l.mode,N=wp({mode:"hidden",children:N},y),h=jl(h,y,c,null),N.return=l,h.return=l,N.sibling=h,l.child=N,h=l.child,h.memoizedState=P0(c),h.childLanes=H0(r,w,c),l.memoizedState=BS,vf(null,h)):(yr(l),U0(l,N))}var G=r.memoizedState;if(G!==null&&(N=G.dehydrated,N!==null)){if(b)l.flags&256?(yr(l),l.flags&=-257,l=V0(r,l,c)):l.memoizedState!==null?(vr(l),l.child=r.child,l.flags|=128,l=null):(vr(l),N=h.fallback,y=l.mode,h=wp({mode:"visible",children:h.children},y),N=jl(N,y,c,null),N.flags|=2,h.return=l,N.return=l,h.sibling=N,l.child=h,Xl(l,r.child,null,c),h=l.child,h.memoizedState=P0(c),h.childLanes=H0(r,w,c),l.memoizedState=BS,l=vf(null,h));else if(yr(l),SS(N))w=W5(N).digest,h=Error(i(419)),h.stack="",h.digest=w,Et({value:h,source:null,stack:null}),l=V0(r,l,c);else if(un||bn(r,l,c,!1),w=(c&r.childLanes)!==0,un||w){if(w=Ee,w!==null&&(h=k(w,c),h!==0&&h!==G.retryLane))throw G.retryLane=h,Pl(r,h),Si(w,r,h),LS;vS(N)||Ip(),l=V0(r,l,c)}else vS(N)?(l.flags|=192,l.child=r.child,l=null):(r=G.treeContext,Jn&&(He=rB(N),Vn=l,Zt=!0,Tr=null,ma=!1,r!==null&&ce(l,r)),l=U0(l,h.children),l.flags|=4096);return l}return y?(vr(l),N=h.fallback,y=l.mode,G=r.child,b=G.sibling,h=Co(G,{mode:"hidden",children:h.children}),h.subtreeFlags=G.subtreeFlags&65011712,b!==null?N=Co(b,N):(N=jl(N,y,c,null),N.flags|=2),N.return=l,h.return=l,h.sibling=N,l.child=h,vf(null,h),h=l.child,N=r.child.memoizedState,N===null?N=P0(c):(y=N.cachePool,y!==null?(G=wo?Ue._currentValue:Ue._currentValue2,y=y.parent!==G?{parent:G,pool:G}:y):y=ye(),N={baseLanes:N.baseLanes|c,cachePool:y}),h.memoizedState=N,h.childLanes=H0(r,w,c),l.memoizedState=BS,vf(r.child,h)):(yr(l),c=r.child,r=c.sibling,c=Co(c,{mode:"visible",children:h.children}),c.return=l,c.sibling=null,r!==null&&(w=l.deletions,w===null?(l.deletions=[r],l.flags|=16):w.push(r)),l.child=c,l.memoizedState=null,c)}function U0(r,l){return l=wp({mode:"visible",children:l},r.mode),l.return=r,r.child=l}function wp(r,l){return r=e(22,r,null,l),r.lanes=0,r}function V0(r,l,c){return Xl(l,r.child,null,c),r=U0(l,l.pendingProps.children),r.flags|=2,l.memoizedState=null,r}function rC(r,l,c){r.lanes|=l;var h=r.alternate;h!==null&&(h.lanes|=l),Pn(r.return,l,c)}function j0(r,l,c,h,y,b){var w=r.memoizedState;w===null?r.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:h,tail:c,tailMode:y,treeForkCount:b}:(w.isBackwards=l,w.rendering=null,w.renderingStartTime=0,w.last=h,w.tail=c,w.tailMode=y,w.treeForkCount=b)}function lC(r,l,c){var h=l.pendingProps,y=h.revealOrder,b=h.tail;h=h.children;var w=en.current,N=(w&2)!==0;if(N?(w=w&1|2,l.flags|=128):w&=1,v(en,w),Hn(r,l,h,c),h=Zt?Of:0,!N&&r!==null&&r.flags&128)t:for(r=l.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&rC(r,c,l);else if(r.tag===19)rC(r,c,l);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===l)break t;for(;r.sibling===null;){if(r.return===null||r.return===l)break t;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(y){case"forwards":for(c=l.child,y=null;c!==null;)r=c.alternate,r!==null&&yp(r)===null&&(y=c),c=c.sibling;c=y,c===null?(y=l.child,l.child=null):(y=c.sibling,c.sibling=null),j0(l,!1,y,c,b,h);break;case"backwards":case"unstable_legacy-backwards":for(c=null,y=l.child,l.child=null;y!==null;){if(r=y.alternate,r!==null&&yp(r)===null){l.child=y;break}r=y.sibling,y.sibling=c,c=y,y=r}j0(l,!0,c,null,b,h);break;case"together":j0(l,!1,null,null,void 0,h);break;default:l.memoizedState=null}return l.child}function Ro(r,l,c){if(r!==null&&(l.dependencies=r.dependencies),Mr|=l.lanes,!(c&l.childLanes))if(r!==null){if(bn(r,l,c,!1),(c&l.childLanes)===0)return null}else return null;if(r!==null&&l.child!==r.child)throw Error(i(153));if(l.child!==null){for(r=l.child,c=Co(r,r.pendingProps),l.child=c,c.return=l;r.sibling!==null;)r=r.sibling,c=c.sibling=Co(r,r.pendingProps),c.return=l;c.sibling=null}return l.child}function q0(r,l){return r.lanes&l?!0:(r=r.dependencies,!!(r!==null&&ln(r)))}function G4(r,l,c){switch(l.tag){case 3:se(l,l.stateNode.containerInfo),Tt(l,Ue,r.memoizedState.cache),ue();break;case 27:case 5:me(l);break;case 4:se(l,l.stateNode.containerInfo);break;case 10:Tt(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,v0(l),null;break;case 13:var h=l.memoizedState;if(h!==null)return h.dehydrated!==null?(yr(l),l.flags|=128,null):c&l.child.childLanes?oC(r,l,c):(yr(l),r=Ro(r,l,c),r!==null?r.sibling:null);yr(l);break;case 19:var y=(r.flags&128)!==0;if(h=(c&l.childLanes)!==0,h||(bn(r,l,c,!1),h=(c&l.childLanes)!==0),y){if(h)return lC(r,l,c);l.flags|=128}if(y=l.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),v(en,en.current),h)break;return null;case 22:return l.lanes=0,$T(r,l,c,l.pendingProps);case 24:Tt(l,Ue,r.memoizedState.cache)}return Ro(r,l,c)}function sC(r,l,c){if(r!==null)if(r.memoizedProps!==l.pendingProps)un=!0;else{if(!q0(r,c)&&!(l.flags&128))return un=!1,G4(r,l,c);un=!!(r.flags&131072)}else un=!1,Zt&&l.flags&1048576&&Y(l,Of,l.index);switch(l.lanes=0,l.tag){case 16:t:{var h=l.pendingProps;if(r=vi(l.elementType),l.type=r,typeof r=="function")oS(r)?(h=Hl(r,h),l.tag=1,l=iC(null,l,r,h,c)):(l.tag=0,l=B0(null,l,r,h,c));else{if(r!=null){var y=r.$$typeof;if(y===fS){l.tag=11,l=ZT(null,l,r,h,c);break t}else if(y===pS){l.tag=14,l=JT(null,l,r,h,c);break t}}throw l=f(r)||r,Error(i(306,l,""))}}return l;case 0:return B0(r,l,l.type,l.pendingProps,c);case 1:return h=l.type,y=Hl(h,l.pendingProps),iC(r,l,h,y,c);case 3:t:{if(se(l,l.stateNode.containerInfo),r===null)throw Error(i(387));var b=l.pendingProps;y=l.memoizedState,h=y.element,p0(r,l),mf(l,b,null,c);var w=l.memoizedState;if(b=w.cache,Tt(l,Ue,b),b!==y.cache&&yi(l,[Ue],c,!0),pf(),b=w.element,Jn&&y.isDehydrated)if(y={element:b,isDehydrated:!1,cache:w.cache},l.updateQueue.baseState=y,l.memoizedState=y,l.flags&256){l=aC(r,l,b,c);break t}else if(b!==h){h=st(Error(i(424)),l),Et(h),l=aC(r,l,b,c);break t}else for(Jn&&(He=aB(l.stateNode.containerInfo),Vn=l,Zt=!0,Tr=null,ma=!0),c=Lw(l,null,b,c),l.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(ue(),b===h){l=Ro(r,l,c);break t}Hn(r,l,b,c)}l=l.child}return l;case 26:if(Ua)return Cp(r,l),r===null?(c=xw(l.type,null,l.pendingProps,null))?l.memoizedState=c:Zt||(l.stateNode=zB(l.type,l.pendingProps,Ar.current,l)):l.memoizedState=xw(l.type,r.memoizedProps,l.pendingProps,r.memoizedState),null;case 27:if(En)return me(l),r===null&&En&&Zt&&(h=l.stateNode=ww(l.type,l.pendingProps,Ar.current,Un.current,!1),Vn=l,ma=!0,He=lB(l.type,h,He)),Hn(r,l,l.pendingProps.children,c),Cp(r,l),r===null&&(l.flags|=4194304),l.child;case 5:return r===null&&Zt&&(MB(l.type,l.pendingProps,Un.current),(y=h=He)&&(h=sB(h,l.type,l.pendingProps,ma),h!==null?(l.stateNode=h,Vn=l,He=iB(h),ma=!1,y=!0):y=!1),y||oe(l)),me(l),y=l.type,b=l.pendingProps,w=r!==null?r.memoizedProps:null,h=b.children,Hp(y,b)?h=null:w!==null&&Hp(y,w)&&(l.flags|=32),l.memoizedState!==null&&(y=b0(r,l,B4,null,null,c),wo?Fl._currentValue=y:Fl._currentValue2=y),Cp(r,l),Hn(r,l,h,c),l.child;case 6:return r===null&&Zt&&(OB(l.pendingProps,Un.current),(r=c=He)&&(c=uB(c,l.pendingProps,ma),c!==null?(l.stateNode=c,Vn=l,He=null,r=!0):r=!1),r||oe(l)),null;case 13:return oC(r,l,c);case 4:return se(l,l.stateNode.containerInfo),h=l.pendingProps,r===null?l.child=Xl(l,null,h,c):Hn(r,l,h,c),l.child;case 11:return ZT(r,l,l.type,l.pendingProps,c);case 7:return Hn(r,l,l.pendingProps,c),l.child;case 8:return Hn(r,l,l.pendingProps.children,c),l.child;case 12:return Hn(r,l,l.pendingProps.children,c),l.child;case 10:return h=l.pendingProps,Tt(l,l.type,h.value),Hn(r,l,h.children,c),l.child;case 9:return y=l.type._context,h=l.pendingProps.children,ai(l),y=P(y),h=h(y),l.flags|=1,Hn(r,l,h,c),l.child;case 14:return JT(r,l,l.type,l.pendingProps,c);case 15:return WT(r,l,l.type,l.pendingProps,c);case 19:return lC(r,l,c);case 31:return F4(r,l,c);case 22:return $T(r,l,c,l.pendingProps);case 24:return ai(l),h=P(Ue),r===null?(y=xe(),y===null&&(y=Ee,b=ft(),y.pooledCache=b,b.refCount++,b!==null&&(y.pooledCacheLanes|=c),y=b),l.memoizedState={parent:h,cache:y},h0(l),Tt(l,Ue,y)):(r.lanes&c&&(p0(r,l),mf(l,null,null,c),pf()),y=r.memoizedState,b=l.memoizedState,y.parent!==h?(y={parent:h,cache:h},l.memoizedState=y,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=y),Tt(l,Ue,h)):(h=b.cache,Tt(l,Ue,h),h!==y.cache&&yi(l,[Ue],c,!0))),Hn(r,l,l.pendingProps.children,c),l.child;case 29:throw l.pendingProps}throw Error(i(156,l.tag))}function Ba(r){r.flags|=4}function Mp(r){oo&&(r.flags|=8)}function uC(r,l){if(r!==null&&r.child===l.child)return!1;if(l.flags&16)return!0;for(r=l.child;r!==null;){if(r.flags&8218||r.subtreeFlags&8218)return!0;r=r.sibling}return!1}function F0(r,l,c,h){if(Zn)for(c=l.child;c!==null;){if(c.tag===5||c.tag===6)gS(r,c.stateNode);else if(!(c.tag===4||En&&c.tag===27)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===l)break;for(;c.sibling===null;){if(c.return===null||c.return===l)return;c=c.return}c.sibling.return=c.return,c=c.sibling}else if(oo)for(var y=l.child;y!==null;){if(y.tag===5){var b=y.stateNode;c&&h&&(b=gw(b,y.type,y.memoizedProps)),gS(r,b)}else if(y.tag===6)b=y.stateNode,c&&h&&(b=yw(b,y.memoizedProps)),gS(r,b);else if(y.tag!==4){if(y.tag===22&&y.memoizedState!==null)b=y.child,b!==null&&(b.return=y),F0(r,y,!0,!0);else if(y.child!==null){y.child.return=y,y=y.child;continue}}if(y===l)break;for(;y.sibling===null;){if(y.return===null||y.return===l)return;y=y.return}y.sibling.return=y.return,y=y.sibling}}function cC(r,l,c,h){var y=!1;if(oo)for(var b=l.child;b!==null;){if(b.tag===5){var w=b.stateNode;c&&h&&(w=gw(w,b.type,b.memoizedProps)),pw(r,w)}else if(b.tag===6)w=b.stateNode,c&&h&&(w=yw(w,b.memoizedProps)),pw(r,w);else if(b.tag!==4){if(b.tag===22&&b.memoizedState!==null)y=b.child,y!==null&&(y.return=b),cC(r,b,!0,!0),y=!0;else if(b.child!==null){b.child.return=b,b=b.child;continue}}if(b===l)break;for(;b.sibling===null;){if(b.return===null||b.return===l)return y;b=b.return}b.sibling.return=b.return,b=b.sibling}return y}function fC(r,l){if(oo&&uC(r,l)){r=l.stateNode;var c=r.containerInfo,h=hw();cC(h,l,!1,!1),r.pendingChildren=h,Ba(l),J5(c,h)}}function G0(r,l,c,h){if(Zn)r.memoizedProps!==h&&Ba(l);else if(oo){var y=r.stateNode,b=r.memoizedProps;if((r=uC(r,l))||b!==h){var w=Un.current;b=Z5(y,c,b,h,!r,null),b===y?l.stateNode=y:(Mp(l),sw(b,c,h,w)&&Ba(l),l.stateNode=b,r&&F0(b,l,!1,!1))}else l.stateNode=y}}function k0(r,l,c,h,y){if(r.mode&32&&(c===null?R5(l,h):A5(l,c,h))){if(r.flags|=16777216,(y&335544128)===y||yS(l,h))if(cw(r.stateNode,l,h))r.flags|=8192;else if(PC())r.flags|=8192;else throw Ql=Kp,_S}else r.flags&=-16777217}function dC(r,l){if(IB(l)){if(r.flags|=16777216,!Cw(l))if(PC())r.flags|=8192;else throw Ql=Kp,_S}else r.flags&=-16777217}function Op(r,l){l!==null&&(r.flags|=4),r.flags&16384&&(l=r.tag!==22?A():536870912,r.lanes|=l,Ru|=l)}function Sf(r,l){if(!Zt)switch(r.tailMode){case"hidden":l=r.tail;for(var c=null;l!==null;)l.alternate!==null&&(c=l),l=l.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?l||r.tail===null?r.tail=null:r.tail.sibling=null:h.sibling=null}}function we(r){var l=r.alternate!==null&&r.alternate.child===r.child,c=0,h=0;if(l)for(var y=r.child;y!==null;)c|=y.lanes|y.childLanes,h|=y.subtreeFlags&65011712,h|=y.flags&65011712,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)c|=y.lanes|y.childLanes,h|=y.subtreeFlags,h|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=h,r.childLanes=c,l}function k4(r,l,c){var h=l.pendingProps;switch(Qt(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return we(l),null;case 1:return we(l),null;case 3:return c=l.stateNode,h=null,r!==null&&(h=r.memoizedState.cache),l.memoizedState.cache!==h&&(l.flags|=2048),Vt(Ue),ae(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(fe(l)?Ba(l):r===null||r.memoizedState.isDehydrated&&!(l.flags&256)||(l.flags|=1024,$t())),fC(r,l),we(l),null;case 26:if(Ua){var y=l.type,b=l.memoizedState;return r===null?(Ba(l),b!==null?(we(l),dC(l,b)):(we(l),k0(l,y,null,h,c))):b?b!==r.memoizedState?(Ba(l),we(l),dC(l,b)):(we(l),l.flags&=-16777217):(b=r.memoizedProps,Zn?b!==h&&Ba(l):G0(r,l,y,h),we(l),k0(l,y,b,h,c)),null}case 27:if(En){if(Ie(l),c=Ar.current,y=l.type,r!==null&&l.stateNode!=null)Zn?r.memoizedProps!==h&&Ba(l):G0(r,l,y,h);else{if(!h){if(l.stateNode===null)throw Error(i(166));return we(l),null}r=Un.current,fe(l)?da(l,r):(r=ww(y,h,c,r,!0),l.stateNode=r,Ba(l))}return we(l),null}case 5:if(Ie(l),y=l.type,r!==null&&l.stateNode!=null)G0(r,l,y,h);else{if(!h){if(l.stateNode===null)throw Error(i(166));return we(l),null}if(b=Un.current,fe(l))da(l,b),EB(l.stateNode,y,h,b)&&(l.flags|=64);else{var w=m5(y,h,Ar.current,b,l);Mp(l),F0(w,l,!1,!1),l.stateNode=w,sw(w,y,h,b)&&Ba(l)}}return we(l),k0(l,l.type,r===null?null:r.memoizedProps,l.pendingProps,c),null;case 6:if(r&&l.stateNode!=null)c=r.memoizedProps,Zn?c!==h&&Ba(l):oo&&(c!==h?(r=Ar.current,c=Un.current,Mp(l),l.stateNode=uw(h,r,c,l)):l.stateNode=r.stateNode);else{if(typeof h!="string"&&l.stateNode===null)throw Error(i(166));if(r=Ar.current,c=Un.current,fe(l)){if(!Jn)throw Error(i(176));if(r=l.stateNode,c=l.memoizedProps,h=null,y=Vn,y!==null)switch(y.tag){case 27:case 5:h=y.memoizedProps}hB(r,c,l,h)||oe(l,!0)}else Mp(l),l.stateNode=uw(h,r,c,l)}return we(l),null;case 31:if(c=l.memoizedState,r===null||r.memoizedState!==null){if(h=fe(l),c!==null){if(r===null){if(!h)throw Error(i(318));if(!Jn)throw Error(i(556));if(r=l.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));pB(r,l)}else ue(),!(l.flags&128)&&(l.memoizedState=null),l.flags|=4;we(l),r=!1}else c=$t(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return l.flags&256?(Bi(l),l):(Bi(l),null);if(l.flags&128)throw Error(i(558))}return we(l),null;case 13:if(h=l.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(y=fe(l),h!==null&&h.dehydrated!==null){if(r===null){if(!y)throw Error(i(318));if(!Jn)throw Error(i(344));if(y=l.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(i(317));mB(y,l)}else ue(),!(l.flags&128)&&(l.memoizedState=null),l.flags|=4;we(l),y=!1}else y=$t(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return l.flags&256?(Bi(l),l):(Bi(l),null)}return Bi(l),l.flags&128?(l.lanes=c,l):(c=h!==null,r=r!==null&&r.memoizedState!==null,c&&(h=l.child,y=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(y=h.alternate.memoizedState.cachePool.pool),b=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(b=h.memoizedState.cachePool.pool),b!==y&&(h.flags|=2048)),c!==r&&c&&(l.child.flags|=8192),Op(l,l.updateQueue),we(l),null);case 4:return ae(),fC(r,l),r===null&&S5(l.stateNode.containerInfo),we(l),null;case 10:return Vt(l.type),we(l),null;case 19:if(g(en),h=l.memoizedState,h===null)return we(l),null;if(y=(l.flags&128)!==0,b=h.rendering,b===null)if(y)Sf(h,!1);else{if(Xe!==0||r!==null&&r.flags&128)for(r=l.child;r!==null;){if(b=yp(r),b!==null){for(l.flags|=128,Sf(h,!1),r=b.updateQueue,l.updateQueue=r,Op(l,r),l.subtreeFlags=0,r=c,c=l.child;c!==null;)JC(c,r),c=c.sibling;return v(en,en.current&1|2),Zt&&rt(l,h.treeForkCount),l.child}r=r.sibling}h.tail!==null&&bi()>Pf&&(l.flags|=128,y=!0,Sf(h,!1),l.lanes=4194304)}else{if(!y)if(r=yp(b),r!==null){if(l.flags|=128,y=!0,r=r.updateQueue,l.updateQueue=r,Op(l,r),Sf(h,!0),h.tail===null&&h.tailMode==="hidden"&&!b.alternate&&!Zt)return we(l),null}else 2*bi()-h.renderingStartTime>Pf&&c!==536870912&&(l.flags|=128,y=!0,Sf(h,!1),l.lanes=4194304);h.isBackwards?(b.sibling=l.child,l.child=b):(r=h.last,r!==null?r.sibling=b:l.child=b,h.last=b)}return h.tail!==null?(r=h.tail,h.rendering=r,h.tail=r.sibling,h.renderingStartTime=bi(),r.sibling=null,c=en.current,v(en,y?c&1|2:c&1),Zt&&rt(l,h.treeForkCount),r):(we(l),null);case 22:case 23:return Bi(l),y0(),h=l.memoizedState!==null,r!==null?r.memoizedState!==null!==h&&(l.flags|=8192):h&&(l.flags|=8192),h?c&536870912&&!(l.flags&128)&&(we(l),l.subtreeFlags&6&&(l.flags|=8192)):we(l),c=l.updateQueue,c!==null&&Op(l,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==c&&(l.flags|=2048),r!==null&&g(Yl),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),l.memoizedState.cache!==c&&(l.flags|=2048),Vt(Ue),we(l),null;case 25:return null;case 30:return null}throw Error(i(156,l.tag))}function Y4(r,l){switch(Qt(l),l.tag){case 1:return r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 3:return Vt(Ue),ae(),r=l.flags,r&65536&&!(r&128)?(l.flags=r&-65537|128,l):null;case 26:case 27:case 5:return Ie(l),null;case 31:if(l.memoizedState!==null){if(Bi(l),l.alternate===null)throw Error(i(340));ue()}return r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 13:if(Bi(l),r=l.memoizedState,r!==null&&r.dehydrated!==null){if(l.alternate===null)throw Error(i(340));ue()}return r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 19:return g(en),null;case 4:return ae(),null;case 10:return Vt(l.type),null;case 22:case 23:return Bi(l),y0(),r!==null&&g(Yl),r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 24:return Vt(Ue),null;case 25:return null;default:return null}}function hC(r,l){switch(Qt(l),l.tag){case 3:Vt(Ue),ae();break;case 26:case 27:case 5:Ie(l);break;case 4:ae();break;case 31:l.memoizedState!==null&&Bi(l);break;case 13:Bi(l);break;case 19:g(en);break;case 10:Vt(l.type);break;case 22:case 23:Bi(l),y0(),r!==null&&g(Yl);break;case 24:Vt(Ue)}}function bf(r,l){try{var c=l.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var y=h.next;c=y;do{if((c.tag&r)===r){h=void 0;var b=c.create,w=c.inst;h=b(),w.destroy=h}c=c.next}while(c!==y)}}catch(N){te(l,l.return,N)}}function Sr(r,l,c){try{var h=l.updateQueue,y=h!==null?h.lastEffect:null;if(y!==null){var b=y.next;h=b;do{if((h.tag&r)===r){var w=h.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,y=l;var G=c,tt=N;try{tt()}catch(ut){te(y,G,ut)}}}h=h.next}while(h!==b)}}catch(ut){te(l,l.return,ut)}}function pC(r){var l=r.updateQueue;if(l!==null){var c=r.stateNode;try{lT(l,c)}catch(h){te(r,r.return,h)}}}function mC(r,l,c){c.props=Hl(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(h){te(r,l,h)}}function xf(r,l){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var h=Tf(r.stateNode);break;case 30:h=r.stateNode;break;default:h=r.stateNode}typeof c=="function"?r.refCleanup=c(h):c.current=h}}catch(y){te(r,l,y)}}function ao(r,l){var c=r.ref,h=r.refCleanup;if(c!==null)if(typeof h=="function")try{h()}catch(y){te(r,l,y)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(y){te(r,l,y)}else c.current=null}function gC(r){var l=r.type,c=r.memoizedProps,h=r.stateNode;try{U5(h,l,c,r)}catch(y){te(r,r.return,y)}}function Y0(r,l,c){try{V5(r.stateNode,r.type,c,l,r)}catch(h){te(r,r.return,h)}}function yC(r){return r.tag===5||r.tag===3||(Ua?r.tag===26:!1)||(En?r.tag===27&&lu(r.type):!1)||r.tag===4}function Q0(r){t:for(;;){for(;r.sibling===null;){if(r.return===null||yC(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(En&&r.tag===27&&lu(r.type)||r.flags&2||r.child===null||r.tag===4)continue t;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function X0(r,l,c){var h=r.tag;if(h===5||h===6)r=r.stateNode,l?q5(c,r,l):P5(c,r);else if(h!==4&&(En&&h===27&&lu(r.type)&&(c=r.stateNode,l=null),r=r.child,r!==null))for(X0(r,l,c),r=r.sibling;r!==null;)X0(r,l,c),r=r.sibling}function _p(r,l,c){var h=r.tag;if(h===5||h===6)r=r.stateNode,l?j5(c,r,l):B5(c,r);else if(h!==4&&(En&&h===27&&lu(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(_p(r,l,c),r=r.sibling;r!==null;)_p(r,l,c),r=r.sibling}function vC(r,l,c){r=r.containerInfo;try{mw(r,c)}catch(h){te(l,l.return,h)}}function SC(r){var l=r.stateNode,c=r.memoizedProps;try{LB(r.type,c,l,r)}catch(h){te(r,r.return,h)}}function Q4(r,l){for(h5(r.containerInfo),_n=l;_n!==null;)if(r=_n,l=r.child,(r.subtreeFlags&1028)!==0&&l!==null)l.return=r,_n=l;else for(;_n!==null;){r=_n;var c=r.alternate;switch(l=r.flags,r.tag){case 0:if(l&4&&(l=r.updateQueue,l=l!==null?l.events:null,l!==null))for(var h=0;h<l.length;h++){var y=l[h];y.ref.impl=y.nextImpl}break;case 11:case 15:break;case 1:if(l&1024&&c!==null){l=void 0,h=r,y=c.memoizedProps,c=c.memoizedState;var b=h.stateNode;try{var w=Hl(h.type,y);l=b.getSnapshotBeforeUpdate(w,c),b.__reactInternalSnapshotBeforeUpdate=l}catch(N){te(h,h.return,N)}}break;case 3:l&1024&&Zn&&K5(r.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(l&1024)throw Error(i(163))}if(l=r.sibling,l!==null){l.return=r.return,_n=l;break}_n=r.return}}function bC(r,l,c){var h=c.flags;switch(c.tag){case 0:case 11:case 15:Ao(r,c),h&4&&bf(5,c);break;case 1:if(Ao(r,c),h&4)if(r=c.stateNode,l===null)try{r.componentDidMount()}catch(w){te(c,c.return,w)}else{var y=Hl(c.type,l.memoizedProps);l=l.memoizedState;try{r.componentDidUpdate(y,l,r.__reactInternalSnapshotBeforeUpdate)}catch(w){te(c,c.return,w)}}h&64&&pC(c),h&512&&xf(c,c.return);break;case 3:if(Ao(r,c),h&64&&(h=c.updateQueue,h!==null)){if(r=null,c.child!==null)switch(c.child.tag){case 27:case 5:r=Tf(c.child.stateNode);break;case 1:r=c.child.stateNode}try{lT(h,r)}catch(w){te(c,c.return,w)}}break;case 27:En&&l===null&&h&4&&SC(c);case 26:case 5:if(Ao(r,c),l===null){if(h&4)gC(c);else if(h&64){r=c.type,l=c.memoizedProps,y=c.stateNode;try{vB(y,r,l,c)}catch(w){te(c,c.return,w)}}}h&512&&xf(c,c.return);break;case 12:Ao(r,c);break;case 31:Ao(r,c),h&4&&EC(r,c);break;case 13:Ao(r,c),h&4&&RC(r,c),h&64&&(h=c.memoizedState,h!==null&&(h=h.dehydrated,h!==null&&(c=t5.bind(null,c),$5(h,c))));break;case 22:if(h=c.memoizedState!==null||zo,!h){l=l!==null&&l.memoizedState!==null||cn,y=zo;var b=cn;zo=h,(cn=l)&&!b?To(r,c,(c.subtreeFlags&8772)!==0):Ao(r,c),zo=y,cn=b}break;case 30:break;default:Ao(r,c)}}function xC(r){var l=r.alternate;l!==null&&(r.alternate=null,xC(l)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(l=r.stateNode,l!==null&&E5(l)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function Pa(r,l,c){for(c=c.child;c!==null;)K0(r,l,c),c=c.sibling}function K0(r,l,c){if(Vi&&typeof Vi.onCommitFiberUnmount=="function")try{Vi.onCommitFiberUnmount(Mf,c)}catch{}switch(c.tag){case 26:if(Ua){cn||ao(c,l),Pa(r,l,c),c.memoizedState?Rw(c.memoizedState):c.stateNode&&Tw(c.stateNode);break}case 27:if(En){cn||ao(c,l);var h=fn,y=xi;lu(c.type)&&(fn=c.stateNode,xi=!1),Pa(r,l,c),Mw(c.stateNode),fn=h,xi=y;break}case 5:cn||ao(c,l);case 6:if(Zn){if(h=fn,y=xi,fn=null,Pa(r,l,c),fn=h,xi=y,fn!==null)if(xi)try{G5(fn,c.stateNode)}catch(b){te(c,l,b)}else try{F5(fn,c.stateNode)}catch(b){te(c,l,b)}}else Pa(r,l,c);break;case 18:Zn&&fn!==null&&(xi?TB(fn,c.stateNode):AB(fn,c.stateNode));break;case 4:Zn?(h=fn,y=xi,fn=c.stateNode.containerInfo,xi=!0,Pa(r,l,c),fn=h,xi=y):(oo&&vC(c.stateNode,c,hw()),Pa(r,l,c));break;case 0:case 11:case 14:case 15:Sr(2,c,l),cn||Sr(4,c,l),Pa(r,l,c);break;case 1:cn||(ao(c,l),h=c.stateNode,typeof h.componentWillUnmount=="function"&&mC(c,l,h)),Pa(r,l,c);break;case 21:Pa(r,l,c);break;case 22:cn=(h=cn)||c.memoizedState!==null,Pa(r,l,c),cn=h;break;default:Pa(r,l,c)}}function EC(r,l){if(Jn&&l.memoizedState===null&&(r=l.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{bB(r)}catch(c){te(l,l.return,c)}}}function RC(r,l){if(Jn&&l.memoizedState===null&&(r=l.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{xB(r)}catch(c){te(l,l.return,c)}}function X4(r){switch(r.tag){case 31:case 13:case 19:var l=r.stateNode;return l===null&&(l=r.stateNode=new Hw),l;case 22:return r=r.stateNode,l=r._retryCache,l===null&&(l=r._retryCache=new Hw),l;default:throw Error(i(435,r.tag))}}function zp(r,l){var c=X4(r);l.forEach(function(h){if(!c.has(h)){c.add(h);var y=e5.bind(null,r,h);h.then(y,y)}})}function Kn(r,l){var c=l.deletions;if(c!==null)for(var h=0;h<c.length;h++){var y=c[h],b=r,w=l;if(Zn){var N=w;t:for(;N!==null;){switch(N.tag){case 27:if(En){if(lu(N.type)){fn=N.stateNode,xi=!1;break t}break}case 5:fn=N.stateNode,xi=!1;break t;case 3:case 4:fn=N.stateNode.containerInfo,xi=!0;break t}N=N.return}if(fn===null)throw Error(i(160));K0(b,w,y),fn=null,xi=!1}else K0(b,w,y);b=y.alternate,b!==null&&(b.return=null),y.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)AC(l,r),l=l.sibling}function AC(r,l){var c=r.alternate,h=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Kn(l,r),ri(r),h&4&&(Sr(3,r,r.return),bf(3,r),Sr(5,r,r.return));break;case 1:Kn(l,r),ri(r),h&512&&(cn||c===null||ao(c,c.return)),h&64&&zo&&(r=r.updateQueue,r!==null&&(h=r.callbacks,h!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?h:c.concat(h))));break;case 26:if(Ua){var y=Va;if(Kn(l,r),ri(r),h&512&&(cn||c===null||ao(c,c.return)),h&4){h=c!==null?c.memoizedState:null;var b=r.memoizedState;c===null?b===null?r.stateNode===null?r.stateNode=_B(y,r.type,r.memoizedProps,r):Aw(y,r.type,r.stateNode):r.stateNode=Ew(y,b,r.memoizedProps):h!==b?(h===null?c.stateNode!==null&&Tw(c.stateNode):Rw(h),b===null?Aw(y,r.type,r.stateNode):Ew(y,b,r.memoizedProps)):b===null&&r.stateNode!==null&&Y0(r,r.memoizedProps,c.memoizedProps)}break}case 27:if(En){Kn(l,r),ri(r),h&512&&(cn||c===null||ao(c,c.return)),c!==null&&h&4&&Y0(r,r.memoizedProps,c.memoizedProps);break}case 5:if(Kn(l,r),ri(r),h&512&&(cn||c===null||ao(c,c.return)),Zn){if(r.flags&32){y=r.stateNode;try{dw(y)}catch(at){te(r,r.return,at)}}h&4&&r.stateNode!=null&&(y=r.memoizedProps,Y0(r,y,c!==null?c.memoizedProps:y)),h&1024&&(PS=!0)}else oo&&r.alternate!==null&&(r.alternate.stateNode=r.stateNode);break;case 6:if(Kn(l,r),ri(r),h&4&&Zn){if(r.stateNode===null)throw Error(i(162));h=r.memoizedProps,c=c!==null?c.memoizedProps:h,y=r.stateNode;try{H5(y,c,h)}catch(at){te(r,r.return,at)}}break;case 3:if(Ua?(NB(),y=Va,Va=bS(l.containerInfo),Kn(l,r),Va=y):Kn(l,r),ri(r),h&4){if(Zn&&Jn&&c!==null&&c.memoizedState.isDehydrated)try{SB(l.containerInfo)}catch(at){te(r,r.return,at)}if(oo){h=l.containerInfo,c=l.pendingChildren;try{mw(h,c)}catch(at){te(r,r.return,at)}}}PS&&(PS=!1,TC(r));break;case 4:Ua?(c=Va,Va=bS(r.stateNode.containerInfo),Kn(l,r),ri(r),Va=c):(Kn(l,r),ri(r)),h&4&&oo&&vC(r.stateNode,r,r.stateNode.pendingChildren);break;case 12:Kn(l,r),ri(r);break;case 31:Kn(l,r),ri(r),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,zp(r,h)));break;case 13:Kn(l,r),ri(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(am=bi()),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,zp(r,h)));break;case 22:y=r.memoizedState!==null;var w=c!==null&&c.memoizedState!==null,N=zo,G=cn;if(zo=N||y,cn=G||w,Kn(l,r),cn=G,zo=N,ri(r),h&8192&&(l=r.stateNode,l._visibility=y?l._visibility&-2:l._visibility|1,y&&(c===null||w||zo||cn||Ul(r)),Zn)){t:if(c=null,Zn)for(l=r;;){if(l.tag===5||Ua&&l.tag===26){if(c===null){w=c=l;try{b=w.stateNode,y?k5(b):Q5(w.stateNode,w.memoizedProps)}catch(at){te(w,w.return,at)}}}else if(l.tag===6){if(c===null){w=l;try{var tt=w.stateNode;y?Y5(tt):X5(tt,w.memoizedProps)}catch(at){te(w,w.return,at)}}}else if(l.tag===18){if(c===null){w=l;try{var ut=w.stateNode;y?CB(ut):wB(w.stateNode)}catch(at){te(w,w.return,at)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===r)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===r)break t;for(;l.sibling===null;){if(l.return===null||l.return===r)break t;c===l&&(c=null),l=l.return}c===l&&(c=null),l.sibling.return=l.return,l=l.sibling}}h&4&&(h=r.updateQueue,h!==null&&(c=h.retryQueue,c!==null&&(h.retryQueue=null,zp(r,c))));break;case 19:Kn(l,r),ri(r),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,zp(r,h)));break;case 30:break;case 21:break;default:Kn(l,r),ri(r)}}function ri(r){var l=r.flags;if(l&2){try{for(var c,h=r.return;h!==null;){if(yC(h)){c=h;break}h=h.return}if(Zn){if(c==null)throw Error(i(160));switch(c.tag){case 27:if(En){var y=c.stateNode,b=Q0(r);_p(r,b,y);break}case 5:var w=c.stateNode;c.flags&32&&(dw(w),c.flags&=-33);var N=Q0(r);_p(r,N,w);break;case 3:case 4:var G=c.stateNode.containerInfo,tt=Q0(r);X0(r,tt,G);break;default:throw Error(i(161))}}}catch(ut){te(r,r.return,ut)}r.flags&=-3}l&4096&&(r.flags&=-4097)}function TC(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var l=r;TC(l),l.tag===5&&l.flags&1024&&w5(l.stateNode),r=r.sibling}}function Ao(r,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)bC(r,l.alternate,l),l=l.sibling}function Ul(r){for(r=r.child;r!==null;){var l=r;switch(l.tag){case 0:case 11:case 14:case 15:Sr(4,l,l.return),Ul(l);break;case 1:ao(l,l.return);var c=l.stateNode;typeof c.componentWillUnmount=="function"&&mC(l,l.return,c),Ul(l);break;case 27:En&&Mw(l.stateNode);case 26:case 5:ao(l,l.return),Ul(l);break;case 22:l.memoizedState===null&&Ul(l);break;case 30:Ul(l);break;default:Ul(l)}r=r.sibling}}function To(r,l,c){for(c=c&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var h=l.alternate,y=r,b=l,w=b.flags;switch(b.tag){case 0:case 11:case 15:To(y,b,c),bf(4,b);break;case 1:if(To(y,b,c),h=b,y=h.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(tt){te(h,h.return,tt)}if(h=b,y=h.updateQueue,y!==null){var N=h.stateNode;try{var G=y.shared.hiddenCallbacks;if(G!==null)for(y.shared.hiddenCallbacks=null,y=0;y<G.length;y++)rT(G[y],N)}catch(tt){te(h,h.return,tt)}}c&&w&64&&pC(b),xf(b,b.return);break;case 27:En&&SC(b);case 26:case 5:To(y,b,c),c&&h===null&&w&4&&gC(b),xf(b,b.return);break;case 12:To(y,b,c);break;case 31:To(y,b,c),c&&w&4&&EC(y,b);break;case 13:To(y,b,c),c&&w&4&&RC(y,b);break;case 22:b.memoizedState===null&&To(y,b,c),xf(b,b.return);break;case 30:break;default:To(y,b,c)}l=l.sibling}}function Z0(r,l){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(r=l.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&vt(c))}function J0(r,l){r=null,l.alternate!==null&&(r=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==r&&(l.refCount++,r!=null&&vt(r))}function Ha(r,l,c,h){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)CC(r,l,c,h),l=l.sibling}function CC(r,l,c,h){var y=l.flags;switch(l.tag){case 0:case 11:case 15:Ha(r,l,c,h),y&2048&&bf(9,l);break;case 1:Ha(r,l,c,h);break;case 3:Ha(r,l,c,h),y&2048&&(r=null,l.alternate!==null&&(r=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==r&&(l.refCount++,r!=null&&vt(r)));break;case 12:if(y&2048){Ha(r,l,c,h),r=l.stateNode;try{var b=l.memoizedProps,w=b.id,N=b.onPostCommit;typeof N=="function"&&N(w,l.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(G){te(l,l.return,G)}}else Ha(r,l,c,h);break;case 31:Ha(r,l,c,h);break;case 13:Ha(r,l,c,h);break;case 23:break;case 22:b=l.stateNode,w=l.alternate,l.memoizedState!==null?b._visibility&2?Ha(r,l,c,h):Ef(r,l):b._visibility&2?Ha(r,l,c,h):(b._visibility|=2,eu(r,l,c,h,(l.subtreeFlags&10256)!==0||!1)),y&2048&&Z0(w,l);break;case 24:Ha(r,l,c,h),y&2048&&J0(l.alternate,l);break;default:Ha(r,l,c,h)}}function eu(r,l,c,h,y){for(y=y&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var b=r,w=l,N=c,G=h,tt=w.flags;switch(w.tag){case 0:case 11:case 15:eu(b,w,N,G,y),bf(8,w);break;case 23:break;case 22:var ut=w.stateNode;w.memoizedState!==null?ut._visibility&2?eu(b,w,N,G,y):Ef(b,w):(ut._visibility|=2,eu(b,w,N,G,y)),y&&tt&2048&&Z0(w.alternate,w);break;case 24:eu(b,w,N,G,y),y&&tt&2048&&J0(w.alternate,w);break;default:eu(b,w,N,G,y)}l=l.sibling}}function Ef(r,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var c=r,h=l,y=h.flags;switch(h.tag){case 22:Ef(c,h),y&2048&&Z0(h.alternate,h);break;case 24:Ef(c,h),y&2048&&J0(h.alternate,h);break;default:Ef(c,h)}l=l.sibling}}function Vl(r,l,c){if(r.subtreeFlags&xu)for(r=r.child;r!==null;)wC(r,l,c),r=r.sibling}function wC(r,l,c){switch(r.tag){case 26:if(Vl(r,l,c),r.flags&xu)if(r.memoizedState!==null)DB(c,Va,r.memoizedState,r.memoizedProps);else{var h=r.stateNode,y=r.type;r=r.memoizedProps,((l&335544128)===l||yS(y,r))&&fw(c,h,y,r)}break;case 5:Vl(r,l,c),r.flags&xu&&(h=r.stateNode,y=r.type,r=r.memoizedProps,((l&335544128)===l||yS(y,r))&&fw(c,h,y,r));break;case 3:case 4:Ua?(h=Va,Va=bS(r.stateNode.containerInfo),Vl(r,l,c),Va=h):Vl(r,l,c);break;case 22:r.memoizedState===null&&(h=r.alternate,h!==null&&h.memoizedState!==null?(h=xu,xu=16777216,Vl(r,l,c),xu=h):Vl(r,l,c));break;default:Vl(r,l,c)}}function MC(r){var l=r.alternate;if(l!==null&&(r=l.child,r!==null)){l.child=null;do l=r.sibling,r.sibling=null,r=l;while(r!==null)}}function Rf(r){var l=r.deletions;if(r.flags&16){if(l!==null)for(var c=0;c<l.length;c++){var h=l[c];_n=h,_C(h,r)}MC(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)OC(r),r=r.sibling}function OC(r){switch(r.tag){case 0:case 11:case 15:Rf(r),r.flags&2048&&Sr(9,r,r.return);break;case 3:Rf(r);break;case 12:Rf(r);break;case 22:var l=r.stateNode;r.memoizedState!==null&&l._visibility&2&&(r.return===null||r.return.tag!==13)?(l._visibility&=-3,Np(r)):Rf(r);break;default:Rf(r)}}function Np(r){var l=r.deletions;if(r.flags&16){if(l!==null)for(var c=0;c<l.length;c++){var h=l[c];_n=h,_C(h,r)}MC(r)}for(r=r.child;r!==null;){switch(l=r,l.tag){case 0:case 11:case 15:Sr(8,l,l.return),Np(l);break;case 22:c=l.stateNode,c._visibility&2&&(c._visibility&=-3,Np(l));break;default:Np(l)}r=r.sibling}}function _C(r,l){for(;_n!==null;){var c=_n;switch(c.tag){case 0:case 11:case 15:Sr(8,c,l);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var h=c.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:vt(c.memoizedState.cache)}if(h=c.child,h!==null)h.return=c,_n=h;else t:for(c=r;_n!==null;){h=_n;var y=h.sibling,b=h.return;if(xC(h),h===c){_n=null;break t}if(y!==null){y.return=b,_n=y;break t}_n=b}}}function W0(r){var l=v5(r);if(l!=null){if(typeof l.memoizedProps["data-testname"]!="string")throw Error(i(364));return l}if(r=_5(r),r===null)throw Error(i(362));return r.stateNode.current}function $0(r,l){var c=r.tag;switch(l.$$typeof){case $p:if(r.type===l.value)return!0;break;case tm:t:{for(l=l.value,r=[r,0],c=0;c<r.length;){var h=r[c++],y=h.tag,b=r[c++],w=l[b];if(y!==5&&y!==26&&y!==27||!wf(h)){for(;w!=null&&$0(h,w);)b++,w=l[b];if(b===l.length){l=!0;break t}else for(h=h.child;h!==null;)r.push(h,b),h=h.sibling}}l=!1}return l;case em:if((c===5||c===26||c===27)&&I5(r.stateNode,l.value))return!0;break;case im:if((c===5||c===6||c===26||c===27)&&(r=N5(r),r!==null&&0<=r.indexOf(l.value)))return!0;break;case nm:if((c===5||c===26||c===27)&&(r=r.memoizedProps["data-testname"],typeof r=="string"&&r.toLowerCase()===l.value.toLowerCase()))return!0;break;default:throw Error(i(365))}return!1}function tS(r){switch(r.$$typeof){case $p:return"<"+(f(r.value)||"Unknown")+">";case tm:return":has("+(tS(r)||"")+")";case em:return'[role="'+r.value+'"]';case im:return'"'+r.value+'"';case nm:return'[data-testname="'+r.value+'"]';default:throw Error(i(365))}}function zC(r,l){var c=[];r=[r,0];for(var h=0;h<r.length;){var y=r[h++],b=y.tag,w=r[h++],N=l[w];if(b!==5&&b!==26&&b!==27||!wf(y)){for(;N!=null&&$0(y,N);)w++,N=l[w];if(w===l.length)c.push(y);else for(y=y.child;y!==null;)r.push(y,w),y=y.sibling}}return c}function eS(r,l){if(!Cf)throw Error(i(363));r=W0(r),r=zC(r,l),l=[],r=Array.from(r);for(var c=0;c<r.length;){var h=r[c++],y=h.tag;if(y===5||y===26||y===27)wf(h)||l.push(h.stateNode);else for(h=h.child;h!==null;)r.push(h),h=h.sibling}return l}function Pi(){return Ft&2&&Xt!==0?Xt&-Xt:Ct.T!==null?pt():b5()}function NC(){if(Gi===0)if(!(Xt&536870912)||Zt){var r=Vp;Vp<<=1,!(Vp&3932160)&&(Vp=262144),Gi=r}else Gi=536870912;return r=qi.current,r!==null&&(r.flags|=32),Gi}function Si(r,l,c){(r===Ee&&(de===2||de===9)||r.cancelPendingCommit!==null)&&(nu(r,0),br(r,Xt,Gi,!1)),M(r,c),(!(Ft&2)||r!==Ee)&&(r===Ee&&(!(Ft&2)&&(Zl|=c),Xe===4&&br(r,Xt,Gi,!1)),L(r))}function IC(r,l,c){if(Ft&6)throw Error(i(327));var h=!c&&(l&127)===0&&(l&r.expiredLanes)===0||E(r,l),y=h?J4(r,l):iS(r,l,!0),b=h;do{if(y===0){Eu&&!h&&br(r,l,0,!1);break}else{if(c=r.current.alternate,b&&!K4(c)){y=iS(r,l,!1),b=!1;continue}if(y===2){if(b=l,r.errorRecoveryDisabledLanes&b)var w=0;else w=r.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){l=w;t:{var N=r;y=Bf;var G=Jn&&N.current.memoizedState.isDehydrated;if(G&&(nu(N,w).flags|=256),w=iS(N,w,!1),w!==2){if(HS&&!G){N.errorRecoveryDisabledLanes|=b,Zl|=b,y=4;break t}b=Ei,Ei=y,b!==null&&(Ei===null?Ei=b:Ei.push.apply(Ei,b))}y=w}if(b=!1,y!==2)continue}}if(y===1){nu(r,0),br(r,l,0,!0);break}t:{switch(h=r,b=y,b){case 0:case 1:throw Error(i(345));case 4:if((l&4194048)!==l)break;case 6:br(h,l,Gi,!wr);break t;case 2:Ei=null;break;case 3:case 5:break;default:throw Error(i(329))}if((l&62914560)===l&&(y=am+300-bi(),10<y)){if(br(h,l,Gi,!wr),T(h,0,!0)!==0)break t;Io=l,h.timeoutHandle=g5(DC.bind(null,h,c,Ei,om,VS,l,Gi,Zl,Ru,wr,b,"Throttled",-0,0),y);break t}DC(h,c,Ei,om,VS,l,Gi,Zl,Ru,wr,b,null,-0,0)}}break}while(!0);L(r)}function DC(r,l,c,h,y,b,w,N,G,tt,ut,at,mt,Lt){if(r.timeoutHandle=ql,at=l.subtreeFlags,at&8192||(at&16785408)===16785408){at=T5(),wC(l,b,at);var jn=(b&62914560)===b?am-bi():(b&4194048)===b?Uw-bi():0;if(jn=C5(at,jn),jn!==null){Io=b,r.cancelPendingCommit=jn(FC.bind(null,r,l,b,c,h,y,w,N,G,ut,at,null,mt,Lt)),br(r,b,w,!tt);return}}FC(r,l,b,c,h,y,w,N,G)}function K4(r){for(var l=r;;){var c=l.tag;if((c===0||c===11||c===15)&&l.flags&16384&&(c=l.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var h=0;h<c.length;h++){var y=c[h],b=y.getSnapshot;y=y.value;try{if(!ji(b(),y))return!1}catch{return!1}}if(c=l.child,l.subtreeFlags&16384&&c!==null)c.return=l,l=c;else{if(l===r)break;for(;l.sibling===null;){if(l.return===null||l.return===r)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function br(r,l,c,h){l&=~US,l&=~Zl,r.suspendedLanes|=l,r.pingedLanes&=~l,h&&(r.warmLanes|=l),h=r.expirationTimes;for(var y=l;0<y;){var b=31-Ui(y),w=1<<b;h[b]=-1,y&=~w}c!==0&&z(r,c,l)}function LC(){return Ft&6?!0:(W(0,!1),!1)}function nS(){if(Gt!==null){if(de===0)var r=Gt.return;else r=Gt,Oo=Gl=null,R0(r),gu=null,Nf=0,r=Gt;for(;r!==null;)hC(r.alternate,r),r=r.return;Gt=null}}function nu(r,l){var c=r.timeoutHandle;c!==ql&&(r.timeoutHandle=ql,y5(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),Io=0,nS(),Ee=r,Gt=c=Co(r.current,null),Xt=l,de=0,Fi=null,wr=!1,Eu=E(r,l),HS=!1,Ru=Gi=US=Zl=Mr=Xe=0,Ei=Bf=null,VS=!1,l&8&&(l|=l&32);var h=r.entangledLanes;if(h!==0)for(r=r.entanglements,h&=l;0<h;){var y=31-Ui(h),b=1<<y;l|=r[y],h&=~b}return No=l,pp(),c}function BC(r,l){Bt=null,Ct.H=Df,l===mu||l===Xp?(l=io(),de=3):l===_S?(l=io(),de=4):de=l===LS?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Fi=l,Gt===null&&(Xe=1,Ap(r,st(l,r.current)))}function PC(){var r=qi.current;return r===null?!0:(Xt&4194048)===Xt?ya===null:(Xt&62914560)===Xt||Xt&536870912?r===ya:!1}function HC(){var r=Ct.H;return Ct.H=Df,r===null?Df:r}function UC(){var r=Ct.A;return Ct.A=KB,r}function Ip(){Xe=4,wr||(Xt&4194048)!==Xt&&qi.current!==null||(Eu=!0),!(Mr&134217727)&&!(Zl&134217727)||Ee===null||br(Ee,Xt,Gi,!1)}function iS(r,l,c){var h=Ft;Ft|=2;var y=HC(),b=UC();(Ee!==r||Xt!==l)&&(om=null,nu(r,l)),l=!1;var w=Xe;t:do try{if(de!==0&&Gt!==null){var N=Gt,G=Fi;switch(de){case 8:nS(),w=6;break t;case 3:case 2:case 9:case 6:qi.current===null&&(l=!0);var tt=de;if(de=0,Fi=null,iu(r,N,G,tt),c&&Eu){w=0;break t}break;default:tt=de,de=0,Fi=null,iu(r,N,G,tt)}}Z4(),w=Xe;break}catch(ut){BC(r,ut)}while(!0);return l&&r.shellSuspendCounter++,Oo=Gl=null,Ft=h,Ct.H=y,Ct.A=b,Gt===null&&(Ee=null,Xt=0,pp()),w}function Z4(){for(;Gt!==null;)VC(Gt)}function J4(r,l){var c=Ft;Ft|=2;var h=HC(),y=UC();Ee!==r||Xt!==l?(om=null,Pf=bi()+500,nu(r,l)):Eu=E(r,l);t:do try{if(de!==0&&Gt!==null){l=Gt;var b=Fi;e:switch(de){case 1:de=0,Fi=null,iu(r,l,b,1);break;case 2:case 9:if(Pe(b)){de=0,Fi=null,jC(l);break}l=function(){de!==2&&de!==9||Ee!==r||(de=7),L(r)},b.then(l,l);break t;case 3:de=7;break t;case 4:de=5;break t;case 7:Pe(b)?(de=0,Fi=null,jC(l)):(de=0,Fi=null,iu(r,l,b,7));break;case 5:var w=null;switch(Gt.tag){case 26:w=Gt.memoizedState;case 5:case 27:var N=Gt,G=N.type,tt=N.pendingProps;if(w?Cw(w):cw(N.stateNode,G,tt)){de=0,Fi=null;var ut=N.sibling;if(ut!==null)Gt=ut;else{var at=N.return;at!==null?(Gt=at,Dp(at)):Gt=null}break e}}de=0,Fi=null,iu(r,l,b,5);break;case 6:de=0,Fi=null,iu(r,l,b,6);break;case 8:nS(),Xe=6;break t;default:throw Error(i(462))}}W4();break}catch(mt){BC(r,mt)}while(!0);return Oo=Gl=null,Ct.H=h,Ct.A=y,Ft=c,Gt!==null?0:(Ee=null,Xt=0,pp(),Xe)}function W4(){for(;Gt!==null&&!HB();)VC(Gt)}function VC(r){var l=sC(r.alternate,r,No);r.memoizedProps=r.pendingProps,l===null?Dp(r):Gt=l}function jC(r){var l=r,c=l.alternate;switch(l.tag){case 15:case 0:l=nC(c,l,l.pendingProps,l.type,void 0,Xt);break;case 11:l=nC(c,l,l.pendingProps,l.type.render,l.ref,Xt);break;case 5:R0(l);default:hC(c,l),l=Gt=JC(l,No),l=sC(c,l,No)}r.memoizedProps=r.pendingProps,l===null?Dp(r):Gt=l}function iu(r,l,c,h){Oo=Gl=null,R0(l),gu=null,Nf=0;var y=l.return;try{if(q4(r,y,l,c,Xt)){Xe=1,Ap(r,st(c,r.current)),Gt=null;return}}catch(b){if(y!==null)throw Gt=y,b;Xe=1,Ap(r,st(c,r.current)),Gt=null;return}l.flags&32768?(Zt||h===1?r=!0:Eu||Xt&536870912?r=!1:(wr=r=!0,(h===2||h===9||h===3||h===6)&&(h=qi.current,h!==null&&h.tag===13&&(h.flags|=16384))),qC(l,r)):Dp(l)}function Dp(r){var l=r;do{if(l.flags&32768){qC(l,wr);return}r=l.return;var c=k4(l.alternate,l,No);if(c!==null){Gt=c;return}if(l=l.sibling,l!==null){Gt=l;return}Gt=l=r}while(l!==null);Xe===0&&(Xe=5)}function qC(r,l){do{var c=Y4(r.alternate,r);if(c!==null){c.flags&=32767,Gt=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!l&&(r=r.sibling,r!==null)){Gt=r;return}Gt=r=c}while(r!==null);Xe=6,Gt=null}function FC(r,l,c,h,y,b,w,N,G){r.cancelPendingCommit=null;do Af();while(Rn!==0);if(Ft&6)throw Error(i(327));if(l!==null){if(l===r.current)throw Error(i(177));if(b=l.lanes|l.childLanes,b|=zS,I(r,c,b,w,N,G),r===Ee&&(Gt=Ee=null,Xt=0),Au=l,_r=r,Io=c,jS=b,qS=y,Vw=h,l.subtreeFlags&10256||l.flags&10256?(r.callbackNode=null,r.callbackPriority=0,n5(RS,function(){return XC(),null})):(r.callbackNode=null,r.callbackPriority=0),h=(l.flags&13878)!==0,l.subtreeFlags&13878||h){h=Ct.T,Ct.T=null,y=Mo(),On(2),w=Ft,Ft|=4;try{Q4(r,l,c)}finally{Ft=w,On(y),Ct.T=h}}Rn=1,GC(),kC(),YC()}}function GC(){if(Rn===1){Rn=0;var r=_r,l=Au,c=(l.flags&13878)!==0;if(l.subtreeFlags&13878||c){c=Ct.T,Ct.T=null;var h=Mo();On(2);var y=Ft;Ft|=4;try{AC(l,r),p5(r.containerInfo)}finally{Ft=y,On(h),Ct.T=c}}r.current=l,Rn=2}}function kC(){if(Rn===2){Rn=0;var r=_r,l=Au,c=(l.flags&8772)!==0;if(l.subtreeFlags&8772||c){c=Ct.T,Ct.T=null;var h=Mo();On(2);var y=Ft;Ft|=4;try{bC(r,l.alternate,l)}finally{Ft=y,On(h),Ct.T=c}}Rn=3}}function YC(){if(Rn===4||Rn===3){Rn=0,UB();var r=_r,l=Au,c=Io,h=Vw;l.subtreeFlags&10256||l.flags&10256?Rn=5:(Rn=0,Au=_r=null,QC(r,r.pendingLanes));var y=r.pendingLanes;if(y===0&&(Or=null),Q(c),l=l.stateNode,Vi&&typeof Vi.onCommitFiberRoot=="function")try{Vi.onCommitFiberRoot(Mf,l,void 0,(l.current.flags&128)===128)}catch{}if(h!==null){l=Ct.T,y=Mo(),On(2),Ct.T=null;try{for(var b=r.onRecoverableError,w=0;w<h.length;w++){var N=h[w];b(N.value,{componentStack:N.stack})}}finally{Ct.T=l,On(y)}}Io&3&&Af(),L(r),y=r.pendingLanes,c&261930&&y&42?r===FS?Hf++:(Hf=0,FS=r):Hf=0,Jn&&RB(),W(0,!1)}}function QC(r,l){(r.pooledCacheLanes&=l)===0&&(l=r.pooledCache,l!=null&&(r.pooledCache=null,vt(l)))}function Af(){return GC(),kC(),YC(),XC()}function XC(){if(Rn!==5)return!1;var r=_r,l=jS;jS=0;var c=Q(Io),h=32>c?32:c;c=Ct.T;var y=Mo();try{On(h),Ct.T=null,h=qS,qS=null;var b=_r,w=Io;if(Rn=0,Au=_r=null,Io=0,Ft&6)throw Error(i(331));var N=Ft;if(Ft|=4,OC(b.current),CC(b,b.current,w,h),Ft=N,W(0,!1),Vi&&typeof Vi.onPostCommitFiberRoot=="function")try{Vi.onPostCommitFiberRoot(Mf,b)}catch{}return!0}finally{On(y),Ct.T=c,QC(r,l)}}function KC(r,l,c){l=st(c,l),l=L0(r.stateNode,l,2),r=gr(r,l,2),r!==null&&(M(r,2),L(r))}function te(r,l,c){if(r.tag===3)KC(r,r,c);else for(;l!==null;){if(l.tag===3){KC(l,r,c);break}else if(l.tag===1){var h=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Or===null||!Or.has(h))){r=st(c,r),c=XT(2),h=gr(l,c,2),h!==null&&(KT(c,h,l,r),M(h,2),L(h));break}}l=l.return}}function aS(r,l,c){var h=r.pingCache;if(h===null){h=r.pingCache=new ZB;var y=new Set;h.set(l,y)}else y=h.get(l),y===void 0&&(y=new Set,h.set(l,y));y.has(c)||(HS=!0,y.add(c),r=$4.bind(null,r,l,c),l.then(r,r))}function $4(r,l,c){var h=r.pingCache;h!==null&&h.delete(l),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,Ee===r&&(Xt&c)===c&&(Xe===4||Xe===3&&(Xt&62914560)===Xt&&300>bi()-am?!(Ft&2)&&nu(r,0):US|=c,Ru===Xt&&(Ru=0)),L(r)}function ZC(r,l){l===0&&(l=A()),r=Pl(r,l),r!==null&&(M(r,l),L(r))}function t5(r){var l=r.memoizedState,c=0;l!==null&&(c=l.retryLane),ZC(r,c)}function e5(r,l){var c=0;switch(r.tag){case 31:case 13:var h=r.stateNode,y=r.memoizedState;y!==null&&(c=y.retryLane);break;case 19:h=r.stateNode;break;case 22:h=r.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(l),ZC(r,c)}function n5(r,l){return qp(r,l)}function i5(r,l,c,h){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function oS(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Co(r,l){var c=r.alternate;return c===null?(c=e(r.tag,l,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=l,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&65011712,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,l=r.dependencies,c.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function JC(r,l){r.flags&=65011714;var c=r.alternate;return c===null?(r.childLanes=0,r.lanes=l,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,l=c.dependencies,r.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),r}function Lp(r,l,c,h,y,b){var w=0;if(h=r,typeof r=="function")oS(r)&&(w=1);else if(typeof r=="string")w=Ua&&En?bw(r,c,Un.current)?26:Ow(r)?27:5:Ua?bw(r,c,Un.current)?26:5:En&&Ow(r)?27:5;else t:switch(r){case mS:return r=e(31,c,l,y),r.elementType=mS,r.lanes=b,r;case ou:return jl(c.children,y,b,l);case aw:w=8,y|=24;break;case cS:return r=e(12,c,l,y|2),r.elementType=cS,r.lanes=b,r;case dS:return r=e(13,c,l,y),r.elementType=dS,r.lanes=b,r;case hS:return r=e(19,c,l,y),r.elementType=hS,r.lanes=b,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case xr:w=10;break t;case ow:w=9;break t;case fS:w=11;break t;case pS:w=14;break t;case Er:w=16,h=null;break t}w=29,c=Error(i(130,r===null?"null":typeof r,"")),h=null}return l=e(w,c,l,y),l.elementType=r,l.type=h,l.lanes=b,l}function jl(r,l,c,h){return r=e(7,r,h,l),r.lanes=c,r}function rS(r,l,c){return r=e(6,r,null,l),r.lanes=c,r}function WC(r){var l=e(18,null,null,0);return l.stateNode=r,l}function lS(r,l,c){return l=e(4,r.children!==null?r.children:[],r.key,l),l.lanes=c,l.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},l}function a5(r,l,c,h,y,b,w,N,G){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ql,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=C(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=C(0),this.hiddenUpdates=C(null),this.identifierPrefix=h,this.onUncaughtError=y,this.onCaughtError=b,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=G,this.incompleteTransitions=new Map}function $C(r,l,c,h,y,b,w,N,G,tt,ut,at){return r=new a5(r,l,c,w,G,tt,ut,at,N),l=1,b===!0&&(l|=24),b=e(3,null,null,l),r.current=b,b.stateNode=r,l=ft(),l.refCount++,r.pooledCache=l,l.refCount++,b.memoizedState={element:h,isDehydrated:c,cache:l},h0(b),r}function tw(r){return r?(r=uu,r):uu}function ew(r){var l=r._reactInternals;if(l===void 0)throw typeof r.render=="function"?Error(i(188)):(r=Object.keys(r).join(","),Error(i(268,r)));return r=s(l),r=r!==null?u(r):null,r===null?null:Tf(r.stateNode)}function nw(r,l,c,h,y,b){y=tw(y),h.context===null?h.context=y:h.pendingContext=y,h=mr(l),h.payload={element:c},b=b===void 0?null:b,b!==null&&(h.callback=b),c=gr(r,h,l),c!==null&&(Si(c,r,l),hf(c,r,l))}function iw(r,l){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<l?c:l}}function sS(r,l){iw(r,l),(r=r.alternate)&&iw(r,l)}var qt={},o5=X(),Hi=Mb(),uS=Object.assign,r5=Symbol.for("react.element"),Bp=Symbol.for("react.transitional.element"),au=Symbol.for("react.portal"),ou=Symbol.for("react.fragment"),aw=Symbol.for("react.strict_mode"),cS=Symbol.for("react.profiler"),ow=Symbol.for("react.consumer"),xr=Symbol.for("react.context"),fS=Symbol.for("react.forward_ref"),dS=Symbol.for("react.suspense"),hS=Symbol.for("react.suspense_list"),pS=Symbol.for("react.memo"),Er=Symbol.for("react.lazy");Symbol.for("react.scope");var mS=Symbol.for("react.activity");Symbol.for("react.legacy_hidden"),Symbol.for("react.tracing_marker");var l5=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var rw=Symbol.iterator,s5=Symbol.for("react.client.reference"),Pp=Array.isArray,Ct=o5.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,u5=t.rendererVersion,c5=t.rendererPackageName,lw=t.extraDevToolsConfig,Tf=t.getPublicInstance,f5=t.getRootHostContext,d5=t.getChildHostContext,h5=t.prepareForCommit,p5=t.resetAfterCommit,m5=t.createInstance;t.cloneMutableInstance;var gS=t.appendInitialChild,sw=t.finalizeInitialChildren,Hp=t.shouldSetTextContent,uw=t.createTextInstance;t.cloneMutableTextInstance;var g5=t.scheduleTimeout,y5=t.cancelTimeout,ql=t.noTimeout,wo=t.isPrimaryRenderer;t.warnsIfNotActing;var Zn=t.supportsMutation,oo=t.supportsPersistence,Jn=t.supportsHydration,v5=t.getInstanceFromNode;t.beforeActiveInstanceBlur;var S5=t.preparePortalMount;t.prepareScopeUpdate,t.getInstanceFromScope;var On=t.setCurrentUpdatePriority,Mo=t.getCurrentUpdatePriority,b5=t.resolveUpdatePriority;t.trackSchedulerEvent,t.resolveEventType,t.resolveEventTimeStamp;var x5=t.shouldAttemptEagerTransition,E5=t.detachDeletedInstance;t.requestPostPaintCallback;var R5=t.maySuspendCommit,A5=t.maySuspendCommitOnUpdate,yS=t.maySuspendCommitInSyncRender,cw=t.preloadInstance,T5=t.startSuspendingCommit,fw=t.suspendInstance;t.suspendOnActiveViewTransition;var C5=t.waitForCommitToBeReady;t.getSuspendedCommitReason;var ru=t.NotPendingTransition,Fl=t.HostTransitionContext,w5=t.resetFormInstance;t.bindToConsole;var M5=t.supportsMicrotasks,O5=t.scheduleMicrotask,Cf=t.supportsTestSelectors,_5=t.findFiberRoot,z5=t.getBoundingRect,N5=t.getTextContent,wf=t.isHiddenSubtree,I5=t.matchAccessibilityRole,D5=t.setFocusIfFocusable,L5=t.setupIntersectionObserver,B5=t.appendChild,P5=t.appendChildToContainer,H5=t.commitTextUpdate,U5=t.commitMount,V5=t.commitUpdate,j5=t.insertBefore,q5=t.insertInContainerBefore,F5=t.removeChild,G5=t.removeChildFromContainer,dw=t.resetTextContent,k5=t.hideInstance,Y5=t.hideTextInstance,Q5=t.unhideInstance,X5=t.unhideTextInstance;t.cancelViewTransitionName,t.cancelRootViewTransitionName,t.restoreRootViewTransitionName,t.cloneRootViewTransitionContainer,t.removeRootViewTransitionClone,t.measureClonedInstance,t.hasInstanceChanged,t.hasInstanceAffectedParent,t.startViewTransition,t.startGestureTransition,t.stopViewTransition,t.getCurrentGestureOffset,t.createViewTransitionInstance;var K5=t.clearContainer;t.createFragmentInstance,t.updateFragmentInstanceFiber,t.commitNewChildToFragmentInstance,t.deleteChildFromFragmentInstance;var Z5=t.cloneInstance,hw=t.createContainerChildSet,pw=t.appendChildToContainerChildSet,J5=t.finalizeContainerChildren,mw=t.replaceContainerChildren,gw=t.cloneHiddenInstance,yw=t.cloneHiddenTextInstance,vS=t.isSuspenseInstancePending,SS=t.isSuspenseInstanceFallback,W5=t.getSuspenseInstanceFallbackErrorDetails,$5=t.registerSuspenseInstanceRetry,tB=t.canHydrateFormStateMarker,eB=t.isFormStateMarkerMatching,vw=t.getNextHydratableSibling,nB=t.getNextHydratableSiblingAfterSingleton,iB=t.getFirstHydratableChild,aB=t.getFirstHydratableChildWithinContainer,oB=t.getFirstHydratableChildWithinActivityInstance,rB=t.getFirstHydratableChildWithinSuspenseInstance,lB=t.getFirstHydratableChildWithinSingleton,sB=t.canHydrateInstance,uB=t.canHydrateTextInstance,cB=t.canHydrateActivityInstance,fB=t.canHydrateSuspenseInstance,dB=t.hydrateInstance,hB=t.hydrateTextInstance,pB=t.hydrateActivityInstance,mB=t.hydrateSuspenseInstance,gB=t.getNextHydratableInstanceAfterActivityInstance,yB=t.getNextHydratableInstanceAfterSuspenseInstance,vB=t.commitHydratedInstance,SB=t.commitHydratedContainer,bB=t.commitHydratedActivityInstance,xB=t.commitHydratedSuspenseInstance,EB=t.finalizeHydratedChildren,RB=t.flushHydrationEvents;t.clearActivityBoundary;var AB=t.clearSuspenseBoundary;t.clearActivityBoundaryFromContainer;var TB=t.clearSuspenseBoundaryFromContainer,CB=t.hideDehydratedBoundary,wB=t.unhideDehydratedBoundary,Sw=t.shouldDeleteUnhydratedTailInstances;t.diffHydratedPropsForDevWarnings,t.diffHydratedTextForDevWarnings,t.describeHydratableInstanceForDevWarnings;var MB=t.validateHydratableInstance,OB=t.validateHydratableTextInstance,Ua=t.supportsResources,bw=t.isHostHoistableType,bS=t.getHoistableRoot,xw=t.getResource,Ew=t.acquireResource,Rw=t.releaseResource,_B=t.hydrateHoistable,Aw=t.mountHoistable,Tw=t.unmountHoistable,zB=t.createHoistableInstance,NB=t.prepareToCommitHoistables,IB=t.mayResourceSuspendCommit,Cw=t.preloadResource,DB=t.suspendResource,En=t.supportsSingletons,ww=t.resolveSingletonInstance,LB=t.acquireSingletonInstance,Mw=t.releaseSingletonInstance,Ow=t.isHostSingletonType,lu=t.isSingletonScope,xS=[],su=-1,uu={},Ui=Math.clz32?Math.clz32:S,BB=Math.log,PB=Math.LN2,Up=256,Vp=262144,jp=4194304,qp=Hi.unstable_scheduleCallback,ES=Hi.unstable_cancelCallback,HB=Hi.unstable_shouldYield,UB=Hi.unstable_requestPaint,bi=Hi.unstable_now,_w=Hi.unstable_ImmediatePriority,VB=Hi.unstable_UserBlockingPriority,RS=Hi.unstable_NormalPriority,jB=Hi.unstable_IdlePriority,qB=Hi.log,FB=Hi.unstable_setDisableYieldValue,Mf=null,Vi=null,ji=typeof Object.is=="function"?Object.is:lt,zw=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},GB=Object.prototype.hasOwnProperty,AS,Nw,TS=!1,Iw=new WeakMap,cu=[],fu=0,Fp=null,Of=0,ha=[],pa=0,Rr=null,ro=1,lo="",Un=m(null),_f=m(null),Ar=m(null),Gp=m(null),Vn=null,He=null,Zt=!1,Tr=null,ma=!1,CS=Error(i(519)),kp=m(null),Gl=null,Oo=null,kB=typeof AbortController<"u"?AbortController:function(){var r=[],l=this.signal={aborted:!1,addEventListener:function(c,h){r.push(h)}};this.abort=function(){l.aborted=!0,r.forEach(function(c){return c()})}},YB=Hi.unstable_scheduleCallback,QB=Hi.unstable_NormalPriority,Ue={$$typeof:xr,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},Yp=null,du=null,wS=!1,Qp=!1,MS=!1,kl=0,zf=null,OS=0,hu=0,pu=null,Dw=Ct.S;Ct.S=function(r,l){Uw=bi(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&yt(r,l),Dw!==null&&Dw(r,l)};var Yl=m(null),mu=Error(i(460)),_S=Error(i(474)),Xp=Error(i(542)),Kp={then:function(){}},Ql=null,gu=null,Nf=0,Xl=aT(!0),Lw=aT(!1),ga=[],yu=0,zS=0,Cr=!1,NS=!1,vu=m(null),Zp=m(0),qi=m(null),ya=null,en=m(0),_o=0,Bt=null,ve=null,sn=null,Jp=!1,Su=!1,Kl=!1,Wp=0,If=0,bu=null,XB=0,Df={readContext:P,use:Sp,useCallback:Qe,useContext:Qe,useEffect:Qe,useImperativeHandle:Qe,useLayoutEffect:Qe,useInsertionEffect:Qe,useMemo:Qe,useReducer:Qe,useRef:Qe,useState:Qe,useDebugValue:Qe,useDeferredValue:Qe,useTransition:Qe,useSyncExternalStore:Qe,useId:Qe,useHostTransitionStatus:Qe,useFormState:Qe,useActionState:Qe,useOptimistic:Qe,useMemoCache:Qe,useCacheRefresh:Qe};Df.useEffectEvent=Qe;var Bw={readContext:P,use:Sp,useCallback:function(r,l){return oi().memoizedState=[r,l===void 0?null:l],r},useContext:P,useEffect:OT,useImperativeHandle:function(r,l,c){c=c!=null?c.concat([r]):null,xp(4194308,4,IT.bind(null,l,r),c)},useLayoutEffect:function(r,l){return xp(4194308,4,r,l)},useInsertionEffect:function(r,l){xp(4,2,r,l)},useMemo:function(r,l){var c=oi();l=l===void 0?null:l;var h=r();if(Kl){it(!0);try{r()}finally{it(!1)}}return c.memoizedState=[h,l],h},useReducer:function(r,l,c){var h=oi();if(c!==void 0){var y=c(l);if(Kl){it(!0);try{c(l)}finally{it(!1)}}}else y=l;return h.memoizedState=h.baseState=y,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:y},h.queue=r,r=r.dispatch=j4.bind(null,Bt,r),[h.memoizedState,r]},useRef:function(r){var l=oi();return r={current:r},l.memoizedState=r},useState:function(r){r=w0(r);var l=r.queue,c=qT.bind(null,Bt,l);return l.dispatch=c,[r.memoizedState,c]},useDebugValue:_0,useDeferredValue:function(r,l){var c=oi();return z0(c,r,l)},useTransition:function(){var r=w0(!1);return r=HT.bind(null,Bt,r.queue,!0,!1),oi().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,l,c){var h=Bt,y=oi();if(Zt){if(c===void 0)throw Error(i(407));c=c()}else{if(c=l(),Ee===null)throw Error(i(349));Xt&127||hT(h,l,c)}y.memoizedState=c;var b={value:c,getSnapshot:l};return y.queue=b,OT(mT.bind(null,h,b,r),[r]),h.flags|=2048,tu(9,{destroy:void 0},pT.bind(null,h,b,c,l),null),c},useId:function(){var r=oi(),l=Ee.identifierPrefix;if(Zt){var c=lo,h=ro;c=(h&~(1<<32-Ui(h)-1)).toString(32)+c,l="_"+l+"R_"+c,c=Wp++,0<c&&(l+="H"+c.toString(32)),l+="_"}else c=XB++,l="_"+l+"r_"+c.toString(32)+"_";return r.memoizedState=l},useHostTransitionStatus:N0,useFormState:AT,useActionState:AT,useOptimistic:function(r){var l=oi();l.memoizedState=l.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=c,l=I0.bind(null,Bt,!0,c),c.dispatch=l,[r,l]},useMemoCache:A0,useCacheRefresh:function(){return oi().memoizedState=V4.bind(null,Bt)},useEffectEvent:function(r){var l=oi(),c={impl:r};return l.memoizedState=c,function(){if(Ft&2)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},IS={readContext:P,use:Sp,useCallback:LT,useContext:P,useEffect:O0,useImperativeHandle:DT,useInsertionEffect:zT,useLayoutEffect:NT,useMemo:BT,useReducer:bp,useRef:MT,useState:function(){return bp(Eo)},useDebugValue:_0,useDeferredValue:function(r,l){var c=tn();return PT(c,ve.memoizedState,r,l)},useTransition:function(){var r=bp(Eo)[0],l=tn().memoizedState;return[typeof r=="boolean"?r:gf(r),l]},useSyncExternalStore:dT,useId:VT,useHostTransitionStatus:N0,useFormState:TT,useActionState:TT,useOptimistic:function(r,l){var c=tn();return vT(c,ve,r,l)},useMemoCache:A0,useCacheRefresh:jT};IS.useEffectEvent=_T;var Pw={readContext:P,use:Sp,useCallback:LT,useContext:P,useEffect:O0,useImperativeHandle:DT,useInsertionEffect:zT,useLayoutEffect:NT,useMemo:BT,useReducer:C0,useRef:MT,useState:function(){return C0(Eo)},useDebugValue:_0,useDeferredValue:function(r,l){var c=tn();return ve===null?z0(c,r,l):PT(c,ve.memoizedState,r,l)},useTransition:function(){var r=C0(Eo)[0],l=tn().memoizedState;return[typeof r=="boolean"?r:gf(r),l]},useSyncExternalStore:dT,useId:VT,useHostTransitionStatus:N0,useFormState:wT,useActionState:wT,useOptimistic:function(r,l){var c=tn();return ve!==null?vT(c,ve,r,l):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:A0,useCacheRefresh:jT};Pw.useEffectEvent=_T;var DS={enqueueSetState:function(r,l,c){r=r._reactInternals;var h=Pi(),y=mr(h);y.payload=l,c!=null&&(y.callback=c),l=gr(r,y,h),l!==null&&(Si(l,r,h),hf(l,r,h))},enqueueReplaceState:function(r,l,c){r=r._reactInternals;var h=Pi(),y=mr(h);y.tag=1,y.payload=l,c!=null&&(y.callback=c),l=gr(r,y,h),l!==null&&(Si(l,r,h),hf(l,r,h))},enqueueForceUpdate:function(r,l){r=r._reactInternals;var c=Pi(),h=mr(c);h.tag=2,l!=null&&(h.callback=l),l=gr(r,h,c),l!==null&&(Si(l,r,c),hf(l,r,c))}},LS=Error(i(461)),un=!1,BS={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},zo=!1,cn=!1,PS=!1,Hw=typeof WeakSet=="function"?WeakSet:Set,_n=null,fn=null,xi=!1,Va=null,xu=8192,KB={getCacheForType:function(r){var l=P(Ue),c=l.data.get(r);return c===void 0&&(c=r(),l.data.set(r,c)),c},cacheSignal:function(){return P(Ue).controller.signal}},$p=0,tm=1,em=2,nm=3,im=4;if(typeof Symbol=="function"&&Symbol.for){var Lf=Symbol.for;$p=Lf("selector.component"),tm=Lf("selector.has_pseudo_class"),em=Lf("selector.role"),nm=Lf("selector.test_id"),im=Lf("selector.text")}var ZB=typeof WeakMap=="function"?WeakMap:Map,Ft=0,Ee=null,Gt=null,Xt=0,de=0,Fi=null,wr=!1,Eu=!1,HS=!1,No=0,Xe=0,Mr=0,Zl=0,US=0,Gi=0,Ru=0,Bf=null,Ei=null,VS=!1,am=0,Uw=0,Pf=1/0,om=null,Or=null,Rn=0,_r=null,Au=null,Io=0,jS=0,qS=null,Vw=null,Hf=0,FS=null;return qt.attemptContinuousHydration=function(r){if(r.tag===13||r.tag===31){var l=Pl(r,67108864);l!==null&&Si(l,r,67108864),sS(r,67108864)}},qt.attemptHydrationAtCurrentPriority=function(r){if(r.tag===13||r.tag===31){var l=Pi();l=B(l);var c=Pl(r,l);c!==null&&Si(c,r,l),sS(r,l)}},qt.attemptSynchronousHydration=function(r){switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var l=R(r.pendingLanes);if(l!==0){for(r.pendingLanes|=2,r.entangledLanes|=2;l;){var c=1<<31-Ui(l);r.entanglements[1]|=c,l&=~c}L(r),!(Ft&6)&&(Pf=bi()+500,W(0,!1))}}break;case 31:case 13:l=Pl(r,2),l!==null&&Si(l,r,2),LC(),sS(r,2)}},qt.batchedUpdates=function(r,l){return r(l)},qt.createComponentSelector=function(r){return{$$typeof:$p,value:r}},qt.createContainer=function(r,l,c,h,y,b,w,N,G,tt){return $C(r,l,!1,null,c,h,b,null,w,N,G,tt)},qt.createHasPseudoClassSelector=function(r){return{$$typeof:tm,value:r}},qt.createHydrationContainer=function(r,l,c,h,y,b,w,N,G,tt,ut,at,mt,Lt){return r=$C(c,h,!0,r,y,b,N,Lt,G,tt,ut,at),r.context=tw(null),c=r.current,h=Pi(),h=B(h),y=mr(h),y.callback=l??null,gr(c,y,h),l=h,r.current.lanes=l,M(r,l),L(r),r},qt.createPortal=function(r,l,c){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:au,key:h==null?null:""+h,children:r,containerInfo:l,implementation:c}},qt.createRoleSelector=function(r){return{$$typeof:em,value:r}},qt.createTestNameSelector=function(r){return{$$typeof:nm,value:r}},qt.createTextSelector=function(r){return{$$typeof:im,value:r}},qt.defaultOnCaughtError=function(r){console.error(r)},qt.defaultOnRecoverableError=function(r){zw(r)},qt.defaultOnUncaughtError=function(r){zw(r)},qt.deferredUpdates=function(r){var l=Ct.T,c=Mo();try{return On(32),Ct.T=null,r()}finally{On(c),Ct.T=l}},qt.discreteUpdates=function(r,l,c,h,y){var b=Ct.T,w=Mo();try{return On(2),Ct.T=null,r(l,c,h,y)}finally{On(w),Ct.T=b,Ft===0&&(Pf=bi()+500)}},qt.findAllNodes=eS,qt.findBoundingRects=function(r,l){if(!Cf)throw Error(i(363));l=eS(r,l),r=[];for(var c=0;c<l.length;c++)r.push(z5(l[c]));for(l=r.length-1;0<l;l--){c=r[l];for(var h=c.x,y=h+c.width,b=c.y,w=b+c.height,N=l-1;0<=N;N--)if(l!==N){var G=r[N],tt=G.x,ut=tt+G.width,at=G.y,mt=at+G.height;if(h>=tt&&b>=at&&y<=ut&&w<=mt){r.splice(l,1);break}else if(h!==tt||c.width!==G.width||mt<b||at>w){if(!(b!==at||c.height!==G.height||ut<h||tt>y)){tt>h&&(G.width+=tt-h,G.x=h),ut<y&&(G.width=y-tt),r.splice(l,1);break}}else{at>b&&(G.height+=at-b,G.y=b),mt<w&&(G.height=w-at),r.splice(l,1);break}}}return r},qt.findHostInstance=ew,qt.findHostInstanceWithNoPortals=function(r){return r=s(r),r=r!==null?d(r):null,r===null?null:Tf(r.stateNode)},qt.findHostInstanceWithWarning=function(r){return ew(r)},qt.flushPassiveEffects=Af,qt.flushSyncFromReconciler=function(r){var l=Ft;Ft|=1;var c=Ct.T,h=Mo();try{if(On(2),Ct.T=null,r)return r()}finally{On(h),Ct.T=c,Ft=l,!(Ft&6)&&W(0,!1)}},qt.flushSyncWork=LC,qt.focusWithin=function(r,l){if(!Cf)throw Error(i(363));for(r=W0(r),l=zC(r,l),l=Array.from(l),r=0;r<l.length;){var c=l[r++],h=c.tag;if(!wf(c)){if((h===5||h===26||h===27)&&D5(c.stateNode))return!0;for(c=c.child;c!==null;)l.push(c),c=c.sibling}}return!1},qt.getFindAllNodesFailureDescription=function(r,l){if(!Cf)throw Error(i(363));var c=0,h=[];r=[W0(r),0];for(var y=0;y<r.length;){var b=r[y++],w=b.tag,N=r[y++],G=l[N];if((w!==5&&w!==26&&w!==27||!wf(b))&&($0(b,G)&&(h.push(tS(G)),N++,N>c&&(c=N)),N<l.length))for(b=b.child;b!==null;)r.push(b,N),b=b.sibling}if(c<l.length){for(r=[];c<l.length;c++)r.push(tS(l[c]));return`findAllNodes was able to match part of the selector:
8
9
  `+(h.join(" > ")+`
9
10
 
10
11
  No matching component was found for:
11
- `)+o.join(" > ")}return null},n.getPublicRootInstance=function(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return oe(o.child.stateNode);default:return o.child.stateNode}},n.injectIntoDevTools=function(o){if(o={bundleType:o.bundleType,version:o.version,rendererPackageName:o.rendererPackageName,rendererConfig:o.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:u.ReactCurrentDispatcher,findHostInstanceByFiber:_I,findFiberByHostInstance:o.findFiberByHostInstance||OI,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")o=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)o=!0;else{try{uu=a.inject(o),Oi=a}catch{}o=!!a.checkDCE}}return o},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(o,a,d,h){if(!kn)throw Error(l(363));o=Th(o,a);var g=V(o,d,h).disconnect;return{disconnect:function(){g()}}},n.registerMutableSourceForHydration=function(o,a){var d=a._getVersion;d=d(a._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[a,d]:o.mutableSourceEagerHydrationData.push(a,d)},n.runWithPriority=function(o,a){var d=He;try{return He=o,a()}finally{He=d}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(o,a,d,h){var g=a.current,x=nn(),C=Sr(g);return d=vx(d),a.context===null?a.context=d:a.pendingContext=d,a=Ki(x,C),a.payload={element:o},h=h===void 0?null:h,h!==null&&(a.callback=h),o=yr(g,a,C),o!==null&&(Jn(o,g,C,x),yu(o,g,C)),C},n}});var rw=Dt((RF,iw)=>{"use strict";iw.exports=nw()});var Oo=Dt((WF,Qw)=>{"use strict";Qw.exports=ReactDOM});var Kw=Dt(Ym=>{"use strict";var Yw=Oo();Ym.createRoot=Yw.createRoot,Ym.hydrateRoot=Yw.hydrateRoot;var UF});var gE=Dt((AW,mE)=>{"use strict";(()=>{var e={296:(r,s,l)=>{var u=/^\s+|\s+$/g,f=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,c=/^0o[0-7]+$/i,m=parseInt,y=typeof l.g=="object"&&l.g&&l.g.Object===Object&&l.g,w=typeof self=="object"&&self&&self.Object===Object&&self,v=y||w||Function("return this")(),S=Object.prototype.toString,E=Math.max,R=Math.min,b=function(){return v.Date.now()};function I(T){var _=typeof T;return!!T&&(_=="object"||_=="function")}function M(T){if(typeof T=="number")return T;if(function(H){return typeof H=="symbol"||function(Z){return!!Z&&typeof Z=="object"}(H)&&S.call(H)=="[object Symbol]"}(T))return NaN;if(I(T)){var _=typeof T.valueOf=="function"?T.valueOf():T;T=I(_)?_+"":_}if(typeof T!="string")return T===0?T:+T;T=T.replace(u,"");var U=p.test(T);return U||c.test(T)?m(T.slice(2),U?2:8):f.test(T)?NaN:+T}r.exports=function(T,_,U){var H,Z,B,G,K,ce,J=0,te=!1,oe=!1,Re=!0;if(typeof T!="function")throw new TypeError("Expected a function");function de(Ge){var $e=H,Qe=Z;return H=Z=void 0,J=Ge,G=T.apply(Qe,$e)}function N(Ge){var $e=Ge-ce;return ce===void 0||$e>=_||$e<0||oe&&Ge-J>=B}function re(){var Ge=b();if(N(Ge))return Le(Ge);K=setTimeout(re,function($e){var Qe=_-($e-ce);return oe?R(Qe,B-($e-J)):Qe}(Ge))}function Le(Ge){return K=void 0,Re&&H?de(Ge):(H=Z=void 0,G)}function je(){var Ge=b(),$e=N(Ge);if(H=arguments,Z=this,ce=Ge,$e){if(K===void 0)return function(Qe){return J=Qe,K=setTimeout(re,_),te?de(Qe):G}(ce);if(oe)return K=setTimeout(re,_),de(ce)}return K===void 0&&(K=setTimeout(re,_)),G}return _=M(_)||0,I(U)&&(te=!!U.leading,B=(oe="maxWait"in U)?E(M(U.maxWait)||0,_):B,Re="trailing"in U?!!U.trailing:Re),je.cancel=function(){K!==void 0&&clearTimeout(K),J=0,H=ce=Z=K=void 0},je.flush=function(){return K===void 0?G:Le(b())},je}},96:(r,s,l)=>{var u="Expected a function",f=NaN,p="[object Symbol]",c=/^\s+|\s+$/g,m=/^[-+]0x[0-9a-f]+$/i,y=/^0b[01]+$/i,w=/^0o[0-7]+$/i,v=parseInt,S=typeof l.g=="object"&&l.g&&l.g.Object===Object&&l.g,E=typeof self=="object"&&self&&self.Object===Object&&self,R=S||E||Function("return this")(),b=Object.prototype.toString,I=Math.max,M=Math.min,T=function(){return R.Date.now()};function _(H){var Z=typeof H;return!!H&&(Z=="object"||Z=="function")}function U(H){if(typeof H=="number")return H;if(function(G){return typeof G=="symbol"||function(K){return!!K&&typeof K=="object"}(G)&&b.call(G)==p}(H))return f;if(_(H)){var Z=typeof H.valueOf=="function"?H.valueOf():H;H=_(Z)?Z+"":Z}if(typeof H!="string")return H===0?H:+H;H=H.replace(c,"");var B=y.test(H);return B||w.test(H)?v(H.slice(2),B?2:8):m.test(H)?f:+H}r.exports=function(H,Z,B){var G=!0,K=!0;if(typeof H!="function")throw new TypeError(u);return _(B)&&(G="leading"in B?!!B.leading:G,K="trailing"in B?!!B.trailing:K),function(ce,J,te){var oe,Re,de,N,re,Le,je=0,Ge=!1,$e=!1,Qe=!0;if(typeof ce!="function")throw new TypeError(u);function Ze(Ne){var fe=oe,ae=Re;return oe=Re=void 0,je=Ne,N=ce.apply(ae,fe)}function Ct(Ne){var fe=Ne-Le;return Le===void 0||fe>=J||fe<0||$e&&Ne-je>=de}function xt(){var Ne=T();if(Ct(Ne))return xn(Ne);re=setTimeout(xt,function(fe){var ae=J-(fe-Le);return $e?M(ae,de-(fe-je)):ae}(Ne))}function xn(Ne){return re=void 0,Qe&&oe?Ze(Ne):(oe=Re=void 0,N)}function Pt(){var Ne=T(),fe=Ct(Ne);if(oe=arguments,Re=this,Le=Ne,fe){if(re===void 0)return function(ae){return je=ae,re=setTimeout(xt,J),Ge?Ze(ae):N}(Le);if($e)return re=setTimeout(xt,J),Ze(Le)}return re===void 0&&(re=setTimeout(xt,J)),N}return J=U(J)||0,_(te)&&(Ge=!!te.leading,de=($e="maxWait"in te)?I(U(te.maxWait)||0,J):de,Qe="trailing"in te?!!te.trailing:Qe),Pt.cancel=function(){re!==void 0&&clearTimeout(re),je=0,oe=Le=Re=re=void 0},Pt.flush=function(){return re===void 0?N:xn(T())},Pt}(H,Z,{leading:G,maxWait:Z,trailing:K})}},703:(r,s,l)=>{"use strict";var u=l(414);function f(){}function p(){}p.resetWarningCache=f,r.exports=function(){function c(w,v,S,E,R,b){if(b!==u){var I=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw I.name="Invariant Violation",I}}function m(){return c}c.isRequired=c;var y={array:c,bigint:c,bool:c,func:c,number:c,object:c,string:c,symbol:c,any:c,arrayOf:m,element:c,elementType:c,instanceOf:m,node:c,objectOf:m,oneOf:m,oneOfType:m,shape:m,exact:m,checkPropTypes:p,resetWarningCache:f};return y.PropTypes=y,y}},697:(r,s,l)=>{r.exports=l(703)()},414:r=>{"use strict";r.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}},t={};function n(r){var s=t[r];if(s!==void 0)return s.exports;var l=t[r]={exports:{}};return e[r](l,l.exports,n),l.exports}n.n=r=>{var s=r&&r.__esModule?()=>r.default:()=>r;return n.d(s,{a:s}),s},n.d=(r,s)=>{for(var l in s)n.o(s,l)&&!n.o(r,l)&&Object.defineProperty(r,l,{enumerable:!0,get:s[l]})},n.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),n.o=(r,s)=>Object.prototype.hasOwnProperty.call(r,s),n.r=r=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})};var i={};(()=>{"use strict";n.r(i),n.d(i,{LazyLoadComponent:()=>De,LazyLoadImage:()=>Se,trackWindowScroll:()=>Le});let r=Q();var s=n.n(r),l=n(697);let u=Oo();var f=n.n(u);function p(){return typeof window<"u"&&"IntersectionObserver"in window&&"isIntersecting"in window.IntersectionObserverEntry.prototype}function c(V){return c=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(k){return typeof k}:function(k){return k&&typeof Symbol=="function"&&k.constructor===Symbol&&k!==Symbol.prototype?"symbol":typeof k},c(V)}function m(V,k){var X=Object.keys(V);if(Object.getOwnPropertySymbols){var ee=Object.getOwnPropertySymbols(V);k&&(ee=ee.filter(function(Ie){return Object.getOwnPropertyDescriptor(V,Ie).enumerable})),X.push.apply(X,ee)}return X}function y(V,k,X){return(k=v(k))in V?Object.defineProperty(V,k,{value:X,enumerable:!0,configurable:!0,writable:!0}):V[k]=X,V}function w(V,k){for(var X=0;X<k.length;X++){var ee=k[X];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(V,v(ee.key),ee)}}function v(V){var k=function(X,ee){if(c(X)!=="object"||X===null)return X;var Ie=X[Symbol.toPrimitive];if(Ie!==void 0){var _e=Ie.call(X,"string");if(c(_e)!=="object")return _e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(X)}(V);return c(k)==="symbol"?k:String(k)}function S(V,k){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(X,ee){return X.__proto__=ee,X},S(V,k)}function E(V){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(k){return k.__proto__||Object.getPrototypeOf(k)},E(V)}var R=function(V){V.forEach(function(k){k.isIntersecting&&k.target.onVisible()})},b={},I=function(V){(function(W,Y){if(typeof Y!="function"&&Y!==null)throw new TypeError("Super expression must either be null or a function");W.prototype=Object.create(Y&&Y.prototype,{constructor:{value:W,writable:!0,configurable:!0}}),Object.defineProperty(W,"prototype",{writable:!1}),Y&&S(W,Y)})(Be,V);var k,X,ee,Ie,_e=(ee=Be,Ie=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var W,Y=E(ee);if(Ie){var ge=E(this).constructor;W=Reflect.construct(Y,arguments,ge)}else W=Y.apply(this,arguments);return function(he,pe){if(pe&&(c(pe)==="object"||typeof pe=="function"))return pe;if(pe!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(ke){if(ke===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ke}(he)}(this,W)});function Be(W){var Y;if(function(he,pe){if(!(he instanceof pe))throw new TypeError("Cannot call a class as a function")}(this,Be),(Y=_e.call(this,W)).supportsObserver=!W.scrollPosition&&W.useIntersectionObserver&&p(),Y.supportsObserver){var ge=W.threshold;Y.observer=function(he){return b[he]=b[he]||new IntersectionObserver(R,{rootMargin:he+"px"}),b[he]}(ge)}return Y}return k=Be,X=[{key:"componentDidMount",value:function(){this.placeholder&&this.observer&&(this.placeholder.onVisible=this.props.onVisible,this.observer.observe(this.placeholder)),this.supportsObserver||this.updateVisibility()}},{key:"componentWillUnmount",value:function(){this.observer&&this.placeholder&&this.observer.unobserve(this.placeholder)}},{key:"componentDidUpdate",value:function(){this.supportsObserver||this.updateVisibility()}},{key:"getPlaceholderBoundingBox",value:function(){var W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props.scrollPosition,Y=this.placeholder.getBoundingClientRect(),ge=f().findDOMNode(this.placeholder).style,he=parseInt(ge.getPropertyValue("margin-left"),10)||0,pe=parseInt(ge.getPropertyValue("margin-top"),10)||0;return{bottom:W.y+Y.bottom+pe,left:W.x+Y.left+he,right:W.x+Y.right+he,top:W.y+Y.top+pe}}},{key:"isPlaceholderInViewport",value:function(){if(typeof window>"u"||!this.placeholder)return!1;var W=this.props,Y=W.scrollPosition,ge=W.threshold,he=this.getPlaceholderBoundingBox(Y),pe=Y.y+window.innerHeight,ke=Y.x,tt=Y.x+window.innerWidth,nt=Y.y;return nt-ge<=he.bottom&&pe+ge>=he.top&&ke-ge<=he.right&&tt+ge>=he.left}},{key:"updateVisibility",value:function(){this.isPlaceholderInViewport()&&this.props.onVisible()}},{key:"render",value:function(){var W=this,Y=this.props,ge=Y.className,he=Y.height,pe=Y.placeholder,ke=Y.style,tt=Y.width;if(pe&&typeof pe.type!="function")return s().cloneElement(pe,{ref:function(Ye){return W.placeholder=Ye}});var nt=function(Ye){for(var Lt=1;Lt<arguments.length;Lt++){var ct=arguments[Lt]!=null?arguments[Lt]:{};Lt%2?m(Object(ct),!0).forEach(function(Ft){y(Ye,Ft,ct[Ft])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Ye,Object.getOwnPropertyDescriptors(ct)):m(Object(ct)).forEach(function(Ft){Object.defineProperty(Ye,Ft,Object.getOwnPropertyDescriptor(ct,Ft))})}return Ye}({display:"inline-block"},ke);return tt!==void 0&&(nt.width=tt),he!==void 0&&(nt.height=he),s().createElement("span",{className:ge,ref:function(Ye){return W.placeholder=Ye},style:nt},pe)}}],X&&w(k.prototype,X),Object.defineProperty(k,"prototype",{writable:!1}),Be}(s().Component);I.propTypes={onVisible:l.PropTypes.func.isRequired,className:l.PropTypes.string,height:l.PropTypes.oneOfType([l.PropTypes.number,l.PropTypes.string]),placeholder:l.PropTypes.element,threshold:l.PropTypes.number,useIntersectionObserver:l.PropTypes.bool,scrollPosition:l.PropTypes.shape({x:l.PropTypes.number.isRequired,y:l.PropTypes.number.isRequired}),width:l.PropTypes.oneOfType([l.PropTypes.number,l.PropTypes.string])},I.defaultProps={className:"",placeholder:null,threshold:100,useIntersectionObserver:!0};let M=I;var T=n(296),_=n.n(T),U=n(96),H=n.n(U),Z=function(V){var k=getComputedStyle(V,null);return k.getPropertyValue("overflow")+k.getPropertyValue("overflow-y")+k.getPropertyValue("overflow-x")};let B=function(V){if(!(V instanceof HTMLElement))return window;for(var k=V;k&&k instanceof HTMLElement;){if(/(scroll|auto)/.test(Z(k)))return k;k=k.parentNode}return window};function G(V){return G=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(k){return typeof k}:function(k){return k&&typeof Symbol=="function"&&k.constructor===Symbol&&k!==Symbol.prototype?"symbol":typeof k},G(V)}var K=["delayMethod","delayTime"];function ce(){return ce=Object.assign?Object.assign.bind():function(V){for(var k=1;k<arguments.length;k++){var X=arguments[k];for(var ee in X)Object.prototype.hasOwnProperty.call(X,ee)&&(V[ee]=X[ee])}return V},ce.apply(this,arguments)}function J(V,k){for(var X=0;X<k.length;X++){var ee=k[X];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(V,(Ie=function(_e,Be){if(G(_e)!=="object"||_e===null)return _e;var W=_e[Symbol.toPrimitive];if(W!==void 0){var Y=W.call(_e,"string");if(G(Y)!=="object")return Y;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(_e)}(ee.key),G(Ie)==="symbol"?Ie:String(Ie)),ee)}var Ie}function te(V,k){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(X,ee){return X.__proto__=ee,X},te(V,k)}function oe(V,k){if(k&&(G(k)==="object"||typeof k=="function"))return k;if(k!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Re(V)}function Re(V){if(V===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return V}function de(V){return de=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(k){return k.__proto__||Object.getPrototypeOf(k)},de(V)}var N=function(){return typeof window>"u"?0:window.scrollX||window.pageXOffset},re=function(){return typeof window>"u"?0:window.scrollY||window.pageYOffset};let Le=function(V){var k=function(X){(function(ge,he){if(typeof he!="function"&&he!==null)throw new TypeError("Super expression must either be null or a function");ge.prototype=Object.create(he&&he.prototype,{constructor:{value:ge,writable:!0,configurable:!0}}),Object.defineProperty(ge,"prototype",{writable:!1}),he&&te(ge,he)})(Y,X);var ee,Ie,_e,Be,W=(_e=Y,Be=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var ge,he=de(_e);if(Be){var pe=de(this).constructor;ge=Reflect.construct(he,arguments,pe)}else ge=he.apply(this,arguments);return oe(this,ge)});function Y(ge){var he;if(function(ke,tt){if(!(ke instanceof tt))throw new TypeError("Cannot call a class as a function")}(this,Y),(he=W.call(this,ge)).useIntersectionObserver=ge.useIntersectionObserver&&p(),he.useIntersectionObserver)return oe(he);var pe=he.onChangeScroll.bind(Re(he));return ge.delayMethod==="debounce"?he.delayedScroll=_()(pe,ge.delayTime):ge.delayMethod==="throttle"&&(he.delayedScroll=H()(pe,ge.delayTime)),he.state={scrollPosition:{x:N(),y:re()}},he.baseComponentRef=s().createRef(),he}return ee=Y,(Ie=[{key:"componentDidMount",value:function(){this.addListeners()}},{key:"componentWillUnmount",value:function(){this.removeListeners()}},{key:"componentDidUpdate",value:function(){typeof window>"u"||this.useIntersectionObserver||B(f().findDOMNode(this.baseComponentRef.current))!==this.scrollElement&&(this.removeListeners(),this.addListeners())}},{key:"addListeners",value:function(){typeof window>"u"||this.useIntersectionObserver||(this.scrollElement=B(f().findDOMNode(this.baseComponentRef.current)),this.scrollElement.addEventListener("scroll",this.delayedScroll,{passive:!0}),window.addEventListener("resize",this.delayedScroll,{passive:!0}),this.scrollElement!==window&&window.addEventListener("scroll",this.delayedScroll,{passive:!0}))}},{key:"removeListeners",value:function(){typeof window>"u"||this.useIntersectionObserver||(this.scrollElement.removeEventListener("scroll",this.delayedScroll),window.removeEventListener("resize",this.delayedScroll),this.scrollElement!==window&&window.removeEventListener("scroll",this.delayedScroll))}},{key:"onChangeScroll",value:function(){this.useIntersectionObserver||this.setState({scrollPosition:{x:N(),y:re()}})}},{key:"render",value:function(){var ge=this.props,he=(ge.delayMethod,ge.delayTime,function(ke,tt){if(ke==null)return{};var nt,Ye,Lt=function(Ft,hr){if(Ft==null)return{};var ci,to,ua={},nu=Object.keys(Ft);for(to=0;to<nu.length;to++)ci=nu[to],hr.indexOf(ci)>=0||(ua[ci]=Ft[ci]);return ua}(ke,tt);if(Object.getOwnPropertySymbols){var ct=Object.getOwnPropertySymbols(ke);for(Ye=0;Ye<ct.length;Ye++)nt=ct[Ye],tt.indexOf(nt)>=0||Object.prototype.propertyIsEnumerable.call(ke,nt)&&(Lt[nt]=ke[nt])}return Lt}(ge,K)),pe=this.useIntersectionObserver?null:this.state.scrollPosition;return s().createElement(V,ce({forwardRef:this.baseComponentRef,scrollPosition:pe},he))}}])&&J(ee.prototype,Ie),Object.defineProperty(ee,"prototype",{writable:!1}),Y}(s().Component);return k.propTypes={delayMethod:l.PropTypes.oneOf(["debounce","throttle"]),delayTime:l.PropTypes.number,useIntersectionObserver:l.PropTypes.bool},k.defaultProps={delayMethod:"throttle",delayTime:300,useIntersectionObserver:!0},k};function je(V){return je=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(k){return typeof k}:function(k){return k&&typeof Symbol=="function"&&k.constructor===Symbol&&k!==Symbol.prototype?"symbol":typeof k},je(V)}function Ge(V,k){for(var X=0;X<k.length;X++){var ee=k[X];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(V,(Ie=function(_e,Be){if(je(_e)!=="object"||_e===null)return _e;var W=_e[Symbol.toPrimitive];if(W!==void 0){var Y=W.call(_e,"string");if(je(Y)!=="object")return Y;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(_e)}(ee.key),je(Ie)==="symbol"?Ie:String(Ie)),ee)}var Ie}function $e(V,k){return $e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(X,ee){return X.__proto__=ee,X},$e(V,k)}function Qe(V){return Qe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(k){return k.__proto__||Object.getPrototypeOf(k)},Qe(V)}var Ze=function(V){(function(W,Y){if(typeof Y!="function"&&Y!==null)throw new TypeError("Super expression must either be null or a function");W.prototype=Object.create(Y&&Y.prototype,{constructor:{value:W,writable:!0,configurable:!0}}),Object.defineProperty(W,"prototype",{writable:!1}),Y&&$e(W,Y)})(Be,V);var k,X,ee,Ie,_e=(ee=Be,Ie=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var W,Y=Qe(ee);if(Ie){var ge=Qe(this).constructor;W=Reflect.construct(Y,arguments,ge)}else W=Y.apply(this,arguments);return function(he,pe){if(pe&&(je(pe)==="object"||typeof pe=="function"))return pe;if(pe!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(ke){if(ke===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ke}(he)}(this,W)});function Be(W){return function(Y,ge){if(!(Y instanceof ge))throw new TypeError("Cannot call a class as a function")}(this,Be),_e.call(this,W)}return k=Be,(X=[{key:"render",value:function(){return s().createElement(M,this.props)}}])&&Ge(k.prototype,X),Object.defineProperty(k,"prototype",{writable:!1}),Be}(s().Component);let Ct=Le(Ze);function xt(V){return xt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(k){return typeof k}:function(k){return k&&typeof Symbol=="function"&&k.constructor===Symbol&&k!==Symbol.prototype?"symbol":typeof k},xt(V)}function xn(V,k){for(var X=0;X<k.length;X++){var ee=k[X];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(V,(Ie=function(_e,Be){if(xt(_e)!=="object"||_e===null)return _e;var W=_e[Symbol.toPrimitive];if(W!==void 0){var Y=W.call(_e,"string");if(xt(Y)!=="object")return Y;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(_e)}(ee.key),xt(Ie)==="symbol"?Ie:String(Ie)),ee)}var Ie}function Pt(V,k){return Pt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(X,ee){return X.__proto__=ee,X},Pt(V,k)}function Ne(V){if(V===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return V}function fe(V){return fe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(k){return k.__proto__||Object.getPrototypeOf(k)},fe(V)}var ae=function(V){(function(W,Y){if(typeof Y!="function"&&Y!==null)throw new TypeError("Super expression must either be null or a function");W.prototype=Object.create(Y&&Y.prototype,{constructor:{value:W,writable:!0,configurable:!0}}),Object.defineProperty(W,"prototype",{writable:!1}),Y&&Pt(W,Y)})(Be,V);var k,X,ee,Ie,_e=(ee=Be,Ie=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var W,Y=fe(ee);if(Ie){var ge=fe(this).constructor;W=Reflect.construct(Y,arguments,ge)}else W=Y.apply(this,arguments);return function(he,pe){if(pe&&(xt(pe)==="object"||typeof pe=="function"))return pe;if(pe!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ne(he)}(this,W)});function Be(W){var Y;(function(tt,nt){if(!(tt instanceof nt))throw new TypeError("Cannot call a class as a function")})(this,Be),Y=_e.call(this,W);var ge=W.afterLoad,he=W.beforeLoad,pe=W.scrollPosition,ke=W.visibleByDefault;return Y.state={visible:ke},ke&&(he(),ge()),Y.onVisible=Y.onVisible.bind(Ne(Y)),Y.isScrollTracked=!!(pe&&Number.isFinite(pe.x)&&pe.x>=0&&Number.isFinite(pe.y)&&pe.y>=0),Y}return k=Be,(X=[{key:"componentDidUpdate",value:function(W,Y){Y.visible!==this.state.visible&&this.props.afterLoad()}},{key:"onVisible",value:function(){this.props.beforeLoad(),this.setState({visible:!0})}},{key:"render",value:function(){if(this.state.visible)return this.props.children;var W=this.props,Y=W.className,ge=W.delayMethod,he=W.delayTime,pe=W.height,ke=W.placeholder,tt=W.scrollPosition,nt=W.style,Ye=W.threshold,Lt=W.useIntersectionObserver,ct=W.width;return this.isScrollTracked||Lt&&p()?s().createElement(M,{className:Y,height:pe,onVisible:this.onVisible,placeholder:ke,scrollPosition:tt,style:nt,threshold:Ye,useIntersectionObserver:Lt,width:ct}):s().createElement(Ct,{className:Y,delayMethod:ge,delayTime:he,height:pe,onVisible:this.onVisible,placeholder:ke,style:nt,threshold:Ye,width:ct})}}])&&xn(k.prototype,X),Object.defineProperty(k,"prototype",{writable:!1}),Be}(s().Component);ae.propTypes={afterLoad:l.PropTypes.func,beforeLoad:l.PropTypes.func,useIntersectionObserver:l.PropTypes.bool,visibleByDefault:l.PropTypes.bool},ae.defaultProps={afterLoad:function(){return{}},beforeLoad:function(){return{}},useIntersectionObserver:!0,visibleByDefault:!1};let De=ae;function Rt(V){return Rt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(k){return typeof k}:function(k){return k&&typeof Symbol=="function"&&k.constructor===Symbol&&k!==Symbol.prototype?"symbol":typeof k},Rt(V)}var ui=["afterLoad","beforeLoad","delayMethod","delayTime","effect","placeholder","placeholderSrc","scrollPosition","threshold","useIntersectionObserver","visibleByDefault","wrapperClassName","wrapperProps"];function un(V,k){var X=Object.keys(V);if(Object.getOwnPropertySymbols){var ee=Object.getOwnPropertySymbols(V);k&&(ee=ee.filter(function(Ie){return Object.getOwnPropertyDescriptor(V,Ie).enumerable})),X.push.apply(X,ee)}return X}function Sn(V){for(var k=1;k<arguments.length;k++){var X=arguments[k]!=null?arguments[k]:{};k%2?un(Object(X),!0).forEach(function(ee){aa(V,ee,X[ee])}):Object.getOwnPropertyDescriptors?Object.defineProperties(V,Object.getOwnPropertyDescriptors(X)):un(Object(X)).forEach(function(ee){Object.defineProperty(V,ee,Object.getOwnPropertyDescriptor(X,ee))})}return V}function aa(V,k,X){return(k=F(k))in V?Object.defineProperty(V,k,{value:X,enumerable:!0,configurable:!0,writable:!0}):V[k]=X,V}function kn(){return kn=Object.assign?Object.assign.bind():function(V){for(var k=1;k<arguments.length;k++){var X=arguments[k];for(var ee in X)Object.prototype.hasOwnProperty.call(X,ee)&&(V[ee]=X[ee])}return V},kn.apply(this,arguments)}function la(V,k){for(var X=0;X<k.length;X++){var ee=k[X];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(V,F(ee.key),ee)}}function F(V){var k=function(X,ee){if(Rt(X)!=="object"||X===null)return X;var Ie=X[Symbol.toPrimitive];if(Ie!==void 0){var _e=Ie.call(X,"string");if(Rt(_e)!=="object")return _e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(X)}(V);return Rt(k)==="symbol"?k:String(k)}function $(V,k){return $=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(X,ee){return X.__proto__=ee,X},$(V,k)}function ie(V){return ie=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(k){return k.__proto__||Object.getPrototypeOf(k)},ie(V)}var le=function(V){(function(W,Y){if(typeof Y!="function"&&Y!==null)throw new TypeError("Super expression must either be null or a function");W.prototype=Object.create(Y&&Y.prototype,{constructor:{value:W,writable:!0,configurable:!0}}),Object.defineProperty(W,"prototype",{writable:!1}),Y&&$(W,Y)})(Be,V);var k,X,ee,Ie,_e=(ee=Be,Ie=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var W,Y=ie(ee);if(Ie){var ge=ie(this).constructor;W=Reflect.construct(Y,arguments,ge)}else W=Y.apply(this,arguments);return function(he,pe){if(pe&&(Rt(pe)==="object"||typeof pe=="function"))return pe;if(pe!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(ke){if(ke===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ke}(he)}(this,W)});function Be(W){var Y;return function(ge,he){if(!(ge instanceof he))throw new TypeError("Cannot call a class as a function")}(this,Be),(Y=_e.call(this,W)).state={loaded:!1},Y}return k=Be,(X=[{key:"onImageLoad",value:function(){var W=this;return this.state.loaded?null:function(Y){W.props.onLoad(Y),W.props.afterLoad(),W.setState({loaded:!0})}}},{key:"getImg",value:function(){var W=this.props,Y=(W.afterLoad,W.beforeLoad,W.delayMethod,W.delayTime,W.effect,W.placeholder,W.placeholderSrc,W.scrollPosition,W.threshold,W.useIntersectionObserver,W.visibleByDefault,W.wrapperClassName,W.wrapperProps,function(ge,he){if(ge==null)return{};var pe,ke,tt=function(Ye,Lt){if(Ye==null)return{};var ct,Ft,hr={},ci=Object.keys(Ye);for(Ft=0;Ft<ci.length;Ft++)ct=ci[Ft],Lt.indexOf(ct)>=0||(hr[ct]=Ye[ct]);return hr}(ge,he);if(Object.getOwnPropertySymbols){var nt=Object.getOwnPropertySymbols(ge);for(ke=0;ke<nt.length;ke++)pe=nt[ke],he.indexOf(pe)>=0||Object.prototype.propertyIsEnumerable.call(ge,pe)&&(tt[pe]=ge[pe])}return tt}(W,ui));return s().createElement("img",kn({},Y,{onLoad:this.onImageLoad()}))}},{key:"getLazyLoadImage",value:function(){var W=this.props,Y=W.beforeLoad,ge=W.className,he=W.delayMethod,pe=W.delayTime,ke=W.height,tt=W.placeholder,nt=W.scrollPosition,Ye=W.style,Lt=W.threshold,ct=W.useIntersectionObserver,Ft=W.visibleByDefault,hr=W.width;return s().createElement(De,{beforeLoad:Y,className:ge,delayMethod:he,delayTime:pe,height:ke,placeholder:tt,scrollPosition:nt,style:Ye,threshold:Lt,useIntersectionObserver:ct,visibleByDefault:Ft,width:hr},this.getImg())}},{key:"getWrappedLazyLoadImage",value:function(W){var Y=this.props,ge=Y.effect,he=Y.height,pe=Y.placeholderSrc,ke=Y.width,tt=Y.wrapperClassName,nt=Y.wrapperProps,Ye=this.state.loaded,Lt=Ye?" lazy-load-image-loaded":"",ct=Ye||!pe?{}:{backgroundImage:"url(".concat(pe,")"),backgroundSize:"100% 100%"};return s().createElement("span",kn({className:tt+" lazy-load-image-background "+ge+Lt,style:Sn(Sn({},ct),{},{color:"transparent",display:"inline-block",height:he,width:ke})},nt),W)}},{key:"render",value:function(){var W=this.props,Y=W.effect,ge=W.placeholderSrc,he=W.visibleByDefault,pe=W.wrapperClassName,ke=W.wrapperProps,tt=this.getLazyLoadImage();return(Y||ge)&&!he||pe||ke?this.getWrappedLazyLoadImage(tt):tt}}])&&la(k.prototype,X),Object.defineProperty(k,"prototype",{writable:!1}),Be}(s().Component);le.propTypes={onLoad:l.PropTypes.func,afterLoad:l.PropTypes.func,beforeLoad:l.PropTypes.func,delayMethod:l.PropTypes.string,delayTime:l.PropTypes.number,effect:l.PropTypes.string,placeholderSrc:l.PropTypes.string,threshold:l.PropTypes.number,useIntersectionObserver:l.PropTypes.bool,visibleByDefault:l.PropTypes.bool,wrapperClassName:l.PropTypes.string,wrapperProps:l.PropTypes.object},le.defaultProps={onLoad:function(){},afterLoad:function(){return{}},beforeLoad:function(){return{}},delayMethod:"throttle",delayTime:300,effect:"",placeholderSrc:null,threshold:100,useIntersectionObserver:!0,visibleByDefault:!1,wrapperClassName:""};let Se=le})(),mE.exports=i})()});var mk={};BI(mk,{AnnotationContext:()=>XO,AnnotationPageContext:()=>ZO,AnnotationStyleProvider:()=>r_,AtlasStoreProvider:()=>Ws,AtlasStoreReactContext:()=>Fo,Auth:()=>gm,AuthProvider:()=>pm,AuthRContext:()=>Co,AuthReactContext:()=>s0,AuthReactContextActions:()=>a0,CanvasAnnotations:()=>VO,CanvasContext:()=>ni,CanvasPanel:()=>jt,CanvasStrategyProvider:()=>Ry,CanvasWorldObject:()=>Iy,CollectionContext:()=>JO,CombinedMetadata:()=>jO,ComplexTimelineProvider:()=>Fg,ContextBridge:()=>jl,ControlsReactContext:()=>bl,CreateCustomShape:()=>Ty,CustomContextBridge:()=>YR,CustomContextBridgeProvider:()=>RO,DefaultEditingTools:()=>JR,EventEmitterProvider:()=>mM,EventsProvider:()=>bO,Image:()=>hE,ImageService:()=>WO,ImageServiceLoaderContext:()=>Mb,InnerViewerProvider:()=>h0,LanguageProvider:()=>f_,LanguageString:()=>Hb,LocaleString:()=>Wn,ManifestContext:()=>im,ManifestMetadata:()=>qO,MediaPlayerProvider:()=>Sl,Metadata:()=>eu,PolygonSelector:()=>BO,RangeContext:()=>rm,ReactEmitterContext:()=>Td,ReactEventContext:()=>Qo,ReactVaultContext:()=>Ar,Render3DModelStrategy:()=>Eg,RenderAccompanyingCanvas:()=>Ig,RenderAnnotation:()=>zo,RenderAnnotationEditing:()=>dy,RenderAnnotationPage:()=>jr,RenderAnnotationStrategy:()=>Mg,RenderAudioStrategy:()=>kg,RenderComplexTimelineStrategy:()=>Bg,RenderEmptyStrategy:()=>Vg,RenderImageStrategy:()=>jg,RenderSvgEditorControls:()=>KO,RenderTextualContentStrategy:()=>Hg,RenderVideoStrategy:()=>Ug,RenderYouTubeStrategy:()=>qg,ResourceProvider:()=>dn,ResourceReactContext:()=>Oa,SelectorControllerProvider:()=>NO,SequenceThumbnails:()=>QO,SimpleViewerProvider:()=>vm,SimpleViewerReactContext:()=>_s,SingleCanvasThumbnail:()=>Ly,StrategyReactContext:()=>Wr,ThumbnailFallbackImage:()=>Ho,TranslationProvider:()=>d_,TransliterationProvider:()=>h_,VaultProvider:()=>bo,ViewerPresetContext:()=>Pi,VirtualAnnotationProvider:()=>Tg,VisibleCanvasReactContext:()=>Ro,annotationResponseToSelector:()=>pk,authDetailsForResource:()=>dm,createAtlasStore:()=>ug,createAuthStateStore:()=>um,createProbe:()=>cm,defaultEmitter:()=>$R,defaultSvgTheme:()=>Jb,emptyActions:()=>fy,emptyStrategy:()=>hy,expandTarget:()=>Tt,findAllCanvasesInRange:()=>Pc,findFirstCanvasFromRange:()=>jS,findManifestSelectedRange:()=>zP,findSelectedRange:()=>om,flattenAnnotationPageIds:()=>py,formatTime:()=>Nd,get3dStrategy:()=>yy,getAtlasStoreByName:()=>fg,getComplexTimelineStrategy:()=>vy,getDefaultAnnotationStyles:()=>hg,getImageStrategy:()=>Yl,getManifestSequence:()=>Ac,getParsedTargetSelector:()=>Ul,getRenderingStrategy:()=>Sy,getTextualContentStrategy:()=>Kl,getVideoStrategy:()=>Xl,getVisibleCanvasesFromCanvasId:()=>DP,hasAuth:()=>oA,isBoxSelector:()=>n_,isImageApiSelector:()=>Ku,isRectangle:()=>js,isSvgSelector:()=>ab,makeAccessServiceRequest:()=>lm,makeAccessTokenRequest:()=>_c,parseRotation:()=>Xu,parseSelector:()=>er,parseSpecificResource:()=>EO,polygonToTarget:()=>Hs,requestToAnnotationResponse:()=>ml,seraliseSupportedSelector:()=>kd,svgThemes:()=>FO,targetIntersects:()=>fk,unknownResponse:()=>ql,unsupportedStrategy:()=>ut,useAnnotation:()=>yl,useAnnotationPage:()=>gg,useAnnotationPageManager:()=>$l,useAnnotationStyles:()=>gl,useAnnotationsAtTime:()=>ek,useAtlasContextMenu:()=>Wl,useAtlasStore:()=>st,useAuthActions:()=>l0,useAuthService:()=>u0,useAuthStore:()=>Ts,useAuthToken:()=>aA,useAuthTokens:()=>fm,useCanvas:()=>Ce,useCanvasChoices:()=>tk,useCanvasClock:()=>nk,useCanvasSequence:()=>sm,useCanvasStartTime:()=>wl,useCanvasSubset:()=>ik,useClosestLanguage:()=>Ub,useCollection:()=>rk,useComplexTimeline:()=>c_,useContextBridge:()=>Vl,useContextMenuStore:()=>ZR,useCreateLocaleString:()=>p_,useCurrentAnnotationActions:()=>ok,useCurrentAnnotationMetadata:()=>sk,useCurrentAnnotationRequest:()=>cy,useCurrentAnnotationTransition:()=>ak,useCurrentAuth:()=>sA,useCustomContextBridge:()=>Bl,useDispatch:()=>Cg,useEmitter:()=>ag,useEvent:()=>Lo,useEventEmitter:()=>zl,useEventListener:()=>lk,useExistingVault:()=>Io,useExternalCollection:()=>uk,useExternalManifest:()=>nm,useExternalResource:()=>Ua,useIIIFLanguage:()=>$d,useImage:()=>Ef,useImageService:()=>Ny,useImageServiceLoader:()=>Rl,useImageTile:()=>ck,useIsAuthEnabled:()=>mm,useLoadImageService:()=>Ql,useLocaleString:()=>qb,useManifest:()=>It,useMediaActions:()=>s_,useMediaElements:()=>a_,useMediaState:()=>o_,usePaintables:()=>gy,usePaintingAnnotations:()=>Yo,usePolygonHelper:()=>Gg,useRange:()=>qa,useRenderControls:()=>mn,useRenderingStrategy:()=>wy,useRequestAnnotation:()=>Ay,useResourceContext:()=>rn,useResourceEvents:()=>xl,useResources:()=>my,useSearchService:()=>ym,useSelectorController:()=>_y,useSelectorEmitter:()=>zO,useSelectorEvents:()=>My,useSelectorHelper:()=>DO,useSimpleMediaPlayer:()=>Do,useSimpleViewer:()=>Po,useStrategy:()=>gt,useStyleHelper:()=>dk,useStyles:()=>No,useSvgEditor:()=>$g,useSvgEditorControls:()=>Fy,useThumbnail:()=>lr,useTranslations:()=>zg,useTransliteration:()=>Ng,useVault:()=>ze,useVaultEffect:()=>_g,useVaultSelector:()=>qe,useViewerPreset:()=>El,useVirtualAnnotationPage:()=>Pg,useVirtualAnnotationPageContext:()=>Ag,useVisibleCanvases:()=>Eo});function Ta(e){"@babel/helpers - typeof";return Ta=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ta(e)}function jI(e,t){if(Ta(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t||"default");if(Ta(i)!="object")return i;throw TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function HI(e){var t=jI(e,"string");return Ta(t)=="symbol"?t:t+""}function Bt(e,t,n){return(t=HI(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var WI=Object.create,bx=Object.defineProperty,UI=Object.getOwnPropertyDescriptor,qI=Object.getOwnPropertyNames,GI=Object.getPrototypeOf,$I=Object.prototype.hasOwnProperty,Wh=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var QI=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(var r=qI(t),s=0,l=r.length,u;s<l;s++)u=r[s],!$I.call(e,u)&&u!==n&&bx(e,u,{get:(f=>t[f]).bind(null,u),enumerable:!(i=UI(t,u))||i.enumerable});return e},Uh=(e,t,n)=>(n=e==null?{}:WI(GI(e)),QI(t||!e||!e.__esModule?bx(n,"default",{value:e,enumerable:!0}):n,e));function YI(e,t,n,i=1){return new Cx(e,t,n).subdivide(i)}function KI(e,t,n,i,r=1){return new ZI(new Float64Array([e.x,e.y,t.x,t.y,n.x,n.y,i.x,i.y])).subdivide(r)}function XI(e){return e.x*e.x+e.y*e.y}function Ma(e){let t=.67;return e/(1-t+(t**4+.25*e*e)**.25)}function fs(e){let t=.39;return e*(1-t+Math.sqrt(t*t+.25*e*e))}var Cx=class{constructor(e,t,n){Bt(this,"start",void 0),Bt(this,"control",void 0),Bt(this,"end",void 0),this.start=e,this.control=t,this.end=n}eval(e){let t=1-e;return{x:this.start.x*t*t+2*this.control.x*t*e+this.end.x*e*e,y:this.start.y*t*t+2*this.control.y*t*e+this.end.y*e*e}}mapToBasic(){let{x:e,y:t}=this.start,{x:n,y:i}=this.control,{x:r,y:s}=this.end,l=2*n-e-r,u=2*i-t-s,f=(n-e)*l+(i-t)*u,p=(r-n)*l+(s-i)*u,c=(r-e)*u-(s-t)*l,m=f/c,y=p/c,w=Math.abs(c)/(Math.hypot(l,u)*Math.abs(y-m));return{x0:e,x2:r,scale:w,cross:c}}subdivide(e){let t=this.mapToBasic(),n=Ma(t.x0),i=Ma(t.x2),r=.5*Math.abs(i-n)*Math.sqrt(t.scale/e),s=Math.ceil(r),l=fs(n),u=fs(i),f=[0];for(let p=1;p<s;p++){let c=fs(n+(i-n)*p/s),m=(c-l)/(u-l);f.push(m)}return f.push(1),f.map(p=>this.eval(p))}},ZI=class Px{constructor(t){Bt(this,"c",void 0),this.c=t}weightsum(t,n,i,r){let s=t*this.c[0]+n*this.c[2]+i*this.c[4]+r*this.c[6],l=t*this.c[1]+n*this.c[3]+i*this.c[5]+r*this.c[7];return{x:s,y:l}}eval(t){let n=1-t,i=n*n*n,r=3*n*n*t,s=3*n*t*t,l=t*t*t;return this.weightsum(i,r,s,l)}deriv(t){let n=1-t,i=-3*n*n,r=3*t*t,s=-6*t*n-i,l=6*t*n-r;return this.weightsum(i,s,l,r)}midpoint_quadbez(){let t=this.weightsum(-.25,.75,.75,-.25);return new Cx({x:this.c[0],y:this.c[1]},t,{x:this.c[6],y:this.c[7]})}subsegment(t,n){let i=new Float64Array(8),r=this.eval(t),s=this.eval(n);i[0]=r.x,i[1]=r.y;let l=(n-t)/3,u=this.deriv(t);i[2]=r.x+l*u.x,i[3]=r.y+l*u.y;let f=this.deriv(n);return i[4]=s.x-l*f.x,i[5]=s.y-l*f.y,i[6]=s.x,i[7]=s.y,new Px(i)}subdivide(t){let n=.1*t,i=t-n,r=Math.sqrt(i),s=XI(this.weightsum(1,-3,3,-1)),l=Math.ceil((s/(432*n*n))**(1/6)),u=[],f=0;for(let v=0;v<l;v++){let S=v/l,E=(v+1)/l,R=this.subsegment(S,E).midpoint_quadbez(),b=R.mapToBasic(),I=Ma(b.x0),M=Ma(b.x2),T=Math.sqrt(b.scale),_=Math.abs(M-I)*T;if(Math.sign(b.x0)!=Math.sign(b.x2)){let U=r/T,H=r*Math.abs(M-I)/Ma(U);_=Math.max(_,H)}u.push({quad:R,a0:I,a2:M,val:_}),f+=_}let p=.5*f/r,c=Math.ceil(p),m=[{x:this.c[0],y:this.c[1]}],y=0,w=0;for(let v=1;v<c;v++){let S=f*v/c;for(;y+u[w].val<S;)y+=u[w].val,w++;let E=u[w].a0,R=u[w].a2,b=fs(E),I=fs(R),M=E+(R-E)*(S-y)/u[w].val,T=fs(M),_=(T-b)/(I-b);m.push(u[w].quad.eval(_))}return m.push({x:this.c[6],y:this.c[7]}),m}},JI=function(){function e(t,n){var i=[],r=!0,s=!1,l=void 0;try{for(var u=t[Symbol.iterator](),f;!(r=(f=u.next()).done)&&(i.push(f.value),!(n&&i.length===n));r=!0);}catch(p){s=!0,l=p}finally{try{!r&&u.return&&u.return()}finally{if(s)throw l}}return i}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw TypeError("Invalid attempt to destructure non-iterable instance")}}(),_a=Math.PI*2,qh=function(e,t,n,i,r,s,l){var u=e.x,f=e.y;u*=t,f*=n;var p=i*u-r*f,c=r*u+i*f;return{x:p+s,y:c+l}},eC=function(e,t){var n=t===1.5707963267948966?.551915024494:t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=Math.cos(e),r=Math.sin(e),s=Math.cos(e+t),l=Math.sin(e+t);return[{x:i-r*n,y:r+i*n},{x:s+l*n,y:l-s*n},{x:s,y:l}]},Rx=function(e,t,n,i){var r=e*i-t*n<0?-1:1,s=e*n+t*i;return s>1&&(s=1),s<-1&&(s=-1),r*Math.acos(s)},tC=function(e,t,n,i,r,s,l,u,f,p,c,m){var y=r**2,w=s**2,v=c**2,S=m**2,E=y*w-y*S-w*v;E<0&&(E=0),E/=y*S+w*v,E=Math.sqrt(E)*(l===u?-1:1);var R=E*r/s*m,b=E*-s/r*c,I=p*R-f*b+(e+n)/2,M=f*R+p*b+(t+i)/2,T=(c-R)/r,_=(m-b)/s,U=(-c-R)/r,H=(-m-b)/s,Z=Rx(1,0,T,_),B=Rx(T,_,U,H);return u===0&&B>0&&(B-=_a),u===1&&B<0&&(B+=_a),[I,M,Z,B]},nC=function(e){var t=e.px,n=e.py,i=e.cx,r=e.cy,s=e.rx,l=e.ry,u=e.xAxisRotation,f=u===void 0?0:u,p=e.largeArcFlag,c=p===void 0?0:p,m=e.sweepFlag,y=m===void 0?0:m,w=[];if(s===0||l===0)return[];var v=Math.sin(f*_a/360),S=Math.cos(f*_a/360),E=S*(t-i)/2+v*(n-r)/2,R=-v*(t-i)/2+S*(n-r)/2;if(E===0&&R===0)return[];s=Math.abs(s),l=Math.abs(l);var b=E**2/s**2+R**2/l**2;b>1&&(s*=Math.sqrt(b),l*=Math.sqrt(b));var I=tC(t,n,i,r,s,l,c,y,v,S,E,R),M=JI(I,4),T=M[0],_=M[1],U=M[2],H=M[3],Z=Math.abs(H)/(_a/4);Math.abs(1-Z)<1e-7&&(Z=1);var B=Math.max(Math.ceil(Z),1);H/=B;for(var G=0;G<B;G++)w.push(eC(U,H)),U+=H;return w.map(function(K){var ce=qh(K[0],s,l,S,v,T,_),J=ce.x,te=ce.y,oe=qh(K[1],s,l,S,v,T,_),Re=oe.x,de=oe.y,N=qh(K[2],s,l,S,v,T,_),re=N.x,Le=N.y;return{x1:J,y1:te,x2:Re,y2:de,x:re,y:Le}})},iC=nC,rC=Wh((e,t)=>{t.exports=r;var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},i=/([astvzqmhlc])([^astvzqmhlc]*)/gi;function r(u){var f=[];return u.replace(i,function(p,c,m){var y=c.toLowerCase();for(m=l(m),y=="m"&&m.length>2&&(f.push([c].concat(m.splice(0,2))),y="l",c=c=="m"?"l":"L");;){if(m.length==n[y])return m.unshift(c),f.push(m);if(m.length<n[y])throw Error("malformed path data");f.push([c].concat(m.splice(0,n[y])))}}),f}var s=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function l(u){var f=u.match(s);return f?f.map(Number):[]}}),oC=Wh((e,t)=>{t.exports=n;function n(i){var r=0,s=0,l=0,u=0;return i.map(function(f){f=f.slice();var p=f[0],c=p.toUpperCase();if(p!=c)switch(f[0]=c,p){case"a":f[6]+=l,f[7]+=u;break;case"v":f[1]+=u;break;case"h":f[1]+=l;break;default:for(var m=1;m<f.length;)f[m++]+=l,f[m++]+=u}switch(c){case"Z":l=r,u=s;break;case"H":l=f[1];break;case"V":u=f[1];break;case"M":l=r=f[1],u=s=f[2];break;default:l=f[f.length-2],u=f[f.length-1]}return f})}}),sC=Uh(rC(),1),aC=Uh(oC(),1);function lC(e){let t=(0,sC.default)(e),n=(0,aC.default)(t),i,r=0,s=0,l=0,u=0,f,p,c=0,m=0,y=[];for(let w=0;w<n.length;w++){let v=n[w],S=v[0];switch(S){case"M":r=v[1],s=v[2];break;case"H":v=["L",v[1],s];break;case"V":v=["L",r,v[1]];break;case"S":{let E=c,R=m;(i==="C"||i=="S")&&(E+=E-l,R+=R-u),v=["C",E,R,v[1],v[2],v[3],v[4]]}break;case"T":i==="Q"||i=="T"?(f=c*2-f,p=m*2-p):(f=c,p=m),v=["Q",f,p,v[1],v[2]];break;case"Q":f=v[1],p=v[2];break;case"A":{let E=iC({px:c,py:m,cx:v[6],cy:v[7],rx:v[1],ry:v[2],xAxisRotation:v[3],largeArcFlag:v[4],sweepFlag:v[5]});if(!E.length)continue;for(let[R,b]of E.entries())v=["C",b.x1,b.y1,b.x2,b.y2,b.x,b.y],R<E.length-1&&y.push(v);v=v}break;case"Z":v=["L",r,s];break}i=S,c=v[v.length-2],m=v[v.length-1],["C","Q","A"].indexOf(S)>-1?(l=v[v.length-4],u=v[v.length-3]):(l=c,u=m),y.push(v)}return y}var uC=/&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/,Ex=/&?(t=)(npt:)?([0-9]+(\.[0-9]+)?)?(,([0-9]+(\.[0-9]+)?))?/,Ix=/^rgba\((\d+),(\d+),(\d+),([0-9.]+)\)$/;function er(e,{domParser:t,svgPreprocessor:n,iiifRenderingHints:i}={}){if(Array.isArray(e))return ti(e.reduce((r,s)=>{let{selector:l,selectors:u,iiifRenderingHints:f}=er(s,{domParser:t,svgPreprocessor:n,iiifRenderingHints:i});return l&&(r.selector?(!r.selector.temporal&&l.temporal&&(r.selector.temporal=l.temporal),!r.selector.spatial&&l.spatial&&(r.selector.spatial=l.spatial),!r.selector.svg&&l.svg&&(r.selector.svg=l.svg),!r.selector.svgShape&&l.svgShape&&(r.selector.svgShape=l.svgShape)):r.selector=l,r.selectors.push(...u)),f&&(r.iiifRenderingHints=r.iiifRenderingHints||{type:"ImageApiSelector"},Object.assign(r.iiifRenderingHints,f)),r},{selector:null,selectors:[],iiifRenderingHints:i}));if(!e)return ti({selector:null,selectors:[],iiifRenderingHints:i});if(typeof e=="string"){let[r,s]=e.split("#");return s?er({type:"FragmentSelector",value:s},{svgPreprocessor:n,iiifRenderingHints:i,domParser:t}):ti({selector:null,selectors:[],iiifRenderingHints:i})}if(e.type){if(e.type==="PointSelector"&&(e.t||e.t===0)){let r={type:"TemporalSelector",temporal:{startTime:e.t}};return ti({selector:r,selectors:[r],iiifRenderingHints:i})}if(e.type==="PointSelector"&&e.x&&e.y){let r={type:"PointSelector",spatial:{x:e.x,y:e.y}};return ti({selector:r,selectors:[r],iiifRenderingHints:i})}}if(Ku(e)){let r=[];if(e.region){let s=er({type:"FragmentSelector",value:"xywh="+e.region},{domParser:t,svgPreprocessor:n,iiifRenderingHints:i});r.push(...s.selectors)}return ti({selector:r[0],selectors:r,iiifRenderingHints:i?{...i,...e}:e})}if(e.type==="FragmentSelector"){let r=uC.exec(e.value);if(r){let l={type:"BoxSelector",spatial:{unit:r[2]==="percent:"||r[2]==="pct:"?"percent":"pixel",x:Number.parseFloat(r[3]),y:Number.parseFloat(r[4]),width:Number.parseFloat(r[5]),height:Number.parseFloat(r[6])}},u=e.value.match(Ex);return u&&(l={type:"TemporalBoxSelector",spatial:l.spatial,temporal:{startTime:u[3]?Number.parseFloat(u[3]):0,endTime:u[6]?Number.parseFloat(u[6]):void 0}}),ti({selector:l,selectors:[l],iiifRenderingHints:i})}let s=e.value.match(Ex);if(s){let l={type:"TemporalSelector",temporal:{startTime:s[3]?Number.parseFloat(s[3]):0,endTime:s[6]?Number.parseFloat(s[6]):void 0}};return ti({selector:l,selectors:[l],iiifRenderingHints:i})}return ti({selector:null,selectors:[],iiifRenderingHints:i})}if(e.type==="SvgSelector"&&"value"in e){t||(typeof window<"u"?t=new window.DOMParser:console.warn("No DOMParser available, cannot parse SVG selector, `points`, `spatial` and `style` will be unavailable and the SVG will not be normalized."));let r=[],s,l,u=n?.(e.value)??e.value,f;if(t){let c=t.parseFromString(e.value,"image/svg+xml").querySelector("svg");if(!c)return console.warn(`Illegal SVG selector: ${e.value}`),ti({selector:null,selectors:[],iiifRenderingHints:i});let m=Ax(c);m&&(r=m.points,f=m.shapeType,s=[Math.min(...r.map(y=>y[0])),Math.min(...r.map(y=>y[1])),Math.max(...r.map(y=>y[0])),Math.max(...r.map(y=>y[1]))],{style:l,svg:u}=fC(m.element)??{svg:u})}let p={type:"SvgSelector",svg:u,svgShape:f,style:l,points:r.length?r:void 0,spatial:s?{unit:"pixel",x:s[0],y:s[1],width:s[2]-s[0],height:s[3]-s[1]}:void 0};return ti({selector:p,selectors:[p],iiifRenderingHints:i})}return ti({selector:null,selectors:[],iiifRenderingHints:i})}function cC(e){let t=e.map(i=>i[0]).reduce((i,r)=>(i[r]+=1,i),{C:0,Q:0,L:0,M:0}),n=new Set(e.map(i=>i[0]));if(t.C>0||t.Q>0)return"path";if(t.L>0&&(n.size===1||n.size===2&&n.has("M"))){if(t.L===4)return"rect";let i=e.slice(-1)[0];return e[0][0]==="M"&&i[0]==="L"&&i[1]==e[0][1]&&i[2]===e[0][2]||i[1]===0&&i[2]===0?"polygon":"polyline"}return"path"}function Ax(e){for(let t of Array.from(e.children))switch(t?.tagName.toLowerCase()){case"g":{let n=Ax(t);if(n)return n}continue;case"path":{let n=t.getAttribute("d");if(!n)continue;let i=lC(n);return{element:t,points:dC(i),shapeType:cC(i)}}case"circle":{let n=Number.parseFloat(t.getAttribute("cx")??"0"),i=Number.parseFloat(t.getAttribute("cy")??"0"),r=Number.parseFloat(t.getAttribute("r")??"0");if(!r)continue;let s=[];for(let l=0;l<=360;l+=12){let u=l*Math.PI/180;s.push([n+r*Math.cos(u),i+r*Math.sin(u)])}return{element:t,points:s,shapeType:"circle"}}case"ellipse":{let n=Number.parseFloat(t.getAttribute("cx")??"0"),i=Number.parseFloat(t.getAttribute("cy")??"0"),r=Number.parseFloat(t.getAttribute("rx")??"0"),s=Number.parseFloat(t.getAttribute("ry")??"0");if(!r&&!s)continue;let l=[];for(let u=0;u<=360;u+=12){let f=Math.tan(u/360*Math.PI),p=r*(1-f**2)/(1+f**2),c=s*2*f/(1+f**2);l.push([n+p,i+c])}return{element:t,points:l,shapeType:"ellipse"}}case"line":{let n=Number.parseFloat(t.getAttribute("x0")??"0"),i=Number.parseFloat(t.getAttribute("y0")??"0"),r=Number.parseFloat(t.getAttribute("x1")??"0"),s=Number.parseFloat(t.getAttribute("y1")??"0");if(n===r&&i===s)continue;return{element:t,points:[[n,i],[r,s]],shapeType:"polyline"}}case"polygon":case"polyline":{let n=t.getAttribute("points")?.split(" ").map(r=>r.split(",").map(Number.parseFloat))??[];if(!n.length)continue;let i="polyline";return t.tagName.toLowerCase()==="polygon"&&(n.push(n[0]),i="polygon"),{element:t,points:n,shapeType:i}}case"rect":{let n=Number.parseFloat(t.getAttribute("x")??"0"),i=Number.parseFloat(t.getAttribute("y")??"0"),r=Number.parseFloat(t.getAttribute("width")??"0"),s=Number.parseFloat(t.getAttribute("height")??"0");if(!r||!s)continue;return{element:t,points:[[n,i],[n+r,i],[n+r,i+s],[n,i+s],[n,i]],shapeType:"rect"}}default:continue}return null}function dC(e){let t=[];for(let n=0;n<e.length;n++){let i=t[t.length-1]??[0,0],r=e[n];switch(r[0]){case"M":case"L":t.push([r[1],r[2]]);continue;case"C":t.push(...KI({x:i[0],y:i[1]},{x:r[1],y:r[2]},{x:r[3],y:r[4]},{x:r[5],y:r[6]}).map(s=>[s.x,s.y]).slice(1));continue;case"Q":t.push(...YI({x:i[0],y:i[1]},{x:r[1],y:r[2]},{x:r[3],y:r[4]}).map(s=>[s.x,s.y]).slice(1));continue}}return t}function fC(e){let t={};if(e.hasAttribute("fill")?(t.fill=e.getAttribute("fill"),e.removeAttribute("fill")):e.style&&e.style.fill&&(t.fill=e.style.fill),t.fill){let i=Ix.exec(t.fill);i&&(t.fillOpacity=Number.parseFloat(i[4]),t.fill=`rgb(${i[1]}, ${i[2]}, ${i[3]})`)}if(e.hasAttribute("fill-opacity")?(t.fillOpacity=Number.parseFloat(e.getAttribute("fill-opacity")),e.removeAttribute("fill-opacity")):e.style&&e.style.fillOpacity&&(t.fillOpacity=Number.parseFloat(e.style.fillOpacity)),e.hasAttribute("stroke")?(t.stroke=e.getAttribute("stroke"),e.removeAttribute("stroke")):e.style&&e.style.stroke&&(t.stroke=e.style.stroke),t.stroke){let i=Ix.exec(t.stroke);i&&(t.strokeOpacity=Number.parseFloat(i[4]),t.stroke=`rgb(${i[1]}, ${i[2]}, ${i[3]})`)}e.hasAttribute("stroke-opacity")?(t.strokeOpacity=Number.parseFloat(e.getAttribute("stroke-opacity")),e.removeAttribute("stroke-opacity")):e.style&&e.style.strokeOpacity&&(t.strokeOpacity=Number.parseFloat(e.style.strokeOpacity)),e.hasAttribute("stroke-width")?(t.strokeWidth=e.getAttribute("stroke-width"),e.removeAttribute("stroke-width")):e.style&&e.style.strokeWidth&&(t.strokeWidth=e.style.strokeWidth),e.hasAttribute("stroke-dasharray")?(t.strokeDasharray=e.getAttribute("stroke-dasharray"),e.removeAttribute("stroke-dasharray")):e.style&&e.style.strokeDasharray&&(t.strokeDasharray=e.style.strokeDasharray);let n=e;for(;n.tagName.toLowerCase()!=="svg";)if(n=n.parentElement,n===null)throw Error("Could not find root SVG element");return{svg:n.outerHTML,style:Object.keys(t).length>0?t:void 0}}function Ku(e){if(!e)return!1;let t=e.type||e["@type"];return t==="iiif:ImageApiSelector"||t==="ImageApiSelector"}function ti(e){if(e.iiifRenderingHints){let t=e.iiifRenderingHints;if(t.rotation){let n=Xu(`${t.rotation}`);if(n)if(e.selectors.length)for(let i of e.selectors)i.rotation=n;else e.selectors.push({type:"RotationSelector",rotation:n})}}else delete e.iiifRenderingHints;return e}function Xu(e){let t=Number.parseFloat(e);return t&&e.startsWith("!")&&(t=360-t),t&&(t%=360),t===t&&t||0}function Tt(e,t={}){if(Array.isArray(e))return Tt(e[0]);if(typeof e=="string"){let[n,i]=e.split("#");return i?Tt({type:"SpecificResource",source:{id:n,type:"Unknown"},selector:{type:"FragmentSelector",value:i}}):{type:"SpecificResource",source:{id:n,type:t.typeMap&&t.typeMap[n]||"Unknown"},selector:null,selectors:[]}}if(e.type==="Choice"||e.type==="List"||e.type==="Composite"||e.type==="Independents")return Tt(e.items[0]);if(!e.type&&"source"in e&&(e.type="SpecificResource"),e.type==="SpecificResource"){e.source.type==="Canvas"&&e.source.partOf&&typeof e.source.partOf=="string"&&(e.source.partOf=[{id:e.source.partOf,type:"Manifest"}]);let{selector:n,selectors:i}=e.selector?er(e.selector,t):{selector:null,selectors:[]};return{type:"SpecificResource",source:e.source,selector:n,selectors:i}}if(e.id){e.type==="Canvas"&&e.partOf&&typeof e.partOf=="string"&&(e.partOf=[{id:e.partOf,type:"Manifest"}]);let[n,i]=e.id.split("#");return i?Tt({type:"SpecificResource",source:{...e,id:n},selector:{type:"FragmentSelector",value:i}}):{type:"SpecificResource",source:{...e,id:n},selector:null,selectors:[]}}return{type:"SpecificResource",source:e,selector:null,selectors:[]}}var Xo=A(Q(),1);var hs=A(Q(),1),kx=A(D(),1),xC={collection:void 0,manifest:void 0,range:void 0,canvas:void 0,annotation:void 0,annotationPage:void 0},Oa=hs.default.createContext(xC),rn=()=>(0,hs.useContext)(Oa);function dn({value:e,children:t}){let n=rn(),i=(0,hs.useMemo)(()=>({...n,...e}),[e,n]);return(0,kx.jsx)(Oa.Provider,{value:i,children:t})}var Lx=A(D(),1);function ni({canvas:e,children:t}){return(0,Lx.jsx)(dn,{value:{canvas:e},children:t})}var Ic=A(Q(),1);var Nx={},Fx=e=>{let t,n=new Set,i=(c,m)=>{let y=typeof c=="function"?c(t):c;if(!Object.is(y,t)){let w=t;t=m??(typeof y!="object"||!y)?y:Object.assign({},t,y),n.forEach(v=>v(t,w))}},r=()=>t,s=()=>p,l=c=>(n.add(c),()=>n.delete(c)),u=()=>{(Nx.env?Nx.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()},f={setState:i,getState:r,getInitialState:s,subscribe:l,destroy:u},p=t=e(i,r,f);return f},Ju=e=>e?Fx(e):Fx;function ec(e){return{all:e||(e=new Map),on:function(t,n){var i=e.get(t);i?i.push(n):e.set(t,[n])},off:function(t,n){var i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var i=e.get(t);i&&i.slice().map(function(r){r(n)}),(i=e.get("*"))&&i.slice().map(function(r){r(t,n)})}}}var ot=function(e){return function(){let t={type:e,getType:()=>e,toString:()=>e};return(n,i)=>({...t,...n!==void 0&&{payload:n},...i!==void 0&&{meta:i}})}},tc="@iiif/IMPORT_ENTITIES",nc="@iiif/MODIFY_ENTITY_FIELD",ic="@iiif/REORDER_ENTITY_FIELD",rc="@iiif/MOVE_ENTITY",ka="@iiif/MOVE_ENTITIES",oc="@iiif/ADD_REFERENCE",La="@iiif/UPDATE_REFERENCE",sc="@iiif/REMOVE_REFERENCE",ac="@iiif/ADD_METADATA",lc="@iiif/REMOVE_METADATA",Fa="@iiif/UPDATE_METADATA",uc="@iiif/REORDER_METADATA",cc=ot(tc)(),zx=ot(nc)(),Dx=ot(ic)(),Bx=ot(rc)(),Vx=ot(ka)(),jx=ot(oc)(),Hx=ot(sc)(),Wx=ot(La)(),Ux=ot(ac)(),qx=ot(Fa)(),Gx=ot(lc)(),$x=ot(uc)(),ho={importEntities:cc,modifyEntityField:zx,reorderEntityField:Dx,addReference:jx,removeReference:Hx,updateReference:Wx,addMetadata:Ux,removeMetadata:Gx,updateMetadata:qx,reorderMetadata:$x,moveEntity:Bx,moveEntities:Vx},dc="@iiif/ADD_MAPPING",fc="@iiif/ADD_MAPPINGS",Gh=ot(dc)(),$h=ot(fc)();var ps="RESOURCE_ERROR",Na="RESOURCE_LOADING",ms="RESOURCE_READY",hc="@iiif/REQUEST_RESOURCE",pc="@iiif/REQUEST_ERROR",mc="@iiif/REQUEST_MISMATCH",gc="@iiif/REQUEST_COMPLETE",yc="@iiif/REQUEST_OFFLINE_RESOURCE",Qh=ot(hc)(),za=ot(pc)(),Yh=ot(mc)(),Kh=ot(gc)(),SC=ot(yc)();var gs="@iiif/BATCH",vc="@iiif/BATCH_IMPORT",ys=ot(gs)(),wC=ot(vc)();var Xh="@iiif/SET_META_VALUE",Zh="@iiif/SET_META_VALUE_DYNAMIC",Jh="@iiif/UNSET_META_VALUE",bC=ot(Xh)(),RC=ot(Zh)(),EC=ot(Jh)(),ep={setMetaValue:bC,setMetaValueDynamic:RC,unsetMetaValue:EC};function yi(e){return Array.isArray(e)?e:e?[e]:[]}function Da(e){"@babel/helpers - typeof";return Da=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Da(e)}function IC(e,t){if(Da(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t||"default");if(Da(i)!="object")return i;throw TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function CC(e){var t=IC(e,"string");return Da(t)=="symbol"?t:t+""}function Vi(e,t,n){return(t=CC(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vi(e){for(let t in e)(e[t]===void 0||e[t]===null)&&delete e[t];return e}function xi(e){return typeof e=="string"?!1:e&&!e.type&&"source"in e?(e.type="SpecificResource",!0):!!e&&e.type==="SpecificResource"}function xc(...e){return t=>e.reduce((n,i)=>i(n),t)}var tp=["Collection","Manifest","Canvas","AnnotationPage","AnnotationCollection","Annotation","ContentResource","Range","Service","Selector","Agent"];function Qx(e,t){if(e==null)throw Error("Null or undefined is not a valid entity.");if(Array.isArray(e))throw Error("Array is not a valid entity");if(typeof e!="object"){if(t)return t;throw Error(`${typeof e} is not a valid entity`)}if(typeof e.type=="string"){let n=tp.indexOf(e.type);if(n!==-1)return tp[n]}if(e.profile)return"Service";throw Error("Resource type is not known")}var np=class Yx{constructor(t,n={}){Vi(this,"traversals",void 0),Vi(this,"options",void 0),Vi(this,"_traverseManifest",xc(this.traverseManifestItems.bind(this),this.traverseNavPlace.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this),this.traverseLinkedCanvases.bind(this),this.traverseManifestStructures.bind(this),this.traverseInlineAnnotationPages.bind(this))),Vi(this,"_traverseCanvas",xc(this.traverseCanvasItems.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this),this.traverseLinkedCanvases.bind(this),this.traverseInlineAnnotationPages.bind(this))),Vi(this,"_traverseAnnotationPage",xc(this.traverseAnnotationPageItems.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this))),Vi(this,"_traverseRange",xc(this.traverseRangeRanges.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this),this.traverseLinkedCanvases.bind(this))),this.traversals={collection:[],manifest:[],canvas:[],annotationCollection:[],annotationPage:[],annotation:[],contentResource:[],choice:[],range:[],service:[],agent:[],specificResource:[],geoJson:[],...t},this.options={allowUndefinedReturn:!1,...n}}static all(t){return new Yx({collection:[t],manifest:[t],canvas:[t],annotationCollection:[t],annotationPage:[t],annotation:[t],contentResource:[t],choice:[t],range:[t],service:[t],geoJson:[t],specificResource:[t],agent:[t]})}traverseDescriptive(t){return t.thumbnail&&(t.thumbnail=yi(t.thumbnail).map(n=>this.traverseType(n,{parent:t},this.traversals.contentResource))),t.provider&&(t.provider=t.provider.map(n=>this.traverseAgent(n,t))),t}traverseLinking(t){return t.seeAlso&&(t.seeAlso=yi(t.seeAlso).map(n=>this.traverseType(n,{parent:t},this.traversals.contentResource))),t.service&&(t.service=yi(t.service).map(n=>this.traverseService(n))),t.services&&(t.services=yi(t.services).map(n=>this.traverseService(n,t))),t.logo&&(t.logo=yi(t.logo).map(n=>this.traverseType(n,{parent:t},this.traversals.contentResource))),t.homepage&&(t.homepage=yi(t.homepage).map(n=>this.traverseType(n,{parent:t},this.traversals.contentResource))),t.partOf&&(t.partOf=t.partOf.map(n=>typeof n=="string"||!n.type?this.traverseType(n,{parent:t},this.traversals.contentResource):n.type==="Canvas"?this.traverseType(n,{parent:t},this.traversals.canvas):n.type==="AnnotationCollection"?this.traverseType(n,{parent:t},this.traversals.annotationCollection):n.type==="Collection"?this.traverseType(n,{parent:t},this.traversals.collection):this.traverseType(n,{parent:t},this.traversals.contentResource))),t.start&&(xi(t.start)?t.start=this.traverseSpecificResource(t.start,"Canvas",t):t.start=this.traverseType(t.start,{parent:t},this.traversals.canvas)),t.rendering&&(t.rendering=t.rendering.map(n=>this.traverseType(n,{parent:t},this.traversals.contentResource))),t.supplementary&&(t.supplementary=t.supplementary.map(n=>this.traverseType(n,{parent:t},this.traversals.contentResource))),t}traverseCollectionItems(t){return t.items&&t.items.map(n=>n.type==="Collection"?this.traverseCollection(n):this.traverseManifest(n)),t}traverseCollection(t,n){return this.traverseType(this.traverseDescriptive(this.traverseNavPlace(this.traverseInlineAnnotationPages(this.traverseLinking(this.traverseLinkedCanvases(this.traverseCollectionItems(t)))))),{parent:n},this.traversals.collection)}traverseGeoJson(t,n){return this.traverseType(t,{parent:n},this.traversals.geoJson)}traverseNavPlace(t){return t.navPlace&&(t.navPlace=this.traverseGeoJson(t.navPlace,t)),t}traverseManifestItems(t){return t.items&&(t.items=t.items.map(n=>this.traverseCanvas(n))),t}traverseManifestStructures(t){return t.structures&&(t.structures=t.structures.map(n=>this.traverseRange(n))),t}traverseManifest(t,n){return this.traverseType(this._traverseManifest(t),{parent:n},this.traversals.manifest)}traverseCanvasItems(t){return t.items=(t.items||[]).map(n=>this.traverseAnnotationPage(n,t)),t}traverseInlineAnnotationPages(t){return typeof t=="string"||!t||t.annotations&&(t.annotations=t.annotations.map(n=>this.traverseAnnotationPage(n,t))),t}traverseCanvas(t,n){return this.traverseType(this._traverseCanvas(t),{parent:n},this.traversals.canvas)}traverseAnnotationPageItems(t){return t.items&&(t.items=t.items.map(n=>this.traverseAnnotation(n,t))),t}traverseAnnotationPage(t,n){return this.traverseType(this._traverseAnnotationPage(t),{parent:n},this.traversals.annotationPage)}traverseAnnotationBody(t){return Array.isArray(t.body)?t.body=t.body.map(n=>this.traverseContentResource(n,t)):t.body&&(t.body=this.traverseContentResource(t.body,t)),t}traverseLinkedCanvases(t){return t.placeholderCanvas&&(t.placeholderCanvas=this.traverseCanvas(t.placeholderCanvas)),t.accompanyingCanvas&&(t.accompanyingCanvas=this.traverseCanvas(t.accompanyingCanvas)),t}traverseAnnotation(t,n){return this.traverseType(this.traverseLinking(this.traverseAnnotationBody(this.traverseDescriptive(t))),{parent:n},this.traversals.annotation)}traverseContentResourceLinking(t){return typeof t=="string"||!t||t&&t.service&&(t.service=yi(t.service||[]).map(n=>this.traverseService(n,t))),t}traverseContentResource(t,n){return t.type==="Choice"&&(t.items=t.items.map(i=>this.traverseContentResource(i,t))),xi(t)?this.traverseSpecificResource(t,"ContentResource"):this.traverseType(this.traverseInlineAnnotationPages(this.traverseContentResourceLinking(t)),{parent:n},this.traversals.contentResource)}traverseSpecificResource(t,n,i){let r=t.source;return typeof t.source=="string"&&(r={id:t.source,type:n||"unknown"}),this.traverseType({...t,source:n==="Canvas"||r.type==="Canvas"?this.traverseType(r,{parent:i},this.traversals.canvas):n==="ContentResource"?this.traverseContentResource(r,{parent:i}):this.traverseUnknown(r,{parent:i,typeHint:n})},{parent:i},this.traversals.specificResource)}traverseRangeRanges(t){return t.items&&(t.items=t.items.map(n=>typeof n=="string"?this.traverseCanvas({id:n,type:"Canvas"},t):xi(n)?this.traverseSpecificResource(n,"Canvas",t):n.type==="Manifest"?this.traverseManifest(n,t):this.traverseRange(n,t))),t}traverseRange(t,n){return this.traverseType(this._traverseRange(t),{parent:n},this.traversals.range)}traverseAgent(t,n){return this.traverseType(this.traverseDescriptive(this.traverseLinking(t)),{parent:n},this.traversals.agent)}traverseType(t,n,i){return i.reduce((r,s)=>{let l=s(r,n);return l===void 0&&!this.options.allowUndefinedReturn?r:l},t)}traverseService(t,n){let i=Object.assign({},t);return i&&i.service&&(i.service=yi(i.service).map(r=>this.traverseService(r))),this.traverseType(i,{parent:n},this.traversals.service)}traverseUnknown(t,{parent:n,typeHint:i}={}){let r=Qx(t,i);switch(r){case"Collection":return this.traverseCollection(t,n);case"Manifest":return this.traverseManifest(t,n);case"Canvas":return this.traverseCanvas(t,n);case"AnnotationPage":return this.traverseAnnotationPage(t,n);case"Annotation":return this.traverseAnnotation(t,n);case"ContentResource":return this.traverseContentResource(t,n);case"Range":return this.traverseRange(t,n);case"Service":return this.traverseService(t,n);case"Agent":return this.traverseAgent(t,n);default:throw Error(`Unknown or unsupported resource type of ${r}`)}}};var ip="http://library.stanford.edu/iiif/image-api/compliance.html#level0",rp="http://library.stanford.edu/iiif/image-api/compliance.html#level1",op="http://library.stanford.edu/iiif/image-api/compliance.html#level2",sp="http://library.stanford.edu/iiif/image-api/conformance.html#level0",ap="http://library.stanford.edu/iiif/image-api/conformance.html#level1",lp="http://library.stanford.edu/iiif/image-api/conformance.html#level2",up="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",cp="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",dp="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",fp="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",hp="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",pp="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",mp="http://iiif.io/api/image/1/level0.json",gp="http://iiif.io/api/image/1/profiles/level0.json",yp="http://iiif.io/api/image/1/level1.json",vp="http://iiif.io/api/image/1/profiles/level1.json",xp="http://iiif.io/api/image/1/level2.json",Sp="http://iiif.io/api/image/1/profiles/level2.json",wp="http://iiif.io/api/image/2/level0.json",bp="http://iiif.io/api/image/2/profiles/level0.json",Rp="http://iiif.io/api/image/2/level1.json",Ep="http://iiif.io/api/image/2/profiles/level1.json",Ip="http://iiif.io/api/image/2/level2.json",Cp="http://iiif.io/api/image/2/profiles/level2.json",Pp="level0",Ap="level1",Tp="level2",Mp="http://iiif.io/api/image/2/level0",_p="http://iiif.io/api/image/2/level1",Op="http://iiif.io/api/image/2/level2",vs=[Op,op,lp,dp,pp,xp,Sp,Ip,Cp,Tp],Sc=[...vs,_p,rp,ap,cp,hp,yp,vp,Rp,Ep,Ap],kp=[Mp,_p,Op,ip,rp,op,sp,ap,lp,up,cp,dp,fp,hp,pp,mp,gp,yp,vp,xp,Sp,wp,bp,Rp,Ep,Ip,Cp,Pp,Ap,Tp],Lp=kp,Fp=[Mp,ip,sp,up,fp,mp,gp,wp,bp,Pp],Kx={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},Xx={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},Zx={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};var Jx=["sc:Collection","sc:Manifest","sc:Canvas","sc:AnnotationList","oa:Annotation","sc:Range","sc:Layer","sc:Sequence","oa:Choice","Service","ContentResource"];function PC(e){if(e==null)throw Error("Null or undefined is not a valid entity.");if(Array.isArray(e))throw Error("Array is not a valid entity");if(typeof e!="object")throw Error(`${typeof e} is not a valid entity`);if(typeof e["@type"]=="string"){let t=Jx.indexOf(e["@type"]);if(t!==-1)return Jx[t]}if(e.profile)return"Service";if(e.format||e["@type"])return"ContentResource";throw Error("Resource type is not known")}var AC=class iS{constructor(t,n={}){Vi(this,"traversals",void 0),Vi(this,"options",void 0),this.traversals={collection:[],manifest:[],canvas:[],annotationList:[],sequence:[],annotation:[],contentResource:[],choice:[],range:[],service:[],layer:[],...t},this.options={convertPropsToArray:!0,mergeMemberProperties:!0,allowUndefinedReturn:!1,...n}}static all(t){return new iS({collection:[t],manifest:[t],canvas:[t],annotationList:[t],sequence:[t],annotation:[t],contentResource:[t],choice:[t],range:[t],service:[t],layer:[t]})}traverseCollection(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCollectionItems(t))),this.traversals.collection)}traverseCollectionItems(t){if(this.options.mergeMemberProperties){let n=[...(t.manifests||[]).map(s=>typeof s=="string"?{"@id":s,"@type":"sc:Manifest"}:s),...(t.collections||[]).map(s=>typeof s=="string"?{"@id":s,"@type":"sc:Collection"}:s),...t.members||[]],i=[],r=n.filter(s=>i.includes(s["@id"])?!1:(i.push(s["@id"]),!0));delete t.collections,delete t.manifests,t.members=r}return t.manifests&&(t.manifests=t.manifests.map(n=>this.traverseManifest(typeof n=="string"?{"@id":n,"@type":"sc:Manifest"}:n))),t.collections&&(t.collections=t.collections.map(n=>this.traverseCollection(typeof n=="string"?{"@id":n,"@type":"sc:Collection"}:n))),t.members&&(t.members=t.members.map(n=>typeof n=="string"?n:n["@type"]==="sc:Collection"?this.traverseCollection(n):n["@type"]==="sc:Manifest"?this.traverseManifest(n):this.traverseUnknown(n))),t}traverseManifest(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseManifestItems(t))),this.traversals.manifest)}traverseManifestItems(t){return t.sequences&&(t.sequences=t.sequences.map(n=>this.traverseSequence(n))),t.structures&&(t.structures=t.structures.map(n=>this.traverseRange(n))),t}traverseSequence(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseSequenceItems(t))),this.traversals.sequence)}traverseSequenceItems(t){return t.canvases&&(t.canvases=t.canvases.map(n=>this.traverseCanvas(n))),t}traverseCanvas(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCanvasItems(t))),this.traversals.canvas)}traverseCanvasItems(t){return t.images&&(t.images=t.images.map(n=>this.traverseAnnotation(n))),t.otherContent&&(t.otherContent=t.otherContent.map(n=>this.traverseAnnotationList(n))),t}traverseRange(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseRangeItems(t))),this.traversals.range)}traverseRangeItems(t){if(this.options.mergeMemberProperties){let n=[...(t.ranges||[]).map(i=>typeof i=="string"?{"@id":i,"@type":"sc:Range"}:i),...(t.canvases||[]).map(i=>typeof i=="string"?{"@id":i,"@type":"sc:Canvas"}:i),...t.members||[]];delete t.ranges,delete t.canvases,t.members=n.length?n.map(i=>this.traverseUnknown(i)):void 0}return t}traverseAnnotationList(t){let n=typeof t=="string"?{"@id":t,"@type":"sc:AnnotationList"}:t;return this.traverseType(this.traverseDescriptive(this.traverseAnnotationListItems(n)),this.traversals.annotationList)}traverseAnnotationListItems(t){return t.resources&&(t.resources=t.resources.map(n=>this.traverseAnnotation(n))),t}traverseAnnotation(t){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseAnnotationItems(t))),this.traversals.annotation)}traverseAnnotationItems(t){return t.resource&&(Array.isArray(t.resource)?t.resource=t.resource.map(n=>this.traverseContentResource(n)):t.resource=this.traverseContentResource(t.resource)),t.on,t}traverseLayer(t){return this.traverseType(this.traverseLinking(this.traverseLayerItems(t)),this.traversals.layer)}traverseLayerItems(t){return t.otherContent&&(t.otherContent=t.otherContent.map(n=>this.traverseAnnotationList(n))),t}traverseChoice(t){return this.traverseType(this.traverseChoiceItems(t),this.traversals.choice)}traverseChoiceItems(t){return t.default&&t.default!=="rdf:nil"&&(t.default=this.traverseContentResource(t.default)),t.item&&t.item!=="rdf:nil"&&(t.item=t.item.map(n=>this.traverseContentResource(n))),t}traverseService(t){return this.traverseType(this.traverseLinking(t),this.traversals.service)}traverseContentResource(t){return t["@type"]==="oa:Choice"?this.traverseChoice(t):this.traverseType(this.traverseDescriptive(this.traverseLinking(t)),this.traversals.contentResource)}traverseUnknown(t){if(!t["@type"]||typeof t=="string")return t;switch(PC(t)){case"sc:Collection":return this.traverseCollection(t);case"sc:Manifest":return this.traverseManifest(t);case"sc:Canvas":return this.traverseCanvas(t);case"sc:Sequence":return this.traverseSequence(t);case"sc:Range":return this.traverseRange(t);case"oa:Annotation":return this.traverseAnnotation(t);case"sc:AnnotationList":return this.traverseAnnotationList(t);case"sc:Layer":return this.traverseLayer(t);case"Service":return this.traverseService(t);case"oa:Choice":return this.traverseChoice(t);case"ContentResource":return this.traverseContentResource(t)}return t.profile?this.traverseService(t):t}traverseImageResource(t){let n=Array.isArray(t),i=Array.isArray(t)?t:[t],r=[];for(let s of i)typeof s=="string"?r.push(this.traverseContentResource({"@id":s,"@type":"dctypes:Image"})):r.push(this.traverseContentResource(s));return!n&&!this.options.convertPropsToArray?r[0]:r}traverseDescriptive(t){return t.thumbnail&&(t.thumbnail=this.traverseImageResource(t.thumbnail)),t.logo&&(t.logo=this.traverseImageResource(t.logo)),t}traverseOneOrMoreServices(t){let n=Array.isArray(t),i=Array.isArray(t)?t:[t],r=[];for(let s of i)r.push(this.traverseService(s));return!n&&!this.options.convertPropsToArray?r[0]:r}traverseLinking(t){return t.related&&(t.related=this.traverseOneOrManyType(t.related,this.traversals.contentResource)),t.rendering&&(t.rendering=this.traverseOneOrManyType(t.rendering,this.traversals.contentResource)),t.service&&(t.service=this.traverseOneOrMoreServices(t.service)),t.seeAlso&&(t.seeAlso=this.traverseOneOrManyType(t.seeAlso,this.traversals.contentResource)),t.within&&(typeof t.within=="string"||(t.within=this.traverseOneOrManyType(t.within,this.traversals.contentResource))),t.startCanvas&&(typeof t.startCanvas=="string"?t.startCanvas=this.traverseType({"@id":t.startCanvas,"@type":"sc:Canvas"},this.traversals.canvas):t.startCanvas&&this.traverseType(t.startCanvas,this.traversals.canvas)),t.contentLayer&&(typeof t.contentLayer=="string"?t.contentLayer=this.traverseLayer({"@id":t.contentLayer,"@type":"sc:Layer"}):t.contentLayer=this.traverseLayer(t.contentLayer)),t}traverseOneOrManyType(t,n){if(!Array.isArray(t))if(this.options.convertPropsToArray)t=[t];else return this.traverseType(t,n);return t.map(i=>this.traverseType(i,n))}traverseType(t,n){return n.reduce((i,r)=>{let s=r(i);return s===void 0&&!this.options.allowUndefinedReturn?i:s},t)}},TC=["http://iiif.io/api/image/2/level1","http://iiif.io/api/image/2/level2","http://library.stanford.edu/iiif/image-api/compliance.html#level1","http://library.stanford.edu/iiif/image-api/compliance.html#level2","http://library.stanford.edu/iiif/image-api/conformance.html#level1","http://library.stanford.edu/iiif/image-api/conformance.html#level2","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2","http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1","http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2","http://iiif.io/api/image/1/level1.json","http://iiif.io/api/image/1/profiles/level1.json","http://iiif.io/api/image/1/level2.json","http://iiif.io/api/image/1/profiles/level2.json","http://iiif.io/api/image/2/level1.json","http://iiif.io/api/image/2/profiles/level1.json","http://iiif.io/api/image/2/level2.json","http://iiif.io/api/image/2/profiles/level2.json","level1","level2"],zp={attributionLabel:"Attribution",lang:"none",providerId:"http://example.org/provider",providerName:""};function MC(e){if(typeof e=="string")return[e];if(!e)return[];let t=Array.isArray(e)?e:[e],n=[];for(let i of t){if(typeof i=="string"){n.push(i);continue}n.push({"@language":i["@language"]||i.language,"@value":i["@value"]||i.value})}return n}function po(e,t="none"){if(!e)return{none:[""]};let n=MC(e),i={};for(let r of n){if(typeof r=="string"){i[t]=i[t]?i[t]:[],i[t].push(r||"");continue}if(!r["@language"]){i[t]=i[t]?i[t]:[],i[t].push(r["@value"]||"");continue}let s=r["@language"];i[s]=i[s]?i[s]:[],i[s].push(r["@value"]||"")}return Object.keys(i).length===0?{none:[""]}:i}function rS(e){if(Array.isArray(e))return rS(e.find(t=>typeof t=="string"));if(vs.indexOf(e)!==-1)return"level2";if(TC.indexOf(e)!==-1)return"level1";if(Lp.indexOf(e)!==-1)return"level0";if(typeof e=="string")return e}function _C(e){let t=Array.isArray(e)?e:[e];for(let n of t)switch(n){case"http://iiif.io/api/image/2/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2":return"ImageService2";case"http://iiif.io/api/image/1/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/context.json":return"ImageService1";case"http://iiif.io/api/annex/openannotation/context.json":return"ImageApiSelector"}}function OC(e){switch(e){case"http://iiif.io/api/image/2/level0.json":case"http://iiif.io/api/image/2/level1.json":case"http://iiif.io/api/image/2/level2.json":return"ImageService2";case"http://iiif.io/api/auth/1/kiosk":case"http://iiif.io/api/auth/1/login":case"http://iiif.io/api/auth/1/clickthrough":case"http://iiif.io/api/auth/1/external":case"http://iiif.io/api/auth/0/kiosk":case"http://iiif.io/api/auth/0/login":case"http://iiif.io/api/auth/0/clickthrough":case"http://iiif.io/api/auth/0/external":return"AuthCookieService1";case"http://iiif.io/api/auth/1/token":case"http://iiif.io/api/auth/0/token":return"AuthTokenService1";case"http://iiif.io/api/auth/1/logout":case"http://iiif.io/api/auth/0/logout":return"AuthLogoutService1";case"http://iiif.io/api/search/1/search":case"http://iiif.io/api/search/0/search":return"SearchService1";case"http://iiif.io/api/search/1/autocomplete":case"http://iiif.io/api/search/0/autocomplete":return"AutoCompleteService1"}}function eS(e){for(let t of["sc","oa","dcterms","dctypes","iiif"])if(e.startsWith(`${t}:`))return e.slice(t.length+1);return e}var kC=["Collection","Manifest","Annotation","AnnotationPage","Range","Service"];function Bp(e){let t=e["@id"]||e.id,n=e["@type"]||e.type,i=e.profile||void 0,r=e["@context"]||void 0;if(i){let s=OC(i);if(s)return s}if(r){let s=_C(r);if(s)return s}if(n){if(Array.isArray(n)){if(n.indexOf("oa:CssStylesheet")!==-1)return"CssStylesheet";if(n.indexOf("cnt:ContentAsText")!==-1)return"TextualBody";n=n[0]}for(let s of["sc","oa","dcterms","dctypes","iiif"])if(n.startsWith(`${s}:`)){n=n.slice(s.length+1);break}switch(n){case"Layer":return"AnnotationCollection";case"AnnotationList":return"AnnotationPage";case"cnt:ContentAsText":return"TextualBody"}}if(n&&kC.indexOf(n)!==-1)return n;if(e.format){if(e.format.startsWith("image/"))return"Image";if(e.format.startsWith("text/")||e.format==="application/pdf")return"Text";if(e.format.startsWith("application/"))return"Dataset"}return t&&(t.endsWith(".jpg")||t.endsWith(".png")||t.endsWith(".jpeg"))?"Image":n||"unknown"}var LC=/http(s)?:\/\/(creativecommons.org|rightsstatements.org)[^"'\\<\n]+/gm;function FC(e){let t=e.match(LC);return t?t[0]:e}function NC(e,t="Rights/License",n="none"){let i=null,r=[],s=Array.isArray(e)?e:[e];for(let l of s){let u=l?FC(l):void 0;if(u&&(u.indexOf("creativecommons.org")!==-1||u.indexOf("rightsstatements.org")!==-1)){i=u.startsWith("https://")?`http://${u.slice(8)}`:u;continue}u&&r.push({label:{[n]:[t]},value:{[n]:[u]}})}return[i,r]}var zC=["http://iiif.io/api/presentation/2/context.json","http://iiif.io/api/image/2/context.json","http://iiif.io/api/image/1/context.json","http://library.stanford.edu/iiif/image-api/1.1/context.json","http://iiif.io/api/search/1/context.json","http://iiif.io/api/search/0/context.json","http://iiif.io/api/auth/1/context.json","http://iiif.io/api/auth/0/context.json","http://iiif.io/api/annex/openannotation/context.json"];function DC(e){if(e){let t=Array.isArray(e)?e:[e],n=[];for(let i of t)i==="http://iiif.io/api/presentation/2/context.json"&&n.push("http://iiif.io/api/presentation/3/context.json"),zC.indexOf(i)===-1&&n.push(i);if(t.length)return n.length===1?n[0]:n}}function BC(e){return e?e.map(t=>({label:po(t.label),value:po(t.value)})):[]}var tS=0;function oS(e,t){let n=encodeURI(e.id||e["@id"]||"").trim();return n&&t?`${n}/${t}`:n||(tS++,`http://example.org/${e["@type"]}${t?`/${t}`:""}/${tS}`)}function tr(e){let t=[...e.behavior||[]];e.viewingHint&&t.push(e.viewingHint);let n;return Array.isArray(e.motivation)?n=e.motivation.map(eS):e.motivation&&(n=eS(e.motivation)),{"@context":e["@context"]?DC(e["@context"]):void 0,id:(e["@id"]||oS(e)).trim(),type:Bp(e),behavior:t.length?t:void 0,height:e.height?e.height:void 0,width:e.width?e.width:void 0,motivation:n,viewingDirection:e.viewingDirection,profile:e.profile,format:e.format?e.format:void 0,duration:void 0,timeMode:void 0}}function nr(e){let[t,n]=NC(e.license),i=[...e.metadata?BC(e.metadata):[],...n];return{rights:t,metadata:i.length?i:void 0,label:e.label?po(e.label):void 0,requiredStatement:e.attribution?{label:po(zp.attributionLabel),value:po(e.attribution)}:void 0,navDate:e.navDate,summary:e.description?po(e.description):void 0,thumbnail:VC(e.thumbnail)}}function VC(e){return e&&(Array.isArray(e)?e:[e]).map(n=>typeof n=="string"?{id:n,type:"Image"}:(n.type==="unknown"&&(n.type="Image"),n))}function jC(e){if(!e.within)return;let t=Array.isArray(e.within)?e.within:[e.within],n=[];for(let i of t)if(typeof i=="string"){if(i)switch(e["@type"]){case"sc:Manifest":n.push({id:i,type:"Collection"});break}}else i["@id"]&&n.push({id:i["@id"],type:Bp(i)});return n.length?n:void 0}function Er(e){let t=e.related?Array.isArray(e.related)?e.related:[e.related]:[],n=e.contentLayer;return{provider:e.logo||t.length?[{id:zp.providerId,type:"Agent",homepage:t.length?[t[0]]:void 0,logo:e.logo?Array.isArray(e.logo)?e.logo:[e.logo]:void 0,label:po(zp.providerName)}]:void 0,partOf:jC(e),rendering:e.rendering,seeAlso:e.seeAlso,start:e.startCanvas,service:e.service?yi(e.service):void 0,supplementary:n?[n]:void 0}}function HC(e){return{chars:e.chars,format:e.format?e.format:void 0,language:e.language}}function Np(e,t){return e?typeof e=="string"?{id:e,type:t}:typeof e?.["@id"]=="string"?{id:e["@id"],type:t}:typeof e.id=="string"?{id:e.id,type:t}:null:null}function WC(e){let t={};if(e.first){let n=Np(e.first,"Collection");n&&(t.first=n)}if((e.total||e.total===0)&&(t.total=e.total),e.prev){let n=Np(e.prev,"Collection");n&&(t.prev=n)}if(e.next){let n=Np(e.next,"Collection");n&&(t.next=n)}return t}function UC(e){let t=[];for(let n of e){let i={...n};i.items&&i.items.length===0&&delete i.items,t.push(i)}return t}function qC(e){return vi({...tr(e),...nr(e),...Er(e),...WC(e),items:UC(e.members)})}function GC(e){let t=[],n=[],i,r;for(let l of e.sequences||[])l.canvases.length&&t.push(...l.canvases),l.behavior&&n.push(...l.behavior),l.viewingDirection&&(r=l.viewingDirection),l.startCanvas&&(i=l.startCanvas);let s=tr(e);return n.length&&(s.behavior?s.behavior.push(...n):s.behavior=n),vi({...s,...nr(e),...Er(e),viewingDirection:r,start:i,items:t,structures:$C(e.structures)})}function $C(e){if(!e)return e;let t=new Map;for(let i of e)t.set(i.id,i);let n=[];for(let i of e)if(i.items){let r=i.items.map(s=>typeof s=="string"?(n.push(s),t.get(s)||s):s&&s.id?(n.push(s.id),t.get(s.id)||s):s);i.items=r}return e.filter(i=>n.indexOf(i.id)===-1)}function QC(e){return vi({...tr(e),...nr(e),...Er(e),annotations:e.otherContent&&e.otherContent.length?e.otherContent:void 0,items:e.images&&e.images.length?[{id:oS(e,"annotation-page"),type:"AnnotationPage",items:e.images}]:void 0})}function YC(e){return vi({...tr(e),...nr(e),...Er(e),items:e.resources&&e.resources.length?e.resources:void 0})}function KC(e){return!e.canvases||e.canvases.length===0?{canvases:[],behavior:[]}:{canvases:e.canvases,behavior:e.viewingHint?[e.viewingHint]:[],viewingDirection:e.viewingDirection,startCanvas:e.startCanvas}}function XC(e){function t(n){if(Array.isArray(n)){if(n.length>1)return{type:"List",items:n.map(t)};n=n[0]}if(typeof n=="string")return encodeURI(n).trim();if("@type"in n){let i;if(typeof n.full=="string")i=n.full;else if(n.full["@type"]==="dctypes:Image")i={id:n.full["@id"],type:"Image"};else if(n.full["@type"]==="sc:Canvas")i={id:n.full["@id"],type:"Canvas"};else throw Error(`Unsupported source type on annotation: ${n.full["@type"]}`);return{type:"SpecificResource",source:i,selector:Dp(n.selector)}}else return encodeURI(n["@id"]).trim()}return vi({...tr(e),...nr(e),...Er(e),target:t(e.on),body:Array.isArray(e.resource)?e.resource.map(nS):nS(e.resource)})}function nS(e){return e.type==="Choice"?e:sS(e)}function sS(e){let t=e;return vi({...tr(t),...nr(t),...Er(t),...HC(t)})}function ZC(e){let t=[];return e.default&&e.default!=="rdf:nil"&&t.push(e.default),e.item&&e.item!=="rdf:nil"&&t.push(...e.item),vi({...tr(e),...nr(e),items:t})}function JC(e){return vi({...tr(e),...nr(e),...Er(e),items:e.members})}function eP(e){let{"@id":t,"@type":n,"@context":i,profile:r,...s}=e,l={};return t&&(l["@id"]=t),l["@type"]=Bp(e),l["@type"]==="unknown"&&(i&&i.length&&(l["@context"]=i),l["@type"]="Service"),r&&(l.profile=rS(r)),vi({...l,...s})}function tP(e){return vi({...tr(e),...nr(e),...Er(e)})}var nP=new AC({collection:[qC],manifest:[GC],canvas:[QC],annotationList:[YC],sequence:[KC],annotation:[XC],contentResource:[sS],choice:[ZC],range:[JC],service:[eP],layer:[tP]});function aS(e){return e&&e["@context"]&&(e["@context"]==="http://iiif.io/api/presentation/2/context.json"||e["@context"].indexOf("http://iiif.io/api/presentation/2/context.json")!==-1||e["@context"]==="http://www.shared-canvas.org/ns/context.json")||e["@context"]==="http://iiif.io/api/image/2/context.json"||e["@id"]&&e["@type"]==="sc:Collection"||e["@id"]&&e["@type"]==="sc:Manifest"?(e["@context"]||(e["@context"]="http://iiif.io/api/presentation/2/context.json"),nP.traverseUnknown(e)):e}function Dp(e){if((Array.isArray(e["@type"])&&e["@type"].includes("oa:SvgSelector")||e["@type"]=="oa:SvgSelector")&&("chars"in e||"value"in e))return{type:"SvgSelector",value:"chars"in e?e.chars:e.value};if(e["@type"]==="oa:FragmentSelector")return{type:"FragmentSelector",value:e.value};if(e["@type"]==="oa:Choice")return[Dp(e.default),...(Array.isArray(e.item)?e.item:[e.item]).map(Dp)];if(e["@type"]=="iiif:ImageApiSelector")return{type:"ImageApiSelector",region:"region"in e?e.region:void 0,rotation:"rotation"in e?e.rotation:void 0};throw Error(`Unsupported selector type: ${e["@type"]}`)}function ja(e,t){let n=t||"unknown";if(!e)return;if(typeof e=="string")return{id:e,type:n};if(xi(e))return ja(e.source,t);let i=n&&n!=="unknown"?n:e.type||e["@type"],r=e.id||e["@id"];if(i&&i.indexOf(":")!==-1&&(i=i.split(":").pop()),r&&i)return{id:r,type:i}}var Ss={},St="iiif-parser:hasPart",Nn="iiif-parser:partOf",ws="iiif-parser:isExternal",ii="__$UNSET$__",Hp="__$UNWRAP$__",we=[];Object.freeze(we),Object.freeze(Ss);function cS(e){if(e===Ss||Object.keys(e).length===0)return!0;for(let t in e)return!1;return!0}function Rs(e,t){if(t&&t["@explicit"]){let n={},i=Object.keys(t);for(let r of i)r===Nn||r==="@explicit"||(cS(t[r])?n[r]=e[r]:n[r]=t[r]);return n}return e}function Wp(e,t,n){let i=ja(t);if(!i)return[void 0,void 0];let r=e.requests[i.id],s=i.type||e.mapping[i.id];if(!s||r&&r.resourceUri&&(!e.entities[s]||!e.entities[s][r.resourceUri]))return[void 0,void 0];let l=e.entities[s][r?r.resourceUri:i.id];if(i.type&&!l)return Wp(e,{id:i.id},n);if(l&&l[St]){let u=l[St].find(p=>n?p[Nn]===n.id:p[Nn]===l.id);return[Rs(l,u),l]}return[l,l]}var dS={id:"https://iiif-parser/annotation-page",type:"AnnotationPage",behavior:we,label:null,thumbnail:we,summary:null,requiredStatement:null,metadata:we,rights:null,provider:we,items:we,seeAlso:we,homepage:we,rendering:we,service:we},fS={id:"https://iiif-parser/empty-canvas",type:"Canvas",label:null,behavior:we,thumbnail:we,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:we,rights:null,navDate:null,provider:we,items:we,annotations:we,seeAlso:we,homepage:we,partOf:we,rendering:we,service:we,duration:0,height:0,width:0},hS={id:"https://iiif-parser/empty-collection",type:"Collection",label:null,viewingDirection:"left-to-right",behavior:we,thumbnail:we,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:we,rights:null,navDate:null,provider:we,items:we,annotations:we,seeAlso:we,homepage:we,partOf:we,rendering:we,service:we,services:we},pS={id:"https://iiif-parser/empty-manifest",type:"Manifest",annotations:we,behavior:we,homepage:we,items:we,label:null,metadata:we,navDate:null,provider:we,partOf:we,accompanyingCanvas:null,placeholderCanvas:null,rendering:we,requiredStatement:null,rights:null,seeAlso:we,service:we,services:we,start:null,structures:we,summary:null,thumbnail:we,viewingDirection:"left-to-right"},mS={id:"https://iiif-parser/empty-canvas",type:"Range",label:null,behavior:we,thumbnail:we,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:we,rights:null,navDate:null,provider:we,items:we,annotations:we,seeAlso:we,homepage:we,partOf:we,rendering:we,service:we,start:null,supplementary:null,viewingDirection:"left-to-right"},gS={id:"https://iiif-parser/empty-agent",type:"Agent",label:{},logo:we,seeAlso:we,homepage:we},yS={id:"https://iiif-parser/empty-service",type:"UnknownService"};function jp(e,t={}){if(Array.isArray(e))return jp(e[0]);if(typeof e=="string"){let[n,i]=e.split("#");return i?{type:"SpecificResource",source:{id:n,type:t.typeHint||"Unknown"},selector:{type:"FragmentSelector",value:i}}:{type:"SpecificResource",source:{id:n,type:t.typeMap&&t.typeMap[n]||t.typeHint||"Unknown"}}}if(e.type==="Choice"||e.type==="List"||e.type==="Composite"||e.type==="Independents")return jp(e.items[0]);if(!e.type&&"source"in e&&(e.type="SpecificResource"),e.type==="SpecificResource")return e.source.type==="Canvas"&&e.source.partOf&&typeof e.source.partOf=="string"&&(e.source.partOf=[{id:e.source.partOf,type:"Manifest"}]),e.selector?{type:"SpecificResource",source:e.source,selector:e.selector}:{type:"SpecificResource",source:e.source};if(e.id){e.type==="Canvas"&&e.partOf&&typeof e.partOf=="string"&&(e.partOf=[{id:e.partOf,type:"Manifest"}]);let[n,i]=e.id.split("#");return i?{type:"SpecificResource",source:{...e,id:n},selector:{type:"FragmentSelector",value:i}}:{type:"SpecificResource",source:{...e,id:n}}}return{type:"SpecificResource",source:e}}function vS(){return{Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{},Agent:{}}}function xS(e,t){if(typeof e=="string")return{id:e,type:t};if(!e.id)throw Error(`Invalid resource does not have an ID (${JSON.stringify(e)}, ${t})`);return e}function iP(e,t){return(n,i)=>{let r=e[n]?e[n]:{};return(s,l)=>{let u=xS(s,i||n);return u&&u.id&&n?(r[u.id]=r[u.id]?Rc(r[u.id],u,{parent:l.parent,isTopLevel:t.id===u.id}):Rc({id:u.id,type:u.type},u,{parent:l.parent,isTopLevel:t.id===u.id}),{id:u.id,type:n==="ContentResource"?n:u.type}):u}}}function bc(e,t,n){if(!t)return e;if(Array.isArray(e)){if(!Array.isArray(t))throw Error("Cannot merge array with non-array");let i=[...e];for(let r of t)if(r["@id"]&&!r.id&&(r.id=r["@id"]),r["@type"]&&!r.type&&(r.type=r["@type"]),r!=null)if(Array.isArray(r))i.push(r);else if(typeof r=="object"&&r.id&&r.type){let s=i.findIndex(l=>l.id===r.id&&l.type===r.type);s>=0&&(i[s]=bc(i[s],r))}else e.indexOf(r)===-1&&i.push(r);return i}else if(typeof e=="object"){if(Array.isArray(t)||typeof t!="object")throw Error("Cannot merge object with non-object");let i={...e},r=[],s=[],l=Object.keys(e).filter(p=>p!==St&&p!=="id"&&p!=="type"),u={},f={};for(let[p,c]of Object.entries(t)){if(p===St||p==="id"||p==="type")continue;let m=i[p];m===c?s.push(p):m===we||!m?(r.push(p),i[p]=c):(m&&c&&(u[p]=m,f[p]=c),i[p]=bc(m,c),i[p]===u[p]&&(s.push(p),delete u[p]))}if(n&&(n.parent&&n.parent.id||n.isTopLevel)){let p=[],c={};if(n.parent?c[Nn]=n.parent.id:n.isTopLevel&&(c[Nn]=e.id),i[St]&&i[St].length){let m=!(i[St]||[]).find(w=>w["@explicit"]),y=r.length>0||s.length!==l.length;if(m&&y)for(let w of i[St]){let v={...w},S=Object.keys(u);if(v){v["@explicit"]=!0;for(let E of l)E!==St&&(v[E]=Ss);for(let E of S)v[E]=u[E]}p.push(v)}else p.push(...i[St]);if(y){let w=Object.keys(f);c["@explicit"]=!0;for(let v of r)c[v]=Ss;for(let v of s)c[v]=Ss;for(let v of w)c[v]=f[v]}}c.id=i.id,c.type=i.type,p.push(c),i[St]=p}return i}else if(e)return e;return t}function Rc(e,t,n){if(typeof e=="string")return e;if(t.id!==e.id||t.type!==e.type){if(t.type==="ImageService3")return t;if(e.type==="ImageService3")return e;throw Error(`Can only merge entities with identical identifiers and type! ${t.type}(${t.id}) => ${e.type}(${e.id})`)}return bc({...e},t,n)}function rP(e){return(t,n)=>i=>{let{id:r,type:s}=xS(i,n||t);if(r===void 0)throw Error("Found invalid entity without an ID.");return t==="ContentResource"||t==="Service"?e[r]=t:e[r]=s,i}}function oP(e){let t=Object.assign({},e);if(t["@id"]&&(t.id=t["@id"]),t["@type"]&&(t.type=t["@type"]),t.service){let n=[];t.service=Array.isArray(t.service)?t.service:[t.service];for(let i of t.service)n.push({id:i["@id"]||i.id,type:i["@type"]||i.type});t.service=n}return Object.assign({},yS,t)}function sP(e){return t=>{e.Service=e.Service?e.Service:{};let n=t.id||t["@id"],i=oP(t);return i&&i.id&&(e.Service[i.id]?e.Service[n]=Rc(e.Service[n],i):e.Service[n]=i),t}}function aP(e){let t=JSON.stringify(e),n=5381,i=t.length;for(;i;)n=n*33^t.charCodeAt(--i);let r=n>>>0,s=r.toString(16);return s.length%2?"0"+s:s}function Vp(e){return t=>typeof t=="string"?{id:t,type:e}:t.id?t.type?t:{type:e,...t}:{id:`vault://${aP(t)}`,type:e,...t}}function xs(e){return t=>({...e,...t})}function Ba(e){return Array.isArray(e)?e:[e]}function lP(e){return e.body&&(e.body=Ba(e.body)),e.seeAlso&&(e.seeAlso=Ba(e.seeAlso)),e.audience&&(e.audience=Ba(e.audience)),e.accessibility&&(e.accessibility=Ba(e.accessibility)),e.motivation&&(e.motivation=Ba(e.motivation)),e}function SS(e,{typeHint:t,partOfTypeHint:n}={}){if(typeof e=="string"&&(e={id:e,type:t||"unknown"}),xi(e))return typeof e.source=="string"&&(e.source={id:e.source,type:t||"unknown"}),e.source.type==="Canvas"&&e.source.partOf&&typeof e.source.partOf=="string"&&(e.source.partOf=[{id:e.source.partOf,type:n||"Manifest"}]),e;let i;if((e.id||"").indexOf("#")!==-1){let[r,s]=(e.id||"").split("#");e.id=r,s&&(i={type:"FragmentSelector",value:s})}return{type:"SpecificResource",source:e,selector:i}}function uP(e){let t=Object.assign({},e);return e&&e.items&&(t.items=e.items.map(n=>typeof n=="string"||n.type==="Canvas"?SS(n):n)),t}function cP(e){let t=Object.assign({},e);return t.start?(t.start=SS(t.start,{typeHint:"Canvas"}),t):e}function dP(e){let t=Object.assign({},e);return t.target?(t.target=jp(t.target,{typeHint:"Canvas"}),t):e}function wS(e){return e}function wc(e){return e.items===void 0&&(e[ws]=!0),e}function Up(e){let t=aS(e),n=vS(),i={},r=iP(n,t),s=rP(i),l=new np({collection:[wc,xs(hS),s("Collection"),r("Collection")],manifest:[wc,xs(pS),cP,s("Manifest"),r("Manifest")],canvas:[xs(fS),s("Canvas"),r("Canvas")],annotationPage:[wc,Vp("AnnotationPage"),xs(dS),s("AnnotationPage"),r("AnnotationPage")],annotation:[Vp("Annotation"),lP,dP,s("Annotation"),r("Annotation")],contentResource:[Vp("ContentResource"),s("ContentResource"),r("ContentResource")],range:[xs(mS),uP,s("Range","Canvas"),r("Range","Canvas")],agent:[xs(gS),s("Agent"),r("Agent")],specificResource:[wS],service:[sP(n)]}),u=l.traverseUnknown(t);return{entities:n,resource:u,mapping:i}}function bS(e){let t={};for(let[n,i]of e){if(n===Hp&&i!==ii)return i;i!==ii&&i!=null&&(t[n]=i)}return t}function qp(e,t,n){if(!t.type||!t.id)throw Error("Unknown entity");if(!n[t.type])throw Error(`Serializer not found for ${t.type}`);function i(r,s,l=0){let u=n[r.type];if(!u)return ii;if(l>20)throw Error("Circular reference: "+r.id+" "+r.type);let[f,p]=Wp(e,r.type?r:r.id,s)||(r.id&&r.type?r:null);if(!f)return ii;let c=u(f,e,{parent:s,isTopLevel:t.id===r.id,fullResource:p}),m=c.next();for(;!m.done;){let y=m.value,w=ii;if(y)if(Array.isArray(y)){let v=[];for(let S of y)v.push(i(S,r,l+1));w=v}else w=i(y,r,l+1);m=c.next(w)}return m.value===ii?ii:bS(m.value)}return i(t)}function bs(e,{allowSourceString:t=!0,allowString:n=!1,allowedStringType:i}={}){let r=s=>{if(t&&s&&s.source&&typeof s.source!="string"){let l=Object.keys(s.source);if(s.source.id&&s.source.type&&l.length===2)return{...s,source:s.source.id}}return s};if(e){if(e.source&&e.source.partOf)return r(e);let s=Object.keys(e);if(s.length===2&&e.type&&e.source||s.length===3&&e.type&&e.source&&s.indexOf("selector")!==-1&&!e.selector)return n&&(!i||i===e.source.type)?e.source.id:e.source.type==="ContentResource"?{type:"SpecificResource",source:e.source.id}:e.source;if(e.selector&&!Array.isArray(e.selector)&&typeof e.selector!="string"&&e.selector.type==="FragmentSelector"){let l=`${e.source.id}#${e.selector.value}`;return n?l:{id:l,type:e.source.type}}}return r(e)}function vo(e){if(!e)return;let t=Object.keys(e);if(t.length!==0){if(t.length===1){let n=t[0];if(!n)return"";let i=(e[n]||[]).join("");return n==="@none"||n==="none"||n==="en"?i:{"@language":n,"@value":i}}return t.map(n=>({"@language":n,"@value":(e[n]||[]).join("")}))}}function RS(e){return Array.isArray(e)?e.map(t=>RS(t)):typeof e=="string"?e:e.type&&e.type==="Canvas"?e.id:e}function Pr(e,t=!1){if(e)return e.length>1&&!t?e:e[0]||void 0}function fP(e){if(e){if(typeof e=="string")return{"@id":e};if("@id"in e){let t={...e};return delete t["@type"],t}return{"@context":"http://iiif.io/api/image/2/context.json","@id":e.id,profile:`http://iiif.io/api/image/2/profiles/${e.profile}.json`}}}function mo(e,t){return[["@id",e.id],["@type",t],["format",e.format],["height",e.height],["width",e.width],["viewingDirection",e.viewingDirection==="left-to-right"?void 0:e.viewingDirection],["license",e.license?e.license:void 0]]}function*go(e){let t=e.provider?yield e.provider[0]:void 0;return[["label",vo(e.label)],["metadata",e.metadata&&e.metadata.length?e.metadata.map(n=>({label:vo(n.label)||"",value:vo(n.value)||""})):void 0],["description",vo(e.summary)],["thumbnail",Pr(yield e.thumbnail)],["navDate",e.navDate],["logo",t?Pr(t.logo):void 0],["homepage",t?t.homepage:void 0],["attribution",e.requiredStatement?vo(e.requiredStatement.value):void 0]]}function*Va(e){let t=e.start&&e.start.type&&e.start.type==="SpecificResource"?bs(e.start):e.start;return[["seeAlso",Pr(yield e.seeAlso)],["service",Pr((e.service||[]).map(fP))],["rendering",Pr(yield e.rendering)],["startCanvas",t?t.id:void 0]]}function hP(e){return e.type==="SpecificResource"}function pP(e){return e&&e.type==="FragmentSelector"}function mP(e){if(e&&hP(e)){let t=e.id,n=e.selector?Array.isArray(e.selector)?e.selector[0]:e.selector:void 0;return pP(n)&&(t+="#"+n.value),t}return e?.id}var Gp={Manifest:function*(e,t,{isTopLevel:n}){return[...n?[["@context","http://iiif.io/api/presentation/2/context.json"]]:[],...mo(e,"sc:Manifest"),...yield*go(e),...yield*Va(e),["sequences",[{"@id":`${e.id}/sequence0`,"@type":"sc:Sequence",canvases:yield e.items}]],["structures",yield e.structures]]},Canvas:function*(e){let t=yield e.items,n=t[0];return[...mo(e,"sc:Canvas"),...yield*go(e),...yield*Va(e),["images",n?[n.resources]:void 0],["annotations",e.annotations&&e.annotations.length?Pr(yield e.annotations):void 0]]},AnnotationPage:function*(e){return[...mo(e,"sc:AnnotationList"),...yield*go(e),["resources",e.items&&e.items.length?Pr(yield e.items):void 0]]},Annotation:function*(e){return[["@id",e.id],["@type","oa:Annotation"],["motivation","sc:painting"],["on",RS(e.target)],["resource",Pr(yield e.body,!0)]]},ContentResource:function*(e){switch(e.type){case"Image":return[...mo(e,"dctypes:Image"),...yield*go(e),...yield*Va(e)];case"Text":case"Dataset":default:return[...mo(e,void 0),...yield*go(e)]}},AnnotationCollection:function*(e){return[["@id",e.id],["@type","sc:Layer"],["label",vo(e.label)]]},Collection:function*(e){return[...mo(e,"sc:Collection"),...yield*go(e),...yield*Va(e),["members",yield*e.items]]},Range:function*(e){let t=[],n=[];if(e.items)for(let i of e.items){let r=i.type==="SpecificResource"?i.source:i;if(r){let s=yield r;t.push({"@id":mP(i),"@type":r.type,label:s?s.label:void 0,within:e.id}),r.type==="Canvas"&&n.push(r.id)}}return[...mo(e,"sc:Range"),...yield*go(e),...yield*Va(e),["canvases",n.length===t.length?n:void 0],["members",n.length===t.length?void 0:t]]}};function yo(e){return[["id",e.id?.startsWith("vault://")?void 0:e.id],["type",e.type],["format",e.format],["profile",e.profile],["height",e.height||void 0],["width",e.width||void 0],["duration",e.duration||void 0],["viewingDirection",e.viewingDirection==="left-to-right"?void 0:e.viewingDirection],["behavior",e.behavior&&e.behavior.length?e.behavior:void 0],["timeMode",e.timeMode],["motivation",Array.isArray(e.motivation)?e.motivation[0]:e.motivation],[St,ii]]}function Mt(e){if(e===ii||!e||e.length===0)return;let t=e.filter(n=>n!==ii);if(t.length!==0)return t}function ES(e){if(e&&e.type&&e.type==="ImageService2"){let{id:t,type:n,profile:i,...r}=e,s=typeof i=="string"?i:Array.isArray(i)?i.find(l=>typeof l=="string"):"";return{"@id":t,"@type":n,profile:s?s.startsWith("http")?s:`http://iiif.io/api/image/2/${s}.json`:"http://iiif.io/api/image/2/level0.json",...r}}return e}function lS(e){if(Array.isArray(e)||(e=e?[e]:[]),!(!e||e.length===0))return e.map(ES)}function*Ir(e){return[["label",e.label],["metadata",Mt(e.metadata)],["summary",e.summary],["requiredStatement",e.requiredStatement],["rights",Array.isArray(e.rights)?e.rights[0]||void 0:e.rights||void 0],["navDate",e.navDate],["language",e.language],["thumbnail",Mt(yield e.thumbnail)],["placeholderCanvas",yield e.placeholderCanvas],["accompanyingCanvas",yield e.accompanyingCanvas],["provider",Mt(yield e.provider)]]}function*Cr(e,t){let n=[];for(let i of e.partOf||[])i.type==="Manifest"&&t.type==="Manifest"||n.push(yield i);return[["seeAlso",Mt(yield e.seeAlso)],["service",Mt(lS(e.service))],["services",Mt(lS(e.services))],["rendering",Mt(yield e.rendering)],["supplementary",Mt(yield e.supplementary)],["homepage",Mt(yield e.homepage)],["logo",Mt(yield e.logo)],["partOf",Mt(n)],["start",e.start?bs(e.start):e.start]]}var $p={Manifest:function*(e,t,{isTopLevel:n}){if(!n)return[...yo(e),...yield*Ir(e),["navPlace",e.navPlace]];let i="http://iiif.io/api/presentation/3/context.json";return(e.navPlace||uS(e))&&(i=["http://iiif.io/api/presentation/3/context.json","http://iiif.io/api/extension/navplace/context.json"]),[["@context",e["@context"]?e["@context"]:i],...yo(e),...yield*Ir(e),...yield*Cr(e),["items",yield e.items],["structures",Mt(yield e.structures)],["annotations",Mt(yield e.annotations)],["navPlace",e.navPlace]]},Canvas:function*(e,t,{parent:n}){return n&&n.type!=="Manifest"&&n.type!=="Canvas"?[["id",e.id]]:[...yo(e),...yield*Ir(e),...yield*Cr(e,n),["items",yield e.items],["annotations",Mt(yield e.annotations)],["navPlace",e.navPlace]]},Agent:function*(e){return[["id",e.id],["type","Agent"],["label",e.label],...yield*Cr(e)]},AnnotationPage:function*(e){let t=Object.entries(e).map(([i,r])=>[i,Array.isArray(r)?Mt(r):r]).filter(([i,r])=>i!=="items"&&i!=="id"&&i!==St&&i!==Nn&&i!==ws),n=yield e.items;return[["id",e.id?.startsWith("vault://")?void 0:e.id],...t,...yield*Cr(e),["items",n.length||e[ws]===!1?n:ii]]},Service:function*(e){return[[Hp,ES(e)]]},Annotation:function*(e){let t=Object.entries(e).map(([i,r])=>i==="motivation"?[i,Array.isArray(r)?r[0]:r]:i==="target"?[i,bs(r,{allowString:!0,allowSourceString:!0,allowedStringType:"Canvas"})]:[i,Array.isArray(r)?Mt(r):r]).filter(([i])=>i!=="body"&&i!==St&&i!==ws),n;if(Array.isArray(e.body)){let i=[];for(let r of e.body)if(r&&xi(r)){let s={...r};r.source.type==="Canvas"?s.source=r.source:s.source=yield r.source,i.push(bs(s,{allowSourceString:!0}))}else i.push(yield r);n=i}else e.body&&xi(e.body)?(n={...e.body},n.source=yield e.body.source):n=yield e.body;return[...t,...yield*Ir(e),...yield*Cr(e),["body",n.length===1?n[0]:n]]},ContentResource:function*(e){return gP([...yo(e),...yield*Ir(e),...yield*Cr(e),["annotations",Mt(yield e.annotations)],["items",Mt(yield e.items)]],e)},AnnotationCollection:function*(e){return[["id",e.id],["type","AnnotationCollection"],["label",e.label]]},Collection:function*(e,t,{isTopLevel:n}){if(n){let i="http://iiif.io/api/presentation/3/context.json";return(e.navPlace||uS(e))&&(i=["http://iiif.io/api/extension/navplace/context.json","http://iiif.io/api/presentation/3/context.json"]),[["@context",i],...yo(e),...yield*Ir(e),...yield*Cr(e),["items",Mt(yield e.items)],["navPlace",e.navPlace]]}return[...yo(e),...yield*Ir(e),["navPlace",e.navPlace]]},Range:function*(e){let t=[];for(let n of e.items)n.type==="Range"?t.push(yield n):n&&n.type==="SpecificResource"?t.push(bs(n)):t.push(n);return[...yo(e),...yield*Ir(e),...yield*Cr(e),["items",t],["annotations",Mt(yield e.annotations)],["navPlace",e.navPlace]]}};function gP(e,t){let n=Object.keys(t),i=e.map(([r])=>r);for(let r of n)r===St||r===ws||i.indexOf(r)===-1&&t[r]!==void 0&&e.push([r,t[r]]);return e}function uS(e){if(!e.items||!Array.isArray(e.items))return!1;for(let t of e.items)if(t.navPlace)return!0;return!1}var yP=(e,t)=>{let{entities:n,resource:i,mapping:r}=Up(t);if(i.id===void 0)return[za({id:e,message:"ID is not defined in resource."})];let s=[cc({entities:n}),$h({mapping:r})];return i.id!==e&&(s.push(Gh({id:e,type:i.type})),s.push(Yh({requestId:e,actualId:i.id}))),s.push(Kh({id:e})),s},IS=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function vP(e,t){return!!(e===t||IS(e)&&IS(t))}function Yp(e,t){if(!Array.isArray(e)||!Array.isArray(t))return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!vP(e[n],t[n]))return!1;return!0}function Qp(e,t,n){let i=e.iiif.requests[t],r=e.iiif.mapping[t];if(!r||!e.iiif.entities[r][i.resourceUri])return;let s=e.iiif.entities[r][i.resourceUri];if(s&&s[St]){let l=s[St].find(u=>n?u[Nn]===n.id:u[Nn]===s.id);return Rs(s,l)}return s}function xP(e){return e&&typeof e.then=="function"}function Kp(e,t,{waitTimeout:n=30}={}){return(i,r,s)=>{let l=e.getStore(),u=l.getState(),f=u.iiif.requests[i];if(f){if(f.loadingState===ms){let c=Qp(u,i);if(c)return c}switch(f.loadingState){case ps:break;case Na:return(async()=>{let c,m=!1;try{let y=await Promise.race([new Promise((w,v)=>{m||(c=l.subscribe(()=>{let S=l.getState();if(S.iiif.requests[i].loadingState===ps){v();return}if(S.iiif.requests[i].loadingState===ms){let E=Qp(S,i);E?w(E):v()}}))}),new Promise((w,v)=>setTimeout(()=>{m=!0,v()},n*60*1e3))]);if(c&&c(),y)return y}catch{c&&c()}})()}}e.dispatch(Qh({id:i}));let p=c=>{if(!c)return;!c.id&&!c["@id"]&&(c["@type"]&&(c["@id"]=i),c.id=i);let m=yP(i,c);return e.dispatch(ys({actions:m})),Qp(l.getState(),i)};try{let c=t(i,r);return xP(c)?(async()=>{try{let m=await c;return s&&(m=s(m)),p(m)}catch(m){throw e.dispatch(za({id:i,message:m.toString()})),m}})():p(s?s(c):c)}catch(c){throw e.dispatch(za({id:i,message:c.toString()})),c}}}function Xp(){return{Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{},Agent:{}}}var Es={},SP=(e,t)=>(n,i,r)=>(r.dispatch=s=>(n(l=>e(l,s),!1,s),s),r.dispatchFromDevtools=!0,{dispatch:(...s)=>r.dispatch(...s),...t}),wP=SP,em=new Map,Ec=e=>{let t=em.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([n,i])=>[n,i.getState()])):{}},bP=(e,t,n)=>{if(e===void 0)return{type:"untracked",connection:t.connect(n)};let i=em.get(n.name);if(i)return{type:"tracked",store:e,...i};let r={connection:t.connect(n),stores:{}};return em.set(n.name,r),{type:"tracked",store:e,...r}},RP=(e,t={})=>(n,i,r)=>{let{enabled:s,anonymousActionType:l,store:u,...f}=t,p;try{p=(s??(Es.env?Es.env.MODE:void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!p)return(Es.env?Es.env.MODE:void 0)!=="production"&&s&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),e(n,i,r);let{connection:c,...m}=bP(u,p,f),y=!0;r.setState=(S,E,R)=>{let b=n(S,E);if(!y)return b;let I=R===void 0?{type:l||"anonymous"}:typeof R=="string"?{type:R}:R;return u===void 0?(c?.send(I,i()),b):(c?.send({...I,type:`${u}/${I.type}`},{...Ec(f.name),[u]:r.getState()}),b)};let w=(...S)=>{let E=y;y=!1,n(...S),y=E},v=e(r.setState,i,r);if(m.type==="untracked"?c?.init(v):(m.stores[m.store]=r,c?.init(Object.fromEntries(Object.entries(m.stores).map(([S,E])=>[S,S===m.store?v:E.getState()])))),r.dispatchFromDevtools&&typeof r.dispatch=="function"){let S=!1,E=r.dispatch;r.dispatch=(...R)=>{(Es.env?Es.env.MODE:void 0)!=="production"&&R[0].type==="__setState"&&!S&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),S=!0),E(...R)}}return c.subscribe(S=>{var E;switch(S.type){case"ACTION":if(typeof S.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return Zp(S.payload,R=>{if(R.type==="__setState"){if(u===void 0){w(R.state);return}Object.keys(R.state).length!==1&&console.error(`
12
+ `)+r.join(" > ")}return null},qt.getPublicRootInstance=function(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 27:case 5:return Tf(r.child.stateNode);default:return r.child.stateNode}},qt.injectIntoDevTools=function(){var r={bundleType:0,version:u5,rendererPackageName:c5,currentDispatcherRef:Ct,reconcilerVersion:"19.2.0"};if(lw!==null&&(r.rendererConfig=lw),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")r=!1;else{var l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(l.isDisabled||!l.supportsFiber)r=!0;else{try{Mf=l.inject(r),Vi=l}catch{}r=!!l.checkDCE}}return r},qt.isAlreadyRendering=function(){return(Ft&6)!==0},qt.observeVisibleRects=function(r,l,c,h){if(!Cf)throw Error(i(363));r=eS(r,l);var y=L5(r,c,h).disconnect;return{disconnect:function(){y()}}},qt.shouldError=function(){return null},qt.shouldSuspend=function(){return!1},qt.startHostTransition=function(r,l,c,h){if(r.tag!==5)throw Error(i(476));var y=UT(r).queue;HT(r,y,l,ru,c===null?n:function(){var b=UT(r);return b.next===null&&(b=r.alternate.memoizedState),yf(r,b.next.queue,{},Pi()),c(h)})},qt.updateContainer=function(r,l,c,h){var y=l.current,b=Pi();return nw(y,b,r,l,c,h),b},qt.updateContainerSync=function(r,l,c,h){return nw(l.current,2,r,l,c,h),2},qt};sd.exports.default=sd.exports;Object.defineProperty(sd.exports,"__esModule",{value:!0})});var $M=li((bY,WM)=>{"use strict";WM.exports=JM()});var ms=li((VY,FO)=>{"use strict";FO.exports=ReactDOM});var eI=li(zy=>{"use strict";var Cn=Mb(),mz=X(),_U=ms();function J(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function gz(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Zd(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function yz(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function vz(t){if(t.tag===31){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function GO(t){if(Zd(t)!==t)throw Error(J(188))}function zU(t){var e=t.alternate;if(!e){if(e=Zd(t),e===null)throw Error(J(188));return e!==t?null:t}for(var n=t,i=e;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return GO(a),t;if(o===i)return GO(a),e;o=o.sibling}throw Error(J(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,u=a.child;u;){if(u===n){s=!0,n=a,i=o;break}if(u===i){s=!0,i=a,n=o;break}u=u.sibling}if(!s){for(u=o.child;u;){if(u===n){s=!0,n=o,i=a;break}if(u===i){s=!0,i=o,n=a;break}u=u.sibling}if(!s)throw Error(J(189))}}if(n.alternate!==i)throw Error(J(190))}if(n.tag!==3)throw Error(J(188));return n.stateNode.current===n?t:e}function Sz(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t;for(t=t.child;t!==null;){if(e=Sz(t),e!==null)return e;t=t.sibling}return null}var _e=Object.assign,NU=Symbol.for("react.element"),lg=Symbol.for("react.transitional.element"),vd=Symbol.for("react.portal"),nc=Symbol.for("react.fragment"),bz=Symbol.for("react.strict_mode"),gx=Symbol.for("react.profiler"),xz=Symbol.for("react.consumer"),Qo=Symbol.for("react.context"),fE=Symbol.for("react.forward_ref"),yx=Symbol.for("react.suspense"),vx=Symbol.for("react.suspense_list"),dE=Symbol.for("react.memo"),qr=Symbol.for("react.lazy");Symbol.for("react.scope");var Sx=Symbol.for("react.activity");Symbol.for("react.legacy_hidden");Symbol.for("react.tracing_marker");var IU=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var kO=Symbol.iterator;function fd(t){return t===null||typeof t!="object"?null:(t=kO&&t[kO]||t["@@iterator"],typeof t=="function"?t:null)}var DU=Symbol.for("react.client.reference");function bx(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===DU?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case nc:return"Fragment";case gx:return"Profiler";case bz:return"StrictMode";case yx:return"Suspense";case vx:return"SuspenseList";case Sx:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case vd:return"Portal";case Qo:return t.displayName||"Context";case xz:return(t._context.displayName||"Context")+".Consumer";case fE:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case dE:return e=t.displayName||null,e!==null?e:bx(t.type)||"Memo";case qr:e=t._payload,t=t._init;try{return bx(t(e))}catch{}}return null}var Sd=Array.isArray,Ot=mz.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le=_U.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,xs={pending:!1,data:null,method:null,action:null},xx=[],ic=-1;function mo(t){return{current:t}}function Dn(t){0>ic||(t.current=xx[ic],xx[ic]=null,ic--)}function Ce(t,e){ic++,xx[ic]=t.current,t.current=e}var po=mo(null),Bd=mo(null),$r=mo(null),Vg=mo(null);function jg(t,e){switch(Ce($r,e),Ce(Bd,t),Ce(po,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?W_(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=W_(e),t=j3(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Dn(po),Ce(po,t)}function xc(){Dn(po),Dn(Bd),Dn($r)}function Ex(t){t.memoizedState!==null&&Ce(Vg,t);var e=po.current,n=j3(e,t.type);e!==n&&(Ce(Bd,t),Ce(po,n))}function qg(t){Bd.current===t&&(Dn(po),Dn(Bd)),Vg.current===t&&(Dn(Vg),Qd._currentValue=xs)}var Pb,YO;function ys(t){if(Pb===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Pb=e&&e[1]||"",YO=-1<n.stack.indexOf(`
13
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
14
+ `+Pb+t+YO}var Hb=!1;function Ub(t,e){if(!t||Hb)return"";Hb=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(e){var m=function(){throw Error()};if(Object.defineProperty(m.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(m,[])}catch(v){var g=v}Reflect.construct(t,[],m)}else{try{m.call()}catch(v){g=v}t.call(m.prototype)}}else{try{throw Error()}catch(v){g=v}(m=t())&&typeof m.catch=="function"&&m.catch(function(){})}}catch(v){if(v&&g&&typeof v.stack=="string")return[v.stack,g.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=i.DetermineComponentFrameRoot(),s=o[0],u=o[1];if(s&&u){var d=s.split(`
15
+ `),p=u.split(`
16
+ `);for(a=i=0;i<d.length&&!d[i].includes("DetermineComponentFrameRoot");)i++;for(;a<p.length&&!p[a].includes("DetermineComponentFrameRoot");)a++;if(i===d.length||a===p.length)for(i=d.length-1,a=p.length-1;1<=i&&0<=a&&d[i]!==p[a];)a--;for(;1<=i&&0<=a;i--,a--)if(d[i]!==p[a]){if(i!==1||a!==1)do if(i--,a--,0>a||d[i]!==p[a]){var f=`
17
+ `+d[i].replace(" at new "," at ");return t.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",t.displayName)),f}while(1<=i&&0<=a);break}}}finally{Hb=!1,Error.prepareStackTrace=n}return(n=t?t.displayName||t.name:"")?ys(n):""}function LU(t,e){switch(t.tag){case 26:case 27:case 5:return ys(t.type);case 16:return ys("Lazy");case 13:return t.child!==e&&e!==null?ys("Suspense Fallback"):ys("Suspense");case 19:return ys("SuspenseList");case 0:case 15:return Ub(t.type,!1);case 11:return Ub(t.type.render,!1);case 1:return Ub(t.type,!0);case 31:return ys("Activity");default:return""}}function QO(t){try{var e="",n=null;do e+=LU(t,n),n=t,t=t.return;while(t);return e}catch(i){return`
18
+ Error generating stack: `+i.message+`
19
+ `+i.stack}}var Rx=Object.prototype.hasOwnProperty,hE=Cn.unstable_scheduleCallback,Vb=Cn.unstable_cancelCallback,BU=Cn.unstable_shouldYield,PU=Cn.unstable_requestPaint,ea=Cn.unstable_now,HU=Cn.unstable_getCurrentPriorityLevel,Ez=Cn.unstable_ImmediatePriority,Rz=Cn.unstable_UserBlockingPriority,Fg=Cn.unstable_NormalPriority,UU=Cn.unstable_LowPriority,Az=Cn.unstable_IdlePriority,VU=Cn.log,jU=Cn.unstable_setDisableYieldValue,Jd=null,na=null;function Xr(t){if(typeof VU=="function"&&jU(t),na&&typeof na.setStrictMode=="function")try{na.setStrictMode(Jd,t)}catch{}}var ia=Math.clz32?Math.clz32:GU,qU=Math.log,FU=Math.LN2;function GU(t){return t>>>=0,t===0?32:31-(qU(t)/FU|0)|0}var sg=256,ug=262144,cg=4194304;function vs(t){var e=t&42;if(e!==0)return e;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function my(t,e,n){var i=t.pendingLanes;if(i===0)return 0;var a=0,o=t.suspendedLanes,s=t.pingedLanes;t=t.warmLanes;var u=i&134217727;return u!==0?(i=u&~o,i!==0?a=vs(i):(s&=u,s!==0?a=vs(s):n||(n=u&~t,n!==0&&(a=vs(n))))):(u=i&~o,u!==0?a=vs(u):s!==0?a=vs(s):n||(n=i&~t,n!==0&&(a=vs(n)))),a===0?0:e!==0&&e!==a&&!(e&o)&&(o=a&-a,n=e&-e,o>=n||o===32&&(n&4194048)!==0)?e:a}function Wd(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function kU(t,e){switch(t){case 1:case 2:case 4:case 8:case 64:return e+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Tz(){var t=cg;return cg<<=1,!(cg&62914560)&&(cg=4194304),t}function jb(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function $d(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function YU(t,e,n,i,a,o){var s=t.pendingLanes;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=n,t.entangledLanes&=n,t.errorRecoveryDisabledLanes&=n,t.shellSuspendCounter=0;var u=t.entanglements,d=t.expirationTimes,p=t.hiddenUpdates;for(n=s&~n;0<n;){var f=31-ia(n),m=1<<f;u[f]=0,d[f]=-1;var g=p[f];if(g!==null)for(p[f]=null,f=0;f<g.length;f++){var v=g[f];v!==null&&(v.lane&=-536870913)}n&=~m}i!==0&&Cz(t,i,0),o!==0&&a===0&&t.tag!==0&&(t.suspendedLanes|=o&~(s&~e))}function Cz(t,e,n){t.pendingLanes|=e,t.suspendedLanes&=~e;var i=31-ia(e);t.entangledLanes|=e,t.entanglements[i]=t.entanglements[i]|1073741824|n&261930}function wz(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var i=31-ia(n),a=1<<i;a&e|t[i]&e&&(t[i]|=e),n&=~a}}function Mz(t,e){var n=e&-e;return n=n&42?1:pE(n),n&(t.suspendedLanes|e)?0:n}function pE(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function mE(t){return t&=-t,2<t?8<t?t&134217727?32:268435456:8:2}function Oz(){var t=le.p;return t!==0?t:(t=window.event,t===void 0?32:W3(t.type))}function XO(t,e){var n=le.p;try{return le.p=t,e()}finally{le.p=n}}var dl=Math.random().toString(36).slice(2),Fn="__reactFiber$"+dl,_i="__reactProps$"+dl,Nc="__reactContainer$"+dl,Ax="__reactEvents$"+dl,QU="__reactListeners$"+dl,XU="__reactHandles$"+dl,KO="__reactResources$"+dl,th="__reactMarker$"+dl;function gE(t){delete t[Fn],delete t[_i],delete t[Ax],delete t[QU],delete t[XU]}function ac(t){var e=t[Fn];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Nc]||n[Fn]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=iz(t);t!==null;){if(n=t[Fn])return n;t=iz(t)}return e}t=n,n=t.parentNode}return null}function Ic(t){if(t=t[Fn]||t[Nc]){var e=t.tag;if(e===5||e===6||e===13||e===31||e===26||e===27||e===3)return t}return null}function bd(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t.stateNode;throw Error(J(33))}function pc(t){var e=t[KO];return e||(e=t[KO]={hoistableStyles:new Map,hoistableScripts:new Map}),e}function In(t){t[th]=!0}var _z=new Set,zz={};function zs(t,e){Ec(t,e),Ec(t+"Capture",e)}function Ec(t,e){for(zz[t]=e,t=0;t<e.length;t++)_z.add(e[t])}var KU=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),ZO={},JO={};function ZU(t){return Rx.call(JO,t)?!0:Rx.call(ZO,t)?!1:KU.test(t)?JO[t]=!0:(ZO[t]=!0,!1)}function Tg(t,e,n){if(ZU(e))if(n===null)t.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":t.removeAttribute(e);return;case"boolean":var i=e.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){t.removeAttribute(e);return}}t.setAttribute(e,""+n)}}function fg(t,e,n){if(n===null)t.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(e);return}t.setAttribute(e,""+n)}}function Vo(t,e,n,i){if(i===null)t.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttributeNS(e,n,""+i)}}function Ra(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Nz(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function JU(t,e,n){var i=Object.getOwnPropertyDescriptor(t.constructor.prototype,e);if(!t.hasOwnProperty(e)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var a=i.get,o=i.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return a.call(this)},set:function(s){n=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Tx(t){if(!t._valueTracker){var e=Nz(t)?"checked":"value";t._valueTracker=JU(t,e,""+t[e])}}function Iz(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),i="";return t&&(i=Nz(t)?t.checked?"true":"false":t.value),t=i,t!==n?(e.setValue(t),!0):!1}function Gg(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var WU=/[\n"\\]/g;function Ca(t){return t.replace(WU,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function Cx(t,e,n,i,a,o,s,u){t.name="",s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?t.type=s:t.removeAttribute("type"),e!=null?s==="number"?(e===0&&t.value===""||t.value!=e)&&(t.value=""+Ra(e)):t.value!==""+Ra(e)&&(t.value=""+Ra(e)):s!=="submit"&&s!=="reset"||t.removeAttribute("value"),e!=null?wx(t,s,Ra(e)):n!=null?wx(t,s,Ra(n)):i!=null&&t.removeAttribute("value"),a==null&&o!=null&&(t.defaultChecked=!!o),a!=null&&(t.checked=a&&typeof a!="function"&&typeof a!="symbol"),u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"?t.name=""+Ra(u):t.removeAttribute("name")}function Dz(t,e,n,i,a,o,s,u){if(o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(t.type=o),e!=null||n!=null){if(!(o!=="submit"&&o!=="reset"||e!=null)){Tx(t);return}n=n!=null?""+Ra(n):"",e=e!=null?""+Ra(e):n,u||e===t.value||(t.value=e),t.defaultValue=e}i=i??a,i=typeof i!="function"&&typeof i!="symbol"&&!!i,t.checked=u?t.checked:!!i,t.defaultChecked=!!i,s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(t.name=s),Tx(t)}function wx(t,e,n){e==="number"&&Gg(t.ownerDocument)===t||t.defaultValue===""+n||(t.defaultValue=""+n)}function mc(t,e,n,i){if(t=t.options,e){e={};for(var a=0;a<n.length;a++)e["$"+n[a]]=!0;for(n=0;n<t.length;n++)a=e.hasOwnProperty("$"+t[n].value),t[n].selected!==a&&(t[n].selected=a),a&&i&&(t[n].defaultSelected=!0)}else{for(n=""+Ra(n),e=null,a=0;a<t.length;a++){if(t[a].value===n){t[a].selected=!0,i&&(t[a].defaultSelected=!0);return}e!==null||t[a].disabled||(e=t[a])}e!==null&&(e.selected=!0)}}function Lz(t,e,n){if(e!=null&&(e=""+Ra(e),e!==t.value&&(t.value=e),n==null)){t.defaultValue!==e&&(t.defaultValue=e);return}t.defaultValue=n!=null?""+Ra(n):""}function Bz(t,e,n,i){if(e==null){if(i!=null){if(n!=null)throw Error(J(92));if(Sd(i)){if(1<i.length)throw Error(J(93));i=i[0]}n=i}n==null&&(n=""),e=n}n=Ra(e),t.defaultValue=n,i=t.textContent,i===n&&i!==""&&i!==null&&(t.value=i),Tx(t)}function Rc(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var $U=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function WO(t,e,n){var i=e.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?i?t.setProperty(e,""):e==="float"?t.cssFloat="":t[e]="":i?t.setProperty(e,n):typeof n!="number"||n===0||$U.has(e)?e==="float"?t.cssFloat=n:t[e]=(""+n).trim():t[e]=n+"px"}function Pz(t,e,n){if(e!=null&&typeof e!="object")throw Error(J(62));if(t=t.style,n!=null){for(var i in n)!n.hasOwnProperty(i)||e!=null&&e.hasOwnProperty(i)||(i.indexOf("--")===0?t.setProperty(i,""):i==="float"?t.cssFloat="":t[i]="");for(var a in e)i=e[a],e.hasOwnProperty(a)&&n[a]!==i&&WO(t,a,i)}else for(var o in e)e.hasOwnProperty(o)&&WO(t,o,e[o])}function yE(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var tV=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),eV=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Cg(t){return eV.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Xo(){}var Mx=null;function vE(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var oc=null,gc=null;function $O(t){var e=Ic(t);if(e&&(t=e.stateNode)){var n=t[_i]||null;t:switch(t=e.stateNode,e.type){case"input":if(Cx(t,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Ca(""+e)+'"][type="radio"]'),e=0;e<n.length;e++){var i=n[e];if(i!==t&&i.form===t.form){var a=i[_i]||null;if(!a)throw Error(J(90));Cx(i,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(e=0;e<n.length;e++)i=n[e],i.form===t.form&&Iz(i)}break t;case"textarea":Lz(t,n.value,n.defaultValue);break t;case"select":e=n.value,e!=null&&mc(t,!!n.multiple,e,!1)}}}var qb=!1;function Hz(t,e,n){if(qb)return t(e,n);qb=!0;try{var i=t(e);return i}finally{if(qb=!1,(oc!==null||gc!==null)&&(wy(),oc&&(e=oc,t=gc,gc=oc=null,$O(e),t)))for(e=0;e<t.length;e++)$O(t[e])}}function Pd(t,e){var n=t.stateNode;if(n===null)return null;var i=n[_i]||null;if(i===null)return null;n=i[e];t:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(t=t.type,i=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!i;break t;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(J(231,e,typeof n));return n}var $o=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ox=!1;if($o)try{Ju={},Object.defineProperty(Ju,"passive",{get:function(){Ox=!0}}),window.addEventListener("test",Ju,Ju),window.removeEventListener("test",Ju,Ju)}catch{Ox=!1}var Ju,Kr=null,SE=null,wg=null;function Uz(){if(wg)return wg;var t,e=SE,n=e.length,i,a="value"in Kr?Kr.value:Kr.textContent,o=a.length;for(t=0;t<n&&e[t]===a[t];t++);var s=n-t;for(i=1;i<=s&&e[n-i]===a[o-i];i++);return wg=a.slice(t,1<i?1-i:void 0)}function Mg(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function dg(){return!0}function t_(){return!1}function zi(t){function e(n,i,a,o,s){this._reactName=n,this._targetInst=a,this.type=i,this.nativeEvent=o,this.target=s,this.currentTarget=null;for(var u in t)t.hasOwnProperty(u)&&(n=t[u],this[u]=n?n(o):o[u]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?dg:t_,this.isPropagationStopped=t_,this}return _e(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=dg)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=dg)},persist:function(){},isPersistent:dg}),e}var Ns={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gy=zi(Ns),eh=_e({},Ns,{view:0,detail:0}),nV=zi(eh),Fb,Gb,dd,yy=_e({},eh,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:bE,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==dd&&(dd&&t.type==="mousemove"?(Fb=t.screenX-dd.screenX,Gb=t.screenY-dd.screenY):Gb=Fb=0,dd=t),Fb)},movementY:function(t){return"movementY"in t?t.movementY:Gb}}),e_=zi(yy),iV=_e({},yy,{dataTransfer:0}),aV=zi(iV),oV=_e({},eh,{relatedTarget:0}),kb=zi(oV),rV=_e({},Ns,{animationName:0,elapsedTime:0,pseudoElement:0}),lV=zi(rV),sV=_e({},Ns,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),uV=zi(sV),cV=_e({},Ns,{data:0}),n_=zi(cV),fV={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},dV={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},hV={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function pV(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=hV[t])?!!e[t]:!1}function bE(){return pV}var mV=_e({},eh,{key:function(t){if(t.key){var e=fV[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Mg(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?dV[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:bE,charCode:function(t){return t.type==="keypress"?Mg(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Mg(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),gV=zi(mV),yV=_e({},yy,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),i_=zi(yV),vV=_e({},eh,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:bE}),SV=zi(vV),bV=_e({},Ns,{propertyName:0,elapsedTime:0,pseudoElement:0}),xV=zi(bV),EV=_e({},yy,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),RV=zi(EV),AV=_e({},Ns,{newState:0,oldState:0}),TV=zi(AV),CV=[9,13,27,32],xE=$o&&"CompositionEvent"in window,Rd=null;$o&&"documentMode"in document&&(Rd=document.documentMode);var wV=$o&&"TextEvent"in window&&!Rd,Vz=$o&&(!xE||Rd&&8<Rd&&11>=Rd),a_=" ",o_=!1;function jz(t,e){switch(t){case"keyup":return CV.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qz(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var rc=!1;function MV(t,e){switch(t){case"compositionend":return qz(e);case"keypress":return e.which!==32?null:(o_=!0,a_);case"textInput":return t=e.data,t===a_&&o_?null:t;default:return null}}function OV(t,e){if(rc)return t==="compositionend"||!xE&&jz(t,e)?(t=Uz(),wg=SE=Kr=null,rc=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Vz&&e.locale!=="ko"?null:e.data;default:return null}}var _V={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function r_(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!_V[t.type]:e==="textarea"}function Fz(t,e,n,i){oc?gc?gc.push(i):gc=[i]:oc=i,e=sy(e,"onChange"),0<e.length&&(n=new gy("onChange","change",null,n,i),t.push({event:n,listeners:e}))}var Ad=null,Hd=null;function zV(t){H3(t,0)}function vy(t){var e=bd(t);if(Iz(e))return t}function l_(t,e){if(t==="change")return e}var Gz=!1;$o&&($o?(pg="oninput"in document,pg||(Yb=document.createElement("div"),Yb.setAttribute("oninput","return;"),pg=typeof Yb.oninput=="function"),hg=pg):hg=!1,Gz=hg&&(!document.documentMode||9<document.documentMode));var hg,pg,Yb;function s_(){Ad&&(Ad.detachEvent("onpropertychange",kz),Hd=Ad=null)}function kz(t){if(t.propertyName==="value"&&vy(Hd)){var e=[];Fz(e,Hd,t,vE(t)),Hz(zV,e)}}function NV(t,e,n){t==="focusin"?(s_(),Ad=e,Hd=n,Ad.attachEvent("onpropertychange",kz)):t==="focusout"&&s_()}function IV(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return vy(Hd)}function DV(t,e){if(t==="click")return vy(e)}function LV(t,e){if(t==="input"||t==="change")return vy(e)}function BV(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var oa=typeof Object.is=="function"?Object.is:BV;function Ud(t,e){if(oa(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),i=Object.keys(e);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var a=n[i];if(!Rx.call(e,a)||!oa(t[a],e[a]))return!1}return!0}function u_(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function c_(t,e){var n=u_(t);t=0;for(var i;n;){if(n.nodeType===3){if(i=t+n.textContent.length,t<=e&&i>=e)return{node:n,offset:e-t};t=i}t:{for(;n;){if(n.nextSibling){n=n.nextSibling;break t}n=n.parentNode}n=void 0}n=u_(n)}}function Yz(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Yz(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Qz(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var e=Gg(t.document);e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Gg(t.document)}return e}function EE(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}var PV=$o&&"documentMode"in document&&11>=document.documentMode,lc=null,_x=null,Td=null,zx=!1;function f_(t,e,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;zx||lc==null||lc!==Gg(i)||(i=lc,"selectionStart"in i&&EE(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Td&&Ud(Td,i)||(Td=i,i=sy(_x,"onSelect"),0<i.length&&(e=new gy("onSelect","select",null,e,n),t.push({event:e,listeners:i}),e.target=lc)))}function gs(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var sc={animationend:gs("Animation","AnimationEnd"),animationiteration:gs("Animation","AnimationIteration"),animationstart:gs("Animation","AnimationStart"),transitionrun:gs("Transition","TransitionRun"),transitionstart:gs("Transition","TransitionStart"),transitioncancel:gs("Transition","TransitionCancel"),transitionend:gs("Transition","TransitionEnd")},Qb={},Xz={};$o&&(Xz=document.createElement("div").style,"AnimationEvent"in window||(delete sc.animationend.animation,delete sc.animationiteration.animation,delete sc.animationstart.animation),"TransitionEvent"in window||delete sc.transitionend.transition);function Is(t){if(Qb[t])return Qb[t];if(!sc[t])return t;var e=sc[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in Xz)return Qb[t]=e[n];return t}var Kz=Is("animationend"),Zz=Is("animationiteration"),Jz=Is("animationstart"),HV=Is("transitionrun"),UV=Is("transitionstart"),VV=Is("transitioncancel"),Wz=Is("transitionend"),$z=new Map,Nx="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Nx.push("scrollEnd");function Xa(t,e){$z.set(t,e),zs(e,[t])}var kg=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Ea=[],uc=0,RE=0;function Sy(){for(var t=uc,e=RE=uc=0;e<t;){var n=Ea[e];Ea[e++]=null;var i=Ea[e];Ea[e++]=null;var a=Ea[e];Ea[e++]=null;var o=Ea[e];if(Ea[e++]=null,i!==null&&a!==null){var s=i.pending;s===null?a.next=a:(a.next=s.next,s.next=a),i.pending=a}o!==0&&tN(n,a,o)}}function by(t,e,n,i){Ea[uc++]=t,Ea[uc++]=e,Ea[uc++]=n,Ea[uc++]=i,RE|=i,t.lanes|=i,t=t.alternate,t!==null&&(t.lanes|=i)}function AE(t,e,n,i){return by(t,e,n,i),Yg(t)}function Ds(t,e){return by(t,null,null,e),Yg(t)}function tN(t,e,n){t.lanes|=n;var i=t.alternate;i!==null&&(i.lanes|=n);for(var a=!1,o=t.return;o!==null;)o.childLanes|=n,i=o.alternate,i!==null&&(i.childLanes|=n),o.tag===22&&(t=o.stateNode,t===null||t._visibility&1||(a=!0)),t=o,o=o.return;return t.tag===3?(o=t.stateNode,a&&e!==null&&(a=31-ia(n),t=o.hiddenUpdates,i=t[a],i===null?t[a]=[e]:i.push(e),e.lane=n|536870912),o):null}function Yg(t){if(50<Dd)throw Dd=0,$x=null,Error(J(185));for(var e=t.return;e!==null;)t=e,e=t.return;return t.tag===3?t.stateNode:null}var cc={};function jV(t,e,n,i){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $i(t,e,n,i){return new jV(t,e,n,i)}function TE(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Zo(t,e){var n=t.alternate;return n===null?(n=$i(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&65011712,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n.refCleanup=t.refCleanup,n}function eN(t,e){t.flags&=65011714;var n=t.alternate;return n===null?(t.childLanes=0,t.lanes=e,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,t.type=n.type,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),t}function Og(t,e,n,i,a,o){var s=0;if(i=t,typeof t=="function")TE(t)&&(s=1);else if(typeof t=="string")s=G8(t,n,po.current)?26:t==="html"||t==="head"||t==="body"?27:5;else t:switch(t){case Sx:return t=$i(31,n,e,a),t.elementType=Sx,t.lanes=o,t;case nc:return Es(n.children,a,o,e);case bz:s=8,a|=24;break;case gx:return t=$i(12,n,e,a|2),t.elementType=gx,t.lanes=o,t;case yx:return t=$i(13,n,e,a),t.elementType=yx,t.lanes=o,t;case vx:return t=$i(19,n,e,a),t.elementType=vx,t.lanes=o,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Qo:s=10;break t;case xz:s=9;break t;case fE:s=11;break t;case dE:s=14;break t;case qr:s=16,i=null;break t}s=29,n=Error(J(130,t===null?"null":typeof t,"")),i=null}return e=$i(s,n,e,a),e.elementType=t,e.type=i,e.lanes=o,e}function Es(t,e,n,i){return t=$i(7,t,i,e),t.lanes=n,t}function Xb(t,e,n){return t=$i(6,t,null,e),t.lanes=n,t}function nN(t){var e=$i(18,null,null,0);return e.stateNode=t,e}function Kb(t,e,n){return e=$i(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}var d_=new WeakMap;function wa(t,e){if(typeof t=="object"&&t!==null){var n=d_.get(t);return n!==void 0?n:(e={value:t,source:e,stack:QO(e)},d_.set(t,e),e)}return{value:t,source:e,stack:QO(e)}}var fc=[],dc=0,Qg=null,Vd=0,Aa=[],Ta=0,sl=null,co=1,fo="";function ko(t,e){fc[dc++]=Vd,fc[dc++]=Qg,Qg=t,Vd=e}function iN(t,e,n){Aa[Ta++]=co,Aa[Ta++]=fo,Aa[Ta++]=sl,sl=t;var i=co;t=fo;var a=32-ia(i)-1;i&=~(1<<a),n+=1;var o=32-ia(e)+a;if(30<o){var s=a-a%5;o=(i&(1<<s)-1).toString(32),i>>=s,a-=s,co=1<<32-ia(e)+a|n<<a|i,fo=o+t}else co=1<<o|n<<a|i,fo=t}function CE(t){t.return!==null&&(ko(t,1),iN(t,1,0))}function wE(t){for(;t===Qg;)Qg=fc[--dc],fc[dc]=null,Vd=fc[--dc],fc[dc]=null;for(;t===sl;)sl=Aa[--Ta],Aa[Ta]=null,fo=Aa[--Ta],Aa[Ta]=null,co=Aa[--Ta],Aa[Ta]=null}function aN(t,e){Aa[Ta++]=co,Aa[Ta++]=fo,Aa[Ta++]=sl,co=e.id,fo=e.overflow,sl=t}var Gn=null,Oe=null,Jt=!1,tl=null,Ma=!1,Ix=Error(J(519));function ul(t){var e=Error(J(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw jd(wa(e,t)),Ix}function h_(t){var e=t.stateNode,n=t.type,i=t.memoizedProps;switch(e[Fn]=t,e[_i]=i,n){case"dialog":kt("cancel",e),kt("close",e);break;case"iframe":case"object":case"embed":kt("load",e);break;case"video":case"audio":for(n=0;n<kd.length;n++)kt(kd[n],e);break;case"source":kt("error",e);break;case"img":case"image":case"link":kt("error",e),kt("load",e);break;case"details":kt("toggle",e);break;case"input":kt("invalid",e),Dz(e,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":kt("invalid",e);break;case"textarea":kt("invalid",e),Bz(e,i.value,i.defaultValue,i.children)}n=i.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||e.textContent===""+n||i.suppressHydrationWarning===!0||V3(e.textContent,n)?(i.popover!=null&&(kt("beforetoggle",e),kt("toggle",e)),i.onScroll!=null&&kt("scroll",e),i.onScrollEnd!=null&&kt("scrollend",e),i.onClick!=null&&(e.onclick=Xo),e=!0):e=!1,e||ul(t,!0)}function p_(t){for(Gn=t.return;Gn;)switch(Gn.tag){case 5:case 31:case 13:Ma=!1;return;case 27:case 3:Ma=!0;return;default:Gn=Gn.return}}function Wu(t){if(t!==Gn)return!1;if(!Jt)return p_(t),Jt=!0,!1;var e=t.tag,n;if((n=e!==3&&e!==27)&&((n=e===5)&&(n=t.type,n=!(n!=="form"&&n!=="button")||aE(t.type,t.memoizedProps)),n=!n),n&&Oe&&ul(t),p_(t),e===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(J(317));Oe=nz(t)}else if(e===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(J(317));Oe=nz(t)}else e===27?(e=Oe,hl(t.type)?(t=sE,sE=null,Oe=t):Oe=e):Oe=Gn?_a(t.stateNode.nextSibling):null;return!0}function Cs(){Oe=Gn=null,Jt=!1}function Zb(){var t=tl;return t!==null&&(Mi===null?Mi=t:Mi.push.apply(Mi,t),tl=null),t}function jd(t){tl===null?tl=[t]:tl.push(t)}var Dx=mo(null),Ls=null,Ko=null;function Gr(t,e,n){Ce(Dx,e._currentValue),e._currentValue=n}function Jo(t){t._currentValue=Dx.current,Dn(Dx)}function Lx(t,e,n){for(;t!==null;){var i=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),t===n)break;t=t.return}}function Bx(t,e,n,i){var a=t.child;for(a!==null&&(a.return=t);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;t:for(;o!==null;){var u=o;o=a;for(var d=0;d<e.length;d++)if(u.context===e[d]){o.lanes|=n,u=o.alternate,u!==null&&(u.lanes|=n),Lx(o.return,n,t),i||(s=null);break t}o=u.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(J(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Lx(s,n,t),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===t){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Dc(t,e,n,i){t=null;for(var a=e,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(J(387));if(s=s.memoizedProps,s!==null){var u=a.type;oa(a.pendingProps.value,s.value)||(t!==null?t.push(u):t=[u])}}else if(a===Vg.current){if(s=a.alternate,s===null)throw Error(J(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(t!==null?t.push(Qd):t=[Qd])}a=a.return}t!==null&&Bx(e,t,n,i),e.flags|=262144}function Xg(t){for(t=t.firstContext;t!==null;){if(!oa(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function ws(t){Ls=t,Ko=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function kn(t){return oN(Ls,t)}function mg(t,e){return Ls===null&&ws(t),oN(t,e)}function oN(t,e){var n=e._currentValue;if(e={context:e,memoizedValue:n,next:null},Ko===null){if(t===null)throw Error(J(308));Ko=e,t.dependencies={lanes:0,firstContext:e},t.flags|=524288}else Ko=Ko.next=e;return n}var qV=typeof AbortController<"u"?AbortController:function(){var t=[],e=this.signal={aborted:!1,addEventListener:function(n,i){t.push(i)}};this.abort=function(){e.aborted=!0,t.forEach(function(n){return n()})}},FV=Cn.unstable_scheduleCallback,GV=Cn.unstable_NormalPriority,mn={$$typeof:Qo,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ME(){return{controller:new qV,data:new Map,refCount:0}}function nh(t){t.refCount--,t.refCount===0&&FV(GV,function(){t.controller.abort()})}var Cd=null,Px=0,Ac=0,yc=null;function kV(t,e){if(Cd===null){var n=Cd=[];Px=0,Ac=$E(),yc={status:"pending",value:void 0,then:function(i){n.push(i)}}}return Px++,e.then(m_,m_),e}function m_(){if(--Px===0&&Cd!==null){yc!==null&&(yc.status="fulfilled");var t=Cd;Cd=null,Ac=0,yc=null;for(var e=0;e<t.length;e++)(0,t[e])()}}function YV(t,e){var n=[],i={status:"pending",value:null,reason:null,then:function(a){n.push(a)}};return t.then(function(){i.status="fulfilled",i.value=e;for(var a=0;a<n.length;a++)(0,n[a])(e)},function(a){for(i.status="rejected",i.reason=a,a=0;a<n.length;a++)(0,n[a])(void 0)}),i}var g_=Ot.S;Ot.S=function(t,e){S3=ea(),typeof e=="object"&&e!==null&&typeof e.then=="function"&&kV(t,e),g_!==null&&g_(t,e)};var Rs=mo(null);function OE(){var t=Rs.current;return t!==null?t:Ae.pooledCache}function _g(t,e){e===null?Ce(Rs,Rs.current):Ce(Rs,e.pool)}function rN(){var t=OE();return t===null?null:{parent:mn._currentValue,pool:t}}var Lc=Error(J(460)),_E=Error(J(474)),xy=Error(J(542)),Kg={then:function(){}};function y_(t){return t=t.status,t==="fulfilled"||t==="rejected"}function lN(t,e,n){switch(n=t[n],n===void 0?t.push(e):n!==e&&(e.then(Xo,Xo),e=n),e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,S_(t),t;default:if(typeof e.status=="string")e.then(Xo,Xo);else{if(t=Ae,t!==null&&100<t.shellSuspendCounter)throw Error(J(482));t=e,t.status="pending",t.then(function(i){if(e.status==="pending"){var a=e;a.status="fulfilled",a.value=i}},function(i){if(e.status==="pending"){var a=e;a.status="rejected",a.reason=i}})}switch(e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,S_(t),t}throw As=e,Lc}}function Ss(t){try{var e=t._init;return e(t._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(As=n,Lc):n}}var As=null;function v_(){if(As===null)throw Error(J(459));var t=As;return As=null,t}function S_(t){if(t===Lc||t===xy)throw Error(J(483))}var vc=null,qd=0;function gg(t){var e=qd;return qd+=1,vc===null&&(vc=[]),lN(vc,t,e)}function hd(t,e){e=e.props.ref,t.ref=e!==void 0?e:null}function yg(t,e){throw e.$$typeof===NU?Error(J(525)):(t=Object.prototype.toString.call(e),Error(J(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)))}function sN(t){function e(E,x){if(t){var A=E.deletions;A===null?(E.deletions=[x],E.flags|=16):A.push(x)}}function n(E,x){if(!t)return null;for(;x!==null;)e(E,x),x=x.sibling;return null}function i(E){for(var x=new Map;E!==null;)E.key!==null?x.set(E.key,E):x.set(E.index,E),E=E.sibling;return x}function a(E,x){return E=Zo(E,x),E.index=0,E.sibling=null,E}function o(E,x,A){return E.index=A,t?(A=E.alternate,A!==null?(A=A.index,A<x?(E.flags|=67108866,x):A):(E.flags|=67108866,x)):(E.flags|=1048576,x)}function s(E){return t&&E.alternate===null&&(E.flags|=67108866),E}function u(E,x,A,C){return x===null||x.tag!==6?(x=Xb(A,E.mode,C),x.return=E,x):(x=a(x,A),x.return=E,x)}function d(E,x,A,C){var M=A.type;return M===nc?f(E,x,A.props.children,C,A.key):x!==null&&(x.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===qr&&Ss(M)===x.type)?(x=a(x,A.props),hd(x,A),x.return=E,x):(x=Og(A.type,A.key,A.props,null,E.mode,C),hd(x,A),x.return=E,x)}function p(E,x,A,C){return x===null||x.tag!==4||x.stateNode.containerInfo!==A.containerInfo||x.stateNode.implementation!==A.implementation?(x=Kb(A,E.mode,C),x.return=E,x):(x=a(x,A.children||[]),x.return=E,x)}function f(E,x,A,C,M){return x===null||x.tag!==7?(x=Es(A,E.mode,C,M),x.return=E,x):(x=a(x,A),x.return=E,x)}function m(E,x,A){if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return x=Xb(""+x,E.mode,A),x.return=E,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case lg:return A=Og(x.type,x.key,x.props,null,E.mode,A),hd(A,x),A.return=E,A;case vd:return x=Kb(x,E.mode,A),x.return=E,x;case qr:return x=Ss(x),m(E,x,A)}if(Sd(x)||fd(x))return x=Es(x,E.mode,A,null),x.return=E,x;if(typeof x.then=="function")return m(E,gg(x),A);if(x.$$typeof===Qo)return m(E,mg(E,x),A);yg(E,x)}return null}function g(E,x,A,C){var M=x!==null?x.key:null;if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return M!==null?null:u(E,x,""+A,C);if(typeof A=="object"&&A!==null){switch(A.$$typeof){case lg:return A.key===M?d(E,x,A,C):null;case vd:return A.key===M?p(E,x,A,C):null;case qr:return A=Ss(A),g(E,x,A,C)}if(Sd(A)||fd(A))return M!==null?null:f(E,x,A,C,null);if(typeof A.then=="function")return g(E,x,gg(A),C);if(A.$$typeof===Qo)return g(E,x,mg(E,A),C);yg(E,A)}return null}function v(E,x,A,C,M){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return E=E.get(A)||null,u(x,E,""+C,M);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case lg:return E=E.get(C.key===null?A:C.key)||null,d(x,E,C,M);case vd:return E=E.get(C.key===null?A:C.key)||null,p(x,E,C,M);case qr:return C=Ss(C),v(E,x,A,C,M)}if(Sd(C)||fd(C))return E=E.get(A)||null,f(x,E,C,M,null);if(typeof C.then=="function")return v(E,x,A,gg(C),M);if(C.$$typeof===Qo)return v(E,x,A,mg(x,C),M);yg(x,C)}return null}function S(E,x,A,C){for(var M=null,I=null,z=x,D=x=0,k=null;z!==null&&D<A.length;D++){z.index>D?(k=z,z=null):k=z.sibling;var B=g(E,z,A[D],C);if(B===null){z===null&&(z=k);break}t&&z&&B.alternate===null&&e(E,z),x=o(B,x,D),I===null?M=B:I.sibling=B,I=B,z=k}if(D===A.length)return n(E,z),Jt&&ko(E,D),M;if(z===null){for(;D<A.length;D++)z=m(E,A[D],C),z!==null&&(x=o(z,x,D),I===null?M=z:I.sibling=z,I=z);return Jt&&ko(E,D),M}for(z=i(z);D<A.length;D++)k=v(z,E,D,A[D],C),k!==null&&(t&&k.alternate!==null&&z.delete(k.key===null?D:k.key),x=o(k,x,D),I===null?M=k:I.sibling=k,I=k);return t&&z.forEach(function(Q){return e(E,Q)}),Jt&&ko(E,D),M}function R(E,x,A,C){if(A==null)throw Error(J(151));for(var M=null,I=null,z=x,D=x=0,k=null,B=A.next();z!==null&&!B.done;D++,B=A.next()){z.index>D?(k=z,z=null):k=z.sibling;var Q=g(E,z,B.value,C);if(Q===null){z===null&&(z=k);break}t&&z&&Q.alternate===null&&e(E,z),x=o(Q,x,D),I===null?M=Q:I.sibling=Q,I=Q,z=k}if(B.done)return n(E,z),Jt&&ko(E,D),M;if(z===null){for(;!B.done;D++,B=A.next())B=m(E,B.value,C),B!==null&&(x=o(B,x,D),I===null?M=B:I.sibling=B,I=B);return Jt&&ko(E,D),M}for(z=i(z);!B.done;D++,B=A.next())B=v(z,E,D,B.value,C),B!==null&&(t&&B.alternate!==null&&z.delete(B.key===null?D:B.key),x=o(B,x,D),I===null?M=B:I.sibling=B,I=B);return t&&z.forEach(function(it){return e(E,it)}),Jt&&ko(E,D),M}function T(E,x,A,C){if(typeof A=="object"&&A!==null&&A.type===nc&&A.key===null&&(A=A.props.children),typeof A=="object"&&A!==null){switch(A.$$typeof){case lg:t:{for(var M=A.key;x!==null;){if(x.key===M){if(M=A.type,M===nc){if(x.tag===7){n(E,x.sibling),C=a(x,A.props.children),C.return=E,E=C;break t}}else if(x.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===qr&&Ss(M)===x.type){n(E,x.sibling),C=a(x,A.props),hd(C,A),C.return=E,E=C;break t}n(E,x);break}else e(E,x);x=x.sibling}A.type===nc?(C=Es(A.props.children,E.mode,C,A.key),C.return=E,E=C):(C=Og(A.type,A.key,A.props,null,E.mode,C),hd(C,A),C.return=E,E=C)}return s(E);case vd:t:{for(M=A.key;x!==null;){if(x.key===M)if(x.tag===4&&x.stateNode.containerInfo===A.containerInfo&&x.stateNode.implementation===A.implementation){n(E,x.sibling),C=a(x,A.children||[]),C.return=E,E=C;break t}else{n(E,x);break}else e(E,x);x=x.sibling}C=Kb(A,E.mode,C),C.return=E,E=C}return s(E);case qr:return A=Ss(A),T(E,x,A,C)}if(Sd(A))return S(E,x,A,C);if(fd(A)){if(M=fd(A),typeof M!="function")throw Error(J(150));return A=M.call(A),R(E,x,A,C)}if(typeof A.then=="function")return T(E,x,gg(A),C);if(A.$$typeof===Qo)return T(E,x,mg(E,A),C);yg(E,A)}return typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint"?(A=""+A,x!==null&&x.tag===6?(n(E,x.sibling),C=a(x,A),C.return=E,E=C):(n(E,x),C=Xb(A,E.mode,C),C.return=E,E=C),s(E)):n(E,x)}return function(E,x,A,C){try{qd=0;var M=T(E,x,A,C);return vc=null,M}catch(z){if(z===Lc||z===xy)throw z;var I=$i(29,z,null,E.mode);return I.lanes=C,I.return=E,I}finally{}}}var Ms=sN(!0),uN=sN(!1),Fr=!1;function zE(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hx(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function el(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function nl(t,e,n){var i=t.updateQueue;if(i===null)return null;if(i=i.shared,re&2){var a=i.pending;return a===null?e.next=e:(e.next=a.next,a.next=e),i.pending=e,e=Yg(t),tN(t,null,n),e}return by(t,i,e,n),Yg(t)}function wd(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194048)!==0)){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,wz(t,n)}}function Jb(t,e){var n=t.updateQueue,i=t.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var a=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};o===null?a=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?a=o=e:o=o.next=e}else a=o=e;n={baseState:i.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:i.shared,callbacks:i.callbacks},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}var Ux=!1;function Md(){if(Ux){var t=yc;if(t!==null)throw t}}function Od(t,e,n,i){Ux=!1;var a=t.updateQueue;Fr=!1;var o=a.firstBaseUpdate,s=a.lastBaseUpdate,u=a.shared.pending;if(u!==null){a.shared.pending=null;var d=u,p=d.next;d.next=null,s===null?o=p:s.next=p,s=d;var f=t.alternate;f!==null&&(f=f.updateQueue,u=f.lastBaseUpdate,u!==s&&(u===null?f.firstBaseUpdate=p:u.next=p,f.lastBaseUpdate=d))}if(o!==null){var m=a.baseState;s=0,f=p=d=null,u=o;do{var g=u.lane&-536870913,v=g!==u.lane;if(v?(Kt&g)===g:(i&g)===g){g!==0&&g===Ac&&(Ux=!0),f!==null&&(f=f.next={lane:0,tag:u.tag,payload:u.payload,callback:null,next:null});t:{var S=t,R=u;g=e;var T=n;switch(R.tag){case 1:if(S=R.payload,typeof S=="function"){m=S.call(T,m,g);break t}m=S;break t;case 3:S.flags=S.flags&-65537|128;case 0:if(S=R.payload,g=typeof S=="function"?S.call(T,m,g):S,g==null)break t;m=_e({},m,g);break t;case 2:Fr=!0}}g=u.callback,g!==null&&(t.flags|=64,v&&(t.flags|=8192),v=a.callbacks,v===null?a.callbacks=[g]:v.push(g))}else v={lane:g,tag:u.tag,payload:u.payload,callback:u.callback,next:null},f===null?(p=f=v,d=m):f=f.next=v,s|=g;if(u=u.next,u===null){if(u=a.shared.pending,u===null)break;v=u,u=v.next,v.next=null,a.lastBaseUpdate=v,a.shared.pending=null}}while(!0);f===null&&(d=m),a.baseState=d,a.firstBaseUpdate=p,a.lastBaseUpdate=f,o===null&&(a.shared.lanes=0),fl|=s,t.lanes=s,t.memoizedState=m}}function cN(t,e){if(typeof t!="function")throw Error(J(191,t));t.call(e)}function fN(t,e){var n=t.callbacks;if(n!==null)for(t.callbacks=null,t=0;t<n.length;t++)cN(n[t],e)}var Tc=mo(null),Zg=mo(0);function b_(t,e){t=ir,Ce(Zg,t),Ce(Tc,e),ir=t|e.baseLanes}function Vx(){Ce(Zg,ir),Ce(Tc,Tc.current)}function NE(){ir=Zg.current,Dn(Tc),Dn(Zg)}var ra=mo(null),Oa=null;function kr(t){var e=t.alternate;Ce(on,on.current&1),Ce(ra,t),Oa===null&&(e===null||Tc.current!==null||e.memoizedState!==null)&&(Oa=t)}function jx(t){Ce(on,on.current),Ce(ra,t),Oa===null&&(Oa=t)}function dN(t){t.tag===22?(Ce(on,on.current),Ce(ra,t),Oa===null&&(Oa=t)):Yr(t)}function Yr(){Ce(on,on.current),Ce(ra,ra.current)}function Wi(t){Dn(ra),Oa===t&&(Oa=null),Dn(on)}var on=mo(0);function Jg(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||rE(n)||lE(n)))return e}else if(e.tag===19&&(e.memoizedProps.revealOrder==="forwards"||e.memoizedProps.revealOrder==="backwards"||e.memoizedProps.revealOrder==="unstable_legacy-backwards"||e.memoizedProps.revealOrder==="together")){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var tr=0,Pt=null,be=null,hn=null,Wg=!1,Sc=!1,Os=!1,$g=0,Fd=0,bc=null,QV=0;function Je(){throw Error(J(321))}function IE(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!oa(t[n],e[n]))return!1;return!0}function DE(t,e,n,i,a,o){return tr=o,Pt=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Ot.H=t===null||t.memoizedState===null?FN:kE,Os=!1,o=n(i,a),Os=!1,Sc&&(o=pN(e,n,i,a)),hN(t),o}function hN(t){Ot.H=Gd;var e=be!==null&&be.next!==null;if(tr=0,hn=be=Pt=null,Wg=!1,Fd=0,bc=null,e)throw Error(J(300));t===null||gn||(t=t.dependencies,t!==null&&Xg(t)&&(gn=!0))}function pN(t,e,n,i){Pt=t;var a=0;do{if(Sc&&(bc=null),Fd=0,Sc=!1,25<=a)throw Error(J(301));if(a+=1,hn=be=null,t.updateQueue!=null){var o=t.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}Ot.H=GN,o=e(n,i)}while(Sc);return o}function XV(){var t=Ot.H,e=t.useState()[0];return e=typeof e.then=="function"?ih(e):e,t=t.useState()[0],(be!==null?be.memoizedState:null)!==t&&(Pt.flags|=1024),e}function LE(){var t=$g!==0;return $g=0,t}function BE(t,e,n){e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n}function PE(t){if(Wg){for(t=t.memoizedState;t!==null;){var e=t.queue;e!==null&&(e.pending=null),t=t.next}Wg=!1}tr=0,hn=be=Pt=null,Sc=!1,Fd=$g=0,bc=null}function fi(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return hn===null?Pt.memoizedState=hn=t:hn=hn.next=t,hn}function rn(){if(be===null){var t=Pt.alternate;t=t!==null?t.memoizedState:null}else t=be.next;var e=hn===null?Pt.memoizedState:hn.next;if(e!==null)hn=e,be=t;else{if(t===null)throw Pt.alternate===null?Error(J(467)):Error(J(310));be=t,t={memoizedState:be.memoizedState,baseState:be.baseState,baseQueue:be.baseQueue,queue:be.queue,next:null},hn===null?Pt.memoizedState=hn=t:hn=hn.next=t}return hn}function Ey(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ih(t){var e=Fd;return Fd+=1,bc===null&&(bc=[]),t=lN(bc,t,e),e=Pt,(hn===null?e.memoizedState:hn.next)===null&&(e=e.alternate,Ot.H=e===null||e.memoizedState===null?FN:kE),t}function Ry(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return ih(t);if(t.$$typeof===Qo)return kn(t)}throw Error(J(438,String(t)))}function HE(t){var e=null,n=Pt.updateQueue;if(n!==null&&(e=n.memoCache),e==null){var i=Pt.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(e={data:i.data.map(function(a){return a.slice()}),index:0})))}if(e==null&&(e={data:[],index:0}),n===null&&(n=Ey(),Pt.updateQueue=n),n.memoCache=e,n=e.data[e.index],n===void 0)for(n=e.data[e.index]=Array(t),i=0;i<t;i++)n[i]=IU;return e.index++,n}function er(t,e){return typeof e=="function"?e(t):e}function zg(t){var e=rn();return UE(e,be,t)}function UE(t,e,n){var i=t.queue;if(i===null)throw Error(J(311));i.lastRenderedReducer=n;var a=t.baseQueue,o=i.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}e.baseQueue=a=o,i.pending=null}if(o=t.baseState,a===null)t.memoizedState=o;else{e=a.next;var u=s=null,d=null,p=e,f=!1;do{var m=p.lane&-536870913;if(m!==p.lane?(Kt&m)===m:(tr&m)===m){var g=p.revertLane;if(g===0)d!==null&&(d=d.next={lane:0,revertLane:0,gesture:null,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null}),m===Ac&&(f=!0);else if((tr&g)===g){p=p.next,g===Ac&&(f=!0);continue}else m={lane:0,revertLane:p.revertLane,gesture:null,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null},d===null?(u=d=m,s=o):d=d.next=m,Pt.lanes|=g,fl|=g;m=p.action,Os&&n(o,m),o=p.hasEagerState?p.eagerState:n(o,m)}else g={lane:m,revertLane:p.revertLane,gesture:p.gesture,action:p.action,hasEagerState:p.hasEagerState,eagerState:p.eagerState,next:null},d===null?(u=d=g,s=o):d=d.next=g,Pt.lanes|=m,fl|=m;p=p.next}while(p!==null&&p!==e);if(d===null?s=o:d.next=u,!oa(o,t.memoizedState)&&(gn=!0,f&&(n=yc,n!==null)))throw n;t.memoizedState=o,t.baseState=s,t.baseQueue=d,i.lastRenderedState=o}return a===null&&(i.lanes=0),[t.memoizedState,i.dispatch]}function Wb(t){var e=rn(),n=e.queue;if(n===null)throw Error(J(311));n.lastRenderedReducer=t;var i=n.dispatch,a=n.pending,o=e.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=t(o,s.action),s=s.next;while(s!==a);oa(o,e.memoizedState)||(gn=!0),e.memoizedState=o,e.baseQueue===null&&(e.baseState=o),n.lastRenderedState=o}return[o,i]}function mN(t,e,n){var i=Pt,a=rn(),o=Jt;if(o){if(n===void 0)throw Error(J(407));n=n()}else n=e();var s=!oa((be||a).memoizedState,n);if(s&&(a.memoizedState=n,gn=!0),a=a.queue,VE(vN.bind(null,i,a,t),[t]),a.getSnapshot!==e||s||hn!==null&&hn.memoizedState.tag&1){if(i.flags|=2048,Cc(9,{destroy:void 0},yN.bind(null,i,a,n,e),null),Ae===null)throw Error(J(349));o||tr&127||gN(i,e,n)}return n}function gN(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Pt.updateQueue,e===null?(e=Ey(),Pt.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function yN(t,e,n,i){e.value=n,e.getSnapshot=i,SN(e)&&bN(t)}function vN(t,e,n){return n(function(){SN(e)&&bN(t)})}function SN(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!oa(t,n)}catch{return!0}}function bN(t){var e=Ds(t,2);e!==null&&Oi(e,t,2)}function qx(t){var e=fi();if(typeof t=="function"){var n=t;if(t=n(),Os){Xr(!0);try{n()}finally{Xr(!1)}}}return e.memoizedState=e.baseState=t,e.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:er,lastRenderedState:t},e}function xN(t,e,n,i){return t.baseState=n,UE(t,be,typeof i=="function"?i:er)}function KV(t,e,n,i,a){if(Ty(t))throw Error(J(485));if(t=e.action,t!==null){var o={payload:a,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(s){o.listeners.push(s)}};Ot.T!==null?n(!0):o.isTransition=!1,i(o),n=e.pending,n===null?(o.next=e.pending=o,EN(e,o)):(o.next=n.next,e.pending=n.next=o)}}function EN(t,e){var n=e.action,i=e.payload,a=t.state;if(e.isTransition){var o=Ot.T,s={};Ot.T=s;try{var u=n(a,i),d=Ot.S;d!==null&&d(s,u),x_(t,e,u)}catch(p){Fx(t,e,p)}finally{o!==null&&s.types!==null&&(o.types=s.types),Ot.T=o}}else try{o=n(a,i),x_(t,e,o)}catch(p){Fx(t,e,p)}}function x_(t,e,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){E_(t,e,i)},function(i){return Fx(t,e,i)}):E_(t,e,n)}function E_(t,e,n){e.status="fulfilled",e.value=n,RN(e),t.state=n,e=t.pending,e!==null&&(n=e.next,n===e?t.pending=null:(n=n.next,e.next=n,EN(t,n)))}function Fx(t,e,n){var i=t.pending;if(t.pending=null,i!==null){i=i.next;do e.status="rejected",e.reason=n,RN(e),e=e.next;while(e!==i)}t.action=null}function RN(t){t=t.listeners;for(var e=0;e<t.length;e++)(0,t[e])()}function AN(t,e){return e}function R_(t,e){if(Jt){var n=Ae.formState;if(n!==null){t:{var i=Pt;if(Jt){if(Oe){e:{for(var a=Oe,o=Ma;a.nodeType!==8;){if(!o){a=null;break e}if(a=_a(a.nextSibling),a===null){a=null;break e}}o=a.data,a=o==="F!"||o==="F"?a:null}if(a){Oe=_a(a.nextSibling),i=a.data==="F!";break t}}ul(i)}i=!1}i&&(e=n[0])}}return n=fi(),n.memoizedState=n.baseState=e,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:AN,lastRenderedState:e},n.queue=i,n=VN.bind(null,Pt,i),i.dispatch=n,i=qx(!1),o=GE.bind(null,Pt,!1,i.queue),i=fi(),a={state:e,dispatch:null,action:t,pending:null},i.queue=a,n=KV.bind(null,Pt,a,o,n),a.dispatch=n,i.memoizedState=t,[e,n,!1]}function A_(t){var e=rn();return TN(e,be,t)}function TN(t,e,n){if(e=UE(t,e,AN)[0],t=zg(er)[0],typeof e=="object"&&e!==null&&typeof e.then=="function")try{var i=ih(e)}catch(s){throw s===Lc?xy:s}else i=e;e=rn();var a=e.queue,o=a.dispatch;return n!==e.memoizedState&&(Pt.flags|=2048,Cc(9,{destroy:void 0},ZV.bind(null,a,n),null)),[i,o,t]}function ZV(t,e){t.action=e}function T_(t){var e=rn(),n=be;if(n!==null)return TN(e,n,t);rn(),e=e.memoizedState,n=rn();var i=n.queue.dispatch;return n.memoizedState=t,[e,i,!1]}function Cc(t,e,n,i){return t={tag:t,create:n,deps:i,inst:e,next:null},e=Pt.updateQueue,e===null&&(e=Ey(),Pt.updateQueue=e),n=e.lastEffect,n===null?e.lastEffect=t.next=t:(i=n.next,n.next=t,t.next=i,e.lastEffect=t),t}function CN(){return rn().memoizedState}function Ng(t,e,n,i){var a=fi();Pt.flags|=t,a.memoizedState=Cc(1|e,{destroy:void 0},n,i===void 0?null:i)}function Ay(t,e,n,i){var a=rn();i=i===void 0?null:i;var o=a.memoizedState.inst;be!==null&&i!==null&&IE(i,be.memoizedState.deps)?a.memoizedState=Cc(e,o,n,i):(Pt.flags|=t,a.memoizedState=Cc(1|e,o,n,i))}function C_(t,e){Ng(8390656,8,t,e)}function VE(t,e){Ay(2048,8,t,e)}function JV(t){Pt.flags|=4;var e=Pt.updateQueue;if(e===null)e=Ey(),Pt.updateQueue=e,e.events=[t];else{var n=e.events;n===null?e.events=[t]:n.push(t)}}function wN(t){var e=rn().memoizedState;return JV({ref:e,nextImpl:t}),function(){if(re&2)throw Error(J(440));return e.impl.apply(void 0,arguments)}}function MN(t,e){return Ay(4,2,t,e)}function ON(t,e){return Ay(4,4,t,e)}function _N(t,e){if(typeof e=="function"){t=t();var n=e(t);return function(){typeof n=="function"?n():e(null)}}if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function zN(t,e,n){n=n!=null?n.concat([t]):null,Ay(4,4,_N.bind(null,e,t),n)}function jE(){}function NN(t,e){var n=rn();e=e===void 0?null:e;var i=n.memoizedState;return e!==null&&IE(e,i[1])?i[0]:(n.memoizedState=[t,e],t)}function IN(t,e){var n=rn();e=e===void 0?null:e;var i=n.memoizedState;if(e!==null&&IE(e,i[1]))return i[0];if(i=t(),Os){Xr(!0);try{t()}finally{Xr(!1)}}return n.memoizedState=[i,e],i}function qE(t,e,n){return n===void 0||tr&1073741824&&!(Kt&261930)?t.memoizedState=e:(t.memoizedState=n,t=x3(),Pt.lanes|=t,fl|=t,n)}function DN(t,e,n,i){return oa(n,e)?n:Tc.current!==null?(t=qE(t,n,i),oa(t,e)||(gn=!0),t):!(tr&42)||tr&1073741824&&!(Kt&261930)?(gn=!0,t.memoizedState=n):(t=x3(),Pt.lanes|=t,fl|=t,e)}function LN(t,e,n,i,a){var o=le.p;le.p=o!==0&&8>o?o:8;var s=Ot.T,u={};Ot.T=u,GE(t,!1,e,n);try{var d=a(),p=Ot.S;if(p!==null&&p(u,d),d!==null&&typeof d=="object"&&typeof d.then=="function"){var f=YV(d,i);_d(t,e,f,aa(t))}else _d(t,e,i,aa(t))}catch(m){_d(t,e,{then:function(){},status:"rejected",reason:m},aa())}finally{le.p=o,s!==null&&u.types!==null&&(s.types=u.types),Ot.T=s}}function WV(){}function Gx(t,e,n,i){if(t.tag!==5)throw Error(J(476));var a=BN(t).queue;LN(t,a,e,xs,n===null?WV:function(){return PN(t),n(i)})}function BN(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:xs,baseState:xs,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:er,lastRenderedState:xs},next:null};var n={};return e.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:er,lastRenderedState:n},next:null},t.memoizedState=e,t=t.alternate,t!==null&&(t.memoizedState=e),e}function PN(t){var e=BN(t);e.next===null&&(e=t.alternate.memoizedState),_d(t,e.next.queue,{},aa())}function FE(){return kn(Qd)}function HN(){return rn().memoizedState}function UN(){return rn().memoizedState}function $V(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var n=aa();t=el(n);var i=nl(e,t,n);i!==null&&(Oi(i,e,n),wd(i,e,n)),e={cache:ME()},t.payload=e;return}e=e.return}}function t8(t,e,n){var i=aa();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ty(t)?jN(e,n):(n=AE(t,e,n,i),n!==null&&(Oi(n,t,i),qN(n,e,i)))}function VN(t,e,n){var i=aa();_d(t,e,n,i)}function _d(t,e,n,i){var a={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ty(t))jN(e,a);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,u=o(s,n);if(a.hasEagerState=!0,a.eagerState=u,oa(u,s))return by(t,e,a,0),Ae===null&&Sy(),!1}catch{}finally{}if(n=AE(t,e,a,i),n!==null)return Oi(n,t,i),qN(n,e,i),!0}return!1}function GE(t,e,n,i){if(i={lane:2,revertLane:$E(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Ty(t)){if(e)throw Error(J(479))}else e=AE(t,n,i,2),e!==null&&Oi(e,t,2)}function Ty(t){var e=t.alternate;return t===Pt||e!==null&&e===Pt}function jN(t,e){Sc=Wg=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function qN(t,e,n){if(n&4194048){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,wz(t,n)}}var Gd={readContext:kn,use:Ry,useCallback:Je,useContext:Je,useEffect:Je,useImperativeHandle:Je,useLayoutEffect:Je,useInsertionEffect:Je,useMemo:Je,useReducer:Je,useRef:Je,useState:Je,useDebugValue:Je,useDeferredValue:Je,useTransition:Je,useSyncExternalStore:Je,useId:Je,useHostTransitionStatus:Je,useFormState:Je,useActionState:Je,useOptimistic:Je,useMemoCache:Je,useCacheRefresh:Je};Gd.useEffectEvent=Je;var FN={readContext:kn,use:Ry,useCallback:function(t,e){return fi().memoizedState=[t,e===void 0?null:e],t},useContext:kn,useEffect:C_,useImperativeHandle:function(t,e,n){n=n!=null?n.concat([t]):null,Ng(4194308,4,_N.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Ng(4194308,4,t,e)},useInsertionEffect:function(t,e){Ng(4,2,t,e)},useMemo:function(t,e){var n=fi();e=e===void 0?null:e;var i=t();if(Os){Xr(!0);try{t()}finally{Xr(!1)}}return n.memoizedState=[i,e],i},useReducer:function(t,e,n){var i=fi();if(n!==void 0){var a=n(e);if(Os){Xr(!0);try{n(e)}finally{Xr(!1)}}}else a=e;return i.memoizedState=i.baseState=a,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:a},i.queue=t,t=t.dispatch=t8.bind(null,Pt,t),[i.memoizedState,t]},useRef:function(t){var e=fi();return t={current:t},e.memoizedState=t},useState:function(t){t=qx(t);var e=t.queue,n=VN.bind(null,Pt,e);return e.dispatch=n,[t.memoizedState,n]},useDebugValue:jE,useDeferredValue:function(t,e){var n=fi();return qE(n,t,e)},useTransition:function(){var t=qx(!1);return t=LN.bind(null,Pt,t.queue,!0,!1),fi().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,n){var i=Pt,a=fi();if(Jt){if(n===void 0)throw Error(J(407));n=n()}else{if(n=e(),Ae===null)throw Error(J(349));Kt&127||gN(i,e,n)}a.memoizedState=n;var o={value:n,getSnapshot:e};return a.queue=o,C_(vN.bind(null,i,o,t),[t]),i.flags|=2048,Cc(9,{destroy:void 0},yN.bind(null,i,o,n,e),null),n},useId:function(){var t=fi(),e=Ae.identifierPrefix;if(Jt){var n=fo,i=co;n=(i&~(1<<32-ia(i)-1)).toString(32)+n,e="_"+e+"R_"+n,n=$g++,0<n&&(e+="H"+n.toString(32)),e+="_"}else n=QV++,e="_"+e+"r_"+n.toString(32)+"_";return t.memoizedState=e},useHostTransitionStatus:FE,useFormState:R_,useActionState:R_,useOptimistic:function(t){var e=fi();e.memoizedState=e.baseState=t;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return e.queue=n,e=GE.bind(null,Pt,!0,n),n.dispatch=e,[t,e]},useMemoCache:HE,useCacheRefresh:function(){return fi().memoizedState=$V.bind(null,Pt)},useEffectEvent:function(t){var e=fi(),n={impl:t};return e.memoizedState=n,function(){if(re&2)throw Error(J(440));return n.impl.apply(void 0,arguments)}}},kE={readContext:kn,use:Ry,useCallback:NN,useContext:kn,useEffect:VE,useImperativeHandle:zN,useInsertionEffect:MN,useLayoutEffect:ON,useMemo:IN,useReducer:zg,useRef:CN,useState:function(){return zg(er)},useDebugValue:jE,useDeferredValue:function(t,e){var n=rn();return DN(n,be.memoizedState,t,e)},useTransition:function(){var t=zg(er)[0],e=rn().memoizedState;return[typeof t=="boolean"?t:ih(t),e]},useSyncExternalStore:mN,useId:HN,useHostTransitionStatus:FE,useFormState:A_,useActionState:A_,useOptimistic:function(t,e){var n=rn();return xN(n,be,t,e)},useMemoCache:HE,useCacheRefresh:UN};kE.useEffectEvent=wN;var GN={readContext:kn,use:Ry,useCallback:NN,useContext:kn,useEffect:VE,useImperativeHandle:zN,useInsertionEffect:MN,useLayoutEffect:ON,useMemo:IN,useReducer:Wb,useRef:CN,useState:function(){return Wb(er)},useDebugValue:jE,useDeferredValue:function(t,e){var n=rn();return be===null?qE(n,t,e):DN(n,be.memoizedState,t,e)},useTransition:function(){var t=Wb(er)[0],e=rn().memoizedState;return[typeof t=="boolean"?t:ih(t),e]},useSyncExternalStore:mN,useId:HN,useHostTransitionStatus:FE,useFormState:T_,useActionState:T_,useOptimistic:function(t,e){var n=rn();return be!==null?xN(n,be,t,e):(n.baseState=t,[t,n.queue.dispatch])},useMemoCache:HE,useCacheRefresh:UN};GN.useEffectEvent=wN;function $b(t,e,n,i){e=t.memoizedState,n=n(i,e),n=n==null?e:_e({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var kx={enqueueSetState:function(t,e,n){t=t._reactInternals;var i=aa(),a=el(i);a.payload=e,n!=null&&(a.callback=n),e=nl(t,a,i),e!==null&&(Oi(e,t,i),wd(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var i=aa(),a=el(i);a.tag=1,a.payload=e,n!=null&&(a.callback=n),e=nl(t,a,i),e!==null&&(Oi(e,t,i),wd(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=aa(),i=el(n);i.tag=2,e!=null&&(i.callback=e),e=nl(t,i,n),e!==null&&(Oi(e,t,n),wd(e,t,n))}};function w_(t,e,n,i,a,o,s){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(i,o,s):e.prototype&&e.prototype.isPureReactComponent?!Ud(n,i)||!Ud(a,o):!0}function M_(t,e,n,i){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,i),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,i),e.state!==t&&kx.enqueueReplaceState(e,e.state,null)}function _s(t,e){var n=e;if("ref"in e){n={};for(var i in e)i!=="ref"&&(n[i]=e[i])}if(t=t.defaultProps){n===e&&(n=_e({},n));for(var a in t)n[a]===void 0&&(n[a]=t[a])}return n}function kN(t){kg(t)}function YN(t){console.error(t)}function QN(t){kg(t)}function ty(t,e){try{var n=t.onUncaughtError;n(e.value,{componentStack:e.stack})}catch(i){setTimeout(function(){throw i})}}function O_(t,e,n){try{var i=t.onCaughtError;i(n.value,{componentStack:n.stack,errorBoundary:e.tag===1?e.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function Yx(t,e,n){return n=el(n),n.tag=3,n.payload={element:null},n.callback=function(){ty(t,e)},n}function XN(t){return t=el(t),t.tag=3,t}function KN(t,e,n,i){var a=n.type.getDerivedStateFromError;if(typeof a=="function"){var o=i.value;t.payload=function(){return a(o)},t.callback=function(){O_(e,n,i)}}var s=n.stateNode;s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){O_(e,n,i),typeof a!="function"&&(il===null?il=new Set([this]):il.add(this));var u=i.stack;this.componentDidCatch(i.value,{componentStack:u!==null?u:""})})}function e8(t,e,n,i,a){if(n.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(e=n.alternate,e!==null&&Dc(e,n,a,!0),n=ra.current,n!==null){switch(n.tag){case 31:case 13:return Oa===null?oy():n.alternate===null&&We===0&&(We=3),n.flags&=-257,n.flags|=65536,n.lanes=a,i===Kg?n.flags|=16384:(e=n.updateQueue,e===null?n.updateQueue=new Set([i]):e.add(i),cx(t,i,a)),!1;case 22:return n.flags|=65536,i===Kg?n.flags|=16384:(e=n.updateQueue,e===null?(e={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=e):(n=e.retryQueue,n===null?e.retryQueue=new Set([i]):n.add(i)),cx(t,i,a)),!1}throw Error(J(435,n.tag))}return cx(t,i,a),oy(),!1}if(Jt)return e=ra.current,e!==null?(!(e.flags&65536)&&(e.flags|=256),e.flags|=65536,e.lanes=a,i!==Ix&&(t=Error(J(422),{cause:i}),jd(wa(t,n)))):(i!==Ix&&(e=Error(J(423),{cause:i}),jd(wa(e,n))),t=t.current.alternate,t.flags|=65536,a&=-a,t.lanes|=a,i=wa(i,n),a=Yx(t.stateNode,i,a),Jb(t,a),We!==4&&(We=2)),!1;var o=Error(J(520),{cause:i});if(o=wa(o,n),Id===null?Id=[o]:Id.push(o),We!==4&&(We=2),e===null)return!0;i=wa(i,n),n=e;do{switch(n.tag){case 3:return n.flags|=65536,t=a&-a,n.lanes|=t,t=Yx(n.stateNode,i,t),Jb(n,t),!1;case 1:if(e=n.type,o=n.stateNode,(n.flags&128)===0&&(typeof e.getDerivedStateFromError=="function"||o!==null&&typeof o.componentDidCatch=="function"&&(il===null||!il.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=XN(a),KN(a,t,n,i),Jb(n,a),!1}n=n.return}while(n!==null);return!1}var YE=Error(J(461)),gn=!1;function qn(t,e,n,i){e.child=t===null?uN(e,null,n,i):Ms(e,t.child,n,i)}function __(t,e,n,i,a){n=n.render;var o=e.ref;if("ref"in i){var s={};for(var u in i)u!=="ref"&&(s[u]=i[u])}else s=i;return ws(e),i=DE(t,e,n,s,o,a),u=LE(),t!==null&&!gn?(BE(t,e,a),nr(t,e,a)):(Jt&&u&&CE(e),e.flags|=1,qn(t,e,i,a),e.child)}function z_(t,e,n,i,a){if(t===null){var o=n.type;return typeof o=="function"&&!TE(o)&&o.defaultProps===void 0&&n.compare===null?(e.tag=15,e.type=o,ZN(t,e,o,i,a)):(t=Og(n.type,null,i,e,e.mode,a),t.ref=e.ref,t.return=e,e.child=t)}if(o=t.child,!QE(t,a)){var s=o.memoizedProps;if(n=n.compare,n=n!==null?n:Ud,n(s,i)&&t.ref===e.ref)return nr(t,e,a)}return e.flags|=1,t=Zo(o,i),t.ref=e.ref,t.return=e,e.child=t}function ZN(t,e,n,i,a){if(t!==null){var o=t.memoizedProps;if(Ud(o,i)&&t.ref===e.ref)if(gn=!1,e.pendingProps=i=o,QE(t,a))t.flags&131072&&(gn=!0);else return e.lanes=t.lanes,nr(t,e,a)}return Qx(t,e,n,i,a)}function JN(t,e,n,i){var a=i.children,o=t!==null?t.memoizedState:null;if(t===null&&e.stateNode===null&&(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if(e.flags&128){if(o=o!==null?o.baseLanes|n:n,t!==null){for(i=e.child=t.child,a=0;i!==null;)a=a|i.lanes|i.childLanes,i=i.sibling;i=a&~o}else i=0,e.child=null;return N_(t,e,o,n,i)}if(n&536870912)e.memoizedState={baseLanes:0,cachePool:null},t!==null&&_g(e,o!==null?o.cachePool:null),o!==null?b_(e,o):Vx(),dN(e);else return i=e.lanes=536870912,N_(t,e,o!==null?o.baseLanes|n:n,n,i)}else o!==null?(_g(e,o.cachePool),b_(e,o),Yr(e),e.memoizedState=null):(t!==null&&_g(e,null),Vx(),Yr(e));return qn(t,e,a,n),e.child}function xd(t,e){return t!==null&&t.tag===22||e.stateNode!==null||(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),e.sibling}function N_(t,e,n,i,a){var o=OE();return o=o===null?null:{parent:mn._currentValue,pool:o},e.memoizedState={baseLanes:n,cachePool:o},t!==null&&_g(e,null),Vx(),dN(e),t!==null&&Dc(t,e,i,!0),e.childLanes=a,null}function Ig(t,e){return e=ey({mode:e.mode,children:e.children},t.mode),e.ref=t.ref,t.child=e,e.return=t,e}function I_(t,e,n){return Ms(e,t.child,null,n),t=Ig(e,e.pendingProps),t.flags|=2,Wi(e),e.memoizedState=null,t}function n8(t,e,n){var i=e.pendingProps,a=(e.flags&128)!==0;if(e.flags&=-129,t===null){if(Jt){if(i.mode==="hidden")return t=Ig(e,i),e.lanes=536870912,xd(null,t);if(jx(e),(t=Oe)?(t=F3(t,Ma),t=t!==null&&t.data==="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:sl!==null?{id:co,overflow:fo}:null,retryLane:536870912,hydrationErrors:null},n=nN(t),n.return=e,e.child=n,Gn=e,Oe=null)):t=null,t===null)throw ul(e);return e.lanes=536870912,null}return Ig(e,i)}var o=t.memoizedState;if(o!==null){var s=o.dehydrated;if(jx(e),a)if(e.flags&256)e.flags&=-257,e=I_(t,e,n);else if(e.memoizedState!==null)e.child=t.child,e.flags|=128,e=null;else throw Error(J(558));else if(gn||Dc(t,e,n,!1),a=(n&t.childLanes)!==0,gn||a){if(i=Ae,i!==null&&(s=Mz(i,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Ds(t,s),Oi(i,t,s),YE;oy(),e=I_(t,e,n)}else t=o.treeContext,Oe=_a(s.nextSibling),Gn=e,Jt=!0,tl=null,Ma=!1,t!==null&&aN(e,t),e=Ig(e,i),e.flags|=4096;return e}return t=Zo(t.child,{mode:i.mode,children:i.children}),t.ref=e.ref,e.child=t,t.return=e,t}function Dg(t,e){var n=e.ref;if(n===null)t!==null&&t.ref!==null&&(e.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(J(284));(t===null||t.ref!==n)&&(e.flags|=4194816)}}function Qx(t,e,n,i,a){return ws(e),n=DE(t,e,n,i,void 0,a),i=LE(),t!==null&&!gn?(BE(t,e,a),nr(t,e,a)):(Jt&&i&&CE(e),e.flags|=1,qn(t,e,n,a),e.child)}function D_(t,e,n,i,a,o){return ws(e),e.updateQueue=null,n=pN(e,i,n,a),hN(t),i=LE(),t!==null&&!gn?(BE(t,e,o),nr(t,e,o)):(Jt&&i&&CE(e),e.flags|=1,qn(t,e,n,o),e.child)}function L_(t,e,n,i,a){if(ws(e),e.stateNode===null){var o=cc,s=n.contextType;typeof s=="object"&&s!==null&&(o=kn(s)),o=new n(i,o),e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=kx,e.stateNode=o,o._reactInternals=e,o=e.stateNode,o.props=i,o.state=e.memoizedState,o.refs={},zE(e),s=n.contextType,o.context=typeof s=="object"&&s!==null?kn(s):cc,o.state=e.memoizedState,s=n.getDerivedStateFromProps,typeof s=="function"&&($b(e,n,s,i),o.state=e.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(s=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),s!==o.state&&kx.enqueueReplaceState(o,o.state,null),Od(e,i,o,a),Md(),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!0}else if(t===null){o=e.stateNode;var u=e.memoizedProps,d=_s(n,u);o.props=d;var p=o.context,f=n.contextType;s=cc,typeof f=="object"&&f!==null&&(s=kn(f));var m=n.getDerivedStateFromProps;f=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function",u=e.pendingProps!==u,f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(u||p!==s)&&M_(e,o,i,s),Fr=!1;var g=e.memoizedState;o.state=g,Od(e,i,o,a),Md(),p=e.memoizedState,u||g!==p||Fr?(typeof m=="function"&&($b(e,n,m,i),p=e.memoizedState),(d=Fr||w_(e,n,d,i,g,p,s))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=p),o.props=i,o.state=p,o.context=s,i=d):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{o=e.stateNode,Hx(t,e),s=e.memoizedProps,f=_s(n,s),o.props=f,m=e.pendingProps,g=o.context,p=n.contextType,d=cc,typeof p=="object"&&p!==null&&(d=kn(p)),u=n.getDerivedStateFromProps,(p=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(s!==m||g!==d)&&M_(e,o,i,d),Fr=!1,g=e.memoizedState,o.state=g,Od(e,i,o,a),Md();var v=e.memoizedState;s!==m||g!==v||Fr||t!==null&&t.dependencies!==null&&Xg(t.dependencies)?(typeof u=="function"&&($b(e,n,u,i),v=e.memoizedState),(f=Fr||w_(e,n,f,i,g,v,d)||t!==null&&t.dependencies!==null&&Xg(t.dependencies))?(p||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,v,d),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,v,d)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||s===t.memoizedProps&&g===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&g===t.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=v),o.props=i,o.state=v,o.context=d,i=f):(typeof o.componentDidUpdate!="function"||s===t.memoizedProps&&g===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&g===t.memoizedState||(e.flags|=1024),i=!1)}return o=i,Dg(t,e),i=(e.flags&128)!==0,o||i?(o=e.stateNode,n=i&&typeof n.getDerivedStateFromError!="function"?null:o.render(),e.flags|=1,t!==null&&i?(e.child=Ms(e,t.child,null,a),e.child=Ms(e,null,n,a)):qn(t,e,n,a),e.memoizedState=o.state,t=e.child):t=nr(t,e,a),t}function B_(t,e,n,i){return Cs(),e.flags|=256,qn(t,e,n,i),e.child}var tx={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ex(t){return{baseLanes:t,cachePool:rN()}}function nx(t,e,n){return t=t!==null?t.childLanes&~n:0,e&&(t|=ta),t}function WN(t,e,n){var i=e.pendingProps,a=!1,o=(e.flags&128)!==0,s;if((s=o)||(s=t!==null&&t.memoizedState===null?!1:(on.current&2)!==0),s&&(a=!0,e.flags&=-129),s=(e.flags&32)!==0,e.flags&=-33,t===null){if(Jt){if(a?kr(e):Yr(e),(t=Oe)?(t=F3(t,Ma),t=t!==null&&t.data!=="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:sl!==null?{id:co,overflow:fo}:null,retryLane:536870912,hydrationErrors:null},n=nN(t),n.return=e,e.child=n,Gn=e,Oe=null)):t=null,t===null)throw ul(e);return lE(t)?e.lanes=32:e.lanes=536870912,null}var u=i.children;return i=i.fallback,a?(Yr(e),a=e.mode,u=ey({mode:"hidden",children:u},a),i=Es(i,a,n,null),u.return=e,i.return=e,u.sibling=i,e.child=u,i=e.child,i.memoizedState=ex(n),i.childLanes=nx(t,s,n),e.memoizedState=tx,xd(null,i)):(kr(e),Xx(e,u))}var d=t.memoizedState;if(d!==null&&(u=d.dehydrated,u!==null)){if(o)e.flags&256?(kr(e),e.flags&=-257,e=ix(t,e,n)):e.memoizedState!==null?(Yr(e),e.child=t.child,e.flags|=128,e=null):(Yr(e),u=i.fallback,a=e.mode,i=ey({mode:"visible",children:i.children},a),u=Es(u,a,n,null),u.flags|=2,i.return=e,u.return=e,i.sibling=u,e.child=i,Ms(e,t.child,null,n),i=e.child,i.memoizedState=ex(n),i.childLanes=nx(t,s,n),e.memoizedState=tx,e=xd(null,i));else if(kr(e),lE(u)){if(s=u.nextSibling&&u.nextSibling.dataset,s)var p=s.dgst;s=p,i=Error(J(419)),i.stack="",i.digest=s,jd({value:i,source:null,stack:null}),e=ix(t,e,n)}else if(gn||Dc(t,e,n,!1),s=(n&t.childLanes)!==0,gn||s){if(s=Ae,s!==null&&(i=Mz(s,n),i!==0&&i!==d.retryLane))throw d.retryLane=i,Ds(t,i),Oi(s,t,i),YE;rE(u)||oy(),e=ix(t,e,n)}else rE(u)?(e.flags|=192,e.child=t.child,e=null):(t=d.treeContext,Oe=_a(u.nextSibling),Gn=e,Jt=!0,tl=null,Ma=!1,t!==null&&aN(e,t),e=Xx(e,i.children),e.flags|=4096);return e}return a?(Yr(e),u=i.fallback,a=e.mode,d=t.child,p=d.sibling,i=Zo(d,{mode:"hidden",children:i.children}),i.subtreeFlags=d.subtreeFlags&65011712,p!==null?u=Zo(p,u):(u=Es(u,a,n,null),u.flags|=2),u.return=e,i.return=e,i.sibling=u,e.child=i,xd(null,i),i=e.child,u=t.child.memoizedState,u===null?u=ex(n):(a=u.cachePool,a!==null?(d=mn._currentValue,a=a.parent!==d?{parent:d,pool:d}:a):a=rN(),u={baseLanes:u.baseLanes|n,cachePool:a}),i.memoizedState=u,i.childLanes=nx(t,s,n),e.memoizedState=tx,xd(t.child,i)):(kr(e),n=t.child,t=n.sibling,n=Zo(n,{mode:"visible",children:i.children}),n.return=e,n.sibling=null,t!==null&&(s=e.deletions,s===null?(e.deletions=[t],e.flags|=16):s.push(t)),e.child=n,e.memoizedState=null,n)}function Xx(t,e){return e=ey({mode:"visible",children:e},t.mode),e.return=t,t.child=e}function ey(t,e){return t=$i(22,t,null,e),t.lanes=0,t}function ix(t,e,n){return Ms(e,t.child,null,n),t=Xx(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function P_(t,e,n){t.lanes|=e;var i=t.alternate;i!==null&&(i.lanes|=e),Lx(t.return,e,n)}function ax(t,e,n,i,a,o){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:a,treeForkCount:o}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=n,s.tailMode=a,s.treeForkCount=o)}function $N(t,e,n){var i=e.pendingProps,a=i.revealOrder,o=i.tail;i=i.children;var s=on.current,u=(s&2)!==0;if(u?(s=s&1|2,e.flags|=128):s&=1,Ce(on,s),qn(t,e,i,n),i=Jt?Vd:0,!u&&t!==null&&t.flags&128)t:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&P_(t,n,e);else if(t.tag===19)P_(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break t;for(;t.sibling===null;){if(t.return===null||t.return===e)break t;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(a){case"forwards":for(n=e.child,a=null;n!==null;)t=n.alternate,t!==null&&Jg(t)===null&&(a=n),n=n.sibling;n=a,n===null?(a=e.child,e.child=null):(a=n.sibling,n.sibling=null),ax(e,!1,a,n,o,i);break;case"backwards":case"unstable_legacy-backwards":for(n=null,a=e.child,e.child=null;a!==null;){if(t=a.alternate,t!==null&&Jg(t)===null){e.child=a;break}t=a.sibling,a.sibling=n,n=a,a=t}ax(e,!0,n,null,o,i);break;case"together":ax(e,!1,null,null,void 0,i);break;default:e.memoizedState=null}return e.child}function nr(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),fl|=e.lanes,!(n&e.childLanes))if(t!==null){if(Dc(t,e,n,!1),(n&e.childLanes)===0)return null}else return null;if(t!==null&&e.child!==t.child)throw Error(J(153));if(e.child!==null){for(t=e.child,n=Zo(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Zo(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function QE(t,e){return t.lanes&e?!0:(t=t.dependencies,!!(t!==null&&Xg(t)))}function i8(t,e,n){switch(e.tag){case 3:jg(e,e.stateNode.containerInfo),Gr(e,mn,t.memoizedState.cache),Cs();break;case 27:case 5:Ex(e);break;case 4:jg(e,e.stateNode.containerInfo);break;case 10:Gr(e,e.type,e.memoizedProps.value);break;case 31:if(e.memoizedState!==null)return e.flags|=128,jx(e),null;break;case 13:var i=e.memoizedState;if(i!==null)return i.dehydrated!==null?(kr(e),e.flags|=128,null):n&e.child.childLanes?WN(t,e,n):(kr(e),t=nr(t,e,n),t!==null?t.sibling:null);kr(e);break;case 19:var a=(t.flags&128)!==0;if(i=(n&e.childLanes)!==0,i||(Dc(t,e,n,!1),i=(n&e.childLanes)!==0),a){if(i)return $N(t,e,n);e.flags|=128}if(a=e.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),Ce(on,on.current),i)break;return null;case 22:return e.lanes=0,JN(t,e,n,e.pendingProps);case 24:Gr(e,mn,t.memoizedState.cache)}return nr(t,e,n)}function t3(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps)gn=!0;else{if(!QE(t,n)&&!(e.flags&128))return gn=!1,i8(t,e,n);gn=!!(t.flags&131072)}else gn=!1,Jt&&e.flags&1048576&&iN(e,Vd,e.index);switch(e.lanes=0,e.tag){case 16:t:{var i=e.pendingProps;if(t=Ss(e.elementType),e.type=t,typeof t=="function")TE(t)?(i=_s(t,i),e.tag=1,e=L_(null,e,t,i,n)):(e.tag=0,e=Qx(null,e,t,i,n));else{if(t!=null){var a=t.$$typeof;if(a===fE){e.tag=11,e=__(null,e,t,i,n);break t}else if(a===dE){e.tag=14,e=z_(null,e,t,i,n);break t}}throw e=bx(t)||t,Error(J(306,e,""))}}return e;case 0:return Qx(t,e,e.type,e.pendingProps,n);case 1:return i=e.type,a=_s(i,e.pendingProps),L_(t,e,i,a,n);case 3:t:{if(jg(e,e.stateNode.containerInfo),t===null)throw Error(J(387));i=e.pendingProps;var o=e.memoizedState;a=o.element,Hx(t,e),Od(e,i,null,n);var s=e.memoizedState;if(i=s.cache,Gr(e,mn,i),i!==o.cache&&Bx(e,[mn],n,!0),Md(),i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){e=B_(t,e,i,n);break t}else if(i!==a){a=wa(Error(J(424)),e),jd(a),e=B_(t,e,i,n);break t}else{switch(t=e.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Oe=_a(t.firstChild),Gn=e,Jt=!0,tl=null,Ma=!0,n=uN(e,null,i,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Cs(),i===a){e=nr(t,e,n);break t}qn(t,e,i,n)}e=e.child}return e;case 26:return Dg(t,e),t===null?(n=oz(e.type,null,e.pendingProps,null))?e.memoizedState=n:Jt||(n=e.type,t=e.pendingProps,i=uy($r.current).createElement(n),i[Fn]=e,i[_i]=t,Yn(i,n,t),In(i),e.stateNode=i):e.memoizedState=oz(e.type,t.memoizedProps,e.pendingProps,t.memoizedState),null;case 27:return Ex(e),t===null&&Jt&&(i=e.stateNode=G3(e.type,e.pendingProps,$r.current),Gn=e,Ma=!0,a=Oe,hl(e.type)?(sE=a,Oe=_a(i.firstChild)):Oe=a),qn(t,e,e.pendingProps.children,n),Dg(t,e),t===null&&(e.flags|=4194304),e.child;case 5:return t===null&&Jt&&((a=i=Oe)&&(i=z8(i,e.type,e.pendingProps,Ma),i!==null?(e.stateNode=i,Gn=e,Oe=_a(i.firstChild),Ma=!1,a=!0):a=!1),a||ul(e)),Ex(e),a=e.type,o=e.pendingProps,s=t!==null?t.memoizedProps:null,i=o.children,aE(a,o)?i=null:s!==null&&aE(a,s)&&(e.flags|=32),e.memoizedState!==null&&(a=DE(t,e,XV,null,null,n),Qd._currentValue=a),Dg(t,e),qn(t,e,i,n),e.child;case 6:return t===null&&Jt&&((t=n=Oe)&&(n=N8(n,e.pendingProps,Ma),n!==null?(e.stateNode=n,Gn=e,Oe=null,t=!0):t=!1),t||ul(e)),null;case 13:return WN(t,e,n);case 4:return jg(e,e.stateNode.containerInfo),i=e.pendingProps,t===null?e.child=Ms(e,null,i,n):qn(t,e,i,n),e.child;case 11:return __(t,e,e.type,e.pendingProps,n);case 7:return qn(t,e,e.pendingProps,n),e.child;case 8:return qn(t,e,e.pendingProps.children,n),e.child;case 12:return qn(t,e,e.pendingProps.children,n),e.child;case 10:return i=e.pendingProps,Gr(e,e.type,i.value),qn(t,e,i.children,n),e.child;case 9:return a=e.type._context,i=e.pendingProps.children,ws(e),a=kn(a),i=i(a),e.flags|=1,qn(t,e,i,n),e.child;case 14:return z_(t,e,e.type,e.pendingProps,n);case 15:return ZN(t,e,e.type,e.pendingProps,n);case 19:return $N(t,e,n);case 31:return n8(t,e,n);case 22:return JN(t,e,n,e.pendingProps);case 24:return ws(e),i=kn(mn),t===null?(a=OE(),a===null&&(a=Ae,o=ME(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),e.memoizedState={parent:i,cache:a},zE(e),Gr(e,mn,a)):(t.lanes&n&&(Hx(t,e),Od(e,null,null,n),Md()),a=t.memoizedState,o=e.memoizedState,a.parent!==i?(a={parent:i,cache:i},e.memoizedState=a,e.lanes===0&&(e.memoizedState=e.updateQueue.baseState=a),Gr(e,mn,i)):(i=o.cache,Gr(e,mn,i),i!==a.cache&&Bx(e,[mn],n,!0))),qn(t,e,e.pendingProps.children,n),e.child;case 29:throw e.pendingProps}throw Error(J(156,e.tag))}function jo(t){t.flags|=4}function ox(t,e,n,i,a){if((e=(t.mode&32)!==0)&&(e=!1),e){if(t.flags|=16777216,(a&335544128)===a)if(t.stateNode.complete)t.flags|=8192;else if(A3())t.flags|=8192;else throw As=Kg,_E}else t.flags&=-16777217}function H_(t,e){if(e.type!=="stylesheet"||e.state.loading&4)t.flags&=-16777217;else if(t.flags|=16777216,!Q3(e))if(A3())t.flags|=8192;else throw As=Kg,_E}function vg(t,e){e!==null&&(t.flags|=4),t.flags&16384&&(e=t.tag!==22?Tz():536870912,t.lanes|=e,wc|=e)}function pd(t,e){if(!Jt)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:i.sibling=null}}function Me(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,i=0;if(e)for(var a=t.child;a!==null;)n|=a.lanes|a.childLanes,i|=a.subtreeFlags&65011712,i|=a.flags&65011712,a.return=t,a=a.sibling;else for(a=t.child;a!==null;)n|=a.lanes|a.childLanes,i|=a.subtreeFlags,i|=a.flags,a.return=t,a=a.sibling;return t.subtreeFlags|=i,t.childLanes=n,e}function a8(t,e,n){var i=e.pendingProps;switch(wE(e),e.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Me(e),null;case 1:return Me(e),null;case 3:return n=e.stateNode,i=null,t!==null&&(i=t.memoizedState.cache),e.memoizedState.cache!==i&&(e.flags|=2048),Jo(mn),xc(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(Wu(e)?jo(e):t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Zb())),Me(e),null;case 26:var a=e.type,o=e.memoizedState;return t===null?(jo(e),o!==null?(Me(e),H_(e,o)):(Me(e),ox(e,a,null,i,n))):o?o!==t.memoizedState?(jo(e),Me(e),H_(e,o)):(Me(e),e.flags&=-16777217):(t=t.memoizedProps,t!==i&&jo(e),Me(e),ox(e,a,t,i,n)),null;case 27:if(qg(e),n=$r.current,a=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==i&&jo(e);else{if(!i){if(e.stateNode===null)throw Error(J(166));return Me(e),null}t=po.current,Wu(e)?h_(e,t):(t=G3(a,i,n),e.stateNode=t,jo(e))}return Me(e),null;case 5:if(qg(e),a=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==i&&jo(e);else{if(!i){if(e.stateNode===null)throw Error(J(166));return Me(e),null}if(o=po.current,Wu(e))h_(e,o);else{var s=uy($r.current);switch(o){case 1:o=s.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:o=s.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":o=s.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":o=s.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":o=s.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof i.is=="string"?s.createElement("select",{is:i.is}):s.createElement("select"),i.multiple?o.multiple=!0:i.size&&(o.size=i.size);break;default:o=typeof i.is=="string"?s.createElement(a,{is:i.is}):s.createElement(a)}}o[Fn]=e,o[_i]=i;t:for(s=e.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break t;for(;s.sibling===null;){if(s.return===null||s.return===e)break t;s=s.return}s.sibling.return=s.return,s=s.sibling}e.stateNode=o;t:switch(Yn(o,a,i),a){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break t;case"img":i=!0;break t;default:i=!1}i&&jo(e)}}return Me(e),ox(e,e.type,t===null?null:t.memoizedProps,e.pendingProps,n),null;case 6:if(t&&e.stateNode!=null)t.memoizedProps!==i&&jo(e);else{if(typeof i!="string"&&e.stateNode===null)throw Error(J(166));if(t=$r.current,Wu(e)){if(t=e.stateNode,n=e.memoizedProps,i=null,a=Gn,a!==null)switch(a.tag){case 27:case 5:i=a.memoizedProps}t[Fn]=e,t=!!(t.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||V3(t.nodeValue,n)),t||ul(e,!0)}else t=uy(t).createTextNode(i),t[Fn]=e,e.stateNode=t}return Me(e),null;case 31:if(n=e.memoizedState,t===null||t.memoizedState!==null){if(i=Wu(e),n!==null){if(t===null){if(!i)throw Error(J(318));if(t=e.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(J(557));t[Fn]=e}else Cs(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Me(e),t=!1}else n=Zb(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),t=!0;if(!t)return e.flags&256?(Wi(e),e):(Wi(e),null);if(e.flags&128)throw Error(J(558))}return Me(e),null;case 13:if(i=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(a=Wu(e),i!==null&&i.dehydrated!==null){if(t===null){if(!a)throw Error(J(318));if(a=e.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(J(317));a[Fn]=e}else Cs(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Me(e),a=!1}else a=Zb(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),a=!0;if(!a)return e.flags&256?(Wi(e),e):(Wi(e),null)}return Wi(e),e.flags&128?(e.lanes=n,e):(n=i!==null,t=t!==null&&t.memoizedState!==null,n&&(i=e.child,a=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(a=i.alternate.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==a&&(i.flags|=2048)),n!==t&&n&&(e.child.flags|=8192),vg(e,e.updateQueue),Me(e),null);case 4:return xc(),t===null&&tR(e.stateNode.containerInfo),Me(e),null;case 10:return Jo(e.type),Me(e),null;case 19:if(Dn(on),i=e.memoizedState,i===null)return Me(e),null;if(a=(e.flags&128)!==0,o=i.rendering,o===null)if(a)pd(i,!1);else{if(We!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=Jg(t),o!==null){for(e.flags|=128,pd(i,!1),t=o.updateQueue,e.updateQueue=t,vg(e,t),e.subtreeFlags=0,t=n,n=e.child;n!==null;)eN(n,t),n=n.sibling;return Ce(on,on.current&1|2),Jt&&ko(e,i.treeForkCount),e.child}t=t.sibling}i.tail!==null&&ea()>iy&&(e.flags|=128,a=!0,pd(i,!1),e.lanes=4194304)}else{if(!a)if(t=Jg(o),t!==null){if(e.flags|=128,a=!0,t=t.updateQueue,e.updateQueue=t,vg(e,t),pd(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Jt)return Me(e),null}else 2*ea()-i.renderingStartTime>iy&&n!==536870912&&(e.flags|=128,a=!0,pd(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(t=i.last,t!==null?t.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ea(),t.sibling=null,n=on.current,Ce(on,a?n&1|2:n&1),Jt&&ko(e,i.treeForkCount),t):(Me(e),null);case 22:case 23:return Wi(e),NE(),i=e.memoizedState!==null,t!==null?t.memoizedState!==null!==i&&(e.flags|=8192):i&&(e.flags|=8192),i?n&536870912&&!(e.flags&128)&&(Me(e),e.subtreeFlags&6&&(e.flags|=8192)):Me(e),n=e.updateQueue,n!==null&&vg(e,n.retryQueue),n=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),i=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),i!==n&&(e.flags|=2048),t!==null&&Dn(Rs),null;case 24:return n=null,t!==null&&(n=t.memoizedState.cache),e.memoizedState.cache!==n&&(e.flags|=2048),Jo(mn),Me(e),null;case 25:return null;case 30:return null}throw Error(J(156,e.tag))}function o8(t,e){switch(wE(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Jo(mn),xc(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return qg(e),null;case 31:if(e.memoizedState!==null){if(Wi(e),e.alternate===null)throw Error(J(340));Cs()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 13:if(Wi(e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(J(340));Cs()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Dn(on),null;case 4:return xc(),null;case 10:return Jo(e.type),null;case 22:case 23:return Wi(e),NE(),t!==null&&Dn(Rs),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 24:return Jo(mn),null;case 25:return null;default:return null}}function e3(t,e){switch(wE(e),e.tag){case 3:Jo(mn),xc();break;case 26:case 27:case 5:qg(e);break;case 4:xc();break;case 31:e.memoizedState!==null&&Wi(e);break;case 13:Wi(e);break;case 19:Dn(on);break;case 10:Jo(e.type);break;case 22:case 23:Wi(e),NE(),t!==null&&Dn(Rs);break;case 24:Jo(mn)}}function ah(t,e){try{var n=e.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var a=i.next;n=a;do{if((n.tag&t)===t){i=void 0;var o=n.create,s=n.inst;i=o(),s.destroy=i}n=n.next}while(n!==a)}}catch(u){pe(e,e.return,u)}}function cl(t,e,n){try{var i=e.updateQueue,a=i!==null?i.lastEffect:null;if(a!==null){var o=a.next;i=o;do{if((i.tag&t)===t){var s=i.inst,u=s.destroy;if(u!==void 0){s.destroy=void 0,a=e;var d=n,p=u;try{p()}catch(f){pe(a,d,f)}}}i=i.next}while(i!==o)}}catch(f){pe(e,e.return,f)}}function n3(t){var e=t.updateQueue;if(e!==null){var n=t.stateNode;try{fN(e,n)}catch(i){pe(t,t.return,i)}}}function i3(t,e,n){n.props=_s(t.type,t.memoizedProps),n.state=t.memoizedState;try{n.componentWillUnmount()}catch(i){pe(t,e,i)}}function zd(t,e){try{var n=t.ref;if(n!==null){switch(t.tag){case 26:case 27:case 5:var i=t.stateNode;break;case 30:i=t.stateNode;break;default:i=t.stateNode}typeof n=="function"?t.refCleanup=n(i):n.current=i}}catch(a){pe(t,e,a)}}function ho(t,e){var n=t.ref,i=t.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(a){pe(t,e,a)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(a){pe(t,e,a)}else n.current=null}function a3(t){var e=t.type,n=t.memoizedProps,i=t.stateNode;try{t:switch(e){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break t;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(a){pe(t,t.return,a)}}function rx(t,e,n){try{var i=t.stateNode;T8(i,t.type,n,e),i[_i]=e}catch(a){pe(t,t.return,a)}}function o3(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&hl(t.type)||t.tag===4}function lx(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||o3(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&hl(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Kx(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(t,e):(e=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,e.appendChild(t),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Xo));else if(i!==4&&(i===27&&hl(t.type)&&(n=t.stateNode,e=null),t=t.child,t!==null))for(Kx(t,e,n),t=t.sibling;t!==null;)Kx(t,e,n),t=t.sibling}function ny(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(i!==4&&(i===27&&hl(t.type)&&(n=t.stateNode),t=t.child,t!==null))for(ny(t,e,n),t=t.sibling;t!==null;)ny(t,e,n),t=t.sibling}function r3(t){var e=t.stateNode,n=t.memoizedProps;try{for(var i=t.type,a=e.attributes;a.length;)e.removeAttributeNode(a[0]);Yn(e,i,n),e[Fn]=t,e[_i]=n}catch(o){pe(t,t.return,o)}}var Yo=!1,pn=!1,sx=!1,U_=typeof WeakSet=="function"?WeakSet:Set,Nn=null;function r8(t,e){if(t=t.containerInfo,nE=hy,t=Qz(t),EE(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else t:{n=(n=t.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break t}var s=0,u=-1,d=-1,p=0,f=0,m=t,g=null;e:for(;;){for(var v;m!==n||a!==0&&m.nodeType!==3||(u=s+a),m!==o||i!==0&&m.nodeType!==3||(d=s+i),m.nodeType===3&&(s+=m.nodeValue.length),(v=m.firstChild)!==null;)g=m,m=v;for(;;){if(m===t)break e;if(g===n&&++p===a&&(u=s),g===o&&++f===i&&(d=s),(v=m.nextSibling)!==null)break;m=g,g=m.parentNode}m=v}n=u===-1||d===-1?null:{start:u,end:d}}else n=null}n=n||{start:0,end:0}}else n=null;for(iE={focusedElem:t,selectionRange:n},hy=!1,Nn=e;Nn!==null;)if(e=Nn,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Nn=t;else for(;Nn!==null;){switch(e=Nn,o=e.alternate,t=e.flags,e.tag){case 0:if(t&4&&(t=e.updateQueue,t=t!==null?t.events:null,t!==null))for(n=0;n<t.length;n++)a=t[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(t&1024&&o!==null){t=void 0,n=e,a=o.memoizedProps,o=o.memoizedState,i=n.stateNode;try{var S=_s(n.type,a);t=i.getSnapshotBeforeUpdate(S,o),i.__reactInternalSnapshotBeforeUpdate=t}catch(R){pe(n,n.return,R)}}break;case 3:if(t&1024){if(t=e.stateNode.containerInfo,n=t.nodeType,n===9)oE(t);else if(n===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":oE(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(t&1024)throw Error(J(163))}if(t=e.sibling,t!==null){t.return=e.return,Nn=t;break}Nn=e.return}}function l3(t,e,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:Fo(t,n),i&4&&ah(5,n);break;case 1:if(Fo(t,n),i&4)if(t=n.stateNode,e===null)try{t.componentDidMount()}catch(s){pe(n,n.return,s)}else{var a=_s(n.type,e.memoizedProps);e=e.memoizedState;try{t.componentDidUpdate(a,e,t.__reactInternalSnapshotBeforeUpdate)}catch(s){pe(n,n.return,s)}}i&64&&n3(n),i&512&&zd(n,n.return);break;case 3:if(Fo(t,n),i&64&&(t=n.updateQueue,t!==null)){if(e=null,n.child!==null)switch(n.child.tag){case 27:case 5:e=n.child.stateNode;break;case 1:e=n.child.stateNode}try{fN(t,e)}catch(s){pe(n,n.return,s)}}break;case 27:e===null&&i&4&&r3(n);case 26:case 5:Fo(t,n),e===null&&i&4&&a3(n),i&512&&zd(n,n.return);break;case 12:Fo(t,n);break;case 31:Fo(t,n),i&4&&c3(t,n);break;case 13:Fo(t,n),i&4&&f3(t,n),i&64&&(t=n.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(n=m8.bind(null,n),I8(t,n))));break;case 22:if(i=n.memoizedState!==null||Yo,!i){e=e!==null&&e.memoizedState!==null||pn,a=Yo;var o=pn;Yo=i,(pn=e)&&!o?Go(t,n,(n.subtreeFlags&8772)!==0):Fo(t,n),Yo=a,pn=o}break;case 30:break;default:Fo(t,n)}}function s3(t){var e=t.alternate;e!==null&&(t.alternate=null,s3(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&gE(e)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Le=null,wi=!1;function qo(t,e,n){for(n=n.child;n!==null;)u3(t,e,n),n=n.sibling}function u3(t,e,n){if(na&&typeof na.onCommitFiberUnmount=="function")try{na.onCommitFiberUnmount(Jd,n)}catch{}switch(n.tag){case 26:pn||ho(n,e),qo(t,e,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:pn||ho(n,e);var i=Le,a=wi;hl(n.type)&&(Le=n.stateNode,wi=!1),qo(t,e,n),Ld(n.stateNode),Le=i,wi=a;break;case 5:pn||ho(n,e);case 6:if(i=Le,a=wi,Le=null,qo(t,e,n),Le=i,wi=a,Le!==null)if(wi)try{(Le.nodeType===9?Le.body:Le.nodeName==="HTML"?Le.ownerDocument.body:Le).removeChild(n.stateNode)}catch(o){pe(n,e,o)}else try{Le.removeChild(n.stateNode)}catch(o){pe(n,e,o)}break;case 18:Le!==null&&(wi?(t=Le,tz(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,n.stateNode),zc(t)):tz(Le,n.stateNode));break;case 4:i=Le,a=wi,Le=n.stateNode.containerInfo,wi=!0,qo(t,e,n),Le=i,wi=a;break;case 0:case 11:case 14:case 15:cl(2,n,e),pn||cl(4,n,e),qo(t,e,n);break;case 1:pn||(ho(n,e),i=n.stateNode,typeof i.componentWillUnmount=="function"&&i3(n,e,i)),qo(t,e,n);break;case 21:qo(t,e,n);break;case 22:pn=(i=pn)||n.memoizedState!==null,qo(t,e,n),pn=i;break;default:qo(t,e,n)}}function c3(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{zc(t)}catch(n){pe(e,e.return,n)}}}function f3(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{zc(t)}catch(n){pe(e,e.return,n)}}function l8(t){switch(t.tag){case 31:case 13:case 19:var e=t.stateNode;return e===null&&(e=t.stateNode=new U_),e;case 22:return t=t.stateNode,e=t._retryCache,e===null&&(e=t._retryCache=new U_),e;default:throw Error(J(435,t.tag))}}function Sg(t,e){var n=l8(t);e.forEach(function(i){if(!n.has(i)){n.add(i);var a=g8.bind(null,t,i);i.then(a,a)}})}function Ti(t,e){var n=e.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i],o=t,s=e,u=s;t:for(;u!==null;){switch(u.tag){case 27:if(hl(u.type)){Le=u.stateNode,wi=!1;break t}break;case 5:Le=u.stateNode,wi=!1;break t;case 3:case 4:Le=u.stateNode.containerInfo,wi=!0;break t}u=u.return}if(Le===null)throw Error(J(160));u3(o,s,a),Le=null,wi=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(e.subtreeFlags&13886)for(e=e.child;e!==null;)d3(e,t),e=e.sibling}var Qa=null;function d3(t,e){var n=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Ti(e,t),Ci(t),i&4&&(cl(3,t,t.return),ah(3,t),cl(5,t,t.return));break;case 1:Ti(e,t),Ci(t),i&512&&(pn||n===null||ho(n,n.return)),i&64&&Yo&&(t=t.updateQueue,t!==null&&(i=t.callbacks,i!==null&&(n=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=n===null?i:n.concat(i))));break;case 26:var a=Qa;if(Ti(e,t),Ci(t),i&512&&(pn||n===null||ho(n,n.return)),i&4){var o=n!==null?n.memoizedState:null;if(i=t.memoizedState,n===null)if(i===null)if(t.stateNode===null){t:{i=t.type,n=t.memoizedProps,a=a.ownerDocument||a;e:switch(i){case"title":o=a.getElementsByTagName("title")[0],(!o||o[th]||o[Fn]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=a.createElement(i),a.head.insertBefore(o,a.querySelector("head > title"))),Yn(o,i,n),o[Fn]=t,In(o),i=o;break t;case"link":var s=lz("link","href",a).get(i+(n.href||""));if(s){for(var u=0;u<s.length;u++)if(o=s[u],o.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&o.getAttribute("rel")===(n.rel==null?null:n.rel)&&o.getAttribute("title")===(n.title==null?null:n.title)&&o.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(u,1);break e}}o=a.createElement(i),Yn(o,i,n),a.head.appendChild(o);break;case"meta":if(s=lz("meta","content",a).get(i+(n.content||""))){for(u=0;u<s.length;u++)if(o=s[u],o.getAttribute("content")===(n.content==null?null:""+n.content)&&o.getAttribute("name")===(n.name==null?null:n.name)&&o.getAttribute("property")===(n.property==null?null:n.property)&&o.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute("charset")===(n.charSet==null?null:n.charSet)){s.splice(u,1);break e}}o=a.createElement(i),Yn(o,i,n),a.head.appendChild(o);break;default:throw Error(J(468,i))}o[Fn]=t,In(o),i=o}t.stateNode=i}else sz(a,t.type,t.stateNode);else t.stateNode=rz(a,i,t.memoizedProps);else o!==i?(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,i===null?sz(a,t.type,t.stateNode):rz(a,i,t.memoizedProps)):i===null&&t.stateNode!==null&&rx(t,t.memoizedProps,n.memoizedProps)}break;case 27:Ti(e,t),Ci(t),i&512&&(pn||n===null||ho(n,n.return)),n!==null&&i&4&&rx(t,t.memoizedProps,n.memoizedProps);break;case 5:if(Ti(e,t),Ci(t),i&512&&(pn||n===null||ho(n,n.return)),t.flags&32){a=t.stateNode;try{Rc(a,"")}catch(S){pe(t,t.return,S)}}i&4&&t.stateNode!=null&&(a=t.memoizedProps,rx(t,a,n!==null?n.memoizedProps:a)),i&1024&&(sx=!0);break;case 6:if(Ti(e,t),Ci(t),i&4){if(t.stateNode===null)throw Error(J(162));i=t.memoizedProps,n=t.stateNode;try{n.nodeValue=i}catch(S){pe(t,t.return,S)}}break;case 3:if(Pg=null,a=Qa,Qa=cy(e.containerInfo),Ti(e,t),Qa=a,Ci(t),i&4&&n!==null&&n.memoizedState.isDehydrated)try{zc(e.containerInfo)}catch(S){pe(t,t.return,S)}sx&&(sx=!1,h3(t));break;case 4:i=Qa,Qa=cy(t.stateNode.containerInfo),Ti(e,t),Ci(t),Qa=i;break;case 12:Ti(e,t),Ci(t);break;case 31:Ti(e,t),Ci(t),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,Sg(t,i)));break;case 13:Ti(e,t),Ci(t),t.child.flags&8192&&t.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Cy=ea()),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,Sg(t,i)));break;case 22:a=t.memoizedState!==null;var d=n!==null&&n.memoizedState!==null,p=Yo,f=pn;if(Yo=p||a,pn=f||d,Ti(e,t),pn=f,Yo=p,Ci(t),i&8192)t:for(e=t.stateNode,e._visibility=a?e._visibility&-2:e._visibility|1,a&&(n===null||d||Yo||pn||bs(t)),n=null,e=t;;){if(e.tag===5||e.tag===26){if(n===null){d=n=e;try{if(o=d.stateNode,a)s=o.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none";else{u=d.stateNode;var m=d.memoizedProps.style,g=m!=null&&m.hasOwnProperty("display")?m.display:null;u.style.display=g==null||typeof g=="boolean"?"":(""+g).trim()}}catch(S){pe(d,d.return,S)}}}else if(e.tag===6){if(n===null){d=e;try{d.stateNode.nodeValue=a?"":d.memoizedProps}catch(S){pe(d,d.return,S)}}}else if(e.tag===18){if(n===null){d=e;try{var v=d.stateNode;a?ez(v,!0):ez(d.stateNode,!1)}catch(S){pe(d,d.return,S)}}}else if((e.tag!==22&&e.tag!==23||e.memoizedState===null||e===t)&&e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break t;for(;e.sibling===null;){if(e.return===null||e.return===t)break t;n===e&&(n=null),e=e.return}n===e&&(n=null),e.sibling.return=e.return,e=e.sibling}i&4&&(i=t.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,Sg(t,n))));break;case 19:Ti(e,t),Ci(t),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,Sg(t,i)));break;case 30:break;case 21:break;default:Ti(e,t),Ci(t)}}function Ci(t){var e=t.flags;if(e&2){try{for(var n,i=t.return;i!==null;){if(o3(i)){n=i;break}i=i.return}if(n==null)throw Error(J(160));switch(n.tag){case 27:var a=n.stateNode,o=lx(t);ny(t,o,a);break;case 5:var s=n.stateNode;n.flags&32&&(Rc(s,""),n.flags&=-33);var u=lx(t);ny(t,u,s);break;case 3:case 4:var d=n.stateNode.containerInfo,p=lx(t);Kx(t,p,d);break;default:throw Error(J(161))}}catch(f){pe(t,t.return,f)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function h3(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var e=t;h3(e),e.tag===5&&e.flags&1024&&e.stateNode.reset(),t=t.sibling}}function Fo(t,e){if(e.subtreeFlags&8772)for(e=e.child;e!==null;)l3(t,e.alternate,e),e=e.sibling}function bs(t){for(t=t.child;t!==null;){var e=t;switch(e.tag){case 0:case 11:case 14:case 15:cl(4,e,e.return),bs(e);break;case 1:ho(e,e.return);var n=e.stateNode;typeof n.componentWillUnmount=="function"&&i3(e,e.return,n),bs(e);break;case 27:Ld(e.stateNode);case 26:case 5:ho(e,e.return),bs(e);break;case 22:e.memoizedState===null&&bs(e);break;case 30:bs(e);break;default:bs(e)}t=t.sibling}}function Go(t,e,n){for(n=n&&(e.subtreeFlags&8772)!==0,e=e.child;e!==null;){var i=e.alternate,a=t,o=e,s=o.flags;switch(o.tag){case 0:case 11:case 15:Go(a,o,n),ah(4,o);break;case 1:if(Go(a,o,n),i=o,a=i.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(p){pe(i,i.return,p)}if(i=o,a=i.updateQueue,a!==null){var u=i.stateNode;try{var d=a.shared.hiddenCallbacks;if(d!==null)for(a.shared.hiddenCallbacks=null,a=0;a<d.length;a++)cN(d[a],u)}catch(p){pe(i,i.return,p)}}n&&s&64&&n3(o),zd(o,o.return);break;case 27:r3(o);case 26:case 5:Go(a,o,n),n&&i===null&&s&4&&a3(o),zd(o,o.return);break;case 12:Go(a,o,n);break;case 31:Go(a,o,n),n&&s&4&&c3(a,o);break;case 13:Go(a,o,n),n&&s&4&&f3(a,o);break;case 22:o.memoizedState===null&&Go(a,o,n),zd(o,o.return);break;case 30:break;default:Go(a,o,n)}e=e.sibling}}function XE(t,e){var n=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),t=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(t=e.memoizedState.cachePool.pool),t!==n&&(t!=null&&t.refCount++,n!=null&&nh(n))}function KE(t,e){t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&nh(t))}function Ya(t,e,n,i){if(e.subtreeFlags&10256)for(e=e.child;e!==null;)p3(t,e,n,i),e=e.sibling}function p3(t,e,n,i){var a=e.flags;switch(e.tag){case 0:case 11:case 15:Ya(t,e,n,i),a&2048&&ah(9,e);break;case 1:Ya(t,e,n,i);break;case 3:Ya(t,e,n,i),a&2048&&(t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&nh(t)));break;case 12:if(a&2048){Ya(t,e,n,i),t=e.stateNode;try{var o=e.memoizedProps,s=o.id,u=o.onPostCommit;typeof u=="function"&&u(s,e.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(d){pe(e,e.return,d)}}else Ya(t,e,n,i);break;case 31:Ya(t,e,n,i);break;case 13:Ya(t,e,n,i);break;case 23:break;case 22:o=e.stateNode,s=e.alternate,e.memoizedState!==null?o._visibility&2?Ya(t,e,n,i):Nd(t,e):o._visibility&2?Ya(t,e,n,i):(o._visibility|=2,tc(t,e,n,i,(e.subtreeFlags&10256)!==0||!1)),a&2048&&XE(s,e);break;case 24:Ya(t,e,n,i),a&2048&&KE(e.alternate,e);break;default:Ya(t,e,n,i)}}function tc(t,e,n,i,a){for(a=a&&((e.subtreeFlags&10256)!==0||!1),e=e.child;e!==null;){var o=t,s=e,u=n,d=i,p=s.flags;switch(s.tag){case 0:case 11:case 15:tc(o,s,u,d,a),ah(8,s);break;case 23:break;case 22:var f=s.stateNode;s.memoizedState!==null?f._visibility&2?tc(o,s,u,d,a):Nd(o,s):(f._visibility|=2,tc(o,s,u,d,a)),a&&p&2048&&XE(s.alternate,s);break;case 24:tc(o,s,u,d,a),a&&p&2048&&KE(s.alternate,s);break;default:tc(o,s,u,d,a)}e=e.sibling}}function Nd(t,e){if(e.subtreeFlags&10256)for(e=e.child;e!==null;){var n=t,i=e,a=i.flags;switch(i.tag){case 22:Nd(n,i),a&2048&&XE(i.alternate,i);break;case 24:Nd(n,i),a&2048&&KE(i.alternate,i);break;default:Nd(n,i)}e=e.sibling}}var Ed=8192;function $u(t,e,n){if(t.subtreeFlags&Ed)for(t=t.child;t!==null;)m3(t,e,n),t=t.sibling}function m3(t,e,n){switch(t.tag){case 26:$u(t,e,n),t.flags&Ed&&t.memoizedState!==null&&k8(n,Qa,t.memoizedState,t.memoizedProps);break;case 5:$u(t,e,n);break;case 3:case 4:var i=Qa;Qa=cy(t.stateNode.containerInfo),$u(t,e,n),Qa=i;break;case 22:t.memoizedState===null&&(i=t.alternate,i!==null&&i.memoizedState!==null?(i=Ed,Ed=16777216,$u(t,e,n),Ed=i):$u(t,e,n));break;default:$u(t,e,n)}}function g3(t){var e=t.alternate;if(e!==null&&(t=e.child,t!==null)){e.child=null;do e=t.sibling,t.sibling=null,t=e;while(t!==null)}}function md(t){var e=t.deletions;if(t.flags&16){if(e!==null)for(var n=0;n<e.length;n++){var i=e[n];Nn=i,v3(i,t)}g3(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)y3(t),t=t.sibling}function y3(t){switch(t.tag){case 0:case 11:case 15:md(t),t.flags&2048&&cl(9,t,t.return);break;case 3:md(t);break;case 12:md(t);break;case 22:var e=t.stateNode;t.memoizedState!==null&&e._visibility&2&&(t.return===null||t.return.tag!==13)?(e._visibility&=-3,Lg(t)):md(t);break;default:md(t)}}function Lg(t){var e=t.deletions;if(t.flags&16){if(e!==null)for(var n=0;n<e.length;n++){var i=e[n];Nn=i,v3(i,t)}g3(t)}for(t=t.child;t!==null;){switch(e=t,e.tag){case 0:case 11:case 15:cl(8,e,e.return),Lg(e);break;case 22:n=e.stateNode,n._visibility&2&&(n._visibility&=-3,Lg(e));break;default:Lg(e)}t=t.sibling}}function v3(t,e){for(;Nn!==null;){var n=Nn;switch(n.tag){case 0:case 11:case 15:cl(8,n,e);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var i=n.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:nh(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,Nn=i;else t:for(n=t;Nn!==null;){i=Nn;var a=i.sibling,o=i.return;if(s3(i),i===n){Nn=null;break t}if(a!==null){a.return=o,Nn=a;break t}Nn=o}}}var s8={getCacheForType:function(t){var e=kn(mn),n=e.data.get(t);return n===void 0&&(n=t(),e.data.set(t,n)),n},cacheSignal:function(){return kn(mn).controller.signal}},u8=typeof WeakMap=="function"?WeakMap:Map,re=0,Ae=null,Yt=null,Kt=0,he=0,Ji=null,Zr=!1,Bc=!1,ZE=!1,ir=0,We=0,fl=0,Ts=0,JE=0,ta=0,wc=0,Id=null,Mi=null,Zx=!1,Cy=0,S3=0,iy=1/0,ay=null,il=null,Tn=0,al=null,Mc=null,Wo=0,Jx=0,Wx=null,b3=null,Dd=0,$x=null;function aa(){return re&2&&Kt!==0?Kt&-Kt:Ot.T!==null?$E():Oz()}function x3(){if(ta===0)if(!(Kt&536870912)||Jt){var t=ug;ug<<=1,!(ug&3932160)&&(ug=262144),ta=t}else ta=536870912;return t=ra.current,t!==null&&(t.flags|=32),ta}function Oi(t,e,n){(t===Ae&&(he===2||he===9)||t.cancelPendingCommit!==null)&&(Oc(t,0),Jr(t,Kt,ta,!1)),$d(t,n),(!(re&2)||t!==Ae)&&(t===Ae&&(!(re&2)&&(Ts|=n),We===4&&Jr(t,Kt,ta,!1)),go(t))}function E3(t,e,n){if(re&6)throw Error(J(327));var i=!n&&(e&127)===0&&(e&t.expiredLanes)===0||Wd(t,e),a=i?d8(t,e):ux(t,e,!0),o=i;do{if(a===0){Bc&&!i&&Jr(t,e,0,!1);break}else{if(n=t.current.alternate,o&&!c8(n)){a=ux(t,e,!1),o=!1;continue}if(a===2){if(o=e,t.errorRecoveryDisabledLanes&o)var s=0;else s=t.pendingLanes&-536870913,s=s!==0?s:s&536870912?536870912:0;if(s!==0){e=s;t:{var u=t;a=Id;var d=u.current.memoizedState.isDehydrated;if(d&&(Oc(u,s).flags|=256),s=ux(u,s,!1),s!==2){if(ZE&&!d){u.errorRecoveryDisabledLanes|=o,Ts|=o,a=4;break t}o=Mi,Mi=a,o!==null&&(Mi===null?Mi=o:Mi.push.apply(Mi,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Oc(t,0),Jr(t,e,0,!0);break}t:{switch(i=t,o=a,o){case 0:case 1:throw Error(J(345));case 4:if((e&4194048)!==e)break;case 6:Jr(i,e,ta,!Zr);break t;case 2:Mi=null;break;case 3:case 5:break;default:throw Error(J(329))}if((e&62914560)===e&&(a=Cy+300-ea(),10<a)){if(Jr(i,e,ta,!Zr),my(i,0,!0)!==0)break t;Wo=e,i.timeoutHandle=q3(V_.bind(null,i,n,Mi,ay,Zx,e,ta,Ts,wc,Zr,o,"Throttled",-0,0),a);break t}V_(i,n,Mi,ay,Zx,e,ta,Ts,wc,Zr,o,null,-0,0)}}break}while(!0);go(t)}function V_(t,e,n,i,a,o,s,u,d,p,f,m,g,v){if(t.timeoutHandle=-1,m=e.subtreeFlags,m&8192||(m&16785408)===16785408){m={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Xo},m3(e,o,m);var S=(o&62914560)===o?Cy-ea():(o&4194048)===o?S3-ea():0;if(S=Y8(m,S),S!==null){Wo=o,t.cancelPendingCommit=S(q_.bind(null,t,e,o,n,i,a,s,u,d,f,m,null,g,v)),Jr(t,o,s,!p);return}}q_(t,e,o,n,i,a,s,u,d)}function c8(t){for(var e=t;;){var n=e.tag;if((n===0||n===11||n===15)&&e.flags&16384&&(n=e.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var i=0;i<n.length;i++){var a=n[i],o=a.getSnapshot;a=a.value;try{if(!oa(o(),a))return!1}catch{return!1}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Jr(t,e,n,i){e&=~JE,e&=~Ts,t.suspendedLanes|=e,t.pingedLanes&=~e,i&&(t.warmLanes|=e),i=t.expirationTimes;for(var a=e;0<a;){var o=31-ia(a),s=1<<o;i[o]=-1,a&=~s}n!==0&&Cz(t,n,e)}function wy(){return re&6?!0:(oh(0,!1),!1)}function WE(){if(Yt!==null){if(he===0)var t=Yt.return;else t=Yt,Ko=Ls=null,PE(t),vc=null,qd=0,t=Yt;for(;t!==null;)e3(t.alternate,t),t=t.return;Yt=null}}function Oc(t,e){var n=t.timeoutHandle;n!==-1&&(t.timeoutHandle=-1,M8(n)),n=t.cancelPendingCommit,n!==null&&(t.cancelPendingCommit=null,n()),Wo=0,WE(),Ae=t,Yt=n=Zo(t.current,null),Kt=e,he=0,Ji=null,Zr=!1,Bc=Wd(t,e),ZE=!1,wc=ta=JE=Ts=fl=We=0,Mi=Id=null,Zx=!1,e&8&&(e|=e&32);var i=t.entangledLanes;if(i!==0)for(t=t.entanglements,i&=e;0<i;){var a=31-ia(i),o=1<<a;e|=t[a],i&=~o}return ir=e,Sy(),n}function R3(t,e){Pt=null,Ot.H=Gd,e===Lc||e===xy?(e=v_(),he=3):e===_E?(e=v_(),he=4):he=e===YE?8:e!==null&&typeof e=="object"&&typeof e.then=="function"?6:1,Ji=e,Yt===null&&(We=1,ty(t,wa(e,t.current)))}function A3(){var t=ra.current;return t===null?!0:(Kt&4194048)===Kt?Oa===null:(Kt&62914560)===Kt||Kt&536870912?t===Oa:!1}function T3(){var t=Ot.H;return Ot.H=Gd,t===null?Gd:t}function C3(){var t=Ot.A;return Ot.A=s8,t}function oy(){We=4,Zr||(Kt&4194048)!==Kt&&ra.current!==null||(Bc=!0),!(fl&134217727)&&!(Ts&134217727)||Ae===null||Jr(Ae,Kt,ta,!1)}function ux(t,e,n){var i=re;re|=2;var a=T3(),o=C3();(Ae!==t||Kt!==e)&&(ay=null,Oc(t,e)),e=!1;var s=We;t:do try{if(he!==0&&Yt!==null){var u=Yt,d=Ji;switch(he){case 8:WE(),s=6;break t;case 3:case 2:case 9:case 6:ra.current===null&&(e=!0);var p=he;if(he=0,Ji=null,hc(t,u,d,p),n&&Bc){s=0;break t}break;default:p=he,he=0,Ji=null,hc(t,u,d,p)}}f8(),s=We;break}catch(f){R3(t,f)}while(!0);return e&&t.shellSuspendCounter++,Ko=Ls=null,re=i,Ot.H=a,Ot.A=o,Yt===null&&(Ae=null,Kt=0,Sy()),s}function f8(){for(;Yt!==null;)w3(Yt)}function d8(t,e){var n=re;re|=2;var i=T3(),a=C3();Ae!==t||Kt!==e?(ay=null,iy=ea()+500,Oc(t,e)):Bc=Wd(t,e);t:do try{if(he!==0&&Yt!==null){e=Yt;var o=Ji;e:switch(he){case 1:he=0,Ji=null,hc(t,e,o,1);break;case 2:case 9:if(y_(o)){he=0,Ji=null,j_(e);break}e=function(){he!==2&&he!==9||Ae!==t||(he=7),go(t)},o.then(e,e);break t;case 3:he=7;break t;case 4:he=5;break t;case 7:y_(o)?(he=0,Ji=null,j_(e)):(he=0,Ji=null,hc(t,e,o,7));break;case 5:var s=null;switch(Yt.tag){case 26:s=Yt.memoizedState;case 5:case 27:var u=Yt;if(s?Q3(s):u.stateNode.complete){he=0,Ji=null;var d=u.sibling;if(d!==null)Yt=d;else{var p=u.return;p!==null?(Yt=p,My(p)):Yt=null}break e}}he=0,Ji=null,hc(t,e,o,5);break;case 6:he=0,Ji=null,hc(t,e,o,6);break;case 8:WE(),We=6;break t;default:throw Error(J(462))}}h8();break}catch(f){R3(t,f)}while(!0);return Ko=Ls=null,Ot.H=i,Ot.A=a,re=n,Yt!==null?0:(Ae=null,Kt=0,Sy(),We)}function h8(){for(;Yt!==null&&!BU();)w3(Yt)}function w3(t){var e=t3(t.alternate,t,ir);t.memoizedProps=t.pendingProps,e===null?My(t):Yt=e}function j_(t){var e=t,n=e.alternate;switch(e.tag){case 15:case 0:e=D_(n,e,e.pendingProps,e.type,void 0,Kt);break;case 11:e=D_(n,e,e.pendingProps,e.type.render,e.ref,Kt);break;case 5:PE(e);default:e3(n,e),e=Yt=eN(e,ir),e=t3(n,e,ir)}t.memoizedProps=t.pendingProps,e===null?My(t):Yt=e}function hc(t,e,n,i){Ko=Ls=null,PE(e),vc=null,qd=0;var a=e.return;try{if(e8(t,a,e,n,Kt)){We=1,ty(t,wa(n,t.current)),Yt=null;return}}catch(o){if(a!==null)throw Yt=a,o;We=1,ty(t,wa(n,t.current)),Yt=null;return}e.flags&32768?(Jt||i===1?t=!0:Bc||Kt&536870912?t=!1:(Zr=t=!0,(i===2||i===9||i===3||i===6)&&(i=ra.current,i!==null&&i.tag===13&&(i.flags|=16384))),M3(e,t)):My(e)}function My(t){var e=t;do{if(e.flags&32768){M3(e,Zr);return}t=e.return;var n=a8(e.alternate,e,ir);if(n!==null){Yt=n;return}if(e=e.sibling,e!==null){Yt=e;return}Yt=e=t}while(e!==null);We===0&&(We=5)}function M3(t,e){do{var n=o8(t.alternate,t);if(n!==null){n.flags&=32767,Yt=n;return}if(n=t.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!e&&(t=t.sibling,t!==null)){Yt=t;return}Yt=t=n}while(t!==null);We=6,Yt=null}function q_(t,e,n,i,a,o,s,u,d){t.cancelPendingCommit=null;do Oy();while(Tn!==0);if(re&6)throw Error(J(327));if(e!==null){if(e===t.current)throw Error(J(177));if(o=e.lanes|e.childLanes,o|=RE,YU(t,n,o,s,u,d),t===Ae&&(Yt=Ae=null,Kt=0),Mc=e,al=t,Wo=n,Jx=o,Wx=a,b3=i,e.subtreeFlags&10256||e.flags&10256?(t.callbackNode=null,t.callbackPriority=0,y8(Fg,function(){return I3(),null})):(t.callbackNode=null,t.callbackPriority=0),i=(e.flags&13878)!==0,e.subtreeFlags&13878||i){i=Ot.T,Ot.T=null,a=le.p,le.p=2,s=re,re|=4;try{r8(t,e,n)}finally{re=s,le.p=a,Ot.T=i}}Tn=1,O3(),_3(),z3()}}function O3(){if(Tn===1){Tn=0;var t=al,e=Mc,n=(e.flags&13878)!==0;if(e.subtreeFlags&13878||n){n=Ot.T,Ot.T=null;var i=le.p;le.p=2;var a=re;re|=4;try{d3(e,t);var o=iE,s=Qz(t.containerInfo),u=o.focusedElem,d=o.selectionRange;if(s!==u&&u&&u.ownerDocument&&Yz(u.ownerDocument.documentElement,u)){if(d!==null&&EE(u)){var p=d.start,f=d.end;if(f===void 0&&(f=p),"selectionStart"in u)u.selectionStart=p,u.selectionEnd=Math.min(f,u.value.length);else{var m=u.ownerDocument||document,g=m&&m.defaultView||window;if(g.getSelection){var v=g.getSelection(),S=u.textContent.length,R=Math.min(d.start,S),T=d.end===void 0?R:Math.min(d.end,S);!v.extend&&R>T&&(s=T,T=R,R=s);var E=c_(u,R),x=c_(u,T);if(E&&x&&(v.rangeCount!==1||v.anchorNode!==E.node||v.anchorOffset!==E.offset||v.focusNode!==x.node||v.focusOffset!==x.offset)){var A=m.createRange();A.setStart(E.node,E.offset),v.removeAllRanges(),R>T?(v.addRange(A),v.extend(x.node,x.offset)):(A.setEnd(x.node,x.offset),v.addRange(A))}}}}for(m=[],v=u;v=v.parentNode;)v.nodeType===1&&m.push({element:v,left:v.scrollLeft,top:v.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<m.length;u++){var C=m[u];C.element.scrollLeft=C.left,C.element.scrollTop=C.top}}hy=!!nE,iE=nE=null}finally{re=a,le.p=i,Ot.T=n}}t.current=e,Tn=2}}function _3(){if(Tn===2){Tn=0;var t=al,e=Mc,n=(e.flags&8772)!==0;if(e.subtreeFlags&8772||n){n=Ot.T,Ot.T=null;var i=le.p;le.p=2;var a=re;re|=4;try{l3(t,e.alternate,e)}finally{re=a,le.p=i,Ot.T=n}}Tn=3}}function z3(){if(Tn===4||Tn===3){Tn=0,PU();var t=al,e=Mc,n=Wo,i=b3;e.subtreeFlags&10256||e.flags&10256?Tn=5:(Tn=0,Mc=al=null,N3(t,t.pendingLanes));var a=t.pendingLanes;if(a===0&&(il=null),mE(n),e=e.stateNode,na&&typeof na.onCommitFiberRoot=="function")try{na.onCommitFiberRoot(Jd,e,void 0,(e.current.flags&128)===128)}catch{}if(i!==null){e=Ot.T,a=le.p,le.p=2,Ot.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var u=i[s];o(u.value,{componentStack:u.stack})}}finally{Ot.T=e,le.p=a}}Wo&3&&Oy(),go(t),a=t.pendingLanes,n&261930&&a&42?t===$x?Dd++:(Dd=0,$x=t):Dd=0,oh(0,!1)}}function N3(t,e){(t.pooledCacheLanes&=e)===0&&(e=t.pooledCache,e!=null&&(t.pooledCache=null,nh(e)))}function Oy(){return O3(),_3(),z3(),I3()}function I3(){if(Tn!==5)return!1;var t=al,e=Jx;Jx=0;var n=mE(Wo),i=Ot.T,a=le.p;try{le.p=32>n?32:n,Ot.T=null,n=Wx,Wx=null;var o=al,s=Wo;if(Tn=0,Mc=al=null,Wo=0,re&6)throw Error(J(331));var u=re;if(re|=4,y3(o.current),p3(o,o.current,s,n),re=u,oh(0,!1),na&&typeof na.onPostCommitFiberRoot=="function")try{na.onPostCommitFiberRoot(Jd,o)}catch{}return!0}finally{le.p=a,Ot.T=i,N3(t,e)}}function F_(t,e,n){e=wa(n,e),e=Yx(t.stateNode,e,2),t=nl(t,e,2),t!==null&&($d(t,2),go(t))}function pe(t,e,n){if(t.tag===3)F_(t,t,n);else for(;e!==null;){if(e.tag===3){F_(e,t,n);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(il===null||!il.has(i))){t=wa(n,t),n=XN(2),i=nl(e,n,2),i!==null&&(KN(n,i,e,t),$d(i,2),go(i));break}}e=e.return}}function cx(t,e,n){var i=t.pingCache;if(i===null){i=t.pingCache=new u8;var a=new Set;i.set(e,a)}else a=i.get(e),a===void 0&&(a=new Set,i.set(e,a));a.has(n)||(ZE=!0,a.add(n),t=p8.bind(null,t,e,n),e.then(t,t))}function p8(t,e,n){var i=t.pingCache;i!==null&&i.delete(e),t.pingedLanes|=t.suspendedLanes&n,t.warmLanes&=~n,Ae===t&&(Kt&n)===n&&(We===4||We===3&&(Kt&62914560)===Kt&&300>ea()-Cy?!(re&2)&&Oc(t,0):JE|=n,wc===Kt&&(wc=0)),go(t)}function D3(t,e){e===0&&(e=Tz()),t=Ds(t,e),t!==null&&($d(t,e),go(t))}function m8(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),D3(t,n)}function g8(t,e){var n=0;switch(t.tag){case 31:case 13:var i=t.stateNode,a=t.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=t.stateNode;break;case 22:i=t.stateNode._retryCache;break;default:throw Error(J(314))}i!==null&&i.delete(e),D3(t,n)}function y8(t,e){return hE(t,e)}var ry=null,ec=null,tE=!1,ly=!1,fx=!1,Wr=0;function go(t){t!==ec&&t.next===null&&(ec===null?ry=ec=t:ec=ec.next=t),ly=!0,tE||(tE=!0,S8())}function oh(t,e){if(!fx&&ly){fx=!0;do for(var n=!1,i=ry;i!==null;){if(!e)if(t!==0){var a=i.pendingLanes;if(a===0)var o=0;else{var s=i.suspendedLanes,u=i.pingedLanes;o=(1<<31-ia(42|t)+1)-1,o&=a&~(s&~u),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(n=!0,G_(i,o))}else o=Kt,o=my(i,i===Ae?o:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),!(o&3)||Wd(i,o)||(n=!0,G_(i,o));i=i.next}while(n);fx=!1}}function v8(){L3()}function L3(){ly=tE=!1;var t=0;Wr!==0&&w8()&&(t=Wr);for(var e=ea(),n=null,i=ry;i!==null;){var a=i.next,o=B3(i,e);o===0?(i.next=null,n===null?ry=a:n.next=a,a===null&&(ec=n)):(n=i,(t!==0||o&3)&&(ly=!0)),i=a}Tn!==0&&Tn!==5||oh(t,!1),Wr!==0&&(Wr=0)}function B3(t,e){for(var n=t.suspendedLanes,i=t.pingedLanes,a=t.expirationTimes,o=t.pendingLanes&-62914561;0<o;){var s=31-ia(o),u=1<<s,d=a[s];d===-1?(!(u&n)||u&i)&&(a[s]=kU(u,e)):d<=e&&(t.expiredLanes|=u),o&=~u}if(e=Ae,n=Kt,n=my(t,t===e?n:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),i=t.callbackNode,n===0||t===e&&(he===2||he===9)||t.cancelPendingCommit!==null)return i!==null&&i!==null&&Vb(i),t.callbackNode=null,t.callbackPriority=0;if(!(n&3)||Wd(t,n)){if(e=n&-n,e===t.callbackPriority)return e;switch(i!==null&&Vb(i),mE(n)){case 2:case 8:n=Rz;break;case 32:n=Fg;break;case 268435456:n=Az;break;default:n=Fg}return i=P3.bind(null,t),n=hE(n,i),t.callbackPriority=e,t.callbackNode=n,e}return i!==null&&i!==null&&Vb(i),t.callbackPriority=2,t.callbackNode=null,2}function P3(t,e){if(Tn!==0&&Tn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var n=t.callbackNode;if(Oy()&&t.callbackNode!==n)return null;var i=Kt;return i=my(t,t===Ae?i:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),i===0?null:(E3(t,i,e),B3(t,ea()),t.callbackNode!=null&&t.callbackNode===n?P3.bind(null,t):null)}function G_(t,e){if(Oy())return null;E3(t,e,!0)}function S8(){O8(function(){re&6?hE(Ez,v8):L3()})}function $E(){if(Wr===0){var t=Ac;t===0&&(t=sg,sg<<=1,!(sg&261888)&&(sg=256)),Wr=t}return Wr}function k_(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Cg(""+t)}function Y_(t,e){var n=e.ownerDocument.createElement("input");return n.name=e.name,n.value=e.value,t.id&&n.setAttribute("form",t.id),e.parentNode.insertBefore(n,e),t=new FormData(t),n.parentNode.removeChild(n),t}function b8(t,e,n,i,a){if(e==="submit"&&n&&n.stateNode===a){var o=k_((a[_i]||null).action),s=i.submitter;s&&(e=(e=s[_i]||null)?k_(e.formAction):s.getAttribute("formAction"),e!==null&&(o=e,s=null));var u=new gy("action","action",null,i,a);t.push({event:u,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Wr!==0){var d=s?Y_(a,s):new FormData(a);Gx(n,{pending:!0,data:d,method:a.method,action:o},null,d)}}else typeof o=="function"&&(u.preventDefault(),d=s?Y_(a,s):new FormData(a),Gx(n,{pending:!0,data:d,method:a.method,action:o},o,d))},currentTarget:a}]})}}for(bg=0;bg<Nx.length;bg++)xg=Nx[bg],Q_=xg.toLowerCase(),X_=xg[0].toUpperCase()+xg.slice(1),Xa(Q_,"on"+X_);var xg,Q_,X_,bg;Xa(Kz,"onAnimationEnd");Xa(Zz,"onAnimationIteration");Xa(Jz,"onAnimationStart");Xa("dblclick","onDoubleClick");Xa("focusin","onFocus");Xa("focusout","onBlur");Xa(HV,"onTransitionRun");Xa(UV,"onTransitionStart");Xa(VV,"onTransitionCancel");Xa(Wz,"onTransitionEnd");Ec("onMouseEnter",["mouseout","mouseover"]);Ec("onMouseLeave",["mouseout","mouseover"]);Ec("onPointerEnter",["pointerout","pointerover"]);Ec("onPointerLeave",["pointerout","pointerover"]);zs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));zs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));zs("onBeforeInput",["compositionend","keypress","textInput","paste"]);zs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));zs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));zs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var kd="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),x8=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(kd));function H3(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var i=t[n],a=i.event;i=i.listeners;t:{var o=void 0;if(e)for(var s=i.length-1;0<=s;s--){var u=i[s],d=u.instance,p=u.currentTarget;if(u=u.listener,d!==o&&a.isPropagationStopped())break t;o=u,a.currentTarget=p;try{o(a)}catch(f){kg(f)}a.currentTarget=null,o=d}else for(s=0;s<i.length;s++){if(u=i[s],d=u.instance,p=u.currentTarget,u=u.listener,d!==o&&a.isPropagationStopped())break t;o=u,a.currentTarget=p;try{o(a)}catch(f){kg(f)}a.currentTarget=null,o=d}}}}function kt(t,e){var n=e[Ax];n===void 0&&(n=e[Ax]=new Set);var i=t+"__bubble";n.has(i)||(U3(e,t,2,!1),n.add(i))}function dx(t,e,n){var i=0;e&&(i|=4),U3(n,t,i,e)}var Eg="_reactListening"+Math.random().toString(36).slice(2);function tR(t){if(!t[Eg]){t[Eg]=!0,_z.forEach(function(n){n!=="selectionchange"&&(x8.has(n)||dx(n,!1,t),dx(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Eg]||(e[Eg]=!0,dx("selectionchange",!1,e))}}function U3(t,e,n,i){switch(W3(e)){case 2:var a=K8;break;case 8:a=Z8;break;default:a=aR}n=a.bind(null,e,n,t),a=void 0,!Ox||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(a=!0),i?a!==void 0?t.addEventListener(e,n,{capture:!0,passive:a}):t.addEventListener(e,n,!0):a!==void 0?t.addEventListener(e,n,{passive:a}):t.addEventListener(e,n,!1)}function hx(t,e,n,i,a){var o=i;if(!(e&1)&&!(e&2)&&i!==null)t:for(;;){if(i===null)return;var s=i.tag;if(s===3||s===4){var u=i.stateNode.containerInfo;if(u===a)break;if(s===4)for(s=i.return;s!==null;){var d=s.tag;if((d===3||d===4)&&s.stateNode.containerInfo===a)return;s=s.return}for(;u!==null;){if(s=ac(u),s===null)return;if(d=s.tag,d===5||d===6||d===26||d===27){i=o=s;continue t}u=u.parentNode}}i=i.return}Hz(function(){var p=o,f=vE(n),m=[];t:{var g=$z.get(t);if(g!==void 0){var v=gy,S=t;switch(t){case"keypress":if(Mg(n)===0)break t;case"keydown":case"keyup":v=gV;break;case"focusin":S="focus",v=kb;break;case"focusout":S="blur",v=kb;break;case"beforeblur":case"afterblur":v=kb;break;case"click":if(n.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":v=e_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":v=aV;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":v=SV;break;case Kz:case Zz:case Jz:v=lV;break;case Wz:v=xV;break;case"scroll":case"scrollend":v=nV;break;case"wheel":v=RV;break;case"copy":case"cut":case"paste":v=uV;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":v=i_;break;case"toggle":case"beforetoggle":v=TV}var R=(e&4)!==0,T=!R&&(t==="scroll"||t==="scrollend"),E=R?g!==null?g+"Capture":null:g;R=[];for(var x=p,A;x!==null;){var C=x;if(A=C.stateNode,C=C.tag,C!==5&&C!==26&&C!==27||A===null||E===null||(C=Pd(x,E),C!=null&&R.push(Yd(x,C,A))),T)break;x=x.return}0<R.length&&(g=new v(g,S,null,n,f),m.push({event:g,listeners:R}))}}if(!(e&7)){t:{if(g=t==="mouseover"||t==="pointerover",v=t==="mouseout"||t==="pointerout",g&&n!==Mx&&(S=n.relatedTarget||n.fromElement)&&(ac(S)||S[Nc]))break t;if((v||g)&&(g=f.window===f?f:(g=f.ownerDocument)?g.defaultView||g.parentWindow:window,v?(S=n.relatedTarget||n.toElement,v=p,S=S?ac(S):null,S!==null&&(T=Zd(S),R=S.tag,S!==T||R!==5&&R!==27&&R!==6)&&(S=null)):(v=null,S=p),v!==S)){if(R=e_,C="onMouseLeave",E="onMouseEnter",x="mouse",(t==="pointerout"||t==="pointerover")&&(R=i_,C="onPointerLeave",E="onPointerEnter",x="pointer"),T=v==null?g:bd(v),A=S==null?g:bd(S),g=new R(C,x+"leave",v,n,f),g.target=T,g.relatedTarget=A,C=null,ac(f)===p&&(R=new R(E,x+"enter",S,n,f),R.target=A,R.relatedTarget=T,C=R),T=C,v&&S)e:{for(R=E8,E=v,x=S,A=0,C=E;C;C=R(C))A++;C=0;for(var M=x;M;M=R(M))C++;for(;0<A-C;)E=R(E),A--;for(;0<C-A;)x=R(x),C--;for(;A--;){if(E===x||x!==null&&E===x.alternate){R=E;break e}E=R(E),x=R(x)}R=null}else R=null;v!==null&&K_(m,g,v,R,!1),S!==null&&T!==null&&K_(m,T,S,R,!0)}}t:{if(g=p?bd(p):window,v=g.nodeName&&g.nodeName.toLowerCase(),v==="select"||v==="input"&&g.type==="file")var I=l_;else if(r_(g))if(Gz)I=LV;else{I=IV;var z=NV}else v=g.nodeName,!v||v.toLowerCase()!=="input"||g.type!=="checkbox"&&g.type!=="radio"?p&&yE(p.elementType)&&(I=l_):I=DV;if(I&&(I=I(t,p))){Fz(m,I,n,f);break t}z&&z(t,g,p),t==="focusout"&&p&&g.type==="number"&&p.memoizedProps.value!=null&&wx(g,"number",g.value)}switch(z=p?bd(p):window,t){case"focusin":(r_(z)||z.contentEditable==="true")&&(lc=z,_x=p,Td=null);break;case"focusout":Td=_x=lc=null;break;case"mousedown":zx=!0;break;case"contextmenu":case"mouseup":case"dragend":zx=!1,f_(m,n,f);break;case"selectionchange":if(PV)break;case"keydown":case"keyup":f_(m,n,f)}var D;if(xE)t:{switch(t){case"compositionstart":var k="onCompositionStart";break t;case"compositionend":k="onCompositionEnd";break t;case"compositionupdate":k="onCompositionUpdate";break t}k=void 0}else rc?jz(t,n)&&(k="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(k="onCompositionStart");k&&(Vz&&n.locale!=="ko"&&(rc||k!=="onCompositionStart"?k==="onCompositionEnd"&&rc&&(D=Uz()):(Kr=f,SE="value"in Kr?Kr.value:Kr.textContent,rc=!0)),z=sy(p,k),0<z.length&&(k=new n_(k,t,null,n,f),m.push({event:k,listeners:z}),D?k.data=D:(D=qz(n),D!==null&&(k.data=D)))),(D=wV?MV(t,n):OV(t,n))&&(k=sy(p,"onBeforeInput"),0<k.length&&(z=new n_("onBeforeInput","beforeinput",null,n,f),m.push({event:z,listeners:k}),z.data=D)),b8(m,t,p,n,f)}H3(m,e)})}function Yd(t,e,n){return{instance:t,listener:e,currentTarget:n}}function sy(t,e){for(var n=e+"Capture",i=[];t!==null;){var a=t,o=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||o===null||(a=Pd(t,n),a!=null&&i.unshift(Yd(t,a,o)),a=Pd(t,e),a!=null&&i.push(Yd(t,a,o))),t.tag===3)return i;t=t.return}return[]}function E8(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function K_(t,e,n,i,a){for(var o=e._reactName,s=[];n!==null&&n!==i;){var u=n,d=u.alternate,p=u.stateNode;if(u=u.tag,d!==null&&d===i)break;u!==5&&u!==26&&u!==27||p===null||(d=p,a?(p=Pd(n,o),p!=null&&s.unshift(Yd(n,p,d))):a||(p=Pd(n,o),p!=null&&s.push(Yd(n,p,d)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}var R8=/\r\n?/g,A8=/\u0000|\uFFFD/g;function Z_(t){return(typeof t=="string"?t:""+t).replace(R8,`
20
+ `).replace(A8,"")}function V3(t,e){return e=Z_(e),Z_(t)===e}function Se(t,e,n,i,a,o){switch(n){case"children":typeof i=="string"?e==="body"||e==="textarea"&&i===""||Rc(t,i):(typeof i=="number"||typeof i=="bigint")&&e!=="body"&&Rc(t,""+i);break;case"className":fg(t,"class",i);break;case"tabIndex":fg(t,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":fg(t,n,i);break;case"style":Pz(t,i,o);break;case"data":if(e!=="object"){fg(t,"data",i);break}case"src":case"href":if(i===""&&(e!=="a"||n!=="href")){t.removeAttribute(n);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){t.removeAttribute(n);break}i=Cg(""+i),t.setAttribute(n,i);break;case"action":case"formAction":if(typeof i=="function"){t.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof o=="function"&&(n==="formAction"?(e!=="input"&&Se(t,e,"name",a.name,a,null),Se(t,e,"formEncType",a.formEncType,a,null),Se(t,e,"formMethod",a.formMethod,a,null),Se(t,e,"formTarget",a.formTarget,a,null)):(Se(t,e,"encType",a.encType,a,null),Se(t,e,"method",a.method,a,null),Se(t,e,"target",a.target,a,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){t.removeAttribute(n);break}i=Cg(""+i),t.setAttribute(n,i);break;case"onClick":i!=null&&(t.onclick=Xo);break;case"onScroll":i!=null&&kt("scroll",t);break;case"onScrollEnd":i!=null&&kt("scrollend",t);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(J(61));if(n=i.__html,n!=null){if(a.children!=null)throw Error(J(60));t.innerHTML=n}}break;case"multiple":t.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":t.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){t.removeAttribute("xlink:href");break}n=Cg(""+i),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?t.setAttribute(n,""+i):t.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?t.setAttribute(n,""):t.removeAttribute(n);break;case"capture":case"download":i===!0?t.setAttribute(n,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?t.setAttribute(n,i):t.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?t.setAttribute(n,i):t.removeAttribute(n);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?t.removeAttribute(n):t.setAttribute(n,i);break;case"popover":kt("beforetoggle",t),kt("toggle",t),Tg(t,"popover",i);break;case"xlinkActuate":Vo(t,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Vo(t,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Vo(t,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Vo(t,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Vo(t,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Vo(t,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Vo(t,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Vo(t,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Vo(t,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":Tg(t,"is",i);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=tV.get(n)||n,Tg(t,n,i))}}function eE(t,e,n,i,a,o){switch(n){case"style":Pz(t,i,o);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(J(61));if(n=i.__html,n!=null){if(a.children!=null)throw Error(J(60));t.innerHTML=n}}break;case"children":typeof i=="string"?Rc(t,i):(typeof i=="number"||typeof i=="bigint")&&Rc(t,""+i);break;case"onScroll":i!=null&&kt("scroll",t);break;case"onScrollEnd":i!=null&&kt("scrollend",t);break;case"onClick":i!=null&&(t.onclick=Xo);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!zz.hasOwnProperty(n))t:{if(n[0]==="o"&&n[1]==="n"&&(a=n.endsWith("Capture"),e=n.slice(2,a?n.length-7:void 0),o=t[_i]||null,o=o!=null?o[n]:null,typeof o=="function"&&t.removeEventListener(e,o,a),typeof i=="function")){typeof o!="function"&&o!==null&&(n in t?t[n]=null:t.hasAttribute(n)&&t.removeAttribute(n)),t.addEventListener(e,i,a);break t}n in t?t[n]=i:i===!0?t.setAttribute(n,""):Tg(t,n,i)}}}function Yn(t,e,n){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":kt("error",t),kt("load",t);var i=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case"src":i=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(J(137,e));default:Se(t,e,o,s,n,null)}}a&&Se(t,e,"srcSet",n.srcSet,n,null),i&&Se(t,e,"src",n.src,n,null);return;case"input":kt("invalid",t);var u=o=s=a=null,d=null,p=null;for(i in n)if(n.hasOwnProperty(i)){var f=n[i];if(f!=null)switch(i){case"name":a=f;break;case"type":s=f;break;case"checked":d=f;break;case"defaultChecked":p=f;break;case"value":o=f;break;case"defaultValue":u=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(J(137,e));break;default:Se(t,e,i,f,n,null)}}Dz(t,o,u,d,p,s,a,!1);return;case"select":kt("invalid",t),i=s=o=null;for(a in n)if(n.hasOwnProperty(a)&&(u=n[a],u!=null))switch(a){case"value":o=u;break;case"defaultValue":s=u;break;case"multiple":i=u;default:Se(t,e,a,u,n,null)}e=o,n=s,t.multiple=!!i,e!=null?mc(t,!!i,e,!1):n!=null&&mc(t,!!i,n,!0);return;case"textarea":kt("invalid",t),o=a=i=null;for(s in n)if(n.hasOwnProperty(s)&&(u=n[s],u!=null))switch(s){case"value":i=u;break;case"defaultValue":a=u;break;case"children":o=u;break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(J(91));break;default:Se(t,e,s,u,n,null)}Bz(t,i,a,o);return;case"option":for(d in n)if(n.hasOwnProperty(d)&&(i=n[d],i!=null))switch(d){case"selected":t.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:Se(t,e,d,i,n,null)}return;case"dialog":kt("beforetoggle",t),kt("toggle",t),kt("cancel",t),kt("close",t);break;case"iframe":case"object":kt("load",t);break;case"video":case"audio":for(i=0;i<kd.length;i++)kt(kd[i],t);break;case"image":kt("error",t),kt("load",t);break;case"details":kt("toggle",t);break;case"embed":case"source":case"link":kt("error",t),kt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(p in n)if(n.hasOwnProperty(p)&&(i=n[p],i!=null))switch(p){case"children":case"dangerouslySetInnerHTML":throw Error(J(137,e));default:Se(t,e,p,i,n,null)}return;default:if(yE(e)){for(f in n)n.hasOwnProperty(f)&&(i=n[f],i!==void 0&&eE(t,e,f,i,n,void 0));return}}for(u in n)n.hasOwnProperty(u)&&(i=n[u],i!=null&&Se(t,e,u,i,n,null))}function T8(t,e,n,i){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,o=null,s=null,u=null,d=null,p=null,f=null;for(v in n){var m=n[v];if(n.hasOwnProperty(v)&&m!=null)switch(v){case"checked":break;case"value":break;case"defaultValue":d=m;default:i.hasOwnProperty(v)||Se(t,e,v,null,i,m)}}for(var g in i){var v=i[g];if(m=n[g],i.hasOwnProperty(g)&&(v!=null||m!=null))switch(g){case"type":o=v;break;case"name":a=v;break;case"checked":p=v;break;case"defaultChecked":f=v;break;case"value":s=v;break;case"defaultValue":u=v;break;case"children":case"dangerouslySetInnerHTML":if(v!=null)throw Error(J(137,e));break;default:v!==m&&Se(t,e,g,v,i,m)}}Cx(t,s,u,d,p,f,o,a);return;case"select":v=s=u=g=null;for(o in n)if(d=n[o],n.hasOwnProperty(o)&&d!=null)switch(o){case"value":break;case"multiple":v=d;default:i.hasOwnProperty(o)||Se(t,e,o,null,i,d)}for(a in i)if(o=i[a],d=n[a],i.hasOwnProperty(a)&&(o!=null||d!=null))switch(a){case"value":g=o;break;case"defaultValue":u=o;break;case"multiple":s=o;default:o!==d&&Se(t,e,a,o,i,d)}e=u,n=s,i=v,g!=null?mc(t,!!n,g,!1):!!i!=!!n&&(e!=null?mc(t,!!n,e,!0):mc(t,!!n,n?[]:"",!1));return;case"textarea":v=g=null;for(u in n)if(a=n[u],n.hasOwnProperty(u)&&a!=null&&!i.hasOwnProperty(u))switch(u){case"value":break;case"children":break;default:Se(t,e,u,null,i,a)}for(s in i)if(a=i[s],o=n[s],i.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case"value":g=a;break;case"defaultValue":v=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(J(91));break;default:a!==o&&Se(t,e,s,a,i,o)}Lz(t,g,v);return;case"option":for(var S in n)if(g=n[S],n.hasOwnProperty(S)&&g!=null&&!i.hasOwnProperty(S))switch(S){case"selected":t.selected=!1;break;default:Se(t,e,S,null,i,g)}for(d in i)if(g=i[d],v=n[d],i.hasOwnProperty(d)&&g!==v&&(g!=null||v!=null))switch(d){case"selected":t.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:Se(t,e,d,g,i,v)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var R in n)g=n[R],n.hasOwnProperty(R)&&g!=null&&!i.hasOwnProperty(R)&&Se(t,e,R,null,i,g);for(p in i)if(g=i[p],v=n[p],i.hasOwnProperty(p)&&g!==v&&(g!=null||v!=null))switch(p){case"children":case"dangerouslySetInnerHTML":if(g!=null)throw Error(J(137,e));break;default:Se(t,e,p,g,i,v)}return;default:if(yE(e)){for(var T in n)g=n[T],n.hasOwnProperty(T)&&g!==void 0&&!i.hasOwnProperty(T)&&eE(t,e,T,void 0,i,g);for(f in i)g=i[f],v=n[f],!i.hasOwnProperty(f)||g===v||g===void 0&&v===void 0||eE(t,e,f,g,i,v);return}}for(var E in n)g=n[E],n.hasOwnProperty(E)&&g!=null&&!i.hasOwnProperty(E)&&Se(t,e,E,null,i,g);for(m in i)g=i[m],v=n[m],!i.hasOwnProperty(m)||g===v||g==null&&v==null||Se(t,e,m,g,i,v)}function J_(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function C8(){if(typeof performance.getEntriesByType=="function"){for(var t=0,e=0,n=performance.getEntriesByType("resource"),i=0;i<n.length;i++){var a=n[i],o=a.transferSize,s=a.initiatorType,u=a.duration;if(o&&u&&J_(s)){for(s=0,u=a.responseEnd,i+=1;i<n.length;i++){var d=n[i],p=d.startTime;if(p>u)break;var f=d.transferSize,m=d.initiatorType;f&&J_(m)&&(d=d.responseEnd,s+=f*(d<u?1:(u-p)/(d-p)))}if(--i,e+=8*(o+s)/(a.duration/1e3),t++,10<t)break}}if(0<t)return e/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var nE=null,iE=null;function uy(t){return t.nodeType===9?t:t.ownerDocument}function W_(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function j3(t,e){if(t===0)switch(e){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&e==="foreignObject"?0:t}function aE(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.children=="bigint"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var px=null;function w8(){var t=window.event;return t&&t.type==="popstate"?t===px?!1:(px=t,!0):(px=null,!1)}var q3=typeof setTimeout=="function"?setTimeout:void 0,M8=typeof clearTimeout=="function"?clearTimeout:void 0,$_=typeof Promise=="function"?Promise:void 0,O8=typeof queueMicrotask=="function"?queueMicrotask:typeof $_<"u"?function(t){return $_.resolve(null).then(t).catch(_8)}:q3;function _8(t){setTimeout(function(){throw t})}function hl(t){return t==="head"}function tz(t,e){var n=e,i=0;do{var a=n.nextSibling;if(t.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"||n==="/&"){if(i===0){t.removeChild(a),zc(e);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")Ld(t.ownerDocument.documentElement);else if(n==="head"){n=t.ownerDocument.head,Ld(n);for(var o=n.firstChild;o;){var s=o.nextSibling,u=o.nodeName;o[th]||u==="SCRIPT"||u==="STYLE"||u==="LINK"&&o.rel.toLowerCase()==="stylesheet"||n.removeChild(o),o=s}}else n==="body"&&Ld(t.ownerDocument.body);n=a}while(n);zc(e)}function ez(t,e){var n=t;t=0;do{var i=n.nextSibling;if(n.nodeType===1?e?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(e?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(t===0)break;t--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||t++;n=i}while(n)}function oE(t){var e=t.firstChild;for(e&&e.nodeType===10&&(e=e.nextSibling);e;){var n=e;switch(e=e.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":oE(n),gE(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}t.removeChild(n)}}function z8(t,e,n,i){for(;t.nodeType===1;){var a=n;if(t.nodeName.toLowerCase()!==e.toLowerCase()){if(!i&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(i){if(!t[th])switch(e){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(o=t.getAttribute("rel"),o==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(o!==a.rel||t.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||t.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||t.getAttribute("title")!==(a.title==null?null:a.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(o=t.getAttribute("src"),(o!==(a.src==null?null:a.src)||t.getAttribute("type")!==(a.type==null?null:a.type)||t.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&o&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(e==="input"&&t.type==="hidden"){var o=a.name==null?null:""+a.name;if(a.type==="hidden"&&t.getAttribute("name")===o)return t}else return t;if(t=_a(t.nextSibling),t===null)break}return null}function N8(t,e,n){if(e==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=_a(t.nextSibling),t===null))return null;return t}function F3(t,e){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!e||(t=_a(t.nextSibling),t===null))return null;return t}function rE(t){return t.data==="$?"||t.data==="$~"}function lE(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function I8(t,e){var n=t.ownerDocument;if(t.data==="$~")t._reactRetry=e;else if(t.data!=="$?"||n.readyState!=="loading")e();else{var i=function(){e(),n.removeEventListener("DOMContentLoaded",i)};n.addEventListener("DOMContentLoaded",i),t._reactRetry=i}}function _a(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?"||e==="$~"||e==="&"||e==="F!"||e==="F")break;if(e==="/$"||e==="/&")return null}}return t}var sE=null;function nz(t){t=t.nextSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"||n==="/&"){if(e===0)return _a(t.nextSibling);e--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||e++}t=t.nextSibling}return null}function iz(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(e===0)return t;e--}else n!=="/$"&&n!=="/&"||e++}t=t.previousSibling}return null}function G3(t,e,n){switch(e=uy(n),t){case"html":if(t=e.documentElement,!t)throw Error(J(452));return t;case"head":if(t=e.head,!t)throw Error(J(453));return t;case"body":if(t=e.body,!t)throw Error(J(454));return t;default:throw Error(J(451))}}function Ld(t){for(var e=t.attributes;e.length;)t.removeAttributeNode(e[0]);gE(t)}var za=new Map,az=new Set;function cy(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var ar=le.d;le.d={f:D8,r:L8,D:B8,C:P8,L:H8,m:U8,X:j8,S:V8,M:q8};function D8(){var t=ar.f(),e=wy();return t||e}function L8(t){var e=Ic(t);e!==null&&e.tag===5&&e.type==="form"?PN(e):ar.r(t)}var Pc=typeof document>"u"?null:document;function k3(t,e,n){var i=Pc;if(i&&typeof e=="string"&&e){var a=Ca(e);a='link[rel="'+t+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),az.has(a)||(az.add(a),t={rel:t,crossOrigin:n,href:e},i.querySelector(a)===null&&(e=i.createElement("link"),Yn(e,"link",t),In(e),i.head.appendChild(e)))}}function B8(t){ar.D(t),k3("dns-prefetch",t,null)}function P8(t,e){ar.C(t,e),k3("preconnect",t,e)}function H8(t,e,n){ar.L(t,e,n);var i=Pc;if(i&&t&&e){var a='link[rel="preload"][as="'+Ca(e)+'"]';e==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+Ca(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+Ca(n.imageSizes)+'"]')):a+='[href="'+Ca(t)+'"]';var o=a;switch(e){case"style":o=_c(t);break;case"script":o=Hc(t)}za.has(o)||(t=_e({rel:"preload",href:e==="image"&&n&&n.imageSrcSet?void 0:t,as:e},n),za.set(o,t),i.querySelector(a)!==null||e==="style"&&i.querySelector(rh(o))||e==="script"&&i.querySelector(lh(o))||(e=i.createElement("link"),Yn(e,"link",t),In(e),i.head.appendChild(e)))}}function U8(t,e){ar.m(t,e);var n=Pc;if(n&&t){var i=e&&typeof e.as=="string"?e.as:"script",a='link[rel="modulepreload"][as="'+Ca(i)+'"][href="'+Ca(t)+'"]',o=a;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=Hc(t)}if(!za.has(o)&&(t=_e({rel:"modulepreload",href:t},e),za.set(o,t),n.querySelector(a)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(lh(o)))return}i=n.createElement("link"),Yn(i,"link",t),In(i),n.head.appendChild(i)}}}function V8(t,e,n){ar.S(t,e,n);var i=Pc;if(i&&t){var a=pc(i).hoistableStyles,o=_c(t);e=e||"default";var s=a.get(o);if(!s){var u={loading:0,preload:null};if(s=i.querySelector(rh(o)))u.loading=5;else{t=_e({rel:"stylesheet",href:t,"data-precedence":e},n),(n=za.get(o))&&eR(t,n);var d=s=i.createElement("link");In(d),Yn(d,"link",t),d._p=new Promise(function(p,f){d.onload=p,d.onerror=f}),d.addEventListener("load",function(){u.loading|=1}),d.addEventListener("error",function(){u.loading|=2}),u.loading|=4,Bg(s,e,i)}s={type:"stylesheet",instance:s,count:1,state:u},a.set(o,s)}}}function j8(t,e){ar.X(t,e);var n=Pc;if(n&&t){var i=pc(n).hoistableScripts,a=Hc(t),o=i.get(a);o||(o=n.querySelector(lh(a)),o||(t=_e({src:t,async:!0},e),(e=za.get(a))&&nR(t,e),o=n.createElement("script"),In(o),Yn(o,"link",t),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},i.set(a,o))}}function q8(t,e){ar.M(t,e);var n=Pc;if(n&&t){var i=pc(n).hoistableScripts,a=Hc(t),o=i.get(a);o||(o=n.querySelector(lh(a)),o||(t=_e({src:t,async:!0,type:"module"},e),(e=za.get(a))&&nR(t,e),o=n.createElement("script"),In(o),Yn(o,"link",t),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},i.set(a,o))}}function oz(t,e,n,i){var a=(a=$r.current)?cy(a):null;if(!a)throw Error(J(446));switch(t){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(e=_c(n.href),n=pc(a).hoistableStyles,i=n.get(e),i||(i={type:"style",instance:null,count:0,state:null},n.set(e,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){t=_c(n.href);var o=pc(a).hoistableStyles,s=o.get(t);if(s||(a=a.ownerDocument||a,s={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(t,s),(o=a.querySelector(rh(t)))&&!o._p&&(s.instance=o,s.state.loading=5),za.has(t)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},za.set(t,n),o||F8(a,t,n,s.state))),e&&i===null)throw Error(J(528,""));return s}if(e&&i!==null)throw Error(J(529,""));return null;case"script":return e=n.async,n=n.src,typeof n=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=Hc(n),n=pc(a).hoistableScripts,i=n.get(e),i||(i={type:"script",instance:null,count:0,state:null},n.set(e,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(J(444,t))}}function _c(t){return'href="'+Ca(t)+'"'}function rh(t){return'link[rel="stylesheet"]['+t+"]"}function Y3(t){return _e({},t,{"data-precedence":t.precedence,precedence:null})}function F8(t,e,n,i){t.querySelector('link[rel="preload"][as="style"]['+e+"]")?i.loading=1:(e=t.createElement("link"),i.preload=e,e.addEventListener("load",function(){return i.loading|=1}),e.addEventListener("error",function(){return i.loading|=2}),Yn(e,"link",n),In(e),t.head.appendChild(e))}function Hc(t){return'[src="'+Ca(t)+'"]'}function lh(t){return"script[async]"+t}function rz(t,e,n){if(e.count++,e.instance===null)switch(e.type){case"style":var i=t.querySelector('style[data-href~="'+Ca(n.href)+'"]');if(i)return e.instance=i,In(i),i;var a=_e({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(t.ownerDocument||t).createElement("style"),In(i),Yn(i,"style",a),Bg(i,n.precedence,t),e.instance=i;case"stylesheet":a=_c(n.href);var o=t.querySelector(rh(a));if(o)return e.state.loading|=4,e.instance=o,In(o),o;i=Y3(n),(a=za.get(a))&&eR(i,a),o=(t.ownerDocument||t).createElement("link"),In(o);var s=o;return s._p=new Promise(function(u,d){s.onload=u,s.onerror=d}),Yn(o,"link",i),e.state.loading|=4,Bg(o,n.precedence,t),e.instance=o;case"script":return o=Hc(n.src),(a=t.querySelector(lh(o)))?(e.instance=a,In(a),a):(i=n,(a=za.get(o))&&(i=_e({},n),nR(i,a)),t=t.ownerDocument||t,a=t.createElement("script"),In(a),Yn(a,"link",i),t.head.appendChild(a),e.instance=a);case"void":return null;default:throw Error(J(443,e.type))}else e.type==="stylesheet"&&!(e.state.loading&4)&&(i=e.instance,e.state.loading|=4,Bg(i,n.precedence,t));return e.instance}function Bg(t,e,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=i.length?i[i.length-1]:null,o=a,s=0;s<i.length;s++){var u=i[s];if(u.dataset.precedence===e)o=u;else if(o!==a)break}o?o.parentNode.insertBefore(t,o.nextSibling):(e=n.nodeType===9?n.head:n,e.insertBefore(t,e.firstChild))}function eR(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.title==null&&(t.title=e.title)}function nR(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.integrity==null&&(t.integrity=e.integrity)}var Pg=null;function lz(t,e,n){if(Pg===null){var i=new Map,a=Pg=new Map;a.set(n,i)}else a=Pg,i=a.get(n),i||(i=new Map,a.set(n,i));if(i.has(t))return i;for(i.set(t,null),n=n.getElementsByTagName(t),a=0;a<n.length;a++){var o=n[a];if(!(o[th]||o[Fn]||t==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var s=o.getAttribute(e)||"";s=t+s;var u=i.get(s);u?u.push(o):i.set(s,[o])}}return i}function sz(t,e,n){t=t.ownerDocument||t,t.head.insertBefore(n,e==="title"?t.querySelector("head > title"):null)}function G8(t,e,n){if(n===1||e.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;switch(e.rel){case"stylesheet":return t=e.disabled,typeof e.precedence=="string"&&t==null;default:return!0}case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function Q3(t){return!(t.type==="stylesheet"&&!(t.state.loading&3))}function k8(t,e,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var a=_c(i.href),o=e.querySelector(rh(a));if(o){e=o._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=fy.bind(t),e.then(t,t)),n.state.loading|=4,n.instance=o,In(o);return}o=e.ownerDocument||e,i=Y3(i),(a=za.get(a))&&eR(i,a),o=o.createElement("link"),In(o);var s=o;s._p=new Promise(function(u,d){s.onload=u,s.onerror=d}),Yn(o,"link",i),n.instance=o}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(n,e),(e=n.state.preload)&&!(n.state.loading&3)&&(t.count++,n=fy.bind(t),e.addEventListener("load",n),e.addEventListener("error",n))}}var mx=0;function Y8(t,e){return t.stylesheets&&t.count===0&&Hg(t,t.stylesheets),0<t.count||0<t.imgCount?function(n){var i=setTimeout(function(){if(t.stylesheets&&Hg(t,t.stylesheets),t.unsuspend){var o=t.unsuspend;t.unsuspend=null,o()}},6e4+e);0<t.imgBytes&&mx===0&&(mx=62500*C8());var a=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Hg(t,t.stylesheets),t.unsuspend)){var o=t.unsuspend;t.unsuspend=null,o()}},(t.imgBytes>mx?50:800)+e);return t.unsuspend=n,function(){t.unsuspend=null,clearTimeout(i),clearTimeout(a)}}:null}function fy(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hg(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var dy=null;function Hg(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,dy=new Map,e.forEach(Q8,t),dy=null,fy.call(t))}function Q8(t,e){if(!(e.state.loading&4)){var n=dy.get(t);if(n)var i=n.get(null);else{n=new Map,dy.set(t,n);for(var a=t.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<a.length;o++){var s=a[o];(s.nodeName==="LINK"||s.getAttribute("media")!=="not all")&&(n.set(s.dataset.precedence,s),i=s)}i&&n.set(null,i)}a=e.instance,s=a.getAttribute("data-precedence"),o=n.get(s)||i,o===i&&n.set(null,a),n.set(s,a),this.count++,i=fy.bind(this),a.addEventListener("load",i),a.addEventListener("error",i),o?o.parentNode.insertBefore(a,o.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(a,t.firstChild)),e.state.loading|=4}}var Qd={$$typeof:Qo,Provider:null,Consumer:null,_currentValue:xs,_currentValue2:xs,_threadCount:0};function X8(t,e,n,i,a,o,s,u,d){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=jb(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jb(0),this.hiddenUpdates=jb(null),this.identifierPrefix=i,this.onUncaughtError=a,this.onCaughtError=o,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=d,this.incompleteTransitions=new Map}function X3(t,e,n,i,a,o,s,u,d,p,f,m){return t=new X8(t,e,n,s,d,p,f,m,u),e=1,o===!0&&(e|=24),o=$i(3,null,null,e),t.current=o,o.stateNode=t,e=ME(),e.refCount++,t.pooledCache=e,e.refCount++,o.memoizedState={element:i,isDehydrated:n,cache:e},zE(o),t}function K3(t){return t?(t=cc,t):cc}function Z3(t,e,n,i,a,o){a=K3(a),i.context===null?i.context=a:i.pendingContext=a,i=el(e),i.payload={element:n},o=o===void 0?null:o,o!==null&&(i.callback=o),n=nl(t,i,e),n!==null&&(Oi(n,t,e),wd(n,t,e))}function uz(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function iR(t,e){uz(t,e),(t=t.alternate)&&uz(t,e)}function J3(t){if(t.tag===13||t.tag===31){var e=Ds(t,67108864);e!==null&&Oi(e,t,67108864),iR(t,67108864)}}function cz(t){if(t.tag===13||t.tag===31){var e=aa();e=pE(e);var n=Ds(t,e);n!==null&&Oi(n,t,e),iR(t,e)}}var hy=!0;function K8(t,e,n,i){var a=Ot.T;Ot.T=null;var o=le.p;try{le.p=2,aR(t,e,n,i)}finally{le.p=o,Ot.T=a}}function Z8(t,e,n,i){var a=Ot.T;Ot.T=null;var o=le.p;try{le.p=8,aR(t,e,n,i)}finally{le.p=o,Ot.T=a}}function aR(t,e,n,i){if(hy){var a=uE(i);if(a===null)hx(t,e,i,py,n),fz(t,i);else if(W8(a,t,e,n,i))i.stopPropagation();else if(fz(t,i),e&4&&-1<J8.indexOf(t)){for(;a!==null;){var o=Ic(a);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var s=vs(o.pendingLanes);if(s!==0){var u=o;for(u.pendingLanes|=2,u.entangledLanes|=2;s;){var d=1<<31-ia(s);u.entanglements[1]|=d,s&=~d}go(o),!(re&6)&&(iy=ea()+500,oh(0,!1))}}break;case 31:case 13:u=Ds(o,2),u!==null&&Oi(u,o,2),wy(),iR(o,2)}if(o=uE(i),o===null&&hx(t,e,i,py,n),o===a)break;a=o}a!==null&&i.stopPropagation()}else hx(t,e,i,null,n)}}function uE(t){return t=vE(t),oR(t)}var py=null;function oR(t){if(py=null,t=ac(t),t!==null){var e=Zd(t);if(e===null)t=null;else{var n=e.tag;if(n===13){if(t=yz(e),t!==null)return t;t=null}else if(n===31){if(t=vz(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null)}}return py=t,null}function W3(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(HU()){case Ez:return 2;case Rz:return 8;case Fg:case UU:return 32;case Az:return 268435456;default:return 32}default:return 32}}var cE=!1,ol=null,rl=null,ll=null,Xd=new Map,Kd=new Map,Qr=[],J8="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function fz(t,e){switch(t){case"focusin":case"focusout":ol=null;break;case"dragenter":case"dragleave":rl=null;break;case"mouseover":case"mouseout":ll=null;break;case"pointerover":case"pointerout":Xd.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Kd.delete(e.pointerId)}}function gd(t,e,n,i,a,o){return t===null||t.nativeEvent!==o?(t={blockedOn:e,domEventName:n,eventSystemFlags:i,nativeEvent:o,targetContainers:[a]},e!==null&&(e=Ic(e),e!==null&&J3(e)),t):(t.eventSystemFlags|=i,e=t.targetContainers,a!==null&&e.indexOf(a)===-1&&e.push(a),t)}function W8(t,e,n,i,a){switch(e){case"focusin":return ol=gd(ol,t,e,n,i,a),!0;case"dragenter":return rl=gd(rl,t,e,n,i,a),!0;case"mouseover":return ll=gd(ll,t,e,n,i,a),!0;case"pointerover":var o=a.pointerId;return Xd.set(o,gd(Xd.get(o)||null,t,e,n,i,a)),!0;case"gotpointercapture":return o=a.pointerId,Kd.set(o,gd(Kd.get(o)||null,t,e,n,i,a)),!0}return!1}function $3(t){var e=ac(t.target);if(e!==null){var n=Zd(e);if(n!==null){if(e=n.tag,e===13){if(e=yz(n),e!==null){t.blockedOn=e,XO(t.priority,function(){cz(n)});return}}else if(e===31){if(e=vz(n),e!==null){t.blockedOn=e,XO(t.priority,function(){cz(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Ug(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=uE(t.nativeEvent);if(n===null){n=t.nativeEvent;var i=new n.constructor(n.type,n);Mx=i,n.target.dispatchEvent(i),Mx=null}else return e=Ic(n),e!==null&&J3(e),t.blockedOn=n,!1;e.shift()}return!0}function dz(t,e,n){Ug(t)&&n.delete(e)}function $8(){cE=!1,ol!==null&&Ug(ol)&&(ol=null),rl!==null&&Ug(rl)&&(rl=null),ll!==null&&Ug(ll)&&(ll=null),Xd.forEach(dz),Kd.forEach(dz)}function Rg(t,e){t.blockedOn===e&&(t.blockedOn=null,cE||(cE=!0,Cn.unstable_scheduleCallback(Cn.unstable_NormalPriority,$8)))}var Ag=null;function hz(t){Ag!==t&&(Ag=t,Cn.unstable_scheduleCallback(Cn.unstable_NormalPriority,function(){Ag===t&&(Ag=null);for(var e=0;e<t.length;e+=3){var n=t[e],i=t[e+1],a=t[e+2];if(typeof i!="function"){if(oR(i||n)===null)continue;break}var o=Ic(n);o!==null&&(t.splice(e,3),e-=3,Gx(o,{pending:!0,data:a,method:n.method,action:i},i,a))}}))}function zc(t){function e(d){return Rg(d,t)}ol!==null&&Rg(ol,t),rl!==null&&Rg(rl,t),ll!==null&&Rg(ll,t),Xd.forEach(e),Kd.forEach(e);for(var n=0;n<Qr.length;n++){var i=Qr[n];i.blockedOn===t&&(i.blockedOn=null)}for(;0<Qr.length&&(n=Qr[0],n.blockedOn===null);)$3(n),n.blockedOn===null&&Qr.shift();if(n=(t.ownerDocument||t).$$reactFormReplay,n!=null)for(i=0;i<n.length;i+=3){var a=n[i],o=n[i+1],s=a[_i]||null;if(typeof o=="function")s||hz(n);else if(s){var u=null;if(o&&o.hasAttribute("formAction")){if(a=o,s=o[_i]||null)u=s.formAction;else if(oR(a)!==null)continue}else u=s.action;typeof u=="function"?n[i+1]=u:(n.splice(i,3),i-=3),hz(n)}}}function tI(){function t(o){o.canIntercept&&o.info==="react-transition"&&o.intercept({handler:function(){return new Promise(function(s){return a=s})},focusReset:"manual",scroll:"manual"})}function e(){a!==null&&(a(),a=null),i||setTimeout(n,20)}function n(){if(!i&&!navigation.transition){var o=navigation.currentEntry;o&&o.url!=null&&navigation.navigate(o.url,{state:o.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,a=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",e),navigation.addEventListener("navigateerror",e),setTimeout(n,100),function(){i=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",e),navigation.removeEventListener("navigateerror",e),a!==null&&(a(),a=null)}}}function rR(t){this._internalRoot=t}_y.prototype.render=rR.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(J(409));var n=e.current,i=aa();Z3(n,i,t,e,null,null)};_y.prototype.unmount=rR.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Z3(t.current,2,null,t,null,null),wy(),e[Nc]=null}};function _y(t){this._internalRoot=t}_y.prototype.unstable_scheduleHydration=function(t){if(t){var e=Oz();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Qr.length&&e!==0&&e<Qr[n].priority;n++);Qr.splice(n,0,t),n===0&&$3(t)}};var pz=mz.version;if(pz!=="19.2.0")throw Error(J(527,pz,"19.2.0"));le.findDOMNode=function(t){var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(J(188)):(t=Object.keys(t).join(","),Error(J(268,t)));return t=zU(e),t=t!==null?Sz(t):null,t=t===null?null:t.stateNode,t};var tj={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:Ot,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(yd=__REACT_DEVTOOLS_GLOBAL_HOOK__,!yd.isDisabled&&yd.supportsFiber))try{Jd=yd.inject(tj),na=yd}catch{}var yd;zy.createRoot=function(t,e){if(!gz(t))throw Error(J(299));var n=!1,i="",a=kN,o=YN,s=QN;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onUncaughtError!==void 0&&(a=e.onUncaughtError),e.onCaughtError!==void 0&&(o=e.onCaughtError),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=X3(t,1,!1,null,null,n,i,null,a,o,s,tI),t[Nc]=e.current,tR(t),new rR(e)};zy.hydrateRoot=function(t,e,n){if(!gz(t))throw Error(J(299));var i=!1,a="",o=kN,s=YN,u=QN,d=null;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onUncaughtError!==void 0&&(o=n.onUncaughtError),n.onCaughtError!==void 0&&(s=n.onCaughtError),n.onRecoverableError!==void 0&&(u=n.onRecoverableError),n.formState!==void 0&&(d=n.formState)),e=X3(t,1,!0,e,n??null,i,a,d,o,s,u,tI),e.context=K3(null),n=e.current,i=aa(),i=pE(i),a=el(i),a.callback=null,nl(n,a,i),n=i,e.current.lanes=n,$d(e,n),go(e),t[Nc]=e.current,tR(t),new _y(e)};zy.version="19.2.0"});var aI=li((qY,iI)=>{"use strict";function nI(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(nI)}catch(t){console.error(t)}}nI(),iI.exports=eI()});var M4=li((Pit,w4)=>{"use strict";(()=>{var t={296:(a,o,s)=>{var u=/^\s+|\s+$/g,d=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,f=/^0o[0-7]+$/i,m=parseInt,g=typeof s.g=="object"&&s.g&&s.g.Object===Object&&s.g,v=typeof self=="object"&&self&&self.Object===Object&&self,S=g||v||Function("return this")(),R=Object.prototype.toString,T=Math.max,E=Math.min,x=function(){return S.Date.now()};function A(M){var I=typeof M;return!!M&&(I=="object"||I=="function")}function C(M){if(typeof M=="number")return M;if(function(D){return typeof D=="symbol"||function(k){return!!k&&typeof k=="object"}(D)&&R.call(D)=="[object Symbol]"}(M))return NaN;if(A(M)){var I=typeof M.valueOf=="function"?M.valueOf():M;M=A(I)?I+"":I}if(typeof M!="string")return M===0?M:+M;M=M.replace(u,"");var z=p.test(M);return z||f.test(M)?m(M.slice(2),z?2:8):d.test(M)?NaN:+M}a.exports=function(M,I,z){var D,k,B,Q,it,lt,et=0,$=!1,ht=!1,bt=!0;if(typeof M!="function")throw new TypeError("Expected a function");function st(ce){var se=D,ae=k;return D=k=void 0,et=ce,Q=M.apply(ae,se)}function rt(ce){var se=ce-lt;return lt===void 0||se>=I||se<0||ht&&ce-et>=B}function Y(){var ce=x();if(rt(ce))return At(ce);it=setTimeout(Y,function(se){var ae=I-(se-lt);return ht?E(ae,B-(se-et)):ae}(ce))}function At(ce){return it=void 0,bt&&D?st(ce):(D=k=void 0,Q)}function Qt(){var ce=x(),se=rt(ce);if(D=arguments,k=this,lt=ce,se){if(it===void 0)return function(ae){return et=ae,it=setTimeout(Y,I),$?st(ae):Q}(lt);if(ht)return it=setTimeout(Y,I),st(lt)}return it===void 0&&(it=setTimeout(Y,I)),Q}return I=C(I)||0,A(z)&&($=!!z.leading,B=(ht="maxWait"in z)?T(C(z.maxWait)||0,I):B,bt="trailing"in z?!!z.trailing:bt),Qt.cancel=function(){it!==void 0&&clearTimeout(it),et=0,D=lt=k=it=void 0},Qt.flush=function(){return it===void 0?Q:At(x())},Qt}},96:(a,o,s)=>{var u="Expected a function",d=NaN,p="[object Symbol]",f=/^\s+|\s+$/g,m=/^[-+]0x[0-9a-f]+$/i,g=/^0b[01]+$/i,v=/^0o[0-7]+$/i,S=parseInt,R=typeof s.g=="object"&&s.g&&s.g.Object===Object&&s.g,T=typeof self=="object"&&self&&self.Object===Object&&self,E=R||T||Function("return this")(),x=Object.prototype.toString,A=Math.max,C=Math.min,M=function(){return E.Date.now()};function I(D){var k=typeof D;return!!D&&(k=="object"||k=="function")}function z(D){if(typeof D=="number")return D;if(function(Q){return typeof Q=="symbol"||function(it){return!!it&&typeof it=="object"}(Q)&&x.call(Q)==p}(D))return d;if(I(D)){var k=typeof D.valueOf=="function"?D.valueOf():D;D=I(k)?k+"":k}if(typeof D!="string")return D===0?D:+D;D=D.replace(f,"");var B=g.test(D);return B||v.test(D)?S(D.slice(2),B?2:8):m.test(D)?d:+D}a.exports=function(D,k,B){var Q=!0,it=!0;if(typeof D!="function")throw new TypeError(u);return I(B)&&(Q="leading"in B?!!B.leading:Q,it="trailing"in B?!!B.trailing:it),function(lt,et,$){var ht,bt,st,rt,Y,At,Qt=0,ce=!1,se=!1,ae=!0;if(typeof lt!="function")throw new TypeError(u);function me(fe){var ue=ht,$t=bt;return ht=bt=void 0,Qt=fe,rt=lt.apply($t,ue)}function Ie(fe){var ue=fe-At;return At===void 0||ue>=et||ue<0||se&&fe-Qt>=st}function oe(){var fe=M();if(Ie(fe))return da(fe);Y=setTimeout(oe,function(ue){var $t=et-(ue-At);return se?C($t,st-(ue-Qt)):$t}(fe))}function da(fe){return Y=void 0,ae&&ht?me(fe):(ht=bt=void 0,rt)}function ii(){var fe=M(),ue=Ie(fe);if(ht=arguments,bt=this,At=fe,ue){if(Y===void 0)return function($t){return Qt=$t,Y=setTimeout(oe,et),ce?me($t):rt}(At);if(se)return Y=setTimeout(oe,et),me(At)}return Y===void 0&&(Y=setTimeout(oe,et)),rt}return et=z(et)||0,I($)&&(ce=!!$.leading,st=(se="maxWait"in $)?A(z($.maxWait)||0,et):st,ae="trailing"in $?!!$.trailing:ae),ii.cancel=function(){Y!==void 0&&clearTimeout(Y),Qt=0,ht=At=bt=Y=void 0},ii.flush=function(){return Y===void 0?rt:da(M())},ii}(D,k,{leading:Q,maxWait:k,trailing:it})}},703:(a,o,s)=>{"use strict";var u=s(414);function d(){}function p(){}p.resetWarningCache=d,a.exports=function(){function f(v,S,R,T,E,x){if(x!==u){var A=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw A.name="Invariant Violation",A}}function m(){return f}f.isRequired=f;var g={array:f,bigint:f,bool:f,func:f,number:f,object:f,string:f,symbol:f,any:f,arrayOf:m,element:f,elementType:f,instanceOf:m,node:f,objectOf:m,oneOf:m,oneOfType:m,shape:m,exact:m,checkPropTypes:p,resetWarningCache:d};return g.PropTypes=g,g}},697:(a,o,s)=>{a.exports=s(703)()},414:a=>{"use strict";a.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}},e={};function n(a){var o=e[a];if(o!==void 0)return o.exports;var s=e[a]={exports:{}};return t[a](s,s.exports,n),s.exports}n.n=a=>{var o=a&&a.__esModule?()=>a.default:()=>a;return n.d(o,{a:o}),o},n.d=(a,o)=>{for(var s in o)n.o(o,s)&&!n.o(a,s)&&Object.defineProperty(a,s,{enumerable:!0,get:o[s]})},n.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),n.o=(a,o)=>Object.prototype.hasOwnProperty.call(a,o),n.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var i={};(()=>{"use strict";n.r(i),n.d(i,{LazyLoadComponent:()=>Et,LazyLoadImage:()=>vt,trackWindowScroll:()=>At});let a=X();var o=n.n(a),s=n(697);let u=ms();var d=n.n(u);function p(){return typeof window<"u"&&"IntersectionObserver"in window&&"isIntersecting"in window.IntersectionObserverEntry.prototype}function f(j){return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(L){return typeof L}:function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},f(j)}function m(j,L){var W=Object.keys(j);if(Object.getOwnPropertySymbols){var nt=Object.getOwnPropertySymbols(j);L&&(nt=nt.filter(function(zt){return Object.getOwnPropertyDescriptor(j,zt).enumerable})),W.push.apply(W,nt)}return W}function g(j,L,W){return(L=S(L))in j?Object.defineProperty(j,L,{value:W,enumerable:!0,configurable:!0,writable:!0}):j[L]=W,j}function v(j,L){for(var W=0;W<L.length;W++){var nt=L[W];nt.enumerable=nt.enumerable||!1,nt.configurable=!0,"value"in nt&&(nt.writable=!0),Object.defineProperty(j,S(nt.key),nt)}}function S(j){var L=function(W,nt){if(f(W)!=="object"||W===null)return W;var zt=W[Symbol.toPrimitive];if(zt!==void 0){var Dt=zt.call(W,"string");if(f(Dt)!=="object")return Dt;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(W)}(j);return f(L)==="symbol"?L:String(L)}function R(j,L){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(W,nt){return W.__proto__=nt,W},R(j,L)}function T(j){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(L){return L.__proto__||Object.getPrototypeOf(L)},T(j)}var E=function(j){j.forEach(function(L){L.isIntersecting&&L.target.onVisible()})},x={},A=function(j){(function(F,Z){if(typeof Z!="function"&&Z!==null)throw new TypeError("Super expression must either be null or a function");F.prototype=Object.create(Z&&Z.prototype,{constructor:{value:F,writable:!0,configurable:!0}}),Object.defineProperty(F,"prototype",{writable:!1}),Z&&R(F,Z)})(jt,j);var L,W,nt,zt,Dt=(nt=jt,zt=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var F,Z=T(nt);if(zt){var pt=T(this).constructor;F=Reflect.construct(Z,arguments,pt)}else F=Z.apply(this,arguments);return function(yt,dt){if(dt&&(f(dt)==="object"||typeof dt=="function"))return dt;if(dt!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Ht){if(Ht===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Ht}(yt)}(this,F)});function jt(F){var Z;if(function(yt,dt){if(!(yt instanceof dt))throw new TypeError("Cannot call a class as a function")}(this,jt),(Z=Dt.call(this,F)).supportsObserver=!F.scrollPosition&&F.useIntersectionObserver&&p(),Z.supportsObserver){var pt=F.threshold;Z.observer=function(yt){return x[yt]=x[yt]||new IntersectionObserver(E,{rootMargin:yt+"px"}),x[yt]}(pt)}return Z}return L=jt,W=[{key:"componentDidMount",value:function(){this.placeholder&&this.observer&&(this.placeholder.onVisible=this.props.onVisible,this.observer.observe(this.placeholder)),this.supportsObserver||this.updateVisibility()}},{key:"componentWillUnmount",value:function(){this.observer&&this.placeholder&&this.observer.unobserve(this.placeholder)}},{key:"componentDidUpdate",value:function(){this.supportsObserver||this.updateVisibility()}},{key:"getPlaceholderBoundingBox",value:function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props.scrollPosition,Z=this.placeholder.getBoundingClientRect(),pt=d().findDOMNode(this.placeholder).style,yt=parseInt(pt.getPropertyValue("margin-left"),10)||0,dt=parseInt(pt.getPropertyValue("margin-top"),10)||0;return{bottom:F.y+Z.bottom+dt,left:F.x+Z.left+yt,right:F.x+Z.right+yt,top:F.y+Z.top+dt}}},{key:"isPlaceholderInViewport",value:function(){if(typeof window>"u"||!this.placeholder)return!1;var F=this.props,Z=F.scrollPosition,pt=F.threshold,yt=this.getPlaceholderBoundingBox(Z),dt=Z.y+window.innerHeight,Ht=Z.x,xe=Z.x+window.innerWidth,ge=Z.y;return ge-pt<=yt.bottom&&dt+pt>=yt.top&&Ht-pt<=yt.right&&xe+pt>=yt.left}},{key:"updateVisibility",value:function(){this.isPlaceholderInViewport()&&this.props.onVisible()}},{key:"render",value:function(){var F=this,Z=this.props,pt=Z.className,yt=Z.height,dt=Z.placeholder,Ht=Z.style,xe=Z.width;if(dt&&typeof dt.type!="function")return o().cloneElement(dt,{ref:function(ye){return F.placeholder=ye}});var ge=function(ye){for(var Ye=1;Ye<arguments.length;Ye++){var Pe=arguments[Ye]!=null?arguments[Ye]:{};Ye%2?m(Object(Pe),!0).forEach(function(xn){g(ye,xn,Pe[xn])}):Object.getOwnPropertyDescriptors?Object.defineProperties(ye,Object.getOwnPropertyDescriptors(Pe)):m(Object(Pe)).forEach(function(xn){Object.defineProperty(ye,xn,Object.getOwnPropertyDescriptor(Pe,xn))})}return ye}({display:"inline-block"},Ht);return xe!==void 0&&(ge.width=xe),yt!==void 0&&(ge.height=yt),o().createElement("span",{className:pt,ref:function(ye){return F.placeholder=ye},style:ge},dt)}}],W&&v(L.prototype,W),Object.defineProperty(L,"prototype",{writable:!1}),jt}(o().Component);A.propTypes={onVisible:s.PropTypes.func.isRequired,className:s.PropTypes.string,height:s.PropTypes.oneOfType([s.PropTypes.number,s.PropTypes.string]),placeholder:s.PropTypes.element,threshold:s.PropTypes.number,useIntersectionObserver:s.PropTypes.bool,scrollPosition:s.PropTypes.shape({x:s.PropTypes.number.isRequired,y:s.PropTypes.number.isRequired}),width:s.PropTypes.oneOfType([s.PropTypes.number,s.PropTypes.string])},A.defaultProps={className:"",placeholder:null,threshold:100,useIntersectionObserver:!0};let C=A;var M=n(296),I=n.n(M),z=n(96),D=n.n(z),k=function(j){var L=getComputedStyle(j,null);return L.getPropertyValue("overflow")+L.getPropertyValue("overflow-y")+L.getPropertyValue("overflow-x")};let B=function(j){if(!(j instanceof HTMLElement))return window;for(var L=j;L&&L instanceof HTMLElement;){if(/(scroll|auto)/.test(k(L)))return L;L=L.parentNode}return window};function Q(j){return Q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(L){return typeof L}:function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},Q(j)}var it=["delayMethod","delayTime"];function lt(){return lt=Object.assign?Object.assign.bind():function(j){for(var L=1;L<arguments.length;L++){var W=arguments[L];for(var nt in W)Object.prototype.hasOwnProperty.call(W,nt)&&(j[nt]=W[nt])}return j},lt.apply(this,arguments)}function et(j,L){for(var W=0;W<L.length;W++){var nt=L[W];nt.enumerable=nt.enumerable||!1,nt.configurable=!0,"value"in nt&&(nt.writable=!0),Object.defineProperty(j,(zt=function(Dt,jt){if(Q(Dt)!=="object"||Dt===null)return Dt;var F=Dt[Symbol.toPrimitive];if(F!==void 0){var Z=F.call(Dt,"string");if(Q(Z)!=="object")return Z;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(Dt)}(nt.key),Q(zt)==="symbol"?zt:String(zt)),nt)}var zt}function $(j,L){return $=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(W,nt){return W.__proto__=nt,W},$(j,L)}function ht(j,L){if(L&&(Q(L)==="object"||typeof L=="function"))return L;if(L!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return bt(j)}function bt(j){if(j===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return j}function st(j){return st=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(L){return L.__proto__||Object.getPrototypeOf(L)},st(j)}var rt=function(){return typeof window>"u"?0:window.scrollX||window.pageXOffset},Y=function(){return typeof window>"u"?0:window.scrollY||window.pageYOffset};let At=function(j){var L=function(W){(function(pt,yt){if(typeof yt!="function"&&yt!==null)throw new TypeError("Super expression must either be null or a function");pt.prototype=Object.create(yt&&yt.prototype,{constructor:{value:pt,writable:!0,configurable:!0}}),Object.defineProperty(pt,"prototype",{writable:!1}),yt&&$(pt,yt)})(Z,W);var nt,zt,Dt,jt,F=(Dt=Z,jt=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var pt,yt=st(Dt);if(jt){var dt=st(this).constructor;pt=Reflect.construct(yt,arguments,dt)}else pt=yt.apply(this,arguments);return ht(this,pt)});function Z(pt){var yt;if(function(Ht,xe){if(!(Ht instanceof xe))throw new TypeError("Cannot call a class as a function")}(this,Z),(yt=F.call(this,pt)).useIntersectionObserver=pt.useIntersectionObserver&&p(),yt.useIntersectionObserver)return ht(yt);var dt=yt.onChangeScroll.bind(bt(yt));return pt.delayMethod==="debounce"?yt.delayedScroll=I()(dt,pt.delayTime):pt.delayMethod==="throttle"&&(yt.delayedScroll=D()(dt,pt.delayTime)),yt.state={scrollPosition:{x:rt(),y:Y()}},yt.baseComponentRef=o().createRef(),yt}return nt=Z,(zt=[{key:"componentDidMount",value:function(){this.addListeners()}},{key:"componentWillUnmount",value:function(){this.removeListeners()}},{key:"componentDidUpdate",value:function(){typeof window>"u"||this.useIntersectionObserver||B(d().findDOMNode(this.baseComponentRef.current))!==this.scrollElement&&(this.removeListeners(),this.addListeners())}},{key:"addListeners",value:function(){typeof window>"u"||this.useIntersectionObserver||(this.scrollElement=B(d().findDOMNode(this.baseComponentRef.current)),this.scrollElement.addEventListener("scroll",this.delayedScroll,{passive:!0}),window.addEventListener("resize",this.delayedScroll,{passive:!0}),this.scrollElement!==window&&window.addEventListener("scroll",this.delayedScroll,{passive:!0}))}},{key:"removeListeners",value:function(){typeof window>"u"||this.useIntersectionObserver||(this.scrollElement.removeEventListener("scroll",this.delayedScroll),window.removeEventListener("resize",this.delayedScroll),this.scrollElement!==window&&window.removeEventListener("scroll",this.delayedScroll))}},{key:"onChangeScroll",value:function(){this.useIntersectionObserver||this.setState({scrollPosition:{x:rt(),y:Y()}})}},{key:"render",value:function(){var pt=this.props,yt=(pt.delayMethod,pt.delayTime,function(Ht,xe){if(Ht==null)return{};var ge,ye,Ye=function(xn,vi){if(xn==null)return{};var io,Ll,Bl={},pr=Object.keys(xn);for(Ll=0;Ll<pr.length;Ll++)io=pr[Ll],vi.indexOf(io)>=0||(Bl[io]=xn[io]);return Bl}(Ht,xe);if(Object.getOwnPropertySymbols){var Pe=Object.getOwnPropertySymbols(Ht);for(ye=0;ye<Pe.length;ye++)ge=Pe[ye],xe.indexOf(ge)>=0||Object.prototype.propertyIsEnumerable.call(Ht,ge)&&(Ye[ge]=Ht[ge])}return Ye}(pt,it)),dt=this.useIntersectionObserver?null:this.state.scrollPosition;return o().createElement(j,lt({forwardRef:this.baseComponentRef,scrollPosition:dt},yt))}}])&&et(nt.prototype,zt),Object.defineProperty(nt,"prototype",{writable:!1}),Z}(o().Component);return L.propTypes={delayMethod:s.PropTypes.oneOf(["debounce","throttle"]),delayTime:s.PropTypes.number,useIntersectionObserver:s.PropTypes.bool},L.defaultProps={delayMethod:"throttle",delayTime:300,useIntersectionObserver:!0},L};function Qt(j){return Qt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(L){return typeof L}:function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},Qt(j)}function ce(j,L){for(var W=0;W<L.length;W++){var nt=L[W];nt.enumerable=nt.enumerable||!1,nt.configurable=!0,"value"in nt&&(nt.writable=!0),Object.defineProperty(j,(zt=function(Dt,jt){if(Qt(Dt)!=="object"||Dt===null)return Dt;var F=Dt[Symbol.toPrimitive];if(F!==void 0){var Z=F.call(Dt,"string");if(Qt(Z)!=="object")return Z;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(Dt)}(nt.key),Qt(zt)==="symbol"?zt:String(zt)),nt)}var zt}function se(j,L){return se=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(W,nt){return W.__proto__=nt,W},se(j,L)}function ae(j){return ae=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(L){return L.__proto__||Object.getPrototypeOf(L)},ae(j)}var me=function(j){(function(F,Z){if(typeof Z!="function"&&Z!==null)throw new TypeError("Super expression must either be null or a function");F.prototype=Object.create(Z&&Z.prototype,{constructor:{value:F,writable:!0,configurable:!0}}),Object.defineProperty(F,"prototype",{writable:!1}),Z&&se(F,Z)})(jt,j);var L,W,nt,zt,Dt=(nt=jt,zt=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var F,Z=ae(nt);if(zt){var pt=ae(this).constructor;F=Reflect.construct(Z,arguments,pt)}else F=Z.apply(this,arguments);return function(yt,dt){if(dt&&(Qt(dt)==="object"||typeof dt=="function"))return dt;if(dt!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Ht){if(Ht===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Ht}(yt)}(this,F)});function jt(F){return function(Z,pt){if(!(Z instanceof pt))throw new TypeError("Cannot call a class as a function")}(this,jt),Dt.call(this,F)}return L=jt,(W=[{key:"render",value:function(){return o().createElement(C,this.props)}}])&&ce(L.prototype,W),Object.defineProperty(L,"prototype",{writable:!1}),jt}(o().Component);let Ie=At(me);function oe(j){return oe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(L){return typeof L}:function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},oe(j)}function da(j,L){for(var W=0;W<L.length;W++){var nt=L[W];nt.enumerable=nt.enumerable||!1,nt.configurable=!0,"value"in nt&&(nt.writable=!0),Object.defineProperty(j,(zt=function(Dt,jt){if(oe(Dt)!=="object"||Dt===null)return Dt;var F=Dt[Symbol.toPrimitive];if(F!==void 0){var Z=F.call(Dt,"string");if(oe(Z)!=="object")return Z;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(Dt)}(nt.key),oe(zt)==="symbol"?zt:String(zt)),nt)}var zt}function ii(j,L){return ii=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(W,nt){return W.__proto__=nt,W},ii(j,L)}function fe(j){if(j===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return j}function ue(j){return ue=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(L){return L.__proto__||Object.getPrototypeOf(L)},ue(j)}var $t=function(j){(function(F,Z){if(typeof Z!="function"&&Z!==null)throw new TypeError("Super expression must either be null or a function");F.prototype=Object.create(Z&&Z.prototype,{constructor:{value:F,writable:!0,configurable:!0}}),Object.defineProperty(F,"prototype",{writable:!1}),Z&&ii(F,Z)})(jt,j);var L,W,nt,zt,Dt=(nt=jt,zt=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var F,Z=ue(nt);if(zt){var pt=ue(this).constructor;F=Reflect.construct(Z,arguments,pt)}else F=Z.apply(this,arguments);return function(yt,dt){if(dt&&(oe(dt)==="object"||typeof dt=="function"))return dt;if(dt!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return fe(yt)}(this,F)});function jt(F){var Z;(function(xe,ge){if(!(xe instanceof ge))throw new TypeError("Cannot call a class as a function")})(this,jt),Z=Dt.call(this,F);var pt=F.afterLoad,yt=F.beforeLoad,dt=F.scrollPosition,Ht=F.visibleByDefault;return Z.state={visible:Ht},Ht&&(yt(),pt()),Z.onVisible=Z.onVisible.bind(fe(Z)),Z.isScrollTracked=!!(dt&&Number.isFinite(dt.x)&&dt.x>=0&&Number.isFinite(dt.y)&&dt.y>=0),Z}return L=jt,(W=[{key:"componentDidUpdate",value:function(F,Z){Z.visible!==this.state.visible&&this.props.afterLoad()}},{key:"onVisible",value:function(){this.props.beforeLoad(),this.setState({visible:!0})}},{key:"render",value:function(){if(this.state.visible)return this.props.children;var F=this.props,Z=F.className,pt=F.delayMethod,yt=F.delayTime,dt=F.height,Ht=F.placeholder,xe=F.scrollPosition,ge=F.style,ye=F.threshold,Ye=F.useIntersectionObserver,Pe=F.width;return this.isScrollTracked||Ye&&p()?o().createElement(C,{className:Z,height:dt,onVisible:this.onVisible,placeholder:Ht,scrollPosition:xe,style:ge,threshold:ye,useIntersectionObserver:Ye,width:Pe}):o().createElement(Ie,{className:Z,delayMethod:pt,delayTime:yt,height:dt,onVisible:this.onVisible,placeholder:Ht,style:ge,threshold:ye,width:Pe})}}])&&da(L.prototype,W),Object.defineProperty(L,"prototype",{writable:!1}),jt}(o().Component);$t.propTypes={afterLoad:s.PropTypes.func,beforeLoad:s.PropTypes.func,useIntersectionObserver:s.PropTypes.bool,visibleByDefault:s.PropTypes.bool},$t.defaultProps={afterLoad:function(){return{}},beforeLoad:function(){return{}},useIntersectionObserver:!0,visibleByDefault:!1};let Et=$t;function Tt(j){return Tt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(L){return typeof L}:function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},Tt(j)}var Vt=["afterLoad","beforeLoad","delayMethod","delayTime","effect","placeholder","placeholderSrc","scrollPosition","threshold","useIntersectionObserver","visibleByDefault","wrapperClassName","wrapperProps"];function Pn(j,L){var W=Object.keys(j);if(Object.getOwnPropertySymbols){var nt=Object.getOwnPropertySymbols(j);L&&(nt=nt.filter(function(zt){return Object.getOwnPropertyDescriptor(j,zt).enumerable})),W.push.apply(W,nt)}return W}function yi(j){for(var L=1;L<arguments.length;L++){var W=arguments[L]!=null?arguments[L]:{};L%2?Pn(Object(W),!0).forEach(function(nt){bn(j,nt,W[nt])}):Object.getOwnPropertyDescriptors?Object.defineProperties(j,Object.getOwnPropertyDescriptors(W)):Pn(Object(W)).forEach(function(nt){Object.defineProperty(j,nt,Object.getOwnPropertyDescriptor(W,nt))})}return j}function bn(j,L,W){return(L=P(L))in j?Object.defineProperty(j,L,{value:W,enumerable:!0,configurable:!0,writable:!0}):j[L]=W,j}function ln(){return ln=Object.assign?Object.assign.bind():function(j){for(var L=1;L<arguments.length;L++){var W=arguments[L];for(var nt in W)Object.prototype.hasOwnProperty.call(W,nt)&&(j[nt]=W[nt])}return j},ln.apply(this,arguments)}function ai(j,L){for(var W=0;W<L.length;W++){var nt=L[W];nt.enumerable=nt.enumerable||!1,nt.configurable=!0,"value"in nt&&(nt.writable=!0),Object.defineProperty(j,P(nt.key),nt)}}function P(j){var L=function(W,nt){if(Tt(W)!=="object"||W===null)return W;var zt=W[Symbol.toPrimitive];if(zt!==void 0){var Dt=zt.call(W,"string");if(Tt(Dt)!=="object")return Dt;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(W)}(j);return Tt(L)==="symbol"?L:String(L)}function K(j,L){return K=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(W,nt){return W.__proto__=nt,W},K(j,L)}function ct(j){return ct=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(L){return L.__proto__||Object.getPrototypeOf(L)},ct(j)}var ft=function(j){(function(F,Z){if(typeof Z!="function"&&Z!==null)throw new TypeError("Super expression must either be null or a function");F.prototype=Object.create(Z&&Z.prototype,{constructor:{value:F,writable:!0,configurable:!0}}),Object.defineProperty(F,"prototype",{writable:!1}),Z&&K(F,Z)})(jt,j);var L,W,nt,zt,Dt=(nt=jt,zt=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var F,Z=ct(nt);if(zt){var pt=ct(this).constructor;F=Reflect.construct(Z,arguments,pt)}else F=Z.apply(this,arguments);return function(yt,dt){if(dt&&(Tt(dt)==="object"||typeof dt=="function"))return dt;if(dt!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Ht){if(Ht===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Ht}(yt)}(this,F)});function jt(F){var Z;return function(pt,yt){if(!(pt instanceof yt))throw new TypeError("Cannot call a class as a function")}(this,jt),(Z=Dt.call(this,F)).state={loaded:!1},Z}return L=jt,(W=[{key:"onImageLoad",value:function(){var F=this;return this.state.loaded?null:function(Z){F.props.onLoad(Z),F.props.afterLoad(),F.setState({loaded:!0})}}},{key:"getImg",value:function(){var F=this.props,Z=(F.afterLoad,F.beforeLoad,F.delayMethod,F.delayTime,F.effect,F.placeholder,F.placeholderSrc,F.scrollPosition,F.threshold,F.useIntersectionObserver,F.visibleByDefault,F.wrapperClassName,F.wrapperProps,function(pt,yt){if(pt==null)return{};var dt,Ht,xe=function(ye,Ye){if(ye==null)return{};var Pe,xn,vi={},io=Object.keys(ye);for(xn=0;xn<io.length;xn++)Pe=io[xn],Ye.indexOf(Pe)>=0||(vi[Pe]=ye[Pe]);return vi}(pt,yt);if(Object.getOwnPropertySymbols){var ge=Object.getOwnPropertySymbols(pt);for(Ht=0;Ht<ge.length;Ht++)dt=ge[Ht],yt.indexOf(dt)>=0||Object.prototype.propertyIsEnumerable.call(pt,dt)&&(xe[dt]=pt[dt])}return xe}(F,Vt));return o().createElement("img",ln({},Z,{onLoad:this.onImageLoad()}))}},{key:"getLazyLoadImage",value:function(){var F=this.props,Z=F.beforeLoad,pt=F.className,yt=F.delayMethod,dt=F.delayTime,Ht=F.height,xe=F.placeholder,ge=F.scrollPosition,ye=F.style,Ye=F.threshold,Pe=F.useIntersectionObserver,xn=F.visibleByDefault,vi=F.width;return o().createElement(Et,{beforeLoad:Z,className:pt,delayMethod:yt,delayTime:dt,height:Ht,placeholder:xe,scrollPosition:ge,style:ye,threshold:Ye,useIntersectionObserver:Pe,visibleByDefault:xn,width:vi},this.getImg())}},{key:"getWrappedLazyLoadImage",value:function(F){var Z=this.props,pt=Z.effect,yt=Z.height,dt=Z.placeholderSrc,Ht=Z.width,xe=Z.wrapperClassName,ge=Z.wrapperProps,ye=this.state.loaded,Ye=ye?" lazy-load-image-loaded":"",Pe=ye||!dt?{}:{backgroundImage:"url(".concat(dt,")"),backgroundSize:"100% 100%"};return o().createElement("span",ln({className:xe+" lazy-load-image-background "+pt+Ye,style:yi(yi({},Pe),{},{color:"transparent",display:"inline-block",height:yt,width:Ht})},ge),F)}},{key:"render",value:function(){var F=this.props,Z=F.effect,pt=F.placeholderSrc,yt=F.visibleByDefault,dt=F.wrapperClassName,Ht=F.wrapperProps,xe=this.getLazyLoadImage();return(Z||pt)&&!yt||dt||Ht?this.getWrappedLazyLoadImage(xe):xe}}])&&ai(L.prototype,W),Object.defineProperty(L,"prototype",{writable:!1}),jt}(o().Component);ft.propTypes={onLoad:s.PropTypes.func,afterLoad:s.PropTypes.func,beforeLoad:s.PropTypes.func,delayMethod:s.PropTypes.string,delayTime:s.PropTypes.number,effect:s.PropTypes.string,placeholderSrc:s.PropTypes.string,threshold:s.PropTypes.number,useIntersectionObserver:s.PropTypes.bool,visibleByDefault:s.PropTypes.bool,wrapperClassName:s.PropTypes.string,wrapperProps:s.PropTypes.object},ft.defaultProps={onLoad:function(){},afterLoad:function(){return{}},beforeLoad:function(){return{}},delayMethod:"throttle",delayTime:300,effect:"",placeholderSrc:null,threshold:100,useIntersectionObserver:!0,visibleByDefault:!1,wrapperClassName:""};let vt=ft})(),w4.exports=i})()});var y9={};iP(y9,{AnnotationContext:()=>WF,AnnotationPageContext:()=>$F,AnnotationStyleProvider:()=>o7,AtlasStoreProvider:()=>Yc,AtlasStoreReactContext:()=>Hs,Auth:()=>yb,AuthProvider:()=>mb,AuthRContext:()=>fs,AuthReactContext:()=>MM,AuthReactContextActions:()=>OM,CanvasAnnotations:()=>jF,CanvasContext:()=>Sa,CanvasPanel:()=>Mn,CanvasStrategyProvider:()=>FA,CanvasWorldObject:()=>kA,CollectionContext:()=>t9,CombinedMetadata:()=>qF,ComplexTimelineProvider:()=>nA,ContextBridge:()=>Jh,ControlsReactContext:()=>Nh,CreateCustomShape:()=>KA,CustomContextBridge:()=>l4,CustomContextBridgeProvider:()=>AF,DefaultEditingTools:()=>f4,EventEmitterProvider:()=>gq,EventsProvider:()=>RF,Image:()=>T4,ImageService:()=>GF,ImageServiceLoaderContext:()=>qD,InnerViewerProvider:()=>LM,LanguageProvider:()=>h7,LanguageString:()=>tL,LocaleString:()=>sa,ManifestContext:()=>ab,ManifestMetadata:()=>YF,MediaPlayerProvider:()=>_h,Metadata:()=>fp,PolygonSelector:()=>VF,RangeContext:()=>ob,ReactEmitterContext:()=>fv,ReactEventContext:()=>Js,ReactVaultContext:()=>Br,RegionHighlight:()=>BR,Render3DModelStrategy:()=>kR,RenderAccompanyingCanvas:()=>YR,RenderAnnotation:()=>Vs,RenderAnnotationEditing:()=>NA,RenderAnnotationPage:()=>xl,RenderAnnotationStrategy:()=>JR,RenderAudioStrategy:()=>tA,RenderComplexTimelineStrategy:()=>rA,RenderEmptyStrategy:()=>lA,RenderImageStrategy:()=>sA,RenderSvgEditorControls:()=>JF,RenderTextualContentStrategy:()=>uA,RenderVideoStrategy:()=>fA,RenderYouTubeStrategy:()=>dA,ResizeWorldItem:()=>DR,ResourceProvider:()=>si,ResourceReactContext:()=>Ff,SelectorControllerProvider:()=>PF,SequenceThumbnails:()=>KF,SimpleViewerProvider:()=>Sb,SimpleViewerReactContext:()=>ku,SingleCanvasThumbnail:()=>tT,StrategyReactContext:()=>Rl,ThumbnailFallbackImage:()=>ks,TranslationProvider:()=>d7,TransliterationProvider:()=>p7,VaultProvider:()=>ls,ViewerPresetContext:()=>Wa,VirtualAnnotationProvider:()=>ZR,VisibleCanvasReactContext:()=>ss,annotationResponseToSelector:()=>g9,authDetailsForResource:()=>db,createAtlasStore:()=>CR,createAuthStateStore:()=>cb,createProbe:()=>fb,defaultEmitter:()=>o4,defaultSvgTheme:()=>fL,emptyActions:()=>IA,emptyStrategy:()=>DA,expandTarget:()=>nn,findAllCanvasesInRange:()=>jm,findFirstCanvasFromRange:()=>cM,findManifestSelectedRange:()=>$6,findSelectedRange:()=>rb,flattenAnnotationPageIds:()=>LA,formatTime:()=>vv,get3dStrategy:()=>HA,getAtlasStoreByName:()=>OR,getComplexTimelineStrategy:()=>UA,getDefaultAnnotationStyles:()=>_R,getImageStrategy:()=>op,getManifestSequence:()=>qm,getParsedTargetSelector:()=>tp,getRenderingStrategy:()=>sp,getTextualContentStrategy:()=>rp,getVideoStrategy:()=>lp,getVisibleCanvasesFromCanvasId:()=>tH,hasAuth:()=>xH,isBoxSelector:()=>i7,isImageApiSelector:()=>lm,isRectangle:()=>Gc,isSvgSelector:()=>vD,makeAccessServiceRequest:()=>ub,makeAccessTokenRequest:()=>Ym,parseRotation:()=>sm,parseSelector:()=>Do,parseSpecificResource:()=>TF,polygonToTarget:()=>kc,requestToAnnotationResponse:()=>Th,seraliseSupportedSelector:()=>mv,svgThemes:()=>BF,targetIntersects:()=>p9,unknownResponse:()=>ep,unsupportedStrategy:()=>Be,useAnnotation:()=>wh,useAnnotationPage:()=>PR,useAnnotationPageManager:()=>ip,useAnnotationStyles:()=>Ch,useAnnotationsAtTime:()=>e9,useAtlasContextMenu:()=>$h,useAtlasStore:()=>Ne,useAuthActions:()=>_M,useAuthService:()=>zM,useAuthStore:()=>Fu,useAuthToken:()=>RH,useAuthTokens:()=>hb,useCanvas:()=>_t,useCanvasChoices:()=>n9,useCanvasClock:()=>i9,useCanvasSequence:()=>lb,useCanvasStartTime:()=>zh,useCanvasSubset:()=>a9,useClosestLanguage:()=>nL,useCollection:()=>o9,useComplexTimeline:()=>f7,useContextBridge:()=>Zh,useContextMenuStore:()=>c4,useCreateLocaleString:()=>m7,useCurrentAnnotationActions:()=>r9,useCurrentAnnotationMetadata:()=>l9,useCurrentAnnotationRequest:()=>zA,useCurrentAnnotationTransition:()=>s9,useCurrentAuth:()=>EH,useCustomContextBridge:()=>Kh,useDispatch:()=>QR,useEmitter:()=>AR,useEvent:()=>Ps,useEventEmitter:()=>Qh,useEventListener:()=>u9,useExistingVault:()=>cs,useExternalCollection:()=>c9,useExternalManifest:()=>ib,useExternalResource:()=>td,useIIIFLanguage:()=>Ov,useImage:()=>o0,useImageService:()=>nT,useImageServiceLoader:()=>Ih,useImageTile:()=>f9,useIsAuthEnabled:()=>gb,useLoadImageService:()=>ap,useLocaleString:()=>iL,useManifest:()=>an,useMediaActions:()=>l7,useMediaElements:()=>s7,useMediaState:()=>r7,usePaintables:()=>PA,usePaintingAnnotations:()=>hr,usePolygonHelper:()=>hA,useRange:()=>ed,useRemoteStylesheet:()=>NR,useRenderControls:()=>hi,useRenderingStrategy:()=>jA,useRequestAnnotation:()=>XA,useResourceContext:()=>Wn,useResourceEvents:()=>Oh,useResources:()=>BA,useSearchService:()=>vb,useSelectorController:()=>JA,useSelectorEmitter:()=>HF,useSelectorEvents:()=>ZA,useSelectorHelper:()=>UF,useSimpleMediaPlayer:()=>js,useSimpleViewer:()=>ds,useStaticRenderingStrategy:()=>d9,useStrategy:()=>Fe,useStyleHelper:()=>h9,useStyles:()=>Us,useStylesheetStore:()=>bD,useSvgEditor:()=>pA,useSvgEditorControls:()=>eT,useThumbnail:()=>sr,useTranslations:()=>aA,useTransliteration:()=>iA,useVault:()=>Ut,useVaultEffect:()=>WR,useVaultSelector:()=>ie,useViewerPreset:()=>Dh,useVirtualAnnotationPage:()=>XR,useVirtualAnnotationPageContext:()=>KR,useVisibleCanvases:()=>us});function Vf(t){"@babel/helpers - typeof";return Vf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vf(t)}function oP(t,e){if(Vf(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e||"default");if(Vf(i)!="object")return i;throw TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function rP(t){var e=oP(t,"string");return Vf(e)=="symbol"?e:e+""}function An(t,e,n){return(e=rP(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var lP=Object.create,qw=Object.defineProperty,sP=Object.getOwnPropertyDescriptor,uP=Object.getOwnPropertyNames,cP=Object.getPrototypeOf,fP=Object.prototype.hasOwnProperty,GS=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var dP=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var a=uP(e),o=0,s=a.length,u;o<s;o++)u=a[o],!fP.call(t,u)&&u!==n&&qw(t,u,{get:(d=>e[d]).bind(null,u),enumerable:!(i=sP(e,u))||i.enumerable});return t},kS=(t,e,n)=>(n=t==null?{}:lP(cP(t)),dP(e||!t||!t.__esModule?qw(n,"default",{value:t,enumerable:!0}):n,t));function hP(t,e,n,i=1){return new Qw(t,e,n).subdivide(i)}function pP(t,e,n,i,a=1){return new gP(new Float64Array([t.x,t.y,e.x,e.y,n.x,n.y,i.x,i.y])).subdivide(a)}function mP(t){return t.x*t.x+t.y*t.y}function jf(t){let e=.67;return t/(1-e+(e**4+.25*t*t)**.25)}function Tu(t){let e=.39;return t*(1-e+Math.sqrt(e*e+.25*t*t))}var Qw=class{constructor(t,e,n){An(this,"start",void 0),An(this,"control",void 0),An(this,"end",void 0),this.start=t,this.control=e,this.end=n}eval(t){let e=1-t;return{x:this.start.x*e*e+2*this.control.x*e*t+this.end.x*t*t,y:this.start.y*e*e+2*this.control.y*e*t+this.end.y*t*t}}mapToBasic(){let{x:t,y:e}=this.start,{x:n,y:i}=this.control,{x:a,y:o}=this.end,s=2*n-t-a,u=2*i-e-o,d=(n-t)*s+(i-e)*u,p=(a-n)*s+(o-i)*u,f=(a-t)*u-(o-e)*s,m=d/f,g=p/f,v=Math.abs(f)/(Math.hypot(s,u)*Math.abs(g-m));return{x0:t,x2:a,scale:v,cross:f}}subdivide(t){let e=this.mapToBasic(),n=jf(e.x0),i=jf(e.x2),a=.5*Math.abs(i-n)*Math.sqrt(e.scale/t),o=Math.ceil(a),s=Tu(n),u=Tu(i),d=[0];for(let p=1;p<o;p++){let f=Tu(n+(i-n)*p/o),m=(f-s)/(u-s);d.push(m)}return d.push(1),d.map(p=>this.eval(p))}},gP=class Xw{constructor(e){An(this,"c",void 0),this.c=e}weightsum(e,n,i,a){let o=e*this.c[0]+n*this.c[2]+i*this.c[4]+a*this.c[6],s=e*this.c[1]+n*this.c[3]+i*this.c[5]+a*this.c[7];return{x:o,y:s}}eval(e){let n=1-e,i=n*n*n,a=3*n*n*e,o=3*n*e*e,s=e*e*e;return this.weightsum(i,a,o,s)}deriv(e){let n=1-e,i=-3*n*n,a=3*e*e,o=-6*e*n-i,s=6*e*n-a;return this.weightsum(i,o,s,a)}midpoint_quadbez(){let e=this.weightsum(-.25,.75,.75,-.25);return new Qw({x:this.c[0],y:this.c[1]},e,{x:this.c[6],y:this.c[7]})}subsegment(e,n){let i=new Float64Array(8),a=this.eval(e),o=this.eval(n);i[0]=a.x,i[1]=a.y;let s=(n-e)/3,u=this.deriv(e);i[2]=a.x+s*u.x,i[3]=a.y+s*u.y;let d=this.deriv(n);return i[4]=o.x-s*d.x,i[5]=o.y-s*d.y,i[6]=o.x,i[7]=o.y,new Xw(i)}subdivide(e){let n=.1*e,i=e-n,a=Math.sqrt(i),o=mP(this.weightsum(1,-3,3,-1)),s=Math.ceil((o/(432*n*n))**(1/6)),u=[],d=0;for(let S=0;S<s;S++){let R=S/s,T=(S+1)/s,E=this.subsegment(R,T).midpoint_quadbez(),x=E.mapToBasic(),A=jf(x.x0),C=jf(x.x2),M=Math.sqrt(x.scale),I=Math.abs(C-A)*M;if(Math.sign(x.x0)!=Math.sign(x.x2)){let z=a/M,D=a*Math.abs(C-A)/jf(z);I=Math.max(I,D)}u.push({quad:E,a0:A,a2:C,val:I}),d+=I}let p=.5*d/a,f=Math.ceil(p),m=[{x:this.c[0],y:this.c[1]}],g=0,v=0;for(let S=1;S<f;S++){let R=d*S/f;for(;g+u[v].val<R;)g+=u[v].val,v++;let T=u[v].a0,E=u[v].a2,x=Tu(T),A=Tu(E),C=T+(E-T)*(R-g)/u[v].val,M=Tu(C),I=(M-x)/(A-x);m.push(u[v].quad.eval(I))}return m.push({x:this.c[6],y:this.c[7]}),m}};function yP(t){let e={},n=t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").trim(),i=/([^{]+)\{([^}]+)\}/g,a;for(;(a=i.exec(n))!==null;){let o=a[1].trim(),s=a[2].trim(),u=o.match(/\.([a-zA-Z0-9_-]+)/);if(!u)continue;let d=u[1],p=s.split(";").filter(m=>m.trim()),f={};for(let m of p){let[g,v]=m.split(":").map(S=>S.trim());if(!(!g||!v))switch(g){case"background-color":f.backgroundColor=v;break;case"opacity":f.opacity=parseFloat(v);break;case"box-shadow":f.boxShadow=v;break;case"border-color":f.borderColor=v;break;case"border-width":f.borderWidth=v;break;case"border-style":f.borderStyle=v;break;case"outline-color":f.outlineColor=v;break;case"outline-width":f.outlineWidth=v;break;case"outline-offset":f.outlineOffset=v;break;case"outline-style":f.outlineStyle=v;break;case"border":f.border=v;break;case"outline":f.outline=v;break;case"background":f.background=v;break}}e[d]=f}return e}function Fw(t){let e={};return t&&(t.fill&&(e.backgroundColor=t.fill,t.fillOpacity),t.stroke&&(e.borderColor=t.stroke),t.strokeWidth&&(e.borderWidth=t.strokeWidth)),e}var YS=new Map;function vP(t,e){if(YS.has(t))return YS.get(t);let n=yP(e);return YS.set(t,Object.fromEntries(Object.entries(n).map(([i,a])=>[i,a]))),n}function QS(t,e,n={}){if(!t||!e)return Fw(n||{});let i=Fw(n||{}),a=Object.entries(e);for(let[o,s]of a){if(!s)continue;let u=vP(o,s),d=Object.entries(u);for(let[p,f]of d)p===t&&Object.assign(i,f)}return i}var SP=function(){function t(e,n){var i=[],a=!0,o=!1,s=void 0;try{for(var u=e[Symbol.iterator](),d;!(a=(d=u.next()).done)&&(i.push(d.value),!(n&&i.length===n));a=!0);}catch(p){o=!0,s=p}finally{try{!a&&u.return&&u.return()}finally{if(o)throw s}}return i}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw TypeError("Invalid attempt to destructure non-iterable instance")}}(),qf=Math.PI*2,XS=function(t,e,n,i,a,o,s){var u=t.x,d=t.y;u*=e,d*=n;var p=i*u-a*d,f=a*u+i*d;return{x:p+o,y:f+s}},bP=function(t,e){var n=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),i=Math.cos(t),a=Math.sin(t),o=Math.cos(t+e),s=Math.sin(t+e);return[{x:i-a*n,y:a+i*n},{x:o+s*n,y:s-o*n},{x:o,y:s}]},Gw=function(t,e,n,i){var a=t*i-e*n<0?-1:1,o=t*n+e*i;return o>1&&(o=1),o<-1&&(o=-1),a*Math.acos(o)},xP=function(t,e,n,i,a,o,s,u,d,p,f,m){var g=a**2,v=o**2,S=f**2,R=m**2,T=g*v-g*R-v*S;T<0&&(T=0),T/=g*R+v*S,T=Math.sqrt(T)*(s===u?-1:1);var E=T*a/o*m,x=T*-o/a*f,A=p*E-d*x+(t+n)/2,C=d*E+p*x+(e+i)/2,M=(f-E)/a,I=(m-x)/o,z=(-f-E)/a,D=(-m-x)/o,k=Gw(1,0,M,I),B=Gw(M,I,z,D);return u===0&&B>0&&(B-=qf),u===1&&B<0&&(B+=qf),[A,C,k,B]},EP=function(t){var e=t.px,n=t.py,i=t.cx,a=t.cy,o=t.rx,s=t.ry,u=t.xAxisRotation,d=u===void 0?0:u,p=t.largeArcFlag,f=p===void 0?0:p,m=t.sweepFlag,g=m===void 0?0:m,v=[];if(o===0||s===0)return[];var S=Math.sin(d*qf/360),R=Math.cos(d*qf/360),T=R*(e-i)/2+S*(n-a)/2,E=-S*(e-i)/2+R*(n-a)/2;if(T===0&&E===0)return[];o=Math.abs(o),s=Math.abs(s);var x=T**2/o**2+E**2/s**2;x>1&&(o*=Math.sqrt(x),s*=Math.sqrt(x));var A=xP(e,n,i,a,o,s,f,g,S,R,T,E),C=SP(A,4),M=C[0],I=C[1],z=C[2],D=C[3],k=Math.abs(D)/(qf/4);Math.abs(1-k)<1e-7&&(k=1);var B=Math.max(Math.ceil(k),1);D/=B;for(var Q=0;Q<B;Q++)v.push(bP(z,D)),z+=D;return v.map(function(it){var lt=XS(it[0],o,s,R,S,M,I),et=lt.x,$=lt.y,ht=XS(it[1],o,s,R,S,M,I),bt=ht.x,st=ht.y,rt=XS(it[2],o,s,R,S,M,I),Y=rt.x,At=rt.y;return{x1:et,y1:$,x2:bt,y2:st,x:Y,y:At}})},RP=EP,AP=GS((t,e)=>{e.exports=a;var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},i=/([astvzqmhlc])([^astvzqmhlc]*)/gi;function a(u){var d=[];return u.replace(i,function(p,f,m){var g=f.toLowerCase();for(m=s(m),g=="m"&&m.length>2&&(d.push([f].concat(m.splice(0,2))),g="l",f=f=="m"?"l":"L");;){if(m.length==n[g])return m.unshift(f),d.push(m);if(m.length<n[g])throw Error("malformed path data");d.push([f].concat(m.splice(0,n[g])))}}),d}var o=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function s(u){var d=u.match(o);return d?d.map(Number):[]}}),TP=GS((t,e)=>{e.exports=n;function n(i){var a=0,o=0,s=0,u=0;return i.map(function(d){d=d.slice();var p=d[0],f=p.toUpperCase();if(p!=f)switch(d[0]=f,p){case"a":d[6]+=s,d[7]+=u;break;case"v":d[1]+=u;break;case"h":d[1]+=s;break;default:for(var m=1;m<d.length;)d[m++]+=s,d[m++]+=u}switch(f){case"Z":s=a,u=o;break;case"H":s=d[1];break;case"V":u=d[1];break;case"M":s=a=d[1],u=o=d[2];break;default:s=d[d.length-2],u=d[d.length-1]}return d})}}),CP=kS(AP(),1),wP=kS(TP(),1);function MP(t){let e=(0,CP.default)(t),n=(0,wP.default)(e),i,a=0,o=0,s=0,u=0,d,p,f=0,m=0,g=[];for(let v=0;v<n.length;v++){let S=n[v],R=S[0];switch(R){case"M":a=S[1],o=S[2];break;case"H":S=["L",S[1],o];break;case"V":S=["L",a,S[1]];break;case"S":{let T=f,E=m;(i==="C"||i=="S")&&(T+=T-s,E+=E-u),S=["C",T,E,S[1],S[2],S[3],S[4]]}break;case"T":i==="Q"||i=="T"?(d=f*2-d,p=m*2-p):(d=f,p=m),S=["Q",d,p,S[1],S[2]];break;case"Q":d=S[1],p=S[2];break;case"A":{let T=RP({px:f,py:m,cx:S[6],cy:S[7],rx:S[1],ry:S[2],xAxisRotation:S[3],largeArcFlag:S[4],sweepFlag:S[5]});if(!T.length)continue;for(let[E,x]of T.entries())S=["C",x.x1,x.y1,x.x2,x.y2,x.x,x.y],E<T.length-1&&g.push(S);S=S}break;case"Z":S=["L",a,o];break}i=R,f=S[S.length-2],m=S[S.length-1],["C","Q","A"].indexOf(R)>-1?(s=S[S.length-4],u=S[S.length-3]):(s=f,u=m),g.push(S)}return g}var OP=/&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/,kw=/&?(t=)(npt:)?([0-9]+(\.[0-9]+)?)?(,([0-9]+(\.[0-9]+)?))?/,Yw=/^rgba\((\d+),(\d+),(\d+),([0-9.]+)\)$/;function Do(t,{domParser:e,svgPreprocessor:n,iiifRenderingHints:i,loadedStylesheets:a}={},{styleClass:o}={}){if(Array.isArray(t))return va(t.reduce((s,u)=>{let{selector:d,selectors:p,iiifRenderingHints:f}=Do(u,{domParser:e,svgPreprocessor:n,iiifRenderingHints:i},{styleClass:o});return d&&(s.selector?(!s.selector.temporal&&d.temporal&&(s.selector.temporal=d.temporal),!s.selector.spatial&&d.spatial&&(s.selector.spatial=d.spatial),!s.selector.svg&&d.svg&&(s.selector.svg=d.svg),!s.selector.svgShape&&d.svgShape&&(s.selector.svgShape=d.svgShape)):s.selector=d,s.selectors.push(...p)),f&&(s.iiifRenderingHints=s.iiifRenderingHints||{type:"ImageApiSelector"},Object.assign(s.iiifRenderingHints,f)),s},{selector:null,selectors:[],iiifRenderingHints:i}));if(!t)return va({selector:null,selectors:[],iiifRenderingHints:i});if(typeof t=="string"){let[s,u]=t.split("#");return u?Do({type:"FragmentSelector",value:u},{svgPreprocessor:n,iiifRenderingHints:i,domParser:e},{styleClass:o}):va({selector:null,selectors:[],iiifRenderingHints:i})}if(t.type){if(t.type==="PointSelector"&&(t.t||t.t===0)){let s={type:"TemporalSelector",temporal:{startTime:t.t}};return va({selector:s,selectors:[s],iiifRenderingHints:i})}if(t.type==="PointSelector"&&t.x&&t.y){let s={type:"PointSelector",spatial:{x:t.x,y:t.y}};return va({selector:s,selectors:[s],iiifRenderingHints:i})}}if(lm(t)){let s=[];if(t.region){let u=Do({type:"FragmentSelector",value:"xywh="+t.region},{domParser:e,svgPreprocessor:n,iiifRenderingHints:i},{styleClass:o});s.push(...u.selectors)}return va({selector:s[0],selectors:s,iiifRenderingHints:i?{...i,...t}:t})}if(t.type==="FragmentSelector"){let s=OP.exec(t.value);if(s){let d={type:"BoxSelector",spatial:{unit:s[2]==="percent:"||s[2]==="pct:"?"percent":"pixel",x:Number.parseFloat(s[3]),y:Number.parseFloat(s[4]),width:Number.parseFloat(s[5]),height:Number.parseFloat(s[6])},boxStyle:QS(o,a)},p=t.value.match(kw);return p&&(d={type:"TemporalBoxSelector",spatial:d.spatial,temporal:{startTime:p[3]?Number.parseFloat(p[3]):0,endTime:p[6]?Number.parseFloat(p[6]):void 0},boxStyle:QS(o,a)}),va({selector:d,selectors:[d],iiifRenderingHints:i})}let u=t.value.match(kw);if(u){let d={type:"TemporalSelector",temporal:{startTime:u[3]?Number.parseFloat(u[3]):0,endTime:u[6]?Number.parseFloat(u[6]):void 0}};return va({selector:d,selectors:[d],iiifRenderingHints:i})}return va({selector:null,selectors:[],iiifRenderingHints:i})}if(t.type==="SvgSelector"&&"value"in t){e||(typeof window<"u"?e=new window.DOMParser:console.warn("No DOMParser available, cannot parse SVG selector, `points`, `spatial` and `style` will be unavailable and the SVG will not be normalized."));let s=[],u,d,p=n?.(t.value)??t.value,f;if(e){let g=e.parseFromString(t.value,"image/svg+xml").querySelector("svg");if(!g)return console.warn(`Illegal SVG selector: ${t.value}`),va({selector:null,selectors:[],iiifRenderingHints:i});let v=Kw(g);v&&(s=v.points,f=v.shapeType,u=[Math.min(...s.map(S=>S[0])),Math.min(...s.map(S=>S[1])),Math.max(...s.map(S=>S[0])),Math.max(...s.map(S=>S[1]))],{style:d,svg:p}=NP(v.element)??{svg:p})}let m={type:"SvgSelector",svg:p,svgShape:f,style:d,boxStyle:QS(o,a,d),points:s.length?s:void 0,spatial:u?{unit:"pixel",x:u[0],y:u[1],width:u[2]-u[0],height:u[3]-u[1]}:void 0};return va({selector:m,selectors:[m],iiifRenderingHints:i})}return va({selector:null,selectors:[],iiifRenderingHints:i})}function _P(t){let e=t.map(i=>i[0]).reduce((i,a)=>(i[a]+=1,i),{C:0,Q:0,L:0,M:0}),n=new Set(t.map(i=>i[0]));if(e.C>0||e.Q>0)return"path";if(e.L>0&&(n.size===1||n.size===2&&n.has("M"))){if(e.L===4)return"rect";let i=t.slice(-1)[0];return t[0][0]==="M"&&i[0]==="L"&&i[1]==t[0][1]&&i[2]===t[0][2]||i[1]===0&&i[2]===0?"polygon":"polyline"}return"path"}function Kw(t){for(let e of Array.from(t.children))switch(e?.tagName.toLowerCase()){case"g":{let n=Kw(e);if(n)return n}continue;case"path":{let n=e.getAttribute("d");if(!n)continue;let i=MP(n);return{element:e,points:zP(i),shapeType:_P(i)}}case"circle":{let n=Number.parseFloat(e.getAttribute("cx")??"0"),i=Number.parseFloat(e.getAttribute("cy")??"0"),a=Number.parseFloat(e.getAttribute("r")??"0");if(!a)continue;let o=[];for(let s=0;s<=360;s+=12){let u=s*Math.PI/180;o.push([n+a*Math.cos(u),i+a*Math.sin(u)])}return{element:e,points:o,shapeType:"circle"}}case"ellipse":{let n=Number.parseFloat(e.getAttribute("cx")??"0"),i=Number.parseFloat(e.getAttribute("cy")??"0"),a=Number.parseFloat(e.getAttribute("rx")??"0"),o=Number.parseFloat(e.getAttribute("ry")??"0");if(!a&&!o)continue;let s=[];for(let u=0;u<=360;u+=12){let d=Math.tan(u/360*Math.PI),p=a*(1-d**2)/(1+d**2),f=o*2*d/(1+d**2);s.push([n+p,i+f])}return{element:e,points:s,shapeType:"ellipse"}}case"line":{let n=Number.parseFloat(e.getAttribute("x0")??"0"),i=Number.parseFloat(e.getAttribute("y0")??"0"),a=Number.parseFloat(e.getAttribute("x1")??"0"),o=Number.parseFloat(e.getAttribute("y1")??"0");if(n===a&&i===o)continue;return{element:e,points:[[n,i],[a,o]],shapeType:"polyline"}}case"polygon":case"polyline":{let n=e.getAttribute("points")?.split(" ").map(a=>a.split(",").map(Number.parseFloat))??[];if(!n.length)continue;let i="polyline";return e.tagName.toLowerCase()==="polygon"&&(n.push(n[0]),i="polygon"),{element:e,points:n,shapeType:i}}case"rect":{let n=Number.parseFloat(e.getAttribute("x")??"0"),i=Number.parseFloat(e.getAttribute("y")??"0"),a=Number.parseFloat(e.getAttribute("width")??"0"),o=Number.parseFloat(e.getAttribute("height")??"0");if(!a||!o)continue;return{element:e,points:[[n,i],[n+a,i],[n+a,i+o],[n,i+o],[n,i]],shapeType:"rect"}}default:continue}return null}function zP(t){let e=[];for(let n=0;n<t.length;n++){let i=e[e.length-1]??[0,0],a=t[n];switch(a[0]){case"M":case"L":e.push([a[1],a[2]]);continue;case"C":e.push(...pP({x:i[0],y:i[1]},{x:a[1],y:a[2]},{x:a[3],y:a[4]},{x:a[5],y:a[6]}).map(o=>[o.x,o.y]).slice(1));continue;case"Q":e.push(...hP({x:i[0],y:i[1]},{x:a[1],y:a[2]},{x:a[3],y:a[4]}).map(o=>[o.x,o.y]).slice(1));continue}}return e}function NP(t){let e={};if(t.hasAttribute("fill")?(e.fill=t.getAttribute("fill"),t.removeAttribute("fill")):t.style&&t.style.fill&&(e.fill=t.style.fill),e.fill){let i=Yw.exec(e.fill);i&&(e.fillOpacity=Number.parseFloat(i[4]),e.fill=`rgb(${i[1]}, ${i[2]}, ${i[3]})`)}if(t.hasAttribute("fill-opacity")?(e.fillOpacity=Number.parseFloat(t.getAttribute("fill-opacity")),t.removeAttribute("fill-opacity")):t.style&&t.style.fillOpacity&&(e.fillOpacity=Number.parseFloat(t.style.fillOpacity)),t.hasAttribute("stroke")?(e.stroke=t.getAttribute("stroke"),t.removeAttribute("stroke")):t.style&&t.style.stroke&&(e.stroke=t.style.stroke),e.stroke){let i=Yw.exec(e.stroke);i&&(e.strokeOpacity=Number.parseFloat(i[4]),e.stroke=`rgb(${i[1]}, ${i[2]}, ${i[3]})`)}t.hasAttribute("stroke-opacity")?(e.strokeOpacity=Number.parseFloat(t.getAttribute("stroke-opacity")),t.removeAttribute("stroke-opacity")):t.style&&t.style.strokeOpacity&&(e.strokeOpacity=Number.parseFloat(t.style.strokeOpacity)),t.hasAttribute("stroke-width")?(e.strokeWidth=t.getAttribute("stroke-width"),t.removeAttribute("stroke-width")):t.style&&t.style.strokeWidth&&(e.strokeWidth=t.style.strokeWidth),t.hasAttribute("stroke-dasharray")?(e.strokeDasharray=t.getAttribute("stroke-dasharray"),t.removeAttribute("stroke-dasharray")):t.style&&t.style.strokeDasharray&&(e.strokeDasharray=t.style.strokeDasharray);let n=t;for(;n.tagName.toLowerCase()!=="svg";)if(n=n.parentElement,n===null)throw Error("Could not find root SVG element");return{svg:n.outerHTML,style:Object.keys(e).length>0?e:void 0}}function lm(t){if(!t)return!1;let e=t.type||t["@type"];return e==="iiif:ImageApiSelector"||e==="ImageApiSelector"}function va(t){if(t.iiifRenderingHints){let e=t.iiifRenderingHints;if(e.rotation){let n=sm(`${e.rotation}`);if(n)if(t.selectors.length)for(let i of t.selectors)i.rotation=n;else t.selectors.push({type:"RotationSelector",rotation:n})}}else delete t.iiifRenderingHints;return t}function sm(t){let e=Number.parseFloat(t);return e&&t.startsWith("!")&&(e=360-e),e&&(e%=360),e===e&&e||0}function nn(t,e={}){if(Array.isArray(t))return nn(t[0]);if(typeof t=="string"){let[n,i]=t.split("#");return i?nn({type:"SpecificResource",source:{id:n,type:e.typeMap&&e.typeMap[n]||e.defaultType||"Canvas"},selector:{type:"FragmentSelector",value:i}},e):{type:"SpecificResource",source:{id:n,type:e.typeMap&&e.typeMap[n]||e.defaultType||"Canvas"},selector:null,selectors:[]}}if(t.type==="Choice"||t.type==="List"||t.type==="Composite"||t.type==="Independents")return nn(t.items[0],e);if(!t.type&&"source"in t&&(t.type="SpecificResource"),t.type==="SpecificResource"){t.source.type==="Canvas"&&t.source.partOf&&typeof t.source.partOf=="string"&&(t.source.partOf=[{id:t.source.partOf,type:"Manifest"}]);let n=t.styleClass||e.styleClass,i={selector:null,selectors:[]};if(typeof t.source=="string"&&t.source.includes("#")){let s=nn(t.source,{...e,styleClass:n});t.source=s.source,i={selector:s.selector,selectors:s.selectors}}let{selector:a,selectors:o}=t.selector?Do(t.selector,e,{styleClass:n}):i;return{type:"SpecificResource",source:t.source,selector:a,selectors:o}}if(t.id){t.type==="Canvas"&&t.partOf&&typeof t.partOf=="string"&&(t.partOf=[{id:t.partOf,type:"Manifest"}]);let[n,i]=t.id.split("#");return i?nn({type:"SpecificResource",source:{...t,id:n},selector:{type:"FragmentSelector",value:i}},e):{type:"SpecificResource",source:{...t,id:n},selector:null,selectors:[]}}return{type:"SpecificResource",source:t,selector:null,selectors:[]}}var $s=_(X(),1);var Cu=_(X(),1),t2=_(V(),1),LP={collection:void 0,manifest:void 0,range:void 0,canvas:void 0,annotation:void 0,annotationPage:void 0},Ff=Cu.default.createContext(LP),Wn=()=>(0,Cu.useContext)(Ff);function si({value:t,children:e}){let n=Wn(),i=(0,Cu.useMemo)(()=>({...n,...t}),[t,n]);return(0,t2.jsx)(Ff.Provider,{value:i,children:e})}var e2=_(V(),1);function Sa({canvas:t,children:e}){return(0,e2.jsx)(si,{value:{canvas:t},children:e})}var Um=_(X(),1);var i2={},n2=t=>{let e,n=new Set,i=(f,m)=>{let g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){let v=e;e=m??(typeof g!="object"||!g)?g:Object.assign({},e,g),n.forEach(S=>S(e,v))}},a=()=>e,o=()=>p,s=f=>(n.add(f),()=>n.delete(f)),u=()=>{(i2.env?i2.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()},d={setState:i,getState:a,getInitialState:o,subscribe:s,destroy:u},p=e=t(i,a,d);return d},cm=t=>t?n2(t):n2;function fm(t){return{all:t||(t=new Map),on:function(e,n){var i=t.get(e);i?i.push(n):t.set(e,[n])},off:function(e,n){var i=t.get(e);i&&(n?i.splice(i.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var i=t.get(e);i&&i.slice().map(function(a){a(n)}),(i=t.get("*"))&&i.slice().map(function(a){a(e,n)})}}}function Gf(t){"@babel/helpers - typeof";return Gf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gf(t)}function BP(t,e){if(Gf(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e||"default");if(Gf(i)!="object")return i;throw TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function PP(t){var e=BP(t,"string");return Gf(e)=="symbol"?e:e+""}function so(t,e,n){return(e=PP(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ja(t){return Array.isArray(t)?t:t?[t]:[]}function qa(t){for(let e in t)(t[e]===void 0||t[e]===null)&&delete t[e];return t}function ki(t){return typeof t=="string"?!1:t&&!t.type&&"source"in t?(t.type="SpecificResource",!0):!!t&&t.type==="SpecificResource"}function dm(...t){return e=>t.reduce((n,i)=>i(n),e)}var KS=["Collection","Manifest","Canvas","AnnotationPage","AnnotationCollection","Annotation","ContentResource","Range","Service","Selector","Agent"];function a2(t,e){if(t==null)throw Error("Null or undefined is not a valid entity.");if(Array.isArray(t))throw Error("Array is not a valid entity");if(typeof t!="object"){if(e)return e;throw Error(`${typeof t} is not a valid entity`)}if(typeof t.type=="string"){let n=KS.indexOf(t.type);if(n!==-1)return KS[n]}if(t.profile)return"Service";throw Error("Resource type is not known")}var ZS=class o2{constructor(e,n={}){so(this,"traversals",void 0),so(this,"options",void 0),so(this,"_traverseManifest",dm(this.traverseManifestItems.bind(this),this.traverseNavPlace.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this),this.traverseLinkedCanvases.bind(this),this.traverseManifestStructures.bind(this),this.traverseInlineAnnotationPages.bind(this))),so(this,"_traverseCanvas",dm(this.traverseCanvasItems.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this),this.traverseLinkedCanvases.bind(this),this.traverseInlineAnnotationPages.bind(this))),so(this,"_traverseAnnotationPage",dm(this.traverseAnnotationPageItems.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this))),so(this,"_traverseRange",dm(this.traverseRangeRanges.bind(this),this.traverseLinking.bind(this),this.traverseDescriptive.bind(this),this.traverseLinkedCanvases.bind(this))),this.traversals={collection:[],manifest:[],canvas:[],annotationCollection:[],annotationPage:[],annotation:[],contentResource:[],choice:[],range:[],service:[],agent:[],specificResource:[],geoJson:[],...e},this.options={allowUndefinedReturn:!1,...n}}static all(e){return new o2({collection:[e],manifest:[e],canvas:[e],annotationCollection:[e],annotationPage:[e],annotation:[e],contentResource:[e],choice:[e],range:[e],service:[e],geoJson:[e],specificResource:[e],agent:[e]})}traverseDescriptive(e){return e.thumbnail&&(e.thumbnail=ja(e.thumbnail).map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.provider&&(e.provider=e.provider.map(n=>this.traverseAgent(n,e))),e}traverseLinking(e){return e.seeAlso&&(e.seeAlso=ja(e.seeAlso).map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.service&&(e.service=ja(e.service).map(n=>this.traverseService(n))),e.services&&(e.services=ja(e.services).map(n=>this.traverseService(n,e))),e.logo&&(e.logo=ja(e.logo).map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.homepage&&(e.homepage=ja(e.homepage).map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.partOf&&(e.partOf=e.partOf.map(n=>typeof n=="string"||!n.type?this.traverseType(n,{parent:e},this.traversals.contentResource):n.type==="Canvas"?this.traverseType(n,{parent:e},this.traversals.canvas):n.type==="AnnotationCollection"?this.traverseType(n,{parent:e},this.traversals.annotationCollection):n.type==="Collection"?this.traverseType(n,{parent:e},this.traversals.collection):this.traverseType(n,{parent:e},this.traversals.contentResource))),e.start&&(ki(e.start)?e.start=this.traverseSpecificResource(e.start,"Canvas",e):e.start=this.traverseType(e.start,{parent:e},this.traversals.canvas)),e.rendering&&(e.rendering=e.rendering.map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e.supplementary&&(e.supplementary=e.supplementary.map(n=>this.traverseType(n,{parent:e},this.traversals.contentResource))),e}traverseCollectionItems(e){return e.items&&e.items.map(n=>n.type==="Collection"?this.traverseCollection(n):this.traverseManifest(n)),e}traverseCollection(e,n){return this.traverseType(this.traverseDescriptive(this.traverseNavPlace(this.traverseInlineAnnotationPages(this.traverseLinking(this.traverseLinkedCanvases(this.traverseCollectionItems(e)))))),{parent:n},this.traversals.collection)}traverseGeoJson(e,n){return this.traverseType(e,{parent:n},this.traversals.geoJson)}traverseNavPlace(e){return e.navPlace&&(e.navPlace=this.traverseGeoJson(e.navPlace,e)),e}traverseManifestItems(e){return e.items&&(e.items=e.items.map(n=>this.traverseCanvas(n))),e}traverseManifestStructures(e){return e.structures&&(e.structures=e.structures.map(n=>this.traverseRange(n))),e}traverseManifest(e,n){return this.traverseType(this._traverseManifest(e),{parent:n},this.traversals.manifest)}traverseCanvasItems(e){return e.items=(e.items||[]).map(n=>this.traverseAnnotationPage(n,e)),e}traverseInlineAnnotationPages(e){return typeof e=="string"||!e||e.annotations&&(e.annotations=e.annotations.map(n=>this.traverseAnnotationPage(n,e))),e}traverseCanvas(e,n){return this.traverseType(this._traverseCanvas(e),{parent:n},this.traversals.canvas)}traverseAnnotationPageItems(e){return e.items&&(e.items=e.items.map(n=>this.traverseAnnotation(n,e))),e}traverseAnnotationPage(e,n){return this.traverseType(this._traverseAnnotationPage(e),{parent:n},this.traversals.annotationPage)}traverseAnnotationBody(e){return Array.isArray(e.body)?e.body=e.body.map(n=>this.traverseContentResource(n,e)):e.body&&(e.body=this.traverseContentResource(e.body,e)),e}traverseLinkedCanvases(e){return e.placeholderCanvas&&(e.placeholderCanvas=this.traverseCanvas(e.placeholderCanvas)),e.accompanyingCanvas&&(e.accompanyingCanvas=this.traverseCanvas(e.accompanyingCanvas)),e}traverseAnnotation(e,n){return this.traverseType(this.traverseLinking(this.traverseAnnotationBody(this.traverseDescriptive(e))),{parent:n},this.traversals.annotation)}traverseContentResourceLinking(e){return typeof e=="string"||!e||e&&e.service&&(e.service=ja(e.service||[]).map(n=>this.traverseService(n,e))),e}traverseContentResource(e,n){return e.type==="Choice"&&(e.items=e.items.map(i=>this.traverseContentResource(i,e))),ki(e)?this.traverseSpecificResource(e,"ContentResource"):this.traverseType(this.traverseInlineAnnotationPages(this.traverseContentResourceLinking(e)),{parent:n},this.traversals.contentResource)}traverseSpecificResource(e,n,i){let a=e.source;return typeof e.source=="string"&&(a={id:e.source,type:n||"unknown"}),this.traverseType({...e,source:n==="Canvas"||a.type==="Canvas"?this.traverseType(a,{parent:i},this.traversals.canvas):n==="ContentResource"?this.traverseContentResource(a,{parent:i}):this.traverseUnknown(a,{parent:i,typeHint:n})},{parent:i},this.traversals.specificResource)}traverseRangeRanges(e){return e.items&&(e.items=e.items.map(n=>typeof n=="string"?this.traverseCanvas({id:n,type:"Canvas"},e):ki(n)?this.traverseSpecificResource(n,"Canvas",e):n.type==="Manifest"?this.traverseManifest(n,e):this.traverseRange(n,e))),e}traverseRange(e,n){return this.traverseType(this._traverseRange(e),{parent:n},this.traversals.range)}traverseAgent(e,n){return this.traverseType(this.traverseDescriptive(this.traverseLinking(e)),{parent:n},this.traversals.agent)}traverseType(e,n,i){return i.reduce((a,o)=>{let s=o(a,n);return s===void 0&&!this.options.allowUndefinedReturn?a:s},e)}traverseService(e,n){let i=Object.assign({},e);return i&&i.service&&(i.service=ja(i.service).map(a=>this.traverseService(a))),this.traverseType(i,{parent:n},this.traversals.service)}traverseUnknown(e,{parent:n,typeHint:i}={}){let a=a2(e,i);switch(a){case"Collection":return this.traverseCollection(e,n);case"Manifest":return this.traverseManifest(e,n);case"Canvas":return this.traverseCanvas(e,n);case"AnnotationPage":return this.traverseAnnotationPage(e,n);case"Annotation":return this.traverseAnnotation(e,n);case"ContentResource":return this.traverseContentResource(e,n);case"Range":return this.traverseRange(e,n);case"Service":return this.traverseService(e,n);case"Agent":return this.traverseAgent(e,n);default:throw Error(`Unknown or unsupported resource type of ${a}`)}}};var JS="http://library.stanford.edu/iiif/image-api/compliance.html#level0",WS="http://library.stanford.edu/iiif/image-api/compliance.html#level1",$S="http://library.stanford.edu/iiif/image-api/compliance.html#level2",t1="http://library.stanford.edu/iiif/image-api/conformance.html#level0",e1="http://library.stanford.edu/iiif/image-api/conformance.html#level1",n1="http://library.stanford.edu/iiif/image-api/conformance.html#level2",i1="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",a1="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",o1="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",r1="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",l1="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",s1="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",u1="http://iiif.io/api/image/1/level0.json",c1="http://iiif.io/api/image/1/profiles/level0.json",f1="http://iiif.io/api/image/1/level1.json",d1="http://iiif.io/api/image/1/profiles/level1.json",h1="http://iiif.io/api/image/1/level2.json",p1="http://iiif.io/api/image/1/profiles/level2.json",m1="http://iiif.io/api/image/2/level0.json",g1="http://iiif.io/api/image/2/profiles/level0.json",y1="http://iiif.io/api/image/2/level1.json",v1="http://iiif.io/api/image/2/profiles/level1.json",S1="http://iiif.io/api/image/2/level2.json",b1="http://iiif.io/api/image/2/profiles/level2.json",x1="level0",E1="level1",R1="level2",A1="http://iiif.io/api/image/2/level0",T1="http://iiif.io/api/image/2/level1",C1="http://iiif.io/api/image/2/level2",wu=[C1,$S,n1,o1,s1,h1,p1,S1,b1,R1],hm=[...wu,T1,WS,e1,a1,l1,f1,d1,y1,v1,E1],w1=[A1,T1,C1,JS,WS,$S,t1,e1,n1,i1,a1,o1,r1,l1,s1,u1,c1,f1,d1,h1,p1,m1,g1,y1,v1,S1,b1,x1,E1,R1],M1=w1,O1=[A1,JS,t1,i1,r1,u1,c1,m1,g1,x1],r2={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},l2={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},s2={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};var u2=["sc:Collection","sc:Manifest","sc:Canvas","sc:AnnotationList","oa:Annotation","sc:Range","sc:Layer","sc:Sequence","oa:Choice","Service","ContentResource"];function HP(t){if(t==null)throw Error("Null or undefined is not a valid entity.");if(Array.isArray(t))throw Error("Array is not a valid entity");if(typeof t!="object")throw Error(`${typeof t} is not a valid entity`);if(typeof t["@type"]=="string"){let e=u2.indexOf(t["@type"]);if(e!==-1)return u2[e]}if(t.profile)return"Service";if(t.format||t["@type"])return"ContentResource";throw Error("Resource type is not known")}var UP=class h2{constructor(e,n={}){so(this,"traversals",void 0),so(this,"options",void 0),this.traversals={collection:[],manifest:[],canvas:[],annotationList:[],sequence:[],annotation:[],contentResource:[],choice:[],range:[],service:[],layer:[],...e},this.options={convertPropsToArray:!0,mergeMemberProperties:!0,allowUndefinedReturn:!1,...n}}static all(e){return new h2({collection:[e],manifest:[e],canvas:[e],annotationList:[e],sequence:[e],annotation:[e],contentResource:[e],choice:[e],range:[e],service:[e],layer:[e]})}traverseCollection(e){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCollectionItems(e))),this.traversals.collection)}traverseCollectionItems(e){if(this.options.mergeMemberProperties){let n=[...(e.manifests||[]).map(o=>typeof o=="string"?{"@id":o,"@type":"sc:Manifest"}:o),...(e.collections||[]).map(o=>typeof o=="string"?{"@id":o,"@type":"sc:Collection"}:o),...e.members||[]],i=[],a=n.filter(o=>i.includes(o["@id"])?!1:(i.push(o["@id"]),!0));delete e.collections,delete e.manifests,e.members=a}return e.manifests&&(e.manifests=e.manifests.map(n=>this.traverseManifest(typeof n=="string"?{"@id":n,"@type":"sc:Manifest"}:n))),e.collections&&(e.collections=e.collections.map(n=>this.traverseCollection(typeof n=="string"?{"@id":n,"@type":"sc:Collection"}:n))),e.members&&(e.members=e.members.map(n=>typeof n=="string"?n:n["@type"]==="sc:Collection"?this.traverseCollection(n):n["@type"]==="sc:Manifest"?this.traverseManifest(n):this.traverseUnknown(n))),e}traverseManifest(e){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseManifestItems(e))),this.traversals.manifest)}traverseManifestItems(e){return e.sequences&&(e.sequences=e.sequences.map(n=>this.traverseSequence(n))),e.structures&&(e.structures=e.structures.map(n=>this.traverseRange(n))),e}traverseSequence(e){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseSequenceItems(e))),this.traversals.sequence)}traverseSequenceItems(e){return e.canvases&&(e.canvases=e.canvases.map(n=>this.traverseCanvas(n))),e}traverseCanvas(e){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCanvasItems(e))),this.traversals.canvas)}traverseCanvasItems(e){return e.images&&(e.images=e.images.map(n=>this.traverseAnnotation(n))),e.otherContent&&(e.otherContent=e.otherContent.map(n=>this.traverseAnnotationList(n))),e}traverseRange(e){return e["@type"]!=="sc:Range"&&(e["@type"]="sc:Range"),this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseRangeItems(e))),this.traversals.range)}traverseRangeItems(e){if(this.options.mergeMemberProperties){let n=[...(e.ranges||[]).map(i=>typeof i=="string"?{"@id":i,"@type":"sc:Range"}:i),...(e.canvases||[]).map(i=>typeof i=="string"?{"@id":i,"@type":"sc:Canvas"}:i),...e.members||[]];delete e.ranges,delete e.canvases,e.members=n.length?n.map(i=>this.traverseUnknown(i)):void 0}return e}traverseAnnotationList(e){let n=typeof e=="string"?{"@id":e,"@type":"sc:AnnotationList"}:e;return this.traverseType(this.traverseDescriptive(this.traverseAnnotationListItems(n)),this.traversals.annotationList)}traverseAnnotationListItems(e){return e.resources&&(e.resources=e.resources.map(n=>this.traverseAnnotation(n))),e}traverseAnnotation(e){return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseAnnotationItems(e))),this.traversals.annotation)}traverseAnnotationItems(e){return e.resource&&(Array.isArray(e.resource)?e.resource=e.resource.map(n=>this.traverseContentResource(n)):e.resource=this.traverseContentResource(e.resource)),e.on,e}traverseLayer(e){return this.traverseType(this.traverseLinking(this.traverseLayerItems(e)),this.traversals.layer)}traverseLayerItems(e){return e.otherContent&&(e.otherContent=e.otherContent.map(n=>this.traverseAnnotationList(n))),e}traverseChoice(e){return this.traverseType(this.traverseChoiceItems(e),this.traversals.choice)}traverseChoiceItems(e){return e.default&&e.default!=="rdf:nil"&&(e.default=this.traverseContentResource(e.default)),e.item&&e.item!=="rdf:nil"&&(e.item=e.item.map(n=>this.traverseContentResource(n))),e}traverseService(e){return this.traverseType(this.traverseLinking(e),this.traversals.service)}traverseContentResource(e){return e["@type"]==="oa:Choice"?this.traverseChoice(e):this.traverseType(this.traverseDescriptive(this.traverseLinking(e)),this.traversals.contentResource)}traverseUnknown(e){if(!e["@type"]||typeof e=="string")return e;switch(HP(e)){case"sc:Collection":return this.traverseCollection(e);case"sc:Manifest":return this.traverseManifest(e);case"sc:Canvas":return this.traverseCanvas(e);case"sc:Sequence":return this.traverseSequence(e);case"sc:Range":return this.traverseRange(e);case"oa:Annotation":return this.traverseAnnotation(e);case"sc:AnnotationList":return this.traverseAnnotationList(e);case"sc:Layer":return this.traverseLayer(e);case"Service":return this.traverseService(e);case"oa:Choice":return this.traverseChoice(e);case"ContentResource":return this.traverseContentResource(e)}return e.profile?this.traverseService(e):e}traverseImageResource(e){let n=Array.isArray(e),i=Array.isArray(e)?e:[e],a=[];for(let o of i)typeof o=="string"?a.push(this.traverseContentResource({"@id":o,"@type":"dctypes:Image"})):a.push(this.traverseContentResource(o));return!n&&!this.options.convertPropsToArray?a[0]:a}traverseDescriptive(e){return e.thumbnail&&(e.thumbnail=this.traverseImageResource(e.thumbnail)),e.logo&&(e.logo=this.traverseImageResource(e.logo)),e}traverseOneOrMoreServices(e){let n=Array.isArray(e),i=Array.isArray(e)?e:[e],a=[];for(let o of i)a.push(this.traverseService(o));return!n&&!this.options.convertPropsToArray?a[0]:a}traverseLinking(e){return e.related&&(e.related=this.traverseOneOrManyType(e.related,this.traversals.contentResource)),e.rendering&&(e.rendering=this.traverseOneOrManyType(e.rendering,this.traversals.contentResource)),e.service&&(e.service=this.traverseOneOrMoreServices(e.service)),e.seeAlso&&(e.seeAlso=this.traverseOneOrManyType(e.seeAlso,this.traversals.contentResource)),e.within&&(typeof e.within=="string"||(e.within=this.traverseOneOrManyType(e.within,this.traversals.contentResource))),e.startCanvas&&(typeof e.startCanvas=="string"?e.startCanvas=this.traverseType({"@id":e.startCanvas,"@type":"sc:Canvas"},this.traversals.canvas):e.startCanvas&&this.traverseType(e.startCanvas,this.traversals.canvas)),e.contentLayer&&(typeof e.contentLayer=="string"?e.contentLayer=this.traverseLayer({"@id":e.contentLayer,"@type":"sc:Layer"}):e.contentLayer=this.traverseLayer(e.contentLayer)),e}traverseOneOrManyType(e,n){if(!Array.isArray(e))if(this.options.convertPropsToArray)e=[e];else return this.traverseType(e,n);return e.map(i=>this.traverseType(i,n))}traverseType(e,n){return n.reduce((i,a)=>{let o=a(i);return o===void 0&&!this.options.allowUndefinedReturn?i:o},e)}},VP=["http://iiif.io/api/image/2/level1","http://iiif.io/api/image/2/level2","http://library.stanford.edu/iiif/image-api/compliance.html#level1","http://library.stanford.edu/iiif/image-api/compliance.html#level2","http://library.stanford.edu/iiif/image-api/conformance.html#level1","http://library.stanford.edu/iiif/image-api/conformance.html#level2","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2","http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1","http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2","http://iiif.io/api/image/1/level1.json","http://iiif.io/api/image/1/profiles/level1.json","http://iiif.io/api/image/1/level2.json","http://iiif.io/api/image/1/profiles/level2.json","http://iiif.io/api/image/2/level1.json","http://iiif.io/api/image/2/profiles/level1.json","http://iiif.io/api/image/2/level2.json","http://iiif.io/api/image/2/profiles/level2.json","level1","level2"],z1={attributionLabel:"Attribution",lang:"none",providerId:"http://example.org/provider",providerName:""};function jP(t){if(typeof t=="string")return[t];if(!t)return[];let e=Array.isArray(t)?t:[t],n=[];for(let i of e){if(typeof i=="string"){n.push(i);continue}n.push({"@language":i["@language"]||i.language,"@value":i["@value"]||i.value})}return n}function Wl(t,e="none"){if(!t)return{none:[""]};let n=jP(t),i={};for(let a of n){if(typeof a=="string"){i[e]=i[e]?i[e]:[],i[e].push(a||"");continue}if(!a["@language"]){i[e]=i[e]?i[e]:[],i[e].push(a["@value"]||"");continue}let o=a["@language"];i[o]=i[o]?i[o]:[],i[o].push(a["@value"]||"")}return Object.keys(i).length===0?{none:[""]}:i}function p2(t){if(Array.isArray(t))return p2(t.find(e=>typeof e=="string"));if(wu.indexOf(t)!==-1)return"level2";if(VP.indexOf(t)!==-1)return"level1";if(M1.indexOf(t)!==-1)return"level0";if(typeof t=="string")return t}function qP(t){let e=Array.isArray(t)?t:[t];for(let n of e)switch(n){case"http://iiif.io/api/image/2/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2":return"ImageService2";case"http://iiif.io/api/image/1/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/context.json":return"ImageService1";case"http://iiif.io/api/annex/openannotation/context.json":return"ImageApiSelector"}}function FP(t){switch(t){case"http://iiif.io/api/image/2/level0.json":case"http://iiif.io/api/image/2/level1.json":case"http://iiif.io/api/image/2/level2.json":return"ImageService2";case"http://iiif.io/api/auth/1/kiosk":case"http://iiif.io/api/auth/1/login":case"http://iiif.io/api/auth/1/clickthrough":case"http://iiif.io/api/auth/1/external":case"http://iiif.io/api/auth/0/kiosk":case"http://iiif.io/api/auth/0/login":case"http://iiif.io/api/auth/0/clickthrough":case"http://iiif.io/api/auth/0/external":return"AuthCookieService1";case"http://iiif.io/api/auth/1/token":case"http://iiif.io/api/auth/0/token":return"AuthTokenService1";case"http://iiif.io/api/auth/1/logout":case"http://iiif.io/api/auth/0/logout":return"AuthLogoutService1";case"http://iiif.io/api/search/1/search":case"http://iiif.io/api/search/0/search":return"SearchService1";case"http://iiif.io/api/search/1/autocomplete":case"http://iiif.io/api/search/0/autocomplete":return"AutoCompleteService1"}}function c2(t){for(let e of["sc","oa","dcterms","dctypes","iiif"])if(t.startsWith(`${e}:`))return t.slice(e.length+1);return t}var GP=["Collection","Manifest","Annotation","AnnotationPage","Range","Service"];function I1(t){let e=t["@id"]||t.id,n=t["@type"]||t.type,i=t.profile||void 0,a=t["@context"]||void 0;if(i){let o=FP(i);if(o)return o}if(a){let o=qP(a);if(o)return o}if(n){if(Array.isArray(n)){if(n.indexOf("oa:CssStylesheet")!==-1)return"CssStylesheet";if(n.indexOf("cnt:ContentAsText")!==-1)return"TextualBody";n=n[0]}for(let o of["sc","oa","dcterms","dctypes","iiif"])if(n.startsWith(`${o}:`)){n=n.slice(o.length+1);break}switch(n){case"Layer":return"AnnotationCollection";case"AnnotationList":return"AnnotationPage";case"cnt:ContentAsText":return"TextualBody"}}if(n&&GP.indexOf(n)!==-1)return n;if(t.format){if(t.format.startsWith("image/"))return"Image";if(t.format.startsWith("text/")||t.format==="application/pdf")return"Text";if(t.format.startsWith("application/"))return"Dataset"}return e&&(e.endsWith(".jpg")||e.endsWith(".png")||e.endsWith(".jpeg"))?"Image":n||"unknown"}var kP=/http(s)?:\/\/(creativecommons.org|rightsstatements.org)[^"'\\<\n]+/gm;function YP(t){let e=t.match(kP);return e?e[0]:t}function QP(t,e="Rights/License",n="none"){let i=null,a=[],o=Array.isArray(t)?t:[t];for(let s of o){let u=s?YP(s):void 0;if(u&&(u.indexOf("creativecommons.org")!==-1||u.indexOf("rightsstatements.org")!==-1)){i=u.startsWith("https://")?`http://${u.slice(8)}`:u;continue}u&&a.push({label:{[n]:[e]},value:{[n]:[u]}})}return[i,a]}var XP=["http://iiif.io/api/presentation/2/context.json","http://iiif.io/api/image/2/context.json","http://iiif.io/api/image/1/context.json","http://library.stanford.edu/iiif/image-api/1.1/context.json","http://iiif.io/api/search/1/context.json","http://iiif.io/api/search/0/context.json","http://iiif.io/api/auth/1/context.json","http://iiif.io/api/auth/0/context.json","http://iiif.io/api/annex/openannotation/context.json"];function KP(t){if(t){let e=Array.isArray(t)?t:[t],n=[];for(let i of e)i==="http://iiif.io/api/presentation/2/context.json"&&n.push("http://iiif.io/api/presentation/3/context.json"),XP.indexOf(i)===-1&&n.push(i);if(e.length)return n.length===1?n[0]:n}}function ZP(t){return t?t.map(e=>({label:Wl(e.label),value:Wl(e.value)})):[]}var f2=0;function m2(t,e){let n=encodeURI(t.id||t["@id"]||"").trim();return n&&e?`${n}/${e}`:n||(f2++,`http://example.org/${t["@type"]}${e?`/${e}`:""}/${f2}`)}function Lo(t){let e=[...t.behavior||[]];t.viewingHint&&e.push(t.viewingHint);let n;return Array.isArray(t.motivation)?n=t.motivation.map(c2):t.motivation&&(n=c2(t.motivation)),{"@context":t["@context"]?KP(t["@context"]):void 0,id:(t["@id"]||m2(t)).trim(),type:I1(t),behavior:e.length?e:void 0,height:t.height?t.height:void 0,width:t.width?t.width:void 0,motivation:n,viewingDirection:t.viewingDirection,profile:t.profile,format:t.format?t.format:void 0,duration:void 0,timeMode:void 0}}function Bo(t){let[e,n]=QP(t.license),i=[...t.metadata?ZP(t.metadata):[],...n];return{rights:e,metadata:i.length?i:void 0,label:t.label?Wl(t.label):void 0,requiredStatement:t.attribution?{label:Wl(z1.attributionLabel),value:Wl(t.attribution)}:void 0,navDate:t.navDate,summary:t.description?Wl(t.description):void 0,thumbnail:JP(t.thumbnail)}}function JP(t){return t&&(Array.isArray(t)?t:[t]).map(n=>typeof n=="string"?{id:n,type:"Image"}:(n.type==="unknown"&&(n.type="Image"),n))}function WP(t){if(!t.within)return;let e=Array.isArray(t.within)?t.within:[t.within],n=[];for(let i of e)if(typeof i=="string"){if(i)switch(t["@type"]){case"sc:Manifest":n.push({id:i,type:"Collection"});break}}else i["@id"]&&n.push({id:i["@id"],type:I1(i)});return n.length?n:void 0}function Nr(t){let e=t.related?Array.isArray(t.related)?t.related:[t.related]:[],n=t.contentLayer;return{provider:t.logo||e.length?[{id:z1.providerId,type:"Agent",homepage:e.length?[e[0]]:void 0,logo:t.logo?Array.isArray(t.logo)?t.logo:[t.logo]:void 0,label:Wl(z1.providerName)}]:void 0,partOf:WP(t),rendering:t.rendering,seeAlso:t.seeAlso,start:t.startCanvas,service:t.service?ja(t.service):void 0,supplementary:n?[n]:void 0}}function $P(t){return{chars:t.chars,format:t.format?t.format:void 0,language:t.language}}function _1(t,e){return t?typeof t=="string"?{id:t,type:e}:typeof t?.["@id"]=="string"?{id:t["@id"],type:e}:typeof t.id=="string"?{id:t.id,type:e}:null:null}function t6(t){let e={};if(t.first){let n=_1(t.first,"Collection");n&&(e.first=n)}if((t.total||t.total===0)&&(e.total=t.total),t.prev){let n=_1(t.prev,"Collection");n&&(e.prev=n)}if(t.next){let n=_1(t.next,"Collection");n&&(e.next=n)}return e}function e6(t){let e=[];for(let n of t){let i={...n};i.items&&i.items.length===0&&delete i.items,e.push(i)}return e}function n6(t){return qa({...Lo(t),...Bo(t),...Nr(t),...t6(t),items:e6(t.members)})}function i6(t){let e=[],n=[],i,a;for(let s of t.sequences||[])s.canvases.length&&e.push(...s.canvases),s.behavior&&n.push(...s.behavior),s.viewingDirection&&(a=s.viewingDirection),s.startCanvas&&(i=s.startCanvas);let o=Lo(t);return n.length&&(o.behavior?o.behavior.push(...n):o.behavior=n),qa({...o,...Bo(t),...Nr(t),viewingDirection:a,start:i,items:e,structures:a6(t.structures)})}function a6(t){if(!t)return t;let e=new Map;for(let i of t)e.set(i.id,i);let n=[];for(let i of t)if(i.items){let a=i.items.map(o=>typeof o=="string"?(n.push(o),e.get(o)||o):o&&o.id?(n.push(o.id),e.get(o.id)||o):o);i.items=a}return t.filter(i=>n.indexOf(i.id)===-1)}function o6(t){return qa({...Lo(t),...Bo(t),...Nr(t),annotations:t.otherContent&&t.otherContent.length?t.otherContent:void 0,items:t.images&&t.images.length?[{id:m2(t,"annotation-page"),type:"AnnotationPage",items:t.images}]:void 0})}function r6(t){return qa({...Lo(t),...Bo(t),...Nr(t),items:t.resources&&t.resources.length?t.resources:void 0})}function l6(t){return!t.canvases||t.canvases.length===0?{canvases:[],behavior:[]}:{canvases:t.canvases,behavior:t.viewingHint?[t.viewingHint]:[],viewingDirection:t.viewingDirection,startCanvas:t.startCanvas}}function s6(t){function e(n){if(Array.isArray(n)){if(n.length>1)return{type:"List",items:n.map(e)};n=n[0]}if(typeof n=="string")return encodeURI(n).trim();if("@type"in n){let i;if(typeof n.full=="string")i=n.full;else if(n.full["@type"]==="dctypes:Image")i={id:n.full["@id"],type:"Image"};else if(n.full["@type"]==="sc:Canvas")i={id:n.full["@id"],type:"Canvas"};else throw Error(`Unsupported source type on annotation: ${n.full["@type"]}`);return{type:"SpecificResource",source:i,selector:N1(n.selector)}}else return encodeURI(n["@id"]).trim()}return qa({...Lo(t),...Bo(t),...Nr(t),target:e(t.on),body:Array.isArray(t.resource)?t.resource.map(d2):d2(t.resource)})}function d2(t){return t.type==="Choice"?t:g2(t)}function g2(t){let e=t;return qa({...Lo(e),...Bo(e),...Nr(e),...$P(e)})}function u6(t){let e=[];return t.default&&t.default!=="rdf:nil"&&e.push(t.default),t.item&&t.item!=="rdf:nil"&&e.push(...t.item),qa({...Lo(t),...Bo(t),items:e})}function c6(t){return qa({...Lo(t),...Bo(t),...Nr(t),items:t.members})}function f6(t){let{"@id":e,"@type":n,"@context":i,profile:a,...o}=t,s={};return e&&(s["@id"]=e),s["@type"]=I1(t),s["@type"]==="unknown"&&(i&&i.length&&(s["@context"]=i),s["@type"]="Service"),a&&(s.profile=p2(a)),qa({...s,...o})}function d6(t){return qa({...Lo(t),...Bo(t),...Nr(t)})}var h6=new UP({collection:[n6],manifest:[i6],canvas:[o6],annotationList:[r6],sequence:[l6],annotation:[s6],contentResource:[g2],choice:[u6],range:[c6],service:[f6],layer:[d6]});function y2(t){return t&&t["@context"]&&(t["@context"]==="http://iiif.io/api/presentation/2/context.json"||t["@context"].indexOf("http://iiif.io/api/presentation/2/context.json")!==-1||t["@context"]==="http://www.shared-canvas.org/ns/context.json")||t["@context"]==="http://iiif.io/api/image/2/context.json"||t["@id"]&&t["@type"]==="sc:Collection"||t["@id"]&&t["@type"]==="sc:Manifest"?(t["@context"]||(t["@context"]="http://iiif.io/api/presentation/2/context.json"),h6.traverseUnknown(t)):t}function N1(t){if((Array.isArray(t["@type"])&&t["@type"].includes("oa:SvgSelector")||t["@type"]=="oa:SvgSelector")&&("chars"in t||"value"in t))return{type:"SvgSelector",value:"chars"in t?t.chars:t.value};if(t["@type"]==="oa:FragmentSelector")return{type:"FragmentSelector",value:t.value};if(t["@type"]==="oa:Choice")return[N1(t.default),...(Array.isArray(t.item)?t.item:[t.item]).map(N1)];if(t["@type"]=="iiif:ImageApiSelector")return{type:"ImageApiSelector",region:"region"in t?t.region:void 0,rotation:"rotation"in t?t.rotation:void 0};throw Error(`Unsupported selector type: ${t["@type"]}`)}function Nu(t,e){let n=e||"unknown";if(!t)return;if(typeof t=="string")return{id:t,type:n};if(ki(t))return Nu(t.source,e);let i=n&&n!=="unknown"?n:t.type||t["@type"],a=t.id||t["@id"];if(i&&i.indexOf(":")!==-1&&(i=i.split(":").pop()),a&&i)return{id:a,type:i}}var Ou={},Ke="iiif-parser:hasPart",Yi="iiif-parser:partOf",_u="iiif-parser:isExternal",ba="__$UNSET$__",L1="__$UNWRAP$__",xt=[];Object.freeze(xt),Object.freeze(Ou);function b2(t){if(t===Ou||Object.keys(t).length===0)return!0;for(let e in t)return!1;return!0}function Iu(t,e){if(e&&e["@explicit"]){let n={},i=Object.keys(e);for(let a of i)a===Yi||a==="@explicit"||(b2(e[a])?n[a]=t[a]:n[a]=e[a]);return n}return t}function B1(t,e,n){let i=Nu(e);if(!i)return[void 0,void 0];let a=t.requests[i.id],o=i.type||t.mapping[i.id];if(!o||a&&a.resourceUri&&(!t.entities[o]||!t.entities[o][a.resourceUri]))return[void 0,void 0];let s=t.entities[o][a?a.resourceUri:i.id];if(i.type&&!s)return B1(t,{id:i.id},n);if(s&&s[Ke]){let u=s[Ke].find(p=>n?p[Yi]===n.id:p[Yi]===s.id);return[Iu(s,u),s]}return[s,s]}var x2={id:"https://iiif-parser/annotation-page",type:"AnnotationPage",behavior:xt,label:null,thumbnail:xt,summary:null,requiredStatement:null,metadata:xt,rights:null,provider:xt,items:xt,seeAlso:xt,homepage:xt,rendering:xt,service:xt},E2={id:"https://iiif-parser/empty-canvas",type:"Canvas",label:null,behavior:xt,thumbnail:xt,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:xt,rights:null,navDate:null,provider:xt,items:xt,annotations:xt,seeAlso:xt,homepage:xt,partOf:xt,rendering:xt,service:xt,duration:0,height:0,width:0},R2={id:"https://iiif-parser/empty-collection",type:"Collection",label:null,viewingDirection:"left-to-right",behavior:xt,thumbnail:xt,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:xt,rights:null,navDate:null,provider:xt,items:xt,annotations:xt,seeAlso:xt,homepage:xt,partOf:xt,rendering:xt,service:xt,services:xt},A2={id:"https://iiif-parser/empty-manifest",type:"Manifest",annotations:xt,behavior:xt,homepage:xt,items:xt,label:null,metadata:xt,navDate:null,provider:xt,partOf:xt,accompanyingCanvas:null,placeholderCanvas:null,rendering:xt,requiredStatement:null,rights:null,seeAlso:xt,service:xt,services:xt,start:null,structures:xt,summary:null,thumbnail:xt,viewingDirection:"left-to-right"},T2={id:"https://iiif-parser/empty-canvas",type:"Range",label:null,behavior:xt,thumbnail:xt,accompanyingCanvas:null,placeholderCanvas:null,summary:null,requiredStatement:null,metadata:xt,rights:null,navDate:null,provider:xt,items:xt,annotations:xt,seeAlso:xt,homepage:xt,partOf:xt,rendering:xt,service:xt,start:null,supplementary:null,viewingDirection:"left-to-right"},C2={id:"https://iiif-parser/empty-agent",type:"Agent",label:{},logo:xt,seeAlso:xt,homepage:xt},w2={id:"https://iiif-parser/empty-service",type:"UnknownService"};function pm(t,e={}){if(Array.isArray(t))return pm(t[0]);if(typeof t=="string"){let[n,i]=t.split("#");return i?{type:"SpecificResource",source:{id:n,type:e.typeHint||"Unknown"},selector:{type:"FragmentSelector",value:i}}:{type:"SpecificResource",source:{id:n,type:e.typeMap&&e.typeMap[n]||e.typeHint||"Unknown"}}}if(t.type==="Choice"||t.type==="List"||t.type==="Composite"||t.type==="Independents")return pm(t.items[0]);if(!t.type&&"source"in t&&(t.type="SpecificResource"),t.type==="SpecificResource"){t.source.type==="Canvas"&&t.source.partOf&&typeof t.source.partOf=="string"&&(t.source.partOf=[{id:t.source.partOf,type:"Manifest"}]);let n=typeof t.source=="string"?t.source:t.source.id;if(n?.includes("#")){let i=pm(n,e);i&&(t.selector=i.selector,t.source=i.source)}return t.selector?{...t,type:"SpecificResource",source:t.source,selector:t.selector}:{...t,type:"SpecificResource",source:t.source}}if(t.id){t.type==="Canvas"&&t.partOf&&typeof t.partOf=="string"&&(t.partOf=[{id:t.partOf,type:"Manifest"}]);let[n,i]=t.id.split("#");return i?{type:"SpecificResource",source:{...t,id:n},selector:{type:"FragmentSelector",value:i}}:{type:"SpecificResource",source:{...t,id:n}}}return{type:"SpecificResource",source:t}}function M2(){return{Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{},Agent:{}}}function O2(t,e){if(typeof t=="string")return{id:t,type:e};if(!t.id)throw Error(`Invalid resource does not have an ID (${JSON.stringify(t)}, ${e})`);return t}function p6(t,e){return(n,i)=>{let a=t[n]?t[n]:{};return(o,s)=>{let u=O2(o,i||n);return u&&u.id&&n?(a[u.id]=a[u.id]?ym(a[u.id],u,{parent:s.parent,isTopLevel:e.id===u.id}):ym({id:u.id,type:u.type},u,{parent:s.parent,isTopLevel:e.id===u.id}),{id:u.id,type:n==="ContentResource"?n:u.type}):u}}}function gm(t,e,n){if(!e)return t;if(Array.isArray(t)){if(!Array.isArray(e))throw Error("Cannot merge array with non-array");let i=[...t];for(let a of e)if(a["@id"]&&!a.id&&(a.id=a["@id"]),a["@type"]&&!a.type&&(a.type=a["@type"]),a!=null)if(Array.isArray(a))i.push(a);else if(typeof a=="object"&&a.id&&a.type){let o=i.findIndex(s=>s.id===a.id&&s.type===a.type);o>=0&&(i[o]=gm(i[o],a))}else t.indexOf(a)===-1&&i.push(a);return i}else if(typeof t=="object"){if(Array.isArray(e)||typeof e!="object")throw Error("Cannot merge object with non-object");let i={...t},a=[],o=[],s=Object.keys(t).filter(p=>p!==Ke&&p!=="id"&&p!=="type"),u={},d={};for(let[p,f]of Object.entries(e)){if(p===Ke||p==="id"||p==="type")continue;let m=i[p];m===f?o.push(p):m===xt||!m?(a.push(p),i[p]=f):(m&&f&&(u[p]=m,d[p]=f),i[p]=gm(m,f),i[p]===u[p]&&(o.push(p),delete u[p]))}if(n&&(n.parent&&n.parent.id||n.isTopLevel)){let p=[],f={};if(n.parent?f[Yi]=n.parent.id:n.isTopLevel&&(f[Yi]=t.id),i[Ke]&&i[Ke].length){let m=!(i[Ke]||[]).find(v=>v["@explicit"]),g=a.length>0||o.length!==s.length;if(m&&g)for(let v of i[Ke]){let S={...v},R=Object.keys(u);if(S){S["@explicit"]=!0;for(let T of s)T!==Ke&&(S[T]=Ou);for(let T of R)S[T]=u[T]}p.push(S)}else p.push(...i[Ke]);if(g){let v=Object.keys(d);f["@explicit"]=!0;for(let S of a)f[S]=Ou;for(let S of o)f[S]=Ou;for(let S of v)f[S]=d[S]}}f.id=i.id,f.type=i.type,p.push(f),i[Ke]=p}return i}else if(t)return t;return e}function ym(t,e,n){if(typeof t=="string")return t;if(e.id!==t.id||e.type!==t.type){if(e.type==="ImageService3")return e;if(t.type==="ImageService3")return t;throw Error(`Can only merge entities with identical identifiers and type! ${e.type}(${e.id}) => ${t.type}(${t.id})`)}return gm({...t},e,n)}function m6(t){return(e,n)=>i=>{let{id:a,type:o}=O2(i,n||e);if(a===void 0)throw Error("Found invalid entity without an ID.");return e==="ContentResource"||e==="Service"?t[a]=e:t[a]=o,i}}function g6(t){let e=Object.assign({},t);if(e["@id"]&&(e.id=e["@id"]),e["@type"]&&(e.type=e["@type"]),e.service){let n=[];e.service=Array.isArray(e.service)?e.service:[e.service];for(let i of e.service)n.push({id:i["@id"]||i.id,type:i["@type"]||i.type});e.service=n}return Object.assign({},w2,e)}function y6(t){return e=>{t.Service=t.Service?t.Service:{};let n=e.id||e["@id"],i=g6(e);return i&&i.id&&(t.Service[i.id]?t.Service[n]=ym(t.Service[n],i):t.Service[n]=i),e}}function v6(t){let e=JSON.stringify(t),n=5381,i=e.length;for(;i;)n=n*33^e.charCodeAt(--i);let a=n>>>0,o=a.toString(16);return o.length%2?"0"+o:o}function D1(t){return e=>typeof e=="string"?{id:e,type:t}:e.id?e.type?e:{type:t,...e}:{id:`vault://${v6(e)}`,type:t,...e}}function Mu(t){return e=>({...t,...e})}function kf(t){return Array.isArray(t)?t:[t]}function S6(t){return t.body&&(t.body=kf(t.body)),t.seeAlso&&(t.seeAlso=kf(t.seeAlso)),t.audience&&(t.audience=kf(t.audience)),t.accessibility&&(t.accessibility=kf(t.accessibility)),t.motivation&&(t.motivation=kf(t.motivation)),t}function _2(t,{typeHint:e,partOfTypeHint:n}={}){if(typeof t=="string"&&(t={id:t,type:e||"unknown"}),ki(t))return typeof t.source=="string"&&(t.source={id:t.source,type:e||"unknown"}),t.source.type==="Canvas"&&t.source.partOf&&typeof t.source.partOf=="string"&&(t.source.partOf=[{id:t.source.partOf,type:n||"Manifest"}]),t;let i;if((t.id||"").indexOf("#")!==-1){let[a,o]=(t.id||"").split("#");t.id=a,o&&(i={type:"FragmentSelector",value:o})}return{type:"SpecificResource",source:t,selector:i}}function b6(t){let e=Object.assign({},t);return t&&t.items&&(e.items=t.items.map(n=>typeof n=="string"||n.type==="Canvas"?_2(n):n)),e}function x6(t){let e=Object.assign({},t);return e.start?(e.start=_2(e.start,{typeHint:"Canvas"}),e):t}function E6(t){let e=Object.assign({},t);return e.target?(e.target=pm(e.target,{typeHint:"Canvas"}),e):t}function z2(t){return t}function mm(t){return t.items===void 0&&(t[_u]=!0),t}function P1(t){let e=y2(t),n=M2(),i={},a=p6(n,e),o=m6(i),s=new ZS({collection:[mm,Mu(R2),o("Collection"),a("Collection")],manifest:[mm,Mu(A2),x6,o("Manifest"),a("Manifest")],canvas:[Mu(E2),o("Canvas"),a("Canvas")],annotationPage:[mm,D1("AnnotationPage"),Mu(x2),o("AnnotationPage"),a("AnnotationPage")],annotation:[D1("Annotation"),S6,E6,o("Annotation"),a("Annotation")],contentResource:[D1("ContentResource"),o("ContentResource"),a("ContentResource")],range:[Mu(T2),b6,o("Range","Canvas"),a("Range","Canvas")],agent:[Mu(C2),o("Agent"),a("Agent")],specificResource:[z2],service:[y6(n)]}),u=s.traverseUnknown(e);return{entities:n,resource:u,mapping:i}}function N2(t){let e={};for(let[n,i]of t){if(n===L1&&i!==ba)return i;i!==ba&&i!=null&&(e[n]=i)}return e}function H1(t,e,n){if(!e.type||!e.id)throw Error("Unknown entity");if(!n[e.type])throw Error(`Serializer not found for ${e.type}`);function i(a,o,s=0){let u=n[a.type];if(!u)return ba;if(s>20)throw Error("Circular reference: "+a.id+" "+a.type);let[d,p]=B1(t,a.type?a:a.id,o)||(a.id&&a.type?a:null);if(!d)return ba;let f=u(d,t,{parent:o,isTopLevel:e.id===a.id,fullResource:p}),m=f.next();for(;!m.done;){let g=m.value,v=ba;if(g)if(Array.isArray(g)){let S=[];for(let R of g)S.push(i(R,a,s+1));v=S}else v=i(g,a,s+1);m=f.next(v)}return m.value===ba?ba:N2(m.value)}return i(e)}function zu(t,{allowSourceString:e=!0,allowString:n=!1,allowedStringType:i}={}){let a=o=>{if(e&&o&&o.source&&typeof o.source!="string"){let s=Object.keys(o.source);if(o.source.id&&o.source.type&&s.length===2)return{...o,source:o.source.id}}return o};if(t){if(t.source&&t.source.partOf)return a(t);let o=Object.keys(t);if(o.length===2&&t.type&&t.source||o.length===3&&t.type&&t.source&&o.indexOf("selector")!==-1&&!t.selector)return n&&(!i||i===t.source.type)?t.source.id:t.source.type==="ContentResource"?{type:"SpecificResource",source:t.source.id}:t.source;if(t.selector&&!Array.isArray(t.selector)&&typeof t.selector!="string"&&t.selector.type==="FragmentSelector"){let s=`${t.source.id}#${t.selector.value}`;return n?s:{id:s,type:t.source.type}}}return a(t)}function ns(t){if(!t)return;let e=Object.keys(t);if(e.length!==0){if(e.length===1){let n=e[0];if(!n)return"";let i=(t[n]||[]).join("");return n==="@none"||n==="none"||n==="en"?i:{"@language":n,"@value":i}}return e.map(n=>({"@language":n,"@value":(t[n]||[]).join("")}))}}function I2(t){return Array.isArray(t)?t.map(e=>I2(e)):typeof t=="string"?t:t.type&&t.type==="Canvas"?t.id:t}function Lr(t,e=!1){if(t)return t.length>1&&!e?t:t[0]||void 0}function R6(t){if(t){if(typeof t=="string")return{"@id":t};if("@id"in t){let e={...t};return delete e["@type"],e}return{"@context":"http://iiif.io/api/image/2/context.json","@id":t.id,profile:`http://iiif.io/api/image/2/profiles/${t.profile}.json`}}}function $l(t,e){return[["@id",t.id],["@type",e],["format",t.format],["height",t.height],["width",t.width],["viewingDirection",t.viewingDirection==="left-to-right"?void 0:t.viewingDirection],["license",t.license?t.license:void 0]]}function*ts(t){let e=t.provider?yield t.provider[0]:void 0;return[["label",ns(t.label)],["metadata",t.metadata&&t.metadata.length?t.metadata.map(n=>({label:ns(n.label)||"",value:ns(n.value)||""})):void 0],["description",ns(t.summary)],["thumbnail",Lr(yield t.thumbnail)],["navDate",t.navDate],["logo",e?Lr(e.logo):void 0],["homepage",e?e.homepage:void 0],["attribution",t.requiredStatement?ns(t.requiredStatement.value):void 0]]}function*Yf(t){let e=t.start&&t.start.type&&t.start.type==="SpecificResource"?zu(t.start):t.start;return[["seeAlso",Lr(yield t.seeAlso)],["service",Lr((t.service||[]).map(R6))],["rendering",Lr(yield t.rendering)],["startCanvas",e?e.id:void 0]]}function A6(t){return t.type==="SpecificResource"}function T6(t){return t&&t.type==="FragmentSelector"}function C6(t){if(t&&A6(t)){let e=t.id,n=t.selector?Array.isArray(t.selector)?t.selector[0]:t.selector:void 0;return T6(n)&&(e+="#"+n.value),e}return t?.id}var U1={Manifest:function*(t,e,{isTopLevel:n}){return[...n?[["@context","http://iiif.io/api/presentation/2/context.json"]]:[],...$l(t,"sc:Manifest"),...yield*ts(t),...yield*Yf(t),["sequences",[{"@id":`${t.id}/sequence0`,"@type":"sc:Sequence",canvases:yield t.items}]],["structures",yield t.structures]]},Canvas:function*(t){let e=yield t.items,n=e[0];return[...$l(t,"sc:Canvas"),...yield*ts(t),...yield*Yf(t),["images",n?[n.resources]:void 0],["annotations",t.annotations&&t.annotations.length?Lr(yield t.annotations):void 0]]},AnnotationPage:function*(t){return[...$l(t,"sc:AnnotationList"),...yield*ts(t),["resources",t.items&&t.items.length?Lr(yield t.items):void 0]]},Annotation:function*(t){return[["@id",t.id],["@type","oa:Annotation"],["motivation","sc:painting"],["on",I2(t.target)],["resource",Lr(yield t.body,!0)]]},ContentResource:function*(t){switch(t.type){case"Image":return[...$l(t,"dctypes:Image"),...yield*ts(t),...yield*Yf(t)];case"Text":case"Dataset":default:return[...$l(t,void 0),...yield*ts(t)]}},AnnotationCollection:function*(t){return[["@id",t.id],["@type","sc:Layer"],["label",ns(t.label)]]},Collection:function*(t){return[...$l(t,"sc:Collection"),...yield*ts(t),...yield*Yf(t),["members",yield*t.items]]},Range:function*(t){let e=[],n=[];if(t.items)for(let i of t.items){let a=i.type==="SpecificResource"?i.source:i;if(a){let o=yield a;e.push({"@id":C6(i),"@type":a.type,label:o?o.label:void 0,within:t.id}),a.type==="Canvas"&&n.push(a.id)}}return[...$l(t,"sc:Range"),...yield*ts(t),...yield*Yf(t),["canvases",n.length===e.length?n:void 0],["members",n.length===e.length?void 0:e]]}};function es(t){return[["id",t.id?.startsWith("vault://")?void 0:t.id],["type",t.type],["format",t.format],["profile",t.profile],["height",t.height||void 0],["width",t.width||void 0],["duration",t.duration||void 0],["viewingDirection",t.viewingDirection==="left-to-right"?void 0:t.viewingDirection],["behavior",t.behavior&&t.behavior.length?t.behavior:void 0],["timeMode",t.timeMode],["motivation",Array.isArray(t.motivation)?t.motivation[0]:t.motivation],[Ke,ba]]}function dn(t){if(t===ba||!t||t.length===0)return;let e=t.filter(n=>n!==ba);if(e.length!==0)return e}function D2(t){if(t&&t.type&&t.type==="ImageService2"){let{id:e,type:n,profile:i,...a}=t,o=typeof i=="string"?i:Array.isArray(i)?i.find(s=>typeof s=="string"):"";return{"@id":e,"@type":n,profile:o?o.startsWith("http")?o:`http://iiif.io/api/image/2/${o}.json`:"http://iiif.io/api/image/2/level0.json",...a}}return t}function v2(t){if(Array.isArray(t)||(t=t?[t]:[]),!(!t||t.length===0))return t.map(D2)}function*Ir(t){return[["label",t.label],["metadata",dn(t.metadata)],["summary",t.summary],["requiredStatement",t.requiredStatement],["rights",Array.isArray(t.rights)?t.rights[0]||void 0:t.rights||void 0],["navDate",t.navDate],["language",t.language],["thumbnail",dn(yield t.thumbnail)],["placeholderCanvas",yield t.placeholderCanvas],["accompanyingCanvas",yield t.accompanyingCanvas],["provider",dn(yield t.provider)]]}function*Dr(t,e){let n=[];for(let i of t.partOf||[])i.type==="Manifest"&&e.type==="Manifest"||n.push(yield i);return[["seeAlso",dn(yield t.seeAlso)],["service",dn(v2(t.service))],["services",dn(v2(t.services))],["rendering",dn(yield t.rendering)],["supplementary",dn(yield t.supplementary)],["homepage",dn(yield t.homepage)],["logo",dn(yield t.logo)],["partOf",dn(n)],["start",t.start?zu(t.start):t.start]]}var V1={Manifest:function*(t,e,{isTopLevel:n}){if(!n)return[...es(t),...yield*Ir(t),["navPlace",t.navPlace]];let i="http://iiif.io/api/presentation/3/context.json";return(t.navPlace||S2(t))&&(i=["http://iiif.io/api/presentation/3/context.json","http://iiif.io/api/extension/navplace/context.json"]),[["@context",t["@context"]?t["@context"]:i],...es(t),...yield*Ir(t),...yield*Dr(t),["items",yield t.items],["structures",dn(yield t.structures)],["annotations",dn(yield t.annotations)],["navPlace",t.navPlace]]},Canvas:function*(t,e,{parent:n}){return n&&n.type!=="Manifest"&&n.type!=="Canvas"?[["id",t.id]]:[...es(t),...yield*Ir(t),...yield*Dr(t,n),["items",yield t.items],["annotations",dn(yield t.annotations)],["navPlace",t.navPlace]]},Agent:function*(t){return[["id",t.id],["type","Agent"],["label",t.label],...yield*Dr(t)]},AnnotationPage:function*(t){let e=Object.entries(t).map(([i,a])=>[i,Array.isArray(a)?dn(a):a]).filter(([i,a])=>i!=="items"&&i!=="id"&&i!==Ke&&i!==Yi&&i!==_u),n=yield t.items;return[["id",t.id?.startsWith("vault://")?void 0:t.id],...e,...yield*Dr(t),["items",n.length||t[_u]===!1?n:ba]]},Service:function*(t){return[[L1,D2(t)]]},Annotation:function*(t){let e=Object.entries(t).map(([i,a])=>i==="motivation"?[i,Array.isArray(a)?a[0]:a]:i==="target"?[i,zu(a,{allowString:!0,allowSourceString:!0,allowedStringType:"Canvas"})]:[i,Array.isArray(a)?dn(a):a]).filter(([i])=>i!=="body"&&i!==Ke&&i!==_u),n;if(Array.isArray(t.body)){let i=[];for(let a of t.body)if(a&&ki(a)){let o={...a};a.source.type==="Canvas"?o.source=a.source:o.source=yield a.source,i.push(zu(o,{allowSourceString:!0}))}else i.push(yield a);n=i}else t.body&&ki(t.body)?(n={...t.body},n.source=yield t.body.source):n=yield t.body;return[...e,...yield*Ir(t),...yield*Dr(t),["body",n.length===1?n[0]:n]]},ContentResource:function*(t){return w6([...es(t),...yield*Ir(t),...yield*Dr(t),["annotations",dn(yield t.annotations)],["items",dn(yield t.items)]],t)},AnnotationCollection:function*(t){return[["id",t.id],["type","AnnotationCollection"],["label",t.label]]},Collection:function*(t,e,{isTopLevel:n}){if(n){let i="http://iiif.io/api/presentation/3/context.json";return(t.navPlace||S2(t))&&(i=["http://iiif.io/api/extension/navplace/context.json","http://iiif.io/api/presentation/3/context.json"]),[["@context",i],...es(t),...yield*Ir(t),...yield*Dr(t),["items",dn(yield t.items)],["navPlace",t.navPlace]]}return[...es(t),...yield*Ir(t),["navPlace",t.navPlace]]},Range:function*(t){let e=[];for(let n of t.items)n.type==="Range"?e.push(yield n):n&&n.type==="SpecificResource"?e.push(zu(n)):e.push(n);return[...es(t),...yield*Ir(t),...yield*Dr(t),["items",e],["annotations",dn(yield t.annotations)],["navPlace",t.navPlace]]}};function w6(t,e){let n=Object.keys(e),i=t.map(([a])=>a);for(let a of n)a===Ke||a===_u||i.indexOf(a)===-1&&e[a]!==void 0&&t.push([a,e[a]]);return t}function S2(t){if(!t.items||!Array.isArray(t.items))return!1;for(let e of t.items)if(e.navPlace)return!0;return!1}function L2(t,e){return ki(t)?typeof t.source=="string"?{...t,source:e}:{...t,source:{...t.source||{},id:e}}:{...t,id:e}}var Te=function(t){return function(){let e={type:t,getType:()=>t,toString:()=>t};return(n,i)=>({...e,...n!==void 0&&{payload:n},...i!==void 0&&{meta:i}})}},vm="@iiif/IMPORT_ENTITIES",Sm="@iiif/MODIFY_ENTITY_FIELD",bm="@iiif/REORDER_ENTITY_FIELD",xm="@iiif/MOVE_ENTITY",Qf="@iiif/MOVE_ENTITIES",Em="@iiif/ADD_REFERENCE",Xf="@iiif/UPDATE_REFERENCE",Rm="@iiif/CHANGE_REFERENCE_IDENTIFIER",Am="@iiif/REMOVE_REFERENCE",Tm="@iiif/ADD_METADATA",Cm="@iiif/REMOVE_METADATA",Kf="@iiif/UPDATE_METADATA",wm="@iiif/REORDER_METADATA",Mm=Te(vm)(),B2=Te(Sm)(),P2=Te(bm)(),H2=Te(xm)(),U2=Te(Qf)(),V2=Te(Em)(),j2=Te(Am)(),q2=Te(Xf)(),F2=Te(Rm)(),G2=Te(Tm)(),k2=Te(Kf)(),Y2=Te(Cm)(),Q2=Te(wm)(),is={importEntities:Mm,modifyEntityField:B2,reorderEntityField:P2,addReference:V2,removeReference:j2,updateReference:q2,changeReferenceIdentifier:F2,addMetadata:G2,removeMetadata:Y2,updateMetadata:k2,reorderMetadata:Q2,moveEntity:H2,moveEntities:U2},Om="@iiif/ADD_MAPPING",_m="@iiif/ADD_MAPPINGS",j1=Te(Om)(),q1=Te(_m)();var Du="RESOURCE_ERROR",Zf="RESOURCE_LOADING",Lu="RESOURCE_READY",zm="@iiif/REQUEST_RESOURCE",Nm="@iiif/REQUEST_ERROR",Im="@iiif/REQUEST_MISMATCH",Dm="@iiif/REQUEST_COMPLETE",Lm="@iiif/REQUEST_OFFLINE_RESOURCE",F1=Te(zm)(),Jf=Te(Nm)(),G1=Te(Im)(),k1=Te(Dm)(),M6=Te(Lm)();var Bu="@iiif/BATCH",Bm="@iiif/BATCH_IMPORT",Pu=Te(Bu)(),O6=Te(Bm)();var Y1="@iiif/SET_META_VALUE",Q1="@iiif/SET_META_VALUE_DYNAMIC",X1="@iiif/UNSET_META_VALUE",_6=Te(Y1)(),z6=Te(Q1)(),N6=Te(X1)(),K1={setMetaValue:_6,setMetaValueDynamic:z6,unsetMetaValue:N6};var I6=(t,e)=>{let{entities:n,resource:i,mapping:a}=P1(e);if(i.id===void 0)return[Jf({id:t,message:"ID is not defined in resource."})];let o=[Mm({entities:n}),q1({mapping:a})];return i.id!==t&&(o.push(j1({id:t,type:i.type})),o.push(G1({requestId:t,actualId:i.id}))),o.push(k1({id:t})),o},X2=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function D6(t,e){return!!(t===e||X2(t)&&X2(e))}function J1(t,e){if(!Array.isArray(t)||!Array.isArray(e))return t===e;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!D6(t[n],e[n]))return!1;return!0}function Z1(t,e,n){let i=t.iiif.requests[e],a=t.iiif.mapping[e];if(!a||!t.iiif.entities[a][i.resourceUri])return;let o=t.iiif.entities[a][i.resourceUri];if(o&&o[Ke]){let s=o[Ke].find(u=>n?u[Yi]===n.id:u[Yi]===o.id);return Iu(o,s)}return o}function L6(t){return t&&typeof t.then=="function"}function W1(t,e,{waitTimeout:n=30}={}){return(i,a,o)=>{let s=t.getStore(),u=s.getState(),d=u.iiif.requests[i];if(d){if(d.loadingState===Lu){let f=Z1(u,i);if(f)return f}switch(d.loadingState){case Du:break;case Zf:return(async()=>{let f,m=!1;try{let g=await Promise.race([new Promise((v,S)=>{m||(f=s.subscribe(()=>{let R=s.getState();if(R.iiif.requests[i].loadingState===Du){S();return}if(R.iiif.requests[i].loadingState===Lu){let T=Z1(R,i);T?v(T):S()}}))}),new Promise((v,S)=>setTimeout(()=>{m=!0,S()},n*60*1e3))]);if(f&&f(),g)return g}catch{f&&f()}})()}}t.dispatch(F1({id:i}));let p=f=>{if(!f)return;!f.id&&!f["@id"]&&(f["@type"]&&(f["@id"]=i),f.id=i);let m=I6(i,f);return t.dispatch(Pu({actions:m})),Z1(s.getState(),i)};try{let f=e(i,a);return L6(f)?(async()=>{try{let m=await f;return o&&(m=o(m)),p(m)}catch(m){throw t.dispatch(Jf({id:i,message:m.toString()})),m}})():p(o?o(f):f)}catch(f){throw t.dispatch(Jf({id:i,message:f.toString()})),f}}}function $1(){return{Collection:{},Manifest:{},Canvas:{},AnnotationPage:{},AnnotationCollection:{},Annotation:{},ContentResource:{},Range:{},Service:{},Selector:{},Agent:{}}}var Hu={},B6=(t,e)=>(n,i,a)=>(a.dispatch=o=>(n(s=>t(s,o),!1,o),o),a.dispatchFromDevtools=!0,{dispatch:(...o)=>a.dispatch(...o),...e}),P6=B6,eb=new Map,Pm=t=>{let e=eb.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,i])=>[n,i.getState()])):{}},H6=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};let i=eb.get(n.name);if(i)return{type:"tracked",store:t,...i};let a={connection:e.connect(n),stores:{}};return eb.set(n.name,a),{type:"tracked",store:t,...a}},U6=(t,e={})=>(n,i,a)=>{let{enabled:o,anonymousActionType:s,store:u,...d}=e,p;try{p=(o??(Hu.env?Hu.env.MODE:void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!p)return(Hu.env?Hu.env.MODE:void 0)!=="production"&&o&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,i,a);let{connection:f,...m}=H6(u,p,d),g=!0;a.setState=(R,T,E)=>{let x=n(R,T);if(!g)return x;let A=E===void 0?{type:s||"anonymous"}:typeof E=="string"?{type:E}:E;return u===void 0?(f?.send(A,i()),x):(f?.send({...A,type:`${u}/${A.type}`},{...Pm(d.name),[u]:a.getState()}),x)};let v=(...R)=>{let T=g;g=!1,n(...R),g=T},S=t(a.setState,i,a);if(m.type==="untracked"?f?.init(S):(m.stores[m.store]=a,f?.init(Object.fromEntries(Object.entries(m.stores).map(([R,T])=>[R,R===m.store?S:T.getState()])))),a.dispatchFromDevtools&&typeof a.dispatch=="function"){let R=!1,T=a.dispatch;a.dispatch=(...E)=>{(Hu.env?Hu.env.MODE:void 0)!=="production"&&E[0].type==="__setState"&&!R&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),R=!0),T(...E)}}return f.subscribe(R=>{var T;switch(R.type){case"ACTION":if(typeof R.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return tb(R.payload,E=>{if(E.type==="__setState"){if(u===void 0){v(E.state);return}Object.keys(E.state).length!==1&&console.error(`
12
21
  [zustand devtools middleware] Unsupported __setState action format.
13
22
  When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
14
23
  and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
15
- `);let b=R.state[u];if(b==null)return;JSON.stringify(r.getState())!==JSON.stringify(b)&&w(b);return}r.dispatchFromDevtools&&typeof r.dispatch=="function"&&r.dispatch(R)});case"DISPATCH":switch(S.payload.type){case"RESET":return w(v),u===void 0?c?.init(r.getState()):c?.init(Ec(f.name));case"COMMIT":if(u===void 0){c?.init(r.getState());return}return c?.init(Ec(f.name));case"ROLLBACK":return Zp(S.state,R=>{if(u===void 0){w(R),c?.init(r.getState());return}w(R[u]),c?.init(Ec(f.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return Zp(S.state,R=>{if(u===void 0){w(R);return}JSON.stringify(r.getState())!==JSON.stringify(R[u])&&w(R[u])});case"IMPORT_STATE":{let{nextLiftedState:R}=S.payload,b=(E=R.computedStates.slice(-1)[0])?.state;if(!b)return;w(u===void 0?b:b[u]),c?.send(null,R);return}case"PAUSE_RECORDING":return y=!y}return}}),v},EP=RP,Zp=(e,t)=>{let n;try{n=JSON.parse(e)}catch(i){console.error("[zustand devtools middleware] Could not parse the received json",i)}n!==void 0&&t(n)},IP=e=>(t,n,i)=>{let r=i.subscribe;return i.subscribe=(l,u,f)=>{let p=l;if(u){let c=f?.equalityFn||Object.is,m=l(i.getState());p=y=>{let w=l(y);if(!c(m,w)){let v=m;u(m=w,v)}},f?.fireImmediately&&u(m,m)}return r(p)},e(t,n,i)},CP=IP,PP=(e={},t)=>{switch(t.type){case dc:return{...e,[t.payload.id]:t.payload.type};case fc:return{...e,...t.payload.mapping};default:return e}};function Ha(e,t,n,i){return!(!e[n]||!e[n][t]||!e[n][t][i]||!Array.isArray(e[n][t][i]))}function AP(e,t){let n={},i=[];for(let[r,s]of Object.entries(e||{})){i.push(r);let l=(t||{})[r];if(!l||l.length===0){n[r]=s;continue}n[r]=l}for(let[r,s]of Object.entries(t||{}))i.indexOf(r)===-1&&(n[r]=s);return n}function be(e){return e.payload||{}}function TP(e,t,n){if(!e[t]||!Array.isArray(e[t]))return null;let i=n.index===void 0?e[t].findIndex(r=>r?ja(r)?.id===n.id:!1):n.index;return i===-1?null:{entity:e[t][i],index:i}}function CS(e,t){if(!(!t?.id||!t?.type))return e[t.type]?.[t.id]}function Jp(e,t){return e===void 0?t:e}var PS=(e=Xp(),t)=>{let n=(i,r)=>({...e,[be(t).type]:{...e[be(t).type],[be(t).id]:{...i,...r}}});switch(t.type){case nc:{if(!e[be(t).type]||!e[be(t).type][be(t).id])return e;let i=e[be(t).type][be(t).id];return typeof i=="string"?e:n(i,{[be(t).key]:be(t).value})}case ic:{if(!Ha(e,be(t).id,be(t).type,be(t).key))return e;let i=e[be(t).type][be(t).id];if(typeof i=="string")return e;let r=Array.from(i[be(t).key]),[s]=r.splice(be(t).startIndex,1);return r.splice(be(t).endIndex,0,s),n(i,{[be(t).key]:r})}case ka:{let i=be(t).subjects,r=be(t).from,s=be(t).to||r,l=CS(e,r),u=s?.key||r.key;if(!Ha(e,r.id,r.type,r.key)||!Ha(e,s.id,s.type,s.key))return e;let f=[],p=[];if(i.type==="slice"){let R=i.startIndex,b=i.length;f=Array.from(l[r.key]),p=f.splice(R,b)}else{let R=Array.from(l[r.key]);for(let b of i.items){let I=TP(l,r.key,b);I&&(p.push(I.entity),R[I.index]=null),f=R.filter(M=>M!==null)}}let c={...l,[r.key]:f},m={...e,[r.type]:{...e[r.type],[r.id]:c}},y=CS(m,s);if(!y)return e;let w=s?.index===void 0?y[u].length:s.index,v=Array.from(y[s.key]);v.splice(w,0,...p);let S={...y,[u]:v};return{...m,[s.type]:{...m[s.type],[s.id]:S}}}case rc:return PS(e,{type:ka,payload:{subjects:{type:"list",items:[be(t).subject]},from:be(t).from,to:be(t).to}});case tc:{let i=Object.keys(be(t).entities),r={...e};for(let s of i){let l=be(t).entities[s],u={...e[s]||{}},f=!1,p=Object.keys(l||{})||[];if(l&&p){for(let c of p)f=!0,u[c]=e[s][c]?AP(e[s][c],l[c]):l[c];f&&(r[s]=u)}}return r}case oc:{if(!Ha(e,be(t).id,be(t).type,be(t).key))return e;let i=e[be(t).type][be(t).id],r=Array.from(i[be(t).key]);return r.splice(Jp(be(t).index,r.length+1),0,be(t).reference),n(i,{[be(t).key]:r})}case La:case sc:{if(!Ha(e,be(t).id,be(t).type,be(t).key))return e;let i=e[be(t).type][be(t).id],r=Array.from(i[be(t).key]),s=Jp(be(t).index,r.findIndex(l=>l&&l.id===be(t).reference.id));return s===-1||r[s]?.id!==be(t).reference.id?e:(t.type===La?r.splice(s,1,be(t).reference):r.splice(s,1),n(i,{[be(t).key]:r}))}case ac:{let i=e[be(t).type][be(t).id];if(!i)return e;let r=Array.from(i.metadata||[]),s=be(t);return r.splice(Jp(t.payload.beforeIndex,r.length+1),0,{label:s.label,value:s.label}),n(i,{metadata:r})}case uc:{let i=e[be(t).type][be(t).id];if(typeof i=="string"||!i)return e;let r=Array.from(i.metadata||[]),[s]=r.splice(be(t).startIndex,1);return r.splice(be(t).endIndex,0,s),n(i,{metadata:r})}case Fa:case lc:{let i=e[be(t).type][be(t).id],r=Array.from(i.metadata||[]),s=be(t).atIndex;return s===void 0||s===-1||!r[s]?e:(t.type===Fa?r.splice(s,1,{label:be(t).label,value:be(t).value}):r.splice(s,1),n(i,{metadata:r}))}default:return e}},MP=(e={},t)=>{switch(t.type){case hc:case yc:return{...e,[t.payload.id]:{requestUri:t.payload.id,loadingState:Na,uriMismatch:!1,resourceUri:t.payload.id}};case mc:return{...e,[t.payload.requestId]:{...e[t.payload.requestId]||{},uriMismatch:!0,resourceUri:t.payload.actualId},[t.payload.actualId]:{requestUri:t.payload.requestId,loadingState:e[t.payload.requestId].loadingState,uriMismatch:!0,resourceUri:t.payload.actualId}};case pc:return{...e,[t.payload.id]:{...e[t.payload.id]||{},loadingState:ps,error:t.payload.message}};case gc:return{...e,[t.payload.id]:{...e[t.payload.id]||{},loadingState:ms,error:void 0}}}return e},_P=(e={},t)=>{let{id:n,updateValue:i,value:r,meta:s,key:l}=t&&t.payload||{};switch(t.type){case Xh:return{...e,[n]:{...e[n]||{},[s]:{...e[n]&&e[n][s]||{},[l]:r}}};case Zh:return{...e,[n]:{...e[n]||{},[s]:{...e[n]&&e[n][s]||{},[l]:e[n]&&e[n][s]?i(e[n][s][l]):i(void 0)}}};case Jh:return e[n]&&e[n][s]&&e[n][s][l]?{...e,[n]:{...e[n]||{},[s]:{...e[n]&&e[n][s]||{},[l]:void 0}}}:e;default:return e}};function AS(e={}){let t=Object.keys(e);return function(n={},i){let r=!1,s={};for(let l=0;l<t.length;l++){let u=t[l];s[u]=e[u](n[u],i),r||(r=s[u]!==n[u])}return r?s:n}}function OP(e){return(t,n)=>n&&n.type===gs?n.payload.actions.reduce(e,t):n&&n.type===vc?{...t,iiif:{...t.iiif,...n.payload.state}}:e(t,n)}var kP=AS({mapping:PP,entities:PS,requests:MP,meta:_P});function LP(){return{iiif:{entities:Xp(),meta:{},mapping:{},requests:{}}}}function TS(e={}){let{enableDevtools:t=!1,iiifStoreName:n="iiif",defaultState:i=LP(),customReducers:r={}}=e,s=OP(AS({[n]:kP,...r})),l=!!(typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__);return Ju(CP((l?EP:(f,p)=>f)(wP(s,i),{enabled:t})))}function fn(e,t,n,i=!0){t[Is]=t[Is]||[],t[Is].push(e);let r=new Map;Object.defineProperty(t,e,{enumerable:i,get(){if(t[So][e]===void 0)return;let s=t[So][e];if(!s)return s;let l=n.get(t[So][e],{parent:this.id?{id:this.id,type:this.type}:void 0});return r.has(l)||(r.clear(),r.set(l,wo(l,n))),r.get(l)},set(s){t[So][e]!==s&&(this[xo]?n.modifyEntityField({id:this.id,type:this.type},e,OS(s)):this[So][e]=s)}})}var So=Symbol.for("_refs_"),xo=Symbol.for("_reactive_"),Is=Symbol.for("_defined_"),MS=Symbol.for("_parent_");function FP(e,t=!1,n){let i={id:"",type:"unknown",[Is]:[],[So]:{},[MS]:n||null,[xo]:null,is(r){return typeof r=="string"?this.id===r:r.id?r.id===this.id:!1},reactive(){if(!this[xo])return this[xo]=this.subscribe(()=>this.refresh(),!0),()=>{this.unreactive()}},refresh(){if(this.id){let r=this.unwrap();for(let s of Object.keys(r||{}))this[Is].includes(s)?this[So][s]=r[s]:this[s]=r[s]}},unreactive(){this[xo]&&(this[xo](),this[xo]=null)},unwrap(){if(!this.id)throw Error("Invalid object");let r=this[MS];return e.get(this.id,{parent:r?{id:r,type:"unknown"}:void 0})},toPresentation3(){return e.toPresentation3(this.unwrap())},toPresentation2(){return e.toPresentation2(this.unwrap())},valueOf(){return this.unwrap()},toJSON(){let r=this;return{...r,items:r.items,annotations:r.annotations,structures:r.structures,seeAlso:r.seeAlso,service:r.service,services:r.services,rendering:r.rendering,partOf:r.partOf,start:r.start,supplementary:r.supplementary,homepage:r.homepage,thumbnail:r.thumbnail,placeholderCanvas:r.placeholderCanvas,accompanyingCanvas:r.accompanyingCanvas,provider:r.provider}},subscribe(r,s=!0){return e.subscribe(()=>this.id?e.get(this.id):null,r,s)}};return fn("items",i,e),fn("annotations",i,e),fn("structures",i,e),fn("seeAlso",i,e),fn("rendering",i,e),fn("partOf",i,e),fn("start",i,e,!1),fn("supplementary",i,e),fn("homepage",i,e),fn("thumbnail",i,e),fn("placeholderCanvas",i,e,!1),fn("accompanyingCanvas",i,e,!1),fn("provider",i,e),fn("body",i,e),fn("logo",i,e),i}function NP(e){return!!e[Is]}function OS(e){return Array.isArray(e)?e.map(t=>OS(t)):!e||!e.type?e:{id:e.id,type:e.type}}function wo(e,t,n=!1,i){if(Array.isArray(e))return e.map(u=>wo(u,t,n));if(!e||!e.type||!e.id)return e;let r=FP(t,n),s=Object.create(r),l=Object.assign(s,e);return n&&l.reactive(),l}function _S(e){switch(e){case"Image":case"Video":case"Sound":case"Dataset":case"Text":case"Composite":case"List":case"Independents":case"Audience":return"ContentResource";case"ImageService1":case"ImageService2":case"ImageService3":return"Service"}return e}var Cs=class{constructor(e,t){Bt(this,"options",void 0),Bt(this,"store",void 0),Bt(this,"emitter",void 0),Bt(this,"isBatching",!1),Bt(this,"batchQueue",[]),Bt(this,"remoteFetcher",void 0),Bt(this,"staticFetcher",void 0),Bt(this,"defaultFetcher",n=>fetch(n).then(i=>{if(i.status===200)return i.json();{let r=Error(`${i.status} ${i.statusText}`);throw r.name="HTTPError",r}})),this.options=Object.assign({reducers:{},customFetcher:this.defaultFetcher,enableDevtools:!0},e||{}),this.store=t||TS({customReducers:this.options.reducers,defaultState:this.options.defaultState,enableDevtools:this.options.enableDevtools}),this.emitter=ec(),this.remoteFetcher=Kp(this,this.options.customFetcher),this.staticFetcher=Kp(this,(n,i)=>i)}batch(e){this.isBatching=!0;try{e(this),this.isBatching=!1,this.dispatch(ys({actions:this.batchQueue}))}catch(t){throw this.batchQueue=[],this.isBatching=!1,t}this.batchQueue=[]}async asyncBatch(e){this.isBatching=!0;try{await e(this),this.isBatching=!1,this.dispatch(ys({actions:this.batchQueue}))}catch(t){throw this.batchQueue=[],this.isBatching=!1,t}this.batchQueue=[]}modifyEntityField(e,t,n){this.dispatch(ho.modifyEntityField({id:e.id,type:e.type,key:t,value:n}))}dispatch(e){if(this.isBatching)this.batchQueue.push(e);else{if(e.type===gs){for(let i of e.payload.actions)this.emitter.emit(i.type,{action:i,state:this.store.getState()});this.store.dispatch(e);let n=this.getState();for(let i of e.payload.actions)this.emitter.emit(`after:${i.type}`,{action:i,state:n});return}this.emitter.emit(e.type,{action:e,state:this.store.getState()}),this.store.dispatch(e);let t=this.store.getState();this.emitter.emit(`after:${e.type}`,{action:e,state:t});return}}on(e,t){return this.emitter.on(e,t),()=>{this.emitter.off(e,t)}}serialize(e,t){return qp(this.getState().iiif,e,t)}toPresentation2(e){return this.serialize(e,Gp)}toPresentation3(e){return this.serialize(e,$p)}hydrate(e,t,n={}){return this.get(e,t,{...n,skipSelfReturn:!1})}get(e,t,n={}){typeof t!="string"&&(n=t||{},t=void 0);let{skipSelfReturn:i=!0}=n||{},r=n.parent?typeof n.parent=="string"?n.parent:n.parent.id:void 0;if(Array.isArray(e))return e.map(c=>this.get(c,n));let s=this.getState();if(xi(e)&&!n.preserveSpecificResources&&(e=e.source),typeof e=="string"){let c=_S(t||s.iiif.mapping[e]);if(!c)return i?null:{id:e,type:"unknown"};e={id:e,type:c}}if(e&&e.partOf&&!r&&!n.skipPartOfCheck){let c=Array.isArray(e.partOf)?e.partOf[0]:e.partOf;c&&(typeof c=="string"&&(r=c),typeof c.id=="string"&&(r=c.id))}let l=_S(t||e?.type),u=e?.id,f=s.iiif.entities[l];if(!f){let c=s.iiif.requests[u];return c&&c.resourceUri!==u?this.get(c.resourceUri,n):i?null:e}let p=f[e.id];if(p&&p[St]){let c=p[St].find(m=>r?m[Nn]===r:m[Nn]===p.id);return Rs(p,c)}return f[e.id]||(i?null:e)}select(e){return e(this.getState())}getStore(){return this.store}getState(){return this.store.getState()}deep(e,t){if(e===void 0)return this.get(t,{skipSelfReturn:!1});if(typeof e=="function")try{let i=e(this.get(t,{skipSelfReturn:!1})),r=s=>this.deep(s,i);return r.size=Array.isArray(i)?i.length:1,r}catch{let i=r=>this.deep(r,void 0);return i.size=0,i}let n=i=>this.deep(i,e);return n.size=Array.isArray(e)?e.length:1,n}loadManifest(e,t,n){let i=typeof e=="string"?e:e.id;return this.load(i,t,n)}loadCollection(e,t,n){let i=typeof e=="string"?e:e.id;return this.load(i,t,n)}load(e,t,n){let i=typeof e=="string"?e:e.id;return t?Promise.resolve(this.staticFetcher(i,t,n)):Promise.resolve(this.remoteFetcher(i,{},n))}loadSync(e,t,n){let i=typeof e=="string"?e:e.id;return this.staticFetcher(i,t,n)}loadManifestSync(e,t,n){let i=typeof e=="string"?e:e.id;return this.loadSync(i,t,n)}loadCollectionSync(e,t,n){let i=typeof e=="string"?e:e.id;return this.loadSync(i,t,n)}areInputsEqual(e,t){return Yp(e,t)}subscribe(e,t,n){return n===void 0&&(t===void 0||t===!1||t===!0)&&(n=t,t=e,e=i=>i),this.store.subscribe(e,i=>t(i,this),{equalityFn:Yp,fireImmediately:!n})}async ensureLoaded(e){let t=typeof e=="string"?e:e.id;this.requestStatus(t)||await this.load(t)}requestStatus(e){return this.select(t=>t.iiif.requests[e])}getPaginationState(e){let t=typeof e=="string"?e:e.id;if(!t)return null;let n=this.getResourceMeta(t,"@vault/pagination");if(n?.state)return n.state;let i=this.get(e);if(i.first){let r={currentPage:null,currentPageIndex:null,isFetching:!1,isFullyLoaded:!1,next:i.first,page:1,pages:[],previous:null,totalItems:i.total,currentLength:0};return this.setMetaValue([t,"@vault/pagination","state"],r),r}return null}async loadNextPage(e,t){let n=typeof e=="string"?e:e.id;if(!n)return[null,null];let i=this.getPaginationState(e);if(!i||i.isFullyLoaded||!i.next)return[null,null];if(i.isFetching)return[i,null];let r=typeof i.next=="string"?i.next:i.next.id,s=i.currentPage,l={...i,isFetching:!0};this.setMetaValue([n,"@vault/pagination","state"],l);let u;try{u=await this.loadCollection(r,t,y=>{let{id:w,"@id":v,...S}=y||{};return v?{"@id":r,...S}:{id:r,...S}})}catch(y){let w={...i,isFetching:!1,error:y};return this.setMetaValue([n,"@vault/pagination","state"],w),[w,null]}if(!u){let y={...i,isFetching:!1,error:Error("Collection not found")};return this.setMetaValue([n,"@vault/pagination","state"],y),[y,null]}let f=this.get(n),p=[...f.items||[],...u.items||[]].map(y=>({id:y.id,type:y.type}));this.modifyEntityField({id:n,type:"Collection"},"items",p);let c=this.getPaginationState(e);if(!c)throw Error("Pagination state not found");let m={...c,isFetching:!1,error:null,currentPage:u.id,next:u.next?.id||null,currentPageIndex:c.pages.length,currentLength:p.length,pages:[...c.pages,{id:u.id,type:"Collection",startIndex:f.items.length,pageLength:u.items.length,order:typeof c.currentPageIndex=="number"?c.currentPageIndex+1:0}],isFullyLoaded:!u.next,previous:s,page:c.pages.length+1};return this.setMetaValue([n,"@vault/pagination","state"],m),[m,u]}getResourceMeta(e,t){let n=this.getState().iiif.meta[e];if(n)return t?n[t]:n}getObject(e,t,n={}){let{reactive:i,...r}=n;return wo(this.get(e,t,r),this,i)}async loadObject(e,t){return wo(await this.load(e,t),this)}async loadManifestObject(e,t){return wo(await this.loadManifest(e,t),this)}async loadCollectionObject(e,t){return wo(await this.loadCollection(e,t),this)}wrapObject(e){return wo(this.get(e,{skipSelfReturn:!1}),this)}isWrapped(e){return NP(e)}setMetaValue([e,t,n],i){this.dispatch(typeof i=="function"?ep.setMetaValueDynamic({id:e,meta:t,key:n,updateValue:i}):ep.setMetaValue({id:e,meta:t,key:n,value:i}))}};function kS(){return typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}function Wa(e){let t=kS();try{let i=t.IIIF_VAULT;if(i)return i}catch{}let n=new Cs(e);try{t.IIIF_VAULT=n}catch{}return n}var tm=A(D(),1),Ar=Ic.default.createContext({vault:null,setVaultInstance:e=>{}});function bo({vault:e,vaultOptions:t,useGlobal:n,resources:i,children:r}){let[s,l]=(0,Ic.useState)(()=>e||(n?Wa(t):t?new Cs(t):new Cs));return(0,tm.jsx)(Ar.Provider,{value:{vault:s,setVaultInstance:l},children:(0,tm.jsx)(dn,{value:i||{},children:r})})}var FS=A(Q(),1),NS=A(Q(),1);var LS=A(Q(),1),ze=()=>{let{vault:e}=(0,LS.useContext)(Ar);if(e===null)throw new Error("Vault not found. Ensure you have your provider set up correctly.");return e};var Cc=A(Q(),1);function qe(e,t=[]){let n=ze(),[i,r]=(0,Cc.useState)(()=>e(n.getState(),n));return(0,Cc.useEffect)(()=>n.subscribe(s=>e(s,n),s=>{r(s)},!1),t),i}var Ro=NS.default.createContext([]);function Eo(){let e=(0,FS.useContext)(Ro);return qe(t=>e.map(n=>t.iiif.entities.Canvas[n]).filter(Boolean),[e])}var zS=A(Q(),1);function Io(e){let t=(0,zS.useContext)(Ar);return e||(t&&t.vault?t.vault:Wa())}var DS=A(Q(),1);function It(e={},t=[]){let{id:n,selector:i}=e,r=rn(),s=ze(),l=n||r.manifest,u=qe(f=>l?f.iiif.entities.Manifest[l]:void 0,[l]);return(0,DS.useMemo)(()=>{if(u)return i?i(u):u},[u,i,...t])}var f0=A(Q(),1),kc=A(Q(),1);var Tr=A(Q(),1);function Ua(e,{noCache:t=!1}={}){let n=typeof e=="string"?e:e.id,i=Io(),[r,s]=(0,Tr.useState)(n),[l,u]=(0,Tr.useState)(void 0),f=(0,Tr.useMemo)(()=>i.get(n,{skipSelfReturn:!0})||void 0,[n,i]),[p,c]=(0,Tr.useState)(f);return(0,Tr.useEffect)(()=>{(async()=>{try{let m=f&&!t?f:await i.load(n),y=m?m.id||m["@id"]:null;m&&r!==y&&s(y),c(m)}catch(m){u(m)}})()},[n,t]),{isLoaded:!!p,id:r,requestId:n,error:l,resource:p,cached:!!(p&&p===f)}}function nm(e,t){let{id:n,isLoaded:i,error:r,resource:s,requestId:l,cached:u}=Ua(e,t);return{id:n,isLoaded:i,error:r,manifest:s,requestId:l,cached:u}}var BS=A(D(),1);function im({manifest:e,children:t}){return(0,BS.jsx)(dn,{value:{manifest:e},children:t})}var VS=A(D(),1);function rm({range:e,children:t}){return(0,VS.jsx)(dn,{value:{range:e},children:t})}function jS(e,t){for(let n of t.items){if(n.type==="Canvas")return n;if(n.type==="SpecificResource")return n.source;if(n.type==="Range"){let i=jS(e,e.get(n));if(i)return i}}return null}function Pc(e,t){let n=[];for(let i of t.items)if(i.type==="SpecificResource"&&i.source?.type==="Canvas"&&(i.source.id.indexOf("#")!==-1?n.push({id:i.source.id.split("#")[0],type:"Canvas"}):n.push(i.source)),i.type==="Range"&&n.push(...Pc(e,e.get(i))),i.type==="SpecificResource"){let r=typeof i.source=="string"?i.source:i.source.id;n.push({id:r,type:"Canvas"})}return n}function zP(e,t,n){for(let i of t.structures){let r=om(e,e.get(i),n);if(r)return r}return null}function om(e,t,n){for(let i of t.items){let r=i?.source?.id?.split("#")[0];if(i.type==="SpecificResource"&&i.source===n||i.type==="SpecificResource"&&i.source?.type==="Canvas"&&n===r)return t;if(i.type==="Range"){let s=om(e,e.get(i),n);if(s)return s}}return null}function DP(e,t,n,i=!1){let r=t.behavior,s=n?e.get(n):null;if(!s)return[];let l=s.behavior,u=i?!1:r.includes("paged"),f=u?!1:r.includes("continuous"),p=u||f?!1:r.includes("individuals"),c=l.includes("facing-pages"),m=l.includes("non-paged");if(c||m||p||i)return[{id:s.id,type:"Canvas"}];let[y,w]=Ac(e,t);if(f)return y;let v=y.findIndex(S=>S.id===n);if(v===-1)return[];for(let S of w)if(S.includes(v))return S.map(E=>y[E]);return[{id:s.id,type:"Canvas"}]}function Ac(e,t,{disablePaging:n,skipNonPaged:i}={}){let r=t.behavior,s=r.includes("paged"),l=s?!1:r.includes("continuous"),u=s||l?!1:r.includes("individuals"),f=t.type==="Manifest"?t.items:Pc(e,t);if(l)return[f,[f.map((v,S)=>S)]];if(u||!s||n)return[f,f.map((v,S)=>[S])];let p=[],c=[],m=()=>{c.length&&(p.push([...c]),c=[])},y=0,w=!1;for(let v=0;v<f.length;v++){let S=e.get(f[v]);if(S.behavior.includes("non-paged")){v===y&&y++,i||(m(),p.push([v]),m());continue}if(v===y||S.behavior.includes("facing-pages")){c.length&&(w=!0),m(),p.push([v]),m();continue}if(c.push(v),w){m(),w=!1;continue}c.length>1&&m()}return c.length&&m(),[f,p]}var Si=A(Q(),1);var HS=A(Q(),1);function qa(e={},t=[]){let{id:n,selector:i}=e,r=rn(),s=n||r.range,l=qe(u=>s?u.iiif.entities.Range[s]:void 0,[s]);return(0,HS.useMemo)(()=>{if(l)return i?i(l):l},[l,i,...t])}function sm({startCanvas:e,disablePaging:t}){let n=ze(),i=It(),r=qa(),[s,l]=(0,Si.useState)(void 0),u=r||i;if(!u)throw new Error("Nothing selected");let[f,p]=(0,Si.useMemo)(()=>Ac(n,u,{disablePaging:t}),[n,u,t]),c=(0,Si.useRef)(p);if(c.current!==p){let E=c.current[s][0],R=p.findIndex(b=>b.includes(E));c.current=p,l(R)}let m=(0,Si.useCallback)(S=>{let E=p.findIndex(R=>R.includes(S));l(E===-1?0:E)},[f,p]),y=(0,Si.useCallback)(S=>{let E=f.findIndex(R=>R.id===S);E!==-1?m(E):l(0)},[f,p]),w=(0,Si.useCallback)(()=>{l(S=>S>=p.length-1?S:S+1)},[p]),v=(0,Si.useCallback)(()=>{l(S=>S<=0?0:S-1)},[p]);return typeof s>"u"&&(e?y(e):l(0)),{visibleItems:p[s]?.map(S=>f[S].id)||[],cursor:s,items:f,sequence:p,hasPrevious:s>0,hasNext:s<p.length-1,setSequenceIndex:l,setCanvasIndex:m,setCanvasId:y,next:w,previous:v}}var bi=A(Q(),1);var US={},WS=e=>{let t,n=new Set,i=(c,m)=>{let y=typeof c=="function"?c(t):c;if(!Object.is(y,t)){let w=t;t=m??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(v=>v(t,w))}},r=()=>t,f={setState:i,getState:r,getInitialState:()=>p,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{(US.env?US.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},p=t=e(i,r,f);return f},zn=e=>e?WS(e):WS;var t0=A(Q(),1),n0=A(ZS(),1),Mc={},{useDebugValue:nA}=t0.default,{useSyncExternalStoreWithSelector:iA}=n0.default,JS=!1,rA=e=>e;function ve(e,t=rA,n){(Mc.env?Mc.env.MODE:void 0)!=="production"&&n&&!JS&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),JS=!0);let i=iA(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return nA(i),i}var e0=e=>{(Mc.env?Mc.env.MODE:void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");let t=typeof e=="function"?zn(e):e,n=(i,r)=>ve(t,i,r);return Object.assign(n,t),n},i0=e=>e?e0(e):e0;function oA(e){let t=e.service||e.services||[];for(let n of t)if(n.type==="AuthProbeService2")return!0;return!1}function wi(e,t,n){let i=t.findIndex(l=>l.service.id===e);if(i===-1)return t;let r=[...t],s=n(r[i]);return s===r[i]?t:(r[i]=s,r)}var um=()=>zn((e,t)=>({currentAuth:-1,authItems:[],login:()=>{let n=t().authItems[t().currentAuth];if(!n||n.isPending||n.isLoggedIn)return;if(n.type!=="active")throw new Error("Cannot login to non-active service");let i=n.service.service.find(r=>r.type==="AuthAccessTokenService2");if(!i)throw new Error("Token service not found");e(()=>({authItems:wi(n.id,t().authItems,r=>({...r,isPending:!0}))})),lm(n.service).then(()=>{_c(i).then(r=>{let s=r.expiresIn,l=Date.now()+s*1e3;e(()=>({authItems:wi(n.id,t().authItems,u=>({...u,isLoggedIn:!0,isPending:!1,session:{token:r.accessToken,expires:l}}))}))}).catch(r=>{e(()=>({authItems:wi(n.id,t().authItems,s=>({...s,isLoggedIn:!1,isPending:!1,error:r.message}))}))})})},logout:()=>{let n=t().authItems[t().currentAuth];if(!n||n.isPending||!n.isLoggedIn)return;if(n.type!=="active")throw new Error("Cannot logout of non-active service");let i=n.service.service.find(l=>l.type==="AuthLogoutService2");if(!i)return;let r=`${i.id}?origin=${r0()}`,s=window.open(r);e(()=>({authItems:wi(n.id,t().authItems,l=>({...l,isLoggedIn:!1,session:null,isPending:!1}))}))},nextAuth:()=>{let n=t().authItems.length,i=t().currentAuth+1;i>=n||e(()=>({currentAuth:i}))},previousAuth:()=>{let n=t().currentAuth-1;n<0||e(()=>({currentAuth:n}))},setAuth:n=>{n!==-1&&(n<0||n>=t().authItems.length)||e(()=>({currentAuth:n}))},addService:(n,i)=>{if(!n.service)return;let r=n.service.find(u=>u.type==="AuthAccessTokenService2"),s=n;if(t().authItems.find(u=>u.service.id===n.id)){e(()=>({authItems:wi(n.id,t().authItems,u=>({...u,instances:u.instances+1}))}));return}if(e(()=>({currentAuth:s.profile==="active"?0:t().currentAuth,authItems:[{id:n.id,type:n.profile,service:n,probeId:i,canAuthenticate:!0,instances:1,isPending:!1,isLoggedIn:!1,session:null},...t().authItems]})),n.profile==="external"){if(!r)throw new Error("Token service not found");_c(r).then(u=>{e(()=>({authItems:wi(n.id,t().authItems,f=>({...f,isLoggedIn:!0,isPending:!1,session:{token:u.accessToken,expires:u.expiresIn}}))}))}).catch(u=>{e(()=>({authItems:wi(n.id,t().authItems,f=>({...f,isLoggedIn:!1,isPending:!1,canAuthenticate:!1,error:u.message}))}))})}if(n.profile==="kiosk"){if(!r)throw new Error("Token service not found");e(()=>({authItems:wi(n.id,t().authItems,u=>({...u,isPending:!0}))})),lm(s).then(()=>{_c(r).then(u=>{e(()=>({authItems:wi(n.id,t().authItems,f=>({...f,isLoggedIn:!0,isPending:!1,session:{token:u.accessToken,expires:u.expiresIn}}))}))}).catch(u=>{e(()=>({authItems:wi(n.id,t().authItems,f=>({...f,isLoggedIn:!1,isPending:!1,error:u.message}))}))})})}n.profile},removeService:(n,i)=>{let r=t().currentAuth===t().authItems.findIndex(l=>l.service.id===n.id),s=t().currentAuth;if(r){let l=t().authItems.find(f=>f.service.id===n.id);l&&l.instances>1||(s=t().authItems.findIndex(p=>p.service.id!==n.id&&p.instances>0))}e(()=>({authItems:wi(n.id,t().authItems,l=>({...l,instances:l.instances-1})),currentAuth:s}))}})),cm=(e,t)=>zn((n,i)=>({service:e,status:e?"unknown":"success",shouldRedirect:!1,redirectResource:null,shouldSubstitute:!1,substituteResource:null,error:null,errorHeading:null,errorNote:null,shouldDisplayResource:!1,token:t||null,async probe(){if(!i().service)return;let r=i().service?.id;if(!r){n({status:"error",error:"Service ID not found",errorHeading:{en:["Service ID not found"]}});return}n({status:"probing"});let s=i().token;try{let l=await fetch(r,{headers:s?{Authorization:`Bearer ${i().token}`,Accept:"application/json"}:{Accept:"application/json"}}).then(u=>u.json());if(l.status===200)n({status:"success",shouldDisplayResource:!0,error:null,errorHeading:null,errorNote:null,shouldSubstitute:!1,shouldRedirect:!1});else if(l.status<400&&l.status>=300){if(!l.location)throw new Error("Redirect location not found");n({status:"error",shouldDisplayResource:!1,shouldRedirect:!0,redirectResource:l.location||null})}else if(l.status===401)n({status:"error",shouldDisplayResource:!1,shouldRedirect:!1,shouldSubstitute:!!l.substitute,substituteResource:l.substitute||null,error:"Unauthorized",errorHeading:l.heading||{en:["Unauthorized"]},errorNote:l.note||null});else throw new Error("Unknown error")}catch(l){n({status:"error",error:l.message,errorHeading:{en:["Unknown error"]}})}},setToken(r){n({token:r})}}));function dm(e){let t=e.service||e.services||[],n={hasAuth:!1,services:{}};for(let i of t)if(i.type==="AuthProbeService2"){n.services.probe=i,n.hasAuth=!0;let r=i.service.filter(s=>s.type==="AuthAccessService2");r[0]&&(n.services.access=r[0])}return n}async function _c(e,{strict:t=!0}={}){return new Promise((n,i)=>{let r=Math.random().toString(36).substring(7),s=`${e.id}?messageId=${r}&origin=${window.location.origin}`,l=p=>{let c=p.data;if(c.messageId===r){if(t&&c.type!=="AuthAccessToken2"){u(),i("Invalid response, expected type=AuthAccessToken2");return}if(!c.accessToken){u(),i("Invalid response, expected accessToken");return}u(),n(c)}},u=()=>window.removeEventListener("message",l),f=document.createElement("iframe");f.src=s,f.style.display="none",document.body.appendChild(f),window.addEventListener("message",l)})}function r0(e){let t=window.location;if(e){let n=document.createElement("a");return n.href=e,n.protocol+"//"+n.hostname+(n.port?":"+n.port:"")}return t.protocol+"//"+t.hostname+(t.port?":"+t.port:"")}async function lm(e){let t=`${e.id}?origin=${r0()}`,n=window.open(t);if(!n)throw new Error("Failed to open window");return new Promise((i,r)=>{let s=setInterval(()=>{n.closed&&(clearInterval(s),i())},500)})}var As=A(Q(),1);function o0(e){let t=(0,As.useMemo)(()=>dm(e),[e]),n=fm(t.services.access?.id),i=(0,As.useMemo)(()=>cm(t.services.probe,n),[t.services.probe]),r=ve(i);return(0,As.useEffect)(()=>{r.status==="unknown"&&!n&&r.probe()},[t.services.probe,r.status]),(0,As.useEffect)(()=>{n&&(r.setToken(n),r.probe())},[n]),[e,r,t.hasAuth]}var Ga=A(D(),1),Co=(0,bi.createContext)(null),s0=(0,bi.createContext)(null);s0.displayName="CurrentAuth";var a0=(0,bi.createContext)(null);a0.displayName="AuthActions";function pm({children:e}){let t=(0,bi.useMemo)(()=>um(),[]);return(0,Ga.jsx)(Co.Provider,{value:t,children:e})}function mm(){return!!(0,bi.useContext)(Co)}function Ts(){let e=(0,bi.useContext)(Co);if(!e)throw new Error("useAuthActions must be used within a AuthProvider");return e}function l0(){let e=Ts();return ve(e,n=>({login:n.login,logout:n.logout,nextAuth:n.nextAuth,previousAuth:n.previousAuth,setAuth:n.setAuth,addService:n.addService,removeService:n.removeService}))}function sA(){let e=Ts();return ve(e,t=>t)}function u0(e){let t=Ts();return ve(t,i=>i.authItems.find(r=>r.service.id===e))}function fm(e){let t=Ts();return ve(t,i=>i.authItems.find(r=>r.id===e)?.session?.token)}function aA(e){let t=Ts();return ve(t,i=>{let r=i.authItems.find(s=>s.service.id===e);return!r||!r.isLoggedIn||!r.session?null:r.session?.token||null})}function lA(e){let t=l0(),n=u0(e.service.id);return(0,bi.useEffect)(()=>(t?.addService(e.service,e.probeId),()=>{t?.removeService(e.service,e.probeId)}),[e.service]),n?(n.error||!n.isLoggedIn,e.children):null}function hm(){return null}function gm(e){let[t,n,i]=o0(e.resource),r=e.fallbackComponent||hm,s=e.loadingComponent||hm,l=e.errorComponent||hm,u=n.service,f=null;if(!i||!u)return e.children(t);let p=u.service.filter(c=>c.type==="AuthAccessService2");n.status==="error"&&(f=(0,Ga.jsx)(l,{resource:e.resource,error:n.error||"",heading:n.errorHeading,note:n.errorNote,extra:e.extra})),(n.status==="unknown"||n.status==="probing")&&(f=(0,Ga.jsx)(s,{})),n.status==="success"&&(f=e.children(t));for(let c of p)f=(0,Ga.jsx)(lA,{service:c,probeId:u.id,children:f},c.id);return f}var $a=A(Q(),1);var uA=e=>e.id||e["@id"];function cA(e){return(Array.isArray(e.service)?e.service:[e.service]).find(n=>n.profile==="http://iiif.io/api/search/0/autocomplete"||n.profile==="http://iiif.io/api/search/1/autocomplete"||n.profile==="AutoCompleteService1")}var c0=e=>{let t;typeof e=="string"?t={"@context":"http://iiif.io/api/search/1/context.json",profile:"http://iiif.io/api/search/1/search","@id":e,id:e,service:[]}:t=e;let n=t?uA(t):void 0,i=null;return zn((r,s)=>({service:t,resources:[],lastQuery:{},loading:!1,error:!1,highlight:null,hasSearch:!!t,hasAutocomplete:t?!!cA(t):!1,errorMessage:"",search(l,u={}){if(!n)throw new Error("No search service found.");i&&!i.signal.aborted&&i.abort(),i=new AbortController;let f=new URLSearchParams;l.q&&f.set("q",l.q),l.motivation&&f.set("motivation",l.motivation),l.date&&f.set("date",l.date),l.user&&f.set("user",l.user),r({loading:!0}),fetch(`${n}?${f.toString()}`,{signal:i.signal,headers:{"Content-Type":"application/json",Accept:"application/json",...u.headers||{}}}).then(async p=>{if(!i?.signal.aborted)if(p.ok){let c=await p.json();r({resources:c.resources,error:!1,errorMessage:""})}else r({resources:[],error:!0,errorMessage:p.statusText})})},clearSearch(){r({resources:[],error:!1,errorMessage:""})},highlightResult(l){let u=s().resources.find(f=>f["@id"]===l);r({highlight:u})},nextResult(){let l=s().resources,u=s().highlight;if(!u){r({highlight:l[0]||null});return}let f=l.findIndex(p=>p["@id"]===u["@id"]);if(f===-1){r({highlight:l[0]||null});return}r({highlight:l[f+1]||l[0]||null})},previousResult(){let l=s().resources,u=s().highlight;if(!u){r({highlight:l[l.length-1]||null});return}let f=l.findIndex(p=>p["@id"]===u["@id"]);if(f===-1){r({highlight:l[l.length-1]||null});return}if(f===0){r({highlight:l[l.length-1]||null});return}r({highlight:l[f-1]||l[l.length-1]||null})}}))};function ym(){let e=It();return e?e.service.find(t=>t.profile==="SearchService1"||t.profile==="http://iiif.io/api/search/1/search"):void 0}var Oc=A(D(),1),Ms=(0,$a.createContext)(null);Ms.displayName="Search";function d0(e){let t=ym();return e.store?(0,Oc.jsx)(Ms.Provider,{value:e.store,children:e.children}):(0,Oc.jsx)(dA,{service:t,children:e.children})}function dA({service:e,children:t}){let n=(0,$a.useMemo)(()=>c0(e),[e]);return(0,Oc.jsx)(Ms.Provider,{value:n,children:t})}var Pn=A(D(),1),Qa=()=>{},_s=(0,kc.createContext)({setCurrentCanvasId:Qa,setCurrentCanvasIndex:Qa,nextCanvas:Qa,previousCanvas:Qa,items:[],sequence:[],setSequenceIndex:Qa,currentSequenceIndex:0,hasNext:!1,hasPrevious:!1});function h0(e){let t=It(),{cursor:n,visibleItems:i,next:r,sequence:s,items:l,setCanvasIndex:u,setCanvasId:f,previous:p,setSequenceIndex:c,hasNext:m,hasPrevious:y}=sm({startCanvas:e.startCanvas,disablePaging:e.pagingEnabled===!1}),w=(0,kc.useMemo)(()=>({sequence:s,items:l,setCurrentCanvasId:f,nextCanvas:r,previousCanvas:p,totalCanvases:l.length,setCurrentCanvasIndex:u,setSequenceIndex:c,currentSequenceIndex:n,hasNext:m,hasPrevious:y}),[s,l,f,r,p,l,u,c,n]);return t?i.length===0?null:(0,Pn.jsx)(_s.Provider,{value:w,children:(0,Pn.jsx)(Ro.Provider,{value:i,children:(0,Pn.jsx)(ni,{canvas:i[0],children:e.children})})}):(console.warn("The manifest passed to the provider is not a valid IIIF manifest."),(0,Pn.jsx)("div",{children:"Sorry, something went wrong."}))}function vm(e){let t=Io(e.vault),n=nm(e.manifest);if(!n)return console.warn("The manifest passed to the provider is not a valid IIIF manifest."),(0,Pn.jsx)("div",{children:"Sorry, something went wrong."});if(n.error)return(0,Pn.jsx)("div",{children:n.error.toString()});if(!n.isLoaded)return(0,Pn.jsx)("div",{children:"Loading..."});let i=(0,Pn.jsx)(h0,{...e,children:e.children});return(0,Pn.jsx)(bo,{vault:t,children:(0,Pn.jsx)(im,{manifest:n.id,children:(0,Pn.jsx)(pm,{children:(0,Pn.jsx)(d0,{children:e.rangeId?(0,Pn.jsx)(rm,{range:e.rangeId,children:i}):i})})})})}function Po(){return(0,f0.useContext)(_s)}var Mr=(e,t,n)=>{let i=e.length,r=n||me(i);for(let s=0;s<i;s++)r[s]=s%5===0?e[s+1]<t[3]&&e[s+3]>t[1]&&e[s+2]<t[4]&&e[s+4]>t[2]?1:0:e[s];return r};function me(e,t,n){return new Float32Array(e,t,n)}var p0=(e,t,n)=>{let i=e[1]<=t[3]&&e[3]>=t[1]&&e[2]<=t[4]&&e[4]>=t[2],r=n||me(5);return i?(r[0]=1,r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r[3]=Math.min(e[3],t[3]),r[4]=Math.min(e[4],t[4]),r):(r[0]=0,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r)},m0=e=>e.length/5;var An=(e,t,n)=>{let i=n||me(9);return i[0]=e[0]*t[0]+e[1]*t[3]+e[2]*t[6],i[1]=e[0]*t[1]+e[1]*t[4]+e[2]*t[7],i[2]=e[0]*t[2]+e[1]*t[5]+e[2]*t[8],i[3]=e[3]*t[0]+e[4]*t[3]+e[5]*t[6],i[4]=e[3]*t[1]+e[4]*t[4]+e[5]*t[7],i[5]=e[3]*t[2]+e[4]*t[5]+e[5]*t[8],i[6]=e[6]*t[0]+e[7]*t[3]+e[8]*t[6],i[7]=e[6]*t[1]+e[7]*t[4]+e[8]*t[7],i[8]=e[6]*t[2]+e[7]*t[5]+e[8]*t[8],i},Pe=class e{constructor(t){this.index=0,this.length=t,this.points=me(this.length)}static grid(t=1,n=1){return new e(5*t*n)}static point(t,n){let i=me(5);return i[0]=1,i[1]=t,i[2]=n,i[3]=t,i[4]=n,i}static positionPair(t){let n=me(5);return n[0]=1,n[1]=t.x1,n[2]=t.y1,n[3]=t.x2,n[4]=t.y2,n}static projection(t){return e.singleBox(t.width,t.height,t.x,t.y)}static singleBox(t,n,i=0,r=0){let s=me(5);return s[0]=1,s[1]=i,s[2]=r,s[3]=t+i,s[4]=n+r,s}row(t){return t(this)}addPoints(t,n,i,r){return this.points[this.index]=1,this.points[1+this.index]=t,this.points[2+this.index]=n,this.points[3+this.index]=i,this.points[4+this.index]=r,this.index+=5,this}addBox(t,n,i,r){return this.addPoints(t,n,t+i,n+r),this}build(){return this.points}};var hn=(e,t)=>{let n=e.length;for(let i=0;i<n;i++)e[i]=i%5===0?t[6]*e[i+1]+t[7]*e[i+2]+t[8]*e[i]:i%5%2===1?t[0]*e[i]+t[1]*e[i+1]+t[2]:t[3]*e[i-1]+t[4]*e[i]+t[5];return e},Dn=e=>{let t=me(9);return t[0]=e,t[4]=e,t[8]=1,t},ht=(e,t)=>{let n=me(9);return n[0]=1,n[2]=e,n[4]=1,n[5]=t,n[8]=1,n},ir=(e,t,n)=>An(ht((1-e)*t,(1-e)*n),Dn(e)),Bn=(e,t,n)=>{let i=e.length,r=n&&n.length>=i?n.slice(0,i):me(i);for(let s=0;s<i;s++)r[s]=s%5===0?t[6]*e[s+1]+t[7]*e[s+2]+t[8]*e[s]:s%5%2===1?t[0]*e[s]+t[1]*e[s+1]+t[2]:t[3]*e[s-1]+t[4]*e[s]+t[5];return r};var Ya=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,fA=typeof AbortController=="function",Lc=fA?AbortController:class{constructor(){this.signal=new g0}abort(t=new Error("This operation was aborted")){this.signal.reason=this.signal.reason||t,this.signal.aborted=!0,this.signal.dispatchEvent({type:"abort",target:this.signal})}},hA=typeof AbortSignal=="function",pA=typeof Lc.AbortSignal=="function",g0=hA?AbortSignal:pA?Lc.AbortController:class{constructor(){this.reason=void 0,this.aborted=!1,this._listeners=[]}dispatchEvent(t){t.type==="abort"&&(this.aborted=!0,this.onabort(t),this._listeners.forEach(n=>n(t),this))}onabort(){}addEventListener(t,n){t==="abort"&&this._listeners.push(n)}removeEventListener(t,n){t==="abort"&&(this._listeners=this._listeners.filter(i=>i!==n))}},bm=new Set,xm=(e,t)=>{let n=`LRU_CACHE_OPTION_${e}`;Fc(n)&&Rm(n,`${e} option`,`options.${t}`,ks)},Sm=(e,t)=>{let n=`LRU_CACHE_METHOD_${e}`;if(Fc(n)){let{prototype:i}=ks,{get:r}=Object.getOwnPropertyDescriptor(i,e);Rm(n,`${e} method`,`cache.${t}()`,r)}},mA=(e,t)=>{let n=`LRU_CACHE_PROPERTY_${e}`;if(Fc(n)){let{prototype:i}=ks,{get:r}=Object.getOwnPropertyDescriptor(i,e);Rm(n,`${e} property`,`cache.${t}`,r)}},y0=(...e)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(...e):console.error(...e)},Fc=e=>!bm.has(e),Rm=(e,t,n,i)=>{bm.add(e);let r=`The ${t} is deprecated. Please use ${n} instead.`;y0(r,"DeprecationWarning",e,i)},_r=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),v0=e=>_r(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Os:null:null,Os=class extends Array{constructor(t){super(t),this.fill(0)}},wm=class{constructor(t){if(t===0)return[];let n=v0(t);this.heap=new n(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},ks=class e{constructor(t={}){let{max:n=0,ttl:i,ttlResolution:r=1,ttlAutopurge:s,updateAgeOnGet:l,updateAgeOnHas:u,allowStale:f,dispose:p,disposeAfter:c,noDisposeOnSet:m,noUpdateTTL:y,maxSize:w=0,maxEntrySize:v=0,sizeCalculation:S,fetchMethod:E,fetchContext:R,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:I,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:T,ignoreFetchAbort:_}=t,{length:U,maxAge:H,stale:Z}=t instanceof e?{}:t;if(n!==0&&!_r(n))throw new TypeError("max option must be a nonnegative integer");let B=n?v0(n):Array;if(!B)throw new Error("invalid max value: "+n);if(this.max=n,this.maxSize=w,this.maxEntrySize=v||this.maxSize,this.sizeCalculation=S||U,this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(this.fetchMethod=E||null,this.fetchMethod&&typeof this.fetchMethod!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.fetchContext=R,!this.fetchMethod&&R!==void 0)throw new TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=new Array(n).fill(null),this.valList=new Array(n).fill(null),this.next=new B(n),this.prev=new B(n),this.head=0,this.tail=0,this.free=new wm(n),this.initialFill=1,this.size=0,typeof p=="function"&&(this.dispose=p),typeof c=="function"?(this.disposeAfter=c,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!m,this.noUpdateTTL=!!y,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!M,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!_,this.maxEntrySize!==0){if(this.maxSize!==0&&!_r(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");if(!_r(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!f||!!Z,this.noDeleteOnStaleGet=!!I,this.updateAgeOnGet=!!l,this.updateAgeOnHas=!!u,this.ttlResolution=_r(r)||r===0?r:1,this.ttlAutopurge=!!s,this.ttl=i||H||0,this.ttl){if(!_r(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}if(this.max===0&&this.ttl===0&&this.maxSize===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.max&&!this.maxSize){let G="LRU_CACHE_UNBOUNDED";Fc(G)&&(bm.add(G),y0("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",G,e))}Z&&xm("stale","allowStale"),H&&xm("maxAge","ttl"),U&&xm("length","sizeCalculation")}getRemainingTTL(t){return this.has(t,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new Os(this.max),this.starts=new Os(this.max),this.setItemTTL=(i,r,s=Ya.now())=>{if(this.starts[i]=r!==0?s:0,this.ttls[i]=r,r!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.isStale(i)&&this.delete(this.keyList[i])},r+1);l.unref&&l.unref()}},this.updateItemAge=i=>{this.starts[i]=this.ttls[i]!==0?Ya.now():0},this.statusTTL=(i,r)=>{i&&(i.ttl=this.ttls[r],i.start=this.starts[r],i.now=t||n(),i.remainingTTL=i.now+i.ttl-i.start)};let t=0,n=()=>{let i=Ya.now();if(this.ttlResolution>0){t=i;let r=setTimeout(()=>t=0,this.ttlResolution);r.unref&&r.unref()}return i};this.getRemainingTTL=i=>{let r=this.keyMap.get(i);return r===void 0?0:this.ttls[r]===0||this.starts[r]===0?1/0:this.starts[r]+this.ttls[r]-(t||n())},this.isStale=i=>this.ttls[i]!==0&&this.starts[i]!==0&&(t||n())-this.starts[i]>this.ttls[i]}updateItemAge(t){}statusTTL(t,n){}setItemTTL(t,n,i){}isStale(t){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new Os(this.max),this.removeItemSize=t=>{this.calculatedSize-=this.sizes[t],this.sizes[t]=0},this.requireSize=(t,n,i,r)=>{if(this.isBackgroundFetch(n))return 0;if(!_r(i))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(i=r(n,t),!_r(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.addItemSize=(t,n,i)=>{if(this.sizes[t]=n,this.maxSize){let r=this.maxSize-this.sizes[t];for(;this.calculatedSize>r;)this.evict(!0)}this.calculatedSize+=this.sizes[t],i&&(i.entrySize=n,i.totalCalculatedSize=this.calculatedSize)}}removeItemSize(t){}addItemSize(t,n){}requireSize(t,n,i,r){if(i||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}*indexes({allowStale:t=this.allowStale}={}){if(this.size)for(let n=this.tail;!(!this.isValidIndex(n)||((t||!this.isStale(n))&&(yield n),n===this.head));)n=this.prev[n]}*rindexes({allowStale:t=this.allowStale}={}){if(this.size)for(let n=this.head;!(!this.isValidIndex(n)||((t||!this.isStale(n))&&(yield n),n===this.tail));)n=this.next[n]}isValidIndex(t){return t!==void 0&&this.keyMap.get(this.keyList[t])===t}*entries(){for(let t of this.indexes())this.valList[t]!==void 0&&this.keyList[t]!==void 0&&!this.isBackgroundFetch(this.valList[t])&&(yield[this.keyList[t],this.valList[t]])}*rentries(){for(let t of this.rindexes())this.valList[t]!==void 0&&this.keyList[t]!==void 0&&!this.isBackgroundFetch(this.valList[t])&&(yield[this.keyList[t],this.valList[t]])}*keys(){for(let t of this.indexes())this.keyList[t]!==void 0&&!this.isBackgroundFetch(this.valList[t])&&(yield this.keyList[t])}*rkeys(){for(let t of this.rindexes())this.keyList[t]!==void 0&&!this.isBackgroundFetch(this.valList[t])&&(yield this.keyList[t])}*values(){for(let t of this.indexes())this.valList[t]!==void 0&&!this.isBackgroundFetch(this.valList[t])&&(yield this.valList[t])}*rvalues(){for(let t of this.rindexes())this.valList[t]!==void 0&&!this.isBackgroundFetch(this.valList[t])&&(yield this.valList[t])}[Symbol.iterator](){return this.entries()}find(t,n){for(let i of this.indexes()){let r=this.valList[i],s=this.isBackgroundFetch(r)?r.__staleWhileFetching:r;if(s!==void 0&&t(s,this.keyList[i],this))return this.get(this.keyList[i],n)}}forEach(t,n=this){for(let i of this.indexes()){let r=this.valList[i],s=this.isBackgroundFetch(r)?r.__staleWhileFetching:r;s!==void 0&&t.call(n,s,this.keyList[i],this)}}rforEach(t,n=this){for(let i of this.rindexes()){let r=this.valList[i],s=this.isBackgroundFetch(r)?r.__staleWhileFetching:r;s!==void 0&&t.call(n,s,this.keyList[i],this)}}get prune(){return Sm("prune","purgeStale"),this.purgeStale}purgeStale(){let t=!1;for(let n of this.rindexes({allowStale:!0}))this.isStale(n)&&(this.delete(this.keyList[n]),t=!0);return t}dump(){let t=[];for(let n of this.indexes({allowStale:!0})){let i=this.keyList[n],r=this.valList[n],s=this.isBackgroundFetch(r)?r.__staleWhileFetching:r;if(s===void 0)continue;let l={value:s};if(this.ttls){l.ttl=this.ttls[n];let u=Ya.now()-this.starts[n];l.start=Math.floor(Date.now()-u)}this.sizes&&(l.size=this.sizes[n]),t.unshift([i,l])}return t}load(t){this.clear();for(let[n,i]of t){if(i.start){let r=Date.now()-i.start;i.start=Ya.now()-r}this.set(n,i.value,i)}}dispose(t,n,i){}set(t,n,{ttl:i=this.ttl,start:r,noDisposeOnSet:s=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,status:p}={}){if(l=this.requireSize(t,n,l,u),this.maxEntrySize&&l>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=!0),this.delete(t),this;let c=this.size===0?void 0:this.keyMap.get(t);if(c===void 0)c=this.newIndex(),this.keyList[c]=t,this.valList[c]=n,this.keyMap.set(t,c),this.next[this.tail]=c,this.prev[c]=this.tail,this.tail=c,this.size++,this.addItemSize(c,l,p),p&&(p.set="add"),f=!1;else{this.moveToTail(c);let m=this.valList[c];if(n!==m){if(this.isBackgroundFetch(m)?m.__abortController.abort(new Error("replaced")):s||(this.dispose(m,t,"set"),this.disposeAfter&&this.disposed.push([m,t,"set"])),this.removeItemSize(c),this.valList[c]=n,this.addItemSize(c,l,p),p){p.set="replace";let y=m&&this.isBackgroundFetch(m)?m.__staleWhileFetching:m;y!==void 0&&(p.oldValue=y)}}else p&&(p.set="update")}if(i!==0&&this.ttl===0&&!this.ttls&&this.initializeTTLTracking(),f||this.setItemTTL(c,i,r),this.statusTTL(p,c),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return this.size===0?this.tail:this.size===this.max&&this.max!==0?this.evict(!1):this.free.length!==0?this.free.pop():this.initialFill++}pop(){if(this.size){let t=this.valList[this.head];return this.evict(!0),t}}evict(t){let n=this.head,i=this.keyList[n],r=this.valList[n];return this.isBackgroundFetch(r)?r.__abortController.abort(new Error("evicted")):(this.dispose(r,i,"evict"),this.disposeAfter&&this.disposed.push([r,i,"evict"])),this.removeItemSize(n),t&&(this.keyList[n]=null,this.valList[n]=null,this.free.push(n)),this.head=this.next[n],this.keyMap.delete(i),this.size--,n}has(t,{updateAgeOnHas:n=this.updateAgeOnHas,status:i}={}){let r=this.keyMap.get(t);if(r!==void 0)if(this.isStale(r))i&&(i.has="stale",this.statusTTL(i,r));else return n&&this.updateItemAge(r),i&&(i.has="hit"),this.statusTTL(i,r),!0;else i&&(i.has="miss");return!1}peek(t,{allowStale:n=this.allowStale}={}){let i=this.keyMap.get(t);if(i!==void 0&&(n||!this.isStale(i))){let r=this.valList[i];return this.isBackgroundFetch(r)?r.__staleWhileFetching:r}}backgroundFetch(t,n,i,r){let s=n===void 0?void 0:this.valList[n];if(this.isBackgroundFetch(s))return s;let l=new Lc;i.signal&&i.signal.addEventListener("abort",()=>l.abort(i.signal.reason));let u={signal:l.signal,options:i,context:r},f=(w,v=!1)=>{let{aborted:S}=l.signal,E=i.ignoreFetchAbort&&w!==void 0;return i.status&&(S&&!v?(i.status.fetchAborted=!0,i.status.fetchError=l.signal.reason,E&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),S&&!E&&!v?c(l.signal.reason):(this.valList[n]===y&&(w===void 0?y.__staleWhileFetching?this.valList[n]=y.__staleWhileFetching:this.delete(t):(i.status&&(i.status.fetchUpdated=!0),this.set(t,w,u.options))),w)},p=w=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=w),c(w)),c=w=>{let{aborted:v}=l.signal,S=v&&i.allowStaleOnFetchAbort,E=S||i.allowStaleOnFetchRejection,R=E||i.noDeleteOnFetchRejection;if(this.valList[n]===y&&(!R||y.__staleWhileFetching===void 0?this.delete(t):S||(this.valList[n]=y.__staleWhileFetching)),E)return i.status&&y.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),y.__staleWhileFetching;if(y.__returned===y)throw w},m=(w,v)=>{this.fetchMethod(t,s,u).then(S=>w(S),v),l.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(w(),i.allowStaleOnFetchAbort&&(w=S=>f(S,!0)))})};i.status&&(i.status.fetchDispatched=!0);let y=new Promise(m).then(f,p);return y.__abortController=l,y.__staleWhileFetching=s,y.__returned=null,n===void 0?(this.set(t,y,{...u.options,status:void 0}),n=this.keyMap.get(t)):this.valList[n]=y,y}isBackgroundFetch(t){return t&&typeof t=="object"&&typeof t.then=="function"&&Object.prototype.hasOwnProperty.call(t,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call(t,"__returned")&&(t.__returned===t||t.__returned===null)}async fetch(t,{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:u=0,sizeCalculation:f=this.sizeCalculation,noUpdateTTL:p=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:y=this.ignoreFetchAbort,allowStaleOnFetchAbort:w=this.allowStaleOnFetchAbort,fetchContext:v=this.fetchContext,forceRefresh:S=!1,status:E,signal:R}={}){if(!this.fetchMethod)return E&&(E.fetch="get"),this.get(t,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:E});let b={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:s,noDisposeOnSet:l,size:u,sizeCalculation:f,noUpdateTTL:p,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:w,ignoreFetchAbort:y,status:E,signal:R},I=this.keyMap.get(t);if(I===void 0){E&&(E.fetch="miss");let M=this.backgroundFetch(t,I,b,v);return M.__returned=M}else{let M=this.valList[I];if(this.isBackgroundFetch(M)){let Z=n&&M.__staleWhileFetching!==void 0;return E&&(E.fetch="inflight",Z&&(E.returnedStale=!0)),Z?M.__staleWhileFetching:M.__returned=M}let T=this.isStale(I);if(!S&&!T)return E&&(E.fetch="hit"),this.moveToTail(I),i&&this.updateItemAge(I),this.statusTTL(E,I),M;let _=this.backgroundFetch(t,I,b,v),U=_.__staleWhileFetching!==void 0,H=U&&n;return E&&(E.fetch=U&&T?"stale":"refresh",H&&T&&(E.returnedStale=!0)),H?_.__staleWhileFetching:_.__returned=_}}get(t,{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:s}={}){let l=this.keyMap.get(t);if(l!==void 0){let u=this.valList[l],f=this.isBackgroundFetch(u);return this.statusTTL(s,l),this.isStale(l)?(s&&(s.get="stale"),f?(s&&(s.returnedStale=n&&u.__staleWhileFetching!==void 0),n?u.__staleWhileFetching:void 0):(r||this.delete(t),s&&(s.returnedStale=n),n?u:void 0)):(s&&(s.get="hit"),f?u.__staleWhileFetching:(this.moveToTail(l),i&&this.updateItemAge(l),u))}else s&&(s.get="miss")}connect(t,n){this.prev[n]=t,this.next[t]=n}moveToTail(t){t!==this.tail&&(t===this.head?this.head=this.next[t]:this.connect(this.prev[t],this.next[t]),this.connect(this.tail,t),this.tail=t)}get del(){return Sm("del","delete"),this.delete}delete(t){let n=!1;if(this.size!==0){let i=this.keyMap.get(t);if(i!==void 0)if(n=!0,this.size===1)this.clear();else{this.removeItemSize(i);let r=this.valList[i];this.isBackgroundFetch(r)?r.__abortController.abort(new Error("deleted")):(this.dispose(r,t,"delete"),this.disposeAfter&&this.disposed.push([r,t,"delete"])),this.keyMap.delete(t),this.keyList[i]=null,this.valList[i]=null,i===this.tail?this.tail=this.prev[i]:i===this.head?this.head=this.next[i]:(this.next[this.prev[i]]=this.next[i],this.prev[this.next[i]]=this.prev[i]),this.size--,this.free.push(i)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return n}clear(){for(let t of this.rindexes({allowStale:!0})){let n=this.valList[t];if(this.isBackgroundFetch(n))n.__abortController.abort(new Error("deleted"));else{let i=this.keyList[t];this.dispose(n,i,"delete"),this.disposeAfter&&this.disposed.push([n,i,"delete"])}}if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return Sm("reset","clear"),this.clear}get length(){return mA("length","size"),this.size}static get AbortController(){return Lc}static get AbortSignal(){return g0}},x0=ks;var g1=A(V0(),1);var mt=A(Q(),1),Sd=A(Q(),1),BT=A(D(),1);var Vn=A(Q(),1);function j0(e,t){let n;return(...i)=>{window.clearTimeout(n),n=window.setTimeout(()=>e(...i),t)}}function Vc({debounce:e,scroll:t,polyfill:n,offsetSize:i}={debounce:0,scroll:!1,offsetSize:!1}){let r=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!r)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let[s,l]=(0,Vn.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),u=(0,Vn.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),f=e?typeof e=="number"?e:e.scroll:null,p=e?typeof e=="number"?e:e.resize:null,c=(0,Vn.useRef)(!1);(0,Vn.useEffect)(()=>(c.current=!0,()=>void(c.current=!1)));let[m,y,w]=(0,Vn.useMemo)(()=>{let R=()=>{if(!u.current.element)return;let{left:b,top:I,width:M,height:T,bottom:_,right:U,x:H,y:Z}=u.current.element.getBoundingClientRect(),B={left:b,top:I,width:M,height:T,bottom:_,right:U,x:H,y:Z};u.current.element instanceof HTMLElement&&i&&(B.height=u.current.element.offsetHeight,B.width=u.current.element.offsetWidth),Object.freeze(B),c.current&&!RA(u.current.lastBounds,B)&&l(u.current.lastBounds=B)};return[R,p?j0(R,p):R,f?j0(R,f):R]},[l,i,f,p]);function v(){u.current.scrollContainers&&(u.current.scrollContainers.forEach(R=>R.removeEventListener("scroll",w,!0)),u.current.scrollContainers=null),u.current.resizeObserver&&(u.current.resizeObserver.disconnect(),u.current.resizeObserver=null),u.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",u.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",u.current.orientationHandler))}function S(){u.current.element&&(u.current.resizeObserver=new r(w),u.current.resizeObserver.observe(u.current.element),t&&u.current.scrollContainers&&u.current.scrollContainers.forEach(R=>R.addEventListener("scroll",w,{capture:!0,passive:!0})),u.current.orientationHandler=()=>{w()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",u.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",u.current.orientationHandler))}let E=R=>{!R||R===u.current.element||(v(),u.current.element=R,u.current.scrollContainers=H0(R),S())};return wA(w,!!t),SA(y),(0,Vn.useEffect)(()=>{v(),S()},[t,w,y]),(0,Vn.useEffect)(()=>v,[]),[E,s,m]}function SA(e){(0,Vn.useEffect)(()=>{let t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function wA(e,t){(0,Vn.useEffect)(()=>{if(t){let n=e;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[e,t])}function H0(e){let t=[];if(!e||e===document.body)return t;let{overflow:n,overflowX:i,overflowY:r}=window.getComputedStyle(e);return[n,i,r].some(s=>s==="auto"||s==="scroll")&&t.push(e),[...t,...H0(e.parentElement)]}var bA=["x","y","top","bottom","left","right","width","height"],RA=(e,t)=>bA.every(n=>e[n]===t[n]);var ig=A(Q(),1),Ui=A(Q(),1),v1=A(rw(),1),x1=A(Q(),1),Rd=A(Q(),1),zs=A(D(),1),oi=A(Q(),1),T1=A(Q(),1),M1=A(Q(),1),_1=A(D(),1),pn=A(D(),1),Ed=A(Q(),1);var ll=A(D(),1),og=A(Q(),1),k1=A(Q(),1),iM=A(Q(),1),L1=A(Q(),1),N1=A(Q(),1),Wi=A(Q(),1),z1=A(Q(),1),eg=A(D(),1),D1=A(Q(),1),Hi=A(Q(),1),Vt=A(Q(),1),B1=A(Q(),1),Ad=A(Q(),1),_t=A(D(),1),tg=A(D(),1),uM=A(Q(),1),j1=A(D(),1),H1=A(Q(),1);var IA=Object.defineProperty,CA=(e,t,n)=>t in e?IA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gc=(e,t,n)=>(CA(e,typeof t!="symbol"?t+"":t,n),n);function Mo(e){return e.endsWith("info.json")?e:e.endsWith("/")?`${e}info.json`:`${e}/info.json`}var PA="http://library.stanford.edu/iiif/image-api/compliance.html#level0",lw="http://library.stanford.edu/iiif/image-api/compliance.html#level1",uw="http://library.stanford.edu/iiif/image-api/compliance.html#level2",AA="http://library.stanford.edu/iiif/image-api/conformance.html#level0",cw="http://library.stanford.edu/iiif/image-api/conformance.html#level1",dw="http://library.stanford.edu/iiif/image-api/conformance.html#level2",TA="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",fw="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",hw="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",MA="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",pw="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",mw="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",_A="http://iiif.io/api/image/1/level0.json",OA="http://iiif.io/api/image/1/profiles/level0.json",gw="http://iiif.io/api/image/1/level1.json",yw="http://iiif.io/api/image/1/profiles/level1.json",vw="http://iiif.io/api/image/1/level2.json",xw="http://iiif.io/api/image/1/profiles/level2.json",kA="http://iiif.io/api/image/2/level0.json",LA="http://iiif.io/api/image/2/profiles/level0.json",Sw="http://iiif.io/api/image/2/level1.json",ww="http://iiif.io/api/image/2/profiles/level1.json",bw="http://iiif.io/api/image/2/level2.json",Rw="http://iiif.io/api/image/2/profiles/level2.json",FA="level0",Ew="level1",Iw="level2",NA="http://iiif.io/api/image/2/level0",Cw="http://iiif.io/api/image/2/level1",Pw="http://iiif.io/api/image/2/level2",zA="https://iiif.io/api/image/1.1/compliance/#level0",Aw="https://iiif.io/api/image/1.1/compliance/#level1",Tw="https://iiif.io/api/image/1.1/compliance/#level2",Mw=[Pw,uw,dw,hw,mw,vw,xw,bw,Rw,Iw,Tw],_w=[...Mw,Cw,lw,cw,fw,pw,gw,yw,Sw,ww,Ew,Aw],DA=[NA,Cw,Pw,PA,lw,uw,AA,cw,dw,TA,fw,hw,MA,pw,mw,_A,OA,gw,yw,vw,xw,kA,LA,Sw,ww,bw,Rw,FA,Ew,Iw,zA,Aw,Tw];var BA={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},VA={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},jA={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};function HA(e){return Mw.indexOf(e)!==-1?jA:_w.indexOf(e)!==-1?VA:BA}function WA(e){let t=e?Array.isArray(e.profile)?e.profile:[e.profile]:[],n={extraQualities:[],extraFormats:[],extraFeatures:[]};for(let i of t)if(typeof i=="string"&&(i=HA(i)),!!i){if(i.formats)for(let r of i.formats)n.extraFormats.indexOf(r)===-1&&n.extraFormats.push(r);if(i.qualities)for(let r of i.qualities)n.extraQualities.indexOf(r)===-1&&n.extraQualities.push(r);if(i.supports)for(let r of i.supports)n.extraFeatures.indexOf(r)===-1&&n.extraFeatures.push(r);if(i.maxHeight&&(n.maxHeight=i.maxHeight),i.maxWidth&&(n.maxWidth=i.maxWidth),i.maxArea&&(n.maxArea=i.maxArea),i.extraFormats)for(let r of i.extraFormats)n.extraFormats.indexOf(r)===-1&&n.extraFormats.push(r);if(i.extraQualities)for(let r of i.extraQualities)n.extraQualities.indexOf(r)===-1&&n.extraQualities.push(r);if(i.extraFeatures)for(let r of i.extraFeatures)n.extraFeatures.indexOf(r)===-1&&n.extraFeatures.push(r);i.maxHeight&&(n.maxHeight=i.maxHeight),i.maxWidth&&(n.maxWidth=i.maxWidth),i.maxArea&&(n.maxArea=i.maxArea)}if(e.extraFormats)for(let i of e.extraFormats)n.extraFormats.indexOf(i)===-1&&n.extraFormats.push(i);if(e.extraFeatures)for(let i of e.extraFeatures)n.extraFeatures.indexOf(i)===-1&&n.extraFeatures.push(i);if(e.extraQualities)for(let i of e.extraQualities)n.extraQualities.indexOf(i)===-1&&n.extraQualities.push(i);return n}function UA(e){try{if(e==="full")return{full:!0};if(e==="square")return{square:!0};let t=e.startsWith("pct:"),n=e.substr(t?4:0).split(",").map(i=>parseFloat(i));return{x:n[0],y:n[1],w:n[2],h:n[3],percent:t}}catch{throw new Error("Expected 'full', 'square' or 'x,y,w,h'. Found "+e)}}function qA(e){let t={upscaled:!1,max:!1,confined:!1};if(e[0]==="^"&&(t.upscaled=!0,e=e.slice(1)),e==="max"||e==="full")return t.max=!0,t.serialiseAsFull=e==="full",t;if(e[0]==="!"&&(t.confined=!0,e=e.slice(1)),e[0]==="p")return t.percentScale=parseFloat(e.slice(4)),t;let n=e.split(",").map(i=>i.trim());return n.length&&typeof n[0]<"u"&&(n[0]!==""&&(t.width=parseInt(n[0],10)),typeof n[1]<"u"&&n[1]!==""?(t.height=parseInt(n[1],10),t.version=2):t.version=3),t}function GA(e){let t={angle:0};if(e[0]==="!"&&(t.mirror=!0,e=e.substr(1)),t.angle=parseFloat(e)%360,Number.isNaN(t.angle))throw new Error(`Invalid rotation ${e}`);return t}function $A(e,t=""){let n=e.match(/^(([a-zA-Z]+):\/\/([^/]+))?((.*)+)/);if(!n)throw new Error(`Invalid or unknown input ${e}`);let i=n[2],r=n[3],s=n[4];if(s[0]==="/"&&(s=s.substring(1)),t.length>0){if(t[0]==="/"&&(t=t.substring(1)),t!==s.substring(0,t.length))throw new Error(`Path does not start with prefix (path: ${s}, prefix: ${t})`);s=s.substring(t.length)}return{scheme:i,server:r,path:s,prefix:t}}function QA(e,t=""){let{path:n,scheme:i,server:r,prefix:s}=$A(e,t),l=(n||"").split("/").reverse(),[u,f,p,c,...m]=l,y=m.reverse().filter(Boolean).join("/");if(l.length===1||u==="")return{type:"base",scheme:i,server:r,prefix:s,identifier:y};if(u==="info.json"){let[,...v]=l;return{type:"info",scheme:i,server:r,prefix:s,identifier:v.reverse().filter(Boolean).join("/")}}let w=(u||"").split(".");if(typeof w[1]>"u"||typeof w[0]>"u"||typeof c>"u"||typeof p>"u"||typeof f>"u")throw new Error("Invalid image request");return{type:"image",scheme:i,server:r,prefix:s,identifier:y,originalPath:n,region:UA(c),size:qA(p),rotation:GA(f),quality:w[0],format:w[1]}}function YA(e){let t=QA(Mo(e.id));if(t.type!=="info")throw new Error("Invalid service URL");let n=WA(e);return{identifier:t.identifier,originalPath:"",server:t.server,prefix:t.prefix,scheme:t.scheme,type:"image",quality:n.extraQualities.indexOf("default")===-1?n.extraQualities[0]:"default",region:{full:!0},size:{max:!0,upscaled:!1,confined:!1},format:"jpg",rotation:{angle:0}}}function KA(e,t,n){let i=n.length,r=[];for(let s=0;s<i;s++){let l=n[s];if(l){let u=l.width;r.push(e/u)}}return r}function XA(e,t,n){let i=n.length,r=[];for(let s=0;s<i;s++){let l=n[s];l&&r.push({width:Math.floor(e/l),height:Math.floor(t/l)})}return r}function wt(e){if(e["@id"])return e["@id"];if(e.id)return e.id}function Qc(e){if(!e||!e.profile||!wt(e))return!1;let t=Array.isArray(e.profile)?e.profile:[e.profile];for(let n of t)if(typeof n=="string"&&DA.indexOf(n)!==-1)return!0;return!1}function ZA(e){if(!Qc(e))return!1;let t=Array.isArray(e.profile)?e.profile:[e.profile];for(let n of t)if(typeof n=="string"){if(_w.indexOf(n)!==-1)return!0}else{let i=[...n.supports||[],...n.extraFeatures||[]];if(i.indexOf("regionByPx")!==-1&&(i.indexOf("sizeByW")!==-1||i.indexOf("sizeByWh")!==-1))return!0}return!1}function $c(e,t){if(t&&t.profile){let n=t.profile;if(n){let i=Array.isArray(n)?n:[n];return i.includes(`level${e}`)||i.includes(`http://iiif.io/api/image/2/level${e}.json`)||i.includes(`http://iiif.io/api/image/1/level${e}.json`)||i.includes(`http://iiif.io/api/image/1/profiles/level${e}.json`)}}return!1}function Hm(e){return Qc(e)?$c(0,e)?0:$c(1,e)?1:$c(2,e)?2:null:null}function Ow(e){return(e["@context"]?Array.isArray(e["@context"])?e["@context"]:[e["@context"]]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1}function JA(e){if(!ZA(e))return[];let t=[],n=Array.isArray(e.profile)?e.profile:[e.profile],i=n.length;for(let r=0;r<i;r++){let s=n[r];if(s&&typeof s!="string"&&(s.maxHeight||s.maxWidth))return[{id:wt(e),type:"variable",minWidth:0,minHeight:0,maxHeight:s.maxHeight||s.maxWidth,maxWidth:s.maxWidth||s.maxHeight,level:Hm(e),version:e["@context"]==="http://iiif.io/api/image/3/context.json"?3:2}]}if(e.tiles){let r=e.tiles.length;for(let s=0;s<r;s++){let l=e.tiles[s];l&&(l.height||l.width)&&t.push({id:wt(e),type:"variable",minHeight:0,minWidth:0,maxHeight:l.height||l.width,maxWidth:l.width,level:Hm(e),version:Ow(e)?3:2})}}return t}function ow(e){let t=/^.*\/(full)\/(((\d+),(\d+)?)|max)\/(\d+)\/default\.(jpg|png|jpeg)$/,n=e.match(t);if(n&&n[4]&&n[5]){let i=n[1],r=parseInt(n[4],10),s=parseInt(n[5],10),l=n[7];if((i==="max"||i==="full")&&r&&s&&l)return{type:"fixed",id:e,height:s,width:r}}return{type:"unknown",id:e}}function eT(e){if(e["@type"])return e["@type"];if(e.type)return e.type}function tT(e){if(typeof e=="string")return ow(e);let t=eT(e);if(t!=="Image"&&t!=="sc:Image")return null;let n=e,i=wt(n);return i?i&&n.width&&n.height?{id:i,type:"fixed",width:n.width,height:n.height,unsafe:!0}:ow(i):null}function nT(e){return Qc(e)?(e&&e.sizes?e.sizes:[]).map(t=>({id:wt(e),type:"fixed-service",height:t.height,width:t.width,level:Hm(e),version:Ow(e)?3:2})):[]}function sw(e){let t=[],n=e.length;for(let i=0;i<n;i++){let r=e[i];if(!r)continue;let s=nT(r);s.length&&t.push(...s);let l=JA(r);l.length&&t.push(...l)}return t}function kw(e){let t=e.service?Array.isArray(e.service)?e.service:[e.service]:[],n=t.length,i=[];for(let r=0;r<n;r++)Qc(t[r])&&i.push(t[r]);return i}function iT(e,t=!0,n){let i=[],r=tT(e);if(r===null)return i;let s=e;if(i.push(r),t&&s&&s.width&&s.height){let l=[],u=kw(s);for(let f of u){let p={id:wt(f),width:s.width,height:s.height};if(n.canLoadSync(p)){let c=n.loadServiceSync(p);c&&(c.height||(c.height=s.height),c.width||(c.width=s.width),l.push(...sw([c])))}}if(l.length)return i.push(...l),i}return s.service&&i.push(...sw(s.service)),i}function rT({x:e=0,y:t=0,w:n,h:i,full:r,square:s,percent:l}){if(r)return"full";if(s)return"square";if(typeof n>"u"||typeof i>"u")throw new Error("RegionParameter: invalid region");let u=`${e},${t},${n},${i}`;return l?`pct:${u}`:u}function oT({max:e,percentScale:t,upscaled:n,confined:i,width:r,height:s,serialiseAsFull:l,version:u}){let f=[];return n&&f.push("^"),e?(f.push(l?"full":"max"),f.join("")):(i&&f.push("!"),t&&f.push(`pct:${t}`),r&&f.push(`${r}`),f.push(","),s&&u===3&&f.push(`${s}`),f.join(""))}function sT(e){return`${e.mirror?"!":""}${(e.angle||0)%360}`}function aT(e,t){let n=e.prefix.startsWith("/")?e.prefix.substr(1):e.prefix,i=`${e.scheme}://${e.server}/${n?`${n}/`:""}${e.identifier}`;if(e.type==="base")return i;if(e.type==="info")return`${i}/info.json`;let{size:r}=e,{region:s,rotation:l,format:u,quality:f}=e;if(t){let p=t["@context"]?Array.isArray(t["@context"])?t["@context"]:[t["@context"]]:[],c=t.profile,m=p.indexOf("http://iiif.io/api/image/2/context.json")!==-1||c==="level2",y=p.indexOf("http://iiif.io/api/image/3/context.json")!==-1;if((r.width===t.width&&!r.height||r.height===t.height&&!r.width||r.width===t.width&&r.height===t.height)&&(r={...r,max:!0}),m&&(r.max&&!r.serialiseAsFull&&(r={...r,serialiseAsFull:!0}),!r.max&&r.width&&r.height&&(r={...r,height:void 0}),r={...r,version:2}),y){if(r.max&&r.serialiseAsFull&&(r={...r,serialiseAsFull:!1}),r.width&&!r.height&&t.width&&t.height){let w=t.height/t.width;r={...r,height:Math.ceil(r.width*w)}}r={...r,version:3}}}return[i,rT(s),oT(r),sT(l),`${f}.${u}`].filter(Boolean).join("/")}function jm(e,t,n){let i=YA({"@context":e.version===3?"http://iiif.io/api/image/3/context.json":"http://iiif.io/api/image/2/context.json",id:Mo(wt(e)),profile:e.level===null||typeof e.level>"u"?"level0":`level${e.level}`,type:e.version===3?"ImageService3":"ImageService2"});if(i.type!=="image")throw new Error("Invalid service");return i.size.max=!1,i.size.width=t,i.size.height=n,{id:aT(i),type:"fixed",width:t,height:n||e.height/(e.width||1)*t,unsafe:e.width>t}}function Ls(e){let t=e.replace(/(https?:\/\/)?(www.)?/i,"");return t.indexOf("/")!==-1?t.split("/")[0]:t}function lT(e,t,n){let i=e.width?e.width:e.maxWidth;return n.height<=e.maxHeight&&n.width<=e.maxWidth&&n.height>=e.minHeight&&n.width>=e.minWidth&&(!t||Math.abs(n.width-i)<Math.abs(t.width-i))}function uT(e,t){let n=[],i=Object.assign({unsafeImageService:!1,atAnyCost:!0,fallback:!0,minHeight:64,minWidth:64,maxHeight:1/0,maxWidth:1/0,returnAllOptions:!1,preferFixedSize:!1,allowUnsafe:!1,explain:!1,height:0,width:0},e),r=(c,m=0)=>i.explain?n.push(new Array(m).fill(0).map(y=>" ").join("")+c().trim()):void 0,s=[],l=[],u=null;r(()=>`Using configuration: ${JSON.stringify(i,null,2)}`);let f=(c,m)=>{if(r(()=>"Swapping choice",3),lT(i,m,c)){if(i.preferFixedSize&&c.unsafe){r(()=>`We found an image that was marked as unsafe, but it was the best size. (${c.id})`,4),l.push(c);return}i.returnAllOptions&&m&&l.push(m),r(()=>`We found a new image that was the best size. (${c.id})`,4),u=c}else i.returnAllOptions&&l.push(c)};r(()=>`The input shows we have ${t.length} list(s) of candidates to choose from.`);let p=t.length;for(let c=0;c<p;c++){let m=t[c]();r(()=>`Candidate group ${c}: ${JSON.stringify(m,null,2)}`,1);let y=m.length;r(()=>`Checking candidate list number ${c} and found ${y} potential ways of creating image(s)`,1);for(let w=0;w<y;w++){let v=m[w];if(r(()=>`-> Checking candidate ${w}`,1),v.type==="unknown"&&i.atAnyCost&&(r(()=>`We've found an unknown image type, adding this to the "last resort" list`,2),s.push(v)),v.type==="fixed"&&(v.unsafe?(r(()=>`We've found an unsafe fixed image type, adding this to the "last resort" list`,2),s.push(v)):(r(()=>"We've found a fixed size image, checking if it matches the request",2),f(v,u))),v.type==="fixed-service")if(i.unsafeImageService){r(()=>"Checking for an image from the tile source, without calculating the right height and width (unsafeImageService)",2);let S=jm(v,i.width,i.height);f(S,u)}else{r(()=>"Checking for an image from the tile source 3",2);let S=jm(v,v.width,v.height);f(S,u)}if(v.type==="variable"&&v.maxWidth){let S=jm({id:v.id,type:"fixed-service",width:v.maxWidth,height:v.maxWidth,level:v.level,version:v.version},v.maxWidth);f(S,u)}}if(u&&!i.returnAllOptions){if(u.unsafe||i.allowUnsafe)continue;r(()=>`We found a match in choice list number ${c}, no searching any more`);break}}return i.atAnyCost&&l.length===0?(r(()=>u?`We found an image! ${u.id} of type ${u.type}`:'We found no images, but "atAnyCost" is set, so returning that'),{best:u||s[0]||null,fallback:s.slice(1),log:n}):i.returnAllOptions?(r(()=>"Returning all options that we have found"),{best:(i.atAnyCost?u||l[0]||s[0]:u||l[0])||null,fallback:[...l,...s],log:n}):(r(()=>"Returning the best image that we found, and a fallback"),{best:u||l[0]||null,fallback:u?l:l.slice(1),log:n})}function cT(e,t,n){let i=e>t?e:t,r=n.length,s=[];for(let l=0;l<r;l++){let u=n[l];if(!u||u.scaleFactors.length===0)continue;let f=u.scaleFactors[0];if(!f)continue;let p=i/f,c=[f];for(;p>=u.width;)f=f*2,c.push(f),p=p/2;s.push({...u,scaleFactors:c})}return s}function dT(e,t){if(e.length!==t.length)return!1;if(e.length===0&&t.length===0)return!0;let n=e.length,i=!0;for(let s=0;s<n;s++){let l=e[s],u=t[s];if(l.width!==u.width||l.height!==u.height){i=!1;break}}if(i)return!0;let r=0;for(let s=0;s<n;s++)for(let l=0;l<n;l++)if(e[s].width===t[l].width&&e[s].height===t[l].height){r++;break}return r===n}function aw(e){return $c(0,e)}var Lw=class{constructor(e={}){Gc(this,"config",{verificationsRequired:1,approximateServices:!1,enableFetching:!0,disableThrottling:!1}),Gc(this,"fetchingCount",0),Gc(this,"imageServices",{}),Gc(this,"knownImageServers",{}),this.config=Object.assign(this.config,e)}setConfig(e){Object.assign(this.config,e)}sample(e,t,n=!0){let i=Ls(wt(e)),r=Mo(wt(e)),s=this.knownImageServers[i];return this.imageServices[r]=Object.assign(e,{real:!0}),!s&&e.tiles&&!aw(e)?(this.knownImageServers[i]={verifications:0,malformed:!1,root:i,preLoaded:n,sampledId:wt(e),verified:!1,server:null,result:{context:e["@context"]||[],sampledProfile:e.profile,resourceServiceRatio:t&&e.height?t.height/e.height:1,sampledSizes:e.sizes||[],sizeRatios:KA(e.width,e.height,e.sizes||[]),sampledTiles:e.tiles||[]}},!0):this.verify(e)}preLoad(e,t=!0){this.knownImageServers[e.root]=e,t&&(this.knownImageServers[e.root].malformed=!1,this.knownImageServers[e.root].verifications=this.config.verificationsRequired)}predict(e,t=!1,n=!1){let i=e?.source,r=Ls(wt(e)),s=this.knownImageServers[r],l=Mo(wt(e));return this.imageServices[l]?this.imageServices[l]||null:!this.config.approximateServices||!s||!s.result||!(i?.height||e.height)||!(i?.width||e.width)||!n&&(s.malformed||s.verifications<this.config.verificationsRequired)||aw(e.source)?null:(this.imageServices[l]||(this.imageServices[l]={"@context":s.result.context,"@id":wt(e),id:wt(e),protocol:"http://iiif.io/api/image",tiles:i?.tiles||cT(e.width,e.height,s.result.sampledTiles),sizes:i?.sizes||XA(Math.round(e.width/s.result.resourceServiceRatio),Math.round(e.height/s.result.resourceServiceRatio),s.result.sizeRatios),profile:i?.profile||s.result.sampledProfile,height:i?.height||e.height,width:i?.width||e.width,real:!1}),this.imageServices[l]||null)}async getThumbnailFromResource(e,t,n=!0,i=[]){let r=e?await this.getImageCandidates(e,n):[];return uT(t,[()=>i,()=>r])}async getImageCandidates(e,t=!0){let n=e;if(t&&n&&n.height&&n.width){let i=kw(n);for(let r of i){let s={id:wt(r),width:r.width?r.width:n.width,height:r.height?r.height:n.height,source:r};await this.loadService(s)}}return iT(e,t,this)}async verify(e){let t=this.predict(e,!1,!0),n=await this.fetchService(wt(e));if(!t)return!1;let i=t.height===n.height&&t.width===n.width&&t["@context"]===n["@context"]&&dT(t.sizes||[],n.sizes||[]);if(i){let r=Ls(wt(e)),s=this.knownImageServers[r];s&&(s.verifications+=1,s.verifications>=this.config.verificationsRequired&&(s.verified=!0))}return i}canLoadSync(e){let t=typeof e=="string"?e:wt(e),n=Mo(t);if(this.imageServices[n])return!0;let i=this.knownImageServers[Ls(t)];return!!(i&&!i.malformed&&i.verifications>=this.config.verificationsRequired)}async markAsMalformed(e){return this.knownImageServers[Ls(wt(e))].malformed=!0,this.loadService(e,!0)}async fetchService(e,t=!1){let n=Mo(e),i=this.imageServices[n];if(i&&(!t||i.real))return i;if(!this.config.enableFetching)throw new Error("Fetching is not enabled");let r=await this.fetch(n).then(s=>s.json());return!r.id&&r["@id"]&&(r.id=r["@id"]),r.id!==e&&(r.id=e,r["@id"]&&(r["@id"]=e)),this.imageServices[n]=Object.assign(r,{real:!0}),this.imageServices[n]}async fetch(e,t){return fetch(e,t)}async loadService(e,t=!1){if(!this.config.disableThrottling){let r=!0;for(;r;)if(this.fetchingCount>=this.config.verificationsRequired)await new Promise(s=>setTimeout(s,500));else{r=!1;break}}let n=this.knownImageServers[Ls(wt(e))];if(n&&!n.malformed&&!t){await n.result;let r=this.loadServiceSync(e);if(r)return r}this.fetchingCount++;let i=await this.fetchService(wt(e),t);return this.fetchingCount--,i.real&&this.sample(i,e),i}loadServiceSync(e){let t=Mo(wt(e));return this.imageServices[t]?this.imageServices[t]:this.config.approximateServices?this.predict(e):null}},EF=new Lw;var Yc={},rr={get(e){return e},setMetaValue([e,t,n],i){let r=rr.getResourceMeta(e,t),s=r?r[n]:void 0,l=typeof i=="function"?i(s):i;Yc[e]={...Yc[e]||{},[t]:{...(Yc[e]||{})[t]||{},[n]:l}}},getResourceMeta:(e,t)=>{let n=Yc[e];if(n)return t?n[t]:n},async load(e){let t=typeof e=="string"?e:e.id;return fetch(t).then(n=>n.json())},requestStatus(e){}};function fT(e){try{if(e==="full")return{full:!0};if(e==="square")return{square:!0};let t=e.startsWith("pct:"),n=e.substr(t?4:0).split(","),i=n.map(r=>parseFloat(r));return{x:i[0],y:i[1],w:i[2],h:i[3],percent:t}}catch{throw Error("Expected 'full', 'square' or 'x,y,w,h'. Found "+e)}}function hT(e){let t={upscaled:!1,max:!1,confined:!1};if(e[0]==="^"&&(t.upscaled=!0,e=e.slice(1)),e==="max"||e==="full")return t.max=!0,t.serialiseAsFull=e==="full",t;if(e[0]==="!"&&(t.confined=!0,e=e.slice(1)),e[0]==="p")return t.percentScale=parseFloat(e.slice(4)),t;let n=e.split(",").map(i=>i.trim());return n.length&&(n[0]!==""&&(t.width=parseInt(n[0],10)),n[1]!==""&&(t.height=parseInt(n[1],10))),t}function pT(e){let t={angle:0};if(e[0]==="!"&&(t.mirror=!0,e=e.substr(1)),t.angle=parseFloat(e)%360,Number.isNaN(t.angle))throw Error(`Invalid rotation ${e}`);return t}function mT(e,t=""){let n=e.match(/^(([a-zA-Z]+):\/\/([^/]+))?((.*)+)/);if(!n)throw Error(`Invalid or unknown input ${e}`);let i=n[2],r=n[3],s=n[4];if(s[0]==="/"&&(s=s.substring(1)),t.length>0){if(t[0]==="/"&&(t=t.substring(1)),t!==s.substring(0,t.length))throw Error(`Path does not start with prefix (path: ${s}, prefix: ${t})`);s=s.substring(t.length)}return{scheme:i,server:r,path:s,prefix:t}}function gT(e,t=""){let{path:n,scheme:i,server:r,prefix:s}=mT(e,t),l=n.split("/").reverse(),[u,f,p,c,...m]=l,y=m.reverse().filter(Boolean).join("/");if(l.length===1||u==="")return{type:"base",scheme:i,server:r,prefix:s,identifier:y};if(u==="info.json"){let[,...S]=l;return{type:"info",scheme:i,server:r,prefix:s,identifier:S.reverse().filter(Boolean).join("/")}}if(i===void 0||r===void 0||n===void 0||c===void 0||p===void 0||f===void 0||u===void 0)throw Error("Invalid image service URL");let[w="",v=""]=u.split(".");return{type:"image",scheme:i,server:r,prefix:s,identifier:y,originalPath:n,region:fT(c),size:hT(p),rotation:pT(f),quality:w,format:v}}function yT(e){return vs.indexOf(e)!==-1?Zx:Sc.indexOf(e)!==-1?Xx:Kx}function vT(e){let t=e?Array.isArray(e.profile)?e.profile:[e.profile]:[],n={extraQualities:[],extraFormats:[],extraFeatures:[]};for(let i of t)if(typeof i=="string"&&(i=yT(i)),!!i){if(i.formats)for(let r of i.formats)n.extraFormats.indexOf(r)===-1&&n.extraFormats.push(r);if(i.qualities)for(let r of i.qualities)n.extraQualities.indexOf(r)===-1&&n.extraQualities.push(r);if(i.supports)for(let r of i.supports)n.extraFeatures.indexOf(r)===-1&&n.extraFeatures.push(r);if(i.maxHeight&&(n.maxHeight=i.maxHeight),i.maxWidth&&(n.maxWidth=i.maxWidth),i.maxArea&&(n.maxArea=i.maxArea),i.extraFormats)for(let r of i.extraFormats)n.extraFormats.indexOf(r)===-1&&n.extraFormats.push(r);if(i.extraQualities)for(let r of i.extraQualities)n.extraQualities.indexOf(r)===-1&&n.extraQualities.push(r);if(i.extraFeatures)for(let r of i.extraFeatures)n.extraFeatures.indexOf(r)===-1&&n.extraFeatures.push(r);i.maxHeight&&(n.maxHeight=i.maxHeight),i.maxWidth&&(n.maxWidth=i.maxWidth),i.maxArea&&(n.maxArea=i.maxArea)}if(e.extraFormats)for(let i of e.extraFormats)n.extraFormats.indexOf(i)===-1&&n.extraFormats.push(i);if(e.extraFeatures)for(let i of e.extraFeatures)n.extraFeatures.indexOf(i)===-1&&n.extraFeatures.push(i);if(e.extraQualities)for(let i of e.extraQualities)n.extraQualities.indexOf(i)===-1&&n.extraQualities.push(i);return n}function Wm(e){let t=Array.isArray(e.profile)?e.profile:[e.profile];for(let n of t)if(typeof n=="string"&&Fp.indexOf(n)!==-1)return!0;return!1}function Xe(e){if(e["@id"])return e["@id"];if(e.id)return e.id}function Ja(e){if(!e||!e.profile||!Xe(e))return!1;let t=Array.isArray(e.profile)?e.profile:[e.profile];for(let n of t)if(typeof n=="string"&&kp.indexOf(n)!==-1)return!0;return!1}function Fw(e){if(!Ja(e))return!1;let t=Array.isArray(e.profile)?e.profile:[e.profile];for(let n of t)if(typeof n=="string"){if(Sc.indexOf(n)!==-1)return!0}else{let i=[...n.supports||[],...n.extraFeatures||[]];if(i.indexOf("regionByPx")!==-1&&(i.indexOf("sizeByW")!==-1||i.indexOf("sizeByWh")!==-1))return!0}return!1}function xT({x:e=0,y:t=0,w:n,h:i,full:r,square:s,percent:l}){if(r)return"full";if(s)return"square";if(n===void 0||i===void 0)throw Error("RegionParameter: invalid region");let u=`${e},${t},${n},${i}`;return l?`pct:${u}`:u}function ST({max:e,percentScale:t,upscaled:n,confined:i,width:r,height:s,serialiseAsFull:l,version:u}){let f=[];return n&&f.push("^"),e?(f.push(l?"full":"max"),f.join("")):(i&&f.push("!"),t&&f.push(`pct:${t}`),r&&f.push(`${r}`),f.push(","),s&&u===3&&f.push(`${s}`),f.join(""))}function wT(e){return`${e.mirror?"!":""}${(e.angle||0)%360}`}function Kc(e,t){let n=e.prefix.startsWith("/")?e.prefix.substring(1):e.prefix,i=`${e.scheme}://${e.server}/${n?`${n}/`:""}${e.identifier}`;if(e.type==="base")return i;if(e.type==="info")return`${i}/info.json`;let{size:r}=e,{region:s,rotation:l,format:u,quality:f}=e;if(t){let p=t["@context"]?Array.isArray(t["@context"])?t["@context"]:[t["@context"]]:[],c=p.indexOf("http://iiif.io/api/image/2/context.json")!==-1,m=p.indexOf("http://iiif.io/api/image/3/context.json")!==-1;if((r.width===t.width&&!r.height||r.height===t.height&&!r.width||r.width===t.width&&r.height===t.height)&&(r={...r,max:!0}),c&&(r.max&&!r.serialiseAsFull&&(r={...r,serialiseAsFull:!0}),!r.max&&r.width&&r.height&&(r={...r,height:void 0}),r={...r,version:2}),m){if(r.max&&r.serialiseAsFull&&(r={...r,serialiseAsFull:!1}),r.width&&!r.height&&t.width&&t.height){let y=t.height/t.width;r={...r,height:Math.ceil(r.width*y)}}r={...r,version:3}}}return[i,xT(s),ST(r),wT(l),`${f}.${u}`].filter(Boolean).join("/")}function kr(e){return e.endsWith("info.json")?e:e.endsWith("/")?`${e}info.json`:`${e}/info.json`}function Xc(e){let t=gT(kr(e.id));if(t.type!=="info")throw Error("Invalid service URL");let n=vT(e);return{identifier:t.identifier,originalPath:"",server:t.server,prefix:t.prefix,scheme:t.scheme,type:"image",quality:n.extraQualities.indexOf("default")===-1?n.extraQualities[0]:"default",region:{full:!0},size:{max:!0,upscaled:!1,confined:!1},format:"jpg",rotation:{angle:0}}}function Nw(e,t,n){let i=n.length,r=[];for(let s=0;s<i;s++){let l=n[s];if(!l)continue;let u=l.width;r.push(e/u)}return r}function zw(e,t,n){let i=n.length,r=[];for(let s=0;s<i;s++){let l=n[s];l&&r.push({width:Math.floor(e/l),height:Math.floor(t/l)})}return r}function Fs(e,t){if(t&&t.profile){let n=t.profile;if(n){let i=Array.isArray(n)?n:[n];if(i.includes(`level${e}`)||i.includes(`http://iiif.io/api/image/2/level${e}.json`)||i.includes(`http://iiif.io/api/image/1/level${e}.json`)||i.includes(`http://iiif.io/api/image/1/profiles/level${e}.json`))return!0;if(e===2){for(let r of i)if(vs.includes(r))return!0}if(e===1){for(let r of i)if(Sc.includes(r))return!0}if(e===0){for(let r of i)if(Fp.includes(r))return!0}}}return!1}function Zc(e){return Ja(e)?Fs(2,e)?2:Fs(1,e)?1:Fs(0,e)?0:null:null}function Lr(e){let t=e.service?Array.isArray(e.service)?e.service:[e.service]:[],n=t.length,i=[];for(let r=0;r<n;r++)Ja(t[r])&&i.push(t[r]);return i}function Dw(e){if(e["@type"])return e["@type"];if(e.type)return e.type}function _o(e){let t=e.replace(/(https?:\/\/)?(www.)?/i,"");return t.indexOf("/")===-1?t:t.split("/")[0]}function Bw(e,t,n){let i=e>t?e:t,r=n.length,s=[];for(let l=0;l<r;l++){let u=n[l];if(!u||u.scaleFactors.length===0)continue;let f=u.scaleFactors[0];if(!f)continue;let p=i/f,c=[f];for(;p>=u.width;)f*=2,c.push(f),p/=2;s.push({...u,scaleFactors:c})}return s}function Jc(e,t,n){let i=Xc({"@context":e.version===3?"http://iiif.io/api/image/3/context.json":"http://iiif.io/api/image/2/context.json",id:kr(Xe(e)),profile:e.level===null||e.level===void 0?"level0":`level${e.level}`,type:e.version===3?"ImageService3":"ImageService2"});if(i.type!=="image")throw Error("Invalid service");return i.size.max=!1,i.size.width=t,i.size.height=n,{id:Kc(i),type:"fixed",width:t,height:n||e.height/(e.width||1)*t,unsafe:e.width>t}}function Vw(e,t,n){let i=e.width?e.width:e.maxWidth;return n.height<=e.maxHeight&&n.width<=e.maxWidth&&n.height>=e.minHeight&&n.width>=e.minWidth&&(!t||Math.abs(n.width-i)<Math.abs(t.width-i))}function jw(e,t){let n=[],i=Object.assign({unsafeImageService:!1,atAnyCost:!0,fallback:!0,minHeight:64,minWidth:64,maxHeight:1/0,maxWidth:1/0,returnAllOptions:!1,preferFixedSize:!1,allowUnsafe:!1,explain:!1,height:0,width:0},e),r=(c,m=0)=>i.explain?n.push(Array(m).fill(0).map(y=>" ").join("")+c().trim()):void 0,s=[],l=[],u=null;r(()=>`Using configuration: ${JSON.stringify(i,null,2)}`);let f=(c,m)=>{if(r(()=>"Swapping choice",3),Vw(i,m,c)){if(i.preferFixedSize&&c.unsafe){r(()=>`We found an image that was marked as unsafe, but it was the best size. (${c.id})`,4),l.push(c);return}i.returnAllOptions&&m&&l.push(m),r(()=>`We found a new image that was the best size. (${c.id})`,4),u=c}else i.returnAllOptions&&l.push(c)};r(()=>`The input shows we have ${t.length} list(s) of candidates to choose from.`);let p=t.length;for(let c=0;c<p;c++){let m=t[c]();r(()=>`Candidate group ${c}: ${JSON.stringify(m,null,2)}`,1);let y=m.length;r(()=>`Checking candidate list number ${c} and found ${y} potential ways of creating image(s)`,1);for(let w=0;w<y;w++){let v=m[w];if(r(()=>`-> Checking candidate ${w}`,1),v.type==="unknown"&&i.atAnyCost&&(r(()=>`We've found an unknown image type, adding this to the "last resort" list`,2),s.push(v)),v.type==="fixed"&&(v.unsafe?(r(()=>`We've found an unsafe fixed image type, adding this to the "last resort" list`,2),s.push(v)):(r(()=>"We've found a fixed size image, checking if it matches the request",2),f(v,u))),v.type==="fixed-service")if(i.unsafeImageService){r(()=>"Checking for an image from the tile source, without calculating the right height and width (unsafeImageService)",2);let S=Jc(v,i.width,i.height);f(S,u)}else{r(()=>"Checking for an image from the tile source 3",2);let S=Jc(v,v.width,v.height);f(S,u)}if(v.type==="variable"&&v.maxWidth){let S=Jc({id:v.id,type:"fixed-service",width:v.maxWidth,height:v.maxWidth,level:v.level,version:v.version},v.maxWidth);f(S,u)}}if(u&&!i.returnAllOptions){if(u.unsafe||i.allowUnsafe)continue;r(()=>`We found a match in choice list number ${c}, no searching any more`);break}}return i.atAnyCost&&l.length===0?(r(()=>u?`We found an image! ${u.id} of type ${u.type}`:'We found no images, but "atAnyCost" is set, so returning that'),{best:u||s[0]||null,fallback:s.slice(1),log:n}):i.returnAllOptions?(r(()=>"Returning all options that we have found"),{best:(i.atAnyCost?u||l[0]||s[0]:u||l[0])||null,fallback:[...l,...s],log:n}):(r(()=>"Returning the best image that we found, and a fallback"),{best:u||l[0]||null,fallback:u?l:l.slice(1),log:n})}function Gm(e){return(e["@context"]?Array.isArray(e["@context"])?e["@context"]:[e["@context"]]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1}function Hw(e){return Ja(e)?(e&&e.sizes?e.sizes:[]).map(t=>({id:Xe(e),type:"fixed-service",height:t.height,width:t.width,level:Zc(e),version:Gm(e)?3:2})):[]}function Ww(e){if(!Fw(e))return[];let t=[],n=Array.isArray(e.profile)?e.profile:[e.profile],i=n.length;for(let r=0;r<i;r++){let s=n[r];if(s&&typeof s!="string"&&(s.maxHeight||s.maxWidth))return[{id:Xe(e),type:"variable",minWidth:0,minHeight:0,maxHeight:s.maxHeight||s.maxWidth,maxWidth:s.maxWidth||s.maxHeight,level:Zc(e),version:e["@context"]==="http://iiif.io/api/image/3/context.json"?3:2}]}if(e.tiles){let r=e.tiles.length;for(let s=0;s<r;s++){let l=e.tiles[s];l&&(l.height||l.width)&&t.push({id:Xe(e),type:"variable",minHeight:0,minWidth:0,maxHeight:l.height||l.width,maxWidth:l.width,level:Zc(e),version:Gm(e)?3:2})}}return t}function Um(e){let t=[],n=e.length;for(let i=0;i<n;i++){let r=e[i];if(!r)continue;let s=Hw(r);s.length&&t.push(...s);let l=Ww(r);l.length&&t.push(...l)}return t}function qm(e){let t=/^.*\/(full)\/(((\d+),(\d+)?)|max)\/(\d+)\/default\.(jpg|png|jpeg)$/,n=e.match(t);if(n&&n[4]&&n[5]){let i=n[1],r=parseInt(n[4],10),s=parseInt(n[5],10),l=n[7];if((i==="max"||i==="full")&&r&&s&&l)return{type:"fixed",id:e,height:s,width:r}}return{type:"unknown",id:e}}function el(e){if(typeof e=="string")return qm(e);let t=Dw(e);if(t!=="Image"&&t!=="sc:Image")return null;let n=e,i=Xe(n);return i?i&&n.width&&n.height?{id:i,type:"fixed",width:n.width,height:n.height,unsafe:!0}:qm(i):null}function Uw(e,t=!0,n){let i=[],r=el(e);if(r===null)return i;let s=e;if(i.push(r),t&&s&&s.width&&s.height){let l=[],u=Lr(s);for(let f of u){let p={id:Xe(f),width:s.width,height:s.height};if(n.canLoadSync(p)){let c=n.loadServiceSync(p);c&&(c.height||(c.height=s.height),c.width||(c.width=s.width),l.push(...Um([c])))}}if(l.length)return i.push(...l),i}return s.service&&i.push(...Um(s.service)),i}function qw(e,t){if(e.length!==t.length)return!1;if(e.length===0&&t.length===0)return!0;let n=e.length,i=!0;for(let s=0;s<n;s++){let l=e[s],u=t[s];if(l.width!==u.width||l.height!==u.height){i=!1;break}}if(i)return!0;let r=0;for(let s=0;s<n;s++)for(let l=0;l<n;l++)if(e[s].width===t[l].width&&e[s].height===t[l].height){r++;break}return r===n}var Ns=class{constructor(e={}){Bt(this,"config",{verificationsRequired:1,approximateServices:!1,enableFetching:!0,disableThrottling:!1}),Bt(this,"fetchingCount",0),Bt(this,"imageServices",{}),Bt(this,"knownImageServers",{}),this.config=Object.assign(this.config,e)}setConfig(e){Object.assign(this.config,e)}sample(e,t,n=!0){let i=_o(Xe(e)),r=kr(Xe(e)),s=this.knownImageServers[i];return this.imageServices[r]=Object.assign(e,{real:!0}),!s&&e.tiles&&!Wm(e)?(this.knownImageServers[i]={verifications:0,malformed:!1,root:i,preLoaded:n,sampledId:Xe(e),verified:!1,server:null,result:{context:e["@context"]||[],sampledProfile:e.profile,resourceServiceRatio:t&&e.height?t.height/e.height:1,sampledSizes:e.sizes||[],sizeRatios:Nw(e.width,e.height,e.sizes||[]),sampledTiles:e.tiles||[]}},!0):this.verify(e)}preLoad(e,t=!0){this.knownImageServers[e.root]=e,t&&(this.knownImageServers[e.root].malformed=!1,this.knownImageServers[e.root].verifications=this.config.verificationsRequired)}predict(e,t=!1,n=!1){let i=e?.source,r=_o(Xe(e)),s=this.knownImageServers[r],l=kr(Xe(e));return this.imageServices[l]?this.imageServices[l]||null:!this.config.approximateServices||!s||!s.result||!(i?.height||e.height)||!(i?.width||e.width)||!n&&(s.malformed||s.verifications<this.config.verificationsRequired)||e.source&&Wm(e.source)?null:(this.imageServices[l]||(this.imageServices[l]={"@context":s.result.context,"@id":Xe(e),id:Xe(e),protocol:"http://iiif.io/api/image",tiles:i?.tiles||Bw(e.width,e.height,s.result.sampledTiles),sizes:i?.sizes||zw(Math.round(e.width/s.result.resourceServiceRatio),Math.round(e.height/s.result.resourceServiceRatio),s.result.sizeRatios),profile:i?.profile||s.result.sampledProfile,height:i?.height||e.height,width:i?.width||e.width,real:!1}),this.imageServices[l]||null)}async getThumbnailFromResource(e,t,n=!0,i=[]){let r=e?await this.getImageCandidates(e,n):[];return jw(t,[()=>i,()=>r])}async getImageCandidates(e,t=!0){let n=e;if(t&&n&&n.height&&n.width){let i=Lr(n);for(let r of i){let s={id:Xe(r),width:r.width?r.width:n.width,height:r.height?r.height:n.height,source:r};await this.loadService(s)}}return Uw(e,t,this)}async verify(e){let t=this.predict(e,!1,!0),n=await this.fetchService(Xe(e));if(!t)return!1;let i=t.height===n.height&&t.width===n.width&&t["@context"]===n["@context"]&&qw(t.sizes||[],n.sizes||[]);if(i){let r=_o(Xe(e)),s=this.knownImageServers[r];s&&(s.verifications+=1,s.verifications>=this.config.verificationsRequired&&(s.verified=!0))}return i}canLoadSync(e){let t=typeof e=="string"?e:Xe(e),n=kr(t);if(this.imageServices[n])return!0;let i=this.knownImageServers[_o(t)];return!!(i&&!i.malformed&&i.verifications>=this.config.verificationsRequired)}async markAsMalformed(e){return this.knownImageServers[_o(Xe(e))].malformed=!0,this.loadService(e,!0)}async fetchService(e,t=!1){let n=kr(e),i=this.imageServices[n];if(i&&(!t||i.real))return i;if(!this.config.enableFetching)throw Error("Fetching is not enabled");let r=await this.fetch(n).then(s=>s.json());return!r.id&&r["@id"]&&(r.id=r["@id"]),r.id!==e&&(r.id=e,r["@id"]&&(r["@id"]=e)),this.imageServices[n]=Object.assign(r,{real:!0}),this.imageServices[n]}async fetch(e,t){return fetch(e,t)}async loadService(e,t=!1){if(!this.config.disableThrottling){let r=!0;for(;r;)if(this.fetchingCount>=this.config.verificationsRequired)await new Promise(s=>setTimeout(s,500));else{r=!1;break}}let n=this.knownImageServers[_o(Xe(e))];if(n&&!n.malformed&&!t){await n.result;let r=this.loadServiceSync(e);if(r)return r}this.fetchingCount++;let i=await this.fetchService(Xe(e),t);return this.fetchingCount--,i.real&&this.sample(i,e),i}loadServiceSync(e){let t=kr(Xe(e));return this.imageServices[t]?this.imageServices[t]:this.config.approximateServices?this.predict(e):null}};function Gw(e={}){let t=e.events||ec(),n=e.loader||new Ns;return{store:Ju((r,s)=>({loaded:{},loadServiceSync:(l,u,f)=>{let p=l.id||l["@id"],c=s().loaded[p];if(c&&c.status==="done")return c.service;if(c&&c.status==="loading")return null;if(c&&c.status==="error")throw Error("Failed to load image service");let m={id:Xe(l),width:l.width||u?.width||0,height:l.height||u?.height||0,source:l},y=n.loadServiceSync(m);return y?(r(w=>({loaded:{...w.loaded,[p]:{status:"done",service:y,real:!0}}})),t.emit("image-service.loaded",{id:p,service:y})):f&&s().loadService(l,u).then(()=>{}),y},loadService:async(l,u)=>{let f=l.id||l["@id"],p=s().loaded[f];if(p&&p.status==="done")return p.service;if(p&&p.status==="loading")return new Promise((c,m)=>{let y=w=>{w.id===f&&(t.off("image-service.loaded",y),c(w.service||l))};t.on("image-service.loaded",y)});if(p&&p.status==="error"&&!u?.force)throw Error("Failed to load image service");t.emit("image-service.loading",{id:f});try{let c={id:Xe(l),width:l.width||0,height:l.height||0,source:l},m=await n.loadService(c,u?.force);return r(y=>({loaded:{...y.loaded,[f]:{status:"done",service:m,real:m.real}}})),t.emit("image-service.loaded",{id:f,service:m}),m}catch(c){throw t.emit("image-service.error",{id:f,error:c}),c}}})),events:t}}var $m=Gw();var $w=new Ns;function Qm(e=rr,t={}){let n=t.imageServiceLoader||$w;async function i(r,s,l=!1,u=[],f){let p=()=>n.getThumbnailFromResource(void 0,s,l,u);if(!r)return await n.getThumbnailFromResource(void 0,s,l,u);if(typeof r=="string"){let y=el(r);return y&&u.push(y),await n.getThumbnailFromResource(void 0,s,l,u)}let c=e.get(r,{skipSelfReturn:!1});if(typeof c=="string")return{best:el(c),fallback:[],log:[]};if(!c)return await p();switch(await(async y=>{if(y&&y.thumbnail&&y.thumbnail.length){let w=e.get(y.thumbnail[0]),v=await n.getImageCandidates(w,l);v&&v.length&&u.push(...v)}})(c),c.type){case"Annotation":{let y=Array.isArray(c.body)?c.body:[c.body],w=e.get(y[0]);return f&&!w.width&&(w.width=f.width,w.height=f.height),await n.getThumbnailFromResource(w,s,l,u)}case"Canvas":{let y=c;return i(y.items[0],s,l,u,{width:y.width,height:y.height})}case"AnnotationPage":return i(c.items[0],s,l,u,f);case"Choice":{let y=c;return!y.items||y.items[0]?await p():i(y.items[0],s,l,u,f)}case"Collection":{let y=c,w=y.items[0];return w?i(w,s,l,u,f):await p()}case"Manifest":{let y=c,w=y.items[0];return w?i(w,s,l,u,f):await p()}case"SpecificResource":case"Image":case"Dataset":case"Sound":case"Text":case"TextualBody":case"Video":return f&&!c.width&&(c.width=f.width,c.height=f.height),n.getThumbnailFromResource(c,s,l,u)}return await p()}return{getBestThumbnailAtSize:i}}var cM=A(D(),1),dM=A(Q(),1),ul=A(Q(),1),fM=A(D(),1),hM=A(Q(),1),W1=A(Q(),1),bT=Object.defineProperty,RT=(e,t,n)=>t in e?bT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P=(e,t,n)=>(RT(e,typeof t!="symbol"?t+"":t,n),n),gd=["onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onScroll","onWheel","onClick","onDragStart","onDragEnd","onDragEnter","onDragExit","onDrag","onDragOver","onContextMenu"];function ET(){return gd.reduce((e,t)=>(e[t]=[],e),{})}var Ds=gd.reduce((e,t)=>(e[t.slice(2).toLowerCase()]=t,e[t]=t,e),{}),IT="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",yd=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+=IT[n[e]&63];return t},qi=class{constructor(){P(this,"__id"),P(this,"__revision",0),P(this,"__host"),P(this,"__onCreate"),P(this,"__parent"),P(this,"__owner",{value:void 0}),P(this,"__state",{}),P(this,"eventHandlers"),P(this,"scale",1),P(this,"layers",[]),P(this,"time",[]),P(this,"_crop"),P(this,"cropData"),P(this,"id"),P(this,"addEventListener",(e,t,n)=>{let i=Ds[e];if(!this.eventHandlers[i])throw new Error(`Unknown event ${i}`);this.eventHandlers[i].indexOf(t)===-1&&this.eventHandlers[i].push(t)}),P(this,"removeEventListener",(e,t)=>{let n=Ds[e];if(!this.eventHandlers[n]){console.warn(`Unknown event ${n}`);return}this.eventHandlers[n].indexOf(t)!==-1&&(this.eventHandlers[n]=this.eventHandlers[n].filter(i=>i!==t))}),this.id=this.__id=yd(),this.eventHandlers=ET()}get crop(){return this._crop}set crop(e){this._crop=e}getObjectsAt(e){return[]}getAllPointsAt(e,t,n){return[]}getScheduledUpdates(e,t){return[]}dispatchEvent(e,t){let n=this.eventHandlers[e],i=n?n.length:0,r=!1;if(i)for(let s=0;s<i;s++)try{n[s](t),r=!0}catch(l){console.error(e,l)}return r}get x(){return this.points[1]}get y(){return this.points[2]}get width(){return this.points[3]-this.points[1]}get height(){return this.points[4]-this.points[2]}translate(e,t){hn(this.points,ht(e,t))}atScale(e){hn(this.points,ir(e,this.x,this.y)),this.scale*=e}transform(e){hn(this.points,e)}applyProps(e){this.__revision++}appendChild(e){}removeChild(e){}insertBefore(e,t){}hideInstance(){}},zr=class Km extends qi{constructor(t){if(super(),P(this,"type","spacial-content"),P(this,"id"),P(this,"uri"),P(this,"display"),P(this,"points"),P(this,"priority"),P(this,"style",{opacity:1}),!t)this.id="",this.uri="",this.display={x:0,y:0,scale:1,width:0,height:0,points:me(5)},this.points=me(5);else{let n=t.scale||1;this.id=t.id||t.uri,this.uri=t.uri,this.points=Pe.singleBox(t.width,t.height,t.x,t.y),this.display={x:0,y:0,scale:n,width:t.width/n,height:t.height/n,points:Pe.singleBox(t.width/n,t.height/n),rotation:t?.rotation}}}applyProps(t){let n=t.display?t.display.width:t.target.width,i=t.target.width/n;if(this.id=t.id||t.uri,this.uri=t.uri,this.points.set(Pe.singleBox(t.target.width,t.target.height,t.target.x,t.target.y)),t.style&&typeof t.style.opacity<"u"&&(this.style.opacity=t.style.opacity),t.crop){this.cropData=t.crop;let r=Pe.singleBox(t.crop.width,t.crop.height,t.crop.x,t.crop.y);hn(r,ht(-t.crop.x,-t.crop.y)),this.crop?this.crop.set(r):this.crop=me(r)}t.display?(this.display.scale=i,this.display.width=t.display.width,this.display.height=t.display.height,this.display.rotation=t.display.rotation,this.display.points=Pe.singleBox(t.display.width,t.display.height)):(this.display.scale=i,this.display.width=t.target.width/i,this.display.height=t.target.height/i,this.display.points=Pe.singleBox(t.target.width/i,t.target.height/i))}getAllPointsAt(t,n,i){return[[this,this.crop||this.points,n]]}static fromSvg(t,n,i,r){return Km.fromImage("data:image/svg+xml;base64,"+btoa(t),n,i,r)}static fromImage(t,n,i,r){let s=new Km;return s.applyProps({uri:t,id:r,display:i,target:n}),s}getImageUrl(){return this.uri}},Xm=class extends qi{constructor(e){if(super(),P(this,"type","spacial-content"),P(this,"id"),P(this,"uri"),P(this,"display"),P(this,"points"),P(this,"getTexture"),this.getTexture=()=>({source:void 0,hash:-1}),!e)this.id="",this.uri="",this.display={x:0,y:0,scale:1,width:0,height:0,points:me(5)},this.points=me(5);else{let t=e.scale||1;this.id=e.id||e.uri,this.uri=e.uri,this.points=Pe.singleBox(e.width,e.height),this.display={x:0,y:0,scale:t,width:e.width/t,height:e.height/t,points:t!==1?Pe.singleBox(e.width/t,e.height/t):this.points}}}applyProps(e){let t=e.display?e.display.width:e.target.width,n=e.target.width/t;this.id=e.id,this.points.set(Pe.singleBox(e.target.width,e.target.height)),this.display.scale=n,this.display.width=e.target.width/n,this.display.height=e.target.height/n,this.getTexture=e.getTexture,this.display.points=n!==1?Pe.singleBox(e.target.width/n,e.target.height/n):this.points}getAllPointsAt(e,t,n){return[[this,this.points,t]]}};function CT(e,t,n=1){let i=t.length;if(i===0)throw new Error("No resources passed in.");let r=0,s=1/0;for(let l=0;l<i&&!(!t[l]||!t[l].display);l++){let u=Zm(t[l].display.scale,e/(n||1));u<s&&(s=u,r=l)}return r}function Zm(e,t){return Math.abs(e-t)}function fd(e,t){let n=Zm(e.x,t.x),i=Zm(e.y,t.y);return Math.sqrt(Math.pow(n,2)+Math.pow(i,2))}function PT(e){let t=e.length;return e.indexOf("/info.json")===t-10?e.slice(0,-10):e}function ed(e,t,n){return Math.min(Math.max(e,t),n)}var al=class d1 extends qi{constructor(t){super(),P(this,"id"),P(this,"type","spacial-content"),P(this,"display"),P(this,"tileWidth"),P(this,"style",{opacity:1}),P(this,"points"),P(this,"service"),P(this,"format","jpg"),P(this,"crop2"),P(this,"version3"),P(this,"tileUrl"),this.tileUrl=PT(t.url),this.id=t.id||`${this.tileUrl}--${t.scaleFactor}`,this.points=t.displayPoints?t.displayPoints:Bn(t.points,Dn(t.scaleFactor)),this.tileWidth=t.tileWidth,this.version3=t.version3,this.display={x:0,y:0,width:t.width/t.scaleFactor,height:t.height/t.scaleFactor,points:t.points,scale:t.scaleFactor},t.format&&(this.format=t.format)}applyProps(t){if(t.style&&typeof t.style.opacity<"u"&&(this.style.opacity=t.style.opacity),t.service!==this.service&&(this.service=t.service),t.format?this.format=t.format:this.format="jpg",typeof t.version3<"u"&&(this.version3=t.version3),t.crop){this.cropData=t.crop;let n=me([...this.points]),i=n.length/5,r=t.crop.x||0,s=t.crop.y||0,l=t.crop.x+t.crop.width,u=t.crop.y+t.crop.height;for(let f=0;f<i;f++){let p=f*5;n[p+1]<l&&n[p+3]>r&&n[p+2]<u&&n[p+4]>s?(n[p+1]=ed(n[p+1],r,l),n[p+3]=ed(n[p+3],r,l),n[p+2]=ed(n[p+2],s,u),n[p+4]=ed(n[p+4],s,u)):n[p]=0}hn(n,ht(-t.crop.x,-t.crop.y)),this.crop?this.crop.set(n):this.crop=n}}static fromTile(t,n,i,r,s,l,u,f){i.height=i.height?i.height:i.width;let p=u?Math.floor(n.width/r):Math.ceil(n.width/r),c=u?Math.floor(n.height/r):Math.ceil(n.height/r),m=Math.ceil(p/i.width),y=Math.ceil(c/i.height),w=Pe.grid(m,y),v=Pe.grid(m,y),S=s?s["@context"]?Array.isArray(s["@context"])?s["@context"]:[s["@context"]]:[]:[],E=typeof f<"u"?f:S.indexOf("http://iiif.io/api/image/3/context.json")!==-1;for(let b=0;b<y;b++)for(let I=0;I<m;I++){let M=I*i.width,T=b*i.height;v.addPoints(M*r,T*r,I===m-1?n.width:(M+i.width)*r,b===y-1?n.height:(T+i.height)*r),w.addPoints(M,T,I===m-1?p:M+i.width,b===y-1?c:T+i.height)}let R=new d1({url:t,scaleFactor:r,points:w.build(),displayPoints:v.build(),width:n.width,height:n.height,tileWidth:i.width,format:l,version3:E});return R.applyProps({service:s}),R}getImageUrl(t){let n=this.points.slice(t*5,t*5+5),i=n[3]-n[1],r=n[4]-n[2],s=Math.ceil(i/this.display.scale),l=Math.ceil(r/this.display.scale),u=`${s>this.tileWidth?this.tileWidth:s},`;return this.version3&&(u+=`${l>this.tileWidth?this.tileWidth:l}`),`${this.tileUrl}/${n[1]},${n[2]},${i},${r}/${u}/0/default.${this.format||"jpg"}`}getAllPointsAt(t,n,i){let r=Mr(this.crop||this.points,t);return[[this,r,n]]}transform(t){hn(this.points,t)}getScheduledUpdates(t,n){return[]}},AT=class extends qi{constructor(){super(...arguments),P(this,"type","spacial-content")}getAllPointsAt(e,t,n){return[[this,this.points,t]]}},TT=class extends AT{constructor(e){super(),P(this,"id"),P(this,"display"),P(this,"points"),P(this,"images",[]),P(this,"allImages",[]),P(this,"scaleFactors",[]),P(this,"aggregateBuffer",me(9)),P(this,"lazyLoader"),P(this,"isFullyLoaded",!1),P(this,"maxScaleFactor",0),P(this,"renderOptions"),P(this,"_scheduleSortByScales",!1),P(this,"_sortByScales",()=>{this._scheduleSortByScales=!1,this.allImages.sort((n,i)=>i.display.width-n.display.width),this.images=[];let t=.1;for(let n of this.allImages)if(!(n.display.width<this.renderOptions.minSize&&n.display.height<this.renderOptions.minSize&&!n.priority||n instanceof zr&&(n.display.width>this.renderOptions.maxImageSize||n.display.height>this.renderOptions.maxImageSize)&&!n.priority)){if(Math.abs(n.display.scale-t)<.25||n.priority){let i=this.images.pop();i&&(i instanceof zr||i.priority)?(n.priority&&this.images.push(n),this.images.push(i)):n&&this.images.push(n)}else n&&this.images.push(n);t=n.display.scale}this.images.length===0&&(this.images=[...this.allImages]),this.scaleFactors=this.images.map(n=>n.display.scale),this.maxScaleFactor=Math.max(...this.scaleFactors)}),P(this,"loadFullResource",async()=>{if(!this.isFullyLoaded&&this.lazyLoader){this.isFullyLoaded=!0;let t=await this.lazyLoader();this.addImages(t)}}),P(this,"fallback",[this.loadFullResource]),this.id=e.id,this.points=Pe.singleBox(e.width,e.height),this.lazyLoader=e.loadFullImages,e.loadFullImages||(this.isFullyLoaded=!0),this.display={x:0,y:0,points:Pe.singleBox(e.width,e.height),height:e.height,width:e.width,scale:1},this.renderOptions={renderSmallestFallback:!0,renderLayers:3,minSize:255,maxImageSize:2048,quality:1.5,...e.renderOptions||{}},this.addImages(e.images)}applyProps(e){typeof e.renderSmallestFallback<"u"&&e.renderSmallestFallback!==this.renderOptions.renderSmallestFallback&&(this.renderOptions.renderSmallestFallback=e.renderSmallestFallback),typeof e.renderLayers<"u"&&e.renderLayers!==this.renderOptions.renderLayers&&(this.renderOptions.renderLayers=e.renderLayers),typeof e.minSize<"u"&&e.minSize!==this.renderOptions.minSize&&(this.renderOptions.minSize=e.minSize),typeof e.maxImageSize<"u"&&e.maxImageSize!==this.renderOptions.maxImageSize&&(this.renderOptions.maxImageSize=e.maxImageSize),typeof e.quality<"u"&&e.quality!==this.renderOptions.quality&&(this.renderOptions.quality=e.quality)}appendChild(e){this.addImages([e])}removeChild(e){this.images.indexOf(e)!==-1&&(this.images=this.images.filter(t=>t!==e),this.sortByScales())}insertBefore(e,t){this.addImages([e])}hideInstance(){}addImages(e){for(let t of e)t.__parent=this,t.__owner=this.__owner;this.allImages.push(...e.filter(Boolean)),this.sortByScales()}sortByScales(){this._scheduleSortByScales=!0}getScheduledUpdates(e,t){return this._scheduleSortByScales?[this._sortByScales]:this.isFullyLoaded?[]:t>1/this.maxScaleFactor?this.fallback:[]}getAllPointsAt(e,t,n){if(this.images.length===0)return[];let i=CT(1/(n||1)/(window.devicePixelRatio||1),this.images,this.renderOptions.quality),r=this.images.length,s=t?An(t,ht(this.x,this.y)):ht(this.x,this.y);if(i!==this.images.length-1&&this.images[i+1]){let l=[];for(let p=r-1;p>=i;p--)l.push(p);let u=l[0];this.renderOptions.renderLayers&&(l=l.slice(-Math.min(l.length,this.renderOptions.renderLayers))),this.renderOptions.renderSmallestFallback&&l.indexOf(u)===-1&&l.unshift(u);let f=[];for(let p=0;p<l.length;p++)f.push(...this.images[l[p]].getAllPointsAt(e,s,n));return f}return this.images[i].getAllPointsAt(e,s,n)}};function td(e,t,n,i,r){let s=Math.PI/180*r,l=Math.cos(s),u=Math.sin(s),f=l*(n-e)+u*(i-t)+e,p=l*(i-t)-u*(n-e)+t;return[f,p]}var ng=class f1 extends qi{constructor(t,n){super(),P(this,"id"),P(this,"type","world-object"),P(this,"scale"),P(this,"layers"),P(this,"points"),P(this,"worldPoints"),P(this,"intersectionBuffer",me(5)),P(this,"aggregateBuffer",me(9)),P(this,"invertedBuffer",me(9)),P(this,"rotation",0),P(this,"filteredPointsBuffer"),P(this,"_updatedList",[]),P(this,"geometry");let{x:i=0,y:r=0}=n||{};t?(this.id=t.id||"",this.scale=1,this.layers=t.layers,this.points=me([1,i,r,i+t.width,r+t.height]),this.worldPoints=me([1,i,r,i+t.width,r+t.height]),this.filteredPointsBuffer=me(t.layers.length*5)):(this.id="",this.scale=1,this.layers=[],this.points=me(5),this.worldPoints=me(5),this.filteredPointsBuffer=me(5))}static createWithProps(t){let n=new f1;return n.applyProps(t),n}applyProps(t){let n=t.x||0,i=t.y||0;this.id=t.id;let r=typeof t.scale<"u"?t.scale:this.scale;this.points[0]=1,this.points[1]=n,this.points[2]=i,this.points[3]=n+t.width,this.points[4]=i+t.height,this.rotation=t.rotation||0,this.worldPoints[3]=this.worldPoints[1]+t.width,this.worldPoints[4]=this.worldPoints[2]+t.height,t.scale&&t.scale!==1&&this.atScale(r),this.scale=r}appendChild(t){t.points[0]===0&&t.points.set(this.points),t.__owner.value=this,this.addLayers([t])}removeChild(t){this.layers=this.layers.filter(n=>n!==t),this.filteredPointsBuffer=me(this.layers.length*5)}insertBefore(t,n){let i=this.layers.indexOf(n);if(i===-1||this.layers.indexOf(t)!==-1)return;let r=this.layers.slice(0,i),s=this.layers.slice(i);this.layers=[...r,t,...s]}hideInstance(){console.warn("hideInstance: not yet implemented")}getObjectsAt(t,n){if(this.rotation&&(t=this.applyRotation(t)),Mr(this.points,t,this.filteredPointsBuffer)[0]===0)return[];let i=this.layers.length,r=[];for(let s=0;s<i;s++){let l=this.layers[s];if(n&&l.isShape){let u=Bn(l.points,ht(this.x,this.y));if(!l.intersects([t[1]-u[1],t[2]-u[2]]))continue}if(Mr(Bn(l.points,ht(this.x,this.y)),t,this.filteredPointsBuffer)[0]!==0&&r.push(l),n){let u=l;r.push(...u.getObjectsAt(t,n))}}return r}applyRotation(t){if(this.rotation){let n={x:t[1],y:t[2]},i={x:t[1],y:t[4]},r={x:t[3],y:t[2]},s={x:t[3],y:t[4]},l=this.points[1]+(this.points[3]-this.points[1])/2,u=this.points[2]+(this.points[4]-this.points[2])/2,[f,p]=td(l,u,n.x,n.y,this.rotation),[c,m]=td(l,u,i.x,i.y,this.rotation),[y,w]=td(l,u,r.x,r.y,this.rotation),[v,S]=td(l,u,s.x,s.y,this.rotation),E=Math.min(f,c,y,v),R=Math.max(f,c,y,v),b=Math.min(p,m,w,S),I=Math.max(p,m,w,S);return me([t[0],E,b,R,I])}return t}getAllPointsAt(t,n,i){let r=An(ht(this.x,this.y),Dn(this.scale),this.aggregateBuffer);this.rotation&&(t=this.applyRotation(t));let s=p0(t,this.points,this.intersectionBuffer),l=this.layers.length,u=[],f=Bn(s,An(Dn(1/this.scale),ht(-this.x,-this.y),this.invertedBuffer)),p=n?An(n,r,this.aggregateBuffer):r,c=i*this.scale;for(let m=0;m<l;m++)u.push(...this.layers[m].getAllPointsAt(f,p,c));return u}addLayers(t){let n=[];for(let i of t)this.layers.indexOf(i)===-1&&(n.push(i),i.points.length===5&&(i.points[1]<this.worldPoints[1]/this.scale||i.points[2]<this.worldPoints[2]/this.scale||i.points[3]>this.worldPoints[3]/this.scale||i.points[4]>this.worldPoints[4]/this.scale)&&(i.crop=i.crop||me([1,Math.max(this.worldPoints[1]/this.scale,i.points[1]),Math.max(this.worldPoints[2]/this.scale,i.points[2]),Math.min(this.worldPoints[3]/this.scale,i.points[3]),Math.min(this.worldPoints[4]/this.scale,i.points[4])])));this.layers=this.layers.concat(n),this.filteredPointsBuffer=me(this.layers.length*5)}getScheduledUpdates(t,n){let i=this.layers.length;this._updatedList=[];let r=n*this.scale;for(let s=0;s<i;s++){let l=this.layers[s].getScheduledUpdates(t,r);l&&this._updatedList.push(...l)}return this._updatedList}},vd=class h1 extends qi{constructor(t=0,n=0,i=100,r="left-to-right"){super(),P(this,"id","world"),P(this,"_width"),P(this,"_height"),P(this,"aspectRatio"),P(this,"viewingDirection"),P(this,"aggregateBuffer",me(9)),P(this,"isDirty",!1),P(this,"zones",[]),P(this,"filteredPointsBuffer"),P(this,"selectedZone"),P(this,"triggerQueue",[]),P(this,"activatedEvents",[]),P(this,"_updatedList",[]),P(this,"translationBuffer",me(9)),P(this,"needsRecalculate",!0),P(this,"emptyPaintables",[]),P(this,"renderOrder",[]),P(this,"points"),P(this,"objects",[]),P(this,"subscriptions",[]),P(this,"_propagateEventTargets",[]),P(this,"_alreadyFlushed",[]),this._width=t,this._height=n,this.aspectRatio=Number.isNaN(t/n)?1:t/n,this.viewingDirection=r,this.points=me(i*5),this.filteredPointsBuffer=me(i*5)}get x(){return 0}get y(){return 0}get width(){return this._width}get height(){return this._height}static withProps(t){let n=new h1;return n.applyProps(t),n}applyProps(t){typeof t.width<"u"&&typeof t.height<"u"&&(t.width!==this._width||t.height!==this._height)&&this.resize(t.width,t.height),t.viewingDirection!==this.viewingDirection&&(this.viewingDirection=t.viewingDirection,this.triggerRepaint())}propagateTouchEvent(t,n,i){let r=[];for(let s of i)if(s.x&&s.y){let l=Pe.singleBox(1,1,s.x,s.y);r.push(this.getObjectsAt(l,!0).reverse())}return r.map(s=>this.propagateEvent(t,n,s,{bubbles:!0,cancelable:!0}))}propagatePointerEvent(t,n,i,r,s={}){let l=Pe.singleBox(1,1,i,r),u=this.getObjectsAt(l,!0).reverse();return this.propagateEvent(t,n,u,s)}propagateEvent(t,n,i,{bubbles:r=!1,cancelable:s=!1}={}){n.atlasTarget=this,this._propagateEventTargets.length=1,this._propagateEventTargets[0]=this;let l=!1;n.stopPropagation=()=>{l=!0};let u=i.length;for(let c=u-1;c>=0;c--){this._propagateEventTargets.unshift(i[c][0]);let m=i[c][1].length;if(m)for(let y=0;y<m;y++)this._propagateEventTargets.unshift(i[c][1][y])}let f=this._propagateEventTargets.length,p=!1;for(let c=0;c<f&&(n.atlasTarget=this._propagateEventTargets[c],n.atlasWorld=this,p=this._propagateEventTargets[c].dispatchEvent(t,n)||p,!l);c++);return p&&this.triggerRepaint(),this._propagateEventTargets}appendChild(t){let n=this.appendWorldObject(t);this.renderOrder.push(n/5)}removeChild(t){let n=this.objects.indexOf(t);if(n===-1){for(let i of this.objects)if(i&&i.id===t.id){this.removeChild(i);return}return}this.objects[n]=null,this.renderOrder=this.renderOrder.filter(i=>i!==n),this.points[n*5]=0,this.triggerRepaint(),this.needsRecalculate=!0}insertBefore(t,n){let i=this.objects.indexOf(n);if(i===-1)return;let r=this.appendWorldObject(t);this.renderOrder.splice(i-1,0,r/5)}hideInstance(){}asWorldObject(){return null}addZone(t){this.zones.push(t)}selectZone(t){if(typeof t=="string"){let n=this.zones.length;for(let i=0;i<n;i++)if(this.zones[i].id===t){this.selectedZone=i,this.trigger("zone-changed");return}}else this.zones[t]&&(this.selectedZone=t,this.trigger("zone-changed"))}deselectZone(){this.selectedZone=void 0}getActiveZone(){if(this.selectedZone)return this.zones[this.selectedZone]}hasActiveZone(){return typeof this.selectedZone<"u"}checkResizeInternalBuffer(){if(m0(this.points)===this.objects.length){let t=this.points,n=me(this.points.length*2);n.set(t,0),this.points=n}}appendWorldObject(t){this.checkResizeInternalBuffer();let n=this.objects.length*5,i=t.points;return t.points=this.points.subarray(this.objects.length*5,this.objects.length*5+5),t.points[1]=i[1],t.points[2]=i[2],t.points[3]=i[3],t.points[4]=i[4],this.objects.push(t),this.filteredPointsBuffer=me(this.objects.length*5),this.needsRecalculate=!0,this.triggerRepaint(),n}recalculateWorldSize(){let t=!1;if(this.needsRecalculate){let n=new Int32Array(this.objects.length),i=new Int32Array(this.objects.length),r=this.renderOrder.length;for(let u=0;u<r;u++){let f=this.renderOrder[u];this.objects[f]&&(n[u]=this.points[f*5+3],i[u]=this.points[f*5+4])}let s=Math.max(...n);s!==this._width&&(this._width=s,t=!0);let l=Math.max(...i);l!==this._height&&(this._height=l,t=!0),t&&this.trigger("recalculate-world-size",{width:s,height:l}),this.needsRecalculate=!1}return t}addObjectAt(t,n){n.width&&!n.height?n.height=n.width/t.width*t.height:n.height&&!n.width&&(n.width=n.height/t.height*t.width),(!n||!n.width||!n.height)&&(n.width=t.width,n.height=t.height);let{width:i,x:r,y:s}=n,l=i/t.width;this.checkResizeInternalBuffer(),this.points.set(Pe.singleBox(t.width,t.height,0,0),this.objects.length*5);let u=new ng(t);return u.points=this.points.subarray(this.objects.length*5,this.objects.length*5+5),this.objects.push(u),this.scaleWorldObject(this.objects.length-1,l),this.translateWorldObject(this.objects.length-1,r,s),this.filteredPointsBuffer=me(this.points.length*2),this.triggerRepaint(),this.needsRecalculate=!0,u}scaleWorldObject(t,n){hn(this.points.subarray(t*5,t*5+5),ir(n,this.points[t*5+1],this.points[t*5+2]));let i=this.objects[t];i&&(i.atScale(n),this.triggerRepaint())}translateWorldObject(t,n,i){hn(this.points.subarray(t*5,t*5+5),ht(n,i));let r=this.objects[t];r&&(r.translate(n,i),this.triggerRepaint())}resize(t,n){return this._width=t,this._height=n,this.aspectRatio=t/n,this.triggerRepaint(),this}getObjects(){return this.objects}getPoints(){return this.points}getPointsFromViewer(t,n){let i=Pe.singleBox(t.width,t.height,t.x,t.y);return this.getPointsAt(i,n,t.scale)}addLayoutSubscriber(t){return this.subscriptions.push(t),()=>{this.subscriptions.splice(this.subscriptions.indexOf(t),1)}}getScheduledUpdates(t,n){let i=Mr(this.points,t,this.filteredPointsBuffer),r=this.objects.length;this._updatedList=[];for(let s=0;s<r;s++)if(i[s*5]!==0){if(!this.objects[s])continue;this._updatedList.push(...this.objects[s].getScheduledUpdates(t,n))}return this._updatedList}getObjectsAt(t,n=!1){let i=this.getActiveZone(),r=Mr(this.points,t,this.filteredPointsBuffer),s=this.renderOrder.length,l=[];for(let u=0;u<s;u++){let f=this.renderOrder[u];if(r[f*5]!==0){let p=this.objects[f];if(!p||i&&i.objects.indexOf(p)===-1)continue;if(p.type!=="world-object"){l.push([p,[p]]);continue}n?l.push([p,p.getObjectsAt(t,n)]):l.push([p,this.emptyPaintables])}}return l}getPointsAt(t,n,i=1){let r=this.getObjectsAt(t),s=An(Dn(i),ht(-t[1],-t[2]),this.translationBuffer),l=n?An(n,s,this.aggregateBuffer):s,u=r.length,f=[];for(let p=0;p<u;p++)r[p]&&f.push(...r[p][0].getAllPointsAt(t,l,i));return f}flushSubscriptions(){if(this.triggerQueue.length){this._alreadyFlushed=[];let t=this.triggerQueue.length;for(let n=0;n<t;n++){if(this._alreadyFlushed.indexOf(this.triggerQueue[n][0])!==-1)continue;typeof this.triggerQueue[n][1]>"u"&&this._alreadyFlushed.push(this.triggerQueue[n][0]);let i=this.subscriptions.length;for(let r=0;r<i;r++)this.subscriptions[r].apply(null,this.triggerQueue[n])}this.triggerQueue=[]}}trigger(t,n){this.triggerQueue.push([t,n])}triggerEventActivation(){this.trigger("event-activation")}triggerRepaint(){this.trigger("repaint")}gotoRegion(t){this.trigger("goto-region",t)}goHome(t=!1){this.trigger("go-home",{immediate:t})}zoomTo(t,n,i){this.trigger("zoom-to",{point:n,factor:t,stream:i})}zoomIn(t){this.trigger("zoom-to",{point:t,factor:.5})}zoomOut(t){this.trigger("zoom-to",{point:t,factor:2})}constraintBounds(t){this.trigger("constrain-bounds",{immediate:t})}};var nd=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,id={},MT=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"],il=class extends qi{constructor(){super(),P(this,"id"),P(this,"type","spacial-content"),P(this,"points"),P(this,"hoverEvents",!1),P(this,"activeEvents",!1),P(this,"display",{x:0,y:0,scale:1,width:-1,height:-1,points:me(5)}),P(this,"_parsed",{border:{id:null,match:[]},outline:{id:null,match:[]}}),P(this,"hovering"),P(this,"pressing"),P(this,"props",{}),P(this,"addHover",()=>{this.hovering=!0,this.__revision++}),P(this,"removeHover",()=>{this.hovering=!1,this.pressing=!1,this.__revision++}),P(this,"addPress",()=>{this.pressing=!0,this.__revision++}),P(this,"removePress",()=>{this.pressing=!1,this.__revision++}),this.id=yd(12),this.points=me(5)}getAllPointsAt(e,t){return[[this,this.points,t]]}applyProps(e={}){let t=!1;if(e.interactive!==this.props.interactive&&(t=!0,this.props.interactive=e.interactive),e.style){let n=e.border||e.style.border;if(n!==this._parsed.border.id)if(!n)this._parsed.border.id=null,this._parsed.border.match=[];else{let i=id[n]||nd.exec(n)||nd.exec(n);i&&(this._parsed.border.id=n,this._parsed.border.match=id[n]=i)}if(this._parsed.border.id&&(e.style.borderWidth=this._parsed.border.match[1],e.style.borderStyle="solid",e.style.borderColor=this._parsed.border.match[4]),e.style.outline!==this._parsed.outline.id)if(!e.style.outline)this._parsed.outline.id=null,this._parsed.outline.match=[];else{let i=id[e.style.outline]||nd.exec(e.style.outline)||nd.exec(e.style.outline);i&&(this._parsed.outline.id=e.style.outline,this._parsed.outline.match=id[e.style.outline]=i)}this._parsed.outline.id&&(e.style.outlineWidth=this._parsed.outline.match[1],e.style.outlineStyle="solid",e.style.outlineColor=this._parsed.outline.match[4]),this.props.style=e.style,e.backgroundColor&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=e.backgroundColor,t=!0),e.style.background&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=e.style.background,t=!0);for(let i of MT)if(this.props.style[i]!==e.style[i]){t=!0;break}e.style[":hover"]!==this.props.hoverStyles&&(this.props.hoverStyles=e.style[":hover"],this.hoverEvents||(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),t=!0),e.style[":active"]!==this.props.pressStyles&&(this.props.pressStyles=e.style[":active"],this.activeEvents||(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),t=!0)}e.href!==this.props.href&&(this.props.href=e.href,t=!0),e.hrefTarget!==this.props.hrefTarget&&(this.props.hrefTarget=e.hrefTarget,t=!0),e.title!==this.props.title&&(this.props.title=e.title,t=!0),e.className!==this.props.className&&(this.props.className=e.className,e.className&&!this.hoverEvents&&(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),e.className&&!this.activeEvents&&(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),t=!0),e.relativeSize!==this.props.relativeSize&&(this.props.relativeSize=e.relativeSize,t=!0),e.relativeStyle!==this.props.relativeStyle&&(this.props.relativeStyle=e.relativeStyle,t=!0),e.html!==this.props.html&&(this.props.html=e.html,t=!0),e.target&&(e.target.width!==this.display.width||e.target.height!==this.display.height||e.target.x!==this.points[1]||e.target.y!==this.points[2])&&(t=!0,this.points=Pe.singleBox(e.target.width,e.target.height,e.target.x,e.target.y),this.display.points=Pe.singleBox(e.target.width,e.target.height,e.target.x,e.target.y),this.display.width=e.target.width,this.display.height=e.target.height),t&&this.__revision++}},cd=class extends qi{constructor(){super(),P(this,"type","spacial-content"),P(this,"id"),P(this,"points"),P(this,"color","#000"),P(this,"backgroundColor"),P(this,"hovering"),P(this,"pressing"),P(this,"text",""),P(this,"display",{x:0,y:0,scale:1,width:100,height:100,points:me(5)}),P(this,"className"),P(this,"html"),P(this,"interactive",!1),P(this,"props",{font:"18px Arial, sans-serif",lineHeight:1,textAlign:"left",verticalAlign:"top",paddingX:0,paddingY:0,fitParent:!1,lineBreak:"auto",strokeText:!1,sizeToFill:!1,maxFontSizeToFill:void 0,allowNewLine:!0,justifyLines:!1,renderHDPI:!1,textDecoration:"none",interactive:!1,relativeSize:!1}),this.id="",this.points=me(5)}getAllPointsAt(e,t){return[[this,this.points,t]]}applyProps({id:e,target:t,text:n,color:i,backgroundColor:r,fontSize:s=18,interactive:l,fontFamily:u="Arial, sans-serif",...f}){f.font=`${s}px ${u}`,this.interactive=l||!1,typeof n<"u"&&(this.text=n||""),i&&(this.color=i),r&&(this.backgroundColor=r),e&&(this.id=e),t&&(this.points=Pe.singleBox(t.width,t.height,t.x,t.y),this.display.points=this.points,this.display.width=t.width,this.display.height=t.height),this.props={...this.props,...f},this.__revision++}},pt=Math.pow,rd=Math.sqrt,tl=Math.sin,Xw=Math.cos,rl=Math.PI,hd=1.70158,od=hd*1.525,Zw=hd+1,Jw=2*rl/3,e1=2*rl/4.5,sd=function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},Nr={linear:e=>e,easeInQuad:function(e){return e*e},easeOutQuad:function(e){return 1-(1-e)*(1-e)},easeInOutQuad:function(e){return e<.5?2*e*e:1-pt(-2*e+2,2)/2},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return 1-pt(1-e,3)},easeInOutCubic:function(e){return e<.5?4*e*e*e:1-pt(-2*e+2,3)/2},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1-pt(1-e,4)},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-pt(-2*e+2,4)/2},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1-pt(1-e,5)},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1-pt(-2*e+2,5)/2},easeInSine:function(e){return 1-Xw(e*rl/2)},easeOutSine:function(e){return tl(e*rl/2)},easeInOutSine:function(e){return-(Xw(rl*e)-1)/2},easeInExpo:function(e){return e===0?0:pt(2,10*e-10)},easeOutExpo:function(e){return e===1?1:1-pt(2,-10*e)},easeInOutExpo:function(e){return e===0?0:e===1?1:e<.5?pt(2,20*e-10)/2:(2-pt(2,-20*e+10))/2},easeInCirc:function(e){return 1-rd(1-pt(e,2))},easeOutCirc:function(e){return rd(1-pt(e-1,2))},easeInOutCirc:function(e){return e<.5?(1-rd(1-pt(2*e,2)))/2:(rd(1-pt(-2*e+2,2))+1)/2},easeInBack:function(e){return Zw*e*e*e-hd*e*e},easeOutBack:function(e){return 1+Zw*pt(e-1,3)+hd*pt(e-1,2)},easeInOutBack:function(e){return e<.5?pt(2*e,2)*((od+1)*2*e-od)/2:(pt(2*e-2,2)*((od+1)*(e*2-2)+od)+2)/2},easeInElastic:function(e){return e===0?0:e===1?1:-pt(2,10*e-10)*tl((e*10-10.75)*Jw)},easeOutElastic:function(e){return e===0?0:e===1?1:pt(2,-10*e)*tl((e*10-.75)*Jw)+1},easeInOutElastic:function(e){return e===0?0:e===1?1:e<.5?-(pt(2,20*e-10)*tl((20*e-11.125)*e1))/2:pt(2,-20*e+10)*tl((20*e-11.125)*e1)/2+1},easeInBounce:function(e){return 1-sd(1-e)},easeOutBounce:sd,easeInOutBounce:function(e){return e<.5?(1-sd(1-2*e))/2:(1+sd(2*e-1))/2}},_T=class{constructor(e){P(this,"runtime"),P(this,"pendingTransition"),P(this,"lastZoomTo",null),P(this,"isConstraining",!1),P(this,"lastGoToRegion",null),this.runtime=e,this.pendingTransition={from:me(5),to:me(5),elapsed_time:0,done:!0,total_time:0,timingFunction:Nr.easeInOutQuad,constrain:!1}}hasPending(){return!this.pendingTransition.done}getPendingTransition(){return this.pendingTransition}getPendingFrom(){return this.pendingTransition.from}customTransition(e){e(this.pendingTransition)}stopTransition(){this.pendingTransition.from=me(this.runtime.target),this.pendingTransition.to=me(this.runtime.target),this.pendingTransition.done=!0,this.pendingTransition.elapsed_time=0,this.pendingTransition.total_time=0}runTransition(e,t){if(!this.pendingTransition.done){let n=this.pendingTransition,i=n.total_time===0?0:(n.elapsed_time+t)/n.total_time,r=n.total_time===0?1:i===0?0:n.timingFunction(i);e[1]=n.from[1]+(n.to[1]-n.from[1])*r,e[2]=n.from[2]+(n.to[2]-n.from[2])*r,e[3]=n.from[3]+(n.to[3]-n.from[3])*r,e[4]=n.from[4]+(n.to[4]-n.from[4])*r,this.pendingTransition.elapsed_time+=t,this.pendingTransition.elapsed_time>=this.pendingTransition.total_time&&(this.pendingTransition.done=!0,this.pendingTransition.callback?.(),this.pendingTransition.constrain&&this.constrainBounds({transition:{duration:this.pendingTransition.total_time===0?0:500,easing:Nr.easeOutExpo}}))}}resumeTransition(){this.lastZoomTo&&this.zoomTo(this.lastZoomTo.factor,this.lastZoomTo.options),this.isConstraining&&this.constrainBounds(),this.lastGoToRegion&&this.goToRegion(this.lastGoToRegion.target,this.lastGoToRegion.options)}zoomTo(e,t={}){let{origin:n,stream:i=!1,transition:r}=t;this.lastZoomTo={factor:e,options:t};let s=this.runtime.getZoomedPosition(e,{origin:n}),l=Math.abs(1-e);this.applyTransition(s,r,{duration:2e3*l,easing:Nr.easeOutExpo,constrain:!0,callback:()=>{this.lastZoomTo=null}},{stream:!1})}constrainBounds({transition:e,panPadding:t=0}={}){this.isConstraining=!0;let[n,i]=this.runtime.constrainBounds(this.runtime.target,{panPadding:t});n&&(this.applyTransition(i,e,{duration:500,easing:Nr.easeOutQuart,constrain:!1,callback:()=>{this.isConstraining=!1}}),this.runtime.updateNextFrame())}applyTransition(e,t,n,{stream:i}={}){this.pendingTransition.from=me(this.runtime.target),this.pendingTransition.to=e,i||(this.pendingTransition.elapsed_time=0),this.pendingTransition.done=!1,this.pendingTransition.total_time=typeof t?.duration<"u"?t.duration:typeof n?.duration<"u"?n.duration:1e3,this.pendingTransition.constrain=typeof t?.constrain<"u"?t.constrain:typeof n?.constrain<"u"?n.constrain:!1,this.pendingTransition.timingFunction=t?.easing||n?.easing||Nr.easeInOutSine}goToRegion(e,{transition:t}={}){this.lastGoToRegion={target:e,options:{transition:t}};let n=this.runtime.clampRegion(e);this.applyTransition(Pe.singleBox(n.width,n.height,n.x,n.y),t,{duration:1e3,easing:Nr.easeOutExpo,constrain:!0,callback:()=>{this.lastGoToRegion=null}}),this.runtime.updateNextFrame()}},rN=Number.MIN_VALUE+1,xd=class{constructor(e,t,n,i=[],r){P(this,"id",yd()),P(this,"ready",!1),P(this,"renderer"),P(this,"world"),P(this,"target"),P(this,"homePosition"),P(this,"manualHomePosition"),P(this,"manualFocalPosition"),P(this,"focalPosition"),P(this,"transitionManager"),P(this,"aggregate"),P(this,"transformBuffer",me(500)),P(this,"lastTarget",me(5)),P(this,"zoomBuffer",me(5)),P(this,"logNextRender",!1),P(this,"pendingUpdate",!0),P(this,"isCommitting",!1),P(this,"firstRender",!0),P(this,"lastTime"),P(this,"stopId"),P(this,"mode","explore"),P(this,"controllers",[]),P(this,"controllersRunning",!1),P(this,"controllerStopFunctions",[]),P(this,"maxScaleFactor",1),P(this,"_viewerToWorld",{x:0,y:0}),P(this,"_lastGoodScale",1),P(this,"hooks",{useFrame:[],useBeforeFrame:[],useAfterPaint:[],useAfterFrame:[]}),P(this,"fpsLimit"),P(this,"options"),P(this,"hookOptions",{filters:{grayscale:0,contrast:0,brightness:0,saturate:0,sepia:0,invert:0,hueRotate:0,blur:0}}),P(this,"_viewport",{x:0,y:0,width:0,height:0}),P(this,"setViewport",s=>{let l=Math.round(typeof s.x>"u"?this.target[1]:s.x),u=Math.round(typeof s.y>"u"?this.target[2]:s.y);s.width?this.target[3]=l+s.width:this.target[3]=this.target[3]-this.target[1]+l,s.height?this.target[4]=u+s.height:this.target[4]=this.target[4]-this.target[2]+u,Math.abs(this.target[1]-l)>.01&&(this.target[1]=l),Math.abs(this.target[2]-u)>.01&&(this.target[2]=u),this.pendingUpdate=!0}),P(this,"render",s=>{let l=s-this.lastTime;if(this.isCommitting||this.fpsLimit&&l<1e3/this.fpsLimit){this.stopId=window.requestAnimationFrame(this.render);return}this.lastTime=s,this.world.flushSubscriptions(),this.stopId=window.requestAnimationFrame(this.render),this.hook("useFrame",l);let u=this.pendingUpdate,f=this.renderer.pendingUpdate();if(this.transitionManager.hasPending()&&(this.transitionManager.runTransition(this.target,l),this.pendingUpdate=!0,this.updateControllerPosition()),!this.firstRender&&!u&&!f&&this.target[0]===this.lastTarget[0]&&this.target[1]===this.lastTarget[1]&&this.target[2]===this.lastTarget[2]&&this.target[3]===this.lastTarget[3]&&this.target[4]===this.lastTarget[4])return;this.hook("useBeforeFrame",l),this.renderer.beforeFrame(this.world,l,this.target,this.hookOptions);let p=this.getScaleFactor(),c=this.renderer.getPointsAt(this.world,this.target,this.aggregate,p),m=c.length;for(let v=0;v<m;v++){let S=c[v][0],E=c[v][1],R=c[v][2],b=R?Bn(E,R,this.transformBuffer):E;this.renderer.prepareLayer(S,S.__parent&&R?Bn(S.__parent.crop||S.__parent.points,R):b);let I=b.length/5;for(let M=0;M<I;M++){let T=M*5;b[T]!==0&&(this.renderer.paint(S,M,b[T+1],b[T+2],b[T+3]-b[T+1],b[T+4]-b[T+2]),this.hook("useAfterPaint",S))}this.renderer.finishLayer(S,E)}this.renderer.afterFrame(this.world,l,this.target,this.hookOptions),this.hook("useAfterFrame",l),this.lastTarget[0]=this.target[0],this.lastTarget[1]=this.target[1],this.lastTarget[2]=this.target[2],this.lastTarget[3]=this.target[3],this.lastTarget[4]=this.target[4],this.firstRender=!1,this.pendingUpdate=!1,this.logNextRender=!1,this.renderer.isReady()&&(this.ready=!0,this.world.trigger("ready")),this.world.flushSubscriptions();let y=this.world.getScheduledUpdates(this.target,p),w=y.length;if(w>0)for(let v=0;v<w;v++){let S=y[w-v-1]();S?S.then(()=>{this.pendingUpdate=!0}):this.pendingUpdate=!0}}),this.renderer=e,this.world=t,this.options={maxOverZoom:1,maxUnderZoom:1,visibilityRatio:1.5,...r||{}},this.target=Pe.projection(n),this.manualHomePosition=!1,this.pendingUpdate=!0,this.homePosition=Pe.projection(this.world),this.manualFocalPosition=!1,this.focalPosition=this.target,this.updateFocalPosition(),this.transitionManager=new _T(this),this.aggregate=Dn(1),this.world.addLayoutSubscriber(s=>{s==="repaint"&&(this.pendingUpdate=!0),s==="recalculate-world-size"&&(this.manualHomePosition||(this.setHomePosition(),this.goHome()),this.updateFocalPosition())}),this.lastTime=performance.now(),this.controllers=i,this.render(this.lastTime),this.startControllers()}get x(){return this.target[1]}set x(e){this.target[1]=e}get y(){return this.target[2]}set y(e){this.target[2]=e}get x2(){return this.target[3]}set x2(e){this.target[3]=e}get y2(){return this.target[4]}set y2(e){this.target[4]=e}get width(){return this.target[3]-this.target[1]}set width(e){this.target[3]=this.target[1]+e}get height(){return this.target[4]-this.target[2]}set height(e){this.target[4]=this.target[2]=e}setHomePosition(e){this.homePosition.set(Pe.projection(e||this.world)),this.pendingUpdate=!0}startControllers(){if(!this.controllersRunning){for(let e of this.controllers)this.controllerStopFunctions.push(e.start(this));this.controllersRunning=!0}}stopControllers(){if(this.controllersRunning){for(let e of this.controllerStopFunctions)e();this.controllersRunning=!1,this.controllerStopFunctions=[]}}updateControllerPosition(){for(let e of this.controllers)e.updatePosition(this.x,this.y,this.width,this.height)}triggerResize(){this.renderer.triggerResize&&this.renderer.triggerResize(),this.pendingUpdate=!0}addController(e){this.controllers.push(e),this.controllersRunning&&e.start(this),this.pendingUpdate=!0}cover(){return this.goHome({cover:!0})}getRendererScreenPosition(){return this.renderer.getRendererScreenPosition()}updateRendererScreenPosition(){this.pendingUpdate=!0,this.renderer.resize()}setOptions(e){this.options={...this.options,...e}}goHome(e={}){if(this.world.width<=0||this.world.height<=0)return;let t=this.getScaleFactor(),n=e.position?{x:e.position[1],y:e.position[2],width:e.position[3]-e.position[1],height:e.position[4]-e.position[2]}:{x:this.homePosition[1],y:this.homePosition[2],width:this.homePosition[3]-this.homePosition[1],height:this.homePosition[4]-this.homePosition[2]},i=this.width*t,r=this.height*t,s=n.width/i,l=n.height/r,u=i/r;if(e.cover?s>l:s<l){let f=u*n.height,p=(f-n.width)/2;this.target[1]=Math.round(-p+n.x),this.target[2]=Math.round(n.y),this.target[3]=Math.round(f-p+n.x),this.target[4]=Math.round(n.height+n.y)}else{let f=n.width/u,p=(f-n.height)/2;this.target[1]=Math.round(n.x),this.target[2]=Math.round(n.y-p),this.target[3]=Math.round(n.x+n.width),this.target[4]=Math.round(n.y+f-p)}this.constrainBounds(this.target),this.updateControllerPosition()}resize(e,t,n,i){this.transitionManager.hasPending()&&this.transitionManager.stopTransition(),this.updateFocalPosition(e-t,n-i);let r=t/e,s=i/n;this.target[3]=this.target[1]+(this.target[3]-this.target[1])*r,this.target[4]=this.target[2]+(this.target[4]-this.target[2])*s,this.goHome({position:this.focalPosition}),this.renderer.resize(t,i),this.pendingUpdate=!0,this.transitionManager.resumeTransition()}updateFocalPosition(e,t){if(!this.manualFocalPosition){let n=this.width,i=this.height,r=Math.min(n,i),s=0,l=0,u=this.x+s,f=this.y+l;if(n<i){let p=this.height-this.width;this.focalPosition=Pe.projection({x:u,y:f+p/2,width:r-s*2,height:r-l*2}),this.pendingUpdate=!0}else{let p=this.width-this.height;this.focalPosition=Pe.projection({x:u+p/2,y:f,width:r-s*2,height:r-l*2}),this.pendingUpdate=!0}}}getViewport(){return this._viewport.x=this.target[1],this._viewport.y=this.target[2],this._viewport.width=this.target[3]-this.target[1],this._viewport.height=this.target[4]-this.target[2],this._viewport}constrainBounds(e,{panPadding:t=0,ref:n=!1}={}){let{minX:i,maxX:r,minY:s,maxY:l}=this.getBounds({target:e,padding:t}),u=!1,f=n?e:me(e),p=Math.round(e[3]-e[1]),c=Math.round(e[4]-e[2]);return i>e[1]&&(u=!0,f[1]=i,f[3]=i+p),s>e[2]&&(u=!0,f[2]=s,f[4]=s+c),r<e[1]&&(u=!0,f[1]=r,f[3]=r+p),l<e[2]&&(u=!0,f[2]=l,f[4]=l+c),[u,f]}getBounds(e){let t=e.target||this.target,n=e.padding,i=this.options.visibilityRatio,r=Math.abs(1-i);if(this.world.hasActiveZone()){let R=this.world.getActiveZone();if(R){let b=t[3]-t[1]<R.points[3]-R.points[1],I=t[4]-t[2]<R.points[4]-R.points[2];return{minX:b?R.points[1]-n:R.points[1]+(R.points[3]-R.points[1])/2-(t[3]-t[1])/2,maxX:I?R.points[2]-n:R.points[2]+(R.points[4]-R.points[2])/2-(t[4]-t[2])/2,minY:b?R.points[3]+n:R.points[1]+(R.points[3]-R.points[1])/2-(t[3]-t[1])/2,maxY:I?R.points[4]+n:R.points[2]+(R.points[4]-R.points[2])/2-(t[4]-t[2])/2}}}let s=t[3]-t[1],l=this.world.width,u=-s*r,f=l-s-u,p=t[4]-t[2],c=this.world.height,m=-p*r,y=c-p-m,w=Math.round(Math.max(u,f)),v=Math.round(Math.min(u,f)),S=Math.round(Math.max(m,y)),E=Math.round(Math.min(m,y));return{minX:v,maxX:w,minY:E,maxY:S}}getScaleFactor(e=!1){let t=this.renderer.getScale(this.target[3]-this.target[1],this.target[4]-this.target[2],e);return t===0?this._lastGoodScale:(this._lastGoodScale=t,t)}getZoomedPosition(e,{origin:t,fromPos:n}){let i=n?{width:n[3]-n[1],height:n[4]-n[2]}:void 0,r=i?this.renderer.getScale(i.width,i.height):this.getScaleFactor(),s=i?i.width:this.width,l=i?i.height:this.height,u=this.getRendererScreenPosition()?.width,f=this.world.width,p=u?u/f:1,c=this.options.maxUnderZoom,m=Math.max(p||1,this.options.maxOverZoom),y=1/e,w=r*y;if(y<1){let S=s*r,E=l*r,R=this.world.width/S,b=this.world.height/E;if(R>b){let I=this.world.width*w,M=~~(s*r)*c;I<M&&(e=this.world.width*r/(s*r*c))}else{let I=this.world.height*w,M=~~(l*r)*c;I<M&&(e=this.world.height*r/(l*r*c))}}else w>m&&(e=r/m);let v=Bn(this.target,ir(e,t?t.x:this.target[1]+(this.target[3]-this.target[1])/2,t?t.y:this.target[2]+(this.target[4]-this.target[2])/2),this.zoomBuffer);return this.constrainBounds(v,{ref:!0,panPadding:100}),v}clampRegion({x:e,y:t,width:n,height:i,padding:r=0}){let s=this.width,l=this.height,u=n/s<i/l,f=e-r,p=t-r,c=n+r*2,m=i+r*2;if(u){let w=m/l*s;return{x:f-(w-c)/2,y:p,width:w,height:m}}let y=c/s*l;return{x:f,y:p-(y-m)/2,width:c,height:y}}viewerToWorld(e,t){let n=this.getScaleFactor();return this._viewerToWorld.x=this.target[1]+e/n,this._viewerToWorld.y=this.target[2]+t/n,this._viewerToWorld}worldToViewer(e,t,n,i){let r=Pe.singleBox(n,i,e,t);return hn(r,An(Dn(this.getScaleFactor()),ht(-this.target[1],-this.target[2]))),{x:r[1],y:r[2],width:r[3]-r[1],height:r[4]-r[2],strand:r}}setScale(e,t){hn(this.target,ir(e,t?t.x:this.target[1]+(this.target[3]-this.target[1])/2,t?t.y:this.target[2]+(this.target[4]-this.target[2])/2)),this.pendingUpdate=!0}syncTo(e){let t=this.target;return this.target=e.target,this.pendingUpdate=!0,()=>{this.target=t}}stop(){return typeof this.stopId<"u"&&(window.cancelAnimationFrame(this.stopId),this.stopId=void 0),()=>{this.render(performance.now())}}reset(){this.renderer.reset()}selectZone(e){this.world.selectZone(e),this.pendingUpdate=!0}deselectZone(){this.world.deselectZone(),this.pendingUpdate=!0}hook(e,t){let n=this.hooks[e].length;if(n!==0)for(let i=0;i<n;i++)this.hooks[e][i](t)}registerHook(e,t){return this.hooks[e].push(t),()=>{this.hooks[e]=this.hooks[e].filter(n=>n!==t)}}updateNextFrame(){this.pendingUpdate=!0}},ad=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,ld={},OT=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"],p1=class extends qi{constructor(){super(),P(this,"id"),P(this,"type","spacial-content"),P(this,"isShape",!0),P(this,"points"),P(this,"hoverEvents",!1),P(this,"activeEvents",!1),P(this,"display",{x:0,y:0,scale:1,width:-1,height:-1,points:me(5)}),P(this,"boundingBox",null),P(this,"_parsed",{border:{id:null,match:[]},outline:{id:null,match:[]}}),P(this,"hovering"),P(this,"pressing"),P(this,"props",{}),P(this,"shape",{type:"none"}),P(this,"addHover",()=>{this.hovering=!0,this.__revision++}),P(this,"removeHover",()=>{this.hovering=!1,this.pressing=!1,this.__revision++}),P(this,"addPress",()=>{this.pressing=!0,this.__revision++}),P(this,"removePress",()=>{this.pressing=!1,this.__revision++}),this.id=yd(12),this.points=me(5),this.shape={type:"none"}}updateBoundingBox(){if(this.shape.type==="none")return;let e=this.shape.points;if(this.shape.points.length>2){let t=Math.min(...e.map(s=>s[0])),n=Math.min(...e.map(s=>s[1])),i=Math.max(0,...e.map(s=>s[0])),r=Math.max(0,...e.map(s=>s[1]));this.boundingBox={x:t,y:n,width:i-t,height:r-n};return}this.boundingBox=null}intersects(e){if(!e||this.shape.type==="none")return!1;let[t,n]=e,i=this.shape.points,r=this.boundingBox;if(r||(this.updateBoundingBox(),r=this.boundingBox),!r||t<r.x||t>r.x+r.width||n<r.y||n>r.height+r.y)return!1;let s=!1;for(let l=0,u=i.length-1;l<i.length;u=l++)i[l][1]>n!=i[u][1]>n&&t<(i[u][0]-i[l][0])*(n-i[l][1])/(i[u][1]-i[l][1])+i[l][0]&&(s=!s);return s}getAllPointsAt(e,t){return e[3]-e[1]===1&&e[4]-e[2]===1?this.intersects([e[1],e[2]])?[[this,this.points,t]]:[]:[[this,this.points,t]]}applyProps(e={}){let t=!1;if(e.points)if(this.shape.type!=="polygon"||this.shape.points.length!==e.points.length)this.shape={type:"polygon",points:e.points,open:e.open},this.updateBoundingBox();else{let n=!1,i=e.points.length;for(let r=0;r<i;r++)if(e.points[r][0]!==this.shape.points[r][0]||e.points[r][1]!==this.shape.points[r][1]){n=!0;break}n&&(this.shape={type:"polygon",points:e.points,open:e.open},this.updateBoundingBox())}if(e.interactive!==this.props.interactive&&(t=!0,this.props.interactive=e.interactive),(e.open||e.open===!1)&&(t=!0,this.shape.open=e.open),e.style){let n=e.border||e.style.border;if(n!==this._parsed.border.id)if(!n)this._parsed.border.id=null,this._parsed.border.match=[];else{let i=ld[n]||ad.exec(n)||ad.exec(n);i&&(this._parsed.border.id=n,this._parsed.border.match=ld[n]=i)}if(this._parsed.border.id&&(e.style.borderWidth=this._parsed.border.match[1],e.style.borderStyle="solid",e.style.borderColor=this._parsed.border.match[4]),e.style.outline!==this._parsed.outline.id)if(!e.style.outline)this._parsed.outline.id=null,this._parsed.outline.match=[];else{let i=ld[e.style.outline]||ad.exec(e.style.outline)||ad.exec(e.style.outline);i&&(this._parsed.outline.id=e.style.outline,this._parsed.outline.match=ld[e.style.outline]=i)}this._parsed.outline.id&&(e.style.outlineWidth=this._parsed.outline.match[1],e.style.outlineStyle="solid",e.style.outlineColor=this._parsed.outline.match[4]),this.props.style=e.style,e.backgroundColor&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=e.backgroundColor,t=!0),e.style.background&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=e.style.background,t=!0);for(let i of OT)if(this.props.style[i]!==e.style[i]){t=!0;break}e.style[":hover"]!==this.props.hoverStyles&&(this.props.hoverStyles=e.style[":hover"],this.hoverEvents||(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),t=!0),e.style[":active"]!==this.props.pressStyles&&(this.props.pressStyles=e.style[":active"],this.activeEvents||(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),t=!0)}e.href!==this.props.href&&(this.props.href=e.href,t=!0),e.hrefTarget!==this.props.hrefTarget&&(this.props.hrefTarget=e.hrefTarget,t=!0),e.title!==this.props.title&&(this.props.title=e.title,t=!0),e.className!==this.props.className&&(this.props.className=e.className,e.className&&!this.hoverEvents&&(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),e.className&&!this.activeEvents&&(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),t=!0),e.relativeSize!==this.props.relativeSize&&(this.props.relativeSize=e.relativeSize,t=!0),e.relativeStyle!==this.props.relativeStyle&&(this.props.relativeStyle=e.relativeStyle,t=!0),e.html!==this.props.html&&(this.props.html=e.html,t=!0),e.target&&(e.target.width!==this.display.width||e.target.height!==this.display.height||e.target.x!==this.points[1]||e.target.y!==this.points[2])&&(t=!0,this.points=Pe.singleBox(e.target.width,e.target.height,e.target.x,e.target.y),this.display.points=Pe.singleBox(e.target.width,e.target.height,e.target.x,e.target.y),this.display.width=e.target.width,this.display.height=e.target.height),t&&this.__revision++}},t1=/(-?[0-9]+(px|em)\s+|0\s+)(-?[0-9]+(px|em)\s+|0\s+)(-?[0-9]+(px|em)\s+|0\s+)?(-?[0-9]+(px|em)\s+|0\s+)?(.*)/g,n1={},kT=typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes("firefox"),ud={},LT=class{constructor(e,t){P(this,"canvas"),P(this,"ctx"),P(this,"options"),P(this,"imagesPending",0),P(this,"imagesLoaded",0),P(this,"imageIdsLoaded",[]),P(this,"frameIsRendering",!1),P(this,"pendingDrawCall",!1),P(this,"firstMeaningfulPaint",!1),P(this,"parallelTasks",8),P(this,"frameTasks",0),P(this,"loadingQueueOrdered",!0),P(this,"loadingQueue",[]),P(this,"currentTask",Promise.resolve()),P(this,"tasksRunning",0),P(this,"stats"),P(this,"averageJobTime",64),P(this,"lastKnownScale",1),P(this,"visible",[]),P(this,"previousVisible",[]),P(this,"rendererPosition"),P(this,"dpi"),P(this,"drawCalls",[]),P(this,"lastPaintedObject"),P(this,"hostCache"),P(this,"invalidated",[]),P(this,"_worker",()=>{if(this.loadingQueue.length){let n=this.loadingQueue.pop();n&&(this.tasksRunning++,this.frameTasks++,this.currentTask=n.task().then(()=>{this.tasksRunning--}).catch(()=>{this.tasksRunning--}))}}),P(this,"_scheduled",0),P(this,"_doWork",()=>{this.loadingQueue.length===0&&this.tasksRunning===0&&this._scheduled&&(clearInterval(this._scheduled),this._scheduled=0);let n=this.parallelTasks||1;!this.firstMeaningfulPaint&&this.loadingQueue.length&&(n=this.loadingQueue.length);for(let i=0;i<=n;i++)this._worker()}),this.canvas=e,this.rendererPosition=e.getBoundingClientRect(),this.ctx=e.getContext("2d",{alpha:!0}),this.ctx.imageSmoothingEnabled=!0,this.options=t||{},this.canvas.style.transition="opacity .3s",this.dpi=t?.dpi||1,this.hostCache=t?.lruCache?new x0({maxSize:1024*512*512,dispose:(n,i,r)=>{this.invalidated.push(i),n.width=0,n.height=0},sizeCalculation:(n,i)=>n.width*n.height}):{store:{},get(n){return this.store[n]},set(n,i){this.store[n]=i}}}getCanvasDims(){return{width:this.canvas.width/this.dpi,height:this.canvas.height/this.dpi}}resize(){this.rendererPosition=this.canvas.getBoundingClientRect()}isReady(){return this.firstMeaningfulPaint}afterFrame(e){if(this.clearTransform(),this.lastPaintedObject=void 0,this.frameIsRendering=!1,this.imagesPending=Math.max(0,this.imagesPending-this.imagesLoaded),this.imagesLoaded=0,this.loadingQueueOrdered||(this.loadingQueue=this.loadingQueue.sort((t,n)=>t.network&&t.scale===n.scale?n.distance-t.distance:t.scale<n.scale?-1:1),this.loadingQueueOrdered=!0),this.previousVisible=this.visible,this.pendingDrawCall=!!this.drawCalls.length,this.pendingDrawCall)for(let t=0;t<this.drawCalls.length;t++){let n=this.drawCalls.shift();n&&n()}this.doOffscreenWork(),this.options.debug&&this.stats&&this.stats.end()}doOffscreenWork(){this.frameTasks=0,this.loadingQueue.length&&(this._worker(),this.loadingQueue.length&&(this._scheduled||(this._scheduled=setInterval(this._doWork,0))))}getScale(e,t,n){if(Number.isNaN(e)||Number.isNaN(t))return this.lastKnownScale;let i=this.getCanvasDims(),r=i.width/e,s=i.height/t,l=(r<s?s:r)*(n&&this.dpi||1);return Number.isNaN(l)||(this.lastKnownScale=l),this.lastKnownScale}beforeFrame(e,t,n,i){this.options.debug&&this.stats&&this.stats.begin(),this.frameIsRendering=!0,this.visible=[],this.options.beforeFrame&&this.options.beforeFrame(t);let r=this.getCanvasDims();if(this.ctx.globalAlpha=1,this.ctx.fillStyle=this.canvas.dataset.background??"rgb(0, 0, 0)",this.ctx.fillRect(0,0,r.width,r.height),i.enableFilters&&(i.filters.brightness||i.filters.contrast||i.filters.grayscale||i.filters.invert||i.filters.sepia||i.filters.saturate||i.filters.hueRotate||i.filters.blur)){let s="";i.filters.brightness&&(s+=`brightness(${~~(100+i.filters.brightness*100)}%) `),i.filters.contrast&&(s+=`contrast(${~~(100+i.filters.contrast*100)}%) `),i.filters.grayscale&&(s+=`grayscale(${~~(i.filters.grayscale*100)}%) `),i.filters.invert&&(s+=`invert(${~~(i.filters.invert*100)}%) `),i.filters.sepia&&(s+=`sepia(${~~(i.filters.sepia*100)}%) `),i.filters.saturate&&(s+=`saturate(${~~(100+i.filters.saturate*100)}%) `),i.filters.hueRotate&&(s+=`hue-rotate(${i.filters.hueRotate}deg) `),i.filters.blur&&(s+=`blur(${i.filters.blur}px) `),this.ctx.filter=s}else this.ctx.filter="none"}applyTransform(e,t,n,i,r){let s=e.__owner.value;if(s&&s.rotation){this.ctx.save();let l=t+i/2,u=n+r/2;this.ctx.translate(l,u),this.ctx.rotate(s.rotation*Math.PI/180),this.ctx.translate(-l,-u),this.lastPaintedObject=s}}clearTransform(){this.lastPaintedObject&&(this.lastPaintedObject.rotation&&this.ctx.restore(),this.lastPaintedObject=void 0)}paint(e,t,n,i,r,s){let l=this.ctx.globalAlpha;if(e instanceof zr||e instanceof al){if(e.display.rotation){this.ctx.save();let p=n+r/2,c=i+s/2;e.crop&&(p-=e.crop[t*5+1],c-=e.crop[t*5+2]),this.ctx.translate(p,c),this.ctx.rotate(e.display.rotation*Math.PI/180),this.ctx.translate(-p,-c)}if(this.visible.push(e),typeof e.style&&e.style.opacity!=="undefined"){if(!e.style.opacity)return;this.ctx.globalAlpha=e.style.opacity}try{let p=e.__host.canvas,c=this.getCanvasDims();if((p.indices.indexOf(t)===-1||this.invalidated.indexOf(p.canvases[t])!==-1)&&this.schedulePaintToCanvas(p,e,t,fd({x:n+r/2,y:i+r/2},{x:c.width/2,y:c.height/2})),!this.firstMeaningfulPaint)return;let m=this.hostCache.get(p.canvases[t]);if(m)if(e.crop&&e.cropData){if(e.crop[t*5]){let y=[e.crop[t*5+1]/e.display.scale-e.display.points[t*5+1],e.crop[t*5+2]/e.display.scale-e.display.points[t*5+2],1+(e.crop[t*5+3]-e.crop[t*5+1])/e.display.scale,1+(e.crop[t*5+4]-e.crop[t*5+2])/e.display.scale];y[0]+=e.cropData.x/e.display.scale,y[1]+=e.cropData.y/e.display.scale;let w=e.x*this.lastKnownScale,v=e.y*this.lastKnownScale,S=[n+w,i+v,r,s];S[0]+=w,S[1]+=v,this.ctx.drawImage(m,y[0],y[1],y[2],y[3],S[0],S[1],S[2]+1,S[3]+1)}}else kT?this.ctx.drawImage(m,0,0,e.display.points[t*5+3]-e.display.points[t*5+1],e.display.points[t*5+4]-e.display.points[t*5+2],n,i,r+1,s+1):this.ctx.drawImage(m,0,0,e.display.points[t*5+3]-e.display.points[t*5+1],e.display.points[t*5+4]-e.display.points[t*5+2],n,i,r+Number.MIN_VALUE+.5,s+Number.MIN_VALUE+.5)}catch{}e.display.rotation&&this.ctx.restore()}let u=e instanceof il&&this.options.box,f=e instanceof p1&&this.options.polygon;if((u||f)&&!e.props.className&&!e.props.html&&!e.props.href){if(this.visible.push(e),e.props.style){let p=Object.assign({},e.props.style||{},e.hovering?e.props.hoverStyles:{},e.pressing?e.props.pressStyles:{}),c=e.props.relativeStyle?1:r/e.width;typeof p.opacity<"u"&&(this.ctx.globalAlpha=p.opacity);let m=0;typeof p.borderWidth<"u"&&(m=parseInt(p.borderWidth,10)*c);let y=0;typeof p.outlineWidth<"u"&&(y=parseInt(p.outlineWidth,10)*c);let w=0;if(typeof p.outlineOffset<"u"&&(w=parseInt(p.outlineOffset,10)*c),p.borderColor&&(this.ctx.strokeStyle=p.borderColor),p.boxShadow){let v=p.boxShadow.split(/,(?![^(]*\))/);for(let S of v){let E=n1[S]||t1.exec(S)||t1.exec(S);n1[S]=E,E&&(this.ctx.save(),this.ctx.shadowOffsetX=parseInt(E[1])*this.dpi*c,this.ctx.shadowOffsetY=parseInt(E[3])*this.dpi*c,this.ctx.shadowBlur=parseInt(E[5])*this.dpi*c,this.ctx.shadowColor=E[9],this.ctx.fillStyle="rgba(0,0,0,1)",this.ctx.fillRect(n+m,i+m,r,s),this.ctx.restore())}}if(this.ctx.fillStyle=p.backgroundColor||"transparent",this.ctx.lineWidth=m,f){let v=e.shape,S=v.points||[],E=S.length;this.ctx.beginPath();for(let R=0;R<E;R++)this.ctx.lineTo(n+S[R][0]*this.lastKnownScale,i+S[R][1]*this.lastKnownScale);v.open||this.ctx.closePath(),m&&this.ctx.stroke(),v.open||this.ctx.fill()}else m&&this.ctx.strokeRect(n+m/2,i+m/2,r+m,s+m),this.ctx.fillRect(n+m,i+m,r,s);y&&(p.outlineColor&&(this.ctx.strokeStyle=p.outlineColor),this.ctx.lineWidth=y,this.ctx.strokeRect(n-y/2-w,i-y/2-w,r+m*2+y+w*2,s+m*2+y+w*2))}this.ctx.globalAlpha=l}}loadImage(e,t,n,i=!1){if(ud[e]&&ud[e].naturalWidth>0){t(ud[e]);return}try{let r=!1;i||setTimeout(()=>{r||this.loadImage(e,t,n,!0)},3e3);let s=document.createElement("img");s.decoding="auto",s.onload=function(){r=!0,t(s),ud[e]=s,s.onload=null},this.options.crossOrigin&&(s.crossOrigin="anonymous"),s.src=e,s.complete&&s.onload({}),s.width}catch(r){console.log("image error",r),n(r)}}schedulePaintToCanvas(e,t,n,i){this.imagesPending++,e.indices.push(n);let r=`${t.id}--${t.display.scale}-${n}`,s=this.invalidated.indexOf(r);s!==-1&&this.invalidated.splice(s,1),e.canvases[n]=r,t.__host.canvas.loading=!0,this.loadingQueueOrdered=!1,this.loadingQueue.push({id:r,scale:t.display.scale,network:!0,distance:i,task:()=>new Promise(l=>{if(this.visible.indexOf(t)===-1){this.imagesPending--,e.indices.splice(e.indices.indexOf(n),1),l();return}let u=t.getImageUrl(n);this.loadImage(u,f=>{this.loadingQueue.push({id:r,scale:t.display.scale,distance:i,task:()=>new Promise(p=>{this.imageIdsLoaded.includes(r)||(this.imagesLoaded++,this.imageIdsLoaded.push(r)),e.loaded.push(n),e.loaded.length===e.indices.length&&(e.loading=!1);let c=t.display.points.slice(n*5,n*5+5),m=document.createElement("canvas"),y=m.getContext("2d");m.width=c[3]-c[1],m.height=c[4]-c[2],this.hostCache.set(e.canvases[n],m),this.drawCalls.push(()=>{y.drawImage(f,0,0,c[3]-c[1],c[4]-c[2]),p()})})}),l()},f=>{this.imagesPending--,e.indices.splice(e.indices.indexOf(n),1),l()})})})}afterPaintLayer(e,t){}prepareLayer(e,t){if(e.__owner.value)if(e.cropData){let n=this.lastKnownScale*(1/e.display.scale);this.applyTransform(e,t[1],t[2],t[3]-t[1],t[4]-t[2])}else this.applyTransform(e,t[1],t[2],t[3]-t[1],t[4]-t[2]);(!e.__host||!e.__host.canvas)&&(e instanceof zr||e instanceof al)&&this.createImageHost(e)}finishLayer(){this.lastPaintedObject&&this.clearTransform()}createImageHost(e){e.__host=e.__host?e.__host:{},e.__host.canvas={canvas:void 0,canvases:[],indices:[],loaded:[],loading:!1}}getPointsAt(e,t,n,i){return e.getPointsAt(t,n,i)}getViewportBounds(e,t,n){let i=e.getActiveZone();if(i){let r=t[3]-t[1]<i.points[3]-i.points[1],s=t[4]-t[2]<i.points[4]-i.points[2];return{x1:r?i.points[1]-n:i.points[1]+(i.points[3]-i.points[1])/2-(t[3]-t[1])/2,y1:s?i.points[2]-n:i.points[2]+(i.points[4]-i.points[2])/2-(t[4]-t[2])/2,x2:r?i.points[3]+n:i.points[1]+(i.points[3]-i.points[1])/2-(t[3]-t[1])/2,y2:s?i.points[4]+n:i.points[2]+(i.points[4]-i.points[2])/2-(t[4]-t[2])/2}}return null}pendingUpdate(){let e=!this.pendingDrawCall&&this.drawCalls.length===0&&this.imagesPending===0&&this.loadingQueue.length===0&&this.tasksRunning===0;return!e&&this.visible.length===0&&setTimeout(()=>{this.canvas.style.opacity="1",this.firstMeaningfulPaint=!0},500),!this.firstMeaningfulPaint&&e&&this.visible.length?(this.canvas.style.opacity="1",this.firstMeaningfulPaint=e,!0):this.options.debug?!0:!e}getRendererScreenPosition(){return this.rendererPosition}reset(){this.loadingQueue=[],this.drawCalls=[]}},m1=class{constructor(e){P(this,"renderers",[]),P(this,"length");for(let t of e)t&&this.renderers.push(t);this.length=this.renderers.length}afterFrame(e,t,n,i){for(let r=0;r<this.length;r++)this.renderers[r].afterFrame(e,t,n,i)}afterPaintLayer(e,t){for(let n=0;n<this.length;n++)this.renderers[n].afterPaintLayer(e,t)}beforeFrame(e,t,n,i){for(let r=0;r<this.length;r++)this.renderers[r].beforeFrame(e,t,n,i)}triggerResize(){for(let e=0;e<this.length;e++){let t=this.renderers[e];t.triggerResize&&t.triggerResize()}}getPointsAt(e,t,n,i){return this.renderers[0].getPointsAt(e,t,n,i)}getScale(e,t){return this.renderers[0].getScale(e,t)}getViewportBounds(e,t,n){return this.renderers[0].getViewportBounds(e,t,n)}getRendererScreenPosition(){return this.renderers[0].getRendererScreenPosition()}isReady(){for(let e=0;e<this.length;e++)if(!this.renderers[e].isReady())return!1;return!0}paint(e,t,n,i,r,s){for(let l=0;l<this.length;l++)this.renderers[l].paint(e,t,n,i,r,s)}pendingUpdate(){for(let e=0;e<this.length;e++)if(this.renderers[e].pendingUpdate())return!0;return!1}prepareLayer(e,t){for(let n=0;n<this.length;n++)this.renderers[n].prepareLayer(e,t)}finishLayer(e,t){for(let n=0;n<this.length;n++)this.renderers[n].finishLayer(e,t)}resize(e,t){for(let n=0;n<this.length;n++)this.renderers[n].resize(e,t)}reset(){for(let e=0;e<this.length;e++)this.renderers[e].reset()}},FT=class{constructor(e){P(this,"canvas"),P(this,"context"),P(this,"heightRatio",1),P(this,"widthRatio",1),P(this,"target",new Float32Array(5)),P(this,"initialWidth"),P(this,"initialHeight"),P(this,"bounds"),P(this,"aggregate"),P(this,"delta",0),P(this,"renderNextFrame",!0),this.canvas=e,this.initialWidth=e.width,this.initialHeight=e.height,this.context=e.getContext("2d"),this.context.globalAlpha=.5,this.aggregate=Dn(1)}isReady(){return!0}resize(){this.initialWidth=this.canvas.width,this.initialHeight=this.canvas.height,this.renderNextFrame=!0}afterFrame(e,t,n){if(this.renderNextFrame){this.context.clearRect(0,0,this.canvas.width,this.canvas.height);let i=this.initialWidth/e.width,r=this.initialHeight/e.height,s=this.widthRatio>this.heightRatio?i:r;if(this.target=n,this.bounds){let l=e.getPointsAt(this.bounds,this.aggregate,s);for(let[u,f]of l)if(u instanceof zr&&u.__host.canvas){let p=f.length/5;for(let c=0;c<p;c++)if(u.__host.canvas.canvases[c]){let m={x1:f[c+1]*s,y1:f[c+2]*s,width:(f[c+3]-f[c+1])*s,height:(f[c+4]-f[c+2])*s}}}}e.getPoints().forEach((l,u,f)=>{if(u%5===0&&l){let p={x1:f[u+1]*s,y1:f[u+2]*s,x2:f[u+3]*s,y2:f[u+4]*s,width:(f[u+3]-f[u+1])*s,height:(f[u+4]-f[u+2])*s};this.context.strokeStyle="red",this.context.strokeRect(p.x1,p.y1,p.width,p.height)}}),n&&(this.context.strokeStyle="red",this.context.lineWidth=window.devicePixelRatio||1,this.context.strokeRect(n[1]*s,n[2]*s,(n[3]-n[1])*s,(n[4]-n[2])*s))}}getActiveZone(e){return null}getPointsAt(e,t,n,i){return e.getPointsAt(t,n,i)}getScale(e,t){return 1}beforeFrame(e,t){this.bounds=Pe.singleBox(e.width,e.height)}drawImage(){}afterPaintLayer(e,t){}paint(e,t,n,i,r,s){this.renderNextFrame=!0}prepareLayer(e){}pendingUpdate(){return!1}hasActiveZone(){return!1}getViewportBounds(e,t,n){return null}getRendererScreenPosition(){return this.canvas.getBoundingClientRect()}finishLayer(){}reset(){}};function NT(e){return{x:e[1],y:e[2],width:e[3]-e[1],height:e[4]-e[2]}}var i1="pan",r1="scroll",zT="gesture",DT={zoomOutFactor:.8,zoomInFactor:1.25,maxZoomFactor:1,minZoomFactor:.05,zoomDuration:300,zoomWheelConstant:20,zoomClamp:.6,panBounceStiffness:120,panBounceDamping:15,panTimeConstant:240,panPower:.1,nudgeDistance:100,panPadding:0,devicePixelRatio:1,enableWheel:!0,enableClickToZoom:!0,ignoreSingleFingerTouch:!1,enablePanOnWait:!1,requireMetaKeyForWheelZoom:!1,panOnWaitDelay:40,onPanInSketchMode:()=>{},parentElement:null},y1=(e={})=>({start:function(t){let{zoomWheelConstant:n,enableWheel:i,enableClickToZoom:r,ignoreSingleFingerTouch:s,enablePanOnWait:l,panOnWaitDelay:u,parentElement:f,requireMetaKeyForWheelZoom:p}={...DT,...e},c={pointerStart:{x:0,y:0},isPressing:!1,mousemoveBuffer:me(5),multiTouch:{distance:0}};t.world.activatedEvents.push("onMouseUp","onMouseDown","onMouseMove","onTouchStart","onTouchEnd","onTouchMove","onContextMenu");function m(){S=0,R="",I(),I(void 0,"notice"),E=0}function y(){t.world.constraintBounds(),m()}function w(B){if(B.which>1){c.isPressing=!1;return}t.mode==="explore"&&(B.preventDefault(),c.pointerStart.x=B.atlas.x,c.pointerStart.y=B.atlas.y,t.transitionManager.stopTransition(),c.isPressing=!0)}function v(){m(),c.isPressing&&(t.mode==="explore"&&t.world.constraintBounds(),c.isPressing=!1)}let S=0,E=0,R="";function b(B){if(t.mode==="explore"){if(B.atlasTouches.length===1&&(E=performance.now(),s==!1&&B.preventDefault(),c.pointerStart.x=B.atlasTouches[0].x,c.pointerStart.y=B.atlasTouches[0].y),B.atlasTouches.length===2){R=zT,B.preventDefault();let G=B.atlasTouches[0].x,K=B.atlasTouches[1].x;c.pointerStart.x=(G+K)/2;let ce=B.atlasTouches[0].y,J=B.atlasTouches[1].y;c.pointerStart.y=(ce+J)/2,S=fd({x:B.touches[0].clientX,y:B.touches[0].clientY},{x:B.touches[1].clientX,y:B.touches[1].clientY})}t.transitionManager.stopTransition(),c.isPressing=!0}}function I(B,G="intent"){f&&(f.dataset[G]=B)}function M(B){let G=null,K=null,ce=!1,J=0;if(c.isPressing&&B.touches.length===2){let te=B.touches[0].clientX,oe=B.touches[1].clientX;G=(te+oe)/2;let Re=B.touches[0].clientY,de=B.touches[1].clientY;K=(Re+de)/2,J=fd({x:B.touches[0].clientX,y:B.touches[0].clientY},{x:B.touches[1].clientX,y:B.touches[1].clientY}),ce=!0}if(I(R),c.isPressing&&B.touches.length===1){if(l&&(performance.now()-E<u&&R==""&&(R=r1),R==""&&(R=i1)),I(R),R==""&&s==!0||R==r1){I("require-two-finger","notice");return}let te=B.touches[0];G=te.clientX,K=te.clientY}if(G!==null&&K!==null){let te=t.getRendererScreenPosition();if(te){let{x:oe,y:Re}=t.viewerToWorld(G-te.x,K-te.y),de=J&&S?J/S:1;t.transitionManager.customTransition(N=>{N.from=me(t.target),N.to=Bn(N.from,An(ht(c.pointerStart.x-oe,c.pointerStart.y-Re),ir(1/de,oe,Re)),c.mousemoveBuffer),N.elapsed_time=0,N.total_time=0,N.timingFunction=Nr.easeInOutExpo,N.done=!1})}S=J}R==i1&&B.preventDefault()}function T(B){if(c.isPressing){let G=t.getRendererScreenPosition();if(G){let{x:K,y:ce}=t.viewerToWorld(B.clientX-G.x,B.clientY-G.y);t.transitionManager.customTransition(J=>{J.from=me(t.target),J.to=Bn(J.from,ht(c.pointerStart.x-K,c.pointerStart.y-ce),c.mousemoveBuffer),J.elapsed_time=0,J.total_time=0,J.timingFunction=Nr.easeInOutExpo,J.done=!1})}}}function _(B){t.mode==="explore"&&t.world.zoomIn(B.atlas)}function U(B){let G=1+(0,g1.default)(B).spinY/n;t.world.zoomTo(G,B.atlas,!0)}function H(B){return p&&B.metaKey==!1?(I("meta-required","notice"),B.stopPropagation(),!1):!0}t.world.addEventListener("mouseup",y),t.world.addEventListener("touchend",y),t.world.addEventListener("touchstart",b),t.world.addEventListener("mousedown",w),window.addEventListener("touchend",v),window.addEventListener("mouseup",v),window.addEventListener("mousemove",T),f&&f.addEventListener("touchmove",M),r&&(t.world.activatedEvents.push("onClick"),t.world.addEventListener("click",_)),i&&(t.world.activatedEvents.push("onWheel"),p&&f?.addEventListener("wheel",H,{passive:!0,capture:!0}),t.world.addEventListener("wheel",U));let Z=t.world.addLayoutSubscriber((B,G)=>{if(B==="zone-changed"&&t.transitionManager.constrainBounds({transition:{duration:0}}),B==="zoom-to"&&G&&t.transitionManager.zoomTo(G.factor,{origin:G.point,stream:G.stream}),B==="go-home"){let K=G.immediate?{duration:0}:void 0;t.transitionManager.goToRegion(NT(t.homePosition),{transition:K})}if(B==="goto-region"&&G){let K=G.immediate?{duration:0}:{};t.transitionManager.goToRegion(G,{transition:K})}B==="constrain-bounds"&&t.transitionManager.constrainBounds({transition:G?.immediate?{duration:0}:void 0})});return()=>{t.world.removeEventListener("mouseup",y),t.world.removeEventListener("touchend",y),t.world.removeEventListener("touchstart",b),t.world.removeEventListener("mousedown",w),window.removeEventListener("touchend",v),window.removeEventListener("mouseup",v),t.world.removeEventListener("mousemove",T),f&&(f.removeEventListener("touchmove",T),f.removeEventListener("wheel",H,{passive:!0,capture:!0})),r&&t.world.removeEventListener("click",_),i&&t.world.removeEventListener("wheel",U),Z()}},updatePosition(){}}),Bs=Sd.default.createContext("explore");Bs.displayName="Mode";var VT=()=>(0,Sd.useContext)(Bs);var wd=ig.default.createContext(null);wd.displayName="Atlas";var bd=ig.default.createContext(null);bd.displayName="Bounds";var pd,jT=typeof performance=="object"&&typeof performance.now=="function";if(jT){let e=performance;pd=()=>e.now()}else{let e=Date,t=e.now();pd=()=>e.now()-t}var HT=16;function o1(e,t){e&&e.appendChild&&t&&e.appendChild(t)}function S1(e,t){e&&e.removeChild&&t&&e.removeChild(t)}function WT(e,t){return S1(e.world,t)}function UT(e,t,n){return w1(e.world,t,n)}function w1(e,t,n){e&&e instanceof xd&&(e=e.world),e&&e.insertBefore&&e.insertBefore(t,n)}function b1(e,t,n){if(n&&(e.applyProps&&e.applyProps(n),e instanceof qi))for(let i of gd){let r=i.slice(2).toLowerCase();n[i]!==t[i]&&(t[i]&&e.removeEventListener(r,t[i]),e.addEventListener(r,n[i]))}}function R1(e,t){let n=Object.keys(t),i=!1;for(let r of n)if(gd.indexOf(r)!==-1){let s=Ds[r];if(s){if(e.activatedEvents.indexOf(s)!==-1)continue;i=!0,e.activatedEvents.push(s)}}i&&e.triggerEventActivation()}var md=new Map,s1={};function qT(e,{args:t=[],...n},i,r,s){if(!(i instanceof xd)&&s){let f=p=>p.return?f(p.return):p.stateNode&&p.stateNode.containerInfo;i=f(s)}let l,u=i.world;switch(e){case"world":l=vd.withProps({width:n.width,height:n.height,viewingDirection:"left-to-right"}),l.activatedEvents=u.activatedEvents,l.eventHandlers=u.eventHandlers,l.subscriptions=u.subscriptions,l.triggerEventActivation(),u=l;break;case"box":l=new il;break;case"shape":l=new p1;break;case"worldObject":case"world-object":l=new ng;break;case"worldImage":case"world-image":l=new zr;break;case"texture":l=new Xm;break;case"compositeImage":case"composite-image":l=new TT({id:n.id,width:n.width,height:n.height,images:[],renderOptions:n.renderOptions});break;case"tiledImage":case"tiled-image":l=al.fromTile(n.uri,n.display,n.tile,n.scaleFactor,void 0,n.format,n.useFloorCalc,n.version3);break;case"paragraph":l=new cd,l.text=n.children;break;default:return}return R1(u,n),b1(l,{},n),l}function GT(e,t){if(t instanceof vd)e.world=t;else if(t instanceof ng)e.world.appendChild(t);else if(t)throw new Error("Invalid root")}var ol=(0,v1.default)({unstable_now:pd,now:pd,createInstance:qT,removeChild:S1,appendChild:o1,appendInitialChild:o1,insertBefore:w1,warnsIfNotActing:!0,supportsMutation:!0,isPrimaryRenderer:!1,scheduleTimeout:typeof setTimeout<"u"?setTimeout:void 0,cancelTimeout:typeof clearTimeout<"u"?clearTimeout:void 0,setTimeout:typeof setTimeout<"u"?setTimeout:void 0,clearTimeout:typeof clearTimeout<"u"?clearTimeout:void 0,noTimeout:-1,appendChildToContainer:GT,removeChildFromContainer:WT,createTextInstance(){},insertInContainerBefore:UT,prepareUpdate(e,t,n,i,r){return R1(r.world,i),i},commitUpdate(e,t,n,i,r,s){e.applyProps&&t&&b1(e,i,t)},finalizeInitialChildren(e){return e?.__handlers},getChildHostContext(){return s1},getRootHostContext(){return s1},prepareForCommit(e){return e.isCommitting=!0,null},preparePortalMount(){},hideInstance(e){e&&e.points&&(e.points[0]=0)},unhideInstance(e,t){e&&e.points&&(e.points[0]=1)},getPublicInstance(e){return e},hideTextInstance(){throw new Error("Text is not allowed in the react-three-fibre tree. You may have extraneous whitespace between components.")},resetAfterCommit(e){e.isCommitting=!1,e.pendingUpdate=!0,e.world&&e.world.needsRecalculate&&(e.world.recalculateWorldSize(),e.world.triggerRepaint())},shouldSetTextContent(){return!1},clearContainer(){return!1},supportsHydration:!1,supportsPersistence:!1,detachDeletedInstance(e){},afterActiveInstanceBlur(){},beforeActiveInstanceBlur(){},getCurrentEventPriority(){return console.log("getCurrentEventPriority"),HT},getInstanceFromNode(e){throw console.log("getInstanceFromNode",e),new Error("Not implemented")},getInstanceFromScope(e){throw console.log("getInstanceFromScope",e),new Error("Not implemented")},prepareScopeUpdate(e,t){throw console.log("prepareScopeUpdate",e,t),new Error("Not implemented")},logRecoverableError(){},requestPostPaintCallback(){}});ol.injectIntoDevTools({bundleType:0,version:x1.version,rendererPackageName:"@atlas-viewer/atlas"});function rg(e,t){let n=md.get(e);n&&ol.updateContainer(null,n,null,()=>{md.delete(e),t&&t(e)})}var a1={render(e,t){let n=md.get(t);if(n)ol.updateContainer(e,n,null);else{let i=ol.createContainer(t,0,null,!1,null,"",()=>{},null);ol.updateContainer(e,i,null),md.set(t,i)}},unmountComponentAtNode(e,t){rg(e,t)}},sl=typeof window<"u"&&(window.document?.createElement||window.navigator?.product==="ReactNative")?Rd.useLayoutEffect:Rd.useEffect,$T=Ui.default.memo(({children:e,setIsReady:t,onCreated:n,bounds:i,preset:r,mode:s="explore"})=>{let l=(0,Ui.useCallback)(function(u){let f=(0,Ui.useRef)(!1),p=()=>{t(!0)};return(0,Ui.useEffect)(()=>{if(r&&!f.current){r.runtime.goHome();let c=n&&n(r);return void(c&&c.then?c.then(p):p())}return()=>{}},[]),(0,Ui.useEffect)(()=>{f.current=!0},[]),u.children},[r]);return sl(()=>{if(r){let u=r.runtime;s!==u.mode&&(u.mode=s),a1.render((0,zs.jsx)(Ui.default.StrictMode,{children:(0,zs.jsx)(l,{children:(0,zs.jsx)(bd.Provider,{value:i,children:(0,zs.jsx)(Bs.Provider,{value:s,children:(0,zs.jsx)(wd.Provider,{value:r,children:e})})})})}),u)}},[r,s,e]),sl(()=>{if(r){let u=r.runtime;return()=>{a1.unmountComponentAtNode(u)}}return()=>{}},[r]),null}),QT=class{constructor(e,t){P(this,"canvas"),P(this,"gl"),P(this,"program"),P(this,"fragmentShader"),P(this,"vertexShader"),P(this,"rectBuffer"),P(this,"fragmentShaderSource",`
24
+ `);let x=E.state[u];if(x==null)return;JSON.stringify(a.getState())!==JSON.stringify(x)&&v(x);return}a.dispatchFromDevtools&&typeof a.dispatch=="function"&&a.dispatch(E)});case"DISPATCH":switch(R.payload.type){case"RESET":return v(S),u===void 0?f?.init(a.getState()):f?.init(Pm(d.name));case"COMMIT":if(u===void 0){f?.init(a.getState());return}return f?.init(Pm(d.name));case"ROLLBACK":return tb(R.state,E=>{if(u===void 0){v(E),f?.init(a.getState());return}v(E[u]),f?.init(Pm(d.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return tb(R.state,E=>{if(u===void 0){v(E);return}JSON.stringify(a.getState())!==JSON.stringify(E[u])&&v(E[u])});case"IMPORT_STATE":{let{nextLiftedState:E}=R.payload,x=(T=E.computedStates.slice(-1)[0])?.state;if(!x)return;v(u===void 0?x:x[u]),f?.send(null,E);return}case"PAUSE_RECORDING":return g=!g}return}}),S},V6=U6,tb=(t,e)=>{let n;try{n=JSON.parse(t)}catch(i){console.error("[zustand devtools middleware] Could not parse the received json",i)}n!==void 0&&e(n)},j6=t=>(e,n,i)=>{let a=i.subscribe;return i.subscribe=(s,u,d)=>{let p=s;if(u){let f=d?.equalityFn||Object.is,m=s(i.getState());p=g=>{let v=s(g);if(!f(m,v)){let S=m;u(m=v,S)}},d?.fireImmediately&&u(m,m)}return a(p)},t(e,n,i)},q6=j6,F6=(t={},e)=>{switch(e.type){case Om:return{...t,[e.payload.id]:e.payload.type};case _m:return{...t,...e.payload.mapping};default:return t}};function Wf(t,e,n,i){return!(!t[n]||!t[n][e]||!t[n][e][i]||!Array.isArray(t[n][e][i]))}function G6(t,e){let n={},i=[];for(let[a,o]of Object.entries(t||{})){i.push(a);let s=(e||{})[a];if(!s||s.length===0){n[a]=o;continue}n[a]=s}for(let[a,o]of Object.entries(e||{}))i.indexOf(a)===-1&&(n[a]=o);return n}function Rt(t){return t.payload||{}}function k6(t,e,n){if(!t[e]||!Array.isArray(t[e]))return null;let i=n.index===void 0?t[e].findIndex(a=>a?Nu(a)?.id===n.id:!1):n.index;return i===-1?null:{entity:t[e][i],index:i}}function K2(t,e){if(!(!e?.id||!e?.type))return t[e.type]?.[e.id]}function Hm(t,e){return t===void 0?e:t}var Z2=(t=$1(),e)=>{let n=(i,a)=>({...t,[Rt(e).type]:{...t[Rt(e).type],[Rt(e).id]:{...i,...a}}});switch(e.type){case Sm:{if(!t[Rt(e).type]||!t[Rt(e).type][Rt(e).id])return t;let i=t[Rt(e).type][Rt(e).id];return typeof i=="string"?t:n(i,{[Rt(e).key]:Rt(e).value})}case bm:{if(!Wf(t,Rt(e).id,Rt(e).type,Rt(e).key))return t;let i=t[Rt(e).type][Rt(e).id];if(typeof i=="string")return t;let a=Array.from(i[Rt(e).key]),[o]=a.splice(Rt(e).startIndex,1);return a.splice(Rt(e).endIndex,0,o),n(i,{[Rt(e).key]:a})}case Qf:{let i=Rt(e).subjects,a=Rt(e).from,o=Rt(e).to||a,s=K2(t,a),u=o?.key||a.key;if(!Wf(t,a.id,a.type,a.key)||!Wf(t,o.id,o.type,o.key))return t;let d=[],p=[];if(i.type==="slice"){let E=i.startIndex,x=i.length;d=Array.from(s[a.key]),p=d.splice(E,x)}else{let E=Array.from(s[a.key]);for(let x of i.items){let A=k6(s,a.key,x);A&&(p.push(A.entity),E[A.index]=null),d=E.filter(C=>C!==null)}}let f={...s,[a.key]:d},m={...t,[a.type]:{...t[a.type],[a.id]:f}},g=K2(m,o);if(!g)return t;let v=o?.index===void 0?g[u].length:o.index,S=Array.from(g[o.key]);S.splice(v,0,...p);let R={...g,[u]:S};return{...m,[o.type]:{...m[o.type],[o.id]:R}}}case xm:return Z2(t,{type:Qf,payload:{subjects:{type:"list",items:[Rt(e).subject]},from:Rt(e).from,to:Rt(e).to}});case Rm:{let{id:i,index:a,key:o,newIdentifier:s,reference:u,type:d}=Rt(e),p=t[d][i],f=Nu(u);if(!p||!p[o]||!f||a<0)return t;let m=p[o],g=m[a],v=t[f.type]?.[f.id];if(!v||!g)return t;let S=L2(g,s),R=Array.from(m);R.splice(Hm(a,R.length+1),1,S);let T=n(p,{[o]:R}),E={...v,id:s};E["iiif-parser:hasPart"]&&(E["iiif-parser:hasPart"]=E["iiif-parser:hasPart"].filter(A=>A["iiif-parser:partOf"]===i).map(A=>({...A,id:s})));let x={...T[f.type],[s]:E};return T[f.type]=x,T}case vm:{let i=Object.keys(Rt(e).entities),a={...t};for(let o of i){let s=Rt(e).entities[o],u={...t[o]||{}},d=!1,p=Object.keys(s||{})||[];if(s&&p){for(let f of p)d=!0,u[f]=t[o][f]?G6(t[o][f],s[f]):s[f];d&&(a[o]=u)}}return a}case Em:{if(!Wf(t,Rt(e).id,Rt(e).type,Rt(e).key))return t;let i=t[Rt(e).type][Rt(e).id],a=Array.from(i[Rt(e).key]);return a.splice(Hm(Rt(e).index,a.length+1),0,Rt(e).reference),n(i,{[Rt(e).key]:a})}case Xf:case Am:{if(!Wf(t,Rt(e).id,Rt(e).type,Rt(e).key))return t;let i=t[Rt(e).type][Rt(e).id],a=Array.from(i[Rt(e).key]),o=Hm(Rt(e).index,a.findIndex(s=>s&&s.id===Rt(e).reference.id));return o===-1||a[o]?.id!==Rt(e).reference.id?t:(e.type===Xf?a.splice(o,1,Rt(e).reference):a.splice(o,1),n(i,{[Rt(e).key]:a}))}case Tm:{let i=t[Rt(e).type][Rt(e).id];if(!i)return t;let a=Array.from(i.metadata||[]),o=Rt(e);return a.splice(Hm(e.payload.beforeIndex,a.length+1),0,{label:o.label,value:o.label}),n(i,{metadata:a})}case wm:{let i=t[Rt(e).type][Rt(e).id];if(typeof i=="string"||!i)return t;let a=Array.from(i.metadata||[]),[o]=a.splice(Rt(e).startIndex,1);return a.splice(Rt(e).endIndex,0,o),n(i,{metadata:a})}case Kf:case Cm:{let i=t[Rt(e).type][Rt(e).id],a=Array.from(i.metadata||[]),o=Rt(e).atIndex;return o===void 0||o===-1||!a[o]?t:(e.type===Kf?a.splice(o,1,{label:Rt(e).label,value:Rt(e).value}):a.splice(o,1),n(i,{metadata:a}))}default:return t}},Y6=(t={},e)=>{switch(e.type){case zm:case Lm:return{...t,[e.payload.id]:{requestUri:e.payload.id,loadingState:Zf,uriMismatch:!1,resourceUri:e.payload.id}};case Im:return{...t,[e.payload.requestId]:{...t[e.payload.requestId]||{},uriMismatch:!0,resourceUri:e.payload.actualId},[e.payload.actualId]:{requestUri:e.payload.requestId,loadingState:t[e.payload.requestId].loadingState,uriMismatch:!0,resourceUri:e.payload.actualId}};case Nm:return{...t,[e.payload.id]:{...t[e.payload.id]||{},loadingState:Du,error:e.payload.message}};case Dm:return{...t,[e.payload.id]:{...t[e.payload.id]||{},loadingState:Lu,error:void 0}}}return t},Q6=(t={},e)=>{let{id:n,updateValue:i,value:a,meta:o,key:s}=e&&e.payload||{};switch(e.type){case Y1:return{...t,[n]:{...t[n]||{},[o]:{...t[n]&&t[n][o]||{},[s]:a}}};case Q1:return{...t,[n]:{...t[n]||{},[o]:{...t[n]&&t[n][o]||{},[s]:t[n]&&t[n][o]?i(t[n][o][s]):i(void 0)}}};case X1:return t[n]&&t[n][o]&&t[n][o][s]?{...t,[n]:{...t[n]||{},[o]:{...t[n]&&t[n][o]||{},[s]:void 0}}}:t;default:return t}};function J2(t={}){let e=Object.keys(t);return function(n={},i){let a=!1,o={};for(let s=0;s<e.length;s++){let u=e[s];o[u]=t[u](n[u],i),a||(a=o[u]!==n[u])}return a?o:n}}function X6(t){return(e,n)=>n&&n.type===Bu?n.payload.actions.reduce(t,e):n&&n.type===Bm?{...e,iiif:{...e.iiif,...n.payload.state}}:t(e,n)}var K6=J2({mapping:F6,entities:Z2,requests:Y6,meta:Q6});function Z6(){return{iiif:{entities:$1(),meta:{},mapping:{},requests:{}}}}function W2(t={}){let{enableDevtools:e=!1,iiifStoreName:n="iiif",defaultState:i=Z6(),customReducers:a={}}=t,o=X6(J2({[n]:K6,...a})),s=!!(typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__);return cm(q6((s?V6:(d,p)=>d)(P6(o,i),{enabled:e})))}function ui(t,e,n,i=!0){e[Uu]=e[Uu]||[],e[Uu].push(t);let a=new Map;Object.defineProperty(e,t,{enumerable:i,get(){if(e[os][t]===void 0)return;let o=e[os][t];if(!o)return o;let s=n.get(e[os][t],{parent:this.id?{id:this.id,type:this.type}:void 0});return a.has(s)||(a.clear(),a.set(s,rs(s,n))),a.get(s)},set(o){e[os][t]!==o&&(this[as]?n.modifyEntityField({id:this.id,type:this.type},t,eM(o)):this[os][t]=o)}})}var os=Symbol.for("_refs_"),as=Symbol.for("_reactive_"),Uu=Symbol.for("_defined_"),$2=Symbol.for("_parent_");function J6(t,e=!1,n){let i={id:"",type:"unknown",[Uu]:[],[os]:{},[$2]:n||null,[as]:null,is(a){return typeof a=="string"?this.id===a:a.id?a.id===this.id:!1},reactive(){if(!this[as])return this[as]=this.subscribe(()=>this.refresh(),!0),()=>{this.unreactive()}},refresh(){if(this.id){let a=this.unwrap();for(let o of Object.keys(a||{}))this[Uu].includes(o)?this[os][o]=a[o]:this[o]=a[o]}},unreactive(){this[as]&&(this[as](),this[as]=null)},unwrap(){if(!this.id)throw Error("Invalid object");let a=this[$2];return t.get(this.id,{parent:a?{id:a,type:"unknown"}:void 0})},toPresentation3(){return t.toPresentation3(this.unwrap())},toPresentation2(){return t.toPresentation2(this.unwrap())},valueOf(){return this.unwrap()},toJSON(){let a=this;return{...a,items:a.items,annotations:a.annotations,structures:a.structures,seeAlso:a.seeAlso,service:a.service,services:a.services,rendering:a.rendering,partOf:a.partOf,start:a.start,supplementary:a.supplementary,homepage:a.homepage,thumbnail:a.thumbnail,placeholderCanvas:a.placeholderCanvas,accompanyingCanvas:a.accompanyingCanvas,provider:a.provider}},subscribe(a,o=!0){return t.subscribe(()=>this.id?t.get(this.id):null,a,o)}};return ui("items",i,t),ui("annotations",i,t),ui("structures",i,t),ui("seeAlso",i,t),ui("rendering",i,t),ui("partOf",i,t),ui("start",i,t,!1),ui("supplementary",i,t),ui("homepage",i,t),ui("thumbnail",i,t),ui("placeholderCanvas",i,t,!1),ui("accompanyingCanvas",i,t,!1),ui("provider",i,t),ui("body",i,t),ui("logo",i,t),i}function W6(t){return!!t[Uu]}function eM(t){return Array.isArray(t)?t.map(e=>eM(e)):!t||!t.type?t:{id:t.id,type:t.type}}function rs(t,e,n=!1,i){if(Array.isArray(t))return t.map(u=>rs(u,e,n));if(!t||!t.type||!t.id)return t;let a=J6(e,n),o=Object.create(a),s=Object.assign(o,t);return n&&s.reactive(),s}function tM(t){switch(t){case"Image":case"Video":case"Sound":case"Dataset":case"Text":case"Composite":case"List":case"Independents":case"Audience":return"ContentResource";case"ImageService1":case"ImageService2":case"ImageService3":return"Service"}return t}var Vu=class{constructor(t,e){An(this,"options",void 0),An(this,"store",void 0),An(this,"emitter",void 0),An(this,"isBatching",!1),An(this,"batchQueue",[]),An(this,"remoteFetcher",void 0),An(this,"staticFetcher",void 0),An(this,"defaultFetcher",n=>fetch(n).then(i=>{if(i.status===200)return i.json();{let a=Error(`${i.status} ${i.statusText}`);throw a.name="HTTPError",a}})),this.options=Object.assign({reducers:{},customFetcher:this.defaultFetcher,enableDevtools:!0},t||{}),this.store=e||W2({customReducers:this.options.reducers,defaultState:this.options.defaultState,enableDevtools:this.options.enableDevtools}),this.emitter=fm(),this.remoteFetcher=W1(this,this.options.customFetcher),this.staticFetcher=W1(this,(n,i)=>i)}batch(t){this.isBatching=!0;try{t(this),this.isBatching=!1,this.dispatch(Pu({actions:this.batchQueue}))}catch(e){throw this.batchQueue=[],this.isBatching=!1,e}this.batchQueue=[]}async asyncBatch(t){this.isBatching=!0;try{await t(this),this.isBatching=!1,this.dispatch(Pu({actions:this.batchQueue}))}catch(e){throw this.batchQueue=[],this.isBatching=!1,e}this.batchQueue=[]}modifyEntityField(t,e,n){this.dispatch(is.modifyEntityField({id:t.id,type:t.type,key:e,value:n}))}dispatch(t){if(this.isBatching)this.batchQueue.push(t);else{if(t.type===Bu){for(let i of t.payload.actions)this.emitter.emit(i.type,{action:i,state:this.store.getState()});this.store.dispatch(t);let n=this.getState();for(let i of t.payload.actions)this.emitter.emit(`after:${i.type}`,{action:i,state:n});return}this.emitter.emit(t.type,{action:t,state:this.store.getState()}),this.store.dispatch(t);let e=this.store.getState();this.emitter.emit(`after:${t.type}`,{action:t,state:e});return}}on(t,e){return this.emitter.on(t,e),()=>{this.emitter.off(t,e)}}serialize(t,e){return H1(this.getState().iiif,t,e)}toPresentation2(t){return this.serialize(t,U1)}toPresentation3(t){return this.serialize(t,V1)}hydrate(t,e,n={}){return this.get(t,e,{...n,skipSelfReturn:!1})}get(t,e,n={}){typeof e!="string"&&(n=e||{},e=void 0);let{skipSelfReturn:i=!0}=n||{},a=n.parent?typeof n.parent=="string"?n.parent:n.parent.id:void 0;if(Array.isArray(t))return t.map(f=>this.get(f,n));let o=this.getState();if(ki(t)&&!n.preserveSpecificResources&&(t=t.source),typeof t=="string"){let f=tM(e||o.iiif.mapping[t]);if(!f)return i?null:{id:t,type:"unknown"};t={id:t,type:f}}if(t&&t.partOf&&!a&&!n.skipPartOfCheck){let f=Array.isArray(t.partOf)?t.partOf[0]:t.partOf;f&&(typeof f=="string"&&(a=f),typeof f.id=="string"&&(a=f.id))}let s=tM(e||t?.type),u=t?.id,d=o.iiif.entities[s];if(!d){let f=o.iiif.requests[u];return f&&f.resourceUri!==u?this.get(f.resourceUri,n):i?null:t}let p=d[t.id];if(p&&p[Ke]){let f=p[Ke].find(m=>a?m[Yi]===a:m[Yi]===p.id);return Iu(p,f)}return d[t.id]||(i?null:t)}select(t){return t(this.getState())}getStore(){return this.store}getState(){return this.store.getState()}deep(t,e){if(t===void 0)return this.get(e,{skipSelfReturn:!1});if(typeof t=="function")try{let i=t(this.get(e,{skipSelfReturn:!1})),a=o=>this.deep(o,i);return a.size=Array.isArray(i)?i.length:1,a}catch{let i=a=>this.deep(a,void 0);return i.size=0,i}let n=i=>this.deep(i,t);return n.size=Array.isArray(t)?t.length:1,n}loadManifest(t,e,n){let i=typeof t=="string"?t:t.id;return this.load(i,e,n)}loadCollection(t,e,n){let i=typeof t=="string"?t:t.id;return this.load(i,e,n)}load(t,e,n){let i=typeof t=="string"?t:t.id;return e?Promise.resolve(this.staticFetcher(i,e,n)):Promise.resolve(this.remoteFetcher(i,{},n))}loadSync(t,e,n){let i=typeof t=="string"?t:t.id;return this.staticFetcher(i,e,n)}loadManifestSync(t,e,n){let i=typeof t=="string"?t:t.id;return this.loadSync(i,e,n)}loadCollectionSync(t,e,n){let i=typeof t=="string"?t:t.id;return this.loadSync(i,e,n)}areInputsEqual(t,e){return J1(t,e)}subscribe(t,e,n){return n===void 0&&(e===void 0||e===!1||e===!0)&&(n=e,e=t,t=i=>i),this.store.subscribe(t,i=>e(i,this),{equalityFn:J1,fireImmediately:!n})}async ensureLoaded(t){let e=typeof t=="string"?t:t.id;this.requestStatus(e)||await this.load(e)}requestStatus(t){return this.select(e=>e.iiif.requests[t])}getPaginationState(t){let e=typeof t=="string"?t:t.id;if(!e)return null;let n=this.getResourceMeta(e,"@vault/pagination");if(n?.state)return n.state;let i=this.get(t);if(i.first){let a={currentPage:null,currentPageIndex:null,isFetching:!1,isFullyLoaded:!1,next:i.first,page:1,pages:[],previous:null,totalItems:i.total,currentLength:0};return this.setMetaValue([e,"@vault/pagination","state"],a),a}return null}async loadNextPage(t,e){let n=typeof t=="string"?t:t.id;if(!n)return[null,null];let i=this.getPaginationState(t);if(!i||i.isFullyLoaded||!i.next)return[null,null];if(i.isFetching)return[i,null];let a=typeof i.next=="string"?i.next:i.next.id,o=i.currentPage,s={...i,isFetching:!0};this.setMetaValue([n,"@vault/pagination","state"],s);let u;try{u=await this.loadCollection(a,e,g=>{let{id:v,"@id":S,...R}=g||{};return S?{"@id":a,...R}:{id:a,...R}})}catch(g){let v={...i,isFetching:!1,error:g};return this.setMetaValue([n,"@vault/pagination","state"],v),[v,null]}if(!u){let g={...i,isFetching:!1,error:Error("Collection not found")};return this.setMetaValue([n,"@vault/pagination","state"],g),[g,null]}let d=this.get(n),p=[...d.items||[],...u.items||[]].map(g=>({id:g.id,type:g.type}));this.modifyEntityField({id:n,type:"Collection"},"items",p);let f=this.getPaginationState(t);if(!f)throw Error("Pagination state not found");let m={...f,isFetching:!1,error:null,currentPage:u.id,next:u.next?.id||null,currentPageIndex:f.pages.length,currentLength:p.length,pages:[...f.pages,{id:u.id,type:"Collection",startIndex:d.items.length,pageLength:u.items.length,order:typeof f.currentPageIndex=="number"?f.currentPageIndex+1:0}],isFullyLoaded:!u.next,previous:o,page:f.pages.length+1};return this.setMetaValue([n,"@vault/pagination","state"],m),[m,u]}getResourceMeta(t,e){let n=this.getState().iiif.meta[t];if(n)return e?n[e]:n}getObject(t,e,n={}){let{reactive:i,...a}=n;return rs(this.get(t,e,a),this,i)}async loadObject(t,e){return rs(await this.load(t,e),this)}async loadManifestObject(t,e){return rs(await this.loadManifest(t,e),this)}async loadCollectionObject(t,e){return rs(await this.loadCollection(t,e),this)}wrapObject(t){return rs(this.get(t,{skipSelfReturn:!1}),this)}isWrapped(t){return W6(t)}setMetaValue([t,e,n],i){this.dispatch(typeof i=="function"?K1.setMetaValueDynamic({id:t,meta:e,key:n,updateValue:i}):K1.setMetaValue({id:t,meta:e,key:n,value:i}))}};function nM(){return typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}function $f(t){let e=nM();try{let i=e.IIIF_VAULT;if(i)return i}catch{}let n=new Vu(t);try{e.IIIF_VAULT=n}catch{}return n}var nb=_(V(),1),Br=Um.default.createContext({vault:null,setVaultInstance:t=>{}});function ls({vault:t,vaultOptions:e,useGlobal:n,resources:i,children:a}){let[o,s]=(0,Um.useState)(()=>t||(n?$f(e):e?new Vu(e):new Vu));return(0,nb.jsx)(Br.Provider,{value:{vault:o,setVaultInstance:s},children:(0,nb.jsx)(si,{value:i||{},children:a})})}var aM=_(X(),1),oM=_(X(),1);var iM=_(X(),1),Ut=()=>{let{vault:t}=(0,iM.useContext)(Br);if(t===null)throw new Error("Vault not found. Ensure you have your provider set up correctly.");return t};var Vm=_(X(),1);function ie(t,e=[]){let n=Ut(),[i,a]=(0,Vm.useState)(()=>t(n.getState(),n));return(0,Vm.useEffect)(()=>n.subscribe(o=>t(o,n),o=>{a(o)},!1),e),i}var ss=oM.default.createContext([]);function us(){let t=(0,aM.useContext)(ss);return ie(e=>t.map(n=>e.iiif.entities.Canvas[n]).filter(Boolean),[t])}var rM=_(X(),1);function cs(t){let e=(0,rM.useContext)(Br);return t||(e&&e.vault?e.vault:$f())}var lM=_(X(),1);function an(t={},e=[]){let{id:n,selector:i}=t,a=Wn(),o=Ut(),s=n||a.manifest,u=ie(d=>s?d.iiif.entities.Manifest[s]:void 0,[s]);return(0,lM.useMemo)(()=>{if(u)return i?i(u):u},[u,i,...e])}var DM=_(X(),1),Xm=_(X(),1);var Pr=_(X(),1);function td(t,{noCache:e=!1}={}){let n=typeof t=="string"?t:t.id,i=cs(),[a,o]=(0,Pr.useState)(n),[s,u]=(0,Pr.useState)(void 0),d=(0,Pr.useMemo)(()=>i.get(n,{skipSelfReturn:!0})||void 0,[n,i]),[p,f]=(0,Pr.useState)(d);return(0,Pr.useEffect)(()=>{(async()=>{try{let m=d&&!e?d:await i.load(n),g=m?m.id||m["@id"]:null;m&&a!==g&&o(g),f(m)}catch(m){u(m)}})()},[n,e]),{isLoaded:!!p,id:a,requestId:n,error:s,resource:p,cached:!!(p&&p===d)}}function ib(t,e){let{id:n,isLoaded:i,error:a,resource:o,requestId:s,cached:u}=td(t,e);return{id:n,isLoaded:i,error:a,manifest:o,requestId:s,cached:u}}var sM=_(V(),1);function ab({manifest:t,children:e}){return(0,sM.jsx)(si,{value:{manifest:t},children:e})}var uM=_(V(),1);function ob({range:t,children:e}){return(0,uM.jsx)(si,{value:{range:t},children:e})}function cM(t,e){for(let n of e.items){if(n.type==="Canvas")return n;if(n.type==="SpecificResource")return n.source;if(n.type==="Range"){let i=cM(t,t.get(n));if(i)return i}}return null}function jm(t,e){let n=[];for(let i of e.items)if(i.type==="SpecificResource"&&i.source?.type==="Canvas"&&(i.source.id.indexOf("#")!==-1?n.push({id:i.source.id.split("#")[0],type:"Canvas"}):n.push(i.source)),i.type==="Range"&&n.push(...jm(t,t.get(i))),i.type==="SpecificResource"){let a=typeof i.source=="string"?i.source:i.source.id;n.push({id:a,type:"Canvas"})}return n}function $6(t,e,n){for(let i of e.structures){let a=rb(t,t.get(i),n);if(a)return a}return null}function rb(t,e,n){for(let i of e.items){let a=i?.source?.id?.split("#")[0];if(i.type==="SpecificResource"&&i.source===n||i.type==="SpecificResource"&&i.source?.type==="Canvas"&&n===a)return e;if(i.type==="Range"){let o=rb(t,t.get(i),n);if(o)return o}}return null}function tH(t,e,n,i=!1){let a=e.behavior,o=n?t.get(n):null;if(!o)return[];let s=o.behavior,u=i?!1:a.includes("paged"),d=u?!1:a.includes("continuous"),p=u||d?!1:a.includes("individuals"),f=s.includes("facing-pages"),m=s.includes("non-paged");if(f||m||p||i)return[{id:o.id,type:"Canvas"}];let[g,v]=qm(t,e);if(d)return g;let S=g.findIndex(R=>R.id===n);if(S===-1)return[];for(let R of v)if(R.includes(S))return R.map(T=>g[T]);return[{id:o.id,type:"Canvas"}]}function qm(t,e,{disablePaging:n,skipNonPaged:i}={}){let a=e.behavior,o=a.includes("paged"),s=o?!1:a.includes("continuous"),u=o||s?!1:a.includes("individuals"),d=e.type==="Manifest"?e.items:jm(t,e);if(s)return[d,[d.map((S,R)=>R)]];if(u||!o||n)return[d,d.map((S,R)=>[R])];let p=[],f=[],m=()=>{f.length&&(p.push([...f]),f=[])},g=0,v=!1;for(let S=0;S<d.length;S++){let R=t.get(d[S]);if(R.behavior.includes("non-paged")){S===g&&g++,i||(m(),p.push([S]),m());continue}if(S===g||R.behavior.includes("facing-pages")){f.length&&(v=!0),m(),p.push([S]),m();continue}if(f.push(S),v){m(),v=!1;continue}f.length>1&&m()}return f.length&&m(),[d,p]}var Fa=_(X(),1);var fM=_(X(),1);function ed(t={},e=[]){let{id:n,selector:i}=t,a=Wn(),o=n||a.range,s=ie(u=>o?u.iiif.entities.Range[o]:void 0,[o]);return(0,fM.useMemo)(()=>{if(s)return i?i(s):s},[s,i,...e])}function lb({startCanvas:t,disablePaging:e}){let n=Ut(),i=an(),a=ed(),[o,s]=(0,Fa.useState)(void 0),u=a||i;if(!u)throw new Error("Nothing selected");let[d,p]=(0,Fa.useMemo)(()=>qm(n,u,{disablePaging:e}),[n,u,e]),f=(0,Fa.useRef)(p);if(f.current!==p){let T=f.current[o][0],E=p.findIndex(x=>x.includes(T));f.current=p,s(E)}let m=(0,Fa.useCallback)(R=>{let T=p.findIndex(E=>E.includes(R));s(T===-1?0:T)},[d,p]),g=(0,Fa.useCallback)(R=>{let T=d.findIndex(E=>E.id===R);T!==-1?m(T):s(0)},[d,p]),v=(0,Fa.useCallback)(()=>{s(R=>R>=p.length-1?R:R+1)},[p]),S=(0,Fa.useCallback)(()=>{s(R=>R<=0?0:R-1)},[p]);return typeof o>"u"&&(t?g(t):s(0)),{visibleItems:p[o]?.map(R=>d[R].id)||[],cursor:o,items:d,sequence:p,hasPrevious:o>0,hasNext:o<p.length-1,setSequenceIndex:s,setCanvasIndex:m,setCanvasId:g,next:v,previous:S}}var ka=_(X(),1);var hM={},dM=t=>{let e,n=new Set,i=(f,m)=>{let g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){let v=e;e=m??(typeof g!="object"||g===null)?g:Object.assign({},e,g),n.forEach(S=>S(e,v))}},a=()=>e,d={setState:i,getState:a,getInitialState:()=>p,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(hM.env?hM.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},p=e=t(i,a,d);return d},Qi=t=>t?dM(t):dM;var AM=_(X(),1),TM=_(xM(),1),Gm={},{useDebugValue:vH}=AM.default,{useSyncExternalStoreWithSelector:SH}=TM.default,EM=!1,bH=t=>t;function St(t,e=bH,n){(Gm.env?Gm.env.MODE:void 0)!=="production"&&n&&!EM&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),EM=!0);let i=SH(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return vH(i),i}var RM=t=>{(Gm.env?Gm.env.MODE:void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");let e=typeof t=="function"?Qi(t):t,n=(i,a)=>St(e,i,a);return Object.assign(n,e),n},km=t=>t?RM(t):RM;function xH(t){let e=t.service||t.services||[];for(let n of e)if(n.type==="AuthProbeService2")return!0;return!1}function Ga(t,e,n){let i=e.findIndex(s=>s.service.id===t);if(i===-1)return e;let a=[...e],o=n(a[i]);return o===a[i]?e:(a[i]=o,a)}var cb=()=>Qi((t,e)=>({currentAuth:-1,authItems:[],login:()=>{let n=e().authItems[e().currentAuth];if(!n||n.isPending||n.isLoggedIn)return;if(n.type!=="active")throw new Error("Cannot login to non-active service");let i=n.service.service.find(a=>a.type==="AuthAccessTokenService2");if(!i)throw new Error("Token service not found");t(()=>({authItems:Ga(n.id,e().authItems,a=>({...a,isPending:!0}))})),ub(n.service).then(()=>{Ym(i).then(a=>{let o=a.expiresIn,s=Date.now()+o*1e3;t(()=>({authItems:Ga(n.id,e().authItems,u=>({...u,isLoggedIn:!0,isPending:!1,session:{token:a.accessToken,expires:s}}))}))}).catch(a=>{t(()=>({authItems:Ga(n.id,e().authItems,o=>({...o,isLoggedIn:!1,isPending:!1,error:a.message}))}))})})},logout:()=>{let n=e().authItems[e().currentAuth];if(!n||n.isPending||!n.isLoggedIn)return;if(n.type!=="active")throw new Error("Cannot logout of non-active service");let i=n.service.service.find(s=>s.type==="AuthLogoutService2");if(!i)return;let a=`${i.id}?origin=${CM()}`,o=window.open(a);t(()=>({authItems:Ga(n.id,e().authItems,s=>({...s,isLoggedIn:!1,session:null,isPending:!1}))}))},nextAuth:()=>{let n=e().authItems.length,i=e().currentAuth+1;i>=n||t(()=>({currentAuth:i}))},previousAuth:()=>{let n=e().currentAuth-1;n<0||t(()=>({currentAuth:n}))},setAuth:n=>{n!==-1&&(n<0||n>=e().authItems.length)||t(()=>({currentAuth:n}))},addService:(n,i)=>{if(!n.service)return;let a=n.service.find(u=>u.type==="AuthAccessTokenService2"),o=n;if(e().authItems.find(u=>u.service.id===n.id)){t(()=>({authItems:Ga(n.id,e().authItems,u=>({...u,instances:u.instances+1}))}));return}if(t(()=>({currentAuth:o.profile==="active"?0:e().currentAuth,authItems:[{id:n.id,type:n.profile,service:n,probeId:i,canAuthenticate:!0,instances:1,isPending:!1,isLoggedIn:!1,session:null},...e().authItems]})),n.profile==="external"){if(!a)throw new Error("Token service not found");Ym(a).then(u=>{t(()=>({authItems:Ga(n.id,e().authItems,d=>({...d,isLoggedIn:!0,isPending:!1,session:{token:u.accessToken,expires:u.expiresIn}}))}))}).catch(u=>{t(()=>({authItems:Ga(n.id,e().authItems,d=>({...d,isLoggedIn:!1,isPending:!1,canAuthenticate:!1,error:u.message}))}))})}if(n.profile==="kiosk"){if(!a)throw new Error("Token service not found");t(()=>({authItems:Ga(n.id,e().authItems,u=>({...u,isPending:!0}))})),ub(o).then(()=>{Ym(a).then(u=>{t(()=>({authItems:Ga(n.id,e().authItems,d=>({...d,isLoggedIn:!0,isPending:!1,session:{token:u.accessToken,expires:u.expiresIn}}))}))}).catch(u=>{t(()=>({authItems:Ga(n.id,e().authItems,d=>({...d,isLoggedIn:!1,isPending:!1,error:u.message}))}))})})}n.profile},removeService:(n,i)=>{let a=e().currentAuth===e().authItems.findIndex(s=>s.service.id===n.id),o=e().currentAuth;if(a){let s=e().authItems.find(d=>d.service.id===n.id);s&&s.instances>1||(o=e().authItems.findIndex(p=>p.service.id!==n.id&&p.instances>0))}t(()=>({authItems:Ga(n.id,e().authItems,s=>({...s,instances:s.instances-1})),currentAuth:o}))}})),fb=(t,e)=>Qi((n,i)=>({service:t,status:t?"unknown":"success",shouldRedirect:!1,redirectResource:null,shouldSubstitute:!1,substituteResource:null,error:null,errorHeading:null,errorNote:null,shouldDisplayResource:!1,token:e||null,async probe(){if(!i().service)return;let a=i().service?.id;if(!a){n({status:"error",error:"Service ID not found",errorHeading:{en:["Service ID not found"]}});return}n({status:"probing"});let o=i().token;try{let s=await fetch(a,{headers:o?{Authorization:`Bearer ${i().token}`,Accept:"application/json"}:{Accept:"application/json"}}).then(u=>u.json());if(s.status===200)n({status:"success",shouldDisplayResource:!0,error:null,errorHeading:null,errorNote:null,shouldSubstitute:!1,shouldRedirect:!1});else if(s.status<400&&s.status>=300){if(!s.location)throw new Error("Redirect location not found");n({status:"error",shouldDisplayResource:!1,shouldRedirect:!0,redirectResource:s.location||null})}else if(s.status===401)n({status:"error",shouldDisplayResource:!1,shouldRedirect:!1,shouldSubstitute:!!s.substitute,substituteResource:s.substitute||null,error:"Unauthorized",errorHeading:s.heading||{en:["Unauthorized"]},errorNote:s.note||null});else throw new Error("Unknown error")}catch(s){n({status:"error",error:s.message,errorHeading:{en:["Unknown error"]}})}},setToken(a){n({token:a})}}));function db(t){let e=t.service||t.services||[],n={hasAuth:!1,services:{}};for(let i of e)if(i.type==="AuthProbeService2"){n.services.probe=i,n.hasAuth=!0;let a=i.service.filter(o=>o.type==="AuthAccessService2");a[0]&&(n.services.access=a[0])}return n}async function Ym(t,{strict:e=!0}={}){return new Promise((n,i)=>{let a=Math.random().toString(36).substring(7),o=`${t.id}?messageId=${a}&origin=${window.location.origin}`,s=p=>{let f=p.data;if(f.messageId===a){if(e&&f.type!=="AuthAccessToken2"){u(),i("Invalid response, expected type=AuthAccessToken2");return}if(!f.accessToken){u(),i("Invalid response, expected accessToken");return}u(),n(f)}},u=()=>window.removeEventListener("message",s),d=document.createElement("iframe");d.src=o,d.style.display="none",document.body.appendChild(d),window.addEventListener("message",s)})}function CM(t){let e=window.location;if(t){let n=document.createElement("a");return n.href=t,n.protocol+"//"+n.hostname+(n.port?":"+n.port:"")}return e.protocol+"//"+e.hostname+(e.port?":"+e.port:"")}async function ub(t){let e=`${t.id}?origin=${CM()}`,n=window.open(e);if(!n)throw new Error("Failed to open window");return new Promise((i,a)=>{let o=setInterval(()=>{n.closed&&(clearInterval(o),i())},500)})}var qu=_(X(),1);function wM(t){let e=(0,qu.useMemo)(()=>db(t),[t]),n=hb(e.services.access?.id),i=(0,qu.useMemo)(()=>fb(e.services.probe,n),[e.services.probe]),a=St(i);return(0,qu.useEffect)(()=>{a.status==="unknown"&&!n&&a.probe()},[e.services.probe,a.status]),(0,qu.useEffect)(()=>{n&&(a.setToken(n),a.probe())},[n]),[t,a,e.hasAuth]}var nd=_(V(),1),fs=(0,ka.createContext)(null),MM=(0,ka.createContext)(null);MM.displayName="CurrentAuth";var OM=(0,ka.createContext)(null);OM.displayName="AuthActions";function mb({children:t}){let e=(0,ka.useMemo)(()=>cb(),[]);return(0,nd.jsx)(fs.Provider,{value:e,children:t})}function gb(){return!!(0,ka.useContext)(fs)}function Fu(){let t=(0,ka.useContext)(fs);if(!t)throw new Error("useAuthActions must be used within a AuthProvider");return t}function _M(){let t=Fu();return St(t,n=>({login:n.login,logout:n.logout,nextAuth:n.nextAuth,previousAuth:n.previousAuth,setAuth:n.setAuth,addService:n.addService,removeService:n.removeService}))}function EH(){let t=Fu();return St(t,e=>e)}function zM(t){let e=Fu();return St(e,i=>i.authItems.find(a=>a.service.id===t))}function hb(t){let e=Fu();return St(e,i=>i.authItems.find(a=>a.id===t)?.session?.token)}function RH(t){let e=Fu();return St(e,i=>{let a=i.authItems.find(o=>o.service.id===t);return!a||!a.isLoggedIn||!a.session?null:a.session?.token||null})}function AH(t){let e=_M(),n=zM(t.service.id);return(0,ka.useEffect)(()=>(e?.addService(t.service,t.probeId),()=>{e?.removeService(t.service,t.probeId)}),[t.service]),n?(n.error||!n.isLoggedIn,t.children):null}function pb(){return null}function yb(t){let[e,n,i]=wM(t.resource),a=t.fallbackComponent||pb,o=t.loadingComponent||pb,s=t.errorComponent||pb,u=n.service,d=null;if(!i||!u)return t.children(e);let p=u.service.filter(f=>f.type==="AuthAccessService2");n.status==="error"&&(d=(0,nd.jsx)(s,{resource:t.resource,error:n.error||"",heading:n.errorHeading,note:n.errorNote,extra:t.extra})),(n.status==="unknown"||n.status==="probing")&&(d=(0,nd.jsx)(o,{})),n.status==="success"&&(d=t.children(e));for(let f of p)d=(0,nd.jsx)(AH,{service:f,probeId:u.id,children:d},f.id);return d}var id=_(X(),1);var TH=t=>t.id||t["@id"];function CH(t){return(Array.isArray(t.service)?t.service:[t.service]).find(n=>n.profile==="http://iiif.io/api/search/0/autocomplete"||n.profile==="http://iiif.io/api/search/1/autocomplete"||n.profile==="AutoCompleteService1")}var NM=t=>{let e;typeof t=="string"?e={"@context":"http://iiif.io/api/search/1/context.json",profile:"http://iiif.io/api/search/1/search","@id":t,id:t,service:[]}:e=t;let n=e?TH(e):void 0,i=null;return Qi((a,o)=>({service:e,resources:[],lastQuery:{},loading:!1,error:!1,highlight:null,hasSearch:!!e,hasAutocomplete:e?!!CH(e):!1,errorMessage:"",search(s,u={}){if(!n)throw new Error("No search service found.");i&&!i.signal.aborted&&i.abort(),i=new AbortController;let d=new URLSearchParams;s.q&&d.set("q",s.q),s.motivation&&d.set("motivation",s.motivation),s.date&&d.set("date",s.date),s.user&&d.set("user",s.user),a({loading:!0}),fetch(`${n}?${d.toString()}`,{signal:i.signal,headers:{"Content-Type":"application/json",Accept:"application/json",...u.headers||{}}}).then(async p=>{if(!i?.signal.aborted)if(p.ok){let f=await p.json();a({resources:f.resources,error:!1,errorMessage:""})}else a({resources:[],error:!0,errorMessage:p.statusText})})},clearSearch(){a({resources:[],error:!1,errorMessage:""})},highlightResult(s){let u=o().resources.find(d=>d["@id"]===s);a({highlight:u})},nextResult(){let s=o().resources,u=o().highlight;if(!u){a({highlight:s[0]||null});return}let d=s.findIndex(p=>p["@id"]===u["@id"]);if(d===-1){a({highlight:s[0]||null});return}a({highlight:s[d+1]||s[0]||null})},previousResult(){let s=o().resources,u=o().highlight;if(!u){a({highlight:s[s.length-1]||null});return}let d=s.findIndex(p=>p["@id"]===u["@id"]);if(d===-1){a({highlight:s[s.length-1]||null});return}if(d===0){a({highlight:s[s.length-1]||null});return}a({highlight:s[d-1]||s[s.length-1]||null})}}))};function vb(){let t=an();return t?t.service.find(e=>e.profile==="SearchService1"||e.profile==="http://iiif.io/api/search/1/search"):void 0}var Qm=_(V(),1),Gu=(0,id.createContext)(null);Gu.displayName="Search";function IM(t){let e=vb();return t.store?(0,Qm.jsx)(Gu.Provider,{value:t.store,children:t.children}):(0,Qm.jsx)(wH,{service:e,children:t.children})}function wH({service:t,children:e}){let n=(0,id.useMemo)(()=>NM(t),[t]);return(0,Qm.jsx)(Gu.Provider,{value:n,children:e})}var Ri=_(V(),1),ad=()=>{},ku=(0,Xm.createContext)({setCurrentCanvasId:ad,setCurrentCanvasIndex:ad,nextCanvas:ad,previousCanvas:ad,items:[],sequence:[],setSequenceIndex:ad,currentSequenceIndex:0,hasNext:!1,hasPrevious:!1});function LM(t){let e=an(),{cursor:n,visibleItems:i,next:a,sequence:o,items:s,setCanvasIndex:u,setCanvasId:d,previous:p,setSequenceIndex:f,hasNext:m,hasPrevious:g}=lb({startCanvas:t.startCanvas,disablePaging:t.pagingEnabled===!1}),v=(0,Xm.useMemo)(()=>({sequence:o,items:s,setCurrentCanvasId:d,nextCanvas:a,previousCanvas:p,totalCanvases:s.length,setCurrentCanvasIndex:u,setSequenceIndex:f,currentSequenceIndex:n,hasNext:m,hasPrevious:g}),[o,s,d,a,p,s,u,f,n]);return e?i.length===0?null:(0,Ri.jsx)(ku.Provider,{value:v,children:(0,Ri.jsx)(ss.Provider,{value:i,children:(0,Ri.jsx)(Sa,{canvas:i[0],children:t.children})})}):(console.warn("The manifest passed to the provider is not a valid IIIF manifest."),(0,Ri.jsx)("div",{children:"Sorry, something went wrong."}))}function Sb(t){let e=cs(t.vault),n=ib(t.manifest);if(!n)return console.warn("The manifest passed to the provider is not a valid IIIF manifest."),(0,Ri.jsx)("div",{children:"Sorry, something went wrong."});if(n.error)return(0,Ri.jsx)("div",{children:n.error.toString()});if(!n.isLoaded)return(0,Ri.jsx)("div",{children:"Loading..."});let i=(0,Ri.jsx)(LM,{...t,children:t.children});return(0,Ri.jsx)(ls,{vault:e,children:(0,Ri.jsx)(ab,{manifest:n.id,children:(0,Ri.jsx)(mb,{children:(0,Ri.jsx)(IM,{children:t.rangeId?(0,Ri.jsx)(ob,{range:t.rangeId,children:i}):i})})})})}function ds(){return(0,DM.useContext)(ku)}var Hr=(t,e,n)=>{let i=t.length,a=n||gt(i);for(let o=0;o<i;o++)a[o]=o%5===0?t[o+1]<e[3]&&t[o+3]>e[1]&&t[o+2]<e[4]&&t[o+4]>e[2]?1:0:t[o];return a};function gt(t,e,n){return new Float32Array(t,e,n)}var BM=(t,e,n)=>{let i=t[1]<=e[3]&&t[3]>=e[1]&&t[2]<=e[4]&&t[4]>=e[2],a=n||gt(5);return i?(a[0]=1,a[1]=Math.max(t[1],e[1]),a[2]=Math.max(t[2],e[2]),a[3]=Math.min(t[3],e[3]),a[4]=Math.min(t[4],e[4]),a):(a[0]=0,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a)},PM=t=>t.length/5;var Ai=(t,e,n)=>{let i=n||gt(9);return i[0]=t[0]*e[0]+t[1]*e[3]+t[2]*e[6],i[1]=t[0]*e[1]+t[1]*e[4]+t[2]*e[7],i[2]=t[0]*e[2]+t[1]*e[5]+t[2]*e[8],i[3]=t[3]*e[0]+t[4]*e[3]+t[5]*e[6],i[4]=t[3]*e[1]+t[4]*e[4]+t[5]*e[7],i[5]=t[3]*e[2]+t[4]*e[5]+t[5]*e[8],i[6]=t[6]*e[0]+t[7]*e[3]+t[8]*e[6],i[7]=t[6]*e[1]+t[7]*e[4]+t[8]*e[7],i[8]=t[6]*e[2]+t[7]*e[5]+t[8]*e[8],i},Nt=class t{constructor(e){this.index=0,this.length=e,this.points=gt(this.length)}static grid(e=1,n=1){return new t(5*e*n)}static point(e,n){let i=gt(5);return i[0]=1,i[1]=e,i[2]=n,i[3]=e,i[4]=n,i}static positionPair(e){let n=gt(5);return n[0]=1,n[1]=e.x1,n[2]=e.y1,n[3]=e.x2,n[4]=e.y2,n}static projection(e){return t.singleBox(e.width,e.height,e.x,e.y)}static singleBox(e,n,i=0,a=0){let o=gt(5);return o[0]=1,o[1]=i,o[2]=a,o[3]=e+i,o[4]=n+a,o}row(e){return e(this)}addPoints(e,n,i,a){return this.points[this.index]=1,this.points[1+this.index]=e,this.points[2+this.index]=n,this.points[3+this.index]=i,this.points[4+this.index]=a,this.index+=5,this}addBox(e,n,i,a){return this.addPoints(e,n,e+i,n+a),this}build(){return this.points}};var ci=(t,e)=>{let n=t.length;for(let i=0;i<n;i++)t[i]=i%5===0?e[6]*t[i+1]+e[7]*t[i+2]+e[8]*t[i]:i%5%2===1?e[0]*t[i]+e[1]*t[i+1]+e[2]:e[3]*t[i-1]+e[4]*t[i]+e[5];return t},Xi=t=>{let e=gt(9);return e[0]=t,e[4]=t,e[8]=1,e},je=(t,e)=>{let n=gt(9);return n[0]=1,n[2]=t,n[4]=1,n[5]=e,n[8]=1,n},Po=(t,e,n)=>Ai(je((1-t)*e,(1-t)*n),Xi(t)),Ki=(t,e,n)=>{let i=t.length,a=n&&n.length>=i?n.slice(0,i):gt(i);for(let o=0;o<i;o++)a[o]=o%5===0?e[6]*t[o+1]+e[7]*t[o+2]+e[8]*t[o]:o%5%2===1?e[0]*t[o]+e[1]*t[o+1]+e[2]:e[3]*t[o-1]+e[4]*t[o]+e[5];return a};var ze=_(X(),1),iv=_(X(),1),Bj=_(V(),1);var Zi=_(X(),1);function HM(t,e){let n;return(...i)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...i),e)}}function Km({debounce:t,scroll:e,polyfill:n,offsetSize:i}={debounce:0,scroll:!1,offsetSize:!1}){let a=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!a)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let[o,s]=(0,Zi.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),u=(0,Zi.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),d=t?typeof t=="number"?t:t.scroll:null,p=t?typeof t=="number"?t:t.resize:null,f=(0,Zi.useRef)(!1);(0,Zi.useEffect)(()=>(f.current=!0,()=>void(f.current=!1)));let[m,g,v]=(0,Zi.useMemo)(()=>{let E=()=>{if(!u.current.element)return;let{left:x,top:A,width:C,height:M,bottom:I,right:z,x:D,y:k}=u.current.element.getBoundingClientRect(),B={left:x,top:A,width:C,height:M,bottom:I,right:z,x:D,y:k};u.current.element instanceof HTMLElement&&i&&(B.height=u.current.element.offsetHeight,B.width=u.current.element.offsetWidth),Object.freeze(B),f.current&&!zH(u.current.lastBounds,B)&&s(u.current.lastBounds=B)};return[E,p?HM(E,p):E,d?HM(E,d):E]},[s,i,d,p]);function S(){u.current.scrollContainers&&(u.current.scrollContainers.forEach(E=>E.removeEventListener("scroll",v,!0)),u.current.scrollContainers=null),u.current.resizeObserver&&(u.current.resizeObserver.disconnect(),u.current.resizeObserver=null),u.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",u.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",u.current.orientationHandler))}function R(){u.current.element&&(u.current.resizeObserver=new a(v),u.current.resizeObserver.observe(u.current.element),e&&u.current.scrollContainers&&u.current.scrollContainers.forEach(E=>E.addEventListener("scroll",v,{capture:!0,passive:!0})),u.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",u.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",u.current.orientationHandler))}let T=E=>{!E||E===u.current.element||(S(),u.current.element=E,u.current.scrollContainers=UM(E),R())};return OH(v,!!e),MH(g),(0,Zi.useEffect)(()=>{S(),R()},[e,v,g]),(0,Zi.useEffect)(()=>S,[]),[T,o,m]}function MH(t){(0,Zi.useEffect)(()=>{let e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function OH(t,e){(0,Zi.useEffect)(()=>{if(e){let n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function UM(t){let e=[];if(!t||t===document.body)return e;let{overflow:n,overflowX:i,overflowY:a}=window.getComputedStyle(t);return[n,i,a].some(o=>o==="auto"||o==="scroll")&&e.push(t),[...e,...UM(t.parentElement)]}var _H=["x","y","top","bottom","left","right","width","height"],zH=(t,e)=>_H.every(n=>t[n]===e[n]);var bR=_(X(),1),vo=_(X(),1),OI=_($M(),1),_I=_(X(),1),rv=_(X(),1),Uc=_(V(),1),Na=_(X(),1),jI=_(X(),1),qI=_(X(),1),FI=_(V(),1),GI=_(X(),1),di=_(V(),1),qc=_(X(),1);var gh=_(V(),1),ER=_(X(),1),YI=_(X(),1),iq=_(X(),1),QI=_(X(),1),KI=_(X(),1),yo=_(X(),1),pR=_(X(),1),mR=_(V(),1),rq=_(X(),1),lq=_(X(),1),wn=_(X(),1),ZI=_(X(),1),cv=_(X(),1),RR=_(V(),1),uq=_(V(),1),cq=_(X(),1),WI=_(V(),1),$I=_(X(),1);var IH=Object.defineProperty,DH=(t,e,n)=>e in t?IH(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$m=(t,e,n)=>(DH(t,typeof e!="symbol"?e+"":e,n),n);function hs(t){return t.endsWith("info.json")?t:t.endsWith("/")?`${t}info.json`:`${t}/info.json`}var LH="http://library.stanford.edu/iiif/image-api/compliance.html#level0",iO="http://library.stanford.edu/iiif/image-api/compliance.html#level1",aO="http://library.stanford.edu/iiif/image-api/compliance.html#level2",BH="http://library.stanford.edu/iiif/image-api/conformance.html#level0",oO="http://library.stanford.edu/iiif/image-api/conformance.html#level1",rO="http://library.stanford.edu/iiif/image-api/conformance.html#level2",PH="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",lO="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",sO="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",HH="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",uO="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",cO="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",UH="http://iiif.io/api/image/1/level0.json",VH="http://iiif.io/api/image/1/profiles/level0.json",fO="http://iiif.io/api/image/1/level1.json",dO="http://iiif.io/api/image/1/profiles/level1.json",hO="http://iiif.io/api/image/1/level2.json",pO="http://iiif.io/api/image/1/profiles/level2.json",jH="http://iiif.io/api/image/2/level0.json",qH="http://iiif.io/api/image/2/profiles/level0.json",mO="http://iiif.io/api/image/2/level1.json",gO="http://iiif.io/api/image/2/profiles/level1.json",yO="http://iiif.io/api/image/2/level2.json",vO="http://iiif.io/api/image/2/profiles/level2.json",FH="level0",SO="level1",bO="level2",GH="http://iiif.io/api/image/2/level0",xO="http://iiif.io/api/image/2/level1",EO="http://iiif.io/api/image/2/level2",kH="https://iiif.io/api/image/1.1/compliance/#level0",RO="https://iiif.io/api/image/1.1/compliance/#level1",AO="https://iiif.io/api/image/1.1/compliance/#level2",TO=[EO,aO,rO,sO,cO,hO,pO,yO,vO,bO,AO],CO=[...TO,xO,iO,oO,lO,uO,fO,dO,mO,gO,SO,RO],YH=[GH,xO,EO,LH,iO,aO,BH,oO,rO,PH,lO,sO,HH,uO,cO,UH,VH,fO,dO,hO,pO,jH,qH,mO,gO,yO,vO,FH,SO,bO,kH,RO,AO];var QH={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},XH={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},KH={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};function ZH(t){return TO.indexOf(t)!==-1?KH:CO.indexOf(t)!==-1?XH:QH}function JH(t){let e=t?Array.isArray(t.profile)?t.profile:[t.profile]:[],n={extraQualities:[],extraFormats:[],extraFeatures:[]};for(let i of e)if(typeof i=="string"&&(i=ZH(i)),!!i){if(i.formats)for(let a of i.formats)n.extraFormats.indexOf(a)===-1&&n.extraFormats.push(a);if(i.qualities)for(let a of i.qualities)n.extraQualities.indexOf(a)===-1&&n.extraQualities.push(a);if(i.supports)for(let a of i.supports)n.extraFeatures.indexOf(a)===-1&&n.extraFeatures.push(a);if(i.maxHeight&&(n.maxHeight=i.maxHeight),i.maxWidth&&(n.maxWidth=i.maxWidth),i.maxArea&&(n.maxArea=i.maxArea),i.extraFormats)for(let a of i.extraFormats)n.extraFormats.indexOf(a)===-1&&n.extraFormats.push(a);if(i.extraQualities)for(let a of i.extraQualities)n.extraQualities.indexOf(a)===-1&&n.extraQualities.push(a);if(i.extraFeatures)for(let a of i.extraFeatures)n.extraFeatures.indexOf(a)===-1&&n.extraFeatures.push(a);i.maxHeight&&(n.maxHeight=i.maxHeight),i.maxWidth&&(n.maxWidth=i.maxWidth),i.maxArea&&(n.maxArea=i.maxArea)}if(t.extraFormats)for(let i of t.extraFormats)n.extraFormats.indexOf(i)===-1&&n.extraFormats.push(i);if(t.extraFeatures)for(let i of t.extraFeatures)n.extraFeatures.indexOf(i)===-1&&n.extraFeatures.push(i);if(t.extraQualities)for(let i of t.extraQualities)n.extraQualities.indexOf(i)===-1&&n.extraQualities.push(i);return n}function WH(t){try{if(t==="full")return{full:!0};if(t==="square")return{square:!0};let e=t.startsWith("pct:"),n=t.substr(e?4:0).split(",").map(i=>parseFloat(i));return{x:n[0],y:n[1],w:n[2],h:n[3],percent:e}}catch{throw new Error("Expected 'full', 'square' or 'x,y,w,h'. Found "+t)}}function $H(t){let e={upscaled:!1,max:!1,confined:!1};if(t[0]==="^"&&(e.upscaled=!0,t=t.slice(1)),t==="max"||t==="full")return e.max=!0,e.serialiseAsFull=t==="full",e;if(t[0]==="!"&&(e.confined=!0,t=t.slice(1)),t[0]==="p")return e.percentScale=parseFloat(t.slice(4)),e;let n=t.split(",").map(i=>i.trim());return n.length&&typeof n[0]<"u"&&(n[0]!==""&&(e.width=parseInt(n[0],10)),typeof n[1]<"u"&&n[1]!==""?(e.height=parseInt(n[1],10),e.version=2):e.version=3),e}function tU(t){let e={angle:0};if(t[0]==="!"&&(e.mirror=!0,t=t.substr(1)),e.angle=parseFloat(t)%360,Number.isNaN(e.angle))throw new Error(`Invalid rotation ${t}`);return e}function eU(t,e=""){let n=t.match(/^(([a-zA-Z]+):\/\/([^/]+))?((.*)+)/);if(!n)throw new Error(`Invalid or unknown input ${t}`);let i=n[2],a=n[3],o=n[4];if(o[0]==="/"&&(o=o.substring(1)),e.length>0){if(e[0]==="/"&&(e=e.substring(1)),e!==o.substring(0,e.length))throw new Error(`Path does not start with prefix (path: ${o}, prefix: ${e})`);o=o.substring(e.length)}return{scheme:i,server:a,path:o,prefix:e}}function nU(t,e=""){let{path:n,scheme:i,server:a,prefix:o}=eU(t,e),s=(n||"").split("/").reverse(),[u,d,p,f,...m]=s,g=m.reverse().filter(Boolean).join("/");if(s.length===1||u==="")return{type:"base",scheme:i,server:a,prefix:o,identifier:g};if(u==="info.json"){let[,...S]=s;return{type:"info",scheme:i,server:a,prefix:o,identifier:S.reverse().filter(Boolean).join("/")}}let v=(u||"").split(".");if(typeof v[1]>"u"||typeof v[0]>"u"||typeof f>"u"||typeof p>"u"||typeof d>"u")throw new Error("Invalid image request");return{type:"image",scheme:i,server:a,prefix:o,identifier:g,originalPath:n,region:WH(f),size:$H(p),rotation:tU(d),quality:v[0],format:v[1]}}function iU(t){let e=nU(hs(t.id));if(e.type!=="info")throw new Error("Invalid service URL");let n=JH(t);return{identifier:e.identifier,originalPath:"",server:e.server,prefix:e.prefix,scheme:e.scheme,type:"image",quality:n.extraQualities.indexOf("default")===-1?n.extraQualities[0]:"default",region:{full:!0},size:{max:!0,upscaled:!1,confined:!1},format:"jpg",rotation:{angle:0}}}function aU(t,e,n){let i=n.length,a=[];for(let o=0;o<i;o++){let s=n[o];if(s){let u=s.width;a.push(t/u)}}return a}function oU(t,e,n){let i=n.length,a=[];for(let o=0;o<i;o++){let s=n[o];s&&a.push({width:Math.floor(t/s),height:Math.floor(e/s)})}return a}function Ze(t){if(t["@id"])return t["@id"];if(t.id)return t.id}function eg(t){if(!t||!t.profile||!Ze(t))return!1;let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"&&YH.indexOf(n)!==-1)return!0;return!1}function rU(t){if(!eg(t))return!1;let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"){if(CO.indexOf(n)!==-1)return!0}else{let i=[...n.supports||[],...n.extraFeatures||[]];if(i.indexOf("regionByPx")!==-1&&(i.indexOf("sizeByW")!==-1||i.indexOf("sizeByWh")!==-1))return!0}return!1}function tg(t,e){if(e&&e.profile){let n=e.profile;if(n){let i=Array.isArray(n)?n:[n];return i.includes(`level${t}`)||i.includes(`http://iiif.io/api/image/2/level${t}.json`)||i.includes(`http://iiif.io/api/image/1/level${t}.json`)||i.includes(`http://iiif.io/api/image/1/profiles/level${t}.json`)}}return!1}function _b(t){return eg(t)?tg(0,t)?0:tg(1,t)?1:tg(2,t)?2:null:null}function wO(t){return(t["@context"]?Array.isArray(t["@context"])?t["@context"]:[t["@context"]]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1}function lU(t){if(!rU(t))return[];let e=[],n=Array.isArray(t.profile)?t.profile:[t.profile],i=n.length;for(let a=0;a<i;a++){let o=n[a];if(o&&typeof o!="string"&&(o.maxHeight||o.maxWidth))return[{id:Ze(t),type:"variable",minWidth:0,minHeight:0,maxHeight:o.maxHeight||o.maxWidth,maxWidth:o.maxWidth||o.maxHeight,level:_b(t),version:t["@context"]==="http://iiif.io/api/image/3/context.json"?3:2}]}if(t.tiles){let a=t.tiles.length;for(let o=0;o<a;o++){let s=t.tiles[o];s&&(s.height||s.width)&&e.push({id:Ze(t),type:"variable",minHeight:0,minWidth:0,maxHeight:s.height||s.width,maxWidth:s.width,level:_b(t),version:wO(t)?3:2})}}return e}function tO(t){let e=/^.*\/(full)\/(((\d+),(\d+)?)|max)\/(\d+)\/default\.(jpg|png|jpeg)$/,n=t.match(e);if(n&&n[4]&&n[5]){let i=n[1],a=parseInt(n[4],10),o=parseInt(n[5],10),s=n[7];if((i==="max"||i==="full")&&a&&o&&s)return{type:"fixed",id:t,height:o,width:a}}return{type:"unknown",id:t}}function sU(t){if(t["@type"])return t["@type"];if(t.type)return t.type}function uU(t){if(typeof t=="string")return tO(t);let e=sU(t);if(e!=="Image"&&e!=="sc:Image")return null;let n=t,i=Ze(n);return i?i&&n.width&&n.height?{id:i,type:"fixed",width:n.width,height:n.height,unsafe:!0}:tO(i):null}function cU(t){return eg(t)?(t&&t.sizes?t.sizes:[]).map(e=>({id:Ze(t),type:"fixed-service",height:e.height,width:e.width,level:_b(t),version:wO(t)?3:2})):[]}function eO(t){let e=[],n=t.length;for(let i=0;i<n;i++){let a=t[i];if(!a)continue;let o=cU(a);o.length&&e.push(...o);let s=lU(a);s.length&&e.push(...s)}return e}function MO(t){let e=t.service?Array.isArray(t.service)?t.service:[t.service]:[],n=e.length,i=[];for(let a=0;a<n;a++)eg(e[a])&&i.push(e[a]);return i}function fU(t,e=!0,n){let i=[],a=uU(t);if(a===null)return i;let o=t;if(i.push(a),e&&o&&o.width&&o.height){let s=[],u=MO(o);for(let d of u){let p={id:Ze(d),width:o.width,height:o.height};if(n.canLoadSync(p)){let f=n.loadServiceSync(p);f&&(f.height||(f.height=o.height),f.width||(f.width=o.width),s.push(...eO([f])))}}if(s.length)return i.push(...s),i}return o.service&&i.push(...eO(o.service)),i}function dU({x:t=0,y:e=0,w:n,h:i,full:a,square:o,percent:s}){if(a)return"full";if(o)return"square";if(typeof n>"u"||typeof i>"u")throw new Error("RegionParameter: invalid region");let u=`${t},${e},${n},${i}`;return s?`pct:${u}`:u}function hU({max:t,percentScale:e,upscaled:n,confined:i,width:a,height:o,serialiseAsFull:s,version:u}){let d=[];return n&&d.push("^"),t?(d.push(s?"full":"max"),d.join("")):(i&&d.push("!"),e&&d.push(`pct:${e}`),a&&d.push(`${a}`),d.push(","),o&&u===3&&d.push(`${o}`),d.join(""))}function pU(t){return`${t.mirror?"!":""}${(t.angle||0)%360}`}function mU(t,e){let n=t.prefix.startsWith("/")?t.prefix.substr(1):t.prefix,i=`${t.scheme}://${t.server}/${n?`${n}/`:""}${t.identifier}`;if(t.type==="base")return i;if(t.type==="info")return`${i}/info.json`;let{size:a}=t,{region:o,rotation:s,format:u,quality:d}=t;if(e){let p=e["@context"]?Array.isArray(e["@context"])?e["@context"]:[e["@context"]]:[],f=e.profile,m=p.indexOf("http://iiif.io/api/image/2/context.json")!==-1||f==="level2",g=p.indexOf("http://iiif.io/api/image/3/context.json")!==-1;if((a.width===e.width&&!a.height||a.height===e.height&&!a.width||a.width===e.width&&a.height===e.height)&&(a={...a,max:!0}),m&&(a.max&&!a.serialiseAsFull&&(a={...a,serialiseAsFull:!0}),!a.max&&a.width&&a.height&&(a={...a,height:void 0}),a={...a,version:2}),g){if(a.max&&a.serialiseAsFull&&(a={...a,serialiseAsFull:!1}),a.width&&!a.height&&e.width&&e.height){let v=e.height/e.width;a={...a,height:Math.ceil(a.width*v)}}a={...a,version:3}}}return[i,dU(o),hU(a),pU(s),`${d}.${u}`].filter(Boolean).join("/")}function Ob(t,e,n){let i=iU({"@context":t.version===3?"http://iiif.io/api/image/3/context.json":"http://iiif.io/api/image/2/context.json",id:hs(Ze(t)),profile:t.level===null||typeof t.level>"u"?"level0":`level${t.level}`,type:t.version===3?"ImageService3":"ImageService2"});if(i.type!=="image")throw new Error("Invalid service");return i.size.max=!1,i.size.width=e,i.size.height=n,{id:mU(i),type:"fixed",width:e,height:n||t.height/(t.width||1)*e,unsafe:t.width>e}}function Xu(t){let e=t.replace(/(https?:\/\/)?(www.)?/i,"");return e.indexOf("/")!==-1?e.split("/")[0]:e}function gU(t,e,n){let i=t.width?t.width:t.maxWidth;return n.height<=t.maxHeight&&n.width<=t.maxWidth&&n.height>=t.minHeight&&n.width>=t.minWidth&&(!e||Math.abs(n.width-i)<Math.abs(e.width-i))}function yU(t,e){let n=[],i=Object.assign({unsafeImageService:!1,atAnyCost:!0,fallback:!0,minHeight:64,minWidth:64,maxHeight:1/0,maxWidth:1/0,returnAllOptions:!1,preferFixedSize:!1,allowUnsafe:!1,explain:!1,height:0,width:0},t),a=(f,m=0)=>i.explain?n.push(new Array(m).fill(0).map(g=>" ").join("")+f().trim()):void 0,o=[],s=[],u=null;a(()=>`Using configuration: ${JSON.stringify(i,null,2)}`);let d=(f,m)=>{if(a(()=>"Swapping choice",3),gU(i,m,f)){if(i.preferFixedSize&&f.unsafe){a(()=>`We found an image that was marked as unsafe, but it was the best size. (${f.id})`,4),s.push(f);return}i.returnAllOptions&&m&&s.push(m),a(()=>`We found a new image that was the best size. (${f.id})`,4),u=f}else i.returnAllOptions&&s.push(f)};a(()=>`The input shows we have ${e.length} list(s) of candidates to choose from.`);let p=e.length;for(let f=0;f<p;f++){let m=e[f]();a(()=>`Candidate group ${f}: ${JSON.stringify(m,null,2)}`,1);let g=m.length;a(()=>`Checking candidate list number ${f} and found ${g} potential ways of creating image(s)`,1);for(let v=0;v<g;v++){let S=m[v];if(a(()=>`-> Checking candidate ${v}`,1),S.type==="unknown"&&i.atAnyCost&&(a(()=>`We've found an unknown image type, adding this to the "last resort" list`,2),o.push(S)),S.type==="fixed"&&(S.unsafe?(a(()=>`We've found an unsafe fixed image type, adding this to the "last resort" list`,2),o.push(S)):(a(()=>"We've found a fixed size image, checking if it matches the request",2),d(S,u))),S.type==="fixed-service")if(i.unsafeImageService){a(()=>"Checking for an image from the tile source, without calculating the right height and width (unsafeImageService)",2);let R=Ob(S,i.width,i.height);d(R,u)}else{a(()=>"Checking for an image from the tile source 3",2);let R=Ob(S,S.width,S.height);d(R,u)}if(S.type==="variable"&&S.maxWidth){let R=Ob({id:S.id,type:"fixed-service",width:S.maxWidth,height:S.maxWidth,level:S.level,version:S.version},S.maxWidth);d(R,u)}}if(u&&!i.returnAllOptions){if(u.unsafe||i.allowUnsafe)continue;a(()=>`We found a match in choice list number ${f}, no searching any more`);break}}return i.atAnyCost&&s.length===0?(a(()=>u?`We found an image! ${u.id} of type ${u.type}`:'We found no images, but "atAnyCost" is set, so returning that'),{best:u||o[0]||null,fallback:o.slice(1),log:n}):i.returnAllOptions?(a(()=>"Returning all options that we have found"),{best:(i.atAnyCost?u||s[0]||o[0]:u||s[0])||null,fallback:[...s,...o],log:n}):(a(()=>"Returning the best image that we found, and a fallback"),{best:u||s[0]||null,fallback:u?s:s.slice(1),log:n})}function vU(t,e,n){let i=t>e?t:e,a=n.length,o=[];for(let s=0;s<a;s++){let u=n[s];if(!u||u.scaleFactors.length===0)continue;let d=u.scaleFactors[0];if(!d)continue;let p=i/d,f=[d];for(;p>=u.width;)d=d*2,f.push(d),p=p/2;o.push({...u,scaleFactors:f})}return o}function SU(t,e){if(t.length!==e.length)return!1;if(t.length===0&&e.length===0)return!0;let n=t.length,i=!0;for(let o=0;o<n;o++){let s=t[o],u=e[o];if(s.width!==u.width||s.height!==u.height){i=!1;break}}if(i)return!0;let a=0;for(let o=0;o<n;o++)for(let s=0;s<n;s++)if(t[o].width===e[s].width&&t[o].height===e[s].height){a++;break}return a===n}function nO(t){return tg(0,t)}var OO=class{constructor(t={}){$m(this,"config",{verificationsRequired:1,approximateServices:!1,enableFetching:!0,disableThrottling:!1}),$m(this,"fetchingCount",0),$m(this,"imageServices",{}),$m(this,"knownImageServers",{}),this.config=Object.assign(this.config,t)}setConfig(t){Object.assign(this.config,t)}sample(t,e,n=!0){let i=Xu(Ze(t)),a=hs(Ze(t)),o=this.knownImageServers[i];return this.imageServices[a]=Object.assign(t,{real:!0}),!o&&t.tiles&&!nO(t)?(this.knownImageServers[i]={verifications:0,malformed:!1,root:i,preLoaded:n,sampledId:Ze(t),verified:!1,server:null,result:{context:t["@context"]||[],sampledProfile:t.profile,resourceServiceRatio:e&&t.height?e.height/t.height:1,sampledSizes:t.sizes||[],sizeRatios:aU(t.width,t.height,t.sizes||[]),sampledTiles:t.tiles||[]}},!0):this.verify(t)}preLoad(t,e=!0){this.knownImageServers[t.root]=t,e&&(this.knownImageServers[t.root].malformed=!1,this.knownImageServers[t.root].verifications=this.config.verificationsRequired)}predict(t,e=!1,n=!1){let i=t?.source,a=Xu(Ze(t)),o=this.knownImageServers[a],s=hs(Ze(t));return this.imageServices[s]?this.imageServices[s]||null:!this.config.approximateServices||!o||!o.result||!(i?.height||t.height)||!(i?.width||t.width)||!n&&(o.malformed||o.verifications<this.config.verificationsRequired)||nO(t.source)?null:(this.imageServices[s]||(this.imageServices[s]={"@context":o.result.context,"@id":Ze(t),id:Ze(t),protocol:"http://iiif.io/api/image",tiles:i?.tiles||vU(t.width,t.height,o.result.sampledTiles),sizes:i?.sizes||oU(Math.round(t.width/o.result.resourceServiceRatio),Math.round(t.height/o.result.resourceServiceRatio),o.result.sizeRatios),profile:i?.profile||o.result.sampledProfile,height:i?.height||t.height,width:i?.width||t.width,real:!1}),this.imageServices[s]||null)}async getThumbnailFromResource(t,e,n=!0,i=[]){let a=t?await this.getImageCandidates(t,n):[];return yU(e,[()=>i,()=>a])}async getImageCandidates(t,e=!0){let n=t;if(e&&n&&n.height&&n.width){let i=MO(n);for(let a of i){let o={id:Ze(a),width:a.width?a.width:n.width,height:a.height?a.height:n.height,source:a};await this.loadService(o)}}return fU(t,e,this)}async verify(t){let e=this.predict(t,!1,!0),n=await this.fetchService(Ze(t));if(!e)return!1;let i=e.height===n.height&&e.width===n.width&&e["@context"]===n["@context"]&&SU(e.sizes||[],n.sizes||[]);if(i){let a=Xu(Ze(t)),o=this.knownImageServers[a];o&&(o.verifications+=1,o.verifications>=this.config.verificationsRequired&&(o.verified=!0))}return i}canLoadSync(t){let e=typeof t=="string"?t:Ze(t),n=hs(e);if(this.imageServices[n])return!0;let i=this.knownImageServers[Xu(e)];return!!(i&&!i.malformed&&i.verifications>=this.config.verificationsRequired)}async markAsMalformed(t){return this.knownImageServers[Xu(Ze(t))].malformed=!0,this.loadService(t,!0)}async fetchService(t,e=!1){let n=hs(t),i=this.imageServices[n];if(i&&(!e||i.real))return i;if(!this.config.enableFetching)throw new Error("Fetching is not enabled");let a=await this.fetch(n).then(o=>o.json());return!a.id&&a["@id"]&&(a.id=a["@id"]),a.id!==t&&(a.id=t,a["@id"]&&(a["@id"]=t)),this.imageServices[n]=Object.assign(a,{real:!0}),this.imageServices[n]}async fetch(t,e){return fetch(t,e)}async loadService(t,e=!1){if(!this.config.disableThrottling){let a=!0;for(;a;)if(this.fetchingCount>=this.config.verificationsRequired)await new Promise(o=>setTimeout(o,500));else{a=!1;break}}let n=this.knownImageServers[Xu(Ze(t))];if(n&&!n.malformed&&!e){await n.result;let a=this.loadServiceSync(t);if(a)return a}this.fetchingCount++;let i=await this.fetchService(Ze(t),e);return this.fetchingCount--,i.real&&this.sample(i,t),i}loadServiceSync(t){let e=hs(Ze(t));return this.imageServices[e]?this.imageServices[e]:this.config.approximateServices?this.predict(t):null}},xY=new OO;var ng={},Uo={get(t){return t},setMetaValue([t,e,n],i){let a=Uo.getResourceMeta(t,e),o=a?a[n]:void 0,s=typeof i=="function"?i(o):i;ng[t]={...ng[t]||{},[e]:{...(ng[t]||{})[e]||{},[n]:s}}},getResourceMeta:(t,e)=>{let n=ng[t];if(n)return e?n[e]:n},async load(t){let e=typeof t=="string"?t:t.id;return fetch(e).then(n=>n.json())},requestStatus(t){}};function bU(t){try{if(t==="full")return{full:!0};if(t==="square")return{square:!0};let e=t.startsWith("pct:"),n=t.substr(e?4:0).split(","),i=n.map(a=>parseFloat(a));return{x:i[0],y:i[1],w:i[2],h:i[3],percent:e}}catch{throw Error("Expected 'full', 'square' or 'x,y,w,h'. Found "+t)}}function xU(t){let e={upscaled:!1,max:!1,confined:!1};if(t[0]==="^"&&(e.upscaled=!0,t=t.slice(1)),t==="max"||t==="full")return e.max=!0,e.serialiseAsFull=t==="full",e;if(t[0]==="!"&&(e.confined=!0,t=t.slice(1)),t[0]==="p")return e.percentScale=parseFloat(t.slice(4)),e;let n=t.split(",").map(i=>i.trim());return n.length&&(n[0]!==""&&(e.width=parseInt(n[0],10)),n[1]!==""&&(e.height=parseInt(n[1],10))),e}function EU(t){let e={angle:0};if(t[0]==="!"&&(e.mirror=!0,t=t.substr(1)),e.angle=parseFloat(t)%360,Number.isNaN(e.angle))throw Error(`Invalid rotation ${t}`);return e}function RU(t,e=""){let n=t.match(/^(([a-zA-Z]+):\/\/([^/]+))?((.*)+)/);if(!n)throw Error(`Invalid or unknown input ${t}`);let i=n[2],a=n[3],o=n[4];if(o[0]==="/"&&(o=o.substring(1)),e.length>0){if(e[0]==="/"&&(e=e.substring(1)),e!==o.substring(0,e.length))throw Error(`Path does not start with prefix (path: ${o}, prefix: ${e})`);o=o.substring(e.length)}return{scheme:i,server:a,path:o,prefix:e}}function AU(t,e=""){let{path:n,scheme:i,server:a,prefix:o}=RU(t,e),s=n.split("/").reverse(),[u,d,p,f,...m]=s,g=m.reverse().filter(Boolean).join("/");if(s.length===1||u==="")return{type:"base",scheme:i,server:a,prefix:o,identifier:g};if(u==="info.json"){let[,...R]=s;return{type:"info",scheme:i,server:a,prefix:o,identifier:R.reverse().filter(Boolean).join("/")}}if(i===void 0||a===void 0||n===void 0||f===void 0||p===void 0||d===void 0||u===void 0)throw Error("Invalid image service URL");let[v="",S=""]=u.split(".");return{type:"image",scheme:i,server:a,prefix:o,identifier:g,originalPath:n,region:bU(f),size:xU(p),rotation:EU(d),quality:v,format:S}}function TU(t){return wu.indexOf(t)!==-1?s2:hm.indexOf(t)!==-1?l2:r2}function CU(t){let e=t?Array.isArray(t.profile)?t.profile:[t.profile]:[],n={extraQualities:[],extraFormats:[],extraFeatures:[]};for(let i of e)if(typeof i=="string"&&(i=TU(i)),!!i){if(i.formats)for(let a of i.formats)n.extraFormats.indexOf(a)===-1&&n.extraFormats.push(a);if(i.qualities)for(let a of i.qualities)n.extraQualities.indexOf(a)===-1&&n.extraQualities.push(a);if(i.supports)for(let a of i.supports)n.extraFeatures.indexOf(a)===-1&&n.extraFeatures.push(a);if(i.maxHeight&&(n.maxHeight=i.maxHeight),i.maxWidth&&(n.maxWidth=i.maxWidth),i.maxArea&&(n.maxArea=i.maxArea),i.extraFormats)for(let a of i.extraFormats)n.extraFormats.indexOf(a)===-1&&n.extraFormats.push(a);if(i.extraQualities)for(let a of i.extraQualities)n.extraQualities.indexOf(a)===-1&&n.extraQualities.push(a);if(i.extraFeatures)for(let a of i.extraFeatures)n.extraFeatures.indexOf(a)===-1&&n.extraFeatures.push(a);i.maxHeight&&(n.maxHeight=i.maxHeight),i.maxWidth&&(n.maxWidth=i.maxWidth),i.maxArea&&(n.maxArea=i.maxArea)}if(t.extraFormats)for(let i of t.extraFormats)n.extraFormats.indexOf(i)===-1&&n.extraFormats.push(i);if(t.extraFeatures)for(let i of t.extraFeatures)n.extraFeatures.indexOf(i)===-1&&n.extraFeatures.push(i);if(t.extraQualities)for(let i of t.extraQualities)n.extraQualities.indexOf(i)===-1&&n.extraQualities.push(i);return n}function zb(t){let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"&&O1.indexOf(n)!==-1)return!0;return!1}function Re(t){if(t["@id"])return t["@id"];if(t.id)return t.id}function ud(t){if(!t||!t.profile||!Re(t))return!1;let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"&&w1.indexOf(n)!==-1)return!0;return!1}function _O(t){if(!ud(t))return!1;let e=Array.isArray(t.profile)?t.profile:[t.profile];for(let n of e)if(typeof n=="string"){if(hm.indexOf(n)!==-1)return!0}else{let i=[...n.supports||[],...n.extraFeatures||[]];if(i.indexOf("regionByPx")!==-1&&(i.indexOf("sizeByW")!==-1||i.indexOf("sizeByWh")!==-1))return!0}return!1}function wU({x:t=0,y:e=0,w:n,h:i,full:a,square:o,percent:s}){if(a)return"full";if(o)return"square";if(n===void 0||i===void 0)throw Error("RegionParameter: invalid region");let u=`${t},${e},${n},${i}`;return s?`pct:${u}`:u}function MU({max:t,percentScale:e,upscaled:n,confined:i,width:a,height:o,serialiseAsFull:s,version:u}){let d=[];return n&&d.push("^"),t?(d.push(s?"full":"max"),d.join("")):(i&&d.push("!"),e&&d.push(`pct:${e}`),a&&d.push(`${a}`),d.push(","),o&&u===3&&d.push(`${o}`),d.join(""))}function OU(t){return`${t.mirror?"!":""}${(t.angle||0)%360}`}function ig(t,e){let n=t.prefix.startsWith("/")?t.prefix.substring(1):t.prefix,i=`${t.scheme}://${t.server}/${n?`${n}/`:""}${t.identifier}`;if(t.type==="base")return i;if(t.type==="info")return`${i}/info.json`;let{size:a}=t,{region:o,rotation:s,format:u,quality:d}=t;if(e){let p=e["@context"]?Array.isArray(e["@context"])?e["@context"]:[e["@context"]]:[],f=p.indexOf("http://iiif.io/api/image/2/context.json")!==-1,m=p.indexOf("http://iiif.io/api/image/3/context.json")!==-1;if((a.width===e.width&&!a.height||a.height===e.height&&!a.width||a.width===e.width&&a.height===e.height)&&(a={...a,max:!0}),f&&(a.max&&!a.serialiseAsFull&&(a={...a,serialiseAsFull:!0}),!a.max&&a.width&&a.height&&(a={...a,height:void 0}),a={...a,version:2}),m){if(a.max&&a.serialiseAsFull&&(a={...a,serialiseAsFull:!1}),a.width&&!a.height&&e.width&&e.height){let g=e.height/e.width;a={...a,height:Math.ceil(a.width*g)}}a={...a,version:3}}}return[i,wU(o),MU(a),OU(s),`${d}.${u}`].filter(Boolean).join("/")}function Vr(t){return t.endsWith("info.json")?t:t.endsWith("/")?`${t}info.json`:`${t}/info.json`}function ag(t){let e=AU(Vr(t.id));if(e.type!=="info")throw Error("Invalid service URL");let n=CU(t);return{identifier:e.identifier,originalPath:"",server:e.server,prefix:e.prefix,scheme:e.scheme,type:"image",quality:n.extraQualities.indexOf("default")===-1?n.extraQualities[0]:"default",region:{full:!0},size:{max:!0,upscaled:!1,confined:!1},format:"jpg",rotation:{angle:0}}}function zO(t,e,n){let i=n.length,a=[];for(let o=0;o<i;o++){let s=n[o];if(!s)continue;let u=s.width;a.push(t/u)}return a}function NO(t,e,n){let i=n.length,a=[];for(let o=0;o<i;o++){let s=n[o];s&&a.push({width:Math.floor(t/s),height:Math.floor(e/s)})}return a}function Ku(t,e){if(e&&e.profile){let n=e.profile;if(n){let i=Array.isArray(n)?n:[n];if(i.includes(`level${t}`)||i.includes(`http://iiif.io/api/image/2/level${t}.json`)||i.includes(`http://iiif.io/api/image/1/level${t}.json`)||i.includes(`http://iiif.io/api/image/1/profiles/level${t}.json`))return!0;if(t===2){for(let a of i)if(wu.includes(a))return!0}if(t===1){for(let a of i)if(hm.includes(a))return!0}if(t===0){for(let a of i)if(O1.includes(a))return!0}}}return!1}function og(t){return ud(t)?Ku(2,t)?2:Ku(1,t)?1:Ku(0,t)?0:null:null}function jr(t){let e=t.service?Array.isArray(t.service)?t.service:[t.service]:[],n=e.length,i=[];for(let a=0;a<n;a++)ud(e[a])&&i.push(e[a]);return i}function IO(t){if(t["@type"])return t["@type"];if(t.type)return t.type}function ps(t){let e=t.replace(/(https?:\/\/)?(www.)?/i,"");return e.indexOf("/")===-1?e:e.split("/")[0]}function DO(t,e,n){let i=t>e?t:e,a=n.length,o=[];for(let s=0;s<a;s++){let u=n[s];if(!u||u.scaleFactors.length===0)continue;let d=u.scaleFactors[0];if(!d)continue;let p=i/d,f=[d];for(;p>=u.width;)d*=2,f.push(d),p/=2;o.push({...u,scaleFactors:f})}return o}function rg(t,e,n){let i=ag({"@context":t.version===3?"http://iiif.io/api/image/3/context.json":"http://iiif.io/api/image/2/context.json",id:Vr(Re(t)),profile:t.level===null||t.level===void 0?"level0":`level${t.level}`,type:t.version===3?"ImageService3":"ImageService2"});if(i.type!=="image")throw Error("Invalid service");return i.size.max=!1,i.size.width=e,i.size.height=n,{id:ig(i),type:"fixed",width:e,height:n||t.height/(t.width||1)*e,unsafe:t.width>e}}function LO(t,e,n){let i=t.width?t.width:t.maxWidth;return n.height<=t.maxHeight&&n.width<=t.maxWidth&&n.height>=t.minHeight&&n.width>=t.minWidth&&(!e||Math.abs(n.width-i)<Math.abs(e.width-i))}function BO(t,e){let n=[],i=Object.assign({unsafeImageService:!1,atAnyCost:!0,fallback:!0,minHeight:64,minWidth:64,maxHeight:1/0,maxWidth:1/0,returnAllOptions:!1,preferFixedSize:!1,allowUnsafe:!1,explain:!1,height:0,width:0},t),a=(f,m=0)=>i.explain?n.push(Array(m).fill(0).map(g=>" ").join("")+f().trim()):void 0,o=[],s=[],u=null;a(()=>`Using configuration: ${JSON.stringify(i,null,2)}`);let d=(f,m)=>{if(a(()=>"Swapping choice",3),LO(i,m,f)){if(i.preferFixedSize&&f.unsafe){a(()=>`We found an image that was marked as unsafe, but it was the best size. (${f.id})`,4),s.push(f);return}i.returnAllOptions&&m&&s.push(m),a(()=>`We found a new image that was the best size. (${f.id})`,4),u=f}else i.returnAllOptions&&s.push(f)};a(()=>`The input shows we have ${e.length} list(s) of candidates to choose from.`);let p=e.length;for(let f=0;f<p;f++){let m=e[f]();a(()=>`Candidate group ${f}: ${JSON.stringify(m,null,2)}`,1);let g=m.length;a(()=>`Checking candidate list number ${f} and found ${g} potential ways of creating image(s)`,1);for(let v=0;v<g;v++){let S=m[v];if(a(()=>`-> Checking candidate ${v}`,1),S.type==="unknown"&&i.atAnyCost&&(a(()=>`We've found an unknown image type, adding this to the "last resort" list`,2),o.push(S)),S.type==="fixed"&&(S.unsafe?(a(()=>`We've found an unsafe fixed image type, adding this to the "last resort" list`,2),o.push(S)):(a(()=>"We've found a fixed size image, checking if it matches the request",2),d(S,u))),S.type==="fixed-service")if(i.unsafeImageService){a(()=>"Checking for an image from the tile source, without calculating the right height and width (unsafeImageService)",2);let R=rg(S,i.width,i.height);d(R,u)}else{a(()=>"Checking for an image from the tile source 3",2);let R=rg(S,S.width,S.height);d(R,u)}if(S.type==="variable"&&S.maxWidth){let R=rg({id:S.id,type:"fixed-service",width:S.maxWidth,height:S.maxWidth,level:S.level,version:S.version},S.maxWidth);d(R,u)}}if(u&&!i.returnAllOptions){if(u.unsafe||i.allowUnsafe)continue;a(()=>`We found a match in choice list number ${f}, no searching any more`);break}}return i.atAnyCost&&s.length===0?(a(()=>u?`We found an image! ${u.id} of type ${u.type}`:'We found no images, but "atAnyCost" is set, so returning that'),{best:u||o[0]||null,fallback:o.slice(1),log:n}):i.returnAllOptions?(a(()=>"Returning all options that we have found"),{best:(i.atAnyCost?u||s[0]||o[0]:u||s[0])||null,fallback:[...s,...o],log:n}):(a(()=>"Returning the best image that we found, and a fallback"),{best:u||s[0]||null,fallback:u?s:s.slice(1),log:n})}function Db(t){return(t["@context"]?Array.isArray(t["@context"])?t["@context"]:[t["@context"]]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1}function PO(t){return ud(t)?(t&&t.sizes?t.sizes:[]).map(e=>({id:Re(t),type:"fixed-service",height:e.height,width:e.width,level:og(t),version:Db(t)?3:2})):[]}function HO(t){if(!_O(t))return[];let e=[],n=Array.isArray(t.profile)?t.profile:[t.profile],i=n.length;for(let a=0;a<i;a++){let o=n[a];if(o&&typeof o!="string"&&(o.maxHeight||o.maxWidth))return[{id:Re(t),type:"variable",minWidth:0,minHeight:0,maxHeight:o.maxHeight||o.maxWidth,maxWidth:o.maxWidth||o.maxHeight,level:og(t),version:t["@context"]==="http://iiif.io/api/image/3/context.json"?3:2}]}if(t.tiles){let a=t.tiles.length;for(let o=0;o<a;o++){let s=t.tiles[o];s&&(s.height||s.width)&&e.push({id:Re(t),type:"variable",minHeight:0,minWidth:0,maxHeight:s.height||s.width,maxWidth:s.width,level:og(t),version:Db(t)?3:2})}}return e}function Nb(t){let e=[],n=t.length;for(let i=0;i<n;i++){let a=t[i];if(!a)continue;let o=PO(a);o.length&&e.push(...o);let s=HO(a);s.length&&e.push(...s)}return e}function Ib(t){let e=/^.*\/(full)\/(((\d+),(\d+)?)|max)\/(\d+)\/default\.(jpg|png|jpeg)$/,n=t.match(e);if(n&&n[4]&&n[5]){let i=n[1],a=parseInt(n[4],10),o=parseInt(n[5],10),s=n[7];if((i==="max"||i==="full")&&a&&o&&s)return{type:"fixed",id:t,height:o,width:a}}return{type:"unknown",id:t}}function cd(t){if(typeof t=="string")return Ib(t);let e=IO(t);if(e!=="Image"&&e!=="sc:Image")return null;let n=t,i=Re(n);return i?i&&n.width&&n.height?{id:i,type:"fixed",width:n.width,height:n.height,unsafe:!0}:Ib(i):null}function UO(t,e=!0,n){let i=[],a=cd(t);if(a===null)return i;let o=t;if(i.push(a),e&&o&&o.width&&o.height){let s=[],u=jr(o);for(let d of u){let p={id:Re(d),width:o.width,height:o.height};if(n.canLoadSync(p)){let f=n.loadServiceSync(p);f&&(f.height||(f.height=o.height),f.width||(f.width=o.width),s.push(...Nb([f])))}}if(s.length)return i.push(...s),i}return o.service&&i.push(...Nb(o.service)),i}function VO(t,e){if(t.length!==e.length)return!1;if(t.length===0&&e.length===0)return!0;let n=t.length,i=!0;for(let o=0;o<n;o++){let s=t[o],u=e[o];if(s.width!==u.width||s.height!==u.height){i=!1;break}}if(i)return!0;let a=0;for(let o=0;o<n;o++)for(let s=0;s<n;s++)if(t[o].width===e[s].width&&t[o].height===e[s].height){a++;break}return a===n}var Zu=class{constructor(t={}){An(this,"config",{verificationsRequired:1,approximateServices:!1,enableFetching:!0,disableThrottling:!1}),An(this,"fetchingCount",0),An(this,"imageServices",{}),An(this,"knownImageServers",{}),this.config=Object.assign(this.config,t)}setConfig(t){Object.assign(this.config,t)}sample(t,e,n=!0){let i=ps(Re(t)),a=Vr(Re(t)),o=this.knownImageServers[i];return this.imageServices[a]=Object.assign(t,{real:!0}),!o&&t.tiles&&!zb(t)?(this.knownImageServers[i]={verifications:0,malformed:!1,root:i,preLoaded:n,sampledId:Re(t),verified:!1,server:null,result:{context:t["@context"]||[],sampledProfile:t.profile,resourceServiceRatio:e&&t.height?e.height/t.height:1,sampledSizes:t.sizes||[],sizeRatios:zO(t.width,t.height,t.sizes||[]),sampledTiles:t.tiles||[]}},!0):this.verify(t)}preLoad(t,e=!0){this.knownImageServers[t.root]=t,e&&(this.knownImageServers[t.root].malformed=!1,this.knownImageServers[t.root].verifications=this.config.verificationsRequired)}predict(t,e=!1,n=!1){let i=t?.source,a=ps(Re(t)),o=this.knownImageServers[a],s=Vr(Re(t));return this.imageServices[s]?this.imageServices[s]||null:!this.config.approximateServices||!o||!o.result||!(i?.height||t.height)||!(i?.width||t.width)||!n&&(o.malformed||o.verifications<this.config.verificationsRequired)||t.source&&zb(t.source)?null:(this.imageServices[s]||(this.imageServices[s]={"@context":o.result.context,"@id":Re(t),id:Re(t),protocol:"http://iiif.io/api/image",tiles:i?.tiles||DO(t.width,t.height,o.result.sampledTiles),sizes:i?.sizes||NO(Math.round(t.width/o.result.resourceServiceRatio),Math.round(t.height/o.result.resourceServiceRatio),o.result.sizeRatios),profile:i?.profile||o.result.sampledProfile,height:i?.height||t.height,width:i?.width||t.width,real:!1}),this.imageServices[s]||null)}async getThumbnailFromResource(t,e,n=!0,i=[]){let a=t?await this.getImageCandidates(t,n):[];return BO(e,[()=>i,()=>a])}async getImageCandidates(t,e=!0){let n=t;if(e&&n&&n.height&&n.width){let i=jr(n);for(let a of i){let o={id:Re(a),width:a.width?a.width:n.width,height:a.height?a.height:n.height,source:a};await this.loadService(o)}}return UO(t,e,this)}async verify(t){let e=this.predict(t,!1,!0),n=await this.fetchService(Re(t));if(!e)return!1;let i=e.height===n.height&&e.width===n.width&&e["@context"]===n["@context"]&&VO(e.sizes||[],n.sizes||[]);if(i){let a=ps(Re(t)),o=this.knownImageServers[a];o&&(o.verifications+=1,o.verifications>=this.config.verificationsRequired&&(o.verified=!0))}return i}canLoadSync(t){let e=typeof t=="string"?t:Re(t),n=Vr(e);if(this.imageServices[n])return!0;let i=this.knownImageServers[ps(e)];return!!(i&&!i.malformed&&i.verifications>=this.config.verificationsRequired)}async markAsMalformed(t){return this.knownImageServers[ps(Re(t))].malformed=!0,this.loadService(t,!0)}async fetchService(t,e=!1){let n=Vr(t),i=this.imageServices[n];if(i&&(!e||i.real))return i;if(!this.config.enableFetching)throw Error("Fetching is not enabled");let a=await this.fetch(n).then(o=>o.json());return!a.id&&a["@id"]&&(a.id=a["@id"]),a.id!==t&&(a.id=t,a["@id"]&&(a["@id"]=t)),this.imageServices[n]=Object.assign(a,{real:!0}),this.imageServices[n]}async fetch(t,e){return fetch(t,e)}async loadService(t,e=!1){if(!this.config.disableThrottling){let a=!0;for(;a;)if(this.fetchingCount>=this.config.verificationsRequired)await new Promise(o=>setTimeout(o,500));else{a=!1;break}}let n=this.knownImageServers[ps(Re(t))];if(n&&!n.malformed&&!e){await n.result;let a=this.loadServiceSync(t);if(a)return a}this.fetchingCount++;let i=await this.fetchService(Re(t),e);return this.fetchingCount--,i.real&&this.sample(i,t),i}loadServiceSync(t){let e=Vr(Re(t));return this.imageServices[e]?this.imageServices[e]:this.config.approximateServices?this.predict(t):null}};function jO(t={}){let e=t.events||fm(),n=t.loader||new Zu;return{store:cm((a,o)=>({loaded:{},loadServiceSync:(s,u,d)=>{let p=s.id||s["@id"],f=o().loaded[p];if(f&&f.status==="done")return f.service;if(f&&f.status==="loading")return null;if(f&&f.status==="error")throw Error("Failed to load image service");let m={id:Re(s),width:s.width||u?.width||0,height:s.height||u?.height||0,source:s},g=n.loadServiceSync(m);return g?(a(v=>({loaded:{...v.loaded,[p]:{status:"done",service:g,real:!0}}})),e.emit("image-service.loaded",{id:p,service:g})):d&&o().loadService(s,u).then(()=>{}),g},loadService:async(s,u)=>{let d=s.id||s["@id"],p=o().loaded[d];if(p&&p.status==="done")return p.service;if(p&&p.status==="loading")return new Promise((f,m)=>{let g=v=>{v.id===d&&(e.off("image-service.loaded",g),f(v.service||s))};e.on("image-service.loaded",g)});if(p&&p.status==="error"&&!u?.force)throw Error("Failed to load image service");e.emit("image-service.loading",{id:d});try{let f={id:Re(s),width:s.width||0,height:s.height||0,source:s},m=await n.loadService(f,u?.force);return a(g=>({loaded:{...g.loaded,[d]:{status:"done",service:m,real:m.real}}})),e.emit("image-service.loaded",{id:d,service:m}),m}catch(f){throw e.emit("image-service.error",{id:d,error:f}),f}}})),events:e}}var Lb=jO();var qO=new Zu;function Bb(t=Uo,e={}){let n=e.imageServiceLoader||qO;async function i(a,o,s=!1,u=[],d){let p=()=>n.getThumbnailFromResource(void 0,o,s,u);if(!a)return await n.getThumbnailFromResource(void 0,o,s,u);if(typeof a=="string"){let g=cd(a);return g&&u.push(g),await n.getThumbnailFromResource(void 0,o,s,u)}let f=t.get(a,{skipSelfReturn:!1});if(typeof f=="string")return{best:cd(f),fallback:[],log:[]};if(!f)return await p();switch(await(async g=>{if(g&&g.thumbnail&&g.thumbnail.length){let v=t.get(g.thumbnail[0]),S=await n.getImageCandidates(v,s);S&&S.length&&u.push(...S)}})(f),f.type){case"Annotation":{let g=Array.isArray(f.body)?f.body:[f.body],v=t.get(g[0]);return d&&!v.width&&(v.width=d.width,v.height=d.height),await n.getThumbnailFromResource(v,o,s,u)}case"Canvas":{let g=f;return i(g.items[0],o,s,u,{width:g.width,height:g.height})}case"AnnotationPage":return i(f.items[0],o,s,u,d);case"Choice":{let g=f;return!g.items||g.items[0]?await p():i(g.items[0],o,s,u,d)}case"Collection":{let g=f,v=g.items[0];return v?i(v,o,s,u,d):await p()}case"Manifest":{let g=f,v=g.items[0];return v?i(v,o,s,u,d):await p()}case"SpecificResource":case"Image":case"Dataset":case"Sound":case"Text":case"TextualBody":case"Video":return d&&!f.width&&(f.width=d.width,f.height=d.height),n.getThumbnailFromResource(f,o,s,u)}return await p()}return{getBestThumbnailAtSize:i}}var fq=_(V(),1),dq=_(X(),1),vh=_(X(),1),hq=_(V(),1),pq=_(X(),1),tD=_(X(),1),ej=Object.create,gR=Object.defineProperty,nj=Object.getOwnPropertyDescriptor,ij=Object.getOwnPropertyNames,aj=Object.getPrototypeOf,oj=Object.prototype.hasOwnProperty,rj=(t,e,n)=>e in t?gR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,yh=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),lj=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of ij(e))!oj.call(t,a)&&a!==n&&gR(t,a,{get:()=>e[a],enumerable:!(i=nj(e,a))||i.enumerable});return t},sj=(t,e,n)=>(n=t!=null?ej(aj(t)):{},lj(e||!t||!t.__esModule?gR(n,"default",{value:t,enumerable:!0}):n,t)),O=(t,e,n)=>(rj(t,typeof e!="symbol"?e+"":e,n),n),uj=yh((t,e)=>{"use strict";var n=!1,i,a,o,s,u,d,p,f,m,g,v,S,R,T,E;function x(){if(!n){n=!0;var C=navigator.userAgent,M=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(C),I=/(Mac OS X)|(Windows)|(Linux)/.exec(C);if(S=/\b(iPhone|iP[ao]d)/.exec(C),R=/\b(iP[ao]d)/.exec(C),g=/Android/i.exec(C),T=/FBAN\/\w+;/i.exec(C),E=/Mobile/i.exec(C),v=!!/Win64/.exec(C),M){i=M[1]?parseFloat(M[1]):M[5]?parseFloat(M[5]):NaN,i&&document&&document.documentMode&&(i=document.documentMode);var z=/(?:Trident\/(\d+.\d+))/.exec(C);d=z?parseFloat(z[1])+4:i,a=M[2]?parseFloat(M[2]):NaN,o=M[3]?parseFloat(M[3]):NaN,s=M[4]?parseFloat(M[4]):NaN,s?(M=/(?:Chrome\/(\d+\.\d+))/.exec(C),u=M&&M[1]?parseFloat(M[1]):NaN):u=NaN}else i=a=o=u=s=NaN;if(I){if(I[1]){var D=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(C);p=D?parseFloat(D[1].replace("_",".")):!0}else p=!1;f=!!I[2],m=!!I[3]}else p=f=m=!1}}var A={ie:function(){return x()||i},ieCompatibilityMode:function(){return x()||d>i},ie64:function(){return A.ie()&&v},firefox:function(){return x()||a},opera:function(){return x()||o},webkit:function(){return x()||s},safari:function(){return A.webkit()},chrome:function(){return x()||u},windows:function(){return x()||f},osx:function(){return x()||p},linux:function(){return x()||m},iphone:function(){return x()||S},mobile:function(){return x()||S||R||g||E},nativeApp:function(){return x()||T},android:function(){return x()||g},ipad:function(){return x()||R}};e.exports=A}),cj=yh((t,e)=>{"use strict";var n=!!(typeof window<"u"&&window.document&&window.document.createElement),i={canUseDOM:n,canUseWorkers:typeof Worker<"u",canUseEventListeners:n&&!!(window.addEventListener||window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};e.exports=i}),fj=yh((t,e)=>{"use strict";var n=cj(),i;n.canUseDOM&&(i=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);function a(o,s){if(!n.canUseDOM||s&&!("addEventListener"in document))return!1;var u="on"+o,d=u in document;if(!d){var p=document.createElement("div");p.setAttribute(u,"return;"),d=typeof p[u]=="function"}return!d&&i&&o==="wheel"&&(d=document.implementation.hasFeature("Events.wheel","3.0")),d}e.exports=a}),dj=yh((t,e)=>{"use strict";var n=uj(),i=fj(),a=10,o=40,s=800;function u(d){var p=0,f=0,m=0,g=0;return"detail"in d&&(f=d.detail),"wheelDelta"in d&&(f=-d.wheelDelta/120),"wheelDeltaY"in d&&(f=-d.wheelDeltaY/120),"wheelDeltaX"in d&&(p=-d.wheelDeltaX/120),"axis"in d&&d.axis===d.HORIZONTAL_AXIS&&(p=f,f=0),m=p*a,g=f*a,"deltaY"in d&&(g=d.deltaY),"deltaX"in d&&(m=d.deltaX),(m||g)&&d.deltaMode&&(d.deltaMode==1?(m*=o,g*=o):(m*=s,g*=s)),m&&!p&&(p=m<1?-1:1),g&&!f&&(f=g<1?-1:1),{spinX:p,spinY:f,pixelX:m,pixelY:g}}u.getEventType=function(){return n.firefox()?"DOMMouseScroll":i("wheel")?"wheel":"mousewheel"},e.exports=u}),hj=yh((t,e)=>{"use strict";e.exports=dj()}),Jy=["onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onScroll","onWheel","onClick","onDragStart","onDragEnd","onDragEnter","onDragExit","onDrag","onDragOver","onContextMenu"];function pj(){return Jy.reduce((t,e)=>(t[e]=[],t),{})}var Vc=Jy.reduce((t,e)=>(t[e.slice(2).toLowerCase()]=e,t[e]=e,t),{}),mj="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Wy=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=mj[n[t]&63];return e},So=class{constructor(){O(this,"__id"),O(this,"__revision",0),O(this,"__host"),O(this,"__onCreate"),O(this,"__parent"),O(this,"__owner",{value:void 0}),O(this,"__state",{}),O(this,"eventHandlers"),O(this,"scale",1),O(this,"layers",[]),O(this,"time",[]),O(this,"_crop"),O(this,"cropData"),O(this,"id"),O(this,"addEventListener",(t,e,n)=>{let i=Vc[t];if(!this.eventHandlers[i])throw new Error(`Unknown event ${i}`);this.eventHandlers[i].indexOf(e)===-1&&this.eventHandlers[i].push(e)}),O(this,"removeEventListener",(t,e)=>{let n=Vc[t];if(!this.eventHandlers[n]){console.warn(`Unknown event ${n}`);return}this.eventHandlers[n].indexOf(e)!==-1&&(this.eventHandlers[n]=this.eventHandlers[n].filter(i=>i!==e))}),this.id=this.__id=Wy(),this.eventHandlers=pj()}get crop(){return this._crop}set crop(t){this._crop=t}getObjectsAt(t){return[]}getAllPointsAt(t,e,n){return[]}getScheduledUpdates(t,e){return[]}dispatchEvent(t,e){let n=this.eventHandlers[t],i=n?n.length:0,a=!1;if(i)for(let o=0;o<i;o++)try{n[o](e),a=!0}catch(s){console.error(t,s)}return a}get x(){return this.points[1]}get y(){return this.points[2]}get width(){return this.points[3]-this.points[1]}get height(){return this.points[4]-this.points[2]}translate(t,e){ci(this.points,je(t,e))}atScale(t){ci(this.points,Po(t,this.x,this.y)),this.scale*=t}transform(t){ci(this.points,t)}applyProps(t){this.__revision++}appendChild(t){}removeChild(t){}insertBefore(t,e){}hideInstance(){}},yl=class uR extends So{constructor(e){if(super(),O(this,"type","spacial-content"),O(this,"id"),O(this,"uri"),O(this,"display"),O(this,"points"),O(this,"priority"),O(this,"style",{opacity:1}),!e)this.id="",this.uri="",this.display={x:0,y:0,scale:1,width:0,height:0,points:gt(5)},this.points=gt(5);else{let n=e.scale||1;this.id=e.id||e.uri,this.uri=e.uri,this.points=Nt.singleBox(e.width,e.height,e.x,e.y),this.display={x:0,y:0,scale:n,width:e.width/n,height:e.height/n,points:Nt.singleBox(e.width/n,e.height/n),rotation:e?.rotation}}}applyProps(e){let n=e.display?e.display.width:e.target.width,i=e.target.width/n;if(this.id=e.id||e.uri,this.uri=e.uri,this.points.set(Nt.singleBox(e.target.width,e.target.height,e.target.x,e.target.y)),e.style&&typeof e.style.opacity<"u"&&(this.style.opacity=e.style.opacity),e.crop){this.cropData=e.crop;let a=Nt.singleBox(e.crop.width,e.crop.height,e.crop.x,e.crop.y);ci(a,je(-e.crop.x,-e.crop.y)),this.crop?this.crop.set(a):this.crop=gt(a)}e.display?(this.display.scale=i,this.display.width=e.display.width,this.display.height=e.display.height,this.display.rotation=e.display.rotation,this.display.points=Nt.singleBox(e.display.width,e.display.height)):(this.display.scale=i,this.display.width=e.target.width/i,this.display.height=e.target.height/i,this.display.points=Nt.singleBox(e.target.width/i,e.target.height/i))}getAllPointsAt(e,n,i){return[[this,this.crop||this.points,n]]}static fromSvg(e,n,i,a){return uR.fromImage("data:image/svg+xml;base64,"+btoa(e),n,i,a)}static fromImage(e,n,i,a){let o=new uR;return o.applyProps({uri:e,id:a,display:i,target:n}),o}getImageUrl(){return this.uri}},cR=class extends So{constructor(t){if(super(),O(this,"type","spacial-content"),O(this,"id"),O(this,"uri"),O(this,"display"),O(this,"points"),O(this,"getTexture"),this.getTexture=()=>({source:void 0,hash:-1}),!t)this.id="",this.uri="",this.display={x:0,y:0,scale:1,width:0,height:0,points:gt(5)},this.points=gt(5);else{let e=t.scale||1;this.id=t.id||t.uri,this.uri=t.uri,this.points=Nt.singleBox(t.width,t.height),this.display={x:0,y:0,scale:e,width:t.width/e,height:t.height/e,points:e!==1?Nt.singleBox(t.width/e,t.height/e):this.points}}}applyProps(t){let e=t.display?t.display.width:t.target.width,n=t.target.width/e;this.id=t.id,this.points.set(Nt.singleBox(t.target.width,t.target.height)),this.display.scale=n,this.display.width=t.target.width/n,this.display.height=t.target.height/n,this.getTexture=t.getTexture,this.display.points=n!==1?Nt.singleBox(t.target.width/n,t.target.height/n):this.points}getAllPointsAt(t,e,n){return[[this,this.points,e]]}};function gj(t,e,n=1){let i=e.length;if(i===0)throw new Error("No resources passed in.");let a=0,o=1/0;for(let s=0;s<i&&!(!e[s]||!e[s].display);s++){let u=fR(e[s].display.scale,t/(n||1));u<o&&(o=u,a=s)}return a}function fR(t,e){return Math.abs(t-e)}function Yy(t,e){let n=fR(t.x,e.x),i=fR(t.y,e.y);return Math.sqrt(Math.pow(n,2)+Math.pow(i,2))}function yj(t){let e=t.length;return t.indexOf("/info.json")===e-10?t.slice(0,-10):t}function Ny(t,e,n){return Math.min(Math.max(t,e),n)}var mh=class bI extends So{constructor(e){super(),O(this,"id"),O(this,"type","spacial-content"),O(this,"display"),O(this,"tileWidth"),O(this,"style",{opacity:1}),O(this,"points"),O(this,"service"),O(this,"format","jpg"),O(this,"crop2"),O(this,"version3"),O(this,"tileUrl"),this.tileUrl=yj(e.url),this.id=e.id||`${this.tileUrl}--${e.scaleFactor}`,this.points=e.displayPoints?e.displayPoints:Ki(e.points,Xi(e.scaleFactor)),this.tileWidth=e.tileWidth,this.version3=e.version3,this.display={x:0,y:0,width:e.width/e.scaleFactor,height:e.height/e.scaleFactor,points:e.points,scale:e.scaleFactor},e.format&&(this.format=e.format)}applyProps(e){if(e.style&&typeof e.style.opacity<"u"&&(this.style.opacity=e.style.opacity),e.service!==this.service&&(this.service=e.service),e.format?this.format=e.format:this.format="jpg",typeof e.version3<"u"&&(this.version3=e.version3),e.crop){this.cropData=e.crop;let n=gt([...this.points]),i=n.length/5,a=e.crop.x||0,o=e.crop.y||0,s=e.crop.x+e.crop.width,u=e.crop.y+e.crop.height;for(let d=0;d<i;d++){let p=d*5;n[p+1]<s&&n[p+3]>a&&n[p+2]<u&&n[p+4]>o?(n[p+1]=Ny(n[p+1],a,s),n[p+3]=Ny(n[p+3],a,s),n[p+2]=Ny(n[p+2],o,u),n[p+4]=Ny(n[p+4],o,u)):n[p]=0}ci(n,je(-e.crop.x,-e.crop.y)),this.crop?this.crop.set(n):this.crop=n}}static fromTile(e,n,i,a,o,s,u,d){i.height=i.height?i.height:i.width;let p=u?Math.floor(n.width/a):Math.ceil(n.width/a),f=u?Math.floor(n.height/a):Math.ceil(n.height/a),m=Math.ceil(p/i.width),g=Math.ceil(f/i.height),v=Nt.grid(m,g),S=Nt.grid(m,g),R=o?o["@context"]?Array.isArray(o["@context"])?o["@context"]:[o["@context"]]:[]:[],T=typeof d<"u"?d:R.indexOf("http://iiif.io/api/image/3/context.json")!==-1;for(let x=0;x<g;x++)for(let A=0;A<m;A++){let C=A*i.width,M=x*i.height;S.addPoints(C*a,M*a,A===m-1?n.width:(C+i.width)*a,x===g-1?n.height:(M+i.height)*a),v.addPoints(C,M,A===m-1?p:C+i.width,x===g-1?f:M+i.height)}let E=new bI({url:e,scaleFactor:a,points:v.build(),displayPoints:S.build(),width:n.width,height:n.height,tileWidth:i.width,format:s,version3:T});return E.applyProps({service:o}),E}getImageUrl(e){let n=this.points.slice(e*5,e*5+5),i=n[3]-n[1],a=n[4]-n[2],o=Math.ceil(i/this.display.scale),s=Math.ceil(a/this.display.scale),u=`${o>this.tileWidth?this.tileWidth:o},`;return this.version3&&(u+=`${s>this.tileWidth?this.tileWidth:s}`),`${this.tileUrl}/${n[1]},${n[2]},${i},${a}/${u}/0/default.${this.format||"jpg"}`}getAllPointsAt(e,n,i){let a=Hr(this.crop||this.points,e);return[[this,a,n]]}transform(e){ci(this.points,e)}getScheduledUpdates(e,n){return[]}},vj=class extends So{constructor(){super(...arguments),O(this,"type","spacial-content")}getAllPointsAt(t,e,n){return[[this,this.points,e]]}},Sj=class extends vj{constructor(t){super(),O(this,"id"),O(this,"display"),O(this,"points"),O(this,"images",[]),O(this,"allImages",[]),O(this,"scaleFactors",[]),O(this,"aggregateBuffer",gt(9)),O(this,"lazyLoader"),O(this,"isFullyLoaded",!1),O(this,"maxScaleFactor",0),O(this,"renderOptions"),O(this,"_scheduleSortByScales",!1),O(this,"_sortByScales",()=>{this._scheduleSortByScales=!1,this.allImages.sort((n,i)=>i.display.width-n.display.width),this.images=[];let e=.1;for(let n of this.allImages)if(!(n.display.width<this.renderOptions.minSize&&n.display.height<this.renderOptions.minSize&&!n.priority||n instanceof yl&&(n.display.width>this.renderOptions.maxImageSize||n.display.height>this.renderOptions.maxImageSize)&&!n.priority)){if(Math.abs(n.display.scale-e)<.25||n.priority){let i=this.images.pop();i&&(i instanceof yl||i.priority)?(n.priority&&this.images.push(n),this.images.push(i)):n&&this.images.push(n)}else n&&this.images.push(n);e=n.display.scale}this.images.length===0&&(this.images=[...this.allImages]),this.scaleFactors=this.images.map(n=>n.display.scale),this.maxScaleFactor=Math.max(...this.scaleFactors)}),O(this,"loadFullResource",async()=>{if(!this.isFullyLoaded&&this.lazyLoader){this.isFullyLoaded=!0;let e=await this.lazyLoader();this.addImages(e)}}),O(this,"fallback",[this.loadFullResource]),this.id=t.id,this.points=Nt.singleBox(t.width,t.height),this.lazyLoader=t.loadFullImages,t.loadFullImages||(this.isFullyLoaded=!0),this.display={x:0,y:0,points:Nt.singleBox(t.width,t.height),height:t.height,width:t.width,scale:1},this.renderOptions={renderSmallestFallback:!0,renderLayers:3,minSize:255,maxImageSize:2048,quality:1.5,...t.renderOptions||{}},this.addImages(t.images)}applyProps(t){typeof t.renderSmallestFallback<"u"&&t.renderSmallestFallback!==this.renderOptions.renderSmallestFallback&&(this.renderOptions.renderSmallestFallback=t.renderSmallestFallback),typeof t.renderLayers<"u"&&t.renderLayers!==this.renderOptions.renderLayers&&(this.renderOptions.renderLayers=t.renderLayers),typeof t.minSize<"u"&&t.minSize!==this.renderOptions.minSize&&(this.renderOptions.minSize=t.minSize),typeof t.maxImageSize<"u"&&t.maxImageSize!==this.renderOptions.maxImageSize&&(this.renderOptions.maxImageSize=t.maxImageSize),typeof t.quality<"u"&&t.quality!==this.renderOptions.quality&&(this.renderOptions.quality=t.quality)}appendChild(t){this.addImages([t])}removeChild(t){this.images.indexOf(t)!==-1&&(this.images=this.images.filter(e=>e!==t),this.sortByScales())}insertBefore(t,e){this.addImages([t])}hideInstance(){}addImages(t){for(let e of t)e.__parent=this,e.__owner=this.__owner;this.allImages.push(...t.filter(Boolean)),this.sortByScales()}sortByScales(){this._scheduleSortByScales=!0}getScheduledUpdates(t,e){return this._scheduleSortByScales?[this._sortByScales]:this.isFullyLoaded?[]:e>1/this.maxScaleFactor?this.fallback:[]}getAllPointsAt(t,e,n){if(this.images.length===0)return[];let i=gj(1/(n||1)/(window.devicePixelRatio||1),this.images,this.renderOptions.quality),a=this.images.length,o=e?Ai(e,je(this.x,this.y)):je(this.x,this.y);if(i!==this.images.length-1&&this.images[i+1]){let s=[];for(let p=a-1;p>=i;p--)s.push(p);let u=s[0];this.renderOptions.renderLayers&&(s=s.slice(-Math.min(s.length,this.renderOptions.renderLayers))),this.renderOptions.renderSmallestFallback&&s.indexOf(u)===-1&&s.unshift(u);let d=[];for(let p=0;p<s.length;p++)d.push(...this.images[s[p]].getAllPointsAt(t,o,n));return d}return this.images[i].getAllPointsAt(t,o,n)}};function Iy(t,e,n,i,a){let o=Math.PI/180*a,s=Math.cos(o),u=Math.sin(o),d=s*(n-t)+u*(i-e)+t,p=s*(i-e)-u*(n-t)+e;return[d,p]}var yR=class xI extends So{constructor(e,n){super(),O(this,"id"),O(this,"type","world-object"),O(this,"scale"),O(this,"layers"),O(this,"points"),O(this,"worldPoints"),O(this,"intersectionBuffer",gt(5)),O(this,"aggregateBuffer",gt(9)),O(this,"invertedBuffer",gt(9)),O(this,"rotation",0),O(this,"filteredPointsBuffer"),O(this,"_updatedList",[]),O(this,"geometry");let{x:i=0,y:a=0}=n||{};e?(this.id=e.id||"",this.scale=1,this.layers=e.layers,this.points=gt([1,i,a,i+e.width,a+e.height]),this.worldPoints=gt([1,i,a,i+e.width,a+e.height]),this.filteredPointsBuffer=gt(e.layers.length*5)):(this.id="",this.scale=1,this.layers=[],this.points=gt(5),this.worldPoints=gt(5),this.filteredPointsBuffer=gt(5))}static createWithProps(e){let n=new xI;return n.applyProps(e),n}applyProps(e){let n=e.x||0,i=e.y||0;this.id=e.id;let a=typeof e.scale<"u"?e.scale:this.scale;this.points[0]=1,this.points[1]=n,this.points[2]=i,this.points[3]=n+e.width,this.points[4]=i+e.height,this.rotation=e.rotation||0,this.worldPoints[3]=this.worldPoints[1]+e.width,this.worldPoints[4]=this.worldPoints[2]+e.height,e.scale&&e.scale!==1&&this.atScale(a),this.scale=a}appendChild(e){e.points[0]===0&&e.points.set(this.points),e.__owner.value=this,this.addLayers([e])}removeChild(e){this.layers=this.layers.filter(n=>n!==e),this.filteredPointsBuffer=gt(this.layers.length*5)}insertBefore(e,n){let i=this.layers.indexOf(n);if(i===-1||this.layers.indexOf(e)!==-1)return;let a=this.layers.slice(0,i),o=this.layers.slice(i);this.layers=[...a,e,...o]}hideInstance(){console.warn("hideInstance: not yet implemented")}getObjectsAt(e,n){if(this.rotation&&(e=this.applyRotation(e)),Hr(this.points,e,this.filteredPointsBuffer)[0]===0)return[];let i=this.layers.length,a=[];for(let o=0;o<i;o++){let s=this.layers[o];if(n&&s.isShape){let u=Ki(s.points,je(this.x,this.y));if(!s.intersects([e[1]-u[1],e[2]-u[2]]))continue}if(Hr(Ki(s.points,je(this.x,this.y)),e,this.filteredPointsBuffer)[0]!==0&&a.push(s),n){let u=s;a.push(...u.getObjectsAt(e,n))}}return a}applyRotation(e){if(this.rotation){let n={x:e[1],y:e[2]},i={x:e[1],y:e[4]},a={x:e[3],y:e[2]},o={x:e[3],y:e[4]},s=this.points[1]+(this.points[3]-this.points[1])/2,u=this.points[2]+(this.points[4]-this.points[2])/2,[d,p]=Iy(s,u,n.x,n.y,this.rotation),[f,m]=Iy(s,u,i.x,i.y,this.rotation),[g,v]=Iy(s,u,a.x,a.y,this.rotation),[S,R]=Iy(s,u,o.x,o.y,this.rotation),T=Math.min(d,f,g,S),E=Math.max(d,f,g,S),x=Math.min(p,m,v,R),A=Math.max(p,m,v,R);return gt([e[0],T,x,E,A])}return e}getAllPointsAt(e,n,i){let a=Ai(je(this.x,this.y),Xi(this.scale),this.aggregateBuffer);this.rotation&&(e=this.applyRotation(e));let o=BM(e,this.points,this.intersectionBuffer),s=this.layers.length,u=[],d=Ki(o,Ai(Xi(1/this.scale),je(-this.x,-this.y),this.invertedBuffer)),p=n?Ai(n,a,this.aggregateBuffer):a,f=i*this.scale;for(let m=0;m<s;m++)u.push(...this.layers[m].getAllPointsAt(d,p,f));return u}addLayers(e){let n=[];for(let i of e)this.layers.indexOf(i)===-1&&(n.push(i),i.points.length===5&&(i.points[1]<this.worldPoints[1]/this.scale||i.points[2]<this.worldPoints[2]/this.scale||i.points[3]>this.worldPoints[3]/this.scale||i.points[4]>this.worldPoints[4]/this.scale)&&(i.crop=i.crop||gt([1,Math.max(this.worldPoints[1]/this.scale,i.points[1]),Math.max(this.worldPoints[2]/this.scale,i.points[2]),Math.min(this.worldPoints[3]/this.scale,i.points[3]),Math.min(this.worldPoints[4]/this.scale,i.points[4])])));this.layers=this.layers.concat(n),this.filteredPointsBuffer=gt(this.layers.length*5)}getScheduledUpdates(e,n){let i=this.layers.length;this._updatedList=[];let a=n*this.scale;for(let o=0;o<i;o++){let s=this.layers[o].getScheduledUpdates(e,a);s&&this._updatedList.push(...s)}return this._updatedList}},$y=class EI extends So{constructor(e=0,n=0,i=100,a="left-to-right"){super(),O(this,"id","world"),O(this,"_width"),O(this,"_height"),O(this,"aspectRatio"),O(this,"viewingDirection"),O(this,"aggregateBuffer",gt(9)),O(this,"isDirty",!1),O(this,"zones",[]),O(this,"filteredPointsBuffer"),O(this,"selectedZone"),O(this,"triggerQueue",[]),O(this,"activatedEvents",[]),O(this,"_updatedList",[]),O(this,"translationBuffer",gt(9)),O(this,"needsRecalculate",!0),O(this,"emptyPaintables",[]),O(this,"renderOrder",[]),O(this,"points"),O(this,"objects",[]),O(this,"subscriptions",[]),O(this,"_propagateEventTargets",[]),O(this,"_alreadyFlushed",[]),this._width=e,this._height=n,this.aspectRatio=Number.isNaN(e/n)?1:e/n,this.viewingDirection=a,this.points=gt(i*5),this.filteredPointsBuffer=gt(i*5)}get x(){return 0}get y(){return 0}get width(){return this._width}get height(){return this._height}static withProps(e){let n=new EI;return n.applyProps(e),n}applyProps(e){typeof e.width<"u"&&typeof e.height<"u"&&(e.width!==this._width||e.height!==this._height)&&this.resize(e.width,e.height),e.viewingDirection!==this.viewingDirection&&(this.viewingDirection=e.viewingDirection,this.triggerRepaint())}propagateTouchEvent(e,n,i){let a=[];for(let o of i)if(o.x&&o.y){let s=Nt.singleBox(1,1,o.x,o.y);a.push(this.getObjectsAt(s,!0).reverse())}return a.map(o=>this.propagateEvent(e,n,o,{bubbles:!0,cancelable:!0}))}propagatePointerEvent(e,n,i,a,o={}){let s=Nt.singleBox(1,1,i,a),u=this.getObjectsAt(s,!0).reverse();return this.propagateEvent(e,n,u,o)}propagateEvent(e,n,i,{bubbles:a=!1,cancelable:o=!1}={}){n.atlasTarget=this,this._propagateEventTargets.length=1,this._propagateEventTargets[0]=this;let s=!1;n.stopPropagation=()=>{s=!0};let u=i.length;for(let f=u-1;f>=0;f--){this._propagateEventTargets.unshift(i[f][0]);let m=i[f][1].length;if(m)for(let g=0;g<m;g++)this._propagateEventTargets.unshift(i[f][1][g])}let d=this._propagateEventTargets.length,p=!1;for(let f=0;f<d&&(n.atlasTarget=this._propagateEventTargets[f],n.atlasWorld=this,p=this._propagateEventTargets[f].dispatchEvent(e,n)||p,!s);f++);return p&&this.triggerRepaint(),this._propagateEventTargets}appendChild(e){let n=this.appendWorldObject(e);this.renderOrder.push(n/5)}removeChild(e){let n=this.objects.indexOf(e);if(n===-1){for(let i of this.objects)if(i&&i.id===e.id){this.removeChild(i);return}return}this.objects[n]=null,this.renderOrder=this.renderOrder.filter(i=>i!==n),this.points[n*5]=0,this.triggerRepaint(),this.needsRecalculate=!0}insertBefore(e,n){let i=this.objects.indexOf(n);if(i===-1)return;let a=this.appendWorldObject(e);this.renderOrder.splice(i-1,0,a/5)}hideInstance(){}asWorldObject(){return null}addZone(e){this.zones.push(e)}selectZone(e){if(typeof e=="string"){let n=this.zones.length;for(let i=0;i<n;i++)if(this.zones[i].id===e){this.selectedZone=i,this.trigger("zone-changed");return}}else this.zones[e]&&(this.selectedZone=e,this.trigger("zone-changed"))}deselectZone(){this.selectedZone=void 0}getActiveZone(){if(this.selectedZone)return this.zones[this.selectedZone]}hasActiveZone(){return typeof this.selectedZone<"u"}checkResizeInternalBuffer(){if(PM(this.points)===this.objects.length){let e=this.points,n=gt(this.points.length*2);n.set(e,0),this.points=n}}appendWorldObject(e){this.checkResizeInternalBuffer();let n=this.objects.length*5,i=e.points;return e.points=this.points.subarray(this.objects.length*5,this.objects.length*5+5),e.points[1]=i[1],e.points[2]=i[2],e.points[3]=i[3],e.points[4]=i[4],this.objects.push(e),this.filteredPointsBuffer=gt(this.objects.length*5),this.needsRecalculate=!0,this.triggerRepaint(),n}recalculateWorldSize(){let e=!1;if(this.needsRecalculate){let n=new Int32Array(this.objects.length),i=new Int32Array(this.objects.length),a=this.renderOrder.length;for(let u=0;u<a;u++){let d=this.renderOrder[u];this.objects[d]&&(n[u]=this.points[d*5+3],i[u]=this.points[d*5+4])}let o=Math.max(...n);o!==this._width&&(this._width=o,e=!0);let s=Math.max(...i);s!==this._height&&(this._height=s,e=!0),e&&this.trigger("recalculate-world-size",{width:o,height:s}),this.needsRecalculate=!1}return e}addObjectAt(e,n){n.width&&!n.height?n.height=n.width/e.width*e.height:n.height&&!n.width&&(n.width=n.height/e.height*e.width),(!n||!n.width||!n.height)&&(n.width=e.width,n.height=e.height);let{width:i,x:a,y:o}=n,s=i/e.width;this.checkResizeInternalBuffer(),this.points.set(Nt.singleBox(e.width,e.height,0,0),this.objects.length*5);let u=new yR(e);return u.points=this.points.subarray(this.objects.length*5,this.objects.length*5+5),this.objects.push(u),this.scaleWorldObject(this.objects.length-1,s),this.translateWorldObject(this.objects.length-1,a,o),this.filteredPointsBuffer=gt(this.points.length*2),this.triggerRepaint(),this.needsRecalculate=!0,u}scaleWorldObject(e,n){ci(this.points.subarray(e*5,e*5+5),Po(n,this.points[e*5+1],this.points[e*5+2]));let i=this.objects[e];i&&(i.atScale(n),this.triggerRepaint())}translateWorldObject(e,n,i){ci(this.points.subarray(e*5,e*5+5),je(n,i));let a=this.objects[e];a&&(a.translate(n,i),this.triggerRepaint())}resize(e,n){return this._width=e,this._height=n,this.aspectRatio=e/n,this.triggerRepaint(),this}getObjects(){return this.objects}getPoints(){return this.points}getPointsFromViewer(e,n){let i=Nt.singleBox(e.width,e.height,e.x,e.y);return this.getPointsAt(i,n,e.scale)}addLayoutSubscriber(e){return this.subscriptions.push(e),()=>{this.subscriptions.splice(this.subscriptions.indexOf(e),1)}}getScheduledUpdates(e,n){let i=Hr(this.points,e,this.filteredPointsBuffer),a=this.objects.length;this._updatedList=[];for(let o=0;o<a;o++)if(i[o*5]!==0){if(!this.objects[o])continue;this._updatedList.push(...this.objects[o].getScheduledUpdates(e,n))}return this._updatedList}getObjectsAt(e,n=!1){let i=this.getActiveZone(),a=Hr(this.points,e,this.filteredPointsBuffer),o=this.renderOrder.length,s=[];for(let u=0;u<o;u++){let d=this.renderOrder[u];if(a[d*5]!==0){let p=this.objects[d];if(!p||i&&i.objects.indexOf(p)===-1)continue;if(p.type!=="world-object"){s.push([p,[p]]);continue}n?s.push([p,p.getObjectsAt(e,n)]):s.push([p,this.emptyPaintables])}}return s}getPointsAt(e,n,i=1){let a=this.getObjectsAt(e),o=Ai(Xi(i),je(-e[1],-e[2]),this.translationBuffer),s=n?Ai(n,o,this.aggregateBuffer):o,u=a.length,d=[];for(let p=0;p<u;p++)a[p]&&d.push(...a[p][0].getAllPointsAt(e,s,i));return d}flushSubscriptions(){if(this.triggerQueue.length){this._alreadyFlushed=[];let e=this.triggerQueue.length;for(let n=0;n<e;n++){if(this._alreadyFlushed.indexOf(this.triggerQueue[n][0])!==-1)continue;typeof this.triggerQueue[n][1]>"u"&&this._alreadyFlushed.push(this.triggerQueue[n][0]);let i=this.subscriptions.length;for(let a=0;a<i;a++)this.subscriptions[a].apply(null,this.triggerQueue[n])}this.triggerQueue=[]}}trigger(e,n){this.triggerQueue.push([e,n])}triggerEventActivation(){this.trigger("event-activation")}triggerRepaint(){this.trigger("repaint")}gotoRegion(e){this.trigger("goto-region",e)}goHome(e=!1){this.trigger("go-home",{immediate:e})}zoomTo(e,n,i){this.trigger("zoom-to",{point:n,factor:e,stream:i})}zoomIn(e){this.trigger("zoom-to",{point:e,factor:.5})}zoomOut(e){this.trigger("zoom-to",{point:e,factor:2})}constraintBounds(e){this.trigger("constrain-bounds",{immediate:e})}};var Dy=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,Ly={},bj=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"],fh=class extends So{constructor(){super(),O(this,"id"),O(this,"type","spacial-content"),O(this,"points"),O(this,"hoverEvents",!1),O(this,"activeEvents",!1),O(this,"display",{x:0,y:0,scale:1,width:-1,height:-1,points:gt(5)}),O(this,"_parsed",{border:{id:null,match:[]},outline:{id:null,match:[]}}),O(this,"hovering"),O(this,"pressing"),O(this,"props",{}),O(this,"addHover",()=>{this.hovering=!0,this.__revision++}),O(this,"removeHover",()=>{this.hovering=!1,this.pressing=!1,this.__revision++}),O(this,"addPress",()=>{this.pressing=!0,this.__revision++}),O(this,"removePress",()=>{this.pressing=!1,this.__revision++}),this.id=Wy(12),this.points=gt(5)}getAllPointsAt(t,e){return[[this,this.points,e]]}applyProps(t={}){let e=!1;if(t.interactive!==this.props.interactive&&(e=!0,this.props.interactive=t.interactive),t.style){let n=t.border||t.style.border;if(n!==this._parsed.border.id)if(!n)this._parsed.border.id=null,this._parsed.border.match=[];else{let i=Ly[n]||Dy.exec(n)||Dy.exec(n);i&&(this._parsed.border.id=n,this._parsed.border.match=Ly[n]=i)}if(this._parsed.border.id&&(t.style.borderWidth=this._parsed.border.match[1],t.style.borderStyle="solid",t.style.borderColor=this._parsed.border.match[4]),t.style.outline!==this._parsed.outline.id)if(!t.style.outline)this._parsed.outline.id=null,this._parsed.outline.match=[];else{let i=Ly[t.style.outline]||Dy.exec(t.style.outline)||Dy.exec(t.style.outline);i&&(this._parsed.outline.id=t.style.outline,this._parsed.outline.match=Ly[t.style.outline]=i)}this._parsed.outline.id&&(t.style.outlineWidth=this._parsed.outline.match[1],t.style.outlineStyle="solid",t.style.outlineColor=this._parsed.outline.match[4]),this.props.style=t.style,t.backgroundColor&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.backgroundColor,e=!0),t.style.background&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.style.background,e=!0);for(let i of bj)if(this.props.style[i]!==t.style[i]){e=!0;break}t.style[":hover"]!==this.props.hoverStyles&&(this.props.hoverStyles=t.style[":hover"],this.hoverEvents||(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),e=!0),t.style[":active"]!==this.props.pressStyles&&(this.props.pressStyles=t.style[":active"],this.activeEvents||(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0)}t.href!==this.props.href&&(this.props.href=t.href,e=!0),t.hrefTarget!==this.props.hrefTarget&&(this.props.hrefTarget=t.hrefTarget,e=!0),t.title!==this.props.title&&(this.props.title=t.title,e=!0),t.className!==this.props.className&&(this.props.className=t.className,t.className&&!this.hoverEvents&&(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),t.className&&!this.activeEvents&&(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0),t.relativeSize!==this.props.relativeSize&&(this.props.relativeSize=t.relativeSize,e=!0),t.relativeStyle!==this.props.relativeStyle&&(this.props.relativeStyle=t.relativeStyle,e=!0),t.html!==this.props.html&&(this.props.html=t.html,e=!0),t.target&&(t.target.width!==this.display.width||t.target.height!==this.display.height||t.target.x!==this.points[1]||t.target.y!==this.points[2])&&(e=!0,this.points=Nt.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.points=Nt.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.width=t.target.width,this.display.height=t.target.height),e&&this.__revision++}},Fy=class extends So{constructor(){super(),O(this,"type","spacial-content"),O(this,"id"),O(this,"points"),O(this,"color","#000"),O(this,"backgroundColor"),O(this,"hovering"),O(this,"pressing"),O(this,"text",""),O(this,"display",{x:0,y:0,scale:1,width:100,height:100,points:gt(5)}),O(this,"className"),O(this,"html"),O(this,"interactive",!1),O(this,"props",{font:"18px Arial, sans-serif",lineHeight:1,textAlign:"left",verticalAlign:"top",paddingX:0,paddingY:0,fitParent:!1,lineBreak:"auto",strokeText:!1,sizeToFill:!1,maxFontSizeToFill:void 0,allowNewLine:!0,justifyLines:!1,renderHDPI:!1,textDecoration:"none",interactive:!1,relativeSize:!1}),this.id="",this.points=gt(5)}getAllPointsAt(t,e){return[[this,this.points,e]]}applyProps({id:t,target:e,text:n,color:i,backgroundColor:a,fontSize:o=18,interactive:s,fontFamily:u="Arial, sans-serif",...d}){d.font=`${o}px ${u}`,this.interactive=s||!1,typeof n<"u"&&(this.text=n||""),i&&(this.color=i),a&&(this.backgroundColor=a),t&&(this.id=t),e&&(this.points=Nt.singleBox(e.width,e.height,e.x,e.y),this.display.points=this.points,this.display.width=e.width,this.display.height=e.height),this.props={...this.props,...d},this.__revision++}},qe=Math.pow,By=Math.sqrt,sh=Math.sin,oI=Math.cos,dh=Math.PI,Qy=1.70158,Py=Qy*1.525,rI=Qy+1,lI=2*dh/3,sI=2*dh/4.5,Hy=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},gl={linear:t=>t,easeInQuad:function(t){return t*t},easeOutQuad:function(t){return 1-(1-t)*(1-t)},easeInOutQuad:function(t){return t<.5?2*t*t:1-qe(-2*t+2,2)/2},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1-qe(1-t,3)},easeInOutCubic:function(t){return t<.5?4*t*t*t:1-qe(-2*t+2,3)/2},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1-qe(1-t,4)},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-qe(-2*t+2,4)/2},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1-qe(1-t,5)},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1-qe(-2*t+2,5)/2},easeInSine:function(t){return 1-oI(t*dh/2)},easeOutSine:function(t){return sh(t*dh/2)},easeInOutSine:function(t){return-(oI(dh*t)-1)/2},easeInExpo:function(t){return t===0?0:qe(2,10*t-10)},easeOutExpo:function(t){return t===1?1:1-qe(2,-10*t)},easeInOutExpo:function(t){return t===0?0:t===1?1:t<.5?qe(2,20*t-10)/2:(2-qe(2,-20*t+10))/2},easeInCirc:function(t){return 1-By(1-qe(t,2))},easeOutCirc:function(t){return By(1-qe(t-1,2))},easeInOutCirc:function(t){return t<.5?(1-By(1-qe(2*t,2)))/2:(By(1-qe(-2*t+2,2))+1)/2},easeInBack:function(t){return rI*t*t*t-Qy*t*t},easeOutBack:function(t){return 1+rI*qe(t-1,3)+Qy*qe(t-1,2)},easeInOutBack:function(t){return t<.5?qe(2*t,2)*((Py+1)*2*t-Py)/2:(qe(2*t-2,2)*((Py+1)*(t*2-2)+Py)+2)/2},easeInElastic:function(t){return t===0?0:t===1?1:-qe(2,10*t-10)*sh((t*10-10.75)*lI)},easeOutElastic:function(t){return t===0?0:t===1?1:qe(2,-10*t)*sh((t*10-.75)*lI)+1},easeInOutElastic:function(t){return t===0?0:t===1?1:t<.5?-(qe(2,20*t-10)*sh((20*t-11.125)*sI))/2:qe(2,-20*t+10)*sh((20*t-11.125)*sI)/2+1},easeInBounce:function(t){return 1-Hy(1-t)},easeOutBounce:Hy,easeInOutBounce:function(t){return t<.5?(1-Hy(1-2*t))/2:(1+Hy(2*t-1))/2}},xj=class{constructor(t){O(this,"runtime"),O(this,"pendingTransition"),O(this,"lastZoomTo",null),O(this,"isConstraining",!1),O(this,"lastGoToRegion",null),this.runtime=t,this.pendingTransition={from:gt(5),to:gt(5),elapsed_time:0,done:!0,total_time:0,timingFunction:gl.easeInOutQuad,constrain:!1}}hasPending(){return!this.pendingTransition.done}getPendingTransition(){return this.pendingTransition}getPendingFrom(){return this.pendingTransition.from}customTransition(t){t(this.pendingTransition)}stopTransition(){this.pendingTransition.from=gt(this.runtime.target),this.pendingTransition.to=gt(this.runtime.target),this.pendingTransition.done=!0,this.pendingTransition.elapsed_time=0,this.pendingTransition.total_time=0}runTransition(t,e){if(!this.pendingTransition.done){let n=this.pendingTransition,i=n.total_time===0?0:(n.elapsed_time+e)/n.total_time,a=n.total_time===0?1:i===0?0:n.timingFunction(i);t[1]=n.from[1]+(n.to[1]-n.from[1])*a,t[2]=n.from[2]+(n.to[2]-n.from[2])*a,t[3]=n.from[3]+(n.to[3]-n.from[3])*a,t[4]=n.from[4]+(n.to[4]-n.from[4])*a,this.pendingTransition.elapsed_time+=e,this.pendingTransition.elapsed_time>=this.pendingTransition.total_time&&(this.pendingTransition.done=!0,this.pendingTransition.callback?.(),this.pendingTransition.constrain&&this.constrainBounds({transition:{duration:this.pendingTransition.total_time===0?0:500,easing:gl.easeOutExpo}}))}}resumeTransition(){this.lastZoomTo&&this.zoomTo(this.lastZoomTo.factor,this.lastZoomTo.options),this.isConstraining&&this.constrainBounds(),this.lastGoToRegion&&this.goToRegion(this.lastGoToRegion.target,this.lastGoToRegion.options)}zoomTo(t,e={}){let{origin:n,stream:i=!1,transition:a}=e;this.lastZoomTo={factor:t,options:e};let o=this.runtime.getZoomedPosition(t,{origin:n}),s=Math.abs(1-t);this.applyTransition(o,a,{duration:2e3*s,easing:gl.easeOutExpo,constrain:!0,callback:()=>{this.lastZoomTo=null}},{stream:!1})}constrainBounds({transition:t,panPadding:e=0}={}){this.isConstraining=!0;let[n,i]=this.runtime.constrainBounds(this.runtime.target,{panPadding:e});n&&(this.applyTransition(i,t,{duration:500,easing:gl.easeOutQuart,constrain:!1,callback:()=>{this.isConstraining=!1}}),this.runtime.updateNextFrame())}applyTransition(t,e,n,{stream:i}={}){this.pendingTransition.from=gt(this.runtime.target),this.pendingTransition.to=t,i||(this.pendingTransition.elapsed_time=0),this.pendingTransition.done=!1,this.pendingTransition.total_time=typeof e?.duration<"u"?e.duration:typeof n?.duration<"u"?n.duration:1e3,this.pendingTransition.constrain=typeof e?.constrain<"u"?e.constrain:typeof n?.constrain<"u"?n.constrain:!1,this.pendingTransition.timingFunction=e?.easing||n?.easing||gl.easeInOutSine}goToRegion(t,{transition:e}={}){this.lastGoToRegion={target:t,options:{transition:e}};let n=this.runtime.clampRegion(t);this.applyTransition(Nt.singleBox(n.width,n.height,n.x,n.y),e,{duration:1e3,easing:gl.easeOutExpo,constrain:!0,callback:()=>{this.lastGoToRegion=null}}),this.runtime.updateNextFrame()}},eQ=Number.MIN_VALUE+1,tv=class{constructor(t,e,n,i=[],a){O(this,"id",Wy()),O(this,"ready",!1),O(this,"renderer"),O(this,"world"),O(this,"target"),O(this,"homePosition"),O(this,"manualHomePosition"),O(this,"manualFocalPosition"),O(this,"focalPosition"),O(this,"transitionManager"),O(this,"aggregate"),O(this,"transformBuffer",gt(500)),O(this,"lastTarget",gt(5)),O(this,"zoomBuffer",gt(5)),O(this,"logNextRender",!1),O(this,"pendingUpdate",!0),O(this,"isCommitting",!1),O(this,"firstRender",!0),O(this,"lastTime"),O(this,"stopId"),O(this,"mode","explore"),O(this,"controllers",[]),O(this,"controllersRunning",!1),O(this,"controllerStopFunctions",[]),O(this,"maxScaleFactor",1),O(this,"_viewerToWorld",{x:0,y:0}),O(this,"_lastGoodScale",1),O(this,"hooks",{useFrame:[],useBeforeFrame:[],useAfterPaint:[],useAfterFrame:[]}),O(this,"fpsLimit"),O(this,"options"),O(this,"hookOptions",{filters:{grayscale:0,contrast:0,brightness:0,saturate:0,sepia:0,invert:0,hueRotate:0,blur:0}}),O(this,"_viewport",{x:0,y:0,width:0,height:0}),O(this,"setViewport",o=>{let s=Math.round(typeof o.x>"u"?this.target[1]:o.x),u=Math.round(typeof o.y>"u"?this.target[2]:o.y);o.width?this.target[3]=s+o.width:this.target[3]=this.target[3]-this.target[1]+s,o.height?this.target[4]=u+o.height:this.target[4]=this.target[4]-this.target[2]+u,Math.abs(this.target[1]-s)>.01&&(this.target[1]=s),Math.abs(this.target[2]-u)>.01&&(this.target[2]=u),this.pendingUpdate=!0}),O(this,"render",o=>{let s=o-this.lastTime;if(this.isCommitting||this.fpsLimit&&s<1e3/this.fpsLimit){this.stopId=window.requestAnimationFrame(this.render);return}this.lastTime=o,this.world.flushSubscriptions(),this.stopId=window.requestAnimationFrame(this.render),this.hook("useFrame",s);let u=this.pendingUpdate,d=this.renderer.pendingUpdate();if(this.transitionManager.hasPending()&&(this.transitionManager.runTransition(this.target,s),this.pendingUpdate=!0,this.updateControllerPosition()),!this.firstRender&&!u&&!d&&this.target[0]===this.lastTarget[0]&&this.target[1]===this.lastTarget[1]&&this.target[2]===this.lastTarget[2]&&this.target[3]===this.lastTarget[3]&&this.target[4]===this.lastTarget[4])return;this.hook("useBeforeFrame",s),this.renderer.beforeFrame(this.world,s,this.target,this.hookOptions);let p=this.getScaleFactor(),f=this.renderer.getPointsAt(this.world,this.target,this.aggregate,p),m=f.length;for(let S=0;S<m;S++){let R=f[S][0],T=f[S][1],E=f[S][2],x=E?Ki(T,E,this.transformBuffer):T;this.renderer.prepareLayer(R,R.__parent&&E?Ki(R.__parent.crop||R.__parent.points,E):x);let A=x.length/5;for(let C=0;C<A;C++){let M=C*5;x[M]!==0&&(this.renderer.paint(R,C,x[M+1],x[M+2],x[M+3]-x[M+1],x[M+4]-x[M+2]),this.hook("useAfterPaint",R))}this.renderer.finishLayer(R,T)}this.renderer.afterFrame(this.world,s,this.target,this.hookOptions),this.hook("useAfterFrame",s),this.lastTarget[0]=this.target[0],this.lastTarget[1]=this.target[1],this.lastTarget[2]=this.target[2],this.lastTarget[3]=this.target[3],this.lastTarget[4]=this.target[4],this.firstRender=!1,this.pendingUpdate=!1,this.logNextRender=!1,this.renderer.isReady()&&(this.ready=!0,this.world.trigger("ready")),this.world.flushSubscriptions();let g=this.world.getScheduledUpdates(this.target,p),v=g.length;if(v>0)for(let S=0;S<v;S++){let R=g[v-S-1]();R?R.then(()=>{this.pendingUpdate=!0}):this.pendingUpdate=!0}}),this.renderer=t,this.world=e,this.options={maxOverZoom:1,maxUnderZoom:1,visibilityRatio:1.5,...a||{}},this.target=Nt.projection(n),this.manualHomePosition=!1,this.pendingUpdate=!0,this.homePosition=Nt.projection(this.world),this.manualFocalPosition=!1,this.focalPosition=this.target,this.updateFocalPosition(),this.transitionManager=new xj(this),this.aggregate=Xi(1),this.world.addLayoutSubscriber(o=>{o==="repaint"&&(this.pendingUpdate=!0),o==="recalculate-world-size"&&(this.manualHomePosition||(this.setHomePosition(),this.goHome()),this.updateFocalPosition())}),this.lastTime=performance.now(),this.controllers=i,this.render(this.lastTime),this.startControllers()}get x(){return this.target[1]}set x(t){this.target[1]=t}get y(){return this.target[2]}set y(t){this.target[2]=t}get x2(){return this.target[3]}set x2(t){this.target[3]=t}get y2(){return this.target[4]}set y2(t){this.target[4]=t}get width(){return this.target[3]-this.target[1]}set width(t){this.target[3]=this.target[1]+t}get height(){return this.target[4]-this.target[2]}set height(t){this.target[4]=this.target[2]=t}setHomePosition(t){this.homePosition.set(Nt.projection(t||this.world)),this.pendingUpdate=!0}startControllers(){if(!this.controllersRunning){for(let t of this.controllers)this.controllerStopFunctions.push(t.start(this));this.controllersRunning=!0}}stopControllers(){if(this.controllersRunning){for(let t of this.controllerStopFunctions)t();this.controllersRunning=!1,this.controllerStopFunctions=[]}}updateControllerPosition(){for(let t of this.controllers)t.updatePosition(this.x,this.y,this.width,this.height)}triggerResize(){this.renderer.triggerResize&&this.renderer.triggerResize(),this.pendingUpdate=!0}addController(t){this.controllers.push(t),this.controllersRunning&&t.start(this),this.pendingUpdate=!0}cover(){return this.goHome({cover:!0})}getRendererScreenPosition(){return this.renderer.getRendererScreenPosition()}updateRendererScreenPosition(){this.pendingUpdate=!0,this.renderer.resize()}setOptions(t){this.options={...this.options,...t}}goHome(t={}){if(this.world.width<=0||this.world.height<=0)return;let e=this.getScaleFactor(),n=t.position?{x:t.position[1],y:t.position[2],width:t.position[3]-t.position[1],height:t.position[4]-t.position[2]}:{x:this.homePosition[1],y:this.homePosition[2],width:this.homePosition[3]-this.homePosition[1],height:this.homePosition[4]-this.homePosition[2]},i=this.width*e,a=this.height*e,o=n.width/i,s=n.height/a,u=i/a;if(t.cover?o>s:o<s){let d=u*n.height,p=(d-n.width)/2;this.target[1]=Math.round(-p+n.x),this.target[2]=Math.round(n.y),this.target[3]=Math.round(d-p+n.x),this.target[4]=Math.round(n.height+n.y)}else{let d=n.width/u,p=(d-n.height)/2;this.target[1]=Math.round(n.x),this.target[2]=Math.round(n.y-p),this.target[3]=Math.round(n.x+n.width),this.target[4]=Math.round(n.y+d-p)}this.constrainBounds(this.target),this.updateControllerPosition()}resize(t,e,n,i){this.transitionManager.hasPending()&&this.transitionManager.stopTransition(),this.updateFocalPosition(t-e,n-i);let a=e/t,o=i/n;this.target[3]=this.target[1]+(this.target[3]-this.target[1])*a,this.target[4]=this.target[2]+(this.target[4]-this.target[2])*o,this.goHome({position:this.focalPosition}),this.renderer.resize(e,i),this.pendingUpdate=!0,this.transitionManager.resumeTransition()}updateFocalPosition(t,e){if(!this.manualFocalPosition){let n=this.width,i=this.height,a=Math.min(n,i),o=0,s=0,u=this.x+o,d=this.y+s;if(n<i){let p=this.height-this.width;this.focalPosition=Nt.projection({x:u,y:d+p/2,width:a-o*2,height:a-s*2}),this.pendingUpdate=!0}else{let p=this.width-this.height;this.focalPosition=Nt.projection({x:u+p/2,y:d,width:a-o*2,height:a-s*2}),this.pendingUpdate=!0}}}getViewport(){return this._viewport.x=this.target[1],this._viewport.y=this.target[2],this._viewport.width=this.target[3]-this.target[1],this._viewport.height=this.target[4]-this.target[2],this._viewport}constrainBounds(t,{panPadding:e=0,ref:n=!1}={}){let{minX:i,maxX:a,minY:o,maxY:s}=this.getBounds({target:t,padding:e}),u=!1,d=n?t:gt(t),p=Math.round(t[3]-t[1]),f=Math.round(t[4]-t[2]);return i>t[1]&&(u=!0,d[1]=i,d[3]=i+p),o>t[2]&&(u=!0,d[2]=o,d[4]=o+f),a<t[1]&&(u=!0,d[1]=a,d[3]=a+p),s<t[2]&&(u=!0,d[2]=s,d[4]=s+f),[u,d]}getBounds(t){let e=t.target||this.target,n=t.padding,i=this.options.visibilityRatio,a=Math.abs(1-i);if(this.world.hasActiveZone()){let E=this.world.getActiveZone();if(E){let x=e[3]-e[1]<E.points[3]-E.points[1],A=e[4]-e[2]<E.points[4]-E.points[2];return{minX:x?E.points[1]-n:E.points[1]+(E.points[3]-E.points[1])/2-(e[3]-e[1])/2,maxX:A?E.points[2]-n:E.points[2]+(E.points[4]-E.points[2])/2-(e[4]-e[2])/2,minY:x?E.points[3]+n:E.points[1]+(E.points[3]-E.points[1])/2-(e[3]-e[1])/2,maxY:A?E.points[4]+n:E.points[2]+(E.points[4]-E.points[2])/2-(e[4]-e[2])/2}}}let o=e[3]-e[1],s=this.world.width,u=-o*a,d=s-o-u,p=e[4]-e[2],f=this.world.height,m=-p*a,g=f-p-m,v=Math.round(Math.max(u,d)),S=Math.round(Math.min(u,d)),R=Math.round(Math.max(m,g)),T=Math.round(Math.min(m,g));return{minX:S,maxX:v,minY:T,maxY:R}}getScaleFactor(t=!1){let e=this.renderer.getScale(this.target[3]-this.target[1],this.target[4]-this.target[2],t);return e===0?this._lastGoodScale:(this._lastGoodScale=e,e)}getZoomedPosition(t,{origin:e,fromPos:n}){let i=n?{width:n[3]-n[1],height:n[4]-n[2]}:void 0,a=i?this.renderer.getScale(i.width,i.height):this.getScaleFactor(),o=i?i.width:this.width,s=i?i.height:this.height,u=this.getRendererScreenPosition()?.width,d=this.world.width,p=u?u/d:1,f=this.options.maxUnderZoom,m=Math.max(p||1,this.options.maxOverZoom),g=1/t,v=a*g;if(g<1){let R=o*a,T=s*a,E=this.world.width/R,x=this.world.height/T;if(E>x){let A=this.world.width*v,C=~~(o*a)*f;A<C&&(t=this.world.width*a/(o*a*f))}else{let A=this.world.height*v,C=~~(s*a)*f;A<C&&(t=this.world.height*a/(s*a*f))}}else v>m&&(t=a/m);let S=Ki(this.target,Po(t,e?e.x:this.target[1]+(this.target[3]-this.target[1])/2,e?e.y:this.target[2]+(this.target[4]-this.target[2])/2),this.zoomBuffer);return this.constrainBounds(S,{ref:!0,panPadding:100}),S}clampRegion({x:t,y:e,width:n,height:i,padding:a=0}){let o=this.width,s=this.height,u=n/o<i/s,d=t-a,p=e-a,f=n+a*2,m=i+a*2;if(u){let v=m/s*o;return{x:d-(v-f)/2,y:p,width:v,height:m}}let g=f/o*s;return{x:d,y:p-(g-m)/2,width:f,height:g}}viewerToWorld(t,e){let n=this.getScaleFactor();return this._viewerToWorld.x=this.target[1]+t/n,this._viewerToWorld.y=this.target[2]+e/n,this._viewerToWorld}worldToViewer(t,e,n,i){let a=Nt.singleBox(n,i,t,e);return ci(a,Ai(Xi(this.getScaleFactor()),je(-this.target[1],-this.target[2]))),{x:a[1],y:a[2],width:a[3]-a[1],height:a[4]-a[2],strand:a}}setScale(t,e){ci(this.target,Po(t,e?e.x:this.target[1]+(this.target[3]-this.target[1])/2,e?e.y:this.target[2]+(this.target[4]-this.target[2])/2)),this.pendingUpdate=!0}syncTo(t){let e=this.target;return this.target=t.target,this.pendingUpdate=!0,()=>{this.target=e}}stop(){return typeof this.stopId<"u"&&(window.cancelAnimationFrame(this.stopId),this.stopId=void 0),()=>{this.render(performance.now())}}reset(){this.renderer.reset()}selectZone(t){this.world.selectZone(t),this.pendingUpdate=!0}deselectZone(){this.world.deselectZone(),this.pendingUpdate=!0}hook(t,e){let n=this.hooks[t].length;if(n!==0)for(let i=0;i<n;i++)this.hooks[t][i](e)}registerHook(t,e){return this.hooks[t].push(e),()=>{this.hooks[t]=this.hooks[t].filter(n=>n!==e)}}updateNextFrame(){this.pendingUpdate=!0}},Uy=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,Vy={},Ej=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"],RI=class extends So{constructor(){super(),O(this,"id"),O(this,"type","spacial-content"),O(this,"isShape",!0),O(this,"points"),O(this,"hoverEvents",!1),O(this,"activeEvents",!1),O(this,"display",{x:0,y:0,scale:1,width:-1,height:-1,points:gt(5)}),O(this,"boundingBox",null),O(this,"_parsed",{border:{id:null,match:[]},outline:{id:null,match:[]}}),O(this,"hovering"),O(this,"pressing"),O(this,"props",{}),O(this,"shape",{type:"none"}),O(this,"addHover",()=>{this.hovering=!0,this.__revision++}),O(this,"removeHover",()=>{this.hovering=!1,this.pressing=!1,this.__revision++}),O(this,"addPress",()=>{this.pressing=!0,this.__revision++}),O(this,"removePress",()=>{this.pressing=!1,this.__revision++}),this.id=Wy(12),this.points=gt(5),this.shape={type:"none"}}updateBoundingBox(){if(this.shape.type==="none")return;let t=this.shape.points;if(this.shape.points.length>2){let e=Math.min(...t.map(o=>o[0])),n=Math.min(...t.map(o=>o[1])),i=Math.max(0,...t.map(o=>o[0])),a=Math.max(0,...t.map(o=>o[1]));this.boundingBox={x:e,y:n,width:i-e,height:a-n};return}this.boundingBox=null}intersects(t){if(!t||this.shape.type==="none")return!1;let[e,n]=t,i=this.shape.points,a=this.boundingBox;if(a||(this.updateBoundingBox(),a=this.boundingBox),!a||e<a.x||e>a.x+a.width||n<a.y||n>a.height+a.y)return!1;let o=!1;for(let s=0,u=i.length-1;s<i.length;u=s++)i[s][1]>n!=i[u][1]>n&&e<(i[u][0]-i[s][0])*(n-i[s][1])/(i[u][1]-i[s][1])+i[s][0]&&(o=!o);return o}getAllPointsAt(t,e){return t[3]-t[1]===1&&t[4]-t[2]===1?this.intersects([t[1],t[2]])?[[this,this.points,e]]:[]:[[this,this.points,e]]}applyProps(t={}){let e=!1;if(t.points)if(this.shape.type!=="polygon"||this.shape.points.length!==t.points.length)this.shape={type:"polygon",points:t.points,open:t.open},this.updateBoundingBox();else{let n=!1,i=t.points.length;for(let a=0;a<i;a++)if(t.points[a][0]!==this.shape.points[a][0]||t.points[a][1]!==this.shape.points[a][1]){n=!0;break}n&&(this.shape={type:"polygon",points:t.points,open:t.open},this.updateBoundingBox())}if(t.interactive!==this.props.interactive&&(e=!0,this.props.interactive=t.interactive),(t.open||t.open===!1)&&(e=!0,this.shape.open=t.open),t.style){let n=t.border||t.style.border;if(n!==this._parsed.border.id)if(!n)this._parsed.border.id=null,this._parsed.border.match=[];else{let i=Vy[n]||Uy.exec(n)||Uy.exec(n);i&&(this._parsed.border.id=n,this._parsed.border.match=Vy[n]=i)}if(this._parsed.border.id&&(t.style.borderWidth=this._parsed.border.match[1],t.style.borderStyle="solid",t.style.borderColor=this._parsed.border.match[4]),t.style.outline!==this._parsed.outline.id)if(!t.style.outline)this._parsed.outline.id=null,this._parsed.outline.match=[];else{let i=Vy[t.style.outline]||Uy.exec(t.style.outline)||Uy.exec(t.style.outline);i&&(this._parsed.outline.id=t.style.outline,this._parsed.outline.match=Vy[t.style.outline]=i)}this._parsed.outline.id&&(t.style.outlineWidth=this._parsed.outline.match[1],t.style.outlineStyle="solid",t.style.outlineColor=this._parsed.outline.match[4]),this.props.style=t.style,t.backgroundColor&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.backgroundColor,e=!0),t.style.background&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.style.background,e=!0);for(let i of Ej)if(this.props.style[i]!==t.style[i]){e=!0;break}t.style[":hover"]!==this.props.hoverStyles&&(this.props.hoverStyles=t.style[":hover"],this.hoverEvents||(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),e=!0),t.style[":active"]!==this.props.pressStyles&&(this.props.pressStyles=t.style[":active"],this.activeEvents||(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0)}t.href!==this.props.href&&(this.props.href=t.href,e=!0),t.hrefTarget!==this.props.hrefTarget&&(this.props.hrefTarget=t.hrefTarget,e=!0),t.title!==this.props.title&&(this.props.title=t.title,e=!0),t.className!==this.props.className&&(this.props.className=t.className,t.className&&!this.hoverEvents&&(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),t.className&&!this.activeEvents&&(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0),t.relativeSize!==this.props.relativeSize&&(this.props.relativeSize=t.relativeSize,e=!0),t.relativeStyle!==this.props.relativeStyle&&(this.props.relativeStyle=t.relativeStyle,e=!0),t.html!==this.props.html&&(this.props.html=t.html,e=!0),t.target&&(t.target.width!==this.display.width||t.target.height!==this.display.height||t.target.x!==this.points[1]||t.target.y!==this.points[2])&&(e=!0,this.points=Nt.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.points=Nt.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.width=t.target.width,this.display.height=t.target.height),e&&this.__revision++}},uh=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Rj=typeof AbortController=="function",Xy=Rj?AbortController:class{constructor(){this.signal=new AI}abort(t=new Error("This operation was aborted")){this.signal.reason=this.signal.reason||t,this.signal.aborted=!0,this.signal.dispatchEvent({type:"abort",target:this.signal})}},Aj=typeof AbortSignal=="function",Tj=typeof Xy.AbortSignal=="function",AI=Aj?AbortSignal:Tj?Xy.AbortController:class{constructor(){this.reason=void 0,this.aborted=!1,this._listeners=[]}dispatchEvent(t){t.type==="abort"&&(this.aborted=!0,this.onabort(t),this._listeners.forEach(e=>e(t),this))}onabort(){}addEventListener(t,e){t==="abort"&&this._listeners.push(e)}removeEventListener(t,e){t==="abort"&&(this._listeners=this._listeners.filter(n=>n!==e))}},vR=new Set,lR=(t,e)=>{let n=`LRU_CACHE_OPTION_${t}`;ev(n)&&SR(n,`${t} option`,`options.${e}`,nv)},sR=(t,e)=>{let n=`LRU_CACHE_METHOD_${t}`;if(ev(n)){let{prototype:i}=nv,{get:a}=Object.getOwnPropertyDescriptor(i,t);SR(n,`${t} method`,`cache.${e}()`,a)}},Cj=(t,e)=>{let n=`LRU_CACHE_PROPERTY_${t}`;if(ev(n)){let{prototype:i}=nv,{get:a}=Object.getOwnPropertyDescriptor(i,t);SR(n,`${t} property`,`cache.${e}`,a)}},TI=(...t)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(...t):console.error(...t)},ev=t=>!vR.has(t),SR=(t,e,n,i)=>{vR.add(t);let a=`The ${e} is deprecated. Please use ${n} instead.`;TI(a,"DeprecationWarning",t,i)},ml=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),CI=t=>ml(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Gy:null:null,Gy=class extends Array{constructor(t){super(t),this.fill(0)}},wj=class{constructor(t){if(t===0)return[];let e=CI(t);this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},nv=class dR{constructor(e={}){let{max:n=0,ttl:i,ttlResolution:a=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:u,allowStale:d,dispose:p,disposeAfter:f,noDisposeOnSet:m,noUpdateTTL:g,maxSize:v=0,maxEntrySize:S=0,sizeCalculation:R,fetchMethod:T,fetchContext:E,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:A,allowStaleOnFetchRejection:C,allowStaleOnFetchAbort:M,ignoreFetchAbort:I}=e,{length:z,maxAge:D,stale:k}=e instanceof dR?{}:e;if(n!==0&&!ml(n))throw new TypeError("max option must be a nonnegative integer");let B=n?CI(n):Array;if(!B)throw new Error("invalid max value: "+n);if(this.max=n,this.maxSize=v,this.maxEntrySize=S||this.maxSize,this.sizeCalculation=R||z,this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(this.fetchMethod=T||null,this.fetchMethod&&typeof this.fetchMethod!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.fetchContext=E,!this.fetchMethod&&E!==void 0)throw new TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=new Array(n).fill(null),this.valList=new Array(n).fill(null),this.next=new B(n),this.prev=new B(n),this.head=0,this.tail=0,this.free=new wj(n),this.initialFill=1,this.size=0,typeof p=="function"&&(this.dispose=p),typeof f=="function"?(this.disposeAfter=f,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!m,this.noUpdateTTL=!!g,this.noDeleteOnFetchRejection=!!x,this.allowStaleOnFetchRejection=!!C,this.allowStaleOnFetchAbort=!!M,this.ignoreFetchAbort=!!I,this.maxEntrySize!==0){if(this.maxSize!==0&&!ml(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");if(!ml(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!d||!!k,this.noDeleteOnStaleGet=!!A,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!u,this.ttlResolution=ml(a)||a===0?a:1,this.ttlAutopurge=!!o,this.ttl=i||D||0,this.ttl){if(!ml(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}if(this.max===0&&this.ttl===0&&this.maxSize===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.max&&!this.maxSize){let Q="LRU_CACHE_UNBOUNDED";ev(Q)&&(vR.add(Q),TI("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Q,dR))}k&&lR("stale","allowStale"),D&&lR("maxAge","ttl"),z&&lR("length","sizeCalculation")}getRemainingTTL(e){return this.has(e,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new Gy(this.max),this.starts=new Gy(this.max),this.setItemTTL=(i,a,o=uh.now())=>{if(this.starts[i]=a!==0?o:0,this.ttls[i]=a,a!==0&&this.ttlAutopurge){let s=setTimeout(()=>{this.isStale(i)&&this.delete(this.keyList[i])},a+1);s.unref&&s.unref()}},this.updateItemAge=i=>{this.starts[i]=this.ttls[i]!==0?uh.now():0},this.statusTTL=(i,a)=>{i&&(i.ttl=this.ttls[a],i.start=this.starts[a],i.now=e||n(),i.remainingTTL=i.now+i.ttl-i.start)};let e=0,n=()=>{let i=uh.now();if(this.ttlResolution>0){e=i;let a=setTimeout(()=>e=0,this.ttlResolution);a.unref&&a.unref()}return i};this.getRemainingTTL=i=>{let a=this.keyMap.get(i);return a===void 0?0:this.ttls[a]===0||this.starts[a]===0?1/0:this.starts[a]+this.ttls[a]-(e||n())},this.isStale=i=>this.ttls[i]!==0&&this.starts[i]!==0&&(e||n())-this.starts[i]>this.ttls[i]}updateItemAge(e){}statusTTL(e,n){}setItemTTL(e,n,i){}isStale(e){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new Gy(this.max),this.removeItemSize=e=>{this.calculatedSize-=this.sizes[e],this.sizes[e]=0},this.requireSize=(e,n,i,a)=>{if(this.isBackgroundFetch(n))return 0;if(!ml(i))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(i=a(n,e),!ml(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.addItemSize=(e,n,i)=>{if(this.sizes[e]=n,this.maxSize){let a=this.maxSize-this.sizes[e];for(;this.calculatedSize>a;)this.evict(!0)}this.calculatedSize+=this.sizes[e],i&&(i.entrySize=n,i.totalCalculatedSize=this.calculatedSize)}}removeItemSize(e){}addItemSize(e,n){}requireSize(e,n,i,a){if(i||a)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}*indexes({allowStale:e=this.allowStale}={}){if(this.size)for(let n=this.tail;!(!this.isValidIndex(n)||((e||!this.isStale(n))&&(yield n),n===this.head));)n=this.prev[n]}*rindexes({allowStale:e=this.allowStale}={}){if(this.size)for(let n=this.head;!(!this.isValidIndex(n)||((e||!this.isStale(n))&&(yield n),n===this.tail));)n=this.next[n]}isValidIndex(e){return e!==void 0&&this.keyMap.get(this.keyList[e])===e}*entries(){for(let e of this.indexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*rentries(){for(let e of this.rindexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*keys(){for(let e of this.indexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*rkeys(){for(let e of this.rindexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*values(){for(let e of this.indexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}*rvalues(){for(let e of this.rindexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}[Symbol.iterator](){return this.entries()}find(e,n){for(let i of this.indexes()){let a=this.valList[i],o=this.isBackgroundFetch(a)?a.__staleWhileFetching:a;if(o!==void 0&&e(o,this.keyList[i],this))return this.get(this.keyList[i],n)}}forEach(e,n=this){for(let i of this.indexes()){let a=this.valList[i],o=this.isBackgroundFetch(a)?a.__staleWhileFetching:a;o!==void 0&&e.call(n,o,this.keyList[i],this)}}rforEach(e,n=this){for(let i of this.rindexes()){let a=this.valList[i],o=this.isBackgroundFetch(a)?a.__staleWhileFetching:a;o!==void 0&&e.call(n,o,this.keyList[i],this)}}get prune(){return sR("prune","purgeStale"),this.purgeStale}purgeStale(){let e=!1;for(let n of this.rindexes({allowStale:!0}))this.isStale(n)&&(this.delete(this.keyList[n]),e=!0);return e}dump(){let e=[];for(let n of this.indexes({allowStale:!0})){let i=this.keyList[n],a=this.valList[n],o=this.isBackgroundFetch(a)?a.__staleWhileFetching:a;if(o===void 0)continue;let s={value:o};if(this.ttls){s.ttl=this.ttls[n];let u=uh.now()-this.starts[n];s.start=Math.floor(Date.now()-u)}this.sizes&&(s.size=this.sizes[n]),e.unshift([i,s])}return e}load(e){this.clear();for(let[n,i]of e){if(i.start){let a=Date.now()-i.start;i.start=uh.now()-a}this.set(n,i.value,i)}}dispose(e,n,i){}set(e,n,{ttl:i=this.ttl,start:a,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,status:p}={}){if(s=this.requireSize(e,n,s,u),this.maxEntrySize&&s>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=!0),this.delete(e),this;let f=this.size===0?void 0:this.keyMap.get(e);if(f===void 0)f=this.newIndex(),this.keyList[f]=e,this.valList[f]=n,this.keyMap.set(e,f),this.next[this.tail]=f,this.prev[f]=this.tail,this.tail=f,this.size++,this.addItemSize(f,s,p),p&&(p.set="add"),d=!1;else{this.moveToTail(f);let m=this.valList[f];if(n!==m){if(this.isBackgroundFetch(m)?m.__abortController.abort(new Error("replaced")):o||(this.dispose(m,e,"set"),this.disposeAfter&&this.disposed.push([m,e,"set"])),this.removeItemSize(f),this.valList[f]=n,this.addItemSize(f,s,p),p){p.set="replace";let g=m&&this.isBackgroundFetch(m)?m.__staleWhileFetching:m;g!==void 0&&(p.oldValue=g)}}else p&&(p.set="update")}if(i!==0&&this.ttl===0&&!this.ttls&&this.initializeTTLTracking(),d||this.setItemTTL(f,i,a),this.statusTTL(p,f),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return this.size===0?this.tail:this.size===this.max&&this.max!==0?this.evict(!1):this.free.length!==0?this.free.pop():this.initialFill++}pop(){if(this.size){let e=this.valList[this.head];return this.evict(!0),e}}evict(e){let n=this.head,i=this.keyList[n],a=this.valList[n];return this.isBackgroundFetch(a)?a.__abortController.abort(new Error("evicted")):(this.dispose(a,i,"evict"),this.disposeAfter&&this.disposed.push([a,i,"evict"])),this.removeItemSize(n),e&&(this.keyList[n]=null,this.valList[n]=null,this.free.push(n)),this.head=this.next[n],this.keyMap.delete(i),this.size--,n}has(e,{updateAgeOnHas:n=this.updateAgeOnHas,status:i}={}){let a=this.keyMap.get(e);if(a!==void 0)if(this.isStale(a))i&&(i.has="stale",this.statusTTL(i,a));else return n&&this.updateItemAge(a),i&&(i.has="hit"),this.statusTTL(i,a),!0;else i&&(i.has="miss");return!1}peek(e,{allowStale:n=this.allowStale}={}){let i=this.keyMap.get(e);if(i!==void 0&&(n||!this.isStale(i))){let a=this.valList[i];return this.isBackgroundFetch(a)?a.__staleWhileFetching:a}}backgroundFetch(e,n,i,a){let o=n===void 0?void 0:this.valList[n];if(this.isBackgroundFetch(o))return o;let s=new Xy;i.signal&&i.signal.addEventListener("abort",()=>s.abort(i.signal.reason));let u={signal:s.signal,options:i,context:a},d=(v,S=!1)=>{let{aborted:R}=s.signal,T=i.ignoreFetchAbort&&v!==void 0;return i.status&&(R&&!S?(i.status.fetchAborted=!0,i.status.fetchError=s.signal.reason,T&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),R&&!T&&!S?f(s.signal.reason):(this.valList[n]===g&&(v===void 0?g.__staleWhileFetching?this.valList[n]=g.__staleWhileFetching:this.delete(e):(i.status&&(i.status.fetchUpdated=!0),this.set(e,v,u.options))),v)},p=v=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=v),f(v)),f=v=>{let{aborted:S}=s.signal,R=S&&i.allowStaleOnFetchAbort,T=R||i.allowStaleOnFetchRejection,E=T||i.noDeleteOnFetchRejection;if(this.valList[n]===g&&(!E||g.__staleWhileFetching===void 0?this.delete(e):R||(this.valList[n]=g.__staleWhileFetching)),T)return i.status&&g.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),g.__staleWhileFetching;if(g.__returned===g)throw v},m=(v,S)=>{this.fetchMethod(e,o,u).then(R=>v(R),S),s.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(v(),i.allowStaleOnFetchAbort&&(v=R=>d(R,!0)))})};i.status&&(i.status.fetchDispatched=!0);let g=new Promise(m).then(d,p);return g.__abortController=s,g.__staleWhileFetching=o,g.__returned=null,n===void 0?(this.set(e,g,{...u.options,status:void 0}),n=this.keyMap.get(e)):this.valList[n]=g,g}isBackgroundFetch(e){return e&&typeof e=="object"&&typeof e.then=="function"&&Object.prototype.hasOwnProperty.call(e,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call(e,"__returned")&&(e.__returned===e||e.__returned===null)}async fetch(e,{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:u=0,sizeCalculation:d=this.sizeCalculation,noUpdateTTL:p=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:g=this.ignoreFetchAbort,allowStaleOnFetchAbort:v=this.allowStaleOnFetchAbort,fetchContext:S=this.fetchContext,forceRefresh:R=!1,status:T,signal:E}={}){if(!this.fetchMethod)return T&&(T.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:T});let x={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,ttl:o,noDisposeOnSet:s,size:u,sizeCalculation:d,noUpdateTTL:p,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:v,ignoreFetchAbort:g,status:T,signal:E},A=this.keyMap.get(e);if(A===void 0){T&&(T.fetch="miss");let C=this.backgroundFetch(e,A,x,S);return C.__returned=C}else{let C=this.valList[A];if(this.isBackgroundFetch(C)){let k=n&&C.__staleWhileFetching!==void 0;return T&&(T.fetch="inflight",k&&(T.returnedStale=!0)),k?C.__staleWhileFetching:C.__returned=C}let M=this.isStale(A);if(!R&&!M)return T&&(T.fetch="hit"),this.moveToTail(A),i&&this.updateItemAge(A),this.statusTTL(T,A),C;let I=this.backgroundFetch(e,A,x,S),z=I.__staleWhileFetching!==void 0,D=z&&n;return T&&(T.fetch=z&&M?"stale":"refresh",D&&M&&(T.returnedStale=!0)),D?I.__staleWhileFetching:I.__returned=I}}get(e,{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:o}={}){let s=this.keyMap.get(e);if(s!==void 0){let u=this.valList[s],d=this.isBackgroundFetch(u);return this.statusTTL(o,s),this.isStale(s)?(o&&(o.get="stale"),d?(o&&(o.returnedStale=n&&u.__staleWhileFetching!==void 0),n?u.__staleWhileFetching:void 0):(a||this.delete(e),o&&(o.returnedStale=n),n?u:void 0)):(o&&(o.get="hit"),d?u.__staleWhileFetching:(this.moveToTail(s),i&&this.updateItemAge(s),u))}else o&&(o.get="miss")}connect(e,n){this.prev[n]=e,this.next[e]=n}moveToTail(e){e!==this.tail&&(e===this.head?this.head=this.next[e]:this.connect(this.prev[e],this.next[e]),this.connect(this.tail,e),this.tail=e)}get del(){return sR("del","delete"),this.delete}delete(e){let n=!1;if(this.size!==0){let i=this.keyMap.get(e);if(i!==void 0)if(n=!0,this.size===1)this.clear();else{this.removeItemSize(i);let a=this.valList[i];this.isBackgroundFetch(a)?a.__abortController.abort(new Error("deleted")):(this.dispose(a,e,"delete"),this.disposeAfter&&this.disposed.push([a,e,"delete"])),this.keyMap.delete(e),this.keyList[i]=null,this.valList[i]=null,i===this.tail?this.tail=this.prev[i]:i===this.head?this.head=this.next[i]:(this.next[this.prev[i]]=this.next[i],this.prev[this.next[i]]=this.prev[i]),this.size--,this.free.push(i)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return n}clear(){for(let e of this.rindexes({allowStale:!0})){let n=this.valList[e];if(this.isBackgroundFetch(n))n.__abortController.abort(new Error("deleted"));else{let i=this.keyList[e];this.dispose(n,i,"delete"),this.disposeAfter&&this.disposed.push([n,i,"delete"])}}if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return sR("reset","clear"),this.clear}get length(){return Cj("length","size"),this.size}static get AbortController(){return Xy}static get AbortSignal(){return AI}},Mj=nv,uI=/(-?[0-9]+(px|em)\s+|0\s+)(-?[0-9]+(px|em)\s+|0\s+)(-?[0-9]+(px|em)\s+|0\s+)?(-?[0-9]+(px|em)\s+|0\s+)?(.*)/g,cI={},Oj=typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes("firefox"),jy={},_j=class{constructor(t,e){O(this,"canvas"),O(this,"ctx"),O(this,"options"),O(this,"imagesPending",0),O(this,"imagesLoaded",0),O(this,"imageIdsLoaded",[]),O(this,"frameIsRendering",!1),O(this,"pendingDrawCall",!1),O(this,"firstMeaningfulPaint",!1),O(this,"parallelTasks",8),O(this,"frameTasks",0),O(this,"loadingQueueOrdered",!0),O(this,"loadingQueue",[]),O(this,"currentTask",Promise.resolve()),O(this,"tasksRunning",0),O(this,"stats"),O(this,"averageJobTime",64),O(this,"lastKnownScale",1),O(this,"visible",[]),O(this,"previousVisible",[]),O(this,"rendererPosition"),O(this,"dpi"),O(this,"drawCalls",[]),O(this,"lastPaintedObject"),O(this,"hostCache"),O(this,"invalidated",[]),O(this,"_worker",()=>{if(this.loadingQueue.length){let n=this.loadingQueue.pop();n&&(this.tasksRunning++,this.frameTasks++,this.currentTask=n.task().then(()=>{this.tasksRunning--}).catch(()=>{this.tasksRunning--}))}}),O(this,"_scheduled",0),O(this,"_doWork",()=>{this.loadingQueue.length===0&&this.tasksRunning===0&&this._scheduled&&(clearInterval(this._scheduled),this._scheduled=0);let n=this.parallelTasks||1;!this.firstMeaningfulPaint&&this.loadingQueue.length&&(n=this.loadingQueue.length);for(let i=0;i<=n;i++)this._worker()}),this.canvas=t,this.rendererPosition=t.getBoundingClientRect(),this.ctx=t.getContext("2d",{alpha:!0}),this.ctx.imageSmoothingEnabled=!0,this.options=e||{},this.canvas.style.transition="opacity .3s",this.dpi=e?.dpi||1,this.hostCache=e?.lruCache?new Mj({maxSize:1024*512*512,dispose:(n,i,a)=>{this.invalidated.push(i),n.width=0,n.height=0},sizeCalculation:(n,i)=>n.width*n.height}):{store:{},get(n){return this.store[n]},set(n,i){this.store[n]=i}}}getCanvasDims(){return{width:this.canvas.width/this.dpi,height:this.canvas.height/this.dpi}}resize(){this.rendererPosition=this.canvas.getBoundingClientRect()}isReady(){return this.firstMeaningfulPaint}afterFrame(t){if(this.clearTransform(),this.lastPaintedObject=void 0,this.frameIsRendering=!1,this.imagesPending=Math.max(0,this.imagesPending-this.imagesLoaded),this.imagesLoaded=0,this.loadingQueueOrdered||(this.loadingQueue=this.loadingQueue.sort((e,n)=>e.network&&e.scale===n.scale?n.distance-e.distance:e.scale<n.scale?-1:1),this.loadingQueueOrdered=!0),this.previousVisible=this.visible,this.pendingDrawCall=!!this.drawCalls.length,this.pendingDrawCall)for(let e=0;e<this.drawCalls.length;e++){let n=this.drawCalls.shift();n&&n()}this.doOffscreenWork(),this.options.debug&&this.stats&&this.stats.end()}doOffscreenWork(){this.frameTasks=0,this.loadingQueue.length&&(this._worker(),this.loadingQueue.length&&(this._scheduled||(this._scheduled=setInterval(this._doWork,0))))}getScale(t,e,n){if(Number.isNaN(t)||Number.isNaN(e))return this.lastKnownScale;let i=this.getCanvasDims(),a=i.width/t,o=i.height/e,s=(a<o?o:a)*(n&&this.dpi||1);return Number.isNaN(s)||(this.lastKnownScale=s),this.lastKnownScale}beforeFrame(t,e,n,i){this.options.debug&&this.stats&&this.stats.begin(),this.frameIsRendering=!0,this.visible=[],this.options.beforeFrame&&this.options.beforeFrame(e);let a=this.getCanvasDims();if(this.ctx.globalAlpha=1,this.ctx.fillStyle=this.canvas.dataset.background??"rgb(0, 0, 0)",this.ctx.fillRect(0,0,a.width,a.height),i.enableFilters&&(i.filters.brightness||i.filters.contrast||i.filters.grayscale||i.filters.invert||i.filters.sepia||i.filters.saturate||i.filters.hueRotate||i.filters.blur)){let o="";i.filters.brightness&&(o+=`brightness(${~~(100+i.filters.brightness*100)}%) `),i.filters.contrast&&(o+=`contrast(${~~(100+i.filters.contrast*100)}%) `),i.filters.grayscale&&(o+=`grayscale(${~~(i.filters.grayscale*100)}%) `),i.filters.invert&&(o+=`invert(${~~(i.filters.invert*100)}%) `),i.filters.sepia&&(o+=`sepia(${~~(i.filters.sepia*100)}%) `),i.filters.saturate&&(o+=`saturate(${~~(100+i.filters.saturate*100)}%) `),i.filters.hueRotate&&(o+=`hue-rotate(${i.filters.hueRotate}deg) `),i.filters.blur&&(o+=`blur(${i.filters.blur}px) `),this.ctx.filter!==o&&(this.ctx.filter=o)}else this.ctx.filter="none"}applyTransform(t,e,n,i,a){let o=t.__owner.value;if(o&&o.rotation){this.ctx.save();let s=e+i/2,u=n+a/2;this.ctx.translate(s,u),this.ctx.rotate(o.rotation*Math.PI/180),this.ctx.translate(-s,-u),this.lastPaintedObject=o}}clearTransform(){this.lastPaintedObject&&(this.lastPaintedObject.rotation&&this.ctx.restore(),this.lastPaintedObject=void 0)}paint(t,e,n,i,a,o){let s=this.ctx.globalAlpha;if(t instanceof yl||t instanceof mh){if(t.display.rotation){this.ctx.save();let p=n+a/2,f=i+o/2;t.crop&&(p-=t.crop[e*5+1],f-=t.crop[e*5+2]),this.ctx.translate(p,f),this.ctx.rotate(t.display.rotation*Math.PI/180),this.ctx.translate(-p,-f)}if(this.visible.push(t),typeof t.style&&t.style.opacity!=="undefined"){if(!t.style.opacity)return;this.ctx.globalAlpha=t.style.opacity}try{let p=t.__host.canvas,f=this.getCanvasDims();if((p.indices.indexOf(e)===-1||this.invalidated.indexOf(p.canvases[e])!==-1)&&this.schedulePaintToCanvas(p,t,e,Yy({x:n+a/2,y:i+a/2},{x:f.width/2,y:f.height/2})),!this.firstMeaningfulPaint)return;let m=this.hostCache.get(p.canvases[e]);if(m)if(t.crop&&t.cropData){if(t.crop[e*5]){let g=[t.crop[e*5+1]/t.display.scale-t.display.points[e*5+1],t.crop[e*5+2]/t.display.scale-t.display.points[e*5+2],1+(t.crop[e*5+3]-t.crop[e*5+1])/t.display.scale,1+(t.crop[e*5+4]-t.crop[e*5+2])/t.display.scale];g[0]+=t.cropData.x/t.display.scale,g[1]+=t.cropData.y/t.display.scale;let v=t.x*this.lastKnownScale,S=t.y*this.lastKnownScale,R=[n+v,i+S,a,o];R[0]+=v,R[1]+=S,this.ctx.drawImage(m,g[0],g[1],g[2],g[3],R[0],R[1],R[2]+1,R[3]+1)}}else Oj?this.ctx.drawImage(m,0,0,t.display.points[e*5+3]-t.display.points[e*5+1],t.display.points[e*5+4]-t.display.points[e*5+2],n,i,a+1,o+1):this.ctx.drawImage(m,0,0,t.display.points[e*5+3]-t.display.points[e*5+1],t.display.points[e*5+4]-t.display.points[e*5+2],n,i,a+Number.MIN_VALUE+.5,o+Number.MIN_VALUE+.5)}catch{}t.display.rotation&&this.ctx.restore()}let u=t instanceof fh&&this.options.box,d=t instanceof RI&&this.options.polygon;if((u||d)&&!t.props.className&&!t.props.html&&!t.props.href){if(this.visible.push(t),t.props.style){let p=Object.assign({},t.props.style||{},t.hovering?t.props.hoverStyles:{},t.pressing?t.props.pressStyles:{}),f=t.props.relativeStyle?1:a/t.width;typeof p.opacity<"u"&&(this.ctx.globalAlpha=p.opacity);let m=0;typeof p.borderWidth<"u"&&(m=parseInt(p.borderWidth,10)*f);let g=0;typeof p.outlineWidth<"u"&&(g=parseInt(p.outlineWidth,10)*f);let v=0;if(typeof p.outlineOffset<"u"&&(v=parseInt(p.outlineOffset,10)*f),p.borderColor&&(this.ctx.strokeStyle=p.borderColor),p.boxShadow){let S=p.boxShadow.split(/,(?![^(]*\))/);for(let R of S){let T=cI[R]||uI.exec(R)||uI.exec(R);cI[R]=T,T&&(this.ctx.save(),this.ctx.shadowOffsetX=parseInt(T[1])*this.dpi*f,this.ctx.shadowOffsetY=parseInt(T[3])*this.dpi*f,this.ctx.shadowBlur=parseInt(T[5])*this.dpi*f,this.ctx.shadowColor=T[9],this.ctx.fillStyle="rgba(0,0,0,1)",this.ctx.fillRect(n+m,i+m,a,o),this.ctx.restore())}}if(this.ctx.fillStyle=p.backgroundColor||"transparent",this.ctx.lineWidth=m,d){let S=t.shape,R=S.points||[],T=R.length;this.ctx.beginPath();for(let E=0;E<T;E++)this.ctx.lineTo(n+R[E][0]*this.lastKnownScale,i+R[E][1]*this.lastKnownScale);S.open||this.ctx.closePath(),m&&this.ctx.stroke(),S.open||this.ctx.fill()}else m&&this.ctx.strokeRect(n+m/2,i+m/2,a+m,o+m),this.ctx.fillRect(n+m,i+m,a,o);g&&(p.outlineColor&&(this.ctx.strokeStyle=p.outlineColor),this.ctx.lineWidth=g,this.ctx.strokeRect(n-g/2-v,i-g/2-v,a+m*2+g+v*2,o+m*2+g+v*2))}this.ctx.globalAlpha=s}}loadImage(t,e,n,i=!1){if(jy[t]&&jy[t].naturalWidth>0){e(jy[t]);return}try{let a=!1;i||setTimeout(()=>{a||this.loadImage(t,e,n,!0)},3e3);let o=document.createElement("img");o.decoding="auto",o.onload=function(){a=!0,e(o),jy[t]=o,o.onload=null},this.options.crossOrigin&&(o.crossOrigin="anonymous"),o.src=t,o.complete&&o.onload({}),o.width}catch(a){console.log("image error",a),n(a)}}schedulePaintToCanvas(t,e,n,i){this.imagesPending++,t.indices.push(n);let a=`${e.id}--${e.display.scale}-${n}`,o=this.invalidated.indexOf(a);o!==-1&&this.invalidated.splice(o,1),t.canvases[n]=a,e.__host.canvas.loading=!0,this.loadingQueueOrdered=!1,this.loadingQueue.push({id:a,scale:e.display.scale,network:!0,distance:i,task:()=>new Promise(s=>{if(this.visible.indexOf(e)===-1){this.imagesPending--,t.indices.splice(t.indices.indexOf(n),1),s();return}let u=e.getImageUrl(n);this.loadImage(u,d=>{this.loadingQueue.push({id:a,scale:e.display.scale,distance:i,task:()=>new Promise(p=>{this.imageIdsLoaded.includes(a)||(this.imagesLoaded++,this.imageIdsLoaded.push(a)),t.loaded.push(n),t.loaded.length===t.indices.length&&(t.loading=!1);let f=e.display.points.slice(n*5,n*5+5),m=document.createElement("canvas"),g=m.getContext("2d");m.width=f[3]-f[1],m.height=f[4]-f[2],this.hostCache.set(t.canvases[n],m),this.drawCalls.push(()=>{g.drawImage(d,0,0,f[3]-f[1],f[4]-f[2]),p()})})}),s()},d=>{this.imagesPending--,t.indices.splice(t.indices.indexOf(n),1),s()})})})}afterPaintLayer(t,e){}prepareLayer(t,e){if(t.__owner.value)if(t.cropData){let n=this.lastKnownScale*(1/t.display.scale);this.applyTransform(t,e[1],e[2],e[3]-e[1],e[4]-e[2])}else this.applyTransform(t,e[1],e[2],e[3]-e[1],e[4]-e[2]);(!t.__host||!t.__host.canvas)&&(t instanceof yl||t instanceof mh)&&this.createImageHost(t)}finishLayer(){this.lastPaintedObject&&this.clearTransform()}createImageHost(t){t.__host=t.__host?t.__host:{},t.__host.canvas={canvas:void 0,canvases:[],indices:[],loaded:[],loading:!1}}getPointsAt(t,e,n,i){return t.getPointsAt(e,n,i)}getViewportBounds(t,e,n){let i=t.getActiveZone();if(i){let a=e[3]-e[1]<i.points[3]-i.points[1],o=e[4]-e[2]<i.points[4]-i.points[2];return{x1:a?i.points[1]-n:i.points[1]+(i.points[3]-i.points[1])/2-(e[3]-e[1])/2,y1:o?i.points[2]-n:i.points[2]+(i.points[4]-i.points[2])/2-(e[4]-e[2])/2,x2:a?i.points[3]+n:i.points[1]+(i.points[3]-i.points[1])/2-(e[3]-e[1])/2,y2:o?i.points[4]+n:i.points[2]+(i.points[4]-i.points[2])/2-(e[4]-e[2])/2}}return null}pendingUpdate(){let t=!this.pendingDrawCall&&this.drawCalls.length===0&&this.imagesPending===0&&this.loadingQueue.length===0&&this.tasksRunning===0;return!t&&this.visible.length===0&&setTimeout(()=>{this.canvas.style.opacity="1",this.firstMeaningfulPaint=!0},500),!this.firstMeaningfulPaint&&t&&this.visible.length?(this.canvas.style.opacity="1",this.firstMeaningfulPaint=t,!0):this.options.debug?!0:!t}getRendererScreenPosition(){return this.rendererPosition}reset(){this.loadingQueue=[],this.drawCalls=[]}},wI=class{constructor(t){O(this,"renderers",[]),O(this,"length");for(let e of t)e&&this.renderers.push(e);this.length=this.renderers.length}afterFrame(t,e,n,i){for(let a=0;a<this.length;a++)this.renderers[a].afterFrame(t,e,n,i)}afterPaintLayer(t,e){for(let n=0;n<this.length;n++)this.renderers[n].afterPaintLayer(t,e)}beforeFrame(t,e,n,i){for(let a=0;a<this.length;a++)this.renderers[a].beforeFrame(t,e,n,i)}triggerResize(){for(let t=0;t<this.length;t++){let e=this.renderers[t];e.triggerResize&&e.triggerResize()}}getPointsAt(t,e,n,i){return this.renderers[0].getPointsAt(t,e,n,i)}getScale(t,e){return this.renderers[0].getScale(t,e)}getViewportBounds(t,e,n){return this.renderers[0].getViewportBounds(t,e,n)}getRendererScreenPosition(){return this.renderers[0].getRendererScreenPosition()}isReady(){for(let t=0;t<this.length;t++)if(!this.renderers[t].isReady())return!1;return!0}paint(t,e,n,i,a,o){for(let s=0;s<this.length;s++)this.renderers[s].paint(t,e,n,i,a,o)}pendingUpdate(){for(let t=0;t<this.length;t++)if(this.renderers[t].pendingUpdate())return!0;return!1}prepareLayer(t,e){for(let n=0;n<this.length;n++)this.renderers[n].prepareLayer(t,e)}finishLayer(t,e){for(let n=0;n<this.length;n++)this.renderers[n].finishLayer(t,e)}resize(t,e){for(let n=0;n<this.length;n++)this.renderers[n].resize(t,e)}reset(){for(let t=0;t<this.length;t++)this.renderers[t].reset()}},zj=class{constructor(t){O(this,"canvas"),O(this,"context"),O(this,"heightRatio",1),O(this,"widthRatio",1),O(this,"target",new Float32Array(5)),O(this,"initialWidth"),O(this,"initialHeight"),O(this,"bounds"),O(this,"aggregate"),O(this,"delta",0),O(this,"renderNextFrame",!0),this.canvas=t,this.initialWidth=t.width,this.initialHeight=t.height,this.context=t.getContext("2d"),this.context.globalAlpha=.5,this.aggregate=Xi(1)}isReady(){return!0}resize(){this.initialWidth=this.canvas.width,this.initialHeight=this.canvas.height,this.renderNextFrame=!0}afterFrame(t,e,n){if(this.renderNextFrame){this.context.clearRect(0,0,this.canvas.width,this.canvas.height);let i=this.initialWidth/t.width,a=this.initialHeight/t.height,o=this.widthRatio>this.heightRatio?i:a;if(this.target=n,this.bounds){let s=t.getPointsAt(this.bounds,this.aggregate,o);for(let[u,d]of s)if(u instanceof yl&&u.__host.canvas){let p=d.length/5;for(let f=0;f<p;f++)if(u.__host.canvas.canvases[f]){let m={x1:d[f+1]*o,y1:d[f+2]*o,width:(d[f+3]-d[f+1])*o,height:(d[f+4]-d[f+2])*o}}}}t.getPoints().forEach((s,u,d)=>{if(u%5===0&&s){let p={x1:d[u+1]*o,y1:d[u+2]*o,x2:d[u+3]*o,y2:d[u+4]*o,width:(d[u+3]-d[u+1])*o,height:(d[u+4]-d[u+2])*o};this.context.strokeStyle="red",this.context.strokeRect(p.x1,p.y1,p.width,p.height)}}),n&&(this.context.strokeStyle="red",this.context.lineWidth=window.devicePixelRatio||1,this.context.strokeRect(n[1]*o,n[2]*o,(n[3]-n[1])*o,(n[4]-n[2])*o))}}getActiveZone(t){return null}getPointsAt(t,e,n,i){return t.getPointsAt(e,n,i)}getScale(t,e){return 1}beforeFrame(t,e){this.bounds=Nt.singleBox(t.width,t.height)}drawImage(){}afterPaintLayer(t,e){}paint(t,e,n,i,a,o){this.renderNextFrame=!0}prepareLayer(t){}pendingUpdate(){return!1}hasActiveZone(){return!1}getViewportBounds(t,e,n){return null}getRendererScreenPosition(){return this.canvas.getBoundingClientRect()}finishLayer(){}reset(){}};var Nj=sj(hj(),1);function Ij(t){return{x:t[1],y:t[2],width:t[3]-t[1],height:t[4]-t[2]}}var fI="pan",dI="scroll",Dj="gesture",Lj={zoomOutFactor:.8,zoomInFactor:1.25,maxZoomFactor:1,minZoomFactor:.05,zoomDuration:300,zoomWheelConstant:20,zoomClamp:.6,panBounceStiffness:120,panBounceDamping:15,panTimeConstant:240,panPower:.1,nudgeDistance:100,panPadding:0,devicePixelRatio:1,enableWheel:!0,enableClickToZoom:!0,ignoreSingleFingerTouch:!1,enablePanOnWait:!1,requireMetaKeyForWheelZoom:!1,panOnWaitDelay:40,onPanInSketchMode:()=>{},parentElement:null},MI=(t={})=>({start:function(e){let{zoomWheelConstant:n,enableWheel:i,enableClickToZoom:a,ignoreSingleFingerTouch:o,enablePanOnWait:s,panOnWaitDelay:u,parentElement:d,requireMetaKeyForWheelZoom:p}={...Lj,...t},f={pointerStart:{x:0,y:0},isPressing:!1,mousemoveBuffer:gt(5),multiTouch:{distance:0}};e.world.activatedEvents.push("onMouseUp","onMouseDown","onMouseMove","onTouchStart","onTouchEnd","onTouchMove","onContextMenu");function m(){R=0,E="",A(),A(void 0,"notice"),T=0}function g(){e.world.constraintBounds(),m()}function v(B){if(B.which>1){f.isPressing=!1;return}e.mode==="explore"&&(B.preventDefault(),f.pointerStart.x=B.atlas.x,f.pointerStart.y=B.atlas.y,e.transitionManager.stopTransition(),f.isPressing=!0)}function S(){m(),f.isPressing&&(e.mode==="explore"&&e.world.constraintBounds(),f.isPressing=!1)}let R=0,T=0,E="";function x(B){if(e.mode==="explore"){if(B.atlasTouches.length===1&&(T=performance.now(),o==!1&&B.preventDefault(),f.pointerStart.x=B.atlasTouches[0].x,f.pointerStart.y=B.atlasTouches[0].y),B.atlasTouches.length===2){E=Dj,B.preventDefault();let Q=B.atlasTouches[0].x,it=B.atlasTouches[1].x;f.pointerStart.x=(Q+it)/2;let lt=B.atlasTouches[0].y,et=B.atlasTouches[1].y;f.pointerStart.y=(lt+et)/2,R=Yy({x:B.touches[0].clientX,y:B.touches[0].clientY},{x:B.touches[1].clientX,y:B.touches[1].clientY})}e.transitionManager.stopTransition(),f.isPressing=!0}}function A(B,Q="intent"){d&&(d.dataset[Q]=B)}function C(B){let Q=null,it=null,lt=!1,et=0;if(f.isPressing&&B.touches.length===2){let $=B.touches[0].clientX,ht=B.touches[1].clientX;Q=($+ht)/2;let bt=B.touches[0].clientY,st=B.touches[1].clientY;it=(bt+st)/2,et=Yy({x:B.touches[0].clientX,y:B.touches[0].clientY},{x:B.touches[1].clientX,y:B.touches[1].clientY}),lt=!0}if(A(E),f.isPressing&&B.touches.length===1){if(s&&(performance.now()-T<u&&E==""&&(E=dI),E==""&&(E=fI)),A(E),E==""&&o==!0||E==dI){A("require-two-finger","notice");return}let $=B.touches[0];Q=$.clientX,it=$.clientY}if(Q!==null&&it!==null){let $=e.getRendererScreenPosition();if($){let{x:ht,y:bt}=e.viewerToWorld(Q-$.x,it-$.y),st=et&&R?et/R:1;e.transitionManager.customTransition(rt=>{rt.from=gt(e.target),rt.to=Ki(rt.from,Ai(je(f.pointerStart.x-ht,f.pointerStart.y-bt),Po(1/st,ht,bt)),f.mousemoveBuffer),rt.elapsed_time=0,rt.total_time=0,rt.timingFunction=gl.easeInOutExpo,rt.done=!1})}R=et}E==fI&&B.preventDefault()}function M(B){if(f.isPressing){let Q=e.getRendererScreenPosition();if(Q){let{x:it,y:lt}=e.viewerToWorld(B.clientX-Q.x,B.clientY-Q.y);e.transitionManager.customTransition(et=>{et.from=gt(e.target),et.to=Ki(et.from,je(f.pointerStart.x-it,f.pointerStart.y-lt),f.mousemoveBuffer),et.elapsed_time=0,et.total_time=0,et.timingFunction=gl.easeInOutExpo,et.done=!1})}}}function I(B){e.mode==="explore"&&e.world.zoomIn(B.atlas)}function z(B){let Q=1+(0,Nj.default)(B).spinY/n;e.world.zoomTo(Q,B.atlas,!0)}function D(B){return p&&B.metaKey==!1?(A("meta-required","notice"),B.stopPropagation(),!1):!0}e.world.addEventListener("mouseup",g),e.world.addEventListener("touchend",g),e.world.addEventListener("touchstart",x),e.world.addEventListener("mousedown",v),window.addEventListener("touchend",S),window.addEventListener("mouseup",S),window.addEventListener("mousemove",M),d&&d.addEventListener("touchmove",C),a&&(e.world.activatedEvents.push("onClick"),e.world.addEventListener("click",I)),i&&(e.world.activatedEvents.push("onWheel"),p&&d?.addEventListener("wheel",D,{passive:!0,capture:!0}),e.world.addEventListener("wheel",z));let k=e.world.addLayoutSubscriber((B,Q)=>{if(B==="zone-changed"&&e.transitionManager.constrainBounds({transition:{duration:0}}),B==="zoom-to"&&Q&&e.transitionManager.zoomTo(Q.factor,{origin:Q.point,stream:Q.stream}),B==="go-home"){let it=Q.immediate?{duration:0}:void 0;e.transitionManager.goToRegion(Ij(e.homePosition),{transition:it})}if(B==="goto-region"&&Q){let it=Q.immediate?{duration:0}:{};e.transitionManager.goToRegion(Q,{transition:it})}B==="constrain-bounds"&&e.transitionManager.constrainBounds({transition:Q?.immediate?{duration:0}:void 0})});return()=>{e.world.removeEventListener("mouseup",g),e.world.removeEventListener("touchend",g),e.world.removeEventListener("touchstart",x),e.world.removeEventListener("mousedown",v),window.removeEventListener("touchend",S),window.removeEventListener("mouseup",S),e.world.removeEventListener("mousemove",M),d&&(d.removeEventListener("touchmove",M),d.removeEventListener("wheel",D,{passive:!0,capture:!0})),a&&e.world.removeEventListener("click",I),i&&e.world.removeEventListener("wheel",z),k()}},updatePosition(){}}),jc=iv.default.createContext("explore");jc.displayName="Mode";var Pj=()=>(0,iv.useContext)(jc);var av=bR.default.createContext(null);av.displayName="Atlas";var ov=bR.default.createContext(null);ov.displayName="Bounds";var Ky,Hj=typeof performance=="object"&&typeof performance.now=="function";if(Hj){let t=performance;Ky=()=>t.now()}else{let t=Date,e=t.now();Ky=()=>t.now()-e}var Uj=8,hI=32,Vj=2,zI=0;function pI(t,e){t&&t.appendChild&&e&&t.appendChild(e)}function NI(t,e){t&&t.removeChild&&e&&t.removeChild(e)}function jj(t,e){return NI(t.world,e)}function qj(t,e,n){return II(t.world,e,n)}function II(t,e,n){t&&t instanceof tv&&(t=t.world),t&&t.insertBefore&&t.insertBefore(e,n)}function DI(t,e,n){if(n&&(t.applyProps&&t.applyProps(n),t instanceof So))for(let i of Jy){let a=i.slice(2).toLowerCase();n[i]!==e[i]&&(e[i]&&t.removeEventListener(a,e[i]),t.addEventListener(a,n[i]))}}function LI(t,e){let n=Object.keys(e),i=!1;for(let a of n)if(Jy.indexOf(a)!==-1){let o=Vc[a];if(o){if(t.activatedEvents.indexOf(o)!==-1)continue;i=!0,t.activatedEvents.push(o)}}i&&t.triggerEventActivation()}var Zy=new Map,mI={};function Fj(t,{args:e=[],...n},i,a,o){if(!(i instanceof tv)&&o){let d=p=>p.return?d(p.return):p.stateNode&&p.stateNode.containerInfo;i=d(o)}let s,u=i.world;switch(t){case"world":s=$y.withProps({width:n.width,height:n.height,viewingDirection:"left-to-right"}),s.activatedEvents=u.activatedEvents,s.eventHandlers=u.eventHandlers,s.subscriptions=u.subscriptions,s.triggerEventActivation(),u=s;break;case"box":s=new fh;break;case"shape":s=new RI;break;case"worldObject":case"world-object":s=new yR;break;case"worldImage":case"world-image":s=new yl;break;case"texture":s=new cR;break;case"compositeImage":case"composite-image":s=new Sj({id:n.id,width:n.width,height:n.height,images:[],renderOptions:n.renderOptions});break;case"tiledImage":case"tiled-image":s=mh.fromTile(n.uri,n.display,n.tile,n.scaleFactor,void 0,n.format,n.useFloorCalc,n.version3);break;case"paragraph":s=new Fy,s.text=n.children;break;default:return}return LI(u,n),DI(s,{},n),s}function Gj(t,e){if(e instanceof $y)t.world=e;else if(e instanceof yR)t.world.appendChild(e);else if(e)throw new Error("Invalid root")}var qy=zI,hh=(0,OI.default)({unstable_now:Ky,now:Ky,createInstance:Fj,removeChild:NI,appendChild:pI,appendInitialChild:pI,insertBefore:II,warnsIfNotActing:!0,supportsMutation:!0,isPrimaryRenderer:!1,scheduleTimeout:typeof setTimeout<"u"?setTimeout:void 0,cancelTimeout:typeof clearTimeout<"u"?clearTimeout:void 0,setTimeout:typeof setTimeout<"u"?setTimeout:void 0,clearTimeout:typeof clearTimeout<"u"?clearTimeout:void 0,noTimeout:-1,appendChildToContainer:Gj,removeChildFromContainer:jj,createTextInstance(){},insertInContainerBefore:qj,prepareUpdate(t,e,n,i,a){return LI(a.world,i),i},commitUpdate(t,e,n,i,a,o){let s=e,u=n;typeof u=="string"&&(s=n,u=n),t.applyProps&&u&&DI(t,i,u)},finalizeInitialChildren(t){return t?.__handlers},getChildHostContext(){return mI},getRootHostContext(){return mI},prepareForCommit(t){return t.isCommitting=!0,null},preparePortalMount(){},hideInstance(t){t&&t.points&&(t.points[0]=0)},unhideInstance(t,e){t&&t.points&&(t.points[0]=1)},getPublicInstance(t){return t},hideTextInstance(){throw new Error("Text is not allowed in the react-three-fibre tree. You may have extraneous whitespace between components.")},resetAfterCommit(t){t.isCommitting=!1,t.pendingUpdate=!0,t.world&&t.world.needsRecalculate&&(t.world.recalculateWorldSize(),t.world.triggerRepaint())},shouldSetTextContent(){return!1},clearContainer(){return!1},supportsHydration:!1,supportsPersistence:!1,detachDeletedInstance(t){},afterActiveInstanceBlur(){},beforeActiveInstanceBlur(){},getCurrentEventPriority(){return hI},getInstanceFromNode(t){throw new Error("Not implemented")},getInstanceFromScope(t){throw new Error("Not implemented")},prepareScopeUpdate(t,e){throw new Error("Not implemented")},logRecoverableError(){},requestPostPaintCallback(){},rendererPackageName:"@atlas-viewer/atlas",rendererVersion:_I.version,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,maySuspendCommit:()=>!1,preloadInstance:()=>!0,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,setCurrentUpdatePriority(t){qy=t},getCurrentUpdatePriority(){return qy},resolveUpdatePriority(){if(qy!==zI)return qy;switch(typeof window<"u"&&window.event?.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Vj;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Uj;default:return hI}},resetFormInstance(){}});hh.injectIntoDevTools();function xR(t,e){let n=Zy.get(t);n&&hh.updateContainer(null,n,null,()=>{Zy.delete(t),e&&e(t)})}var gI={render(t,e){let n=Zy.get(e);if(n)hh.updateContainer(t,n,null);else{let i=hh.createContainer(e,0,null,!1,null,"",()=>{},null);hh.updateContainer(t,i,null),Zy.set(e,i)}},unmountComponentAtNode(t,e){xR(t,e)}},ph=typeof window<"u"&&(window.document?.createElement||window.navigator?.product==="ReactNative")?rv.useLayoutEffect:rv.useEffect,kj=vo.default.memo(({children:t,setIsReady:e,onCreated:n,bounds:i,preset:a,mode:o="explore"})=>{let s=(0,vo.useCallback)(function(u){let d=(0,vo.useRef)(!1),p=()=>{e(!0)};return(0,vo.useEffect)(()=>{if(a&&!d.current){a.runtime.goHome();let f=n&&n(a);return void(f&&f.then?f.then(p):p())}return()=>{}},[]),(0,vo.useEffect)(()=>{d.current=!0},[]),u.children},[a]);return ph(()=>{if(a){let u=a.runtime;o!==u.mode&&(u.mode=o),gI.render((0,Uc.jsx)(vo.default.StrictMode,{children:(0,Uc.jsx)(s,{children:(0,Uc.jsx)(ov.Provider,{value:i,children:(0,Uc.jsx)(jc.Provider,{value:o,children:(0,Uc.jsx)(av.Provider,{value:a,children:t})})})})}),u)}},[a,o,t]),ph(()=>{if(a){let u=a.runtime;return()=>{gI.unmountComponentAtNode(u)}}return()=>{}},[a]),null}),Yj=class{constructor(t,e){O(this,"canvas"),O(this,"gl"),O(this,"program"),O(this,"fragmentShader"),O(this,"vertexShader"),O(this,"rectBuffer"),O(this,"fragmentShaderSource",`
16
25
  precision mediump float;
17
26
 
18
27
  uniform sampler2D u_image;
@@ -21,7 +30,7 @@ No matching component was found for:
21
30
  void main() {
22
31
  gl_FragColor = texture2D(u_image, v_texCoord);
23
32
  }
24
- `),P(this,"vertexShaderSource",`
33
+ `),O(this,"vertexShaderSource",`
25
34
  attribute vec2 a_position;
26
35
  uniform vec2 u_resolution;
27
36
  varying vec4 v_color;
@@ -45,16 +54,16 @@ No matching component was found for:
45
54
 
46
55
  v_texCoord = a_texCoord;
47
56
  }
48
- `),P(this,"attributes"),P(this,"uniforms"),P(this,"buffers"),P(this,"rendererPosition"),P(this,"dpi"),P(this,"lastResize",0),P(this,"lastKnownScale",1),this.canvas=e,this.rendererPosition=e.getBoundingClientRect(),this.gl=e.getContext("webgl2"),this.fragmentShader=this.createShader(this.gl.FRAGMENT_SHADER,this.fragmentShaderSource),this.vertexShader=this.createShader(this.gl.VERTEX_SHADER,this.vertexShaderSource),this.program=this.createProgram(this.vertexShader,this.fragmentShader),this.dpi=t?.dpi||1,this.attributes={position:this.gl.getAttribLocation(this.program,"a_position"),texCoord:this.gl.getAttribLocation(this.program,"a_texCoord")},this.uniforms={resolution:this.gl.getUniformLocation(this.program,"u_resolution"),texture:this.gl.getUniformLocation(this.program,"u_texture")},this.buffers={position:this.createArrayBuffer(),texCoord:this.createArrayBuffer(new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]))},this.rectBuffer=new Float32Array(12),this.resize(),this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.useProgram(this.program),this.gl.enableVertexAttribArray(this.attributes.position)}resize(){this.resizeCanvasToDisplaySize(),this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.rendererPosition=this.canvas.getBoundingClientRect()}isReady(){return!0}beforeFrame(e,t,n){this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.vertexAttribPointer(this.attributes.position,2,this.gl.FLOAT,!1,0,0),this.gl.uniform2f(this.uniforms.resolution,this.gl.canvas.width,this.gl.canvas.height),this.lastResize>1e3&&(this.lastResize=0,this.resizeCanvasToDisplaySize()),this.lastResize+=t}prepareLayer(e){(!e.__host||!e.__host.webgl)&&((e instanceof zr||e instanceof al)&&this.createImageHost(e),e instanceof Xm&&this.createTextureHost(e))}createTextureHost(e){e.__host=e.__host?e.__host:{};let t=this.gl,n=this.gl.createTexture();t.bindTexture(t.TEXTURE_2D,n),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1);let i;if(e instanceof Xm){let r=e.getTexture();r.source&&t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r.source),i=r}t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),e.__host.webgl={height:e.height,width:e.width,texture:n,lastImage:i}}createImageHost(e){let t=[...new Array(e.points.length/5)];e.__host=e.__host?e.__host:{},e.__host.webgl={height:e.height,width:e.width,textures:t,loading:[],loaded:[],lastLevelRendered:-1,onLoad:(n,i)=>{let r=this.gl,s=this.gl.createTexture();r.bindTexture(r.TEXTURE_2D,s),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,i),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.bindTexture(r.TEXTURE_2D,null),e.__host.webgl.textures[n]=s,e.__host.webgl.loaded.push(n)}}}paint(e,t,n,i,r,s){if(e.type==="spacial-content"&&e.__host&&e.__host.webgl){if(e.getTexture){let u=e?.getTexture();if(u&&e.__host.webgl.lastImage!==u.hash&&u.source&&!e.__host.webgl.error)try{let f=this.gl.RGBA,p=this.gl.RGBA,c=this.gl.UNSIGNED_BYTE;this.gl.bindTexture(this.gl.TEXTURE_2D,e.__host.webgl.texture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,f,p,c,u.source),e.__host.webgl.lastImage=u.hash}catch(f){e.__host.webgl.error=f}}if(e.__host.webgl.loading&&e.__host.webgl.loading.indexOf(t)===-1&&e.getImageUrl){e.__host.webgl.loading.push(t);let u=document.createElement("img");u.decoding="async",u.crossOrigin="anonymous",u.src=e.getImageUrl(t),u.onload=()=>(u.onload=null,e.__host.webgl.onLoad(t,u))}let l=e.__host.webgl.texture?e.__host.webgl.texture:e.__host.webgl.textures[t];l&&(this.gl.enableVertexAttribArray(this.attributes.texCoord),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.buffers.texCoord),this.gl.enableVertexAttribArray(this.attributes.texCoord),this.gl.vertexAttribPointer(this.attributes.texCoord,2,this.gl.FLOAT,!1,0,0),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.buffers.position),this.gl.enableVertexAttribArray(this.attributes.position),this.gl.vertexAttribPointer(this.attributes.position,2,this.gl.FLOAT,!1,0,0),this.gl.bindTexture(this.gl.TEXTURE_2D,l),this.gl.uniform1i(this.uniforms.texture,0),this.setRectangle(n,i,r,s),this.gl.drawArrays(this.gl.TRIANGLES,0,6))}}afterPaintLayer(e,t){}pendingUpdate(){return!0}getPointsAt(e,t,n,i){return e.getPointsAt(t,n,i)}afterFrame(){}getScale(e,t,n){if(Number.isNaN(e)||Number.isNaN(t))return this.lastKnownScale;let i=this.getCanvasDims(),r=i.width/e,s=i.height/t,l=(r<s?s:r)*(n&&this.dpi||1);return Number.isNaN(l)||(this.lastKnownScale=l),this.lastKnownScale}getCanvasDims(){return{width:this.canvas.width/this.dpi,height:this.canvas.height/this.dpi}}getViewportBounds(e,t,n){return null}createShader(e,t){let n=this.gl.createShader(e);if(n){if(this.gl.shaderSource(n,t),this.gl.compileShader(n),this.gl.getShaderParameter(n,this.gl.COMPILE_STATUS))return n;let i=this.gl.getShaderInfoLog(n);if(this.gl.deleteShader(n),i)throw new Error(i)}throw new Error("Invalid shader")}createProgram(e,t){let n=this.gl.createProgram();if(n){if(this.gl.attachShader(n,e),this.gl.attachShader(n,t),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS))return n;let i=this.gl.getProgramInfoLog(n);if(this.gl.deleteProgram(n),i)throw new Error(i)}throw new Error("Invalid program")}resizeCanvasToDisplaySize(){let e=this.gl.canvas,t=e.clientWidth,n=e.clientHeight,i=e.width!==t||e.height!==n;return i&&(e.width=t,e.height=n),i}createArrayBuffer(e){let t=this.gl.createBuffer();if(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,t),e&&this.gl.bufferData(this.gl.ARRAY_BUFFER,e,this.gl.STATIC_DRAW),!t)throw new Error("Cannot create buffer");return t}setRectangle(e,t,n,i){this.gl.bufferData(this.gl.ARRAY_BUFFER,this.getRectangle(e,t,n,i),this.gl.STATIC_DRAW)}getRectangle(e,t,n,i){let r=e,s=e+n,l=t,u=t+i;return this.rectBuffer.set([r,l,s,l,r,u,r,u,s,l,s,u]),this.rectBuffer}getRendererScreenPosition(){return this.rendererPosition}finishLayer(){}reset(){}};function Jm(e,t){let n=t?e:JSON.stringify(e),i=5381,r=n.length;for(;r;)i=i*33^n.charCodeAt(--r);let s=(i>>>0).toString(16);return s.length%2?"0"+s:s}var E1=class{constructor(e){P(this,"$element"),P(this,"stylesheetClasses"),P(this,"activeStylesheetClasses"),P(this,"sheetsDidUpdate"),P(this,"sheetPrefix"),P(this,"stylesheetEntries"),this.sheetPrefix=e?.sheetPrefix||"a-",this.$element=document.createElement("style"),this.stylesheetClasses=[],this.activeStylesheetClasses=[],this.sheetsDidUpdate=!1,this.stylesheetEntries={}}getElement(){return this.$element}addStylesheet(e){let t=e.replace(/\s\s+/g," ").replace(/: /g,":").replace(/; /g,";").trim(),n=this.sheetPrefix+Jm(t,!0);return this.stylesheetClasses.indexOf(n)!==-1||(this.stylesheetClasses.push(n),this.activeStylesheetClasses.push(n),this.stylesheetEntries[n]=t,this.sheetsDidUpdate=!0),n}removeStylesheet(e){let t=this.sheetPrefix+Jm(e,!0);this.stylesheetClasses.indexOf(t)&&(this.stylesheetClasses=this.stylesheetClasses.filter(n=>n!==t)),this.sheetsDidUpdate=!0}clearClasses(){this.activeStylesheetClasses=[]}didUpdateActive(){if(this.activeStylesheetClasses.length){for(let e of this.activeStylesheetClasses)if(this.stylesheetClasses.indexOf(e)===-1)return!0;for(let e of this.stylesheetClasses)if(this.activeStylesheetClasses.indexOf(e)===-1)return!0}return!1}updateSheet(){(this.sheetsDidUpdate||this.didUpdateActive())&&(this.$element.innerText=this.activeStylesheetClasses.map(e=>`.${e}{${this.stylesheetEntries[e]}}`).join(""),this.sheetsDidUpdate=!1,this.stylesheetClasses=[...this.activeStylesheetClasses])}},I1=class{constructor(e,t){P(this,"htmlContainer"),P(this,"visible",[]),P(this,"previousVisible",[]),P(this,"htmlIds",[]),P(this,"firstMeaningfulPaint",!1),P(this,"rendererPosition"),P(this,"stylesheet"),P(this,"options"),P(this,"paintTx",1),P(this,"zIndex",0),P(this,"classes"),this.htmlContainer=e,this.htmlContainer.innerHTML="",this.rendererPosition=this.htmlContainer.getBoundingClientRect(),this.options={triggerResize:()=>{},box:!1,text:!1,sheetPrefix:"",inlineStyles:!1,background:"",...t||{}},this.stylesheet=new E1({sheetPrefix:this.options.sheetPrefix}),this.options.inlineStyles||this.htmlContainer.appendChild(this.stylesheet.getElement()),this.options.background&&this.htmlContainer.classList.add(this.stylesheet.addStylesheet(`
57
+ `),O(this,"attributes"),O(this,"uniforms"),O(this,"buffers"),O(this,"rendererPosition"),O(this,"dpi"),O(this,"lastResize",0),O(this,"lastKnownScale",1),this.canvas=t,this.rendererPosition=t.getBoundingClientRect(),this.gl=t.getContext("webgl2"),this.fragmentShader=this.createShader(this.gl.FRAGMENT_SHADER,this.fragmentShaderSource),this.vertexShader=this.createShader(this.gl.VERTEX_SHADER,this.vertexShaderSource),this.program=this.createProgram(this.vertexShader,this.fragmentShader),this.dpi=e?.dpi||1,this.attributes={position:this.gl.getAttribLocation(this.program,"a_position"),texCoord:this.gl.getAttribLocation(this.program,"a_texCoord")},this.uniforms={resolution:this.gl.getUniformLocation(this.program,"u_resolution"),texture:this.gl.getUniformLocation(this.program,"u_texture")},this.buffers={position:this.createArrayBuffer(),texCoord:this.createArrayBuffer(new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]))},this.rectBuffer=new Float32Array(12),this.resize(),this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.useProgram(this.program),this.gl.enableVertexAttribArray(this.attributes.position)}resize(){this.resizeCanvasToDisplaySize(),this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.rendererPosition=this.canvas.getBoundingClientRect()}isReady(){return!0}beforeFrame(t,e,n){this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.vertexAttribPointer(this.attributes.position,2,this.gl.FLOAT,!1,0,0),this.gl.uniform2f(this.uniforms.resolution,this.gl.canvas.width,this.gl.canvas.height),this.lastResize>1e3&&(this.lastResize=0,this.resizeCanvasToDisplaySize()),this.lastResize+=e}prepareLayer(t){(!t.__host||!t.__host.webgl)&&((t instanceof yl||t instanceof mh)&&this.createImageHost(t),t instanceof cR&&this.createTextureHost(t))}createTextureHost(t){t.__host=t.__host?t.__host:{};let e=this.gl,n=this.gl.createTexture();e.bindTexture(e.TEXTURE_2D,n),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1);let i;if(t instanceof cR){let a=t.getTexture();a.source&&e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,a.source),i=a}e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),t.__host.webgl={height:t.height,width:t.width,texture:n,lastImage:i}}createImageHost(t){let e=[...new Array(t.points.length/5)];t.__host=t.__host?t.__host:{},t.__host.webgl={height:t.height,width:t.width,textures:e,loading:[],loaded:[],lastLevelRendered:-1,onLoad:(n,i)=>{let a=this.gl,o=this.gl.createTexture();a.bindTexture(a.TEXTURE_2D,o),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,!1),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.bindTexture(a.TEXTURE_2D,null),t.__host.webgl.textures[n]=o,t.__host.webgl.loaded.push(n)}}}paint(t,e,n,i,a,o){if(t.type==="spacial-content"&&t.__host&&t.__host.webgl){if(t.getTexture){let u=t?.getTexture();if(u&&t.__host.webgl.lastImage!==u.hash&&u.source&&!t.__host.webgl.error)try{let d=this.gl.RGBA,p=this.gl.RGBA,f=this.gl.UNSIGNED_BYTE;this.gl.bindTexture(this.gl.TEXTURE_2D,t.__host.webgl.texture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,d,p,f,u.source),t.__host.webgl.lastImage=u.hash}catch(d){t.__host.webgl.error=d}}if(t.__host.webgl.loading&&t.__host.webgl.loading.indexOf(e)===-1&&t.getImageUrl){t.__host.webgl.loading.push(e);let u=document.createElement("img");u.decoding="async",u.crossOrigin="anonymous",u.src=t.getImageUrl(e),u.onload=()=>(u.onload=null,t.__host.webgl.onLoad(e,u))}let s=t.__host.webgl.texture?t.__host.webgl.texture:t.__host.webgl.textures[e];s&&(this.gl.enableVertexAttribArray(this.attributes.texCoord),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.buffers.texCoord),this.gl.enableVertexAttribArray(this.attributes.texCoord),this.gl.vertexAttribPointer(this.attributes.texCoord,2,this.gl.FLOAT,!1,0,0),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.buffers.position),this.gl.enableVertexAttribArray(this.attributes.position),this.gl.vertexAttribPointer(this.attributes.position,2,this.gl.FLOAT,!1,0,0),this.gl.bindTexture(this.gl.TEXTURE_2D,s),this.gl.uniform1i(this.uniforms.texture,0),this.setRectangle(n,i,a,o),this.gl.drawArrays(this.gl.TRIANGLES,0,6))}}afterPaintLayer(t,e){}pendingUpdate(){return!0}getPointsAt(t,e,n,i){return t.getPointsAt(e,n,i)}afterFrame(){}getScale(t,e,n){if(Number.isNaN(t)||Number.isNaN(e))return this.lastKnownScale;let i=this.getCanvasDims(),a=i.width/t,o=i.height/e,s=(a<o?o:a)*(n&&this.dpi||1);return Number.isNaN(s)||(this.lastKnownScale=s),this.lastKnownScale}getCanvasDims(){return{width:this.canvas.width/this.dpi,height:this.canvas.height/this.dpi}}getViewportBounds(t,e,n){return null}createShader(t,e){let n=this.gl.createShader(t);if(n){if(this.gl.shaderSource(n,e),this.gl.compileShader(n),this.gl.getShaderParameter(n,this.gl.COMPILE_STATUS))return n;let i=this.gl.getShaderInfoLog(n);if(this.gl.deleteShader(n),i)throw new Error(i)}throw new Error("Invalid shader")}createProgram(t,e){let n=this.gl.createProgram();if(n){if(this.gl.attachShader(n,t),this.gl.attachShader(n,e),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS))return n;let i=this.gl.getProgramInfoLog(n);if(this.gl.deleteProgram(n),i)throw new Error(i)}throw new Error("Invalid program")}resizeCanvasToDisplaySize(){let t=this.gl.canvas,e=t.clientWidth,n=t.clientHeight,i=t.width!==e||t.height!==n;return i&&(t.width=e,t.height=n),i}createArrayBuffer(t){let e=this.gl.createBuffer();if(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),t&&this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),!e)throw new Error("Cannot create buffer");return e}setRectangle(t,e,n,i){this.gl.bufferData(this.gl.ARRAY_BUFFER,this.getRectangle(t,e,n,i),this.gl.STATIC_DRAW)}getRectangle(t,e,n,i){let a=t,o=t+n,s=e,u=e+i;return this.rectBuffer.set([a,s,o,s,a,u,a,u,o,s,o,u]),this.rectBuffer}getRendererScreenPosition(){return this.rendererPosition}finishLayer(){}reset(){}};function hR(t,e){let n=e?t:JSON.stringify(t),i=5381,a=n.length;for(;a;)i=i*33^n.charCodeAt(--a);let o=(i>>>0).toString(16);return o.length%2?"0"+o:o}var BI=class{constructor(t){O(this,"$element"),O(this,"stylesheetClasses"),O(this,"activeStylesheetClasses"),O(this,"sheetsDidUpdate"),O(this,"sheetPrefix"),O(this,"stylesheetEntries"),this.sheetPrefix=t?.sheetPrefix||"a-",this.$element=document.createElement("style"),this.stylesheetClasses=[],this.activeStylesheetClasses=[],this.sheetsDidUpdate=!1,this.stylesheetEntries={}}getElement(){return this.$element}addStylesheet(t){let e=t.replace(/\s\s+/g," ").replace(/: /g,":").replace(/; /g,";").trim(),n=this.sheetPrefix+hR(e,!0);return this.stylesheetClasses.indexOf(n)!==-1||(this.stylesheetClasses.push(n),this.activeStylesheetClasses.push(n),this.stylesheetEntries[n]=e,this.sheetsDidUpdate=!0),n}removeStylesheet(t){let e=this.sheetPrefix+hR(t,!0);this.stylesheetClasses.indexOf(e)&&(this.stylesheetClasses=this.stylesheetClasses.filter(n=>n!==e)),this.sheetsDidUpdate=!0}clearClasses(){this.activeStylesheetClasses=[]}didUpdateActive(){if(this.activeStylesheetClasses.length){for(let t of this.activeStylesheetClasses)if(this.stylesheetClasses.indexOf(t)===-1)return!0;for(let t of this.stylesheetClasses)if(this.activeStylesheetClasses.indexOf(t)===-1)return!0}return!1}updateSheet(){(this.sheetsDidUpdate||this.didUpdateActive())&&(this.$element.innerText=this.activeStylesheetClasses.map(t=>`.${t}{${this.stylesheetEntries[t]}}`).join(""),this.sheetsDidUpdate=!1,this.stylesheetClasses=[...this.activeStylesheetClasses])}},PI=class{constructor(t,e){O(this,"htmlContainer"),O(this,"visible",[]),O(this,"previousVisible",[]),O(this,"htmlIds",[]),O(this,"firstMeaningfulPaint",!1),O(this,"rendererPosition"),O(this,"stylesheet"),O(this,"options"),O(this,"paintTx",1),O(this,"zIndex",0),O(this,"classes"),this.htmlContainer=t,this.htmlContainer.innerHTML="",this.rendererPosition=this.htmlContainer.getBoundingClientRect(),this.options={triggerResize:()=>{},box:!1,text:!1,sheetPrefix:"",inlineStyles:!1,background:"",...e||{}},this.stylesheet=new BI({sheetPrefix:this.options.sheetPrefix}),this.options.inlineStyles||this.htmlContainer.appendChild(this.stylesheet.getElement()),this.options.background&&this.htmlContainer.classList.add(this.stylesheet.addStylesheet(`
49
58
  background: ${this.options.background};
50
59
  `)),this.classes={hostClassName:this.stylesheet.addStylesheet(`
51
60
  position: absolute;
52
61
  transform-origin: 0px 0px;
53
- `),interactive:this.stylesheet.addStylesheet("pointer-events: all"),nonInteractive:this.stylesheet.addStylesheet("pointer-events: none")},this.stylesheet.updateSheet()}createHtmlHost(e){if(this.htmlContainer&&(this.options.box||e.props.className||e.props.html||e.props.href)){let t=document.createElement(e.props.href?"a":"div");if(e.props.href){t.style.display="block",t.href=e.props.href;let n=e.props.hrefTarget||"_blank";t.target=n,n!=="_self"&&(t.rel="noopener noreferrer")}t.title=e.props.title||"",this.options.inlineStyles?(t.style.display="block",t.style.position="absolute",t.style.overflow="hidden",t.style.transformOrigin="0px 0px"):t.classList.add(this.classes.hostClassName),e.__host={element:t,revision:null,relative:!1},this.updateHtmlHost(e,e.width,e.height),e.__onCreate&&e.__onCreate()}}triggerResize(){this.options.triggerResize()}updateHtmlHost(e,t,n){if(e.__revision!==e.__host.revision){let i=e.__host.element,r=[this.classes.hostClassName];if(e.props.interactive?this.options.inlineStyles?i.style.pointerEvents="all":r.push(this.classes.interactive):this.options.inlineStyles?i.style.pointerEvents="none":r.push(this.classes.nonInteractive),e.props.href){i.style.display="block",i.href=e.props.href;let l=e.props.hrefTarget||"_blank";i.target=l,l!=="_self"?i.rel="noopener noreferrer":i.rel=""}else i.href&&i.removeAttribute("href");if(e.props.title&&(i.title=e.props.title||""),e.props.className&&(r.push(e.props.className),e.hovering&&r.push(`${e.props.className}--hover`),e.pressing&&r.push(`${e.props.className}--active`)),e.props.relativeStyle?(i.style.width=`${t||e.width}px`,i.style.height=`${n||e.height}px`):(i.style.width=`${e.width}px`,i.style.height=`${e.height}px`),e.props.style){Object.assign(i.style,e.props.style||{},e.hovering?e.props.hoverStyles||{}:{},e.pressing?e.props.pressStyles||{}:{});return}if(this.options.text&&e instanceof cd){e.text&&(i.innerText=e.text),e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor),e.color&&(i.style.color=e.color),e.props.font&&(i.style.font=e.props.font),e.props.textAlign&&(i.style.textAlign=e.props.textAlign),e.__host.revision=e.__revision;let l=r.join(" ");i.className=l,i.part=l}e instanceof il&&(this.options.box||e.props.className||e.props.html)&&(e.props.backgroundColor&&(i.style.backgroundColor=e.props.backgroundColor),e.props.border!==i.style.border&&(i.style.border=e.props.border));let s=r.join(" ");i.className=s,i.part=s}}afterFrame(e,t,n){this.stylesheet.updateSheet();for(let i of this.previousVisible)this.visible.indexOf(i)===-1&&this.htmlContainer&&i.__id&&this.htmlIds.indexOf(i.__id)!==-1&&this.htmlContainer.removeChild(i.__host.element);this.previousVisible=this.visible}afterPaintLayer(e,t){}beforeFrame(e,t,n){this.stylesheet.clearClasses(),this.paintTx++,this.zIndex=0,this.visible=[]}getPointsAt(e,t,n,i){return e.getPointsAt(t,n,i)}getScale(e,t){let n=this.rendererPosition.width/e,i=this.rendererPosition.height/t;return n<i?i:n}getViewportBounds(e,t,n){return null}isReady(){return!1}paint(e,t,n,i,r,s){if(this.zIndex++,(this.options.text&&e instanceof cd||e instanceof il&&(this.options.box||e.props.className||e.props.html))&&e.__host.tx!==this.paintTx&&(this.visible.push(e),e.__host.tx=this.paintTx,this.htmlContainer)){this.updateHtmlHost(e,r,s);let l=r/e.width,u=e.__host.element;u.style.zIndex=`${this.zIndex}`,e.props.relativeStyle?u.style.transform=`translate(${Math.round(n)}px, ${Math.round(i)}px)`:u.style.transform=`translate(${Math.round(n)}px, ${Math.round(i)}px) scale(${l})`,this.previousVisible.indexOf(e)===-1&&this.htmlContainer.appendChild(u),this.htmlIds.indexOf(e.__id)===-1&&this.htmlIds.push(e.__id)}}pendingUpdate(){return!1}prepareLayer(e){e.__host||(e instanceof cd||e instanceof il)&&this.createHtmlHost(e)}resize(e,t){typeof e<"u"&&typeof t<"u"&&(this.htmlContainer.style.width=`${e}px`,this.htmlContainer.style.height=`${t}px`),this.rendererPosition=this.htmlContainer.getBoundingClientRect()}getRendererScreenPosition(){return this.rendererPosition}finishLayer(){}reset(){}},C1=class dd{constructor(t,n,i){P(this,"element"),P(this,"runtime"),P(this,"unsubscribe"),P(this,"activatedEvents",[]),P(this,"eventHandlers",[]),P(this,"bounds"),P(this,"listening"),P(this,"pointerMoveEvent"),P(this,"pointerEventState",{isClicking:!1,isDragging:!1,isPressed:!1,mousedOver:[],itemsBeingDragged:[],mouseDownStart:{x:0,y:0},lastTouches:[]}),P(this,"options"),P(this,"_realPointerMove",s=>{this.pointerMoveEvent=s}),P(this,"onWheelEvent",s=>{s.preventDefault(),this.onPointerEvent(s)}),P(this,"onContextMenu",s=>{s.preventDefault();let l="onContextMenu";if(this.runtime.world.activatedEvents.indexOf(l)!==-1){let{x:u,y:f}=this.runtime.viewerToWorld(s.clientX-this.bounds.left,s.clientY-this.bounds.top);this.assignToEvent(s,u,f),this.runtime.world.propagatePointerEvent(l,s,u,f)}}),P(this,"onTouchEvent",s=>{let l=Ds[s.type],u=[],f=s.touches.length;for(let p=0;p<f;p++){let c=s.touches.item(p);if(!c)continue;let{x:m,y}=this.runtime.viewerToWorld(c.clientX-this.bounds.left,c.clientY-this.bounds.top),w={id:c.identifier,x:m,y};u.push(w)}u.length&&this.assignToEvent(s,u[0].x,u[0].y),l!=="onTouchEnd"?(this.pointerEventState.lastTouches=u,s.atlasTouches=u,this.runtime.world.propagateTouchEvent(l,s,u)):(s.atlasTouches=[],this.runtime.world.propagateTouchEvent(l,s,this.pointerEventState.lastTouches),this.pointerEventState.lastTouches=[])}),P(this,"onPointerEvent",s=>{if(s.button===2)return;let l=Ds[s.type];if(l&&this.runtime.world.activatedEvents.indexOf(l)!==-1){let{x:u,y:f}=this.runtime.viewerToWorld(s.clientX-this.bounds.left,s.clientY-this.bounds.top);this.assignToEvent(s,u,f),this.runtime.world.propagatePointerEvent(l,s,u,f)}}),P(this,"onPointerDown",s=>{s.button!==2&&(this.pointerEventState.isPressed=!0,this.pointerEventState.isClicking=!0,this.pointerEventState.mouseDownStart.x=s.clientX,this.pointerEventState.mouseDownStart.y=s.clientY,setTimeout(()=>{this.runtime&&(this.pointerEventState.isClicking=!1)},250),setTimeout(()=>{if(this.runtime&&this.pointerEventState.isPressed&&!this.pointerEventState.isDragging){let l=this.runtime.viewerToWorld(this.pointerEventState.mouseDownStart.x-this.bounds.left,this.pointerEventState.mouseDownStart.y-this.bounds.top);this.pointerEventState.isDragging=!0,this.pointerEventState.itemsBeingDragged=this.runtime.world.propagatePointerEvent("onDragStart",s,l.x,l.y)}},800),this.onPointerEvent(s))}),P(this,"onPointerUp",s=>{if(s.button!==2){if(this.pointerEventState.isClicking){let{x:l,y:u}=this.runtime.viewerToWorld(s.clientX-this.bounds.left,s.clientY-this.bounds.top);this.assignToEvent(s,l,u),this.runtime.world.propagatePointerEvent("onClick",s,l,u)}if(this.pointerEventState.isDragging){for(let l of this.pointerEventState.itemsBeingDragged)l.dispatchEvent("onDragEnd",s);this.pointerEventState.isDragging=!1}this.pointerEventState.isClicking=!1,this.pointerEventState.isPressed=!1,this.pointerEventState.itemsBeingDragged=[],this.onPointerEvent(s)}}),P(this,"onPointerMove",s=>{this.pointerMoveEvent=void 0;let{x:l,y:u}=this.runtime.viewerToWorld(s.clientX-this.bounds.left,s.clientY-this.bounds.top);if(Number.isNaN(l)||Number.isNaN(u))return;this.assignToEvent(s,l,u),this.runtime.world.propagatePointerEvent("onPointerMove",s,l,u);let f=this.runtime.world.propagatePointerEvent("onMouseMove",s,l,u),p=[],c=[];for(let m of f)p.push(m.id),c.push(m),this.pointerEventState.mousedOver.indexOf(m)===-1&&(m.dispatchEvent("onMouseEnter",s),m.dispatchEvent("onPointerEnter",s),m.dispatchEvent("onMouseOver",s),m.dispatchEvent("onPointerOver",s));for(let m of this.pointerEventState.mousedOver)p.indexOf(m.id)===-1&&(m.dispatchEvent("onMouseLeave",s),m.dispatchEvent("onPointerLeave",s),m.dispatchEvent("onMouseOut",s),m.dispatchEvent("onPointerOut",s));if(this.pointerEventState.isDragging)for(let m of this.pointerEventState.itemsBeingDragged)m.dispatchEvent("onDrag",s);if(this.pointerEventState.isPressed&&!this.pointerEventState.isDragging&&fd(this.pointerEventState.mouseDownStart,{x:s.clientX,y:s.clientY})>50){let m=this.runtime.viewerToWorld(this.pointerEventState.mouseDownStart.x-this.bounds.left,this.pointerEventState.mouseDownStart.y-this.bounds.top);this.pointerEventState.isDragging=!0,this.pointerEventState.itemsBeingDragged=this.runtime.world.propagatePointerEvent("onDragStart",{...s,atlas:{x:m.x,y:m.y}},m.x,m.y)}this.pointerEventState.mousedOver=c}),this.element=t,this.runtime=n,this.unsubscribe=n.world.addLayoutSubscriber(this.layoutSubscriber.bind(this)),this.bounds=t.getBoundingClientRect(),this.listening=!1,this.options={simulationRate:0,...i||{}};let r=0;n.registerHook("useFrame",s=>{r+=s,r>this.options.simulationRate&&this.pointerMoveEvent&&(r=0,n.updateNextFrame())}),n.registerHook("useBeforeFrame",()=>{this.pointerMoveEvent&&this.onPointerMove(this.pointerMoveEvent)}),this.activateEvents()}updateBounds(){this.bounds=this.element.getBoundingClientRect(),this.runtime.updateRendererScreenPosition()}layoutSubscriber(t){t==="event-activation"&&this.listening==!1&&this.activateEvents()}assignToEvent(t,n,i){dd.eventPool.atlas.x=n,dd.eventPool.atlas.y=i,t.atlas=dd.eventPool.atlas}activateEvents(){this.listening=!0,this.element.addEventListener("pointermove",this._realPointerMove),this.element.addEventListener("pointerup",this.onPointerUp),this.element.addEventListener("pointerdown",this.onPointerDown),this.element.addEventListener("mousedown",this.onPointerEvent),this.element.addEventListener("mouseup",this.onPointerEvent),this.element.addEventListener("pointercancel",this.onPointerEvent),this.element.addEventListener("wheel",this.onWheelEvent),this.element.addEventListener("contextmenu",this.onContextMenu),this.element.addEventListener("touchstart",this.onTouchEvent),this.element.addEventListener("touchcancel",this.onTouchEvent),this.element.addEventListener("touchend",this.onTouchEvent),this.element.addEventListener("touchmove",this.onTouchEvent)}normalizeEventName(t){return t.startsWith("on")?t.slice(2).toLowerCase():t.toLowerCase()}stop(){this.listening=!1,this.element.removeEventListener("pointermove",this._realPointerMove),this.element.removeEventListener("pointerup",this.onPointerUp),this.element.removeEventListener("pointerdown",this.onPointerDown),this.element.removeEventListener("mousedown",this.onPointerEvent),this.element.removeEventListener("mouseup",this.onPointerEvent),this.element.removeEventListener("pointercancel",this.onPointerEvent),this.element.removeEventListener("wheel",this.onWheelEvent),this.element.removeEventListener("touchstart",this.onTouchEvent),this.element.removeEventListener("touchcancel",this.onTouchEvent),this.element.removeEventListener("touchend",this.onTouchEvent),this.element.removeEventListener("touchmove",this.onTouchEvent),this.unsubscribe();for(let[t,n]of this.eventHandlers)this.element.removeEventListener(this.normalizeEventName(t),n)}};P(C1,"eventPool",{atlas:{x:0,y:0}});var P1=C1;function A1({interactive:e=!0,viewport:t,forceRefresh:n,canvasElement:i,overlayElement:r,controllerConfig:s,unstable_webglRenderer:l,dpi:u,debug:f,canvasBox:p=!0,polygon:c=!0,navigatorElement:m,runtimeOptions:y}){if(!i)throw new Error("Invalid container");i.style.userSelect="none";let w=e?y1({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1,parentElement:i,...s||{}}):void 0,v=new m1([l?new QT(i,{dpi:u}):new LT(i,{dpi:u,debug:f,box:p,polygon:c}),r?new I1(r,{box:l||!p,text:!0,triggerResize:n}):void 0,m?new FT(m):void 0]),S=new xd(v,new vd(1024,1024),t,w?[w]:[],y),E=new P1(i,S);return{name:"default-preset",em:E,runtime:S,renderer:v,controller:w,canvas:i,navigator:m,unmount(){rg(S),S.stopControllers(),S.stop(),S.reset(),E&&E.stop()}}}var Fr=1+Number.MIN_VALUE,YT=class{constructor(e,t){P(this,"container"),P(this,"width"),P(this,"height"),P(this,"pending",!0),P(this,"options"),P(this,"stylesheet"),P(this,"zIndex",0),P(this,"lastKnownScale",1),P(this,"rendererPosition"),P(this,"currentlyVisible",[]),P(this,"previouslyVisible",[]),this.container=e,this.rendererPosition=e.getBoundingClientRect();let{width:n,height:i}=this.rendererPosition;this.width=n,this.height=i,this.options={addPart:!1,setDraggableFalse:!1,imageClass:"",widthStylesheet:!1,sheetPrefix:"position-",background:"#000",...t||{}},this.stylesheet=new E1({sheetPrefix:this.options.sheetPrefix}),this.container.classList.add(this.stylesheet.addStylesheet(`
62
+ `),interactive:this.stylesheet.addStylesheet("pointer-events: all"),nonInteractive:this.stylesheet.addStylesheet("pointer-events: none")},this.stylesheet.updateSheet()}createHtmlHost(t){if(this.htmlContainer&&(this.options.box||t.props.className||t.props.html||t.props.href)){let e=document.createElement(t.props.href?"a":"div");if(t.props.href){e.style.display="block",e.href=t.props.href;let n=t.props.hrefTarget||"_blank";e.target=n,n!=="_self"&&(e.rel="noopener noreferrer")}e.title=t.props.title||"",this.options.inlineStyles?(e.style.display="block",e.style.position="absolute",e.style.overflow="hidden",e.style.transformOrigin="0px 0px"):e.classList.add(this.classes.hostClassName),t.__host={element:e,revision:null,relative:!1},this.updateHtmlHost(t,t.width,t.height),t.__onCreate&&t.__onCreate()}}triggerResize(){this.options.triggerResize()}updateHtmlHost(t,e,n){if(t.__revision!==t.__host.revision){let i=t.__host.element,a=[this.classes.hostClassName];if(t.props.interactive?this.options.inlineStyles?i.style.pointerEvents="all":a.push(this.classes.interactive):this.options.inlineStyles?i.style.pointerEvents="none":a.push(this.classes.nonInteractive),t.props.href){i.style.display="block",i.href=t.props.href;let s=t.props.hrefTarget||"_blank";i.target=s,s!=="_self"?i.rel="noopener noreferrer":i.rel=""}else i.href&&i.removeAttribute("href");if(t.props.title&&(i.title=t.props.title||""),t.props.className&&(a.push(t.props.className),t.hovering&&a.push(`${t.props.className}--hover`),t.pressing&&a.push(`${t.props.className}--active`)),t.props.relativeStyle?(i.style.width=`${e||t.width}px`,i.style.height=`${n||t.height}px`):(i.style.width=`${t.width}px`,i.style.height=`${t.height}px`),t.props.style){Object.assign(i.style,t.props.style||{},t.hovering?t.props.hoverStyles||{}:{},t.pressing?t.props.pressStyles||{}:{});return}if(this.options.text&&t instanceof Fy){t.text&&(i.innerText=t.text),t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor),t.color&&(i.style.color=t.color),t.props.font&&(i.style.font=t.props.font),t.props.textAlign&&(i.style.textAlign=t.props.textAlign),t.__host.revision=t.__revision;let s=a.join(" ");i.className=s,i.part=s}t instanceof fh&&(this.options.box||t.props.className||t.props.html)&&(t.props.backgroundColor&&(i.style.backgroundColor=t.props.backgroundColor),t.props.border!==i.style.border&&(i.style.border=t.props.border));let o=a.join(" ");i.className=o,i.part=o}}afterFrame(t,e,n){this.stylesheet.updateSheet();for(let i of this.previousVisible)this.visible.indexOf(i)===-1&&this.htmlContainer&&i.__id&&this.htmlIds.indexOf(i.__id)!==-1&&this.htmlContainer.removeChild(i.__host.element);this.previousVisible=this.visible}afterPaintLayer(t,e){}beforeFrame(t,e,n){this.stylesheet.clearClasses(),this.paintTx++,this.zIndex=0,this.visible=[]}getPointsAt(t,e,n,i){return t.getPointsAt(e,n,i)}getScale(t,e){let n=this.rendererPosition.width/t,i=this.rendererPosition.height/e;return n<i?i:n}getViewportBounds(t,e,n){return null}isReady(){return!1}paint(t,e,n,i,a,o){if(this.zIndex++,(this.options.text&&t instanceof Fy||t instanceof fh&&(this.options.box||t.props.className||t.props.html))&&t.__host.tx!==this.paintTx&&(this.visible.push(t),t.__host.tx=this.paintTx,this.htmlContainer)){this.updateHtmlHost(t,a,o);let s=a/t.width,u=t.__host.element;u.style.zIndex=`${this.zIndex}`,t.props.relativeStyle?u.style.transform=`translate(${Math.round(n)}px, ${Math.round(i)}px)`:u.style.transform=`translate(${Math.round(n)}px, ${Math.round(i)}px) scale(${s})`,this.previousVisible.indexOf(t)===-1&&this.htmlContainer.appendChild(u),this.htmlIds.indexOf(t.__id)===-1&&this.htmlIds.push(t.__id)}}pendingUpdate(){return!1}prepareLayer(t){t.__host||(t instanceof Fy||t instanceof fh)&&this.createHtmlHost(t)}resize(t,e){typeof t<"u"&&typeof e<"u"&&(this.htmlContainer.style.width=`${t}px`,this.htmlContainer.style.height=`${e}px`),this.rendererPosition=this.htmlContainer.getBoundingClientRect()}getRendererScreenPosition(){return this.rendererPosition}finishLayer(){}reset(){}},HI=class ky{constructor(e,n,i){O(this,"element"),O(this,"runtime"),O(this,"unsubscribe"),O(this,"activatedEvents",[]),O(this,"eventHandlers",[]),O(this,"bounds"),O(this,"listening"),O(this,"pointerMoveEvent"),O(this,"pointerEventState",{isClicking:!1,isDragging:!1,isPressed:!1,mousedOver:[],itemsBeingDragged:[],mouseDownStart:{x:0,y:0},lastTouches:[]}),O(this,"options"),O(this,"_realPointerMove",o=>{this.pointerMoveEvent=o}),O(this,"onWheelEvent",o=>{o.preventDefault(),this.onPointerEvent(o)}),O(this,"onContextMenu",o=>{o.preventDefault();let s="onContextMenu";if(this.runtime.world.activatedEvents.indexOf(s)!==-1){let{x:u,y:d}=this.runtime.viewerToWorld(o.clientX-this.bounds.left,o.clientY-this.bounds.top);this.assignToEvent(o,u,d),this.runtime.world.propagatePointerEvent(s,o,u,d)}}),O(this,"onTouchEvent",o=>{let s=Vc[o.type],u=[],d=o.touches.length;for(let p=0;p<d;p++){let f=o.touches.item(p);if(!f)continue;let{x:m,y:g}=this.runtime.viewerToWorld(f.clientX-this.bounds.left,f.clientY-this.bounds.top),v={id:f.identifier,x:m,y:g};u.push(v)}u.length&&this.assignToEvent(o,u[0].x,u[0].y),s!=="onTouchEnd"?(this.pointerEventState.lastTouches=u,o.atlasTouches=u,this.runtime.world.propagateTouchEvent(s,o,u)):(o.atlasTouches=[],this.runtime.world.propagateTouchEvent(s,o,this.pointerEventState.lastTouches),this.pointerEventState.lastTouches=[])}),O(this,"onPointerEvent",o=>{if(o.button===2)return;let s=Vc[o.type];if(s&&this.runtime.world.activatedEvents.indexOf(s)!==-1){let{x:u,y:d}=this.runtime.viewerToWorld(o.clientX-this.bounds.left,o.clientY-this.bounds.top);this.assignToEvent(o,u,d),this.runtime.world.propagatePointerEvent(s,o,u,d)}}),O(this,"onPointerDown",o=>{o.button!==2&&(this.pointerEventState.isPressed=!0,this.pointerEventState.isClicking=!0,this.pointerEventState.mouseDownStart.x=o.clientX,this.pointerEventState.mouseDownStart.y=o.clientY,setTimeout(()=>{this.runtime&&(this.pointerEventState.isClicking=!1)},250),setTimeout(()=>{if(this.runtime&&this.pointerEventState.isPressed&&!this.pointerEventState.isDragging){let s=this.runtime.viewerToWorld(this.pointerEventState.mouseDownStart.x-this.bounds.left,this.pointerEventState.mouseDownStart.y-this.bounds.top);this.pointerEventState.isDragging=!0,this.pointerEventState.itemsBeingDragged=this.runtime.world.propagatePointerEvent("onDragStart",o,s.x,s.y)}},800),this.onPointerEvent(o))}),O(this,"onPointerUp",o=>{if(o.button!==2){if(this.pointerEventState.isClicking){let{x:s,y:u}=this.runtime.viewerToWorld(o.clientX-this.bounds.left,o.clientY-this.bounds.top);this.assignToEvent(o,s,u),this.runtime.world.propagatePointerEvent("onClick",o,s,u)}if(this.pointerEventState.isDragging){for(let s of this.pointerEventState.itemsBeingDragged)s.dispatchEvent("onDragEnd",o);this.pointerEventState.isDragging=!1}this.pointerEventState.isClicking=!1,this.pointerEventState.isPressed=!1,this.pointerEventState.itemsBeingDragged=[],this.onPointerEvent(o)}}),O(this,"onPointerMove",o=>{this.pointerMoveEvent=void 0;let{x:s,y:u}=this.runtime.viewerToWorld(o.clientX-this.bounds.left,o.clientY-this.bounds.top);if(Number.isNaN(s)||Number.isNaN(u))return;this.assignToEvent(o,s,u),this.runtime.world.propagatePointerEvent("onPointerMove",o,s,u);let d=this.runtime.world.propagatePointerEvent("onMouseMove",o,s,u),p=[],f=[];for(let m of d)p.push(m.id),f.push(m),this.pointerEventState.mousedOver.indexOf(m)===-1&&(m.dispatchEvent("onMouseEnter",o),m.dispatchEvent("onPointerEnter",o),m.dispatchEvent("onMouseOver",o),m.dispatchEvent("onPointerOver",o));for(let m of this.pointerEventState.mousedOver)p.indexOf(m.id)===-1&&(m.dispatchEvent("onMouseLeave",o),m.dispatchEvent("onPointerLeave",o),m.dispatchEvent("onMouseOut",o),m.dispatchEvent("onPointerOut",o));if(this.pointerEventState.isDragging)for(let m of this.pointerEventState.itemsBeingDragged)m.dispatchEvent("onDrag",o);if(this.pointerEventState.isPressed&&!this.pointerEventState.isDragging&&Yy(this.pointerEventState.mouseDownStart,{x:o.clientX,y:o.clientY})>50){let m=this.runtime.viewerToWorld(this.pointerEventState.mouseDownStart.x-this.bounds.left,this.pointerEventState.mouseDownStart.y-this.bounds.top);this.pointerEventState.isDragging=!0,this.pointerEventState.itemsBeingDragged=this.runtime.world.propagatePointerEvent("onDragStart",{...o,atlas:{x:m.x,y:m.y}},m.x,m.y)}this.pointerEventState.mousedOver=f}),this.element=e,this.runtime=n,this.unsubscribe=n.world.addLayoutSubscriber(this.layoutSubscriber.bind(this)),this.bounds=e.getBoundingClientRect(),this.listening=!1,this.options={simulationRate:0,...i||{}};let a=0;n.registerHook("useFrame",o=>{a+=o,a>this.options.simulationRate&&this.pointerMoveEvent&&(a=0,n.updateNextFrame())}),n.registerHook("useBeforeFrame",()=>{this.pointerMoveEvent&&this.onPointerMove(this.pointerMoveEvent)}),this.activateEvents()}updateBounds(){this.bounds=this.element.getBoundingClientRect(),this.runtime.updateRendererScreenPosition()}layoutSubscriber(e){e==="event-activation"&&this.listening==!1&&this.activateEvents()}assignToEvent(e,n,i){ky.eventPool.atlas.x=n,ky.eventPool.atlas.y=i,e.atlas=ky.eventPool.atlas}activateEvents(){this.listening=!0,this.element.addEventListener("pointermove",this._realPointerMove),this.element.addEventListener("pointerup",this.onPointerUp),this.element.addEventListener("pointerdown",this.onPointerDown),this.element.addEventListener("mousedown",this.onPointerEvent),this.element.addEventListener("mouseup",this.onPointerEvent),this.element.addEventListener("pointercancel",this.onPointerEvent),this.element.addEventListener("wheel",this.onWheelEvent),this.element.addEventListener("contextmenu",this.onContextMenu),this.element.addEventListener("touchstart",this.onTouchEvent),this.element.addEventListener("touchcancel",this.onTouchEvent),this.element.addEventListener("touchend",this.onTouchEvent),this.element.addEventListener("touchmove",this.onTouchEvent)}normalizeEventName(e){return e.startsWith("on")?e.slice(2).toLowerCase():e.toLowerCase()}stop(){this.listening=!1,this.element.removeEventListener("pointermove",this._realPointerMove),this.element.removeEventListener("pointerup",this.onPointerUp),this.element.removeEventListener("pointerdown",this.onPointerDown),this.element.removeEventListener("mousedown",this.onPointerEvent),this.element.removeEventListener("mouseup",this.onPointerEvent),this.element.removeEventListener("pointercancel",this.onPointerEvent),this.element.removeEventListener("wheel",this.onWheelEvent),this.element.removeEventListener("touchstart",this.onTouchEvent),this.element.removeEventListener("touchcancel",this.onTouchEvent),this.element.removeEventListener("touchend",this.onTouchEvent),this.element.removeEventListener("touchmove",this.onTouchEvent),this.unsubscribe();for(let[e,n]of this.eventHandlers)this.element.removeEventListener(this.normalizeEventName(e),n)}};O(HI,"eventPool",{atlas:{x:0,y:0}});var UI=HI;function VI({interactive:t=!0,viewport:e,forceRefresh:n,canvasElement:i,overlayElement:a,controllerConfig:o,unstable_webglRenderer:s,dpi:u,debug:d,canvasBox:p=!0,polygon:f=!0,navigatorElement:m,runtimeOptions:g}){if(!i)throw new Error("Invalid container");i.style.userSelect="none";let v=t?MI({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1,parentElement:i,...o||{}}):void 0,S=new wI([s?new Yj(i,{dpi:u}):new _j(i,{dpi:u,debug:d,box:p,polygon:f}),a?new PI(a,{box:s||!p,text:!0,triggerResize:n}):void 0,m?new zj(m):void 0]),R=new tv(S,new $y(1024,1024),e,v?[v]:[],g),T=new UI(i,R);return{name:"default-preset",em:T,runtime:R,renderer:S,controller:v,canvas:i,navigator:m,unmount(){xR(R),R.stopControllers(),R.stop(),R.reset(),T&&T.stop()}}}var pl=1+Number.MIN_VALUE,Qj=class{constructor(t,e){O(this,"container"),O(this,"width"),O(this,"height"),O(this,"pending",!0),O(this,"options"),O(this,"stylesheet"),O(this,"zIndex",0),O(this,"lastKnownScale",1),O(this,"rendererPosition"),O(this,"currentlyVisible",[]),O(this,"previouslyVisible",[]),this.container=t,this.rendererPosition=t.getBoundingClientRect();let{width:n,height:i}=this.rendererPosition;this.width=n,this.height=i,this.options={addPart:!1,setDraggableFalse:!1,imageClass:"",widthStylesheet:!1,sheetPrefix:"position-",background:"#000",...e||{}},this.stylesheet=new BI({sheetPrefix:this.options.sheetPrefix}),this.container.classList.add(this.stylesheet.addStylesheet(`
54
63
  background: ${this.options.background};
55
- `)),this.options.widthStylesheet&&this.container.appendChild(this.stylesheet.getElement())}isReady(){return!0}resize(){this.rendererPosition=this.container.getBoundingClientRect(),this.width=this.rendererPosition.width,this.height=this.rendererPosition.height}getRendererScreenPosition(){return this.rendererPosition}afterFrame(e,t,n){this.stylesheet.updateSheet();for(let i of this.previouslyVisible)this.currentlyVisible.indexOf(i)===-1&&this.container.removeChild(i);for(let i of this.currentlyVisible)this.previouslyVisible.indexOf(i)===-1&&this.container.appendChild(i);this.previouslyVisible=this.currentlyVisible,this.currentlyVisible=[]}afterPaintLayer(e,t){}beforeFrame(e,t,n){this.stylesheet.clearClasses(),this.zIndex=0}getPointsAt(e,t,n,i){return e.getPointsAt(t,n,i)}getScale(e,t){if(Number.isNaN(e)||Number.isNaN(t))return this.lastKnownScale;let n=this.width/e,i=this.height/t,r=n<i?i:n;return Number.isNaN(r)||(this.lastKnownScale=r),this.lastKnownScale}getViewportBounds(e,t,n){return null}createImage(){let e=document.createElement("img");return this.options.imageClass?(e.className=this.options.imageClass,this.options.addPart&&e.setAttribute("part",this.options.imageClass)):(e.style.position="absolute",e.style.pointerEvents="none",e.style.userSelect="none"),this.options.setDraggableFalse&&e.setAttribute("draggable","false"),e}paint(e,t,n,i,r,s){if(this.pending=!1,this.zIndex++,e instanceof zr){if(!e.__host){let u=this.createImage();u.src=e.uri,e.__host=u,this.container.appendChild(e.__host)}let l=e.__host;this.currentlyVisible.push(l),l.style.zIndex=`${this.zIndex}`,l.style.opacity=`${e.style.opacity}`,this.options.widthStylesheet?l.className=this.options.imageClass+" "+this.stylesheet.addStylesheet(`width:${(r+Fr).toFixed(2)}px;height:${(s+Fr).toFixed(2)}px;`):(l.style.width=`${r+Fr}px`,l.style.height=`${s+Fr}px`),l.style.transform=`translate(${n}px, ${i}px)`}if(e instanceof al){if(e.__host||(e.__host={images:[]}),!e.__host.images[t]){let u=e.getImageUrl(t),f=this.createImage();f.src=u,e.__host.images[t]=f,this.container.appendChild(f)}let l=e.__host.images[t];l.style.zIndex=`${this.zIndex}`,l.style.opacity=`${e.style.opacity}`,this.currentlyVisible.push(l),this.options.widthStylesheet?l.className=this.options.imageClass+" "+this.stylesheet.addStylesheet(`width:${(r+Fr).toFixed(2)}px;height:${(s+Fr).toFixed(2)}px;`):(l.style.width=`${r+Fr}px`,l.style.height=`${s+Fr}px`),l.style.transform=`translate(${n}px, ${i}px)`}}pendingUpdate(){return this.pending}prepareLayer(e){}finishLayer(e){}reset(){}};function KT({interactive:e,viewport:t,forceRefresh:n,containerElement:i,overlayElement:r,controllerConfig:s}){if(!i)throw new Error("Invalid container");i.style.userSelect="none";let l=e?y1({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1,parentElement:i,...s||{}}):void 0,u=new YT(i,{addPart:!1,setDraggableFalse:!1,imageClass:"atlas-static-image"}),f=r?new m1([u,new I1(r,{box:!0,text:!0,triggerResize:n})]):u,p=new xd(f,new vd(1024,1024),t,l?[l]:[]),c=new P1(i,p);return{name:"static-preset",em:c,runtime:p,renderer:f,controller:l,container:i,overlay:r,unmount(){rg(p),p.stopControllers(),p.stop(),c&&c.stop()}}}var XT={"default-preset":A1,"static-preset":KT},ZT={};function JT(e,t){let n=(0,oi.useRef)(),i=(0,oi.useRef)(),r=(0,oi.useRef)(),s=(0,oi.useRef)(),l=(0,oi.useRef)({width:t.width,height:t.height,didUpdate:!0}),[u="default-preset",f=ZT]=Array.isArray(e)?e||[]:[e],[p,c]=(0,oi.useState)(null);(0,oi.useLayoutEffect)(()=>{let y=i.current,w=s.current,v=n.current,S=r.current,E=(XT[u]||A1)({containerElement:w,canvasElement:y,overlayElement:v,navigatorElement:S,viewport:l.current,dpi:window.devicePixelRatio||1,forceRefresh:t.forceRefresh,unstable_webglRenderer:t.unstable_webglRenderer,...f||{}});return c(E),()=>{E&&(E.unmount(),y&&(y.height=0,y.width=0),v&&(v.innerHTML=""),S&&(S.height=0,S.width=0))}},[u,f]);let m=(0,oi.useMemo)(()=>({canvas:i,overlay:n,container:s,navigator:r}),[]);return[u,p,l,m]}function eM(e){return(0,T1.useMemo)(()=>Jm(e),e)}var nl=M1.default.forwardRef((e,t)=>(0,_1.jsx)("div",{...e,ref:t,part:e.className})),l1=["brightness","contrast","grayscale","hueRotate","invert","saturate","sepia","blur"],tM=({htmlChildren:e,renderPreset:t,onCreated:n,mode:i="explore",resetWorldOnChange:r=!0,unstable_webglRenderer:s=!1,unstable_noReconciler:l=!1,hideInlineStyle:u=!1,controllerConfig:f,children:p,overlayStyle:c,containerStyle:m,enableNavigator:y,className:w,containerProps:v={},homePosition:S,homeOnResize:E,homeCover:R,background:b,runtimeOptions:I,debug:M,filters:T,..._})=>{let[U,H]=(0,mt.useState)(i),[Z,B]=(0,mt.useState)(!1),G=(0,mt.useRef)(!1),K=(0,mt.useMemo)(()=>(typeof t=="string"&&(t=[t,{}]),M?t?[t[0],{debug:M,...t[1]||{}}]:["default-preset",{debug:M}]:t||"default-preset"),[t,M]),[ce,J,te]=Vc({scroll:!0}),oe=(0,mt.useRef)(),Re=fe=>{oe.current=fe,ce(fe)},[de,N,re,Le]=JT(K,{width:_.width,height:_.height,forceRefresh:te,unstable_webglRenderer:s}),[je,Ge]=(0,mt.useState)("");(0,mt.useEffect)(()=>{H(i)},[i]),(0,mt.useEffect)(()=>{N&&N.em&&N.em.updateBounds()},[N,J]),(0,mt.useEffect)(()=>{N?.runtime.setOptions(I||{})},[I]),(0,mt.useEffect)(()=>{N&&N.runtime&&(N.runtime.mode=U),Z&&N&&(N.ready=!0)},[N,Z,U]),(0,mt.useEffect)(()=>{N&&(R||(N.runtime.manualHomePosition=!!S,N.runtime.setHomePosition(S)))},[N,R,S]),(0,mt.useEffect)(()=>{if(N){let fe=N.runtime;fe.resize(re.current.width,_.width,re.current.height,_.height),re.current.width=_.width,re.current.height=_.height,fe.updateNextFrame(),re.current.didUpdate=!0}},[N,_.width,_.height]),(0,mt.useEffect)(()=>{if(T&&N){let fe=N.runtime,ae=!1;fe.hookOptions.enableFilters=!0;for(let De of l1)T[De]?T[De]!==N.runtime.hookOptions.filters[De]&&(fe.hookOptions.filters[De]=T[De],ae=!0):fe.hookOptions.filters[De]&&(fe.hookOptions.filters[De]=0,ae=!0);ae&&fe.updateNextFrame()}else if(N){let fe=N.runtime;for(let ae of l1)fe.hookOptions.filters[ae]=0;fe.hookOptions.enableFilters=!1,fe.updateNextFrame()}},[N,T]),sl(()=>{if(N&&(N.overlay&&(N.overlay.style.width=`${J.width}px`,N.overlay.style.height=`${J.height}px`),N.container&&(N.container.style.width=`${J.width}px`,N.container.style.height=`${J.height}px`),R)){let fe=N.runtime.world.width,ae=N.runtime.world.height,De=fe/ae,Rt=re.current.width,ui=re.current.height,un=Rt/ui;if(De>un){un=ui/Rt,N.runtime.manualHomePosition=!0;let Sn=(fe-ae/un)/2;R==="start"&&(Sn=0),R==="end"&&(Sn=fe-ae/un),N.runtime.setHomePosition({x:Sn,y:0,width:ae/un,height:ae})}else{let Sn=(ae-fe/un)/2;R==="start"&&(Sn=0),R==="end"&&(Sn=ae-fe/un),N.runtime.manualHomePosition=!0,N.runtime.setHomePosition({x:0,y:Sn,width:fe,height:fe/un})}E&&N.runtime.goHome({})}},[N,J.height,J.width,R]),sl(()=>{let fe=()=>{if(N){let ae=N.runtime;re.current.width!==_.width&&re.current.height!==_.height&&(ae.resize(re.current.width,_.width,re.current.height,_.height),re.current.width=_.width,re.current.height=_.height,ae.updateNextFrame(),re.current.didUpdate=!0)}};return window.addEventListener("resize",fe),()=>window.removeEventListener("resize",fe)},[N,_.height,_.width]);let $e={width:120},Qe=()=>{if(N&&N.navigator){let fe=N.runtime.world.height,ae=N.runtime.world.width,De=window.devicePixelRatio||1,Rt=$e.width,ui=$e.width/ae*fe;N.navigator.width=Rt*De,N.navigator.height=ui*De,N.navigator.style.width=Rt+"px",N.navigator.style.height=ui+"px"}};sl(()=>{if(N){Qe();let fe=N.runtime;return fe.world.addLayoutSubscriber(ae=>{ae==="recalculate-world-size"&&(Qe(),fe.resize(re.current.width,_.width,re.current.height,_.height))})}return()=>{}},[N,_.width,_.height]);let Ze=(0,mt.useCallback)(function(fe){let ae=()=>{B(!0)};return(0,mt.useEffect)(()=>{if(N){N.runtime.goHome();let De=n&&n(N);return void(De&&De.then?De.then(ae):ae())}else throw new Error("Invalid configuration - no runtime found")},[]),fe.children},[N]);(0,mt.useEffect)(()=>{if(N){let fe=N.runtime;if(r)return fe.world.addLayoutSubscriber(ae=>{ae==="recalculate-world-size"&&fe.goHome()})}return()=>{}},[N,r]),(0,mt.useEffect)(()=>N?N.runtime.registerHook("useBeforeFrame",()=>{if(re.current.didUpdate&&N.canvas){let fe=window.devicePixelRatio||1,ae=re.current.width,De=re.current.height;N.canvas.width=ae*fe,N.canvas.height=De*fe,N.canvas.style.width=ae+"px",N.canvas.style.height=De+"px",N.canvas.getContext("2d")?.scale(fe,fe),N&&N.em&&N.em.updateBounds(),re.current.didUpdate=!1}}):()=>{},[N,r]),(0,mt.useEffect)(()=>{let fe=()=>{N&&(H("sketch"),Ge("mode-sketch")),window.removeEventListener("keyup",fe)},ae=De=>{if(De.code==="Space"&&N&&N.runtime.mode==="sketch"){let Rt=De.target?.tagName?.toLowerCase();if(Rt==="input"||Rt==="textarea"||De.target?.isContentEditable)return;De.preventDefault(),H("explore"),Ge("mode-explore"),window.addEventListener("keyup",fe)}};return window.addEventListener("keydown",ae),()=>{window.removeEventListener("keydown",ae),window.removeEventListener("keyup",fe)}},[N]),G.current=!0;let{height:Ct,width:xt,...xn}=_,Pt=eM([_.width,_.height]),Ne=!0;return K&&Array.isArray(K)&&K.length>1&&K[1].interactive===!1&&(Ne=!1),b=b??"#000",oe.current&&(b=getComputedStyle(oe.current).getPropertyValue("--atlas-background")||b),(0,pn.jsxs)(nl,{ref:Re,className:["atlas",u?"":`atlas-width-${Pt}`,je,w,`atlas-${de}`].filter(Boolean).join(" ").trim(),style:{...m,...u?{}:{width:_.width,height:_.height}},children:[de==="static-preset"?(0,pn.jsx)(nl,{className:"atlas-static-container",ref:Le.container,tabIndex:0,...v}):(0,pn.jsx)("canvas",{className:"atlas-canvas",part:"atlas-canvas",tabIndex:0,...xn,...v,ref:Le.canvas,"data-background":b}),(0,pn.jsx)(nl,{className:["atlas-overlay",Ne?"atlas-overlay--interactive":""].filter(Boolean).join(" ").trim(),style:{...c||{}},ref:Le.overlay,children:l?(0,pn.jsx)(Ze,{children:(0,pn.jsx)(bd.Provider,{value:J,children:(0,pn.jsx)(Bs.Provider,{value:U,children:(0,pn.jsx)(wd.Provider,{value:N,children:p})})})}):(0,pn.jsx)($T,{bounds:J,preset:N,mode:U,setIsReady:B,onCreated:n,children:p})}),y?(0,pn.jsx)(nl,{className:"atlas-navigator",children:(0,pn.jsx)("canvas",{className:"atlas-navigator-canvas",part:"atlas-navigator-canvas",ref:Le.navigator})}):null,u?(0,pn.jsx)("style",{children:`.atlas-width-${Pt} { width: ${_.width}px; height: ${_.height}px; }`}):(0,pn.jsx)("style",{children:`
56
- .atlas { position: relative; display: flex; background: ${b}; z-index: var(--atlas-z-index, 10); -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
57
- .atlas-width-${Pt} { width: ${_.width}px; height: ${_.height}px; }
64
+ `)),this.options.widthStylesheet&&this.container.appendChild(this.stylesheet.getElement())}isReady(){return!0}resize(){this.rendererPosition=this.container.getBoundingClientRect(),this.width=this.rendererPosition.width,this.height=this.rendererPosition.height}getRendererScreenPosition(){return this.rendererPosition}afterFrame(t,e,n){this.stylesheet.updateSheet();for(let i of this.previouslyVisible)this.currentlyVisible.indexOf(i)===-1&&this.container.removeChild(i);for(let i of this.currentlyVisible)this.previouslyVisible.indexOf(i)===-1&&this.container.appendChild(i);this.previouslyVisible=this.currentlyVisible,this.currentlyVisible=[]}afterPaintLayer(t,e){}beforeFrame(t,e,n){this.stylesheet.clearClasses(),this.zIndex=0}getPointsAt(t,e,n,i){return t.getPointsAt(e,n,i)}getScale(t,e){if(Number.isNaN(t)||Number.isNaN(e))return this.lastKnownScale;let n=this.width/t,i=this.height/e,a=n<i?i:n;return Number.isNaN(a)||(this.lastKnownScale=a),this.lastKnownScale}getViewportBounds(t,e,n){return null}createImage(){let t=document.createElement("img");return this.options.imageClass?(t.className=this.options.imageClass,this.options.addPart&&t.setAttribute("part",this.options.imageClass)):(t.style.position="absolute",t.style.pointerEvents="none",t.style.userSelect="none"),this.options.setDraggableFalse&&t.setAttribute("draggable","false"),t}paint(t,e,n,i,a,o){if(this.pending=!1,this.zIndex++,t instanceof yl){if(!t.__host){let u=this.createImage();u.src=t.uri,t.__host=u,this.container.appendChild(t.__host)}let s=t.__host;this.currentlyVisible.push(s),s.style.zIndex=`${this.zIndex}`,s.style.opacity=`${t.style.opacity}`,this.options.widthStylesheet?s.className=this.options.imageClass+" "+this.stylesheet.addStylesheet(`width:${(a+pl).toFixed(2)}px;height:${(o+pl).toFixed(2)}px;`):(s.style.width=`${a+pl}px`,s.style.height=`${o+pl}px`),s.style.transform=`translate(${n}px, ${i}px)`}if(t instanceof mh){if(t.__host||(t.__host={images:[]}),!t.__host.images[e]){let u=t.getImageUrl(e),d=this.createImage();d.src=u,t.__host.images[e]=d,this.container.appendChild(d)}let s=t.__host.images[e];s.style.zIndex=`${this.zIndex}`,s.style.opacity=`${t.style.opacity}`,this.currentlyVisible.push(s),this.options.widthStylesheet?s.className=this.options.imageClass+" "+this.stylesheet.addStylesheet(`width:${(a+pl).toFixed(2)}px;height:${(o+pl).toFixed(2)}px;`):(s.style.width=`${a+pl}px`,s.style.height=`${o+pl}px`),s.style.transform=`translate(${n}px, ${i}px)`}}pendingUpdate(){return this.pending}prepareLayer(t){}finishLayer(t){}reset(){}};function Xj({interactive:t,viewport:e,forceRefresh:n,containerElement:i,overlayElement:a,controllerConfig:o}){if(!i)throw new Error("Invalid container");i.style.userSelect="none";let s=t?MI({minZoomFactor:.5,maxZoomFactor:3,enableClickToZoom:!1,parentElement:i,...o||{}}):void 0,u=new Qj(i,{addPart:!1,setDraggableFalse:!1,imageClass:"atlas-static-image"}),d=a?new wI([u,new PI(a,{box:!0,text:!0,triggerResize:n})]):u,p=new tv(d,new $y(1024,1024),e,s?[s]:[]),f=new UI(i,p);return{name:"static-preset",em:f,runtime:p,renderer:d,controller:s,container:i,overlay:a,unmount(){xR(p),p.stopControllers(),p.stop(),f&&f.stop()}}}var Kj={"default-preset":VI,"static-preset":Xj},Zj={};function Jj(t,e){let n=(0,Na.useRef)(),i=(0,Na.useRef)(),a=(0,Na.useRef)(),o=(0,Na.useRef)(),s=(0,Na.useRef)({width:e.width,height:e.height,didUpdate:!0}),[u="default-preset",d=Zj]=Array.isArray(t)?t||[]:[t],[p,f]=(0,Na.useState)(null);(0,Na.useLayoutEffect)(()=>{let g=i.current,v=o.current,S=n.current,R=a.current,T=(Kj[u]||VI)({containerElement:v,canvasElement:g,overlayElement:S,navigatorElement:R,viewport:s.current,dpi:window.devicePixelRatio||1,forceRefresh:e.forceRefresh,unstable_webglRenderer:e.unstable_webglRenderer,...d||{}});return f(T),()=>{T&&(T.unmount(),g&&(g.height=0,g.width=0),S&&(S.innerHTML=""),R&&(R.height=0,R.width=0))}},[u,d]);let m=(0,Na.useMemo)(()=>({canvas:i,overlay:n,container:o,navigator:a}),[]);return[u,p,s,m]}function Wj(t){return(0,jI.useMemo)(()=>hR(t),t)}var ch=qI.default.forwardRef((t,e)=>(0,FI.jsx)("div",{...t,ref:e,part:t.className}));function $j(t,e){let n={},i=new Set([...Object.keys(t),...Object.keys(e)]);for(let a of i){let o=t[a],s=e[a];o!==s&&(n[a]={before:o,after:s})}return Object.keys(n).length>0?n:null}function tq(t,e="",n=!1){let i=(0,GI.useRef)(t);i.current&&n&&(console.log("Diff:",e,$j(i.current,t)),i.current=t)}var yI=["brightness","contrast","grayscale","hueRotate","invert","saturate","sepia","blur"],eq=(0,ze.memo)(function(t){let{htmlChildren:e,renderPreset:n,onCreated:i,mode:a="explore",resetWorldOnChange:o=!0,unstable_webglRenderer:s=!1,unstable_noReconciler:u=!1,hideInlineStyle:d=!1,controllerConfig:p,children:f,overlayStyle:m,containerStyle:g,enableNavigator:v,className:S,containerProps:R={},homePosition:T,homeOnResize:E,homeCover:x,background:A,runtimeOptions:C,debug:M,filters:I,...z}=t;tq(t,"Atlas.tsx",t.debug);let[D,k]=(0,ze.useState)(a),[B,Q]=(0,ze.useState)(!1),it=(0,ze.useRef)(!1),lt=(0,ze.useMemo)(()=>(typeof n=="string"&&(n=[n,{}]),M?n?[n[0],{debug:M,...n[1]||{}}]:["default-preset",{debug:M}]:n||"default-preset"),[n,M]),[et,$,ht]=Km({scroll:!0}),bt=(0,ze.useRef)(),st=Et=>{bt.current=Et,et(Et)},[rt,Y,At,Qt]=Jj(lt,{width:z.width,height:z.height,forceRefresh:ht,unstable_webglRenderer:s}),[ce,se]=(0,ze.useState)("");(0,ze.useEffect)(()=>{k(a)},[a]),(0,ze.useEffect)(()=>{Y&&Y.em&&Y.em.updateBounds()},[Y,$]),(0,ze.useEffect)(()=>{Y?.runtime.setOptions(C||{})},[C]),(0,ze.useEffect)(()=>{Y&&Y.runtime&&(Y.runtime.mode=D),B&&Y&&(Y.ready=!0)},[Y,B,D]),(0,ze.useEffect)(()=>{Y&&(x||(Y.runtime.manualHomePosition=!!T,Y.runtime.setHomePosition(T)))},[Y,x,T]),(0,ze.useEffect)(()=>{if(Y){let Et=Y.runtime;Et.resize(At.current.width,z.width,At.current.height,z.height),At.current.width=z.width,At.current.height=z.height,Et.updateNextFrame(),At.current.didUpdate=!0}},[Y,z.width,z.height,At]),(0,ze.useEffect)(()=>{if(I&&Y){let Et=Y.runtime,Tt=!1;Et.hookOptions.enableFilters=!0;for(let Vt of yI)I[Vt]?I[Vt]!==Y.runtime.hookOptions.filters[Vt]&&(Et.hookOptions.filters[Vt]=I[Vt],Tt=!0):Et.hookOptions.filters[Vt]&&(Et.hookOptions.filters[Vt]=0,Tt=!0);Tt&&Et.updateNextFrame()}else if(Y){let Et=Y.runtime;for(let Tt of yI)Et.hookOptions.filters[Tt]=0;Et.hookOptions.enableFilters=!1,Et.updateNextFrame()}},[Y,I]);function ae(){if(Y&&(Y.overlay&&(Y.overlay.style.width=`${$.width}px`,Y.overlay.style.height=`${$.height}px`),Y.container&&(Y.container.style.width=`${$.width}px`,Y.container.style.height=`${$.height}px`),x)){let Et=Y.runtime.world.width,Tt=Y.runtime.world.height,Vt=Et/Tt,Pn=At.current.width,yi=At.current.height,bn=Pn/yi;if(Vt>bn){bn=yi/Pn,Y.runtime.manualHomePosition=!0;let ln=(Et-Tt/bn)/2;x==="start"&&(ln=0),x==="end"&&(ln=Et-Tt/bn);let ai={x:ln,y:0,width:Tt/bn,height:Tt};Y.runtime.setHomePosition(ai)}else{let ln=(Tt-Et/bn)/2;x==="start"&&(ln=0),x==="end"&&(ln=Tt-Et/bn),Y.runtime.manualHomePosition=!0;let ai={x:0,y:ln,width:Et,height:Et/bn};Y.runtime.setHomePosition(ai)}E&&Y.runtime.goHome({})}}ph(()=>{ae()},[Y,t.runtimeOptions?.maxOverZoom,$.height,$.width,x]),ph(()=>{let Et=()=>{if(Y){let Tt=Y.runtime;At.current.width!==z.width&&At.current.height!==z.height&&(Tt.resize(At.current.width,z.width,At.current.height,z.height),At.current.width=z.width,At.current.height=z.height,Tt.updateNextFrame(),At.current.didUpdate=!0)}};return window.addEventListener("resize",Et),()=>window.removeEventListener("resize",Et)},[Y,z.height,z.width]);let me={width:120},Ie=()=>{if(Y&&Y.navigator){let Et=Y.runtime.world.height,Tt=Y.runtime.world.width,Vt=window.devicePixelRatio||1,Pn=me.width,yi=me.width/Tt*Et;Y.navigator.width=Pn*Vt,Y.navigator.height=yi*Vt,Y.navigator.style.width=Pn+"px",Y.navigator.style.height=yi+"px"}};ph(()=>{if(Y){Ie();let Et=Y.runtime;return Et.world.addLayoutSubscriber(Tt=>{Tt==="recalculate-world-size"&&(Ie(),ae(),Et.resize(At.current.width,z.width,At.current.height,z.height))})}return()=>{}},[Y,z.width,z.height]);let oe=(0,ze.useCallback)(function(Et){let Tt=()=>{Q(!0)};return(0,ze.useEffect)(()=>{if(Y){Y.runtime.goHome();let Vt=i&&i(Y);return void(Vt&&Vt.then?Vt.then(Tt):Tt())}else throw new Error("Invalid configuration - no runtime found")},[]),Et.children},[Y]);(0,ze.useEffect)(()=>{if(Y){let Et=Y.runtime;if(o)return Et.world.addLayoutSubscriber(Tt=>{Tt==="recalculate-world-size"&&Et.goHome()})}return()=>{}},[Y,o]),(0,ze.useEffect)(()=>Y?Y.runtime.registerHook("useBeforeFrame",()=>{if(At.current.didUpdate&&Y.canvas){let Et=window.devicePixelRatio||1,Tt=At.current.width,Vt=At.current.height;Y.canvas.width=Tt*Et,Y.canvas.height=Vt*Et,Y.canvas.style.width=Tt+"px",Y.canvas.style.height=Vt+"px",Y.canvas.getContext("2d")?.scale(Et,Et),Y&&Y.em&&Y.em.updateBounds(),At.current.didUpdate=!1}}):()=>{},[Y,o]),(0,ze.useEffect)(()=>{let Et=()=>{Y&&(k("sketch"),se("mode-sketch")),window.removeEventListener("keyup",Et)},Tt=Vt=>{if(Vt.code==="Space"&&Y&&Y.runtime.mode==="sketch"){let Pn=Vt.target?.tagName?.toLowerCase();if(Pn==="input"||Pn==="textarea"||Vt.target?.isContentEditable)return;Vt.preventDefault(),k("explore"),se("mode-explore"),window.addEventListener("keyup",Et)}};return window.addEventListener("keydown",Tt),()=>{window.removeEventListener("keydown",Tt),window.removeEventListener("keyup",Et)}},[Y]),it.current=!0;let{height:da,width:ii,...fe}=z,ue=Wj([z.width,z.height]),$t=!0;return lt&&Array.isArray(lt)&&lt.length>1&&lt[1].interactive===!1&&($t=!1),A=A??"#000",bt.current&&(A=getComputedStyle(bt.current).getPropertyValue("--atlas-background")||A),(0,di.jsxs)(ch,{ref:st,className:["atlas",d?"":`atlas-width-${ue}`,ce,S,`atlas-${rt}`].filter(Boolean).join(" ").trim(),style:{...g,...d?{}:{width:z.width,height:z.height}},children:[rt==="static-preset"?(0,di.jsx)(ch,{className:"atlas-static-container",ref:Qt.container,tabIndex:0,...R}):(0,di.jsx)("canvas",{className:"atlas-canvas",part:"atlas-canvas",tabIndex:0,...fe,...R,ref:Qt.canvas,"data-background":A}),(0,di.jsx)(ch,{className:["atlas-overlay",$t?"atlas-overlay--interactive":""].filter(Boolean).join(" ").trim(),style:{...m||{}},ref:Qt.overlay,children:u?(0,di.jsx)(oe,{children:(0,di.jsx)(ov.Provider,{value:$,children:(0,di.jsx)(jc.Provider,{value:D,children:(0,di.jsx)(av.Provider,{value:Y,children:f})})})}):(0,di.jsx)(kj,{bounds:$,preset:Y,mode:D,setIsReady:Q,onCreated:i,children:f})}),v?(0,di.jsx)(ch,{className:"atlas-navigator",children:(0,di.jsx)("canvas",{className:"atlas-navigator-canvas",part:"atlas-navigator-canvas",ref:Qt.navigator})}):null,d?(0,di.jsx)("style",{children:`.atlas-width-${ue} { width: ${z.width}px; height: ${z.height}px; }`}):(0,di.jsx)("style",{children:`
65
+ .atlas { position: relative; display: flex; background: ${A}; z-index: var(--atlas-z-index, 10); -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
66
+ .atlas-width-${ue} { width: ${z.width}px; height: ${z.height}px; }
58
67
  .atlas-canvas { flex: 1 1 0px; }
59
68
  .atlas-canvas:focus, .atlas-static-container:focus { outline: none }
60
69
  .atlas-canvas:focus-visible, .atlas-canvas-container:focus-visible { outline: var(--atlas-focus, 2px solid darkorange) }
@@ -66,15 +75,16 @@ No matching component was found for:
66
75
  .atlas-static-image { position: absolute; user-select: none; transform-origin: 0px 0px; }
67
76
  .atlas-navigator { position: absolute; top: var(--atlas-navigator-top, 10px); right: var(--atlas-navigator-bottom, 10px); left: var(--atlas-navigator-left); bottom: var(--atlas-navigator-bottom); opacity: .8 }
68
77
  .atlas-navigator-canvas { width: 100%; }
69
- `}),e]})};function nM(e){return Number(e)==e?`${e}px`:e}var O1=({resizeHash:e,aspectRatio:t,containerProps:n={},...i})=>{let[r,s,l]=Vc(),{height:u,width:f,...p}=i;(0,Ed.useEffect)(()=>{l()},[f,u,e,l]);let c=(0,Ed.useMemo)(()=>t?{width:s.width,height:s.width*(1/t)}:s,[s,t]);return(0,ll.jsxs)(nl,{ref:r,className:"atlas-container",...n,children:[c.width?(0,ll.jsx)(tM,{width:c.width||100,height:c.height||100,...p,children:i.children}):null,i.hideInlineStyle?null:(0,ll.jsx)("style",{children:`
70
- .atlas-container {
78
+ `}),e]})});function nq(t){return Number(t)==t?`${t}px`:t}var kI=(0,qc.memo)(function({resizeHash:t,aspectRatio:e,containerProps:n={},htmlChildren:i,...a}){let[o,s,u]=Km(),{height:d,width:p,...f}=a;(0,qc.useEffect)(()=>{u()},[p,d,t,u]);let m=(0,qc.useMemo)(()=>e?{width:s.width,height:s.width*(1/e)}:s,[s,e]);return(0,gh.jsxs)(ch,{ref:o,className:"atlas-container",...n,children:[m.width?(0,gh.jsx)(eq,{width:m.width||100,height:m.height||100,...f,children:a.children}):null,a.hideInlineStyle?null:(0,gh.jsx)("style",{children:`
79
+ .atlas-container {
71
80
  display: var(--atlas-container-display, block);
72
81
  flex: var(--atlas-container-flex, none);
73
- width: var(--atlas-container-width, ${f?`${f}px`:"100%"});
74
- height: var(--atlas-container-height, ${nM(u||(t?c.height:512))})
82
+ width: var(--atlas-container-width, ${p?`${p}px`:"100%"});
83
+ height: var(--atlas-container-height, ${nq(d||(e?m.height:512))})
75
84
  }
76
- `}),i.htmlChildren]})},Id=()=>(0,k1.useContext)(wd),Cd=()=>{let e=Id();return e?e.runtime:void 0};var F1=(e,t=[])=>{let n=Cd();(0,L1.useEffect)(()=>n?n.registerHook("useFrame",e):()=>{},t)},Pd=()=>{let e=Id();return e&&e.canvas?e.canvas:void 0};function rM(){return(0,N1.useContext)(bd)}async function oM(e,t,n){if(z1.version.startsWith("18.")){let i=await Promise.resolve().then(()=>A(Kw(),1)),r=i.default?i.default.createRoot:i.createRoot;n.current||(n.current=r(e)),n.current.render(t)}else if(typeof ReactDOM<"u"){let{render:i,unmountComponentAtNode:r}=ReactDOM;i(t,e),n.current={unmount(){r(e)}}}else{let i=await Promise.resolve().then(()=>A(Oo(),1)),r=i.default?i.default.render:i.render,s=i.default?i.default.unmountComponentAtNode:i.unmountComponentAtNode;r(t,e),n.current={unmount(){s(e)}}}}var jn=Wi.default.forwardRef(({children:e,...t},n)=>{let i=(0,Wi.useRef)(),r=Cd(),s=(0,Wi.useRef)(0),l=(0,Wi.useRef)(),u=(0,Wi.useRef)();return F1(()=>{if(t.relative){let f=i.current;if(f&&r){let p=r.getScaleFactor();s.current!==p&&(s.current=p,f.style.transformOrigin="0 0",f.style.transform=`scale(${1/s.current})`,f.style.width=`${s.current*100}%`,f.style.height=`${s.current*100}%`,i.current&&l.current?.__owner.value?.rotation&&(f.style.transform=`scale(${1/s.current}) translate(50%, 50%) rotate(${l.current?.__owner.value?.rotation||0}deg) translate(-50%, -50%)`))}}},[t.relative]),(0,Wi.useLayoutEffect)(()=>{let f=l.current;n&&f&&(typeof n=="function"?n(f):n.current=f);async function p(){if(f&&f.__host){let c=t.relative?(0,eg.jsx)("div",{ref:i,children:e}):e;await oM(f.__host.element,c,u)}}f&&f.__host?p():f&&(f.__onCreate=p)},[n,e,l,t.relative]),(0,Wi.useLayoutEffect)(()=>()=>{u.current&&setTimeout(()=>{u.current.unmount()},0)},[]),(0,eg.jsx)("box",{html:!0,...t,ref:l})});jn.displayName="HTMLPortal";var u1=(e,t,n=[])=>{let i=Cd(),r=i?i.world:void 0;(0,B1.useEffect)(()=>{if(i){let s=t,l=Ds[e];i.world.activatedEvents.push(l);let u=l.slice(2).toLowerCase();return i.world.addEventListener(u,s),()=>{i.world.removeEventListener(u,s)}}return()=>{}},[r,e,...n])};function c1(e,t){if(e===0)return[0,1];if(t===0)return[1,0];let n=Math.abs(e)/Math.abs(t);return[n,1-n]}function sM(){let e=(0,Ad.useRef)({ctrl:!1,shift:!1,alt:!1});return(0,Ad.useLayoutEffect)(()=>{function t(i){i.key==="Shift"&&(e.current.shift=!0),i.key==="Control"&&(e.current.ctrl=!0),i.key==="Alt"&&(e.current.alt=!0)}function n(i){i.key==="Shift"&&(e.current.shift=!1),i.key==="Control"&&(e.current.ctrl=!1),i.key==="Alt"&&(e.current.alt=!1)}return window.addEventListener("keydown",t),window.addEventListener("keyup",n),()=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",n)}},[]),e}var aM=(e,t)=>{let n=VT(),i=Cd(),r=rM(),s=(0,Vt.useRef)(),l=(0,Vt.useRef)(null),u=(0,Vt.useRef)(),[f,p]=(0,Vt.useState)(!1),c=(0,Vt.useRef)(!1),m=(0,Vt.useRef)({north:0,south:0,east:0,west:0}),y=sM(),w=(0,Vt.useCallback)(b=>I=>{if(c.current=!0,p(!0),r&&i){let{top:M,left:T}=r,_=i.viewerToWorld(I.pageX-T,I.pageY-M);u.current={x:_.x,y:_.y},s.current=b}},[r,i]),v=(0,Vt.useMemo)(()=>e.width/e.height,[e.width,e.height]),S=(0,Vt.useCallback)(b=>{if(!Math.abs(b.north-b.south+(b.east-b.west)))return;let I=-b.west+b.east,M=-b.north+b.south,T=e.width+I,_=e.height+M;if(T/_>=v){let U=_*v,H=T-U,[Z,B]=c1(b.east,b.west);b.west=b.west+H*B,b.east=b.east-H*Z}else{let U=T/v,H=_-U,[Z,B]=c1(b.north,b.south);b.north=b.north+H*Z,b.south=b.south-H*B}},[e.width,e.height,v]);F1(()=>{u&&i&&i.updateNextFrame()}),(0,Vt.useEffect)(()=>{i&&i.updateNextFrame()},[i,f]);let E=(0,Vt.useCallback)(b=>{if(!i||!r||i.mode!=="sketch")return;let{top:I,left:M}=r,T=i.viewerToWorld(b.pageX-M,b.pageY-I),_=l.current,U=!e.maintainAspectRatio&&y.current.alt,H=!U&&y.current.shift&&s.current?.indexOf("-")!==-1;if((s.current==="translate"||s.current==="east"||s.current==="north-east"||s.current==="south-east")&&(m.current.east=T.x-(u.current?u.current.x:0),U&&(m.current.west=-m.current.east)),(s.current==="translate"||s.current==="west"||s.current==="north-west"||s.current==="south-west")&&(m.current.west=T.x-(u.current?u.current.x:0),U&&(m.current.east=-m.current.west)),(s.current==="translate"||s.current==="north"||s.current==="north-east"||s.current==="north-west")&&(m.current.north=T.y-(u.current?u.current.y:0),U&&(m.current.south=-m.current.north)),(s.current==="translate"||s.current==="south"||s.current==="south-west"||s.current==="south-east")&&(m.current.south=T.y-(u.current?u.current.y:0),U&&(m.current.north=-m.current.south)),(e.maintainAspectRatio||H)&&S(m.current),_){let Z=m.current.west,B=m.current.north,G=e.width+m.current.east,K=e.height+m.current.south;_.points[1]=Math.min(Z,G),_.points[2]=Math.min(B,K),_.points[3]=Math.max(Z,G),_.points[4]=Math.max(B,K),i.updateNextFrame()}},[i,e.width,e.height,e.maintainAspectRatio,r]);u1("mousemove",E,[e.width,e.height,r]),u1("pointermove",E,[e.width,e.height,r]);let R=(0,Vt.useRef)();return(0,Vt.useEffect)(()=>{R.current=()=>{if(c.current){let b=m.current.west,I=m.current.north,M=e.width+m.current.east,T=e.height+m.current.south,_=Math.min(b,M),U=Math.min(I,T),H=Math.max(b,M),Z=Math.max(I,T),B={x:(e.x||0)+_,y:(e.y||0)+U,width:H-_||1,height:Z-U||1};e.maintainAspectRatio,t(B),s.current=void 0,u.current=void 0,m.current.east=0,m.current.west=0,m.current.north=0,m.current.south=0,c.current=!1,p(!1)}}},[t,e.height,e.width,e.x,e.y]),(0,Vt.useEffect)(()=>{let b=()=>{R.current&&R.current()};return window.addEventListener("pointerup",b),window.addEventListener("touchend",b),()=>{window.removeEventListener("pointerup",b),window.removeEventListener("touchend",b)}},[]),{portalRef:l,mode:n,mouseEvent:w,onPointerMoveCallback:E,isEditing:f}};function lM({handleSize:e,resizable:t,onSave:n,children:i,maintainAspectRatio:r,disableCardinalControls:s,...l}){let u=typeof e>"u"?r?10:8:e,{portalRef:f,mode:p,mouseEvent:c,isEditing:m}=aM({x:l.x||0,y:l.y||0,width:l.width,height:l.height,maintainAspectRatio:r},n),y=(0,Hi.useMemo)(()=>c("translate"),[c]),w=(0,Hi.useMemo)(()=>c("east"),[c]),v=(0,Hi.useMemo)(()=>c("west"),[c]),S=(0,Hi.useMemo)(()=>c("south"),[c]),E=(0,Hi.useMemo)(()=>c("north"),[c]),R=(0,Hi.useMemo)(()=>c("south-east"),[c]),b=(0,Hi.useMemo)(()=>c("south-west"),[c]),I=(0,Hi.useMemo)(()=>c("north-east"),[c]),M=(0,Hi.useMemo)(()=>c("north-west"),[c]),T=p==="sketch",_={zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.2)",border:"1px solid rgba(155,155,155,.7)",borderRadius:r||s?"50%":2,position:"absolute",background:"#fff",pointerEvents:m?"none":T?"initial":"none"};return(0,_t.jsx)(_t.Fragment,{children:(0,_t.jsxs)("world-object",{...l,children:[i,T&&t?(0,_t.jsx)(jn,{ref:f,target:{x:0,y:0,height:l.height,width:l.width},relative:!0,interactive:!1,children:T&&t?(0,_t.jsxs)(_t.Fragment,{children:[(0,_t.jsx)("div",{onMouseDown:y,onTouchStart:y,style:{display:"block",width:"100%",height:"100%",position:"relative",border:"1px solid rgba(155,155,155, .7)",boxSizing:"border-box",pointerEvents:m?"none":T?"initial":"none"}}),r?null:(0,_t.jsxs)(_t.Fragment,{children:[(0,_t.jsx)("div",{title:"east",onTouchStart:w,onMouseDown:w,style:{..._,cursor:"e-resize",height:u*2,width:u,right:0,top:"50%",opacity:s?0:1,transform:`translate(${u/2}px, -${u}px)`}}),(0,_t.jsx)("div",{title:"west",onMouseDown:v,style:{..._,cursor:"w-resize",position:"absolute",height:u*2,width:u,left:0,top:"50%",opacity:s?0:1,transform:`translate(-${u/2}px, -${u}px)`}}),(0,_t.jsx)("div",{title:"north",onMouseDown:E,style:{..._,cursor:"n-resize",position:"absolute",height:u,width:u*2,left:"50%",top:0,opacity:s?0:1,transform:`translate(-${u}px, -${u/2}px)`}}),(0,_t.jsx)("div",{title:"south",onMouseDown:S,style:{..._,cursor:"s-resize",position:"absolute",height:u,width:u*2,left:"50%",bottom:0,opacity:s?0:1,transform:`translate(-${u}px, ${u/2}px)`}})]}),(0,_t.jsx)("div",{title:"north-east",onMouseDown:I,style:{..._,cursor:"ne-resize",position:"absolute",height:u,width:u,right:0,top:0,transform:`translate(${u/2}px, -${u/2}px)`}}),(0,_t.jsx)("div",{title:"south-east",onMouseDown:R,style:{..._,cursor:"se-resize",position:"absolute",height:u,width:u,bottom:0,right:0,transform:`translate(${u/2}px, ${u/2}px)`}}),(0,_t.jsx)("div",{title:"south-west",onMouseDown:b,style:{..._,cursor:"sw-resize",position:"absolute",height:u,width:u,bottom:0,left:0,transform:`translate(-${u/2}px, ${u/2}px)`}}),(0,_t.jsx)("div",{title:"north-west",onMouseDown:M,style:{..._,cursor:"nw-resize",position:"absolute",height:u,width:u,top:0,left:0,transform:`translate(-${u/2}px, -${u/2}px)`}})]}):null}):null]})})}function V1({interactive:e,region:t,onClick:n,onSave:i,maintainAspectRatio:r,disableCardinalControls:s,isEditing:l,rotation:u,style:f={backgroundColor:"rgba(0,0,0,.5)"}}){let p=(0,D1.useCallback)(c=>{i({id:t.id,x:t.x,y:t.y,height:t.height,width:t.width,...c})},[i,t.id,t.x,t.y,t.height,t.width]);return(0,tg.jsx)(lM,{x:t.x,y:t.y,rotation:u,width:t.width,height:t.height,resizable:l,onSave:p,maintainAspectRatio:r,disableCardinalControls:s,children:(0,tg.jsx)("box",{interactive:e,onContextMenu:c=>{c.preventDefault(),console.log("menu!")},onClick:c=>{c.preventDefault(),c.stopPropagation(),n(t)},target:{x:0,y:0,width:t.width,height:t.height},style:f})})}function sg(e,t){return e?t?{...e,...t||{},":hover":e[":hover"]?Object.assign(e[":hover"]||{},t[":hover"]||{}):t[":hover"],":active":e[":active"]?Object.assign(e[":active"]||{},t[":active"]||{}):t[":hover"]}:e:t}var or=A(Q(),1);function Ei(e){return{all:e=e||new Map,on:function(t,n){var i=e.get(t);i?i.push(n):e.set(t,[n])},off:function(t,n){var i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var i=e.get(t);i&&i.slice().map(function(r){r(n)}),(i=e.get("*"))&&i.slice().map(function(r){r(t,n)})}}}var ko=A(Q(),1),U1=A(D(),1),pM=Ei(),Td=(0,ko.createContext)(pM);function mM({children:e,emitter:t}){return(0,U1.jsx)(Td.Provider,{value:t,children:e})}function ag(){return(0,ko.useContext)(Td)}function Lo(e,t,n=[]){let i=(0,ko.useContext)(Td);(0,ko.useEffect)(()=>{let r=s=>{t(s)};return i.on(e,r),()=>{i.off(e,r)}},[i,e,...n])}function gM(e){return{all:e=e||new Map,on:function(t,n){var i=e.get(t);i?i.push(n):e.set(t,[n])},off:function(t,n){var i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var i=e.get(t);i&&i.slice().map(function(r){r(n)}),(i=e.get("*"))&&i.slice().map(function(r){r(t,n)})}}}function yM(e,t,n){let[i,r]=e,[s,l]=t,[u,f]=n,p=u-s,c=f-l,m=Math.sqrt(p*p+c*c);if(m===0)return{distance:Math.sqrt((i-s)**2+(r-l)**2),closestPoint:[s,l]};let y=Math.max(0,Math.min(1,((i-s)*p+(r-l)*c)/(m*m))),w=s+y*p,v=l+y*c,S=[w,v];return{distance:Math.sqrt((i-w)**2+(r-v)**2),closestPoint:S}}function vM(e,t,n,i){let[r,s]=e,[l,u]=t,[f,p]=n,[c,m]=i,y=(r-l)*(p-m)-(s-u)*(f-c);if(Math.abs(y)<1e-10)return null;let w=((r-f)*(p-m)-(s-p)*(f-c))/y,v=-((r-l)*(s-p)-(s-u)*(r-f))/y;if(w>=0&&w<=1&&v>=0&&v<=1){let S=r+w*(l-r),E=s+w*(u-s);return[S,E]}return null}function xM(e,t,n){let i=n||t.snapThreshold||15,r=[],[s,l]=e,u=t.polygon.points,f=t.slowState.transitionIntentType==="move-point";if(t.slowState.snapToPoints)for(let p=0;p<u.length;p++){if(f&&t.selectedPoints.includes(p))continue;let c=u[p];if(c[0]===s&&c[1]===l)continue;let m=c[0]-s,y=c[1]-l,w=Math.sqrt(m*m+y*y);w<=i&&r.push({type:"point",point:[c[0],c[1]],source:{pointIndex:p,polygon:t.polygon},distance:w})}if(t.slowState.snapToLines)for(let p=0;p<u.length;p++){if(f&&t.selectedPoints.includes(p))continue;let c=(p+1)%u.length;if(p===c)continue;let m=u[p],y=u[c],{distance:w,closestPoint:v}=yM(e,m,y);w<=i&&r.push({type:"line",point:v,source:{lineIndex:p,polygon:t.polygon},distance:w})}if(t.slowState.snapToIntersections&&u.length>=4)for(let p=0;p<u.length;p++){if(f&&t.selectedPoints.includes(p))continue;let c=(p+1)%u.length,m=u[p],y=u[c];for(let w=p+2;w<u.length;w++){if(f&&t.selectedPoints.includes(w))continue;let v=(w+1)%u.length;if(w===c||v===p)continue;let S=u[w],E=u[v],R=vM(m,y,S,E);if(R){let[b,I]=R,M=Math.sqrt((s-b)**2+(l-I)**2);M<=i&&r.push({type:"intersection",point:R,source:{lineIndex:p,polygon:t.polygon},distance:M})}}}if(t.slowState.snapToParallel)for(let p=0;p<u.length;p++){if(f&&t.selectedPoints.includes(p))continue;let c=u[p],[m,y]=c,w=Math.abs(l-y);w<=i&&r.push({type:"parallel",point:[s,y],source:{pointIndex:p,polygon:t.polygon},distance:w});let v=Math.abs(s-m);v<=i&&r.push({type:"parallel",point:[m,l],source:{pointIndex:p,polygon:t.polygon},distance:v})}return r.sort((p,c)=>p.distance-c.distance)}function SM(e){return e.sort((t,n)=>{let i=t.type==="point"?0:t.type==="intersection"?1:t.type==="parallel"?2:3,r=n.type==="point"?0:n.type==="intersection"?1:n.type==="parallel"?2:3;return i!==r?i-r:t.distance-n.distance})}function wM(e,t){let n=[];for(let i of e)switch(i.type){case"point":n.push({type:"point",points:[i.point],target:i});break;case"line":if(i.source?.lineIndex!==void 0){let r=t.polygon.points,s=i.source.lineIndex,l=(s+1)%r.length,u=r[s],f=r[l];n.push({type:"line",points:[u,f,i.point],target:i})}else n.push({type:"point",points:[i.point],target:i});break;case"intersection":n.push({type:"cross",points:[i.point],target:i});break;case"parallel":if(i.source?.pointIndex!==void 0){let r=t.polygon.points[i.source.pointIndex];n.push({type:"parallel-line",points:[r,i.point],target:i})}break}return n}function Dr(e,t,n=5,i){if(!t.slowState.snapEnabled)return t.snapTargets=[],t.activeSnapGuides=[],t.isSnapping=!1,t.snapPoint=null,null;let r=xM(e,t,void 0);if(r.length===0)return t.snapTargets=[],t.activeSnapGuides=[],t.isSnapping=!1,t.snapPoint=null,null;let s=SM(r);return t.snapTargets=s,t.activeSnapGuides=wM(s.slice(0,n),t),t.isSnapping=!0,t.snapPoint=s[0].point,t.snapPoint}function Y1(e){e.snapTargets=[],e.activeSnapGuides=[],e.isSnapping=!1,e.snapPoint=null}function bM(e){return e.isSnapping&&e.snapPoint!==null}function pl(e,t){return bM(t)&&t.snapPoint?t.snapPoint:e}var RM={type:"add-open-point",label:"Add point",tools:["pen","line","lineBox"],trigger:{type:"click"},isValid(e,t,n){if(!t.isOpen)return!1;if(t.polygon.points.length===0)return!0;if(t.selectedPoints.length!==1||t.polygon.points.length>=2&&(t.slowState.currentTool==="line"||t.slowState.currentTool==="lineBox"))return!1;if(t.slowState.bounds){let{x:r,y:s,width:l,height:u}=t.slowState.bounds,[f,p]=e[0];if(f<r||f>r+l||p<s||p>s+u)return!1}let i=t.selectedPoints[0];return i===0||i===t.polygon.points.length-1},commit(e,t,n){let i=t.line?t.line[1]:e[0];!n.Shift&&t.slowState.snapEnabled&&(Dr(i,t,3),i=pl(i,t));let r=t.polygon.points;if(r.length===0)return{selectedPoints:[0],points:[i]};n.Shift;let s=t.selectedPoints[0],l=t.slowState.currentTool==="line"||t.slowState.currentTool==="lineBox";if(s===0)return~~r[0][0]===~~i[0]&&~~r[0][1]===~~i[1]?{selectedPoints:[0],points:r}:{selectedPoints:l?[]:[0],points:[i,...r]};let u=r[r.length-1];return~~u[0]===~~i[0]&&~~u[1]===~~i[1]?{selectedPoints:[r.length-1],points:r}:(t.line=null,{selectedPoints:l?[]:[r.length],points:[...r,i]})}};function q1(e,t){return Math.abs(e-t)}function Hn(e,t){let n=q1(e[0],t[0]),i=q1(e[1],t[1]);return Math.sqrt(n**2+i**2)}function lg(e,t){return[e[0]-t[0],e[1]-t[1]]}function EM(e,t){return e[0]*t[0]+e[1]*t[1]}function K1(e){return e[0]*e[0]+e[1]*e[1]}function Md(e,t){return K1(lg(e,t))}function X1(e,t,n,i){return i&&n&&(e<0?e=Math.max(e,-i.x-n.x):e>0&&(e=Math.min(e,i.x+i.width-n.x-n.width)),t<0?t=Math.max(t,-i.y-n.y):t>0&&(t=Math.min(t,i.y+i.height-n.y-n.height))),[e,t]}function Z1(e,t){let n,i,r,s;var l=(v,S,E,R,b)=>{if(R<=E+1)return;let I=E,M=0,T=v*v;n=[S[E],S[R]],i=lg(n[1],n[0]);let _=K1(i),U,H,Z,B,G;for(let K=E+1;K<R;K++)U=lg(S[K],n[0]),B=EM(U,i),B<=0?G=Md(S[K],n[0]):_<=B?G=Md(S[K],n[1]):(Z=B/_,H=[n[0][0]+Z*i[0],n[0][1]+Z*i[1]],G=Md(S[K],H)),!(G<=M)&&(I=K,M=G);M>T&&(b[I]=1,l(v,S,E,I,b),l(v,S,I,R,b))};let u=e.length,f=[],p,c,m,y,w=t*t;for(r=[],s=[],r[0]=e[0],p=c=1,y=0;p<u;p++)Md(e[p],e[y])<w||(r[c++]=e[p],y=p);for(y<u-1&&(r[c++]=e[u-1]),s[0]=s[c-1]=1,l(t,r,0,c-1,s),p=m=0;p<c;p++)s[p]&&(f[m++]=r[p]);return f}function IM(e){if(e.length!==4)return!1;let t=1e-10,n=Math.min(...e.map(u=>u[0])),i=Math.max(...e.map(u=>u[0])),r=Math.min(...e.map(u=>u[1])),s=Math.max(...e.map(u=>u[1]));for(let u of e){let f=Math.abs(u[0]-n)<t||Math.abs(u[0]-i)<t,p=Math.abs(u[1]-r)<t||Math.abs(u[1]-s)<t;if(!f||!p)return!1}let l=[[n,r],[n,s],[i,r],[i,s]];for(let u of l)if(!e.some(f=>Math.abs(f[0]-u[0])<t&&Math.abs(f[1]-u[1])<t))return!1;return!0}function J1(e){let t=e.points.length,n=!1,i=[];if(t>1){e.iedges=[];let r=e.points[t-1];for(let s=0;s<t;s++){let l=r;if(r=e.points[s],r.length===6){let p=r[2],c=r[3],m=r[4],y=r[5];i.push([s,[r[0]+p,r[1]+c],[r[0]+m,r[1]+y]]),n=!0}let u=[r[0]-l[0],r[1]-l[1]],f=u[0]*u[0]+u[1]*u[1];f>0?e.iedges.push([u[0]/f,u[1]/f]):e.iedges.push([0,0])}}else t===1?e.iedges=[[0,0]]:e.iedges=null;e.isBezier=n,e.bezierLines=i}function CM(e,t){let n=1/0,i=null,r=-1,s=e.points.length;if(s<=1)return[null,n,r];let l=e.points[s-1];for(let u=0;u<s;u++){let f=l;l=e.points[u];let p=f[0]-t[0],c=f[1]-t[1],m=p*p+c*c;m<n&&(i=f,n=m,r=u===0?s-1:u-1)}return[i,n,r]}function Od(e){if(e.points.length>2){let t=Math.min(...e.points.map(s=>s[0])),n=Math.min(...e.points.map(s=>s[1])),i=Math.max(0,...e.points.map(s=>s[0])),r=Math.max(0,...e.points.map(s=>s[1]));e.boundingBox={x:t,y:n,width:i-t,height:r-n};return}e.boundingBox=null}function PM(e){return e[0]*e[0]+e[1]*e[1]}function G1(e,t){let n=1/0,i=null,r=-1,s=[],l=e.points.length;if(l<=1)return[null,n,s,r];if(e.iedges===null&&(J1(e),!e.iedges))return[null,n,s,r];let u=e.points[l-1];for(let f=0;f<l;f++){let p=u;u=e.points[f];let c=(t[0]-p[0])*e.iedges[f][0]+(t[1]-p[1])*e.iedges[f][1],m;c<=0?m=p:c<1?m=[(1-c)*p[0]+c*u[0],(1-c)*p[1]+c*u[1]]:m=u;let y=PM([m[0]-t[0],m[1]-t[1]]);y<n&&(i=m,n=y,s=[p,u],r=f===0?l-1:f-1)}return[i,n,s,r]}var cl={type:"bounding-box-corners",label:"Drag to resize",tools:["pointer","box"],modifiers:{Shift:"Maintain aspect ratio",Alt:"Scale from center",Meta:"Rotate"},isValid(e,t,n){if(t.transitionDirection=null,t.transitionRotate=!1,t.isOpen||!t.slowState.boxMode&&t.selectedPoints.length!==t.polygon.points.length||!t.polygon.boundingBox)return!1;let i=n.proximity*.5,r=n.proximity*5,s=e[0],l=t.polygon.boundingBox,u=l.x+i,f=l.x+l.width-i*2,p=l.y+i,c=l.y+l.height-i*2;if(s[0]>u&&s[0]<f&&s[1]>p&&s[1]<c)return!1;let m=[l.x+l.width,l.y+l.height],y=[l.x,l.y],w=[l.x+l.width,l.y],v=[l.x,l.y+l.height],S=["ne","nw","se","sw"],E={ne:w,nw:y,se:m,sw:v},R=[Hn(e[0],w),Hn(e[0],y),Hn(e[0],m),Hn(e[0],v)],b=Math.min(...R),I=R.indexOf(b),M=I===-1?null:S[I],T=M?E[M]:null;if(R[0]<r||R[1]<r||R[2]<r||R[3]<r){if(M){let[_,U]=s;(n.Meta||_>=T[0]-n.proximity*4&&U>=T[1]-n.proximity*4&&_<=T[0]+n.proximity*4&&U<=T[1]+n.proximity*4&&!(_>=T[0]-n.proximity*2&&U>=T[1]-n.proximity*2&&_<=T[0]+n.proximity*2&&U<=T[1]+n.proximity*2))&&(t.slowState.boxMode||(t.transitionRotate=!0)),t.transitionDirection=M}return!0}return!1},start(e,t,n){let i=e[0],r=t.polygon.boundingBox,s=[r.x+r.width,r.y+r.height],l=[r.x,r.y],u=[r.x+r.width,r.y],f=[r.x,r.y+r.height],p=["ne","nw","se","sw"],c=[Hn(e[0],u),Hn(e[0],l),Hn(e[0],s),Hn(e[0],f)],m=Math.min(...c),y=c.indexOf(m);t.transitionDirection=y!==-1?p[y]:null},transition(e,t,n){let i=t.polygon.boundingBox,r=t.transitionOrigin||e[0],[s,l]=e[0];if((n.Meta||t.transitionRotate)&&!t.slowState.boxMode){let b=[i.x+i.width/2,i.y+i.height/2],I=Math.atan2(r[1]-b[1],r[0]-b[0]),M=Math.atan2(l-b[1],s-b[0]),T=n.Shift,_=Math.PI/(n.Alt?4:12),U=M-I;T&&(U=Math.round(U/_)*_);let H=Math.cos(U),Z=Math.sin(U),B=[];for(let G of t.polygon.points){let K=G[0]-b[0],ce=G[1]-b[1],J=K*H-ce*Z,te=K*Z+ce*H,oe=J+b[0],Re=te+b[1];B.push(G.length===6?[oe,Re,G[2],G[3],G[4],G[5]]:[oe,Re])}t.transitionPoints=B,Od({points:B,iedges:null,boundingBox:null,isBezier:!1,bezierLines:[]}),t.transitionBoundingBox=t.polygon.boundingBox?{...t.polygon.boundingBox,rotation:U}:null;return}let u=t.transitionDirection,f=u.includes("e")?1:-1,p=u.includes("s")?1:-1,c=!!n.Alt,m;if(c)m=[i.x+i.width/2,i.y+i.height/2];else switch(u){case"se":m=[i.x,i.y];break;case"sw":m=[i.x+i.width,i.y];break;case"ne":m=[i.x,i.y+i.height];break;case"nw":m=[i.x+i.width,i.y+i.height];break}let y=c?i.width/2:i.width,w=c?i.height/2:i.height,v,S;if(n.Shift||t.slowState.fixedAspectRatio){let b=f*y,I=p*w,M=s-m[0],T=l-m[1],_=b*b+I*I,U=_>0?(M*b+T*I)/_:1;U=Math.max(U,.01),v=U,S=U}else{let b=0,I=0;switch(u){case"se":b=s-r[0],I=l-r[1];break;case"sw":b=r[0]-s,I=l-r[1];break;case"ne":b=s-r[0],I=r[1]-l;break;case"nw":b=r[0]-s,I=r[1]-l;break}c&&(b*=2,I*=2),v=(i.width+b)/i.width,S=(i.height+I)/i.height}let E=[];for(let b of t.polygon.points){let I=b[0]-m[0],M=b[1]-m[1],T=I*v,_=M*S,U=T+m[0],H=_+m[1];E.push(b.length===6?[U,H,b[2],b[3],b[4],b[5]]:[U,H])}t.transitionPoints=E;let R={points:E,iedges:null,boundingBox:null,bezierLines:[],isBezier:!1};Od(R),t.transitionBoundingBox=R.boundingBox},commit(e,t,n){let i=t.transitionPoints;return t.transitionPoints=null,t.transitionBoundingBox=null,t.transitionRotate=!1,{points:i}}},AM={type:"close-line-box",label:"Close Line Box",tools:["lineBox"],trigger:{type:"click"},isValid(e,t,n){return t.polygon.points.length===2&&t.lineBox!==null&&t.slowState.boxMode===!1},commit(e,t,n){return t.lineBox?{isOpen:!1,points:t.lineBox,tool:"pen"}:{}}},eb={type:"close-shape",label:"Close shape",tools:["pen","line"],trigger:{type:"click"},isValid(e,t,n){if(!t.isOpen||t.slowState.boxMode||t.selectedPoints.length!==1||t.polygon.points.length<2||n.Meta)return!1;let i=t.selectedPoints[0];if(i===0){let r=t.polygon.points[t.polygon.points.length-1];return Hn(e[0],r)<n.proximity}if(i===t.polygon.points.length-1){let r=t.polygon.points[0];return Hn(e[0],r)<n.proximity}return!1},commit(e,t,n){let i=t.selectedPoints[0];if(t.line=null,i===0)return{selectedPoints:[],points:t.polygon.points.slice(0).reverse(),isOpen:!1};if(i===t.polygon.points.length-1)return{selectedPoints:[],isOpen:!1}}},TM={type:"close-shape-line",label:"Close shape line",trigger:{type:"click"},tools:["pen"],isValid(e,t,n){return!t.isOpen||t.slowState.boxMode||t.polygon.points.length<3||!t.closestLinePoint||t.closestLineDistance>=n.proximity*2?!1:(t.closestLineIndex===0||(t.closestLineIndex,t.polygon.points.length-2),!0)},commit(e,t,n){return eb.commit(e,t,n)}},tb={type:"split-line",label:"Split line",tools:["pen"],isValid(e,t,n){let i=t.slowState.currentTool==="line";return n.Meta||i?!1:!!(t.closestLinePoint&&t.closestLineDistance<n.proximity)},transition(e,t,n){let i=e[0];!n.Shift&&t.slowState.snapEnabled&&(Dr(i,t,3,t.closestLineIndex),i=pl(i,t));let r=t.transitionOrigin||i,[s,l]=i,u=t.polygon.points,f=[],p=s-r[0],c=l-r[1];for(let m=0;m<u.length;m++)if(f.push(u[m]),t.closestLineIndex===m){let y=t.closestLinePoint;f.push([y[0]+p,y[1]+c])}t.transitionPoints=f},commit(e,t,n){let i=t.transitionPoints;return t.transitionPoints=null,t.transitionBoundingBox=null,{selectedPoints:[t.closestLineIndex+1],points:i}}},MM={type:"cut-line",label:"Add new point",tools:["pen"],trigger:{type:"click"},modifiers:{Shift:"Cut line"},isValid(e,t,n){return t.slowState.boxMode?!1:tb.isValid(e,t,n)},commit(e,t,n){if(n.Shift&&!t.isOpen){let s=t.polygon.points,l=[],u=[],f=!1;for(let p=0;p<s.length;p++)f?u.push(s[p]):l.push(s[p]),t.closestLineIndex===p&&(f=!0);return{isOpen:!0,points:[...u,...l]}}let i=t.polygon.points,r=[];for(let s=0;s<i.length;s++)if(r.push(i[s]),t.closestLineIndex===s){let l=t.closestLinePoint;r.push(l)}return{points:r}}},_M={type:"delete-point",label:"Delete point",tools:["pointer","pen","lineBox","line"],trigger:{type:"key",key:"Backspace"},isValid(e,t,n){return t.selectedPoints.length>0&&t.slowState.canDelete},commit(e,t,n){let i=t.polygon.points.filter((r,s)=>!t.selectedPoints.includes(s));return{isOpen:i.length<3,selectedPoints:[],points:i,tool:t.slowState.boxMode?"box":void 0}}},OM={type:"deselect-bounding-box",label:"Deselect bounding box",tools:["pointer"],trigger:{type:"click"},isValid(e,t,n){return t.slowState.canDeselect&&!t.isOpen&&!t.slowState.boxMode&&t.selectedPoints.length>2&&t.selectedPoints.length===t.polygon.points.length},commit(e,t,n){return t.slowState.lastCreationTool==="pen"?{selectedPoints:[],tool:"pen"}:{selectedPoints:[]}}},kM={type:"deselect-draw",label:"Deselect draw",trigger:{type:"key",key:"Escape"},tools:["pointer","pen","box","lineBox","stamp","hand","pencil"],isValid(e,t,n){return t.slowState.canDeselect},commit(e,t,n){return{selectedPoints:[]}}},LM={type:"deselect-points",label:"Deselect points",trigger:{type:"click"},tools:["pointer","pen"],isValid(e,t,n){return t.selectedPoints.length>0&&t.slowState.canDeselect},commit(e,t,n){return{selectedPoints:[]}}},FM={type:"draw-shape",label:"Draw shape",tools:["pen","pencil"],modifiers:{Alt:"Freehand drawing"},isValid(e,t,n){let i=n.Alt||t.slowState.currentTool==="pencil";return!!(t.isOpen&&(t.line||t.polygon.points.length===0)&&i)},start(e,t,n){t.transitionDraw=[]},transition(e,t,n){let i=e[0];!n.Shift&&t.slowState.snapEnabled&&(Dr(i,t,3),i=pl(i,t)),t.transitionDraw.push(i)},commit(e,t,n){let i=t.slowState.currentTool==="pencil"?t.scale*1.5:t.scale*3,r=Z1(t.transitionDraw,i);if(t.transitionDraw=[],r.length===0)return;let s=!0,l=3,u=t.selectedPoints[0],f=[...t.polygon.points,...r],p=f[0],c=f[f.length-1];u===0&&(p=f[f.length-1],c=f[0],f=[...r,...t.polygon.points.slice(0).reverse()]);let m=[f.length-1],y=Hn(p,c)/n.proximity<l,w="";return y&&(s=!1,w="pointer",m=f.map((v,S)=>S)),{isOpen:s,tool:w||void 0,points:f,selectedPoints:m}}},NM={type:"move-line",label:"Move line",tools:["line"],isValid(e,t,n){return t.slowState.currentTool!=="line"||t.slowState.boxMode?!1:!!(t.closestLinePoint&&t.closestLineDistance<n.proximity)},transition(e,t){let n=t.transitionOrigin,i=t.polygon.boundingBox,r=e[0],[s,l]=X1(r[0]-n[0],r[1]-n[1],i,t.slowState.bounds);t.transitionPoints=t.polygon.points.map(u=>u.length===6?[u[0]+s,u[1]+l,u[2],u[3],u[4],u[5]]:[u[0]+s,u[1]+l])},commit(e,t,n){let i=t.transitionPoints;return t.transitionPoints=null,t.transitionBoundingBox=null,{points:i}}},zM={type:"move-point",label:"Move point",tools:["pointer","pen","line"],modifiers:{Shift:"Constrain to axis"},isValid(e,t,n){if(n.Alt)return!1;let i=n.proximity,[r,s]=e[0],l=t.polygon.points,u=t.selectedPoints;for(let f=0;f<l.length;f++){let p=l[f],c=p[0]-r,m=p[1]-s;if(c*c+m*m<i*i)return!0}return!1},start(e,t,n){if(t.slowState.boxMode)return cl.start?cl.start(e,t,n):void 0;if(t.selectedPoints.length<2){let[i,r,s]=CM(t.polygon,e[0]);return{selectedPoints:[s]}}if(t.slowState.closestPoint&&!t.selectedPoints.includes(t.slowState.closestPoint))return{selectedPoints:[t.slowState.closestPoint]}},transition(e,t,n){if(t.slowState.boxMode)return cl.transition(e,t,n);let i=t.transitionOrigin,r=e[0];!n.Shift&&t.slowState.snapEnabled&&(Dr(r,t,3),r=pl(r,t));let[s,l]=r,u=t.polygon.points,f=t.selectedPoints;if(t.slowState.closestPoint){let y=t.slowState.closestPoint;f.indexOf(y)===-1&&(f=[y])}let p=[],c=s-i[0],m=l-i[1];n.Shift&&!t.slowState.snapEnabled&&(Math.abs(c)>Math.abs(m)?m=0:c=0);for(let y=0;y<u.length;y++){let w=f.indexOf(y)!==-1,v=u[y];w?v.length===6?p.push([v[0]+c,v[1]+m,v[2],v[3],v[4],v[5]]):p.push([v[0]+c,v[1]+m]):p.push(v)}t.transitionPoints=p},commit(e,t,n){if(t.slowState.boxMode)return cl.commit(e,t,n);let i=t.transitionPoints;return t.transitionPoints=null,t.transitionBoundingBox=null,{points:i}}},nb={type:"move-bounding-box",label:"Move bounding box",tools:["pointer"],isValid(e,t,n){let i=t.polygon.points.length,r=i===t.selectedPoints.length,s=t.polygon.boundingBox;if(i<1||!r||!s)return!1;let l=e[0],u=l[0],f=l[1];return u>=s.x&&u<=s.x+s.width&&f>=s.y&&f<=s.y+s.height},transition(e,t,n){let i=t.slowState.bounds,r=t.transitionOrigin,s=t.polygon.boundingBox,l=e[0],[u,f]=X1(l[0]-r[0],l[1]-r[1],s,i);t.transitionPoints=t.polygon.points.map(p=>p.length===6?[p[0]+u,p[1]+f,p[2],p[3],p[4],p[5]]:[p[0]+u,p[1]+f]),s&&(t.transitionBoundingBox={x:s.x+u,y:s.y+f,width:s.width,height:s.height})},commit(e,t,n){let i=t.transitionPoints;return t.transitionPoints=null,t.transitionBoundingBox=null,{points:i}}},ib={type:"move-shape",label:"Move shape",tools:["pointer","hand","box"],isValid(e,t,n){return n.Shift?!1:t.slowState.pointerInsideShape&&(!t.isOpen||t.line===null)},transition(e,t,n){nb.transition(e,t,n)},commit(e,t,n){let i=t.transitionPoints;return t.transitionPoints=null,t.transitionBoundingBox=null,{points:i}}},DM={type:"nudge-right",label:"Nudge right",trigger:{type:"key",key:"ArrowRight"},tools:["pointer","pen"],modifiers:{Shift:"Nudge right more"},isValid(e,t,n){return t.selectedPoints.length>0},commit(e,t,n){let i=n.proximity*.3,r=t.polygon.points,s=t.selectedPoints;return{points:r.map((l,u)=>s.includes(u)?[l[0]+(n.Shift?4*i:1),l[1]]:l)}}},BM={type:"nudge-left",label:"Nudge left",trigger:{type:"key",key:"ArrowLeft"},tools:["pointer","pen"],modifiers:{Shift:"Nudge left more"},isValid(e,t,n){return t.selectedPoints.length>0},commit(e,t,n){let i=n.proximity*.3,r=t.polygon.points,s=t.selectedPoints;return{points:r.map((l,u)=>s.includes(u)?[Math.max(0,l[0]-(n.Shift?4*i:1)),l[1]]:l)}}},VM={type:"nudge-up",label:"Nudge up",trigger:{type:"key",key:"ArrowUp"},tools:["pointer","pen"],modifiers:{Shift:"Nudge up more"},isValid(e,t,n){return t.selectedPoints.length>0},commit(e,t,n){let i=n.proximity*.3,r=t.polygon.points,s=t.selectedPoints;return{points:r.map((l,u)=>{if(s.includes(u)){let f=l[0],p=Math.max(0,l[1]-(n.Shift?4*i:1));return l.length===6?[f,p,l[2],l[3],l[4],l[5]]:[f,p]}return l})}}},jM={type:"nudge-down",label:"Nudge down",trigger:{type:"key",key:"ArrowDown"},tools:["pointer","pen"],modifiers:{Shift:"Nudge down more"},isValid(e,t,n){return t.selectedPoints.length>0},commit(e,t,n){let i=n.proximity*.3,r=t.polygon.points,s=t.selectedPoints;return{points:r.map((l,u)=>{let f=l[0],p=Math.max(0,l[1]+(n.Shift?4*i:1));return s.includes(u)?l.length===6?[f,p,l[2],l[3],l[4],l[5]]:[f,p]:l})}}},HM={type:"select-multiple-points",label:"Drag to select multiple points",tools:["pointer","pen"],isValid(e,t,n){return t.slowState.currentTool==="line"&&t.polygon.points.length>=2?!0:!(t.slowState.boxMode||t.line)},transition(e,t,n){if(!t.transitionOrigin)return;let i=t.transitionOrigin[0],r=t.transitionOrigin[1],s=e[0][0],l=e[0][1],u=Math.min(i,s),f=Math.min(r,l),p=Math.abs(i-s),c=Math.abs(r-l);t.selectionBox={x:u,y:f,width:p,height:c}},commit(e,t,n){if(t.selectionBox){let i=[];n.Shift&&i.push(...t.selectedPoints);for(let r=0;r<t.polygon.points.length;r++){let s=t.polygon.points[r];s[0]>=t.selectionBox.x&&s[0]<=t.selectionBox.x+t.selectionBox.width&&s[1]>=t.selectionBox.y&&s[1]<=t.selectionBox.y+t.selectionBox.height&&i.push(r)}return{selectedPoints:i}}}},$1=10,WM={type:"select-point",label:"Select point",trigger:{type:"click"},tools:["pointer","pen","line"],modifiers:{Shift:"Add to selection"},isValid(e,t,n){let i=-1;if(t.selectedPoints.length===1){let u=t.selectedPoints[0];u===0&&(i=t.polygon.points.length-1),u===t.polygon.points.length-1&&(i=0)}if(t.slowState.boxMode)return!1;let[r,s]=e[0],l=t.polygon.points;for(let u=0;u<l.length;u++){let f=l[u],p=f[0]-r,c=f[1]-s;if(p*p+c*c<$1*$1)return i!==u}return!1},commit(e,t,n){let i=n.Shift?[...t.selectedPoints]:[],[r,s]=e[0],l=t.polygon.points.map((u,f)=>{let p=u[0]-r,c=u[1]-s;return[p*p+c*c,f]}).sort((u,f)=>u[0]-f[0])[0];if(t.line=null,!i.includes(l[1]))i.push(l[1]);else if(n.Shift)return{selectedPoints:i.filter(u=>u!==l[1])};return{selectedPoints:i}}},UM={type:"select-shape",label:"Select shape",trigger:{type:"click"},tools:["pointer","pen"],isValid(e,t,n){return ib.isValid(e,t,n)},commit(e,t,n){return{tool:"pointer",selectedPoints:t.polygon.points.map((i,r)=>r)}}},qM={type:"snap",label:"Smart snap",tools:["pointer","pen","line"],modifiers:{Shift:"Disable snapping"},isValid(e,t,n){return n.Shift||!t.slowState.snapEnabled||t.slowState.transitioning&&t.slowState.transitionIntentType!=="snap"||!t.slowState.snapToPoints&&!t.slowState.snapToLines&&!t.slowState.snapToIntersections?!1:Dr(e[0],t,0)!==null},start(e,t,n){Dr(e[0],t,5)},transition(e,t,n){let i=Dr(e[0],t,5);i&&(t.pointer=i)},commit(e,t,n){Y1(t)}},GM={type:"stamp-fixed-size-shape",label:"Stamp fixed size shape",trigger:{type:"click"},tools:["stamp"],isValid(e,t,n){return t.slowState.selectedStamp!==null},commit(e,t,n){let i=e[0],r=t.slowState.selectedStamp;if(!i||!r)return;let s=i[0],l=i[1],u=[],f=Math.min(...r.points.map(S=>S[0])),p=Math.min(...r.points.map(S=>S[1])),c=Math.max(...r.points.map(S=>S[0]))-f,m=Math.max(...r.points.map(S=>S[1]))-p,y=4*n.proximity,w=c/y;m/y>w&&(w=m/y),s-=c/w/2,l-=m/w/2;let v=0;for(let S of r.points)u.push([s+(S[0]-f)/w,l+(S[1]-p)/w]),v++;return{isOpen:!1,points:u}}},rb={id:"square",open:!1,points:[[0,0],[0,100],[100,100],[100,0]]},$M={id:"triangle",open:!1,points:[[50,0],[0,100],[100,100]]},QM={id:"pentagon",open:!1,points:[[0,0],[0,100],[100,100],[100,0],[50,-50]]},YM={id:"hexagon",open:!1,points:[[50,0],[0,25],[0,75],[50,100],[100,75],[100,25]]},KM={id:"circle",open:!1,points:[[948.949,571.107],[954.545,500],[954.545,500],[948.949,428.893],[948.949,428.893],[932.298,359.538],[932.298,359.538],[905.003,293.641],[905.003,293.641],[867.735,232.825],[867.735,232.825],[821.412,178.588],[821.412,178.588],[767.175,132.265],[767.175,132.265],[706.359,94.997],[706.359,94.997],[640.462,67.702],[640.462,67.702],[571.107,51.051],[571.107,51.051],[500,45.455],[500,45.455],[428.893,51.051],[428.893,51.051],[359.538,67.702],[359.538,67.702],[293.641,94.997],[293.641,94.997],[232.825,132.265],[232.825,132.265],[178.588,178.588],[178.588,178.588],[132.265,232.825],[132.265,232.825],[94.997,293.641],[94.997,293.641],[67.702,359.538],[67.702,359.538],[51.051,428.893],[51.051,428.893],[45.455,500],[45.455,500],[51.051,571.107],[51.051,571.107],[67.702,640.462],[67.702,640.462],[94.997,706.359],[94.997,706.359],[132.265,767.175],[132.265,767.175],[178.588,821.412],[178.588,821.412],[232.825,867.735],[232.825,867.735],[293.641,905.003],[293.641,905.003],[359.538,932.298],[359.538,932.298],[428.893,948.949],[428.893,948.949],[500,954.545],[500,954.545],[571.107,948.949],[571.107,948.949],[640.462,932.298],[640.462,932.298],[706.359,905.003],[706.359,905.003],[767.175,867.735],[767.175,867.735],[821.412,821.412],[821.412,821.412],[867.735,767.175],[867.735,767.175],[905.003,706.359],[905.003,706.359],[932.298,640.462],[932.298,640.462],[948.949,571.107]]},XM={type:"stamp-shape",label:"Stamp shape",tools:["stamp","box"],modifiers:{Shift:"Maintain aspect ratio"},isValid(e,t,n){return!(t.polygon.points.length&&!t.slowState.canDelete)},start(e,t,n){let i=e[0],r=t.slowState.selectedStamp||rb;if(i){let s=i[0],l=i[1],u=[],f=Math.min(...r.points.map(S=>S[0])),p=Math.min(...r.points.map(S=>S[1])),c=Math.max(...r.points.map(S=>S[0]))-f,m=Math.max(...r.points.map(S=>S[1]))-p,y=c/32;m/32>y&&(y=m/32);let w=[],v=0;for(let S of r.points)w.push(v),u.push([s+(S[0]-f)/y,l+(S[1]-p)/y]),v++;return t.transitionPoints=u,{isOpen:!1,selectedPoints:w,points:u}}},transition(e,t,n){if(!t.transitionOrigin)return;let i=t.polygon.boundingBox,r=[i.x,i.y],s=t.transitionOrigin||e[0],[l,u]=e[0],f=t.transitionOrigin[0],p=t.transitionOrigin[1],c=e[0][0],m=e[0][1],y=c-f-32,w=m-p-32;if(n.Shift||t.slowState.fixedAspectRatio){let b=i.width/i.height;Math.abs(i.width/y)>Math.abs(i.height/w)?w=y/b:y=w*b}let v=(i.width+y)/i.width,S=(i.height+w)/i.height,E=[];for(let b of t.polygon.points){let I=b[0]-r[0],M=b[1]-r[1],T=I*v,_=M*S,U=T+r[0],H=_+r[1];if(b.length===6){E.push([U,H,b[2],b[3],b[4],b[5]]);continue}E.push([U,H])}t.transitionPoints=E;let R={points:E,iedges:null,boundingBox:null,bezierLines:[],isBezier:!1};Od(R),t.transitionBoundingBox=R.boundingBox},commit(e,t,n){return{isOpen:!1,points:t.transitionPoints,tool:"pointer"}}},ZM={type:"toggle-snap",label:"Toggle snapping",trigger:{type:"key",key:"`"},tools:["pointer","pen","line","lineBox","box","stamp"],modifiers:{},isValid(e,t,n){return!0},commit(e,t,n){let i=!t.slowState.snapEnabled;return t.slowState.snapEnabled=i,i||(t.snapTargets=[],t.activeSnapGuides=[],t.isSnapping=!1,t.snapPoint=null),{}}};function ob(e={}){let t=e.proximityThreshold||10,n=e.closestLinePointFill||{selected:"#fff",unselected:"rgba(255, 255, 255, .5)"},i=e.closestLinePointStroke||{selected:"#000",unselected:"rgba(0, 0, 0, .5)"};function r(v,S,E){v&&S.transitionBoundingBox&&E.transitioning&&(v.setAttribute("x",""+S.transitionBoundingBox.x),v.setAttribute("y",""+S.transitionBoundingBox.y),v.setAttribute("width",""+S.transitionBoundingBox.width),v.setAttribute("height",""+S.transitionBoundingBox.height))}function s(v,S,E){v&&S.polygon.boundingBox&&E.showBoundingBox&&(v.setAttribute("x",""+S.polygon.boundingBox.x),v.setAttribute("y",""+S.polygon.boundingBox.y),v.setAttribute("width",""+S.polygon.boundingBox.width),v.setAttribute("height",""+S.polygon.boundingBox.height))}function l(v,S,E){if(v&&S.polygon.boundingBox&&E.showBoundingBox){let R=S.transitionBoundingBox||S.polygon.boundingBox;R.rotation?(v.style.transformOrigin=`${R.x+R.width/2}px ${R.y+R.height/2}px`,v.style.transform=`rotate(${Math.round(100*R.rotation*(180/Math.PI))/100}deg)`):v.style.transform="",v.setAttribute("points",[[R.x,R.y],[R.x+R.width,R.y],[R.x+R.width,R.y+R.height],[R.x,R.y+R.height]].map(b=>b.join(",")).join(" "))}}function u(v,S,E){v&&S.transitionPoints&&E.transitioning&&v.setAttribute("points",S.transitionPoints.map(R=>R.join(",")).join(" "))}function f(v,S,E){v&&S.closestLinePoint&&E.hasClosestLine&&(v.setAttribute("cx",""+S.closestLinePoint[0]),v.setAttribute("cy",""+S.closestLinePoint[1]),v.setAttribute("fill",S.closestLineDistance<t?n.selected:n.unselected),v.setAttribute("stroke",S.closestLineDistance<t?i.selected:i.unselected))}function p(v,S,E){v&&S.closestLinePoint&&E.hasClosestLine&&v.setAttribute("transform",`translate(${S.closestLinePoint[0]}, ${S.closestLinePoint[1]})`)}function c(v,S,E){v&&S.selectionBox&&E.transitionIntentType==="select-multiple-points"&&(v.setAttribute("x",""+S.selectionBox.x),v.setAttribute("y",""+S.selectionBox.y),v.setAttribute("width",""+S.selectionBox.width),v.setAttribute("height",""+S.selectionBox.height))}function m(v,S,E){if(v&&S.pointer&&S.selectedPoints.length)if(E.actionIntentType==="close-shape"||E.actionIntentType==="close-shape-line"){let R=S.polygon.points[0],b=S.polygon.points[S.polygon.points.length-1];R&&b&&v.setAttribute("points",`${R.join(",")} ${b.join(",")}`)}else if(S.line)v.setAttribute("points",`${S.line[0].join(",")} ${S.line[1].join(",")}`);else{let R=S.polygon.points[S.selectedPoints[0]];R&&R.length&&v.setAttribute("points",`${S.pointer[0]},${S.pointer[1]} ${R.join(",")}`)}}function y(v,S,E,R=3){v&&S.transitionDraw.length&&v.setAttribute("points",Z1(S.transitionDraw,R*S.scale).map(b=>b.join(",")).join(" "))}function w(v,S){v&&S.lineBox&&v.setAttribute("points",S.lineBox.map(E=>E.join(",")).join(" "))}return{updateTransitionBoundingBox:r,updateClosestLinePointTransform:p,updateBoundingBoxPolygon:l,updateBoundingBox:s,updateTransitionShape:u,updateClosestLinePoint:f,updateSelectBox:c,updatePointLine:m,updateDrawPreview:y,updateLineBox:w}}var JM=typeof window<"u"?window.requestAnimationFrame:e=>setTimeout(e,16),e_=typeof window<"u"?window.cancelAnimationFrame:e=>clearTimeout(e);function Q1(e){return!["hand","pointer"].includes(e)}var fl=[cl,zM,NM,tb,ib,nb,FM,HM,XM,qM],t_=fl.length,dl=[AM,GM,eb,WM,TM,MM,RM,UM,OM,LM],Vs=[kM,DM,BM,VM,jM,_M,ZM],hl={};fl.forEach(e=>{hl[e.type]=e});dl.forEach(e=>{hl[e.type]=e});Vs.forEach(e=>{hl[e.type]=e});var _d=10;function sb(e,t){let n=e?.fixedAspectRatio||!1,i=e?.tool||"pointer",r=e?.keyboardShortcutMapping||{},s=typeof e?.keyboardShortcutsEnabled=="boolean"?e.keyboardShortcutsEnabled:!0,l=e?.enabledTools||["pointer","pen","box","lineBox","stamp","hand","line","pencil"],u=e?.emitter||gM(),f={V:"pointer",P:"pen",B:"box",L:"lineBox",S:"stamp",H:"hand",N:"line",D:"pencil",...e?.toolMap||{}},p={shapeId:e?.id||null,noShape:e===null,transitioning:!1,actionIntentType:null,transitionIntentType:null,selectedPoints:[],hasClosestLine:!1,modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:_d},bounds:e?.bounds||null,showBoundingBox:!1,currentModifiers:{},validIntentKeys:{},pointerInsideShape:!1,closestPoint:null,selectedStamp:null,transitionModifiers:null,boxMode:!1,bezierLines:[],fixedAspectRatio:n,isToolSwitchingLocked:!1,canDeselect:!1,canDelete:!0,cursor:"default",enabledTools:l,currentTool:i,lastCreationTool:Q1(i)?i:null,snapEnabled:!1,snapToPoints:!0,snapToLines:!0,snapToIntersections:!0,snapToGrid:!1,snapToParallel:!0},c={isOpen:typeof e?.open=="boolean"?e.open:!1,polygon:{points:e?.points||[],iedges:null,boundingBox:null,isBezier:null,bezierLines:[]},scale:1,selectedPoints:[],pointer:null,line:null,lineBox:null,transitionPoints:null,transitionOrigin:null,transitionBoundingBox:null,closestLinePoint:null,closestLineDistance:0,closestLineIndex:-1,transitionRotate:!1,transitionDirection:null,transitionBezierLine:null,selectionBox:null,slowState:p,transitionDraw:[],isPanning:!1,panStart:null,snapTargets:[],activeSnapGuides:[],snapThreshold:15,isSnapping:!1,snapPoint:null},m={startTime:0,time:0,shouldUpdate:!1,nextSlowState:null,renderFunc:()=>{},setStateFunc:()=>{},animationFrame:0,actionIntent:null,transitionIntent:null,undoStack:[],undoStackPointer:-1},y={isPressed:!1,isClicking:!1,lastPress:null,pressTimeout:0,noTransition:!1};function w(F){J1(F),F.isBezier&&v({bezierLines:F.bezierLines}),Od(F),m.shouldUpdate=!0}w(c.polygon);function v(F){let $=Object.keys(F);if($.length===0)return;let ie=m.nextSlowState||c.slowState,le=!1;if($.length===1&&$[0]==="validIntentKeys"&&ie.validIntentKeys){let Se=Object.keys(ie.validIntentKeys),V=Object.keys(F.validIntentKeys||{});if(Se.length===V.length){for(let k of Se)ie.validIntentKeys[k]!==F.validIntentKeys[k]&&(le=!0);if(!le)return}}if(F.selectedPoints){let Se=Array.from(ie.selectedPoints||[]),V=Array.from(F.selectedPoints||[]);if(Se.length===V.length){for(let k of Se)if(!V.includes(k)){le=!0;break}}else le=!0;le||delete F.selectedPoints}if(!($.length===1&&$.includes("hasClosestLine")&&F.hasClosestLine===ie.hasClosestLine)){if(m.nextSlowState){m.nextSlowState={...m.nextSlowState,...F};return}m.nextSlowState={...c.slowState,...F}}}function S(F,$=!1){m.time+=F,E(),R(),Z(),H(),U(),G(),ce(),K(),_(),m.renderFunc(c,c.slowState,F),!$&&(m.animationFrame=JM(S))}function E(){if(m.shouldUpdate&&(t({id:c.slowState.shapeId||void 0,open:c.isOpen,points:c.polygon.points}),m.shouldUpdate=!1),m.nextSlowState&&m.nextSlowState!==c.slowState){let F=Object.keys(c.slowState),$={},ie={},le=!1;for(let Se of F){let V=c.slowState[Se],k=m.nextSlowState[Se];V!==k?(le=!0,$[Se]=k,ie[Se]=k):$[Se]=V}le&&(c.slowState=$,m.nextSlowState=null,m.setStateFunc(c.slowState),e?.customSetState?.(ie))}}function R(){let F=!c.slowState.noShape&&c.polygon.points.length>2&&c.selectedPoints.length===c.polygon.points.length&&!c.isOpen&&(c.slowState.currentTool==="pointer"||c.slowState.currentTool==="box");c.slowState.showBoundingBox!==F&&v({showBoundingBox:F})}function b(F){c.selectedPoints=F.selectedPoints,v({selectedPoints:F.selectedPoints}),c.polygon.points=F.points,c.polygon.boundingBox=null,c.polygon.iedges=null,c.polygon.isBezier=null,w(c.polygon),v({closestPoint:null}),(F.isOpen===!0||F.isOpen===!1)&&(c.isOpen=F.isOpen,m.shouldUpdate=!0)}function I(){if(m.undoStackPointer===-1)return;m.undoStackPointer--;let F=m.undoStack[m.undoStackPointer];b(F)}function M(){if(m.undoStackPointer===m.undoStack.length-1)return;m.undoStackPointer++;let F=m.undoStack[m.undoStackPointer];b(F)}function T(F){m.undoStackPointer++,m.undoStack[m.undoStackPointer]=F,m.undoStack.length>15&&(m.undoStack.shift(),m.undoStackPointer--)}function _(){v({boxMode:IM(c.polygon.points||[])})}function U(){if(!c.pointer||c.slowState.noShape){v({pointerInsideShape:!1});return}let[F,$]=c.pointer,ie=c.polygon.points,le=c.polygon.boundingBox;if(!le){v({pointerInsideShape:!1});return}if(F<le.x||F>le.x+le.width||$<le.y||$>le.height+le.y){v({pointerInsideShape:!1});return}let Se=!1;for(let V=0,k=ie.length-1;V<ie.length;k=V++)ie[V][1]>$!=ie[k][1]>$&&F<(ie[k][0]-ie[V][0])*($-ie[V][1])/(ie[k][1]-ie[V][1])+ie[V][0]&&(Se=!Se);v({pointerInsideShape:Se})}function H(){if(c.slowState.noShape||!c.pointer||c.slowState.transitioning||!c.polygon.points||c.polygon.points.length===0)return;let[F,$]=c.pointer,ie=c.polygon.points.map((le,Se)=>{let V=le[0]-F,k=le[1]-$;return[V*V+k*k,Se]}).sort((le,Se)=>le[0]-Se[0]);ie.length&&v({closestPoint:ie[0][1]})}function Z(){if(!c.pointer||c.slowState.transitioning)return;if(c.slowState.noShape){c.closestLineIndex=-1,c.closestLinePoint=null,c.closestLineDistance=0;return}let[F,$,ie,le]=G1(c.polygon,c.pointer),Se=Ge()*Ge();$<Se&&(!c.isOpen||c.slowState.currentTool==="line"||c.polygon.points.length-1!==le)?(c.closestLinePoint=F,c.closestLineDistance=Math.sqrt($),c.closestLineIndex=le,v({hasClosestLine:!0})):(c.closestLinePoint=null,c.closestLineDistance=0,c.closestLineIndex=-1,v({hasClosestLine:!1}))}function B(F,$=null){let ie={},le=$||(c.pointer?[c.pointer[0],c.pointer[1]]:null);for(let Se of[...fl,...dl,...Vs])Se.tools.includes(F)&&(le&&Se.isValid([le],c,J())?ie[Se.type]=Se.label:le||(ie[Se.type]=Se.label));return ie}function G(){if(c.slowState.transitioning||c.slowState.noShape||!c.pointer||!Array.isArray(c.pointer)||c.pointer.length<2||typeof c.pointer[0]!="number"||typeof c.pointer[1]!="number")return;let F=c.slowState.currentTool;De(F);let $=!1;for(let Se=0;Se<t_;Se++){let V=fl[Se];if(V.tools.includes(F)&&V.isValid(y.isPressed?[y.lastPress]:[c.pointer],c,J())){if(m.transitionIntent===V){$=!0;break}v({transitionIntentType:V.type}),m.transitionIntent=V,$=!0;break}}$||m.transitionIntent&&(v({transitionIntentType:null}),m.transitionIntent=null);let ie=!1;for(let Se=0;Se<dl.length;Se++){let V=dl[Se];if(V.tools.includes(F)&&oe(V)){if(m.actionIntent===V){ie=!0;break}v({actionIntentType:V.type}),m.actionIntent=V,ie=!0;break}}ie||m.actionIntent&&(m.actionIntent=null,v({actionIntentType:null}));let le={};for(let Se=0;Se<Vs.length;Se++){let V=Vs[Se];V.trigger.type==="key"&&oe(V)&&(le[V.trigger.key]=V.label)}v({validIntentKeys:le})}function K(){let F=c.pointer;if(c.lineBox=null,!F||de()||c.polygon.points.length!==2)return;let[$,ie]=F,[le,Se]=c.polygon.points[0],[V,k]=c.polygon.points[1],[X,ee,Ie,_e]=G1(c.polygon,F);if(!X)return;let Be=$-X[0],W=ie-X[1],Y=[le,Se],ge=[V,k],he=[ge[0]+Be,ge[1]+W],pe=[Y[0]+Be,Y[1]+W];c.lineBox=[Y,ge,he,pe]}function ce(){let F=c.pointer;if(!F||!de()||c.slowState.noShape)return;let $=c.selectedPoints[0],ie=F;if(c.slowState.snapEnabled&&!c.slowState.modifiers.Shift?(Dr(F,c,5),ie=pl(F,c)):Y1(c),c.line=[c.polygon.points[$],ie],c.slowState.modifiers.Shift){let le=0;if(c.polygon.points.length>1){let W=c.selectedPoints[0];W===0?le=Math.atan2(c.polygon.points[1][1]-c.polygon.points[0][1],c.polygon.points[1][0]-c.polygon.points[0][0]):le=Math.atan2(c.polygon.points[W-1][1]-c.polygon.points[W][1],c.polygon.points[W-1][0]-c.polygon.points[W][0])}let Se=F[0]-c.polygon.points[$][0],V=F[1]-c.polygon.points[$][1],k=Math.atan2(V,Se),X=Math.PI/4,ee=Math.round((k-le)/X)*X+le,Ie=Hn(c.polygon.points[$],F),_e=Math.cos(ee)*Ie+c.polygon.points[$][0],Be=Math.sin(ee)*Ie+c.polygon.points[$][1];c.line[1]=[_e,Be]}}function J(){return c.slowState.modifiers}function te(F){let $=F.commit([y.lastPress],c,J());u.emit("polygons.end-transition",{transitionIntent:F.type,response:$}),$&&($.tool&&ae($.tool),$.selectedPoints&&(c.selectedPoints=$.selectedPoints,v({selectedPoints:$.selectedPoints})),$.points&&(c.polygon.points=$.points,c.polygon.boundingBox=null,c.polygon.iedges=null,c.polygon.isBezier=null,c.transitionBoundingBox=null,w(c.polygon),v({closestPoint:null,selectedStamp:null})),($.isOpen===!0||$.isOpen===!1)&&(c.isOpen=$.isOpen,m.shouldUpdate=!0),T({isOpen:c.isOpen,points:c.polygon.points,selectedPoints:c.selectedPoints}),De(c.slowState.currentTool)),v({transitionModifiers:null})}function oe(F){if(!F.tools.includes(c.slowState.currentTool))return!1;let $=[];return c.pointer&&Array.isArray(c.pointer)&&c.pointer.length>=2&&typeof c.pointer[0]=="number"&&typeof c.pointer[1]=="number"&&($=[c.pointer]),F.isValid($,c,J())}function Re(F){F==="Delete"&&(F="Backspace");let $=c.slowState.currentTool;for(let ie of Vs)if(!(ie.trigger.type!=="key"||ie.trigger.key!==F)&&ie.tools.includes($)&&oe(ie))return te(ie),!0;return!1}function de(){let F=c.polygon.points,$=c.pointer;if(!c.isOpen||!F.length||c.selectedPoints.length!==1||!$)return!1;let ie=c.selectedPoints[0],le=ie===0,Se=ie===F.length-1;return le||Se}let N={reset(){v({modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:_d}})},getForType(F){let $={};if(!F)return $;let ie=hl[F];return!ie||!ie.modifiers?$:ie.modifiers},set(F){F!=="Shift"&&F!=="Alt"&&F!=="Meta"||v({modifiers:{...m.nextSlowState?.modifiers||c.slowState.modifiers,[F]:!0}})},unset(F){F!=="Shift"&&F!=="Alt"&&F!=="Meta"||v({modifiers:{...m.nextSlowState?.modifiers||c.slowState.modifiers,[F]:!1}})}},re={set(F){let $=F?F.id==="square"||F.id==="rectangle":!1;v({selectedStamp:F,boxMode:$})},clear(){re.set(null)},square(){re.set(rb)},triangle(){re.set($M)},pentagon(){re.set(QM)},hexagon(){re.set(YM)},circle(){re.set(KM)}},Le={down(F){let $=r[F]||F;if($==="Shift"||$==="Alt"||$==="Meta")return N.set($),!0;if($==="Control")return N.set("Meta"),!0;if($==="z"&&c.slowState.modifiers.Meta)return c.slowState.modifiers.Shift?M():I(),!0;if(!c.slowState.modifiers.Meta&&!c.slowState.modifiers.Alt&&!c.slowState.transitioning){if(!s)return;let ie=$.toUpperCase();if(f[ie]){let le=f[ie];return ae(le),!0}}return Re($)},up(F){let $=r[F]||F;if($==="Control"){N.unset("Meta");return}$!=="Shift"&&$!=="Alt"&&$!=="Meta"||N.unset($)}};function je(F){c.scale=F,v({modifiers:{...m.nextSlowState?.modifiers||c.slowState.modifiers,proximity:F*_d}})}function Ge(){return _d*c.scale}let $e={set:F=>{m.renderFunc=F},start:(F,$)=>{m.startTime=performance.now(),m.time=0,F&&(m.renderFunc=F),$&&($(c.slowState),m.setStateFunc=$),S(0)},stop:()=>{m.animationFrame&&(e_(m.animationFrame),m.animationFrame=0)},step:(F=16)=>{S(F)}};function Qe(F){if(!F||!Array.isArray(F)||F.length===0)return;let $=F[0];if(!(!$||!$[0]&&$[0]!==0||!$[1]&&$[1]!==0)&&!(Number.isNaN($[0])||Number.isNaN($[1]))){if(c.pointer=$,c.slowState.transitioning)m.transitionIntent&&(m.transitionIntent.transition(F,c,J()),u.emit("polygons.transition",{transitionIntent:m.transitionIntent.type}));else if(y.isPressed&&!y.noTransition&&y.lastPress&&c.pointer&&(!y.isClicking||Hn(y.lastPress,c.pointer)>10))if(clearTimeout(y.pressTimeout),y.isClicking=!1,m.transitionIntent){if(c.transitionOrigin=y.lastPress,v({transitioning:!0}),m.transitionIntent.start){let ie=m.transitionIntent.start([y.lastPress],c,J());ie&&(ie.selectedPoints&&(c.selectedPoints=ie.selectedPoints,v({selectedPoints:ie.selectedPoints})),(ie.isOpen===!0||ie.isOpen===!1)&&(c.isOpen=ie.isOpen,m.shouldUpdate=!0),ie.points&&(c.polygon.points=ie.points,c.polygon.boundingBox=null,c.polygon.iedges=null,w(c.polygon),v({closestPoint:null})))}v({transitionModifiers:m.transitionIntent.modifiers||null}),u.emit("polygons.start-transition",{transitionIntent:m.transitionIntent.type}),m.transitionIntent.transition([y.lastPress],c,J()),u.emit("polygons.transition",{transitionIntent:m.transitionIntent.type})}else y.noTransition=!0}}function Ze(){c.pointer=null,c.slowState.transitioning||(y.isPressed=!1,y.isClicking=!1,y.lastPress=null,v({transitionIntentType:null,actionIntentType:null}),m.transitionIntent=null,m.actionIntent=null)}function Ct(){y.isClicking=!0,y.isPressed=!0,y.lastPress=c.pointer,y.pressTimeout=setTimeout(()=>{y.isPressed&&(y.isClicking=!1)},250)}function xt(){c.slowState.transitioning?(v({transitioning:!1}),m.transitionIntent&&te(m.transitionIntent),m.transitionIntent=null,v({transitionIntentType:null})):y.isClicking&&(m.actionIntent&&te(m.actionIntent),m.actionIntent=null,v({actionIntentType:null})),y.isPressed=!1,y.isClicking=!1,y.lastPress=null,y.noTransition=!1,clearTimeout(y.pressTimeout)}function xn(F){c.polygon.points=F?.points||[],c.polygon.boundingBox=null,c.polygon.iedges=null,c.isOpen=F?.open||!1,w(c.polygon),m.nextSlowState=null,m.undoStack=[],m.undoStackPointer=-1,c.lineBox=null,c.line=null,y.pressTimeout&&clearTimeout(y.pressTimeout),v({noShape:F===null,shapeId:F?.id||null,transitioning:!1,actionIntentType:null,transitionIntentType:null,selectedPoints:[],hasClosestLine:!1,modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:c.slowState.modifiers.proximity},showBoundingBox:!1,currentModifiers:{},validIntentKeys:{},selectedStamp:null,closestPoint:null,pointerInsideShape:!1,boxMode:!1,fixedAspectRatio:n}),ae(i),E()}function Pt(F){if(!F)return"";let $=hl[F];return!$||!$.modifiers?$.label||"":c.slowState.modifiers.Shift&&$.modifiers.Shift?$.modifiers.Shift:c.slowState.modifiers.Alt&&$.modifiers.Alt?$.modifiers.Alt:c.slowState.modifiers.Meta&&$.modifiers.Meta?$.modifiers.Meta:$.label}function Ne(){v({fixedAspectRatio:!0})}function fe(){v({fixedAspectRatio:!1})}function ae(F){if(c.slowState.isToolSwitchingLocked||c.slowState.currentTool===F||!c.slowState.enabledTools.includes(F))return;let $=c.slowState.lastCreationTool;if(Q1(F)){if(c.slowState.isToolSwitchingLocked)return;$=F}c.slowState.transitioning&&(c.transitionPoints=null,c.transitionBoundingBox=null,c.transitionDraw=[],c.line=null,c.lineBox=null,v({transitioning:!1}));let ie=B(F),le=c.selectedPoints,Se=c.isOpen,V=c.slowState.selectedStamp;switch(F){case"pointer":c.polygon.points.length>0&&!Se&&le.length===0&&(le=c.polygon.points.map((k,X)=>X));break;case"pen":c.polygon.points.length===0?(le=[],Se=!0):Se&&le.length>1&&(le=[le[le.length-1]]);break;case"line":c.polygon.points.length===0?(le=[],Se=!0):Se?le.length>1&&(le=[le[le.length-1]]):(le=[c.polygon.points.length-1],Se=!0);break;case"pencil":le=[],c.polygon.points.length===0&&(Se=!0);break;case"box":le=c.polygon.points.map((k,X)=>X),Se=!1,re.square();break;case"lineBox":le=[],c.polygon.points.length===0&&(Se=!0);break;case"stamp":le=[],Se=!1,V||re.square();break;case"hand":le=[];break;default:le=[];break}v({validIntentKeys:ie}),v({currentTool:F,selectedPoints:le,lastCreationTool:$,boxMode:F==="box"}),c.selectedPoints=le,c.isOpen=Se,De(F),G()}function De(F){let $=F==="box"||F==="pointer"&&c.polygon.points.length>2&&c.selectedPoints.length===c.polygon.points.length&&!c.isOpen;v({showBoundingBox:$})}function Rt(F){c.slowState.currentTool===F&&ae("pointer")}function ui(F){c.slowState.currentTool===F?ae("pointer"):ae(F)}let un={undo:I,redo:M,get canUndo(){return m.undoStackPointer>-1},get canRedo(){return m.undoStackPointer<m.undoStack.length-1}},Sn={setTool:ae,unsetTool:Rt,toggleTool:ui,updateVisibility:De,setCanDelete(F){v({canDelete:F})},setCanDeselect(F){kn(),v({canDeselect:F})},lockToolSwitching(){v({isToolSwitchingLocked:!0})},unlockToolSwitching(){v({isToolSwitchingLocked:!1})},toggleToolSwitching(){v({isToolSwitchingLocked:!c.slowState.isToolSwitchingLocked})},shortcuts:Object.fromEntries(Object.entries(f).map(([F,$])=>[$,F])),getValidIntents(F){let $=F||c.slowState.currentTool;return{actions:dl.filter(ie=>ie.tools.includes($)),transitions:fl.filter(ie=>ie.tools.includes($)),keys:Vs.filter(ie=>ie.tools.includes($)),all:B($),current:c.slowState.validIntentKeys}},getToolInfo(){return{name:c.slowState.currentTool,cursor:c.slowState.cursor,selectionCount:c.selectedPoints.length,pointCount:c.polygon.points.length,isOpen:c.isOpen}},smartSelect(){c.polygon.points.length!==0&&(c.isOpen?(c.selectedPoints=[c.polygon.points.length-1],v({selectedPoints:c.selectedPoints})):(c.selectedPoints=c.polygon.points.map((F,$)=>$),v({selectedPoints:c.selectedPoints})))},clearSelection(){c.selectedPoints=[],v({selectedPoints:[]})},autoSelect(){c.selectedPoints.length===c.polygon.points.length&&!c.isOpen?ae("pointer"):c.isOpen||c.selectedPoints.length>0?ae(c.slowState.lastCreationTool||"pen"):ae("pointer")}},aa={enabled:()=>c.slowState.snapEnabled,enable:()=>v({snapEnabled:!0}),disable:()=>v({snapEnabled:!1}),toggle:()=>v({snapEnabled:!c.slowState.snapEnabled}),pointsEnabled:()=>c.slowState.snapToPoints,enablePoints:()=>v({snapToPoints:!0}),disablePoints:()=>v({snapToPoints:!1}),togglePoints:()=>v({snapToPoints:!c.slowState.snapToPoints}),linesEnabled:()=>c.slowState.snapToLines,enableLines:()=>v({snapToLines:!0}),disableLines:()=>v({snapToLines:!1}),toggleLines:()=>v({snapToLines:!c.slowState.snapToLines}),intersectionsEnabled:()=>c.slowState.snapToIntersections,enableIntersections:()=>v({snapToIntersections:!0}),disableIntersections:()=>v({snapToIntersections:!1}),toggleIntersections:()=>v({snapToIntersections:!c.slowState.snapToIntersections}),gridEnabled:()=>c.slowState.snapToGrid,enableGrid:()=>v({snapToGrid:!0}),disableGrid:()=>v({snapToGrid:!1}),toggleGrid:()=>v({snapToGrid:!c.slowState.snapToGrid}),parallelEnabled:()=>c.slowState.snapToParallel,enableParallel:()=>v({snapToParallel:!0}),disableParallel:()=>v({snapToParallel:!1}),toggleParallel:()=>v({snapToParallel:!c.slowState.snapToParallel}),getThreshold:()=>c.snapThreshold*c.slowState.modifiers.proximity,setThreshold:F=>{c.snapThreshold=Math.max(5,Math.min(50,F))},isActive:()=>c.isSnapping,getSnapPoint:()=>c.snapPoint,getActiveGuides:()=>c.activeSnapGuides,getTargets:()=>c.snapTargets};function kn(){v({selectedPoints:c.polygon.points.map((F,$)=>$)})}function la(F){v({bounds:F})}return ae(i),{state:c,setState:v,emitter:u,modifiers:N,stamps:re,history:un,key:Le,setScale:je,clock:$e,pointer:Qe,blur:Ze,pointerDown:Ct,pointerUp:xt,setShape:xn,label:Pt,tools:Sn,snap:aa,selectAllPoints:kn,setBounds:la,lockAspectRatio:Ne,unlockAspectRatio:fe}}function js(e){let t=Math.max(...e.map(s=>s[0])),n=Math.min(...e.map(s=>s[0])),i=Math.max(...e.map(s=>s[1])),r=Math.min(...e.map(s=>s[1]));for(let s of e)if(s[0]!==n&&s[0]!==t&&s[1]!==r&&s[1]!==i||s[0]<n||s[0]>t||s[1]<r||s[1]>i)return!1;return!0}function Br(e){if(!e)return null;if(e.points.length>2){let t=Math.min(...e.points.map(s=>s[0])),n=Math.min(...e.points.map(s=>s[1])),i=Math.max(0,...e.points.map(s=>s[0])),r=Math.max(0,...e.points.map(s=>s[1]));return{x:t,y:n,width:i-t,height:r-n}}return null}function ab(e){return e.type==="SvgSelector"}function n_(e){return e.type==="BoxSelector"}function kd(e,t){if(ab(e)){let l=e.svgShape==="polyline";if(!e.points||e.points.length===0)return null;if(t){let{width:u,height:f}=t;return{type:"SvgSelector",value:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${u} ${f}" width="${u}" height="${f}"><${l?"polygon":"polyline"} points="${e.points.map(c=>c.join(",")).join(" ")}" /></svg>`}}return{type:"SvgSelector",value:`<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><g><path d='M${e.points.map(u=>u.join(",")).join(" ")}${l?" Z":""}' /></g></svg>`}}if(!e.spatial)return null;let{x:n,y:i,width:r,height:s}=e.spatial||{};return!r||!s?null:{type:"FragmentSelector",value:`xywh=${~~n},${~~i},${~~r},${~~s}`}}function Hs(e,t){if(!e||!e.points.length)return null;if(js(e.points)){let n=e.points.map(f=>f[0]),i=e.points.map(f=>f[1]),r=Math.min(...n),s=Math.min(...i),l=Math.max(...n)-r,u=Math.max(...i)-s;return kd({type:"BoxSelector",spatial:{x:r,y:s,width:l,height:u}},t)}return kd({type:"SvgSelector",points:e.points,svgShape:e.open?"polygon":"polyline"},t)}function ml(e){if(e.type==="polygon"&&!e.noBox&&e.points&&js(e.points)){let n=Br({open:!1,points:e.points||[]});return ml({...e,type:"box",selector:n})}if(e.type==="polygon"||e.type==="draw")return{polygon:{points:e.points||[],open:e.open||!1},requestType:e.type,boundingBox:Br({points:e.points||[],open:!1}),metadata:{},arguments:e.arguments||{},target:Hs({points:e.points||[],open:!1},e.bounds)};let t=e.selector;if(t){let n=[[t.x,t.y],[t.x+t.width,t.y],[t.x+t.width,t.y+t.height],[t.x,t.y+t.height]];return{polygon:{points:n,open:!1},requestType:e.type,boundingBox:t,metadata:{},target:Hs({points:n,open:!1},e.bounds),arguments:e.arguments||{}}}return{polygon:{points:[],open:!1},requestType:e.type,boundingBox:null,target:null,metadata:{},arguments:e.arguments||{}}}var i_={shapeId:null,noShape:!0,transitioning:!1,actionIntentType:null,transitionIntentType:null,selectedPoints:[],hasClosestLine:!1,lastCreationTool:null,modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:0},bounds:null,showBoundingBox:!1,currentModifiers:{},validIntentKeys:{},pointerInsideShape:!1,closestPoint:null,transitionModifiers:null,selectedStamp:null,bezierLines:[],boxMode:!1,fixedAspectRatio:!1,cursor:"",enabledTools:["pointer","pen","box","lineBox","stamp","hand","line","pencil"],canDelete:!0,canDeselect:!0,isToolSwitchingLocked:!1,currentTool:"box",snapEnabled:!1,snapToPoints:!1,snapToLines:!1,snapToIntersections:!1,snapToGrid:!1,snapToParallel:!1};function ug({events:e,enabledTools:t,keyboardShortcutMapping:n,keyboardShortcutsEnabled:i=!1,debug:r}){let s=zn((u,f)=>{let p=null,m=sb({emitter:e,keyboardShortcutsEnabled:i,keyboardShortcutMapping:n,enabledTools:t,customSetState:y=>{r&&console.log("partial state",y),u(w=>({polygonState:{...w.polygonState,...y}}))}},y=>{u(w=>w.tool.requestId?{polygon:{...y,id:w.tool.requestId}}:{polygon:{id:void 0,points:[],open:!0}}),e.emit("atlas.polygon-update",y)});return{mode:"explore",tool:{enabled:!1,requestId:null,canvasId:null},requestType:null,requests:{},history:m.history,polygon:null,validRequestIds:[],metadata:{},stableViewport:null,canvasRelativePositions:{},canvasViewports:{},polygons:m,polygonState:i_,setMetadata:(y,w)=>{let v=w||f().tool.requestId;v&&u(S=>({metadata:{...S.metadata,[v]:{...S.metadata[v]||{},...y}}}))},setToolCanvasId:y=>{u(w=>({tool:{...w.tool,canvasId:y}}))},switchTool:{pointer(){u({mode:"sketch"}),l.tools.setTool("pointer")},hand(){u({mode:"explore"}),l.tools.setTool("hand")},draw(){u({mode:"sketch"}),l.tools.setTool("pencil")},pen(){u({mode:"sketch"}),l.tools.setTool("pen")},line(){u({mode:"sketch"}),l.tools.setTool("line")},lineBox(){u({mode:"sketch"}),l.tools.setTool("lineBox")},box(){u({mode:"sketch"}),l.tools.setTool("box")},triangle(){u({mode:"sketch"}),l.tools.setTool("stamp"),l.stamps.triangle()},hexagon(){u({mode:"sketch"}),l.tools.setTool("stamp"),l.stamps.hexagon()},circle(){u({mode:"sketch"}),l.tools.setTool("stamp"),l.stamps.circle()},remove(){let y=f();y.tool.requestId&&(m.setShape({points:[],open:!0}),y.cancelRequest(y.tool.requestId))}},reset:()=>{let y=f();y.tool.requestId&&y.cancelRequest(y.tool.requestId)},setPolygonState:y=>u({polygonState:typeof y=="function"?y(f().polygonState):y}),getRequestId:()=>{let y=Math.random().toString(36).slice(2);return u(w=>({validRequestIds:[...w.validRequestIds,y]})),{requestId:y,clear:()=>{f().tool.requestId,u(w=>({tool:w.tool.requestId===y?{enabled:!1,requestId:null,canvasId:null}:w.tool,validRequestIds:w.validRequestIds.filter(v=>v!==y)}))}}},cancelRequest:y=>{let w=y||f().tool.requestId;w&&(u(v=>({mode:"explore",tool:v.tool.requestId===w?{enabled:!1,requestId:null,canvasId:null}:v.tool,validRequestIds:v.validRequestIds.filter(S=>S!==w)})),e.emit("atlas.request-cancelled",{id:w}))},requestAnnotation:async(y,w)=>{let S={...f().requests,[w.requestId]:y},E=ml(y);r&&console.log("requestAnnotation",{response:E,request:y});try{let{points:R=[],open:b=!0}=E.polygon||{},{requestId:I,canvasId:M=null,toolId:T}=w,_=T,U=f(),H=U.validRequestIds.includes(I),Z=E.requestType;return r&&console.log("setting points",{requestType:Z,points:R,open:b}),!H||U.tool.enabled?null:(m.setShape({id:I,points:R,open:b}),Z==="polygon"&&(_=_||"pen",m.tools.setTool("pen")),Z==="draw"&&(_=_||"draw",m.tools.setTool("pencil")),Z==="box"&&(_=_||"box",m.tools.setTool("box")),Z==="target"?(_=_||"box",m.tools.setTool("box"),m.lockAspectRatio(),m.tools.lockToolSwitching(),m.tools.setCanDeselect(!1),m.tools.setCanDelete(!1)):(m.tools.unlockToolSwitching(),m.tools.setCanDeselect(!0),m.tools.setCanDelete(!0)),y.bounds&&m.setBounds(y.bounds),e.emit("atlas.annotation-request",{id:I}),u({polygon:{id:I,points:R,open:b},mode:"sketch",requestType:Z,tool:{enabled:!0,requestId:I,canvasId:M},requests:S}),_?U.switchTool[_]?.():R.length===0&&U.switchTool.box(),(typeof y.selectByDefault>"u"&&R.length&&Z==="box"||y.selectByDefault)&&U.switchTool.pointer(),new Promise(B=>{let G=ce=>{ce.id===I&&(u(J=>({mode:"explore",tool:{requestId:null,enabled:!1,canvasId:null},requests:Object.fromEntries(Object.entries(J.requests).filter(([te])=>te!==I))})),e.off("atlas.request-cancelled",G),e.off("atlas.annotation-completed",K),B(null))},K=ce=>{ce.id===I&&(u(J=>({mode:"explore",tool:{requestId:null,enabled:!1,canvasId:null},requests:Object.fromEntries(Object.entries(J.requests).filter(([te])=>te!==I))})),e.off("atlas.annotation-completed",K),e.off("atlas.request-cancelled",G),B(ce))};e.on("atlas.request-cancelled",G),e.on("atlas.annotation-completed",K)}))}catch(R){return console.error(R),null}},completeRequest:y=>{let w=f().tool.requestId;if(typeof y=="string"&&y&&y!==w)return;let v=w?f().requests[w]?.arguments||{}:{},S=w?f().metadata[w]||{}:{},E=f().polygonState.bounds,R=f().polygon;R&&(e.emit("atlas.annotation-completed",{id:R.id,polygon:R,requestType:f().requestType,target:Hs(R,E),canvasId:f().tool.canvasId,boundingBox:Br(R),metadata:S,arguments:{...v}}),m.setShape(null))},setAtlasRuntime:y=>{p=y,e.emit("atlas.ready",{runtime:y}),l.setScale(1/p._lastGoodScale),p.world.addLayoutSubscriber((w,v)=>{(w==="event-activation"||w==="zoom-to"||w==="go-home")&&p?._lastGoodScale&&!Number.isNaN(p._lastGoodScale)&&l.setScale(1/p._lastGoodScale)})},clearAtlasRuntime:()=>{p=null,u({stableViewport:null})},setCanvasRelativePosition:(y,w)=>{u(v=>({canvasRelativePositions:{...v.canvasRelativePositions,[y]:w}}))},clearCanvasRelativePosition:y=>{u(w=>{let v={...w.canvasRelativePositions};return delete v[y],{canvasRelativePositions:v}})},changeMode:y=>{u({mode:y})},nudgeLeft:()=>{},nudgeRight:()=>{},nudgeUp:()=>{},nudgeDown:()=>{},zoomIn:()=>{p?.world?.zoomIn()},zoomOut:()=>{p?.world?.zoomOut()},goHome:()=>{p?.world?.goHome()}}}),l=s.getState().polygons;return e.on("atlas.annotation-request",()=>{l.clock.start((u,f,p)=>{e.emit("atlas.polygon-render",{state:u,slowState:f,dt:p})},u=>{typeof u=="object"?s.setState({polygonState:u}):s.setState(f=>({polygonState:u(f.polygonState)}))})}),e.on("atlas.annotation-completed",()=>{l.clock.stop()}),e.on("atlas.request-cancelled",()=>{l.clock.stop()}),s}var dg=A(D(),1),Fo=(0,or.createContext)(null);function st(){return(0,or.useContext)(Fo)}var cg={};function fg(e="atlas"){return cg[e]?.getState()}function Ws({children:e,name:t="atlas",existing:n,atlasStoreConfig:i}){let r=ag(),s=(0,or.useContext)(Fo),l=(0,or.useMemo)(()=>n||s||ug({events:r,...i||{}}),[r,n,s]),u=ve(l,f=>f.mode);return(0,or.useEffect)(()=>{let f=t;return f&&(cg[f]=l),()=>{f&&delete cg[f]}},[l,t]),(0,dg.jsx)(Fo.Provider,{value:l,children:(0,dg.jsx)(Bs.Provider,{value:u||"explore",children:e})})}var fb=A(Q(),1);var Us=A(Q(),1),lb=A(D(),1);function hg(){return{default:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(252,0,98, .5)"},highlighted:{backgroundColor:"rgba(75, 103, 225, 0.4)",borderWidth:"1px",borderColor:"rgba(75,103,225,0.99)"},hidden:{borderWidth:"0px",borderColor:"rgba(0,0,0,0)",backgroundColor:"rgba(0,0,0,0)",hidden:!0}}}var pg=(0,Us.createContext)(hg());pg.displayName="AnnotationStyle";function gl(){return(0,Us.useContext)(pg)}function r_({theme:e,children:t}){let n=(0,Us.useMemo)(()=>e||hg(),[e]);return(0,lb.jsx)(pg.Provider,{value:n,children:t})}var ub=A(Q(),1);function yl(e={},t=[]){let{id:n,selector:i}=e,r=rn(),s=ze(),l=n||r.annotation,u=qe(p=>l?p.iiif.entities.Annotation[l]:void 0,[l]),f=qe(p=>u&&u.body?u.body.map(c=>c?c.type==="SpecificResource"?{...c,source:s.get(c)}:c?p.iiif.entities[c.type][c.id]:null:null).filter(Boolean):[],[u]);return(0,ub.useMemo)(()=>{if(!u)return;let p={...u,body:f,target:Tt(u.target,{typeMap:s.getState().iiif.mapping})};return i?i(p):p},[u,i,f,...t])}var cb=A(Q(),1);function Ce(e={},t=[]){let{id:n,selector:i}=e,r=rn(),s=n||r.canvas,l=qe(u=>s?u.iiif.entities.Canvas[s]:void 0,[s]);return(0,cb.useMemo)(()=>{if(l)return i?i(l):l},[l,i,...t])}var mg=A(Q(),1);function vl(e=rr){return{addEventListener(t,n,i,r){if(t)return e.setMetaValue([t.id,"eventManager",n],s=>{let l=s||[];for(let u of l)if(u.callback===i)return l;return[...l,{callback:i,scope:r}]}),i},removeEventListener(t,n,i){t&&e.setMetaValue([t.id,"eventManager",n],r=>(r||[]).filter(s=>s.callback!==i))},getListenersAsProps(t,n){let i=typeof t=="string"?{id:t}:t;if(!i||!i.id)return{};let r=e.getResourceMeta(i.id,"eventManager"),s={};if(r&&i)for(let l of Object.keys(r))s[l]=u=>{let f=e.get(i);for(let{callback:p,scope:c}of r[l]||[])(!c||n&&c.indexOf(n)!==-1)&&p(u,f)};return s}}}function xl(e,t){let n=ze(),i=(0,mg.useMemo)(()=>vl(n),[n]),r=qe(()=>e&&e.id?n.getResourceMeta(e.id,"eventManager"):null,[e]);return(0,mg.useMemo)(()=>e?i.getListenersAsProps(e,t):{},[r,e,n,t])}var db=A(Q(),1);function Vr(e=rr){return{applyStyles(t,n,i){let r=typeof t=="string"?t:t.id;return e.setMetaValue([r,"styles",n],i)},getAppliedStyles(t){let n=typeof t=="string"?t:t.id;return e.getResourceMeta(n,"styles")}}}function No(e,t){let n=ze(),i=(0,db.useMemo)(()=>Vr(n),[n]);return qe(()=>{if(!e)return null;let r=i.getAppliedStyles(e.id);return r?t?r[t]:r:void 0},[e,t])}var hb=A(D(),1),zo=({id:e,style:t,className:n,interactive:i,targetId:r,ignoreTargetId:s})=>{let l=yl({id:e}),u=No(l,"atlas"),f=No(l,"html"),p=xl(l,["atlas"]),c=Ce(),m=gl(),y=(0,fb.useMemo)(()=>sg(sg(t,u),l?.motivation?.includes("highlighting")?m.highlighted:m.default),[t,u,m,l?.motivation]),w=r||c?.id;return c&&l&&l.target&&l.target.selector&&(l.target.selector.type==="BoxSelector"||l.target.selector.type==="SvgSelector")&&l.target.source&&(s?!0:l.target.source.id===w||l.target.source===w)?(0,hb.jsx)(V1,{id:l.id,isEditing:!0,region:l.target.selector.spatial,style:y,className:f?.className||n,interactive:!!(f?.href||i),href:f?.href||null,title:f?.title||null,hrefTarget:f?.target||null,onClick:()=>{},...p}):null};var mb=A(Q(),1);var pb=A(Q(),1);function gg(e={},t=[]){let{id:n,selector:i}=e,r=rn(),s=n||r.annotationPage,l=qe(u=>s?u.iiif.entities.AnnotationPage[s]:void 0,[s]);return(0,pb.useMemo)(()=>{if(l)return i?i(l):l},[l,...t])}var yg=A(D(),1),jr=({className:e,page:t,targetId:n,ignoreTargetId:i})=>{let r=gg({id:t.id})||t,s=No(r,"atlas"),l=No(r,"html");return qe(u=>r.id?u.iiif.entities.AnnotationPage[r.id]:null,[]),(0,yg.jsx)(mb.Fragment,{children:r.items?.map(u=>(0,yg.jsx)(zo,{id:u.id,style:s,className:l?.className||e,targetId:n,ignoreTargetId:i},u.id))})};var Hr=A(Q(),1),Ld=A(D(),1),gb=(0,Hr.createContext)(null),yb=(0,Hr.createContext)(null),vb=(0,Hr.createContext)(null);function o_(){let e=(0,Hr.useContext)(gb);if(!e)throw new Error("Ctx not found");return e}function s_(){let e=(0,Hr.useContext)(yb);if(!e)throw new Error("Ctx not found");return e}function a_(){let e=(0,Hr.useContext)(vb);if(!e)throw new Error("Ctx not found");return e}function Sl({actions:e,state:t,children:n,currentTime:i,progress:r,element:s}){return(0,Ld.jsx)(vb.Provider,{value:{currentTime:i,progress:r,element:s},children:(0,Ld.jsx)(yb.Provider,{value:e,children:(0,Ld.jsx)(gb.Provider,{value:t,children:n})})})}var bb=A(Q(),1);function xb(e,t,n=[],i=!1,r=[]){if(r.length&&(t=t.filter(l=>r.indexOf(l)===-1)),!t||t.length===0)return;if(t.length===1)return t[0];if(!e)return t.indexOf("none")===-1?t[0]:"none";if(t.indexOf(e)!==-1)return e;let s=e.indexOf("-")===-1?null:e.slice(0,e.indexOf("-"));if(s&&t.indexOf(s)!==-1)return s;for(let l of n)if(t.indexOf(l)!==-1)return l;if(!i&&e){let l=t.map(f=>f.indexOf("-")===-1?null:f.slice(0,f.indexOf("-"))),u=l.indexOf(e);if(u!==-1)return t[u];for(let f of n){let p=f.indexOf("-")===-1?null:f.slice(0,f.indexOf("-")),c=p?t.indexOf(p):-1;if(c!==-1)return t[c]}}return t.indexOf("none")===-1?t.indexOf("@none")===-1?t[0]:"@none":"none"}function vg(e,t,n={}){let{strictFallback:i=!1,defaultText:r="",separator:s=`
77
- `,fallbackLanguages:l=[],closest:u,skipLanguages:f}=n,p=Object.keys(e||{}),c=u?t:xb(t,p,l,i,f);if(!e)return r;if(typeof e=="string")return e;let m=c?e[c]:void 0;if(m&&c){if(typeof m=="string")return m;if(m.length===1&&m[0]===""){let y=n.skipLanguages||[];return vg(e,t,{...n,skipLanguages:[...y,c]})}return m.join(s)}return""}function Fd(e,t={}){return vg(e,t.language||(typeof navigator<"u"?navigator.language:"en"),t)}var l_=Sb();function Sb(e={}){return(t,...n)=>{let i="";for(let r=0;r<t.length;r++)if(i+=t[r],r<n.length){let s=n[r];if(s==null)continue;typeof s=="string"?i+=s:i+=Fd(s,e)}return i}}function wb(e){return e.type==="SpecificResource"?[e.source,{selector:e.selector}]:[e,{selector:null}]}function xg(e=rr){function t(r){let s=r?typeof r=="string"?e.get(r):r:null;if(!s)return[];let l=e.get(s.items,{parent:s}),u=[];for(let f of l)u.push(...e.get(f.items,{parent:f}));return u}function n(r,s=[]){let l=Array.isArray(r)?r:t(r),u=[],f={items:[],type:"complex-choice"},p=[];for(let c of l){if(c.type!=="Annotation")throw Error("getPaintables() accept either a canvas or list of annotations");let m=Array.from(Array.isArray(c.body)?c.body:[c.body]);for(let y of m){let[w,{selector:v}]=wb(y),S=e.get(w),E=(S.type||"unknown").toLowerCase();if(E==="choice"){let R=e.get(S.items,{parent:S.id}),b=s.length?s.map(I=>R.find(M=>M.id===I)).filter(Boolean):[R[0]];b.length===0&&b.push(R[0]),f.items.push({type:"single-choice",items:R.map(I=>({id:I.id,label:I.label,selected:b.indexOf(I)!==-1})),label:w.label}),m.push(...b);continue}u.indexOf(E)===-1&&u.push(E),p.push({type:E,annotationId:c.id,annotation:c,resource:S,target:c.target,selector:v})}}return{types:u,items:p,choice:f.items.length<2?f.items[0]||null:f,allChoices:f.items.length?f:null}}function i(r){let{choice:s}=n(r);return s}return{getAllPaintingAnnotations:t,getPaintables:n,extractChoices:i}}function wl(){let e=It(),t=Ce();return(0,bb.useMemo)(()=>{if(!e||!t||!e.start)return null;let n=Tt(e.start);return!n||n.source.id!==t.id||!n||!n.selector||n.selector.type!=="TemporalSelector"?null:n.selector.temporal},[e,t])}var bt=A(Q(),1);function Rb(e){return{isMuted:!1,playRequested:!1,isPlaying:!1,isFinished:!1,volume:100,duration:e}}function u_(e,t){switch(t.type){case"RESET":return t.state;case"FINISHED":return{...e,isFinished:!0,isPlaying:!1,playRequested:!1};case"PLAY_PAUSE":return{...e,isFinished:!1,isPlaying:!e.isPlaying};case"PLAY_REQUESTED":return{...e,isFinished:!1,playRequested:!0};case"PAUSE":return{...e,isPlaying:!1};case"PLAY":return{...e,isFinished:!1,playRequested:!1,isPlaying:!0};case"MUTE":return{...e,isMuted:!0};case"SET_VOLUME":return{...e,volume:t.volume,isMuted:t.volume===0};case"TOGGLE_MUTE":return{...e,isMuted:!e.isMuted};case"UNMUTE":return{...e,isMuted:!1}}return e}function Nd(e){let t=Math.round(e);return`${Math.floor(t/60)}:${`${t%60}`.padStart(2,"0")}`}function Do(e){let[t,n]=(0,bt.useReducer)(u_,Rb(e.duration));(0,bt.useEffect)(()=>{n({type:"RESET",state:Rb(e.duration)})},[e.duration]);let i=(0,bt.useRef)(null),r=(0,bt.useRef)(null),s=(0,bt.useRef)(null),l=(0,bt.useRef)(!1),u=(0,bt.useCallback)(()=>{r.current&&i.current&&(r.current.innerHTML=Nd(i.current.currentTime),s.current&&(s.current.style.width=`${i.current.currentTime/e.duration*100}%`),l.current!==i.current.muted&&(l.current=i.current.muted,n(i.current.muted?{type:"MUTE"}:{type:"UNMUTE"})))},[e.duration]),f=(0,bt.useCallback)(()=>{i.current&&(n({type:"PLAY_REQUESTED"}),i.current.play().then(()=>{n({type:"PLAY"})}),u())},[u]),p=(0,bt.useCallback)(()=>{i.current&&(i.current.duration>0&&i.current.paused?f():c())},[u]),c=(0,bt.useCallback)(()=>{i.current&&(i.current.pause(),n({type:"PAUSE"}),u())},[u]),m=(0,bt.useCallback)(()=>{i.current&&(i.current.muted=!i.current.muted,n(i.current.muted?{type:"MUTE"}:{type:"UNMUTE"}))},[]),y=(0,bt.useCallback)(()=>{i.current&&(i.current.muted=!0,n({type:"MUTE"}))},[]),w=(0,bt.useCallback)(()=>{i.current&&(i.current.muted=!1,n({type:"UNMUTE"}))},[]),v=(0,bt.useCallback)(R=>{i.current&&(i.current.muted=!1,i.current.volume=R/100,n({type:"SET_VOLUME",volume:R}))},[]),S=(0,bt.useCallback)(R=>{i.current&&(i.current.currentTime=Math.max(0,Math.min(R*e.duration,e.duration)),u())},[]),E=(0,bt.useCallback)(R=>{if(i.current){let b=typeof R=="function"?R(i.current.currentTime):R;i.current.currentTime=Math.max(0,Math.min(b,e.duration)),u()}},[]);return(0,bt.useEffect)(()=>{let R=setInterval(()=>{u()},350);return()=>clearInterval(R)},[u,e.duration]),(0,bt.useEffect)(()=>{let R=()=>{n({type:"FINISHED"})},b=i.current;return b?.addEventListener("ended",R),()=>b?.removeEventListener("ended",R)},[]),[{element:i,currentTime:r,progress:s},t,{play:f,pause:c,playPause:p,mute:y,unmute:w,toggleMute:m,setVolume:v,setDurationPercent:S,setTime:E}]}var Bo=A(Q(),1),Sg=(0,Bo.createContext)(()=>{}),wg=(0,Bo.createContext)(()=>{});function Kt(e,t,n,i,r=[]){let s=(0,Bo.useContext)(e==="portal"?wg:Sg);(0,Bo.useEffect)(()=>(e!=="none"&&s(t,n,i),()=>{s(t,null)}),[t,e,s,...r])}var Dd=A(D(),1);function bg({media:e,startTime:t,children:n}){let[{element:i,currentTime:r,progress:s},l,u]=Do({duration:e.duration}),f=t?`${e.url}#t=${t}`:e.url;return(0,Dd.jsxs)(Sl,{state:l,actions:u,currentTime:r,progress:s,element:i,children:[(0,Dd.jsx)("audio",{ref:i,src:f}),n]},e.url)}function zd({media:e,mediaControlsDeps:t,audioCopmonent:n=bg,children:i}){let r=wl();return Kt("portal","audio",n,{media:e,startTime:r?r.startTime:null,children:i},[e,r,...t||[]]),null}var Bd=A(Q(),1),Wr=(0,Bd.createContext)(null);Wr.displayName="Strategy";function gt(){let e=(0,Bd.useContext)(Wr);if(!e)throw new Error("useStrategy must be used within a StrategyProvider");return e}var Ur=A(D(),1);function Rg({model:e}){return(0,Ur.jsxs)(Ur.Fragment,{children:[(0,Ur.jsx)("style",{children:`
85
+ `}),i]})}),lv=()=>(0,YI.useContext)(av),sv=()=>{let t=lv();return t?t.runtime:void 0};var XI=(t,e=[])=>{let n=sv();(0,QI.useEffect)(()=>n?n.registerHook("useFrame",t):()=>{},e)},uv=()=>{let t=lv();return t&&t.canvas?t.canvas:void 0};function aq(){return(0,KI.useContext)(ov)}async function oq(t,e,n){if(pR.version.startsWith("18.")||pR.version.startsWith("19.")){let i=await Promise.resolve().then(()=>_(aI(),1)),a=i.default?i.default.createRoot:i.createRoot;n.current||(n.current=a(t)),n.current.render(e)}else if(typeof ReactDOM<"u"){let{render:i,unmountComponentAtNode:a}=ReactDOM;i(e,t),n.current={unmount(){a(t)}}}else{let i=await Promise.resolve().then(()=>_(ms(),1)),a=i.default?i.default.render:i.render,o=i.default?i.default.unmountComponentAtNode:i.unmountComponentAtNode;a(e,t),n.current={unmount(){o(t)}}}}var Ni=yo.default.forwardRef(({children:t,...e},n)=>{let i=(0,yo.useRef)(),a=sv(),o=(0,yo.useRef)(0),s=(0,yo.useRef)(),u=(0,yo.useRef)();return XI(()=>{if(e.relative){let d=i.current;if(d&&a){let p=a.getScaleFactor();o.current!==p&&(o.current=p,d.style.transformOrigin="0 0",d.style.transform=`scale(${1/o.current})`,d.style.width=`${o.current*100}%`,d.style.height=`${o.current*100}%`,i.current&&s.current?.__owner.value?.rotation&&(d.style.transform=`scale(${1/o.current}) translate(50%, 50%) rotate(${s.current?.__owner.value?.rotation||0}deg) translate(-50%, -50%)`))}}},[e.relative]),(0,yo.useLayoutEffect)(()=>{let d=s.current;n&&d&&(typeof n=="function"?n(d):n.current=d);async function p(){if(d&&d.__host){let f=e.relative?(0,mR.jsx)("div",{ref:i,children:t}):t;await oq(d.__host.element,f,u)}}d&&d.__host?p():d&&(d.__onCreate=p)},[n,t,s,e.relative]),(0,yo.useLayoutEffect)(()=>()=>{u.current&&setTimeout(()=>{u.current.unmount()},0)},[]),(0,mR.jsx)("box",{html:!0,...e,ref:s})});Ni.displayName="HTMLPortal";var vI=(t,e,n=[])=>{let i=sv(),a=i?i.world:void 0;(0,ZI.useEffect)(()=>{if(i){let o=e,s=Vc[t];i.world.activatedEvents.push(s);let u=s.slice(2).toLowerCase();return i.world.addEventListener(u,o),()=>{i.world.removeEventListener(u,o)}}return()=>{}},[a,t,...n])};function SI(t,e){if(t===0)return[0,1];if(e===0)return[1,0];let n=Math.abs(t)/Math.abs(e);return[n,1-n]}function sq(){let t=(0,cv.useRef)({ctrl:!1,shift:!1,alt:!1});return(0,cv.useLayoutEffect)(()=>{function e(i){i.key==="Shift"&&(t.current.shift=!0),i.key==="Control"&&(t.current.ctrl=!0),i.key==="Alt"&&(t.current.alt=!0)}function n(i){i.key==="Shift"&&(t.current.shift=!1),i.key==="Control"&&(t.current.ctrl=!1),i.key==="Alt"&&(t.current.alt=!1)}return window.addEventListener("keydown",e),window.addEventListener("keyup",n),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",n)}},[]),t}var JI=(t,e)=>{let n=Pj(),i=sv(),a=aq(),o=(0,wn.useRef)(),s=(0,wn.useRef)(null),u=(0,wn.useRef)(),[d,p]=(0,wn.useState)(!1),f=(0,wn.useRef)(!1),m=(0,wn.useRef)({north:0,south:0,east:0,west:0}),g=sq(),v=(0,wn.useCallback)(x=>A=>{if(f.current=!0,p(!0),a&&i){let{top:C,left:M}=a,I=i.viewerToWorld(A.pageX-M,A.pageY-C);u.current={x:I.x,y:I.y},o.current=x}},[a,i]),S=(0,wn.useMemo)(()=>t.width/t.height,[t.width,t.height]),R=(0,wn.useCallback)(x=>{if(!Math.abs(x.north-x.south+(x.east-x.west)))return;let A=-x.west+x.east,C=-x.north+x.south,M=t.width+A,I=t.height+C;if(M/I>=S){let z=I*S,D=M-z,[k,B]=SI(x.east,x.west);x.west=x.west+D*B,x.east=x.east-D*k}else{let z=M/S,D=I-z,[k,B]=SI(x.north,x.south);x.north=x.north+D*k,x.south=x.south-D*B}},[t.width,t.height,S]);XI(()=>{u&&i&&i.updateNextFrame()}),(0,wn.useEffect)(()=>{i&&i.updateNextFrame()},[i,d]);let T=(0,wn.useCallback)(x=>{if(!i||!a||i.mode!=="sketch")return;let{top:A,left:C}=a,M=i.viewerToWorld(x.pageX-C,x.pageY-A),I=s.current,z=!t.maintainAspectRatio&&g.current.alt,D=!z&&g.current.shift&&o.current?.indexOf("-")!==-1;if((o.current==="translate"||o.current==="east"||o.current==="north-east"||o.current==="south-east")&&(m.current.east=M.x-(u.current?u.current.x:0),z&&(m.current.west=-m.current.east)),(o.current==="translate"||o.current==="west"||o.current==="north-west"||o.current==="south-west")&&(m.current.west=M.x-(u.current?u.current.x:0),z&&(m.current.east=-m.current.west)),(o.current==="translate"||o.current==="north"||o.current==="north-east"||o.current==="north-west")&&(m.current.north=M.y-(u.current?u.current.y:0),z&&(m.current.south=-m.current.north)),(o.current==="translate"||o.current==="south"||o.current==="south-west"||o.current==="south-east")&&(m.current.south=M.y-(u.current?u.current.y:0),z&&(m.current.north=-m.current.south)),(t.maintainAspectRatio||D)&&R(m.current),I){let k=m.current.west,B=m.current.north,Q=t.width+m.current.east,it=t.height+m.current.south;I.points[1]=Math.min(k,Q),I.points[2]=Math.min(B,it),I.points[3]=Math.max(k,Q),I.points[4]=Math.max(B,it),i.updateNextFrame()}},[i,t.width,t.height,t.maintainAspectRatio,a]);vI("mousemove",T,[t.width,t.height,a]),vI("pointermove",T,[t.width,t.height,a]);let E=(0,wn.useRef)();return(0,wn.useEffect)(()=>{E.current=()=>{if(f.current){let x=m.current.west,A=m.current.north,C=t.width+m.current.east,M=t.height+m.current.south,I=Math.min(x,C),z=Math.min(A,M),D=Math.max(x,C),k=Math.max(A,M),B={x:(t.x||0)+I,y:(t.y||0)+z,width:D-I||1,height:k-z||1};t.maintainAspectRatio,e(B),o.current=void 0,u.current=void 0,m.current.east=0,m.current.west=0,m.current.north=0,m.current.south=0,f.current=!1,p(!1)}}},[e,t.height,t.width,t.x,t.y]),(0,wn.useEffect)(()=>{let x=()=>{E.current&&E.current()};return window.addEventListener("pointerup",x),window.addEventListener("touchend",x),()=>{window.removeEventListener("pointerup",x),window.removeEventListener("touchend",x)}},[]),{portalRef:s,mode:n,mouseEvent:v,onPointerMoveCallback:T,isEditing:d}};function Sh(t,e){return t?e?{...t,...e||{},":hover":t[":hover"]?Object.assign(t[":hover"]||{},e[":hover"]||{}):e[":hover"],":active":t[":active"]?Object.assign(t[":active"]||{},e[":active"]||{}):e[":hover"]}:t:e}var or=_(X(),1);function Ka(t){return{all:t=t||new Map,on:function(e,n){var i=t.get(e);i?i.push(n):t.set(e,[n])},off:function(e,n){var i=t.get(e);i&&(n?i.splice(i.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var i=t.get(e);i&&i.slice().map(function(a){a(n)}),(i=t.get("*"))&&i.slice().map(function(a){a(e,n)})}}}var Bs=_(X(),1),eD=_(V(),1),mq=Ka(),fv=(0,Bs.createContext)(mq);function gq({children:t,emitter:e}){return(0,eD.jsx)(fv.Provider,{value:e,children:t})}function AR(){return(0,Bs.useContext)(fv)}function Ps(t,e,n=[]){let i=(0,Bs.useContext)(fv);(0,Bs.useEffect)(()=>{let a=o=>{e(o)};return i.on(t,a),()=>{i.off(t,a)}},[i,t,...n])}function yq(t){return{all:t=t||new Map,on:function(e,n){var i=t.get(e);i?i.push(n):t.set(e,[n])},off:function(e,n){var i=t.get(e);i&&(n?i.splice(i.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var i=t.get(e);i&&i.slice().map(function(a){a(n)}),(i=t.get("*"))&&i.slice().map(function(a){a(e,n)})}}}function vq(t,e,n){let[i,a]=t,[o,s]=e,[u,d]=n,p=u-o,f=d-s,m=Math.sqrt(p*p+f*f);if(m===0)return{distance:Math.sqrt((i-o)**2+(a-s)**2),closestPoint:[o,s]};let g=Math.max(0,Math.min(1,((i-o)*p+(a-s)*f)/(m*m))),v=o+g*p,S=s+g*f,R=[v,S];return{distance:Math.sqrt((i-v)**2+(a-S)**2),closestPoint:R}}function Sq(t,e,n,i){let[a,o]=t,[s,u]=e,[d,p]=n,[f,m]=i,g=(a-s)*(p-m)-(o-u)*(d-f);if(Math.abs(g)<1e-10)return null;let v=((a-d)*(p-m)-(o-p)*(d-f))/g,S=-((a-s)*(o-p)-(o-u)*(a-d))/g;if(v>=0&&v<=1&&S>=0&&S<=1){let R=a+v*(s-a),T=o+v*(u-o);return[R,T]}return null}function bq(t,e,n){let i=n||e.snapThreshold||15,a=[],[o,s]=t,u=e.polygon.points,d=e.slowState.transitionIntentType==="move-point";if(e.slowState.snapToPoints)for(let p=0;p<u.length;p++){if(d&&e.selectedPoints.includes(p))continue;let f=u[p];if(f[0]===o&&f[1]===s)continue;let m=f[0]-o,g=f[1]-s,v=Math.sqrt(m*m+g*g);v<=i&&a.push({type:"point",point:[f[0],f[1]],source:{pointIndex:p,polygon:e.polygon},distance:v})}if(e.slowState.snapToLines)for(let p=0;p<u.length;p++){if(d&&e.selectedPoints.includes(p))continue;let f=(p+1)%u.length;if(p===f)continue;let m=u[p],g=u[f],{distance:v,closestPoint:S}=vq(t,m,g);v<=i&&a.push({type:"line",point:S,source:{lineIndex:p,polygon:e.polygon},distance:v})}if(e.slowState.snapToIntersections&&u.length>=4)for(let p=0;p<u.length;p++){if(d&&e.selectedPoints.includes(p))continue;let f=(p+1)%u.length,m=u[p],g=u[f];for(let v=p+2;v<u.length;v++){if(d&&e.selectedPoints.includes(v))continue;let S=(v+1)%u.length;if(v===f||S===p)continue;let R=u[v],T=u[S],E=Sq(m,g,R,T);if(E){let[x,A]=E,C=Math.sqrt((o-x)**2+(s-A)**2);C<=i&&a.push({type:"intersection",point:E,source:{lineIndex:p,polygon:e.polygon},distance:C})}}}if(e.slowState.snapToParallel)for(let p=0;p<u.length;p++){if(d&&e.selectedPoints.includes(p))continue;let f=u[p],[m,g]=f,v=Math.abs(s-g);v<=i&&a.push({type:"parallel",point:[o,g],source:{pointIndex:p,polygon:e.polygon},distance:v});let S=Math.abs(o-m);S<=i&&a.push({type:"parallel",point:[m,s],source:{pointIndex:p,polygon:e.polygon},distance:S})}return a.sort((p,f)=>p.distance-f.distance)}function xq(t){return t.sort((e,n)=>{let i=e.type==="point"?0:e.type==="intersection"?1:e.type==="parallel"?2:3,a=n.type==="point"?0:n.type==="intersection"?1:n.type==="parallel"?2:3;return i!==a?i-a:e.distance-n.distance})}function Eq(t,e){let n=[];for(let i of t)switch(i.type){case"point":n.push({type:"point",points:[i.point],target:i});break;case"line":if(i.source?.lineIndex!==void 0){let a=e.polygon.points,o=i.source.lineIndex,s=(o+1)%a.length,u=a[o],d=a[s];n.push({type:"line",points:[u,d,i.point],target:i})}else n.push({type:"point",points:[i.point],target:i});break;case"intersection":n.push({type:"cross",points:[i.point],target:i});break;case"parallel":if(i.source?.pointIndex!==void 0){let a=e.polygon.points[i.source.pointIndex];n.push({type:"parallel-line",points:[a,i.point],target:i})}break}return n}function vl(t,e,n=5,i){if(!e.slowState.snapEnabled)return e.snapTargets=[],e.activeSnapGuides=[],e.isSnapping=!1,e.snapPoint=null,null;let a=bq(t,e,void 0);if(a.length===0)return e.snapTargets=[],e.activeSnapGuides=[],e.isSnapping=!1,e.snapPoint=null,null;let o=xq(a);return e.snapTargets=o,e.activeSnapGuides=Eq(o.slice(0,n),e),e.isSnapping=!0,e.snapPoint=o[0].point,e.snapPoint}function rD(t){t.snapTargets=[],t.activeSnapGuides=[],t.isSnapping=!1,t.snapPoint=null}function Rq(t){return t.isSnapping&&t.snapPoint!==null}function Ah(t,e){return Rq(e)&&e.snapPoint?e.snapPoint:t}var Aq={type:"add-open-point",label:"Add point",tools:["pen","line","lineBox"],trigger:{type:"click"},isValid(t,e,n){if(!e.isOpen)return!1;if(e.polygon.points.length===0)return!0;if(e.selectedPoints.length!==1||e.polygon.points.length>=2&&(e.slowState.currentTool==="line"||e.slowState.currentTool==="lineBox"))return!1;if(e.slowState.bounds){let{x:a,y:o,width:s,height:u}=e.slowState.bounds,[d,p]=t[0];if(d<a||d>a+s||p<o||p>o+u)return!1}let i=e.selectedPoints[0];return i===0||i===e.polygon.points.length-1},commit(t,e,n){let i=e.line?e.line[1]:t[0];!n.Shift&&e.slowState.snapEnabled&&(vl(i,e,3),i=Ah(i,e));let a=e.polygon.points;if(a.length===0)return{selectedPoints:[0],points:[i]};n.Shift;let o=e.selectedPoints[0],s=e.slowState.currentTool==="line"||e.slowState.currentTool==="lineBox";if(o===0)return~~a[0][0]===~~i[0]&&~~a[0][1]===~~i[1]?{selectedPoints:[0],points:a}:{selectedPoints:s?[]:[0],points:[i,...a]};let u=a[a.length-1];return~~u[0]===~~i[0]&&~~u[1]===~~i[1]?{selectedPoints:[a.length-1],points:a}:(e.line=null,{selectedPoints:s?[]:[a.length],points:[...a,i]})}};function nD(t,e){return Math.abs(t-e)}function la(t,e){let n=nD(t[0],e[0]),i=nD(t[1],e[1]);return Math.sqrt(n**2+i**2)}function TR(t,e){return[t[0]-e[0],t[1]-e[1]]}function Tq(t,e){return t[0]*e[0]+t[1]*e[1]}function lD(t){return t[0]*t[0]+t[1]*t[1]}function dv(t,e){return lD(TR(t,e))}function sD(t,e,n,i){return i&&n&&(t<0?t=Math.max(t,-i.x-n.x):t>0&&(t=Math.min(t,i.x+i.width-n.x-n.width)),e<0?e=Math.max(e,-i.y-n.y):e>0&&(e=Math.min(e,i.y+i.height-n.y-n.height))),[t,e]}function uD(t,e){let n,i,a,o;var s=(S,R,T,E,x)=>{if(E<=T+1)return;let A=T,C=0,M=S*S;n=[R[T],R[E]],i=TR(n[1],n[0]);let I=lD(i),z,D,k,B,Q;for(let it=T+1;it<E;it++)z=TR(R[it],n[0]),B=Tq(z,i),B<=0?Q=dv(R[it],n[0]):I<=B?Q=dv(R[it],n[1]):(k=B/I,D=[n[0][0]+k*i[0],n[0][1]+k*i[1]],Q=dv(R[it],D)),!(Q<=C)&&(A=it,C=Q);C>M&&(x[A]=1,s(S,R,T,A,x),s(S,R,A,E,x))};let u=t.length,d=[],p,f,m,g,v=e*e;for(a=[],o=[],a[0]=t[0],p=f=1,g=0;p<u;p++)dv(t[p],t[g])<v||(a[f++]=t[p],g=p);for(g<u-1&&(a[f++]=t[u-1]),o[0]=o[f-1]=1,s(e,a,0,f-1,o),p=m=0;p<f;p++)o[p]&&(d[m++]=a[p]);return d}function Cq(t){if(t.length!==4)return!1;let e=1e-10,n=Math.min(...t.map(u=>u[0])),i=Math.max(...t.map(u=>u[0])),a=Math.min(...t.map(u=>u[1])),o=Math.max(...t.map(u=>u[1]));for(let u of t){let d=Math.abs(u[0]-n)<e||Math.abs(u[0]-i)<e,p=Math.abs(u[1]-a)<e||Math.abs(u[1]-o)<e;if(!d||!p)return!1}let s=[[n,a],[n,o],[i,a],[i,o]];for(let u of s)if(!t.some(d=>Math.abs(d[0]-u[0])<e&&Math.abs(d[1]-u[1])<e))return!1;return!0}function cD(t){let e=t.points.length,n=!1,i=[];if(e>1){t.iedges=[];let a=t.points[e-1];for(let o=0;o<e;o++){let s=a;if(a=t.points[o],a.length===6){let p=a[2],f=a[3],m=a[4],g=a[5];i.push([o,[a[0]+p,a[1]+f],[a[0]+m,a[1]+g]]),n=!0}let u=[a[0]-s[0],a[1]-s[1]],d=u[0]*u[0]+u[1]*u[1];d>0?t.iedges.push([u[0]/d,u[1]/d]):t.iedges.push([0,0])}}else e===1?t.iedges=[[0,0]]:t.iedges=null;t.isBezier=n,t.bezierLines=i}function wq(t,e){let n=1/0,i=null,a=-1,o=t.points.length;if(o<=1)return[null,n,a];let s=t.points[o-1];for(let u=0;u<o;u++){let d=s;s=t.points[u];let p=d[0]-e[0],f=d[1]-e[1],m=p*p+f*f;m<n&&(i=d,n=m,a=u===0?o-1:u-1)}return[i,n,a]}function pv(t){if(t.points.length>2){let e=Math.min(...t.points.map(o=>o[0])),n=Math.min(...t.points.map(o=>o[1])),i=Math.max(0,...t.points.map(o=>o[0])),a=Math.max(0,...t.points.map(o=>o[1]));t.boundingBox={x:e,y:n,width:i-e,height:a-n};return}t.boundingBox=null}function Mq(t){return t[0]*t[0]+t[1]*t[1]}function iD(t,e){let n=1/0,i=null,a=-1,o=[],s=t.points.length;if(s<=1)return[null,n,o,a];if(t.iedges===null&&(cD(t),!t.iedges))return[null,n,o,a];let u=t.points[s-1];for(let d=0;d<s;d++){let p=u;u=t.points[d];let f=(e[0]-p[0])*t.iedges[d][0]+(e[1]-p[1])*t.iedges[d][1],m;f<=0?m=p:f<1?m=[(1-f)*p[0]+f*u[0],(1-f)*p[1]+f*u[1]]:m=u;let g=Mq([m[0]-e[0],m[1]-e[1]]);g<n&&(i=m,n=g,o=[p,u],a=d===0?s-1:d-1)}return[i,n,o,a]}var bh={type:"bounding-box-corners",label:"Drag to resize",tools:["pointer","box"],modifiers:{Shift:"Maintain aspect ratio",Alt:"Scale from center",Meta:"Rotate"},isValid(t,e,n){if(e.transitionDirection=null,e.transitionRotate=!1,e.isOpen||!e.slowState.boxMode&&e.selectedPoints.length!==e.polygon.points.length||!e.polygon.boundingBox)return!1;let i=n.proximity*.5,a=n.proximity*5,o=t[0],s=e.polygon.boundingBox,u=s.x+i,d=s.x+s.width-i*2,p=s.y+i,f=s.y+s.height-i*2;if(o[0]>u&&o[0]<d&&o[1]>p&&o[1]<f)return!1;let m=[s.x+s.width,s.y+s.height],g=[s.x,s.y],v=[s.x+s.width,s.y],S=[s.x,s.y+s.height],R=["ne","nw","se","sw"],T={ne:v,nw:g,se:m,sw:S},E=[la(t[0],v),la(t[0],g),la(t[0],m),la(t[0],S)],x=Math.min(...E),A=E.indexOf(x),C=A===-1?null:R[A],M=C?T[C]:null;if(E[0]<a||E[1]<a||E[2]<a||E[3]<a){if(C){let[I,z]=o;(n.Meta||I>=M[0]-n.proximity*4&&z>=M[1]-n.proximity*4&&I<=M[0]+n.proximity*4&&z<=M[1]+n.proximity*4&&!(I>=M[0]-n.proximity*2&&z>=M[1]-n.proximity*2&&I<=M[0]+n.proximity*2&&z<=M[1]+n.proximity*2))&&(e.slowState.boxMode||(e.transitionRotate=!0)),e.transitionDirection=C}return!0}return!1},start(t,e,n){let i=t[0],a=e.polygon.boundingBox,o=[a.x+a.width,a.y+a.height],s=[a.x,a.y],u=[a.x+a.width,a.y],d=[a.x,a.y+a.height],p=["ne","nw","se","sw"],f=[la(t[0],u),la(t[0],s),la(t[0],o),la(t[0],d)],m=Math.min(...f),g=f.indexOf(m);e.transitionDirection=g!==-1?p[g]:null},transition(t,e,n){let i=e.polygon.boundingBox,a=e.transitionOrigin||t[0],[o,s]=t[0];if((n.Meta||e.transitionRotate)&&!e.slowState.boxMode){let x=[i.x+i.width/2,i.y+i.height/2],A=Math.atan2(a[1]-x[1],a[0]-x[0]),C=Math.atan2(s-x[1],o-x[0]),M=n.Shift,I=Math.PI/(n.Alt?4:12),z=C-A;M&&(z=Math.round(z/I)*I);let D=Math.cos(z),k=Math.sin(z),B=[];for(let Q of e.polygon.points){let it=Q[0]-x[0],lt=Q[1]-x[1],et=it*D-lt*k,$=it*k+lt*D,ht=et+x[0],bt=$+x[1];B.push(Q.length===6?[ht,bt,Q[2],Q[3],Q[4],Q[5]]:[ht,bt])}e.transitionPoints=B,pv({points:B,iedges:null,boundingBox:null,isBezier:!1,bezierLines:[]}),e.transitionBoundingBox=e.polygon.boundingBox?{...e.polygon.boundingBox,rotation:z}:null;return}let u=e.transitionDirection,d=u.includes("e")?1:-1,p=u.includes("s")?1:-1,f=!!n.Alt,m;if(f)m=[i.x+i.width/2,i.y+i.height/2];else switch(u){case"se":m=[i.x,i.y];break;case"sw":m=[i.x+i.width,i.y];break;case"ne":m=[i.x,i.y+i.height];break;case"nw":m=[i.x+i.width,i.y+i.height];break}let g=f?i.width/2:i.width,v=f?i.height/2:i.height,S,R;if(n.Shift||e.slowState.fixedAspectRatio){let x=d*g,A=p*v,C=o-m[0],M=s-m[1],I=x*x+A*A,z=I>0?(C*x+M*A)/I:1;z=Math.max(z,.01),S=z,R=z}else{let x=0,A=0;switch(u){case"se":x=o-a[0],A=s-a[1];break;case"sw":x=a[0]-o,A=s-a[1];break;case"ne":x=o-a[0],A=a[1]-s;break;case"nw":x=a[0]-o,A=a[1]-s;break}f&&(x*=2,A*=2),S=(i.width+x)/i.width,R=(i.height+A)/i.height}let T=[];for(let x of e.polygon.points){let A=x[0]-m[0],C=x[1]-m[1],M=A*S,I=C*R,z=M+m[0],D=I+m[1];T.push(x.length===6?[z,D,x[2],x[3],x[4],x[5]]:[z,D])}e.transitionPoints=T;let E={points:T,iedges:null,boundingBox:null,bezierLines:[],isBezier:!1};pv(E),e.transitionBoundingBox=E.boundingBox},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,e.transitionRotate=!1,{points:i}}},Oq={type:"close-line-box",label:"Close Line Box",tools:["lineBox"],trigger:{type:"click"},isValid(t,e,n){return e.polygon.points.length===2&&e.lineBox!==null&&e.slowState.boxMode===!1},commit(t,e,n){return e.lineBox?{isOpen:!1,points:e.lineBox,tool:"pen"}:{}}},fD={type:"close-shape",label:"Close shape",tools:["pen","line"],trigger:{type:"click"},isValid(t,e,n){if(!e.isOpen||e.slowState.boxMode||e.selectedPoints.length!==1||e.polygon.points.length<2||n.Meta)return!1;let i=e.selectedPoints[0];if(i===0){let a=e.polygon.points[e.polygon.points.length-1];return la(t[0],a)<n.proximity}if(i===e.polygon.points.length-1){let a=e.polygon.points[0];return la(t[0],a)<n.proximity}return!1},commit(t,e,n){let i=e.selectedPoints[0];if(e.line=null,i===0)return{selectedPoints:[],points:e.polygon.points.slice(0).reverse(),isOpen:!1};if(i===e.polygon.points.length-1)return{selectedPoints:[],isOpen:!1}}},_q={type:"close-shape-line",label:"Close shape line",trigger:{type:"click"},tools:["pen"],isValid(t,e,n){return!e.isOpen||e.slowState.boxMode||e.polygon.points.length<3||!e.closestLinePoint||e.closestLineDistance>=n.proximity*2?!1:(e.closestLineIndex===0||(e.closestLineIndex,e.polygon.points.length-2),!0)},commit(t,e,n){return fD.commit(t,e,n)}},dD={type:"split-line",label:"Split line",tools:["pen"],isValid(t,e,n){let i=e.slowState.currentTool==="line";return n.Meta||i?!1:!!(e.closestLinePoint&&e.closestLineDistance<n.proximity)},transition(t,e,n){let i=t[0];!n.Shift&&e.slowState.snapEnabled&&(vl(i,e,3,e.closestLineIndex),i=Ah(i,e));let a=e.transitionOrigin||i,[o,s]=i,u=e.polygon.points,d=[],p=o-a[0],f=s-a[1];for(let m=0;m<u.length;m++)if(d.push(u[m]),e.closestLineIndex===m){let g=e.closestLinePoint;d.push([g[0]+p,g[1]+f])}e.transitionPoints=d},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{selectedPoints:[e.closestLineIndex+1],points:i}}},zq={type:"cut-line",label:"Add new point",tools:["pen"],trigger:{type:"click"},modifiers:{Shift:"Cut line"},isValid(t,e,n){return e.slowState.boxMode?!1:dD.isValid(t,e,n)},commit(t,e,n){if(n.Shift&&!e.isOpen){let o=e.polygon.points,s=[],u=[],d=!1;for(let p=0;p<o.length;p++)d?u.push(o[p]):s.push(o[p]),e.closestLineIndex===p&&(d=!0);return{isOpen:!0,points:[...u,...s]}}let i=e.polygon.points,a=[];for(let o=0;o<i.length;o++)if(a.push(i[o]),e.closestLineIndex===o){let s=e.closestLinePoint;a.push(s)}return{points:a}}},Nq={type:"delete-point",label:"Delete point",tools:["pointer","pen","lineBox","line"],trigger:{type:"key",key:"Backspace"},isValid(t,e,n){return e.selectedPoints.length>0&&e.slowState.canDelete},commit(t,e,n){let i=e.polygon.points.filter((a,o)=>!e.selectedPoints.includes(o));return{isOpen:i.length<3,selectedPoints:[],points:i,tool:e.slowState.boxMode?"box":void 0}}},Iq={type:"deselect-bounding-box",label:"Deselect bounding box",tools:["pointer"],trigger:{type:"click"},isValid(t,e,n){return e.slowState.canDeselect&&!e.isOpen&&!e.slowState.boxMode&&e.selectedPoints.length>2&&e.selectedPoints.length===e.polygon.points.length},commit(t,e,n){return e.slowState.lastCreationTool==="pen"?{selectedPoints:[],tool:"pen"}:{selectedPoints:[]}}},Dq={type:"deselect-draw",label:"Deselect draw",trigger:{type:"key",key:"Escape"},tools:["pointer","pen","box","lineBox","stamp","hand","pencil"],isValid(t,e,n){return e.slowState.canDeselect},commit(t,e,n){return{selectedPoints:[]}}},Lq={type:"deselect-points",label:"Deselect points",trigger:{type:"click"},tools:["pointer","pen"],isValid(t,e,n){return e.selectedPoints.length>0&&e.slowState.canDeselect},commit(t,e,n){return{selectedPoints:[]}}},Bq={type:"draw-shape",label:"Draw shape",tools:["pen","pencil"],modifiers:{Alt:"Freehand drawing"},isValid(t,e,n){let i=n.Alt||e.slowState.currentTool==="pencil";return!!(e.isOpen&&(e.line||e.polygon.points.length===0)&&i)},start(t,e,n){e.transitionDraw=[]},transition(t,e,n){let i=t[0];!n.Shift&&e.slowState.snapEnabled&&(vl(i,e,3),i=Ah(i,e)),e.transitionDraw.push(i)},commit(t,e,n){let i=e.slowState.currentTool==="pencil"?e.scale*1.5:e.scale*3,a=uD(e.transitionDraw,i);if(e.transitionDraw=[],a.length===0)return;let o=!0,s=3,u=e.selectedPoints[0],d=[...e.polygon.points,...a],p=d[0],f=d[d.length-1];u===0&&(p=d[d.length-1],f=d[0],d=[...a,...e.polygon.points.slice(0).reverse()]);let m=[d.length-1],g=la(p,f)/n.proximity<s,v="";return g&&(o=!1,v="pointer",m=d.map((S,R)=>R)),{isOpen:o,tool:v||void 0,points:d,selectedPoints:m}}},Pq={type:"move-line",label:"Move line",tools:["line"],isValid(t,e,n){return e.slowState.currentTool!=="line"||e.slowState.boxMode?!1:!!(e.closestLinePoint&&e.closestLineDistance<n.proximity)},transition(t,e){let n=e.transitionOrigin,i=e.polygon.boundingBox,a=t[0],[o,s]=sD(a[0]-n[0],a[1]-n[1],i,e.slowState.bounds);e.transitionPoints=e.polygon.points.map(u=>u.length===6?[u[0]+o,u[1]+s,u[2],u[3],u[4],u[5]]:[u[0]+o,u[1]+s])},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{points:i}}},Hq={type:"move-point",label:"Move point",tools:["pointer","pen","line"],modifiers:{Shift:"Constrain to axis"},isValid(t,e,n){if(n.Alt)return!1;let i=n.proximity,[a,o]=t[0],s=e.polygon.points,u=e.selectedPoints;for(let d=0;d<s.length;d++){let p=s[d],f=p[0]-a,m=p[1]-o;if(f*f+m*m<i*i)return!0}return!1},start(t,e,n){if(e.slowState.boxMode)return bh.start?bh.start(t,e,n):void 0;if(e.selectedPoints.length<2){let[i,a,o]=wq(e.polygon,t[0]);return{selectedPoints:[o]}}if(e.slowState.closestPoint&&!e.selectedPoints.includes(e.slowState.closestPoint))return{selectedPoints:[e.slowState.closestPoint]}},transition(t,e,n){if(e.slowState.boxMode)return bh.transition(t,e,n);let i=e.transitionOrigin,a=t[0];!n.Shift&&e.slowState.snapEnabled&&(vl(a,e,3),a=Ah(a,e));let[o,s]=a,u=e.polygon.points,d=e.selectedPoints;if(e.slowState.closestPoint){let g=e.slowState.closestPoint;d.indexOf(g)===-1&&(d=[g])}let p=[],f=o-i[0],m=s-i[1];n.Shift&&!e.slowState.snapEnabled&&(Math.abs(f)>Math.abs(m)?m=0:f=0);for(let g=0;g<u.length;g++){let v=d.indexOf(g)!==-1,S=u[g];v?S.length===6?p.push([S[0]+f,S[1]+m,S[2],S[3],S[4],S[5]]):p.push([S[0]+f,S[1]+m]):p.push(S)}e.transitionPoints=p},commit(t,e,n){if(e.slowState.boxMode)return bh.commit(t,e,n);let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{points:i}}},hD={type:"move-bounding-box",label:"Move bounding box",tools:["pointer"],isValid(t,e,n){let i=e.polygon.points.length,a=i===e.selectedPoints.length,o=e.polygon.boundingBox;if(i<1||!a||!o)return!1;let s=t[0],u=s[0],d=s[1];return u>=o.x&&u<=o.x+o.width&&d>=o.y&&d<=o.y+o.height},transition(t,e,n){let i=e.slowState.bounds,a=e.transitionOrigin,o=e.polygon.boundingBox,s=t[0],[u,d]=sD(s[0]-a[0],s[1]-a[1],o,i);e.transitionPoints=e.polygon.points.map(p=>p.length===6?[p[0]+u,p[1]+d,p[2],p[3],p[4],p[5]]:[p[0]+u,p[1]+d]),o&&(e.transitionBoundingBox={x:o.x+u,y:o.y+d,width:o.width,height:o.height})},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{points:i}}},pD={type:"move-shape",label:"Move shape",tools:["pointer","hand","box"],isValid(t,e,n){return n.Shift?!1:e.slowState.pointerInsideShape&&(!e.isOpen||e.line===null)},transition(t,e,n){hD.transition(t,e,n)},commit(t,e,n){let i=e.transitionPoints;return e.transitionPoints=null,e.transitionBoundingBox=null,{points:i}}},Uq={type:"nudge-right",label:"Nudge right",trigger:{type:"key",key:"ArrowRight"},tools:["pointer","pen"],modifiers:{Shift:"Nudge right more"},isValid(t,e,n){return e.selectedPoints.length>0},commit(t,e,n){let i=n.proximity*.3,a=e.polygon.points,o=e.selectedPoints;return{points:a.map((s,u)=>o.includes(u)?[s[0]+(n.Shift?4*i:1),s[1]]:s)}}},Vq={type:"nudge-left",label:"Nudge left",trigger:{type:"key",key:"ArrowLeft"},tools:["pointer","pen"],modifiers:{Shift:"Nudge left more"},isValid(t,e,n){return e.selectedPoints.length>0},commit(t,e,n){let i=n.proximity*.3,a=e.polygon.points,o=e.selectedPoints;return{points:a.map((s,u)=>o.includes(u)?[Math.max(0,s[0]-(n.Shift?4*i:1)),s[1]]:s)}}},jq={type:"nudge-up",label:"Nudge up",trigger:{type:"key",key:"ArrowUp"},tools:["pointer","pen"],modifiers:{Shift:"Nudge up more"},isValid(t,e,n){return e.selectedPoints.length>0},commit(t,e,n){let i=n.proximity*.3,a=e.polygon.points,o=e.selectedPoints;return{points:a.map((s,u)=>{if(o.includes(u)){let d=s[0],p=Math.max(0,s[1]-(n.Shift?4*i:1));return s.length===6?[d,p,s[2],s[3],s[4],s[5]]:[d,p]}return s})}}},qq={type:"nudge-down",label:"Nudge down",trigger:{type:"key",key:"ArrowDown"},tools:["pointer","pen"],modifiers:{Shift:"Nudge down more"},isValid(t,e,n){return e.selectedPoints.length>0},commit(t,e,n){let i=n.proximity*.3,a=e.polygon.points,o=e.selectedPoints;return{points:a.map((s,u)=>{let d=s[0],p=Math.max(0,s[1]+(n.Shift?4*i:1));return o.includes(u)?s.length===6?[d,p,s[2],s[3],s[4],s[5]]:[d,p]:s})}}},Fq={type:"select-multiple-points",label:"Drag to select multiple points",tools:["pointer","pen"],isValid(t,e,n){return e.slowState.currentTool==="line"&&e.polygon.points.length>=2?!0:!(e.slowState.boxMode||e.line)},transition(t,e,n){if(!e.transitionOrigin)return;let i=e.transitionOrigin[0],a=e.transitionOrigin[1],o=t[0][0],s=t[0][1],u=Math.min(i,o),d=Math.min(a,s),p=Math.abs(i-o),f=Math.abs(a-s);e.selectionBox={x:u,y:d,width:p,height:f}},commit(t,e,n){if(e.selectionBox){let i=[];n.Shift&&i.push(...e.selectedPoints);for(let a=0;a<e.polygon.points.length;a++){let o=e.polygon.points[a];o[0]>=e.selectionBox.x&&o[0]<=e.selectionBox.x+e.selectionBox.width&&o[1]>=e.selectionBox.y&&o[1]<=e.selectionBox.y+e.selectionBox.height&&i.push(a)}return{selectedPoints:i}}}},aD=10,Gq={type:"select-point",label:"Select point",trigger:{type:"click"},tools:["pointer","pen","line"],modifiers:{Shift:"Add to selection"},isValid(t,e,n){let i=-1;if(e.selectedPoints.length===1){let u=e.selectedPoints[0];u===0&&(i=e.polygon.points.length-1),u===e.polygon.points.length-1&&(i=0)}if(e.slowState.boxMode)return!1;let[a,o]=t[0],s=e.polygon.points;for(let u=0;u<s.length;u++){let d=s[u],p=d[0]-a,f=d[1]-o;if(p*p+f*f<aD*aD)return i!==u}return!1},commit(t,e,n){let i=n.Shift?[...e.selectedPoints]:[],[a,o]=t[0],s=e.polygon.points.map((u,d)=>{let p=u[0]-a,f=u[1]-o;return[p*p+f*f,d]}).sort((u,d)=>u[0]-d[0])[0];if(e.line=null,!i.includes(s[1]))i.push(s[1]);else if(n.Shift)return{selectedPoints:i.filter(u=>u!==s[1])};return{selectedPoints:i}}},kq={type:"select-shape",label:"Select shape",trigger:{type:"click"},tools:["pointer","pen"],isValid(t,e,n){return pD.isValid(t,e,n)},commit(t,e,n){return{tool:"pointer",selectedPoints:e.polygon.points.map((i,a)=>a)}}},Yq={type:"snap",label:"Smart snap",tools:["pointer","pen","line"],modifiers:{Shift:"Disable snapping"},isValid(t,e,n){return n.Shift||!e.slowState.snapEnabled||e.slowState.transitioning&&e.slowState.transitionIntentType!=="snap"||!e.slowState.snapToPoints&&!e.slowState.snapToLines&&!e.slowState.snapToIntersections?!1:vl(t[0],e,0)!==null},start(t,e,n){vl(t[0],e,5)},transition(t,e,n){let i=vl(t[0],e,5);i&&(e.pointer=i)},commit(t,e,n){rD(e)}},Qq={type:"stamp-fixed-size-shape",label:"Stamp fixed size shape",trigger:{type:"click"},tools:["stamp"],isValid(t,e,n){return e.slowState.selectedStamp!==null},commit(t,e,n){let i=t[0],a=e.slowState.selectedStamp;if(!i||!a)return;let o=i[0],s=i[1],u=[],d=Math.min(...a.points.map(R=>R[0])),p=Math.min(...a.points.map(R=>R[1])),f=Math.max(...a.points.map(R=>R[0]))-d,m=Math.max(...a.points.map(R=>R[1]))-p,g=4*n.proximity,v=f/g;m/g>v&&(v=m/g),o-=f/v/2,s-=m/v/2;let S=0;for(let R of a.points)u.push([o+(R[0]-d)/v,s+(R[1]-p)/v]),S++;return{isOpen:!1,points:u}}},mD={id:"square",open:!1,points:[[0,0],[0,100],[100,100],[100,0]]},Xq={id:"triangle",open:!1,points:[[50,0],[0,100],[100,100]]},Kq={id:"pentagon",open:!1,points:[[0,0],[0,100],[100,100],[100,0],[50,-50]]},Zq={id:"hexagon",open:!1,points:[[50,0],[0,25],[0,75],[50,100],[100,75],[100,25]]},Jq={id:"circle",open:!1,points:[[948.949,571.107],[954.545,500],[954.545,500],[948.949,428.893],[948.949,428.893],[932.298,359.538],[932.298,359.538],[905.003,293.641],[905.003,293.641],[867.735,232.825],[867.735,232.825],[821.412,178.588],[821.412,178.588],[767.175,132.265],[767.175,132.265],[706.359,94.997],[706.359,94.997],[640.462,67.702],[640.462,67.702],[571.107,51.051],[571.107,51.051],[500,45.455],[500,45.455],[428.893,51.051],[428.893,51.051],[359.538,67.702],[359.538,67.702],[293.641,94.997],[293.641,94.997],[232.825,132.265],[232.825,132.265],[178.588,178.588],[178.588,178.588],[132.265,232.825],[132.265,232.825],[94.997,293.641],[94.997,293.641],[67.702,359.538],[67.702,359.538],[51.051,428.893],[51.051,428.893],[45.455,500],[45.455,500],[51.051,571.107],[51.051,571.107],[67.702,640.462],[67.702,640.462],[94.997,706.359],[94.997,706.359],[132.265,767.175],[132.265,767.175],[178.588,821.412],[178.588,821.412],[232.825,867.735],[232.825,867.735],[293.641,905.003],[293.641,905.003],[359.538,932.298],[359.538,932.298],[428.893,948.949],[428.893,948.949],[500,954.545],[500,954.545],[571.107,948.949],[571.107,948.949],[640.462,932.298],[640.462,932.298],[706.359,905.003],[706.359,905.003],[767.175,867.735],[767.175,867.735],[821.412,821.412],[821.412,821.412],[867.735,767.175],[867.735,767.175],[905.003,706.359],[905.003,706.359],[932.298,640.462],[932.298,640.462],[948.949,571.107]]},Wq={type:"stamp-shape",label:"Stamp shape",tools:["stamp","box"],modifiers:{Shift:"Maintain aspect ratio"},isValid(t,e,n){return!(e.polygon.points.length&&!e.slowState.canDelete)},start(t,e,n){let i=t[0],a=e.slowState.selectedStamp||mD;if(i){let o=i[0],s=i[1],u=[],d=Math.min(...a.points.map(R=>R[0])),p=Math.min(...a.points.map(R=>R[1])),f=Math.max(...a.points.map(R=>R[0]))-d,m=Math.max(...a.points.map(R=>R[1]))-p,g=f/32;m/32>g&&(g=m/32);let v=[],S=0;for(let R of a.points)v.push(S),u.push([o+(R[0]-d)/g,s+(R[1]-p)/g]),S++;return e.transitionPoints=u,{isOpen:!1,selectedPoints:v,points:u}}},transition(t,e,n){if(!e.transitionOrigin)return;let i=e.polygon.boundingBox,a=[i.x,i.y],o=e.transitionOrigin||t[0],[s,u]=t[0],d=e.transitionOrigin[0],p=e.transitionOrigin[1],f=t[0][0],m=t[0][1],g=f-d-32,v=m-p-32;if(n.Shift||e.slowState.fixedAspectRatio){let x=i.width/i.height;Math.abs(i.width/g)>Math.abs(i.height/v)?v=g/x:g=v*x}let S=(i.width+g)/i.width,R=(i.height+v)/i.height,T=[];for(let x of e.polygon.points){let A=x[0]-a[0],C=x[1]-a[1],M=A*S,I=C*R,z=M+a[0],D=I+a[1];if(x.length===6){T.push([z,D,x[2],x[3],x[4],x[5]]);continue}T.push([z,D])}e.transitionPoints=T;let E={points:T,iedges:null,boundingBox:null,bezierLines:[],isBezier:!1};pv(E),e.transitionBoundingBox=E.boundingBox},commit(t,e,n){return{isOpen:!1,points:e.transitionPoints,tool:"pointer"}}},$q={type:"toggle-snap",label:"Toggle snapping",trigger:{type:"key",key:"`"},tools:["pointer","pen","line","lineBox","box","stamp"],modifiers:{},isValid(t,e,n){return!0},commit(t,e,n){let i=!e.slowState.snapEnabled;return e.slowState.snapEnabled=i,i||(e.snapTargets=[],e.activeSnapGuides=[],e.isSnapping=!1,e.snapPoint=null),{}}};function gD(t={}){let e=t.proximityThreshold||10,n=t.closestLinePointFill||{selected:"#fff",unselected:"rgba(255, 255, 255, .5)"},i=t.closestLinePointStroke||{selected:"#000",unselected:"rgba(0, 0, 0, .5)"};function a(S,R,T){S&&R.transitionBoundingBox&&T.transitioning&&(S.setAttribute("x",""+R.transitionBoundingBox.x),S.setAttribute("y",""+R.transitionBoundingBox.y),S.setAttribute("width",""+R.transitionBoundingBox.width),S.setAttribute("height",""+R.transitionBoundingBox.height))}function o(S,R,T){S&&R.polygon.boundingBox&&T.showBoundingBox&&(S.setAttribute("x",""+R.polygon.boundingBox.x),S.setAttribute("y",""+R.polygon.boundingBox.y),S.setAttribute("width",""+R.polygon.boundingBox.width),S.setAttribute("height",""+R.polygon.boundingBox.height))}function s(S,R,T){if(S&&R.polygon.boundingBox&&T.showBoundingBox){let E=R.transitionBoundingBox||R.polygon.boundingBox;E.rotation?(S.style.transformOrigin=`${E.x+E.width/2}px ${E.y+E.height/2}px`,S.style.transform=`rotate(${Math.round(100*E.rotation*(180/Math.PI))/100}deg)`):S.style.transform="",S.setAttribute("points",[[E.x,E.y],[E.x+E.width,E.y],[E.x+E.width,E.y+E.height],[E.x,E.y+E.height]].map(x=>x.join(",")).join(" "))}}function u(S,R,T){S&&R.transitionPoints&&T.transitioning&&S.setAttribute("points",R.transitionPoints.map(E=>E.join(",")).join(" "))}function d(S,R,T){S&&R.closestLinePoint&&T.hasClosestLine&&(S.setAttribute("cx",""+R.closestLinePoint[0]),S.setAttribute("cy",""+R.closestLinePoint[1]),S.setAttribute("fill",R.closestLineDistance<e?n.selected:n.unselected),S.setAttribute("stroke",R.closestLineDistance<e?i.selected:i.unselected))}function p(S,R,T){S&&R.closestLinePoint&&T.hasClosestLine&&S.setAttribute("transform",`translate(${R.closestLinePoint[0]}, ${R.closestLinePoint[1]})`)}function f(S,R,T){S&&R.selectionBox&&T.transitionIntentType==="select-multiple-points"&&(S.setAttribute("x",""+R.selectionBox.x),S.setAttribute("y",""+R.selectionBox.y),S.setAttribute("width",""+R.selectionBox.width),S.setAttribute("height",""+R.selectionBox.height))}function m(S,R,T){if(S&&R.pointer&&R.selectedPoints.length)if(T.actionIntentType==="close-shape"||T.actionIntentType==="close-shape-line"){let E=R.polygon.points[0],x=R.polygon.points[R.polygon.points.length-1];E&&x&&S.setAttribute("points",`${E.join(",")} ${x.join(",")}`)}else if(R.line)S.setAttribute("points",`${R.line[0].join(",")} ${R.line[1].join(",")}`);else{let E=R.polygon.points[R.selectedPoints[0]];E&&E.length&&S.setAttribute("points",`${R.pointer[0]},${R.pointer[1]} ${E.join(",")}`)}}function g(S,R,T,E=3){S&&R.transitionDraw.length&&S.setAttribute("points",uD(R.transitionDraw,E*R.scale).map(x=>x.join(",")).join(" "))}function v(S,R){S&&R.lineBox&&S.setAttribute("points",R.lineBox.map(T=>T.join(",")).join(" "))}return{updateTransitionBoundingBox:a,updateClosestLinePointTransform:p,updateBoundingBoxPolygon:s,updateBoundingBox:o,updateTransitionShape:u,updateClosestLinePoint:d,updateSelectBox:f,updatePointLine:m,updateDrawPreview:g,updateLineBox:v}}var t7=typeof window<"u"?window.requestAnimationFrame:t=>setTimeout(t,16),e7=typeof window<"u"?window.cancelAnimationFrame:t=>clearTimeout(t);function oD(t){return!["hand","pointer"].includes(t)}var Eh=[bh,Hq,Pq,dD,pD,hD,Bq,Fq,Wq,Yq],n7=Eh.length,xh=[Oq,Qq,fD,Gq,_q,zq,Aq,kq,Iq,Lq],Fc=[Dq,Uq,Vq,jq,qq,Nq,$q],Rh={};Eh.forEach(t=>{Rh[t.type]=t});xh.forEach(t=>{Rh[t.type]=t});Fc.forEach(t=>{Rh[t.type]=t});var hv=10;function yD(t,e){let n=t?.fixedAspectRatio||!1,i=t?.tool||"pointer",a=t?.keyboardShortcutMapping||{},o=typeof t?.keyboardShortcutsEnabled=="boolean"?t.keyboardShortcutsEnabled:!0,s=t?.enabledTools||["pointer","pen","box","lineBox","stamp","hand","line","pencil"],u=t?.emitter||yq(),d={V:"pointer",P:"pen",B:"box",L:"lineBox",S:"stamp",H:"hand",N:"line",D:"pencil",...t?.toolMap||{}},p={shapeId:t?.id||null,noShape:t===null,transitioning:!1,actionIntentType:null,transitionIntentType:null,selectedPoints:[],hasClosestLine:!1,modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:hv},bounds:t?.bounds||null,showBoundingBox:!1,currentModifiers:{},validIntentKeys:{},pointerInsideShape:!1,closestPoint:null,selectedStamp:null,transitionModifiers:null,boxMode:!1,bezierLines:[],fixedAspectRatio:n,isToolSwitchingLocked:!1,canDeselect:!1,canDelete:!0,cursor:"default",enabledTools:s,currentTool:i,lastCreationTool:oD(i)?i:null,snapEnabled:!1,snapToPoints:!0,snapToLines:!0,snapToIntersections:!0,snapToGrid:!1,snapToParallel:!0},f={isOpen:typeof t?.open=="boolean"?t.open:!1,polygon:{points:t?.points||[],iedges:null,boundingBox:null,isBezier:null,bezierLines:[]},scale:1,selectedPoints:[],pointer:null,line:null,lineBox:null,transitionPoints:null,transitionOrigin:null,transitionBoundingBox:null,closestLinePoint:null,closestLineDistance:0,closestLineIndex:-1,transitionRotate:!1,transitionDirection:null,transitionBezierLine:null,selectionBox:null,slowState:p,transitionDraw:[],isPanning:!1,panStart:null,snapTargets:[],activeSnapGuides:[],snapThreshold:15,isSnapping:!1,snapPoint:null},m={startTime:0,time:0,shouldUpdate:!1,nextSlowState:null,renderFunc:()=>{},setStateFunc:()=>{},animationFrame:0,actionIntent:null,transitionIntent:null,undoStack:[],undoStackPointer:-1},g={isPressed:!1,isClicking:!1,lastPress:null,pressTimeout:0,noTransition:!1};function v(P){cD(P),P.isBezier&&S({bezierLines:P.bezierLines}),pv(P),m.shouldUpdate=!0}v(f.polygon);function S(P){let K=Object.keys(P);if(K.length===0)return;let ct=m.nextSlowState||f.slowState,ft=!1;if(K.length===1&&K[0]==="validIntentKeys"&&ct.validIntentKeys){let vt=Object.keys(ct.validIntentKeys),j=Object.keys(P.validIntentKeys||{});if(vt.length===j.length){for(let L of vt)ct.validIntentKeys[L]!==P.validIntentKeys[L]&&(ft=!0);if(!ft)return}}if(P.selectedPoints){let vt=Array.from(ct.selectedPoints||[]),j=Array.from(P.selectedPoints||[]);if(vt.length===j.length){for(let L of vt)if(!j.includes(L)){ft=!0;break}}else ft=!0;ft||delete P.selectedPoints}if(!(K.length===1&&K.includes("hasClosestLine")&&P.hasClosestLine===ct.hasClosestLine)){if(m.nextSlowState){m.nextSlowState={...m.nextSlowState,...P};return}m.nextSlowState={...f.slowState,...P}}}function R(P,K=!1){m.time+=P,T(),E(),k(),D(),z(),Q(),lt(),it(),I(),m.renderFunc(f,f.slowState,P),!K&&(m.animationFrame=t7(R))}function T(){if(m.shouldUpdate&&(e({id:f.slowState.shapeId||void 0,open:f.isOpen,points:f.polygon.points}),m.shouldUpdate=!1),m.nextSlowState&&m.nextSlowState!==f.slowState){let P=Object.keys(f.slowState),K={},ct={},ft=!1;for(let vt of P){let j=f.slowState[vt],L=m.nextSlowState[vt];j!==L?(ft=!0,K[vt]=L,ct[vt]=L):K[vt]=j}ft&&(f.slowState=K,m.nextSlowState=null,m.setStateFunc(f.slowState),t?.customSetState?.(ct))}}function E(){let P=!f.slowState.noShape&&f.polygon.points.length>2&&f.selectedPoints.length===f.polygon.points.length&&!f.isOpen&&(f.slowState.currentTool==="pointer"||f.slowState.currentTool==="box");f.slowState.showBoundingBox!==P&&S({showBoundingBox:P})}function x(P){f.selectedPoints=P.selectedPoints,S({selectedPoints:P.selectedPoints}),f.polygon.points=P.points,f.polygon.boundingBox=null,f.polygon.iedges=null,f.polygon.isBezier=null,v(f.polygon),S({closestPoint:null}),(P.isOpen===!0||P.isOpen===!1)&&(f.isOpen=P.isOpen,m.shouldUpdate=!0)}function A(){if(m.undoStackPointer===-1)return;m.undoStackPointer--;let P=m.undoStack[m.undoStackPointer];x(P)}function C(){if(m.undoStackPointer===m.undoStack.length-1)return;m.undoStackPointer++;let P=m.undoStack[m.undoStackPointer];x(P)}function M(P){m.undoStackPointer++,m.undoStack[m.undoStackPointer]=P,m.undoStack.length>15&&(m.undoStack.shift(),m.undoStackPointer--)}function I(){S({boxMode:Cq(f.polygon.points||[])})}function z(){if(!f.pointer||f.slowState.noShape){S({pointerInsideShape:!1});return}let[P,K]=f.pointer,ct=f.polygon.points,ft=f.polygon.boundingBox;if(!ft){S({pointerInsideShape:!1});return}if(P<ft.x||P>ft.x+ft.width||K<ft.y||K>ft.height+ft.y){S({pointerInsideShape:!1});return}let vt=!1;for(let j=0,L=ct.length-1;j<ct.length;L=j++)ct[j][1]>K!=ct[L][1]>K&&P<(ct[L][0]-ct[j][0])*(K-ct[j][1])/(ct[L][1]-ct[j][1])+ct[j][0]&&(vt=!vt);S({pointerInsideShape:vt})}function D(){if(f.slowState.noShape||!f.pointer||f.slowState.transitioning||!f.polygon.points||f.polygon.points.length===0)return;let[P,K]=f.pointer,ct=f.polygon.points.map((ft,vt)=>{let j=ft[0]-P,L=ft[1]-K;return[j*j+L*L,vt]}).sort((ft,vt)=>ft[0]-vt[0]);ct.length&&S({closestPoint:ct[0][1]})}function k(){if(!f.pointer||f.slowState.transitioning)return;if(f.slowState.noShape){f.closestLineIndex=-1,f.closestLinePoint=null,f.closestLineDistance=0;return}let[P,K,ct,ft]=iD(f.polygon,f.pointer),vt=ce()*ce();K<vt&&(!f.isOpen||f.slowState.currentTool==="line"||f.polygon.points.length-1!==ft)?(f.closestLinePoint=P,f.closestLineDistance=Math.sqrt(K),f.closestLineIndex=ft,S({hasClosestLine:!0})):(f.closestLinePoint=null,f.closestLineDistance=0,f.closestLineIndex=-1,S({hasClosestLine:!1}))}function B(P,K=null){let ct={},ft=K||(f.pointer?[f.pointer[0],f.pointer[1]]:null);for(let vt of[...Eh,...xh,...Fc])vt.tools.includes(P)&&(ft&&vt.isValid([ft],f,et())?ct[vt.type]=vt.label:ft||(ct[vt.type]=vt.label));return ct}function Q(){if(f.slowState.transitioning||f.slowState.noShape||!f.pointer||!Array.isArray(f.pointer)||f.pointer.length<2||typeof f.pointer[0]!="number"||typeof f.pointer[1]!="number")return;let P=f.slowState.currentTool;Et(P);let K=!1;for(let vt=0;vt<n7;vt++){let j=Eh[vt];if(j.tools.includes(P)&&j.isValid(g.isPressed?[g.lastPress]:[f.pointer],f,et())){if(m.transitionIntent===j){K=!0;break}S({transitionIntentType:j.type}),m.transitionIntent=j,K=!0;break}}K||m.transitionIntent&&(S({transitionIntentType:null}),m.transitionIntent=null);let ct=!1;for(let vt=0;vt<xh.length;vt++){let j=xh[vt];if(j.tools.includes(P)&&ht(j)){if(m.actionIntent===j){ct=!0;break}S({actionIntentType:j.type}),m.actionIntent=j,ct=!0;break}}ct||m.actionIntent&&(m.actionIntent=null,S({actionIntentType:null}));let ft={};for(let vt=0;vt<Fc.length;vt++){let j=Fc[vt];j.trigger.type==="key"&&ht(j)&&(ft[j.trigger.key]=j.label)}S({validIntentKeys:ft})}function it(){let P=f.pointer;if(f.lineBox=null,!P||st()||f.polygon.points.length!==2)return;let[K,ct]=P,[ft,vt]=f.polygon.points[0],[j,L]=f.polygon.points[1],[W,nt,zt,Dt]=iD(f.polygon,P);if(!W)return;let jt=K-W[0],F=ct-W[1],Z=[ft,vt],pt=[j,L],yt=[pt[0]+jt,pt[1]+F],dt=[Z[0]+jt,Z[1]+F];f.lineBox=[Z,pt,yt,dt]}function lt(){let P=f.pointer;if(!P||!st()||f.slowState.noShape)return;let K=f.selectedPoints[0],ct=P;if(f.slowState.snapEnabled&&!f.slowState.modifiers.Shift?(vl(P,f,5),ct=Ah(P,f)):rD(f),f.line=[f.polygon.points[K],ct],f.slowState.modifiers.Shift){let ft=0;if(f.polygon.points.length>1){let F=f.selectedPoints[0];F===0?ft=Math.atan2(f.polygon.points[1][1]-f.polygon.points[0][1],f.polygon.points[1][0]-f.polygon.points[0][0]):ft=Math.atan2(f.polygon.points[F-1][1]-f.polygon.points[F][1],f.polygon.points[F-1][0]-f.polygon.points[F][0])}let vt=P[0]-f.polygon.points[K][0],j=P[1]-f.polygon.points[K][1],L=Math.atan2(j,vt),W=Math.PI/4,nt=Math.round((L-ft)/W)*W+ft,zt=la(f.polygon.points[K],P),Dt=Math.cos(nt)*zt+f.polygon.points[K][0],jt=Math.sin(nt)*zt+f.polygon.points[K][1];f.line[1]=[Dt,jt]}}function et(){return f.slowState.modifiers}function $(P){let K=P.commit([g.lastPress],f,et());u.emit("polygons.end-transition",{transitionIntent:P.type,response:K}),K&&(K.tool&&$t(K.tool),K.selectedPoints&&(f.selectedPoints=K.selectedPoints,S({selectedPoints:K.selectedPoints})),K.points&&(f.polygon.points=K.points,f.polygon.boundingBox=null,f.polygon.iedges=null,f.polygon.isBezier=null,f.transitionBoundingBox=null,v(f.polygon),S({closestPoint:null,selectedStamp:null})),(K.isOpen===!0||K.isOpen===!1)&&(f.isOpen=K.isOpen,m.shouldUpdate=!0),M({isOpen:f.isOpen,points:f.polygon.points,selectedPoints:f.selectedPoints}),Et(f.slowState.currentTool)),S({transitionModifiers:null})}function ht(P){if(!P.tools.includes(f.slowState.currentTool))return!1;let K=[];return f.pointer&&Array.isArray(f.pointer)&&f.pointer.length>=2&&typeof f.pointer[0]=="number"&&typeof f.pointer[1]=="number"&&(K=[f.pointer]),P.isValid(K,f,et())}function bt(P){P==="Delete"&&(P="Backspace");let K=f.slowState.currentTool;for(let ct of Fc)if(!(ct.trigger.type!=="key"||ct.trigger.key!==P)&&ct.tools.includes(K)&&ht(ct))return $(ct),!0;return!1}function st(){let P=f.polygon.points,K=f.pointer;if(!f.isOpen||!P.length||f.selectedPoints.length!==1||!K)return!1;let ct=f.selectedPoints[0],ft=ct===0,vt=ct===P.length-1;return ft||vt}let rt={reset(){S({modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:hv}})},getForType(P){let K={};if(!P)return K;let ct=Rh[P];return!ct||!ct.modifiers?K:ct.modifiers},set(P){P!=="Shift"&&P!=="Alt"&&P!=="Meta"||S({modifiers:{...m.nextSlowState?.modifiers||f.slowState.modifiers,[P]:!0}})},unset(P){P!=="Shift"&&P!=="Alt"&&P!=="Meta"||S({modifiers:{...m.nextSlowState?.modifiers||f.slowState.modifiers,[P]:!1}})}},Y={set(P){let K=P?P.id==="square"||P.id==="rectangle":!1;S({selectedStamp:P,boxMode:K})},clear(){Y.set(null)},square(){Y.set(mD)},triangle(){Y.set(Xq)},pentagon(){Y.set(Kq)},hexagon(){Y.set(Zq)},circle(){Y.set(Jq)}},At={down(P){let K=a[P]||P;if(K==="Shift"||K==="Alt"||K==="Meta")return rt.set(K),!0;if(K==="Control")return rt.set("Meta"),!0;if(K==="z"&&f.slowState.modifiers.Meta)return f.slowState.modifiers.Shift?C():A(),!0;if(!f.slowState.modifiers.Meta&&!f.slowState.modifiers.Alt&&!f.slowState.transitioning){if(!o)return;let ct=K.toUpperCase();if(d[ct]){let ft=d[ct];return $t(ft),!0}}return bt(K)},up(P){let K=a[P]||P;if(K==="Control"){rt.unset("Meta");return}K!=="Shift"&&K!=="Alt"&&K!=="Meta"||rt.unset(K)}};function Qt(P){f.scale=P,S({modifiers:{...m.nextSlowState?.modifiers||f.slowState.modifiers,proximity:P*hv}})}function ce(){return hv*f.scale}let se={set:P=>{m.renderFunc=P},start:(P,K)=>{m.startTime=performance.now(),m.time=0,P&&(m.renderFunc=P),K&&(K(f.slowState),m.setStateFunc=K),R(0)},stop:()=>{m.animationFrame&&(e7(m.animationFrame),m.animationFrame=0)},step:(P=16)=>{R(P)}};function ae(P){if(!P||!Array.isArray(P)||P.length===0)return;let K=P[0];if(!(!K||!K[0]&&K[0]!==0||!K[1]&&K[1]!==0)&&!(Number.isNaN(K[0])||Number.isNaN(K[1]))){if(f.pointer=K,f.slowState.transitioning)m.transitionIntent&&(m.transitionIntent.transition(P,f,et()),u.emit("polygons.transition",{transitionIntent:m.transitionIntent.type}));else if(g.isPressed&&!g.noTransition&&g.lastPress&&f.pointer&&(!g.isClicking||la(g.lastPress,f.pointer)>10))if(clearTimeout(g.pressTimeout),g.isClicking=!1,m.transitionIntent){if(f.transitionOrigin=g.lastPress,S({transitioning:!0}),m.transitionIntent.start){let ct=m.transitionIntent.start([g.lastPress],f,et());ct&&(ct.selectedPoints&&(f.selectedPoints=ct.selectedPoints,S({selectedPoints:ct.selectedPoints})),(ct.isOpen===!0||ct.isOpen===!1)&&(f.isOpen=ct.isOpen,m.shouldUpdate=!0),ct.points&&(f.polygon.points=ct.points,f.polygon.boundingBox=null,f.polygon.iedges=null,v(f.polygon),S({closestPoint:null})))}S({transitionModifiers:m.transitionIntent.modifiers||null}),u.emit("polygons.start-transition",{transitionIntent:m.transitionIntent.type}),m.transitionIntent.transition([g.lastPress],f,et()),u.emit("polygons.transition",{transitionIntent:m.transitionIntent.type})}else g.noTransition=!0}}function me(){f.pointer=null,f.slowState.transitioning||(g.isPressed=!1,g.isClicking=!1,g.lastPress=null,S({transitionIntentType:null,actionIntentType:null}),m.transitionIntent=null,m.actionIntent=null)}function Ie(){g.isClicking=!0,g.isPressed=!0,g.lastPress=f.pointer,g.pressTimeout=setTimeout(()=>{g.isPressed&&(g.isClicking=!1)},250)}function oe(){f.slowState.transitioning?(S({transitioning:!1}),m.transitionIntent&&$(m.transitionIntent),m.transitionIntent=null,S({transitionIntentType:null})):g.isClicking&&(m.actionIntent&&$(m.actionIntent),m.actionIntent=null,S({actionIntentType:null})),g.isPressed=!1,g.isClicking=!1,g.lastPress=null,g.noTransition=!1,clearTimeout(g.pressTimeout)}function da(P){f.polygon.points=P?.points||[],f.polygon.boundingBox=null,f.polygon.iedges=null,f.isOpen=P?.open||!1,v(f.polygon),m.nextSlowState=null,m.undoStack=[],m.undoStackPointer=-1,f.lineBox=null,f.line=null,g.pressTimeout&&clearTimeout(g.pressTimeout),S({noShape:P===null,shapeId:P?.id||null,transitioning:!1,actionIntentType:null,transitionIntentType:null,selectedPoints:[],hasClosestLine:!1,modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:f.slowState.modifiers.proximity},showBoundingBox:!1,currentModifiers:{},validIntentKeys:{},selectedStamp:null,closestPoint:null,pointerInsideShape:!1,boxMode:!1,fixedAspectRatio:n}),$t(i),T()}function ii(P){if(!P)return"";let K=Rh[P];return!K||!K.modifiers?K.label||"":f.slowState.modifiers.Shift&&K.modifiers.Shift?K.modifiers.Shift:f.slowState.modifiers.Alt&&K.modifiers.Alt?K.modifiers.Alt:f.slowState.modifiers.Meta&&K.modifiers.Meta?K.modifiers.Meta:K.label}function fe(){S({fixedAspectRatio:!0})}function ue(){S({fixedAspectRatio:!1})}function $t(P){if(f.slowState.isToolSwitchingLocked||f.slowState.currentTool===P||!f.slowState.enabledTools.includes(P))return;let K=f.slowState.lastCreationTool;if(oD(P)){if(f.slowState.isToolSwitchingLocked)return;K=P}f.slowState.transitioning&&(f.transitionPoints=null,f.transitionBoundingBox=null,f.transitionDraw=[],f.line=null,f.lineBox=null,S({transitioning:!1}));let ct=B(P),ft=f.selectedPoints,vt=f.isOpen,j=f.slowState.selectedStamp;switch(P){case"pointer":f.polygon.points.length>0&&!vt&&ft.length===0&&(ft=f.polygon.points.map((L,W)=>W));break;case"pen":f.polygon.points.length===0?(ft=[],vt=!0):vt&&ft.length>1&&(ft=[ft[ft.length-1]]);break;case"line":f.polygon.points.length===0?(ft=[],vt=!0):vt?ft.length>1&&(ft=[ft[ft.length-1]]):(ft=[f.polygon.points.length-1],vt=!0);break;case"pencil":ft=[],f.polygon.points.length===0&&(vt=!0);break;case"box":ft=f.polygon.points.map((L,W)=>W),vt=!1,Y.square();break;case"lineBox":ft=[],f.polygon.points.length===0&&(vt=!0);break;case"stamp":ft=[],vt=!1,j||Y.square();break;case"hand":ft=[];break;default:ft=[];break}S({validIntentKeys:ct}),S({currentTool:P,selectedPoints:ft,lastCreationTool:K,boxMode:P==="box"}),f.selectedPoints=ft,f.isOpen=vt,Et(P),Q()}function Et(P){let K=P==="box"||P==="pointer"&&f.polygon.points.length>2&&f.selectedPoints.length===f.polygon.points.length&&!f.isOpen;S({showBoundingBox:K})}function Tt(P){f.slowState.currentTool===P&&$t("pointer")}function Vt(P){f.slowState.currentTool===P?$t("pointer"):$t(P)}let Pn={undo:A,redo:C,get canUndo(){return m.undoStackPointer>-1},get canRedo(){return m.undoStackPointer<m.undoStack.length-1}},yi={setTool:$t,unsetTool:Tt,toggleTool:Vt,updateVisibility:Et,setCanDelete(P){S({canDelete:P})},setCanDeselect(P){ln(),S({canDeselect:P})},lockToolSwitching(){S({isToolSwitchingLocked:!0})},unlockToolSwitching(){S({isToolSwitchingLocked:!1})},toggleToolSwitching(){S({isToolSwitchingLocked:!f.slowState.isToolSwitchingLocked})},shortcuts:Object.fromEntries(Object.entries(d).map(([P,K])=>[K,P])),getValidIntents(P){let K=P||f.slowState.currentTool;return{actions:xh.filter(ct=>ct.tools.includes(K)),transitions:Eh.filter(ct=>ct.tools.includes(K)),keys:Fc.filter(ct=>ct.tools.includes(K)),all:B(K),current:f.slowState.validIntentKeys}},getToolInfo(){return{name:f.slowState.currentTool,cursor:f.slowState.cursor,selectionCount:f.selectedPoints.length,pointCount:f.polygon.points.length,isOpen:f.isOpen}},smartSelect(){f.polygon.points.length!==0&&(f.isOpen?(f.selectedPoints=[f.polygon.points.length-1],S({selectedPoints:f.selectedPoints})):(f.selectedPoints=f.polygon.points.map((P,K)=>K),S({selectedPoints:f.selectedPoints})))},clearSelection(){f.selectedPoints=[],S({selectedPoints:[]})},autoSelect(){f.selectedPoints.length===f.polygon.points.length&&!f.isOpen?$t("pointer"):f.isOpen||f.selectedPoints.length>0?$t(f.slowState.lastCreationTool||"pen"):$t("pointer")}},bn={enabled:()=>f.slowState.snapEnabled,enable:()=>S({snapEnabled:!0}),disable:()=>S({snapEnabled:!1}),toggle:()=>S({snapEnabled:!f.slowState.snapEnabled}),pointsEnabled:()=>f.slowState.snapToPoints,enablePoints:()=>S({snapToPoints:!0}),disablePoints:()=>S({snapToPoints:!1}),togglePoints:()=>S({snapToPoints:!f.slowState.snapToPoints}),linesEnabled:()=>f.slowState.snapToLines,enableLines:()=>S({snapToLines:!0}),disableLines:()=>S({snapToLines:!1}),toggleLines:()=>S({snapToLines:!f.slowState.snapToLines}),intersectionsEnabled:()=>f.slowState.snapToIntersections,enableIntersections:()=>S({snapToIntersections:!0}),disableIntersections:()=>S({snapToIntersections:!1}),toggleIntersections:()=>S({snapToIntersections:!f.slowState.snapToIntersections}),gridEnabled:()=>f.slowState.snapToGrid,enableGrid:()=>S({snapToGrid:!0}),disableGrid:()=>S({snapToGrid:!1}),toggleGrid:()=>S({snapToGrid:!f.slowState.snapToGrid}),parallelEnabled:()=>f.slowState.snapToParallel,enableParallel:()=>S({snapToParallel:!0}),disableParallel:()=>S({snapToParallel:!1}),toggleParallel:()=>S({snapToParallel:!f.slowState.snapToParallel}),getThreshold:()=>f.snapThreshold*f.slowState.modifiers.proximity,setThreshold:P=>{f.snapThreshold=Math.max(5,Math.min(50,P))},isActive:()=>f.isSnapping,getSnapPoint:()=>f.snapPoint,getActiveGuides:()=>f.activeSnapGuides,getTargets:()=>f.snapTargets};function ln(){S({selectedPoints:f.polygon.points.map((P,K)=>K)})}function ai(P){S({bounds:P})}return $t(i),{state:f,setState:S,emitter:u,modifiers:rt,stamps:Y,history:Pn,key:At,setScale:Qt,clock:se,pointer:ae,blur:me,pointerDown:Ie,pointerUp:oe,setShape:da,label:ii,tools:yi,snap:bn,selectAllPoints:ln,setBounds:ai,lockAspectRatio:fe,unlockAspectRatio:ue}}function Gc(t){let e=Math.max(...t.map(o=>o[0])),n=Math.min(...t.map(o=>o[0])),i=Math.max(...t.map(o=>o[1])),a=Math.min(...t.map(o=>o[1]));for(let o of t)if(o[0]!==n&&o[0]!==e&&o[1]!==a&&o[1]!==i||o[0]<n||o[0]>e||o[1]<a||o[1]>i)return!1;return!0}function Sl(t){if(!t)return null;if(t.points.length>2){let e=Math.min(...t.points.map(o=>o[0])),n=Math.min(...t.points.map(o=>o[1])),i=Math.max(0,...t.points.map(o=>o[0])),a=Math.max(0,...t.points.map(o=>o[1]));return{x:e,y:n,width:i-e,height:a-n}}return null}function vD(t){return t.type==="SvgSelector"}function i7(t){return t.type==="BoxSelector"}function mv(t,e){if(vD(t)){let s=t.svgShape==="polyline";if(!t.points||t.points.length===0)return null;if(e){let{width:u,height:d}=e;return{type:"SvgSelector",value:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${u} ${d}" width="${u}" height="${d}"><${s?"polygon":"polyline"} points="${t.points.map(f=>f.join(",")).join(" ")}" /></svg>`}}return{type:"SvgSelector",value:`<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><g><path d='M${t.points.map(u=>u.join(",")).join(" ")}${s?" Z":""}' /></g></svg>`}}if(!t.spatial)return null;let{x:n,y:i,width:a,height:o}=t.spatial||{};return!a||!o?null:{type:"FragmentSelector",value:`xywh=${~~n},${~~i},${~~a},${~~o}`}}function kc(t,e){if(!t||!t.points.length)return null;if(Gc(t.points)){let n=t.points.map(d=>d[0]),i=t.points.map(d=>d[1]),a=Math.min(...n),o=Math.min(...i),s=Math.max(...n)-a,u=Math.max(...i)-o;return mv({type:"BoxSelector",spatial:{x:a,y:o,width:s,height:u}},e)}return mv({type:"SvgSelector",points:t.points,svgShape:t.open?"polygon":"polyline"},e)}function Th(t){if(t.type==="polygon"&&!t.noBox&&t.points&&Gc(t.points)){let n=Sl({open:!1,points:t.points||[]});return Th({...t,type:"box",selector:n})}if(t.type==="polygon"||t.type==="draw")return{polygon:{points:t.points||[],open:t.open||!1},requestType:t.type,boundingBox:Sl({points:t.points||[],open:!1}),metadata:{},arguments:t.arguments||{},target:kc({points:t.points||[],open:!1},t.bounds)};let e=t.selector;if(e){let n=[[e.x,e.y],[e.x+e.width,e.y],[e.x+e.width,e.y+e.height],[e.x,e.y+e.height]];return{polygon:{points:n,open:!1},requestType:t.type,boundingBox:e,metadata:{},target:kc({points:n,open:!1},t.bounds),arguments:t.arguments||{}}}return{polygon:{points:[],open:!1},requestType:t.type,boundingBox:null,target:null,metadata:{},arguments:t.arguments||{}}}var a7={shapeId:null,noShape:!0,transitioning:!1,actionIntentType:null,transitionIntentType:null,selectedPoints:[],hasClosestLine:!1,lastCreationTool:null,modifiers:{Alt:!1,Shift:!1,Meta:!1,proximity:0},bounds:null,showBoundingBox:!1,currentModifiers:{},validIntentKeys:{},pointerInsideShape:!1,closestPoint:null,transitionModifiers:null,selectedStamp:null,bezierLines:[],boxMode:!1,fixedAspectRatio:!1,cursor:"",enabledTools:["pointer","pen","box","lineBox","stamp","hand","line","pencil"],canDelete:!0,canDeselect:!0,isToolSwitchingLocked:!1,currentTool:"box",snapEnabled:!1,snapToPoints:!1,snapToLines:!1,snapToIntersections:!1,snapToGrid:!1,snapToParallel:!1};function CR({events:t,enabledTools:e,keyboardShortcutMapping:n,keyboardShortcutsEnabled:i=!1,debug:a}){let o=Qi((u,d)=>{let p=null,m=yD({emitter:t,keyboardShortcutsEnabled:i,keyboardShortcutMapping:n,enabledTools:e,customSetState:g=>{a&&console.log("partial state",g),u(v=>({polygonState:{...v.polygonState,...g}}))}},g=>{u(v=>v.tool.requestId?{polygon:{...g,id:v.tool.requestId}}:{polygon:{id:void 0,points:[],open:!0}}),t.emit("atlas.polygon-update",g)});return{mode:"explore",tool:{enabled:!1,requestId:null,canvasId:null},requestType:null,requests:{},history:m.history,polygon:null,validRequestIds:[],metadata:{},stableViewport:null,canvasRelativePositions:{},canvasViewports:{},polygons:m,polygonState:a7,setMetadata:(g,v)=>{let S=v||d().tool.requestId;S&&u(R=>({metadata:{...R.metadata,[S]:{...R.metadata[S]||{},...g}}}))},setToolCanvasId:g=>{u(v=>({tool:{...v.tool,canvasId:g}}))},switchTool:{pointer(){u({mode:"sketch"}),s.tools.setTool("pointer")},hand(){u({mode:"explore"}),s.tools.setTool("hand")},draw(){u({mode:"sketch"}),s.tools.setTool("pencil")},pen(){u({mode:"sketch"}),s.tools.setTool("pen")},line(){u({mode:"sketch"}),s.tools.setTool("line")},lineBox(){u({mode:"sketch"}),s.tools.setTool("lineBox")},box(){u({mode:"sketch"}),s.tools.setTool("box")},triangle(){u({mode:"sketch"}),s.tools.setTool("stamp"),s.stamps.triangle()},hexagon(){u({mode:"sketch"}),s.tools.setTool("stamp"),s.stamps.hexagon()},circle(){u({mode:"sketch"}),s.tools.setTool("stamp"),s.stamps.circle()},remove(){let g=d();g.tool.requestId&&(m.setShape({points:[],open:!0}),g.cancelRequest(g.tool.requestId))}},reset:()=>{let g=d();g.tool.requestId&&g.cancelRequest(g.tool.requestId)},setPolygonState:g=>u({polygonState:typeof g=="function"?g(d().polygonState):g}),getRequestId:()=>{let g=Math.random().toString(36).slice(2);return u(v=>({validRequestIds:[...v.validRequestIds,g]})),{requestId:g,clear:()=>{d().tool.requestId,u(v=>({tool:v.tool.requestId===g?{enabled:!1,requestId:null,canvasId:null}:v.tool,validRequestIds:v.validRequestIds.filter(S=>S!==g)}))}}},cancelRequest:g=>{let v=g||d().tool.requestId;v&&(u(S=>({mode:"explore",tool:S.tool.requestId===v?{enabled:!1,requestId:null,canvasId:null}:S.tool,validRequestIds:S.validRequestIds.filter(R=>R!==v)})),t.emit("atlas.request-cancelled",{id:v}))},requestAnnotation:async(g,v)=>{let R={...d().requests,[v.requestId]:g},T=Th(g);a&&console.log("requestAnnotation",{response:T,request:g});try{let{points:E=[],open:x=!0}=T.polygon||{},{requestId:A,canvasId:C=null,toolId:M}=v,I=M,z=d(),D=z.validRequestIds.includes(A),k=T.requestType;return a&&console.log("setting points",{requestType:k,points:E,open:x}),!D||z.tool.enabled?null:(m.setShape({id:A,points:E,open:x}),k==="polygon"&&(I=I||"pen",m.tools.setTool("pen")),k==="draw"&&(I=I||"draw",m.tools.setTool("pencil")),k==="box"&&(I=I||"box",m.tools.setTool("box")),k==="target"?(I=I||"box",m.tools.setTool("box"),m.lockAspectRatio(),m.tools.lockToolSwitching(),m.tools.setCanDeselect(!1),m.tools.setCanDelete(!1)):(m.tools.unlockToolSwitching(),m.tools.setCanDeselect(!0),m.tools.setCanDelete(!0)),g.bounds&&m.setBounds(g.bounds),t.emit("atlas.annotation-request",{id:A}),u({polygon:{id:A,points:E,open:x},mode:"sketch",requestType:k,tool:{enabled:!0,requestId:A,canvasId:C},requests:R}),I?z.switchTool[I]?.():E.length===0&&z.switchTool.box(),(typeof g.selectByDefault>"u"&&E.length&&k==="box"||g.selectByDefault)&&z.switchTool.pointer(),new Promise(B=>{let Q=lt=>{lt.id===A&&(u(et=>({mode:"explore",tool:{requestId:null,enabled:!1,canvasId:null},requests:Object.fromEntries(Object.entries(et.requests).filter(([$])=>$!==A))})),t.off("atlas.request-cancelled",Q),t.off("atlas.annotation-completed",it),B(null))},it=lt=>{lt.id===A&&(u(et=>({mode:"explore",tool:{requestId:null,enabled:!1,canvasId:null},requests:Object.fromEntries(Object.entries(et.requests).filter(([$])=>$!==A))})),t.off("atlas.annotation-completed",it),t.off("atlas.request-cancelled",Q),B(lt))};t.on("atlas.request-cancelled",Q),t.on("atlas.annotation-completed",it)}))}catch(E){return console.error(E),null}},completeRequest:g=>{let v=d().tool.requestId;if(typeof g=="string"&&g&&g!==v)return;let S=v?d().requests[v]?.arguments||{}:{},R=v?d().metadata[v]||{}:{},T=d().polygonState.bounds,E=d().polygon;E&&(t.emit("atlas.annotation-completed",{id:E.id,polygon:E,requestType:d().requestType,target:kc(E,T),canvasId:d().tool.canvasId,boundingBox:Sl(E),metadata:R,arguments:{...S}}),m.setShape(null))},setAtlasRuntime:g=>{p=g,t.emit("atlas.ready",{runtime:g}),s.setScale(1/p._lastGoodScale),p.world.addLayoutSubscriber((v,S)=>{(v==="event-activation"||v==="zoom-to"||v==="go-home")&&p?._lastGoodScale&&!Number.isNaN(p._lastGoodScale)&&s.setScale(1/p._lastGoodScale)})},clearAtlasRuntime:()=>{p=null,u({stableViewport:null})},setCanvasRelativePosition:(g,v)=>{u(S=>({canvasRelativePositions:{...S.canvasRelativePositions,[g]:v}}))},clearCanvasRelativePosition:g=>{u(v=>{let S={...v.canvasRelativePositions};return delete S[g],{canvasRelativePositions:S}})},changeMode:g=>{u({mode:g})},nudgeLeft:()=>{},nudgeRight:()=>{},nudgeUp:()=>{},nudgeDown:()=>{},zoomIn:()=>{p?.world?.zoomIn()},zoomOut:()=>{p?.world?.zoomOut()},goHome:()=>{p?.world?.goHome()}}}),s=o.getState().polygons;return t.on("atlas.annotation-request",()=>{s.clock.start((u,d,p)=>{t.emit("atlas.polygon-render",{state:u,slowState:d,dt:p})},u=>{typeof u=="object"?o.setState({polygonState:u}):o.setState(d=>({polygonState:u(d.polygonState)}))})}),t.on("atlas.annotation-completed",()=>{s.clock.stop()}),t.on("atlas.request-cancelled",()=>{s.clock.stop()}),o}var MR=_(V(),1),Hs=(0,or.createContext)(null);function Ne(){return(0,or.useContext)(Hs)}var wR={};function OR(t="atlas"){return wR[t]?.getState()}function Yc({children:t,name:e="atlas",existing:n,atlasStoreConfig:i}){let a=AR(),o=(0,or.useContext)(Hs),s=(0,or.useMemo)(()=>n||o||CR({events:a,...i||{}}),[a,n,o]),u=St(s,d=>d.mode);return(0,or.useEffect)(()=>{let d=e;return d&&(wR[d]=s),()=>{d&&delete wR[d]}},[s,e]),(0,MR.jsx)(Hs.Provider,{value:s,children:(0,MR.jsx)(jc.Provider,{value:u||"explore",children:t})})}var TD=_(X(),1);var Qc=_(X(),1),SD=_(V(),1);function _R(){return{default:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(252,0,98, .5)"},highlighted:{backgroundColor:"rgba(75, 103, 225, 0.4)",borderWidth:"1px",borderColor:"rgba(75,103,225,0.99)"},hidden:{borderWidth:"0px",borderColor:"rgba(0,0,0,0)",backgroundColor:"rgba(0,0,0,0)",hidden:!0}}}var zR=(0,Qc.createContext)(_R());zR.displayName="AnnotationStyle";function Ch(){return(0,Qc.useContext)(zR)}function o7({theme:t,children:e}){let n=(0,Qc.useMemo)(()=>t||_R(),[t]);return(0,SD.jsx)(zR.Provider,{value:n,children:e})}var xD=_(X(),1);var Xc=_(X(),1);var bD=km()((t,e)=>{let n=new Map,i=()=>Math.random().toString(36).substring(2,15),a=o=>{let s=n.get(o);if(s)return s;let u=i();return n.set(o,u),u};return{stylesheets:{},loading:[],errors:[],async parseStylesheet(o){let{loadStylesheet:s,setStylesheet:u}=e();if(!o)return null;if(typeof o=="string")return o.startsWith("http")?{id:o,type:"CssStylesheet",value:await s(o)}:{id:u(o),type:"CssStylesheet",value:o};if(o.type==="CssStylesheet"){let d=o.id;if("value"in o){let p=Array.isArray(o.value)?o.value.join(`
86
+ `):o.value;if(p)return{id:u(p,d),type:"CssStylesheet",value:p}}if("id"in o&&o.id){let p=await s(o.id);return{id:o.id,type:"CssStylesheet",value:p}}}return null},async loadStylesheet(o){if(e().loading.includes(o))return"";try{let u=await fetch(o);if(!u.ok)throw new Error(`Failed to load stylesheet from ${o}`);let d=await u.text();return t(p=>({stylesheets:{...p.stylesheets,[o]:d}})),d}catch(u){return t(d=>({errors:[...d.errors,{url:o,error:u}]})),""}},setStylesheet(o,s){let u=s||a(o);return t(d=>({stylesheets:{...d.stylesheets,[u]:o}})),u}}});function NR(t){let[e,n]=(0,Xc.useState)(""),{loading:i,errors:a,stylesheets:o,parseStylesheet:s}=bD();return(0,Xc.useEffect)(()=>{t&&s(t).then(d=>{d?.id&&n(d.id)})},[t,s]),[(0,Xc.useMemo)(()=>{let d={};return e&&o[e]&&(d[e]=o[e]),d},[e,o]),{id:e,stylesheets:o,loading:i,errors:a}]}function wh(t={},e=[]){let{id:n,selector:i}=t,a=Wn(),o=Ut(),s=n||a.annotation,u=ie(f=>s?f.iiif.entities.Annotation[s]:void 0,[s]),[d]=NR(u?.stylesheet),p=ie(f=>u&&u.body?u.body.map(m=>m?m.type==="SpecificResource"?{...m,source:o.get(m)}:m?f.iiif.entities[m.type][m.id]:null:null).filter(Boolean):[],[u]);return(0,xD.useMemo)(()=>{if(!u)return;let f={...u,body:p,target:nn(u.target,{typeMap:o.getState().iiif.mapping,loadedStylesheets:d})};return i?i(f):f},[u,i,p,d,...e])}var ED=_(X(),1);function _t(t={},e=[]){let{id:n,selector:i}=t,a=Wn(),o=n||a.canvas,s=ie(u=>o?u.iiif.entities.Canvas[o]:void 0,[o]);return(0,ED.useMemo)(()=>{if(s)return i?i(s):s},[s,i,...e])}var IR=_(X(),1);function Mh(t=Uo){return{addEventListener(e,n,i,a){if(e)return t.setMetaValue([e.id,"eventManager",n],o=>{let s=o||[];for(let u of s)if(u.callback===i)return s;return[...s,{callback:i,scope:a}]}),i},removeEventListener(e,n,i){e&&t.setMetaValue([e.id,"eventManager",n],a=>(a||[]).filter(o=>o.callback!==i))},getListenersAsProps(e,n){let i=typeof e=="string"?{id:e}:e;if(!i||!i.id)return{};let a=t.getResourceMeta(i.id,"eventManager"),o={};if(a&&i)for(let s of Object.keys(a))o[s]=u=>{let d=t.get(i);for(let{callback:p,scope:f}of a[s]||[])(!f||n&&f.indexOf(n)!==-1)&&p(u,d)};return o}}}function Oh(t,e){let n=Ut(),i=(0,IR.useMemo)(()=>Mh(n),[n]),a=ie(()=>t&&t.id?n.getResourceMeta(t.id,"eventManager"):null,[t]);return(0,IR.useMemo)(()=>t?i.getListenersAsProps(t,e):{},[a,t,n,e])}var RD=_(X(),1);function bl(t=Uo){return{applyStyles(e,n,i){let a=typeof e=="string"?e:e.id;return t.setMetaValue([a,"styles",n],i)},getAppliedStyles(e){let n=typeof e=="string"?e:e.id;return t.getResourceMeta(n,"styles")}}}function Us(t,e){let n=Ut(),i=(0,RD.useMemo)(()=>bl(n),[n]);return ie(()=>{if(!t)return null;let a=i.getAppliedStyles(t.id);return a?e?a[e]:a:void 0},[t,e])}var AD=_(X(),1);var bo=_(X(),1),yn=_(V(),1);function DR({handleSize:t,resizable:e,onSave:n,children:i,maintainAspectRatio:a,disableCardinalControls:o,aspectRatio:s,...u}){let d=typeof t>"u"?a?12:8:t,{portalRef:p,mode:f,mouseEvent:m,isEditing:g}=JI({x:u.x||0,y:u.y||0,width:u.width,height:u.height,aspectRatio:s,maintainAspectRatio:a},n),v=(0,bo.useMemo)(()=>m("translate"),[m]),S=(0,bo.useMemo)(()=>m("east"),[m]),R=(0,bo.useMemo)(()=>m("west"),[m]),T=(0,bo.useMemo)(()=>m("south"),[m]),E=(0,bo.useMemo)(()=>m("north"),[m]),x=(0,bo.useMemo)(()=>m("south-east"),[m]),A=(0,bo.useMemo)(()=>m("south-west"),[m]),C=(0,bo.useMemo)(()=>m("north-east"),[m]),M=(0,bo.useMemo)(()=>m("north-west"),[m]),I=f==="sketch",z={zIndex:999,boxShadow:"0px 2px 3px 0 rgba(0,0,0,0.2)",outline:"2px solid rgba(155,155,155,.7)",borderRadius:a||o?"50%":2,position:"absolute",background:"#fff",pointerEvents:g?"none":I?"initial":"none"};return(0,yn.jsx)(yn.Fragment,{children:(0,yn.jsxs)("world-object",{...u,children:[i,I&&e?(0,yn.jsx)(Ni,{ref:p,target:{x:0,y:0,height:u.height,width:u.width},relative:!0,interactive:!1,children:I&&e?(0,yn.jsxs)(yn.Fragment,{children:[(0,yn.jsx)("div",{onMouseDown:v,onTouchStart:v,style:{display:"block",width:"100%",height:"100%",cursor:"move",border:"1px solid rgba(255,255,255, .7)",outline:"2px solid rgba(155,155,155, .7)",boxSizing:"border-box",pointerEvents:g?"none":I?"initial":"none"}}),a?null:(0,yn.jsxs)(yn.Fragment,{children:[(0,yn.jsx)("div",{title:"east",onTouchStart:S,onMouseDown:S,style:{...z,cursor:"e-resize",height:d*2,width:d,right:0,top:"50%",opacity:o?0:1,transform:`translate(${d/2}px, -${d}px)`}}),(0,yn.jsx)("div",{title:"west",onMouseDown:R,style:{...z,cursor:"w-resize",position:"absolute",height:d*2,width:d,left:0,top:"50%",opacity:o?0:1,transform:`translate(-${d/2}px, -${d}px)`}}),(0,yn.jsx)("div",{title:"north",onMouseDown:E,style:{...z,cursor:"n-resize",position:"absolute",height:d,width:d*2,left:"50%",top:0,opacity:o?0:1,transform:`translate(-${d}px, -${d/2}px)`}}),(0,yn.jsx)("div",{title:"south",onMouseDown:T,style:{...z,cursor:"s-resize",position:"absolute",height:d,width:d*2,left:"50%",bottom:0,opacity:o?0:1,transform:`translate(-${d}px, ${d/2}px)`}})]}),(0,yn.jsx)("div",{title:"north-east",onMouseDown:C,style:{...z,cursor:"ne-resize",position:"absolute",height:d,width:d,right:0,top:0,transform:`translate(${d/2}px, -${d/2}px)`}}),(0,yn.jsx)("div",{title:"south-east",onMouseDown:x,style:{...z,cursor:"se-resize",position:"absolute",height:d,width:d,bottom:0,right:0,transform:`translate(${d/2}px, ${d/2}px)`}}),(0,yn.jsx)("div",{title:"south-west",onMouseDown:A,style:{...z,cursor:"sw-resize",position:"absolute",height:d,width:d,bottom:0,left:0,transform:`translate(-${d/2}px, ${d/2}px)`}}),(0,yn.jsx)("div",{title:"north-west",onMouseDown:M,style:{...z,cursor:"nw-resize",position:"absolute",height:d,width:d,top:0,left:0,transform:`translate(-${d/2}px, -${d/2}px)`}})]}):null}):null]})})}var LR=_(V(),1);function BR({id:t,interactive:e,region:n,onClick:i,onHover:a,onSave:o,aspectRatio:s,maintainAspectRatio:u,disableCardinalControls:d,isEditing:p,style:f={backgroundColor:"rgba(0,0,0,.5)"}}){let m=(0,AD.useCallback)(g=>{p&&o?.({id:n.id,x:n.x,y:n.y,height:n.height,width:n.width,...g})},[o,p,n.id,n.x,n.y,n.height,n.width]);return(0,LR.jsx)(DR,{id:t,x:n.x,y:n.y,width:n.width,aspectRatio:s,height:n.height,resizable:p,onSave:m,maintainAspectRatio:u,disableCardinalControls:d,children:(0,LR.jsx)("box",{interactive:e,onClick:g=>{g.preventDefault(),g.stopPropagation(),i?.(n)},relativeStyle:!0,onMouseEnter:()=>{a?.(n)},target:{x:0,y:0,width:n.width,height:n.height},style:f})})}var CD=_(V(),1),Vs=({id:t,style:e,className:n,interactive:i,targetId:a,ignoreTargetId:o})=>{let s=wh({id:t}),u=Us(s,"atlas"),d=Us(s,"html"),p=Oh(s,["atlas"]),f=_t(),m=Ch(),g=(0,TD.useMemo)(()=>Sh(Sh(Sh(Sh(e,u),s?.motivation?.includes("highlighting")?m.highlighted:m.default),s?.target?.selector?.boxStyle||{})),[e,u,m,s?.motivation,s?.target]),v=a||f?.id;return f&&s&&s.target&&s.target.selector&&(s.target.selector.type==="BoxSelector"||s.target.selector.type==="SvgSelector")&&s.target.source&&(o?!0:s.target.source.id===v||s.target.source===v)?(0,CD.jsx)(BR,{id:s.id,isEditing:!0,region:s.target.selector.spatial,style:g,className:d?.className||n,interactive:!!(d?.href||i),href:d?.href||null,title:d?.title||null,hrefTarget:d?.target||null,onClick:()=>{},...p}):null};var MD=_(X(),1);var wD=_(X(),1);function PR(t={},e=[]){let{id:n,selector:i}=t,a=Wn(),o=n||a.annotationPage,s=ie(u=>o?u.iiif.entities.AnnotationPage[o]:void 0,[o]);return(0,wD.useMemo)(()=>{if(s)return i?i(s):s},[s,...e])}var HR=_(V(),1),xl=({className:t,page:e,targetId:n,ignoreTargetId:i})=>{let a=PR({id:e.id})||e,o=Us(a,"atlas"),s=Us(a,"html");return ie(u=>a.id?u.iiif.entities.AnnotationPage[a.id]:null,[]),(0,HR.jsx)(MD.Fragment,{children:a.items?.map(u=>(0,HR.jsx)(Vs,{id:u.id,style:o,className:s?.className||t,targetId:n,ignoreTargetId:i},u.id))})};var El=_(X(),1),gv=_(V(),1),OD=(0,El.createContext)(null),_D=(0,El.createContext)(null),zD=(0,El.createContext)(null);function r7(){let t=(0,El.useContext)(OD);if(!t)throw new Error("Ctx not found");return t}function l7(){let t=(0,El.useContext)(_D);if(!t)throw new Error("Ctx not found");return t}function s7(){let t=(0,El.useContext)(zD);if(!t)throw new Error("Ctx not found");return t}function _h({actions:t,state:e,children:n,currentTime:i,progress:a,element:o}){return(0,gv.jsx)(zD.Provider,{value:{currentTime:i,progress:a,element:o},children:(0,gv.jsx)(_D.Provider,{value:t,children:(0,gv.jsx)(OD.Provider,{value:e,children:n})})})}var DD=_(X(),1);function ND(t,e,n=[],i=!1,a=[]){if(a.length&&(e=e.filter(s=>a.indexOf(s)===-1)),!e||e.length===0)return;if(e.length===1)return e[0];if(!t)return e.indexOf("none")===-1?e[0]:"none";if(e.indexOf(t)!==-1)return t;let o=t.indexOf("-")===-1?null:t.slice(0,t.indexOf("-"));if(o&&e.indexOf(o)!==-1)return o;for(let s of n)if(e.indexOf(s)!==-1)return s;if(!i&&t){let s=e.map(d=>d.indexOf("-")===-1?null:d.slice(0,d.indexOf("-"))),u=s.indexOf(t);if(u!==-1)return e[u];for(let d of n){let p=d.indexOf("-")===-1?null:d.slice(0,d.indexOf("-")),f=p?e.indexOf(p):-1;if(f!==-1)return e[f]}}return e.indexOf("none")===-1?e.indexOf("@none")===-1?e[0]:"@none":"none"}function UR(t,e,n={}){let{strictFallback:i=!1,defaultText:a="",separator:o=`
87
+ `,fallbackLanguages:s=[],closest:u,skipLanguages:d}=n,p=Object.keys(t||{}),f=u?e:ND(e,p,s,i,d);if(!t)return a;if(typeof t=="string")return t;let m=f?t[f]:void 0;if(m&&f){if(typeof m=="string")return m;if(m.length===1&&m[0]===""){let g=n.skipLanguages||[];return UR(t,e,{...n,skipLanguages:[...g,f]})}return m.join(o)}return""}function yv(t,e={}){return UR(t,e.language||(typeof navigator<"u"?navigator.language:"en"),e)}var u7=ID();function ID(t={}){return(e,...n)=>{let i="";for(let a=0;a<e.length;a++)if(i+=e[a],a<n.length){let o=n[a];if(o==null)continue;typeof o=="string"?i+=o:i+=yv(o,t)}return i}}function VR(t){return t.type==="SpecificResource"?[t.source,{selector:t.selector}]:[t,{selector:null}]}function Kc(t=Uo){function e(a){let o=a?typeof a=="string"?t.get(a):a:null;if(!o)return[];let s=t.get(o.items,{parent:o}),u=[];for(let d of s)u.push(...t.get(d.items,{parent:d}));return u}function n(a,o=[]){let s=Array.isArray(a)?a:e(a),u=[],d={items:[],type:"complex-choice"},p=[];for(let f of s){if(f.type!=="Annotation")throw Error("getPaintables() accept either a canvas or list of annotations");let m=Array.from(Array.isArray(f.body)?f.body:[f.body]);for(let g of m){let[v,{selector:S}]=VR(g),R=t.get(v),T=(R.type||"unknown").toLowerCase();if(T==="choice"){let E=t.get(R.items,{parent:R.id}),x=o.length?o.map(A=>E.find(C=>C.id===A)).filter(Boolean):[E[0]];x.length===0&&x.push(E[0]),d.items.push({type:"single-choice",items:E.map(A=>({id:A.id,label:A.label,selected:x.indexOf(A)!==-1})),label:v.label}),m.push(...x);continue}u.indexOf(T)===-1&&u.push(T),p.push({type:T,annotationId:f.id,annotation:f,resource:R,target:f.target,selector:S})}}return{types:u,items:p,choice:d.items.length<2?d.items[0]||null:d,allChoices:d.items.length?d:null}}function i(a){let{choice:o}=n(a);return o}return{getAllPaintingAnnotations:e,getPaintables:n,extractChoices:i}}function zh(){let t=an(),e=_t();return(0,DD.useMemo)(()=>{if(!t||!e||!t.start)return null;let n=nn(t.start);return!n||n.source.id!==e.id||!n||!n.selector||n.selector.type!=="TemporalSelector"?null:n.selector.temporal},[t,e])}var $e=_(X(),1);function LD(t){return{isMuted:!1,playRequested:!1,isPlaying:!1,isFinished:!1,volume:100,duration:t}}function c7(t,e){switch(e.type){case"RESET":return e.state;case"FINISHED":return{...t,isFinished:!0,isPlaying:!1,playRequested:!1};case"PLAY_PAUSE":return{...t,isFinished:!1,isPlaying:!t.isPlaying};case"PLAY_REQUESTED":return{...t,isFinished:!1,playRequested:!0};case"PAUSE":return{...t,isPlaying:!1};case"PLAY":return{...t,isFinished:!1,playRequested:!1,isPlaying:!0};case"MUTE":return{...t,isMuted:!0};case"SET_VOLUME":return{...t,volume:e.volume,isMuted:e.volume===0};case"TOGGLE_MUTE":return{...t,isMuted:!t.isMuted};case"UNMUTE":return{...t,isMuted:!1}}return t}function vv(t){let e=Math.round(t);return`${Math.floor(e/60)}:${`${e%60}`.padStart(2,"0")}`}function js(t){let[e,n]=(0,$e.useReducer)(c7,LD(t.duration));(0,$e.useEffect)(()=>{n({type:"RESET",state:LD(t.duration)})},[t.duration]);let i=(0,$e.useRef)(null),a=(0,$e.useRef)(null),o=(0,$e.useRef)(null),s=(0,$e.useRef)(!1),u=(0,$e.useCallback)(()=>{a.current&&i.current&&(a.current.innerHTML=vv(i.current.currentTime),o.current&&(o.current.style.width=`${i.current.currentTime/t.duration*100}%`),s.current!==i.current.muted&&(s.current=i.current.muted,n(i.current.muted?{type:"MUTE"}:{type:"UNMUTE"})))},[t.duration]),d=(0,$e.useCallback)(()=>{i.current&&(n({type:"PLAY_REQUESTED"}),i.current.play().then(()=>{n({type:"PLAY"})}),u())},[u]),p=(0,$e.useCallback)(()=>{i.current&&(i.current.duration>0&&i.current.paused?d():f())},[u]),f=(0,$e.useCallback)(()=>{i.current&&(i.current.pause(),n({type:"PAUSE"}),u())},[u]),m=(0,$e.useCallback)(()=>{i.current&&(i.current.muted=!i.current.muted,n(i.current.muted?{type:"MUTE"}:{type:"UNMUTE"}))},[]),g=(0,$e.useCallback)(()=>{i.current&&(i.current.muted=!0,n({type:"MUTE"}))},[]),v=(0,$e.useCallback)(()=>{i.current&&(i.current.muted=!1,n({type:"UNMUTE"}))},[]),S=(0,$e.useCallback)(E=>{i.current&&(i.current.muted=!1,i.current.volume=E/100,n({type:"SET_VOLUME",volume:E}))},[]),R=(0,$e.useCallback)(E=>{i.current&&(i.current.currentTime=Math.max(0,Math.min(E*t.duration,t.duration)),u())},[]),T=(0,$e.useCallback)(E=>{if(i.current){let x=typeof E=="function"?E(i.current.currentTime):E;i.current.currentTime=Math.max(0,Math.min(x,t.duration)),u()}},[]);return(0,$e.useEffect)(()=>{let E=setInterval(()=>{u()},350);return()=>clearInterval(E)},[u,t.duration]),(0,$e.useEffect)(()=>{let E=()=>{n({type:"FINISHED"})},x=i.current;return x?.addEventListener("ended",E),()=>x?.removeEventListener("ended",E)},[]),[{element:i,currentTime:a,progress:o},e,{play:d,pause:f,playPause:p,mute:g,unmute:v,toggleMute:m,setVolume:S,setDurationPercent:R,setTime:T}]}var qs=_(X(),1),jR=(0,qs.createContext)(()=>{}),qR=(0,qs.createContext)(()=>{});function Qn(t,e,n,i,a=[]){let o=(0,qs.useContext)(t==="portal"?qR:jR);(0,qs.useEffect)(()=>(t!=="none"&&o(e,n,i),()=>{o(e,null)}),[e,t,o,...a])}var bv=_(V(),1);function FR({media:t,startTime:e,children:n}){let[{element:i,currentTime:a,progress:o},s,u]=js({duration:t.duration}),d=e?`${t.url}#t=${e}`:t.url;return(0,bv.jsxs)(_h,{state:s,actions:u,currentTime:a,progress:o,element:i,children:[(0,bv.jsx)("audio",{ref:i,src:d}),n]},t.url)}function Sv({media:t,mediaControlsDeps:e,audioCopmonent:n=FR,children:i}){let a=zh();return Qn("portal","audio",n,{media:t,startTime:a?a.startTime:null,children:i},[t,a,...e||[]]),null}var xv=_(X(),1),Rl=(0,xv.createContext)(null);Rl.displayName="Strategy";function Fe(){let t=(0,xv.useContext)(Rl);if(!t)throw new Error("useStrategy must be used within a StrategyProvider");return t}var Al=_(V(),1);function GR({model:t}){return(0,Al.jsxs)(Al.Fragment,{children:[(0,Al.jsx)("style",{children:`
78
88
  .model-container {
79
89
  position: absolute;
80
90
  top: 0;
@@ -87,10 +97,10 @@ No matching component was found for:
87
97
  justify-content: center;
88
98
  pointer-events: visible;
89
99
  }
90
- `}),(0,Ur.jsx)("div",{className:"model-container",children:(0,Ur.jsx)("model-viewer",{"interaction-prompt":"none",style:{width:"100%",height:"100%"},"camera-controls":"","ar-status":"not-presenting",src:e.id})})]})}function Vd({model:e,name:t}){return Kt("overlay",`model-${t}`,Rg,{model:e},[e]),null}var Eb=A(D(),1);function Eg(){let{strategy:e}=gt();return e.type!=="3d-model"?null:(0,Eb.jsx)(Vd,{model:e.model})}var jd=A(Q(),1),bl=(0,jd.createContext)(null);bl.displayName="Controls";function mn(){let e=(0,jd.useContext)(bl);if(!e)throw new Error("useStrategy must be used within a StrategyProvider");return e}var sr=A(D(),1);function Ig(){let{strategy:e}=gt(),{renderViewerControls:t,viewControlsDeps:n}=mn(),i=Ce(),r=i?.accompanyingCanvas,s=i?.placeholderCanvas;return(0,sr.jsxs)(sr.Fragment,{children:[e.type==="media"&&e.media.type==="Sound"&&r?(0,sr.jsx)(ni,{canvas:r.id,children:(0,sr.jsx)(Vo,{renderViewerControls:t,viewControlsDeps:n})}):null,e.type==="media"&&e.media.type==="Sound"&&s&&!r?(0,sr.jsx)(ni,{canvas:s.id,children:(0,sr.jsx)(Vo,{renderViewerControls:t,viewControlsDeps:n})}):null]})}var qs=A(Q(),1);var ar=A(Q(),1);var Ib=A(Q(),1);function Cg(){let t=ze().getStore();return(0,Ib.useMemo)(()=>n=>t.dispatch(n),[t])}function Cb(e){return typeof e!="string"&&e&&e.bindToVault}function Pg(){let e=ze(),t=(0,ar.useRef)([]),n=Cg(),i=(0,ar.useMemo)(()=>`vault://annotation-page/${new Date().getTime()}/${Math.round(Math.random()*1e9).toString(16)}`,[]);(0,ar.useLayoutEffect)(()=>{let u={id:i,type:"AnnotationPage",behavior:[],label:null,thumbnail:[],summary:null,requiredStatement:null,metadata:[],rights:null,provider:[],items:[],seeAlso:[],homepage:[],rendering:[],service:[]};n(ho.importEntities({entities:{AnnotationPage:{[u.id]:u}}}))},[i]);let r=qe(u=>i&&u.iiif.entities.AnnotationPage[i]||null,[i]),s=(0,ar.useCallback)((u,f)=>{if(i){if(Cb(u)){let m=u;m.__vault||m.bindToVault(e),u=typeof m.source=="string"?m.source:m.source.id,t.current[u]=m}else typeof u!="string"&&(u=u.id);let p=e.get({id:i,type:"AnnotationPage"}),c=e.get({id:u,type:"Annotation"});p&&c&&(p.items.find(m=>m.id===c.id)||n(ho.addReference({id:i,type:"AnnotationPage",key:"items",reference:{id:u,type:"Annotation"},index:f})))}},[i]),l=(0,ar.useCallback)(u=>{i&&(Cb(u)?u=typeof u.source=="string"?u.source:u.source.id:typeof u!="string"&&(u=u.id),t.current[u]&&t.current[u].beforeRemove(),e.get({id:i,type:"AnnotationPage"})&&n(ho.removeReference({id:i,type:"AnnotationPage",key:"items",reference:{id:u,type:"Annotation"}})))},[i]);return[r,{addAnnotation:s,removeAnnotation:l}]}var Ab=A(D(),1),Pb=(0,qs.createContext)(null);function Ag(){let e=(0,qs.useContext)(Pb);return[e.fullPage,{addAnnotation:e.addAnnotation,removeAnnotation:e.removeAnnotation}]}function Tg({children:e}){let[t,{addAnnotation:n,removeAnnotation:i}]=Pg();return(0,Ab.jsx)(Pb.Provider,{value:(0,qs.useMemo)(()=>({fullPage:t,addAnnotation:n,removeAnnotation:i}),[t]),children:e})}var jo=A(D(),1);function Mg({children:e}){let{strategy:t}=gt(),[n]=Ag();return t.type!=="images"?null:(0,jo.jsxs)(jo.Fragment,{children:[n?(0,jo.jsx)(jr,{page:n}):null,t.annotations&&t.annotations.pages?t.annotations.pages.map(i=>(0,jo.jsx)(jr,{page:i},i.id)):null,e]})}var qr=A(Q(),1);var Tb=A(Q(),1),_g=(e,t=[])=>{let n=ze();(0,Tb.useEffect)(()=>{e(n)},[n,...t])};var Hd=A(Q(),1);var Mb=Hd.default.createContext(new Ns);function Rl(){return(0,Hd.useContext)(Mb)}function lr(e,t,{canvasId:n,manifestId:i}={}){let r=ze(),s=Rl(),l=(0,qr.useMemo)(()=>Qm(r,{imageServiceLoader:s}),[r,s]),[u,f]=(0,qr.useState)(),p=It(i?{id:i}:void 0),c=Ce(n?{id:n}:void 0),m=c||p,y=(0,qr.useRef)(!1);if((0,qr.useEffect)(()=>(y.current=!1,()=>{y.current=!0}),[]),!m)throw new Error("Must be called under a manifest or canvas context.");return _g(w=>{l.getBestThumbnailAtSize(m,e,t).then(v=>{v.best&&!y.current&&f(v.best)})},[m]),u}var Og=A(D(),1);function Ho({x:e=0,y:t=0}){let n=Ce(),i=lr({maxWidth:256,maxHeight:256});return!n||!i||i.type!=="fixed"?null:(0,Og.jsx)("world-object",{height:n.height,width:n.width,x:e,y:t,children:(0,Og.jsx)("world-image",{uri:i.id,target:{x:0,y:0,width:n.width,height:n.height},display:i.width&&i.height?{width:i.width,height:i.height}:void 0,crop:void 0})})}var Wd=A(D(),1);function kg({as:e}){let{strategy:t}=gt(),{renderMediaControls:n,mediaControlsDeps:i}=mn();return t.type!=="media"||t.media.type!=="Sound"?null:(0,Wd.jsxs)(zd,{media:t.media,mediaControlsDeps:i,audioCopmonent:e,children:[(0,Wd.jsx)(Ho,{}),n?n(t):null]},t.media.url)}var Kd=A(Q(),1);var Ud=A(Q(),1);var _b=A(D(),1),Lg=(0,Ud.createContext)(null);Lg.displayName="ComplexTimeline";function Fg({children:e,store:t}){return(0,_b.jsx)(Lg.Provider,{value:t,children:e})}function c_(e){let t=(0,Ud.useContext)(Lg);if(!t)throw new Error("useComplexTimeline must be used within a ComplexTimelineProvider");return ve(t,e)}function Ob({currentKeyFrameIndex:e,keyframes:t,targetTime:n,currentTime:i}){if(i<=n){let r=t.findIndex(u=>u.time>n);if(r===-1)return[e,[]];let s={},l=t.slice(e,r);for(let u of l)u.type==="enter"&&(s[u.id]=u),u.type==="exit"&&(s[u.id]?delete s[u.id]:s[u.id]=u);return[r,Object.values(s)]}return[e,[]]}function kb({complexTimeline:e,startTime:t=0}){let n=Ei(),i={},r={progress:null,currentTime:null},s=0,l=null,u=0,f=null;function p(){let b=E.getState().visibleElements,I=i,M=[],T=Object.keys(I);for(let _ of T){let U=I[_],H=b[_];U&&H&&M.push(U)}return M}function c(){return Object.keys(i).map(b=>i[b])}function m(R){r.currentTime&&(r.currentTime.innerHTML=Nd(R),r.progress&&(r.progress.style.width=`${R/e.duration*100}%`))}let y=()=>{let R=E.getState(),b=R.currentPrime;if(!b)return;let I=i,M=R.visibleElements,T=Object.keys(I);for(let _ of T){let U=I[_],H=M[_];if(U&&_!==b.id&&H){let Z=u-H.time*1e3;Math.abs(u-H.time*1e3-U.currentTime*1e3)>300&&(U.currentTime=Z/1e3)}}},w=(R=0)=>{let b=R-s,I=E.getState();if(I.isPlaying){let M=I.currentPrime;if(M){let H=i[M.id];H&&(H.paused?u+=b:u=(M.time+H.currentTime)*1e3)}else u+=b;let T=u/1e3;if(T>I.duration){E.getState().setTime(0),E.setState({isPlaying:!1}),v(),m(0);return}m(T);let[_,U]=Ob({currentTime:T,currentKeyFrameIndex:I.nextKeyframeIndex,keyframes:I.complexTimeline.keyframes,targetTime:T});U.length&&I.applyKeyframes(_,U)}s=R,l=requestAnimationFrame(w)},v=()=>{l&&cancelAnimationFrame(l)},S=(R,b)=>{},E=zn((R,b)=>({complexTimeline:e,elements:{},visibleElements:{},isBuffering:!1,bufferMap:{},isMuted:!1,playRequested:!1,isPlaying:!1,isFinished:!1,isReady:!1,volume:100,duration:e.duration,clockStartRequests:0,clockStartTime:0,primeTime:0,currentPrime:null,clockRunning:!1,nextKeyframeIndex:0,startClock:()=>{b().clockRunning||(w(),f=setInterval(y,500)),R({clockRunning:!0,clockStartRequests:b().clockStartRequests+1})},applyKeyframes(I,M){let T=b(),_={...T.visibleElements},U=T.currentPrime;for(let H of M)H.type==="enter"&&(_[H.id]=H,n.emit("complex-timeline.enter",{id:H.id})),H.type==="exit"&&(_[H.id]=null,n.emit("complex-timeline.exit",{id:H.id})),H.isPrime&&(U=H);R({nextKeyframeIndex:I,visibleElements:_,currentPrime:U})},stopClock:()=>{let I=b().clockStartRequests;if(I!==0){if(I===1){v(),f&&clearInterval(f),R({clockRunning:!1,clockStartRequests:0});return}R({clockStartRequests:I-1})}},setElement:(I,M)=>{i[I]=M;let T=Object.keys(i),_=b().complexTimeline;S(M,I),_.items.filter(H=>H.type!=="Image"&&H.type!=="Text").every(H=>T.includes(H.annotationId))&&!b().isReady&&(n.emit("complex-timeline.ready",{complexTimeline:_}),R({isReady:!0}))},removeElement:I=>{delete i[I]},mute(){for(let I of c())I.muted=!0;R({isMuted:!0})},unmute(){for(let I of c())I.muted=!1;R({isMuted:!1})},play(){if(!b().isPlaying){for(let M of p())M.play();R({isPlaying:!0})}},pause(){if(b().isPlaying){for(let M of p())M.pause();R({isPlaying:!1})}},playPause(){let I=b();I.isPlaying?I.pause():I.play()},setDurationPercent(I){let T=b().duration*I;b().setTime(T)},setTime(I){let M=b(),T=u/1e3,_=typeof I=="function"?I(T):I,U=M.nextKeyframeIndex;if(T>_){R({visibleElements:{},currentPrime:null});let J=Object.keys(M.visibleElements);for(let te of J)n.emit("complex-timeline.exit",{id:te});T=0,U=0}let[H,Z]=Ob({currentTime:T,currentKeyFrameIndex:U,keyframes:M.complexTimeline.keyframes,targetTime:_});M.applyKeyframes(H,Z),u=_*1e3;let G=E.getState().visibleElements,K=i,ce=Object.keys(G);for(let J of ce){let te=G[J];if(te){let oe=K[J];oe&&(oe.currentTime=(u-te.time*1e3)/1e3)}}m(_)},setVolume(I){for(let M of c())M.volume=Math.min(1,Math.max(0,I/100));R({volume:I})},toggleMute(){let I=b();I.isMuted?(I.unmute(),R({isMuted:!1})):(I.mute(),R({isMuted:!0}))},clearProgressElement(){r.progress=null},setProgressElement(I){r.progress=I},setCurrentTimeElement(I){r.currentTime=I},clearCurrentTimeElement(){r.currentTime=null}}));return n.on("complex-timeline.enter",R=>{let b=E.getState(),I=R.id,M=i[I];M&&b.isPlaying&&M.play()}),n.on("complex-timeline.exit",R=>{let b=E.getState(),I=R.id,M=i[I];M&&(M.currentTime=0,M.pause())}),E.getState().setTime(t),{store:E,emitter:n}}var $s=A(Q(),1);var qd=A(Q(),1);var Lb=qd.default.createContext($m.store);Lb.displayName="ImageServicesHelper";function Gd(){return(0,qd.useContext)(Lb)}function Fb(e){let t=Gd();return ve(t,({loaded:n})=>n[e])}function Gs(){let e=Gd();return ve(e,({loadServiceSync:t})=>t)}function Nb(){let e=Gd();return ve(e,({loaded:t})=>t)}function zb(){let e=Gd();return ve(e,({loadService:t})=>t)}var Ci=A(Q(),1),Ii=A(D(),1),Bb=Ci.default.createContext("en"),Vb=Ci.default.createContext({}),jb=Ci.default.createContext(null);function d_(e){return(0,Ii.jsx)(Vb.Provider,{value:e.translations,children:e.children})}function f_(e){return(0,Ii.jsx)(Bb.Provider,{value:e.language,children:e.children})}function h_(e){return(0,Ii.jsx)(jb.Provider,{value:e.convert,children:e.children})}function Ng(){return Ci.default.useContext(jb)}function $d(){return Ci.default.useContext(Bb)}function zg(){return Ci.default.useContext(Vb)}function Db(e){return e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):e}function Hb({as:e,language:t,children:n,viewingDirection:i,...r}){let s=$d();return(0,Ci.useMemo)(()=>Db(s)===Db(t),[s,t])?e?(0,Ii.jsx)(e,{...r,children:n}):(0,Ii.jsx)("span",{...r,children:n}):e?(0,Ii.jsx)(e,{...r,lang:t,dir:i,children:n}):(0,Ii.jsx)("span",{...r,lang:t,dir:i,children:n})}function Wb(e,t,n){if(t.length===0)return;if(t.length===1)return t[0];if(t.indexOf(e)!==-1)return e;let i=e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):null;if(i&&t.indexOf(i)!==-1)return i;for(let r of n)if(t.indexOf(r)!==-1)return r;return t.indexOf("none")!==-1?"none":t.indexOf("@none")!==-1?"@none":t[0]}var Ub=(e,t=[])=>{let n=$d();return(0,Ci.useMemo)(()=>{let i=e();return Wb(n,i,[])},[n,...t])};function Wo(e,t,n,i){return t?n?n(e[t]||t,i||"none"):e[t]||t:""}function qb(e,t,n=`
91
- `,i={}){let r=Ng(),s=Ub(()=>Object.keys(e||{}),[e]);return[(0,Ci.useMemo)(()=>{if(!e)return Wo(i,t,r)||"";if(typeof e=="string")return Wo(i,e,r);let l=s?e[s]:void 0;return l?typeof l=="string"?l:l.map(u=>Wo(i,u,r,s)).join(n):""},[s,t,e]),s]}function p_(){let e=$d(),t=zg(),n=Ng();return function(r,s="",l=`
92
- `,u=t){let f=Object.keys(r||{}),p=Wb(e,f,[]);if(!r)return Wo(u,s,n)||"";if(typeof r=="string")return Wo(u,r,n);let c=p?r[p]:void 0;return c?typeof c=="string"?Wo(u,c,n,p):c.map(m=>Wo(u,m,n,p)).join(typeof l<"u"?l:`
93
- `):""}}function Wn({as:e,defaultText:t,enableDangerouslySetInnerHTML:n,children:i,separator:r,...s}){let l=zg(),[u,f]=qb(i,t,r,l);return f?(0,Ii.jsx)(Hb,{...s,as:e,language:f,title:n?void 0:u,dangerouslySetInnerHTML:n?{__html:u}:void 0,children:n?void 0:u}):e?(0,Ii.jsx)(e,{...s,children:u}):(0,Ii.jsx)("span",{...s,title:n?void 0:u,dangerouslySetInnerHTML:n?{__html:u}:void 0,children:n?void 0:u})}var Qd=A(Q(),1),Uo=A(D(),1),Dg=e=>{let t=e.format||"jpg",n=e.width/(e.crop?.width||e.tiles.width),i=e.tiles.imageService.sizes||[],r=e.enableThumbnail,s=e.enableSizes,l=(0,Qd.useMemo)(()=>{let p=e.tiles.imageService.id||e.tiles.imageService["@id"];return p?.endsWith("/info.json")?p.slice(0,-1*10):p},[e.tiles.imageService.id,e.tiles.imageService["@id"]]),u=(0,Qd.useMemo)(()=>{let p=e.tiles.imageService.tiles||[];if(!p.length){let c=e.width,m=[1],y=1;for(;2**y<c;)y=y*2,m.push(y);return(e.tiles.imageService.maxArea||e.tiles.imageService.maxWidth||e.tiles.imageService.maxHeight)&&Fs(2,e.tiles.imageService)?[{width:256,height:256,scaleFactors:m}]:Fs(2,e.tiles.imageService)?[{width:256,height:256,scaleFactors:m}]:[]}return p},[e.tiles.imageService,e.width]),f=(0,Qd.useMemo)(()=>{let p=e.tiles.imageService;return(p?p["@context"]?Array.isArray(p["@context"])?p["@context"]:[p["@context"]]:[]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1},[e.tiles.imageService.id,e.tiles.imageService]);return(0,Uo.jsx)("world-object",{rotation:e.rotation,scale:n,height:e.crop?.height||e.tiles.height,width:e.crop?.width||e.tiles.width,x:e.x,y:e.y,onClick:e.onClick,children:(0,Uo.jsxs)("composite-image",{id:e.tiles.imageService.id,width:e.crop?.width||e.tiles.width,height:e.crop?.height||e.tiles.height,crop:e.crop,renderOptions:e.renderOptions,children:[r&&e.tiles.thumbnail?(0,Uo.jsx)("world-image",{priority:!0,uri:e.tiles.thumbnail.id,target:{width:e.tiles.width,height:e.tiles.height},display:{width:e.tiles.thumbnail.width,height:e.tiles.thumbnail.height},crop:e.crop}):null,s&&i.map((p,c)=>(0,Uo.jsx)("world-image",{uri:`${l}/full/${p.width},${f?p.height:""}/0/default.${t}`,target:{width:e.tiles.width,height:e.tiles.height},display:{width:p.width,height:p.height},crop:e.crop},c)),u.map(p=>(p.scaleFactors||[]).map(c=>(0,Uo.jsx)("tiled-image",{uri:e.tiles.imageService.id,display:{width:e.tiles.width,height:e.tiles.height},format:t,tile:p,scaleFactor:c,crop:e.crop,version3:f},`${e.tiles.imageService.id}-tile-${c}`)))]},e.tiles.imageService.id)},e.tiles.imageService.id)};var si=A(D(),1);function m_({resource:e,heading:t,note:n,extra:i}){return i?(0,si.jsx)(jn,{target:{x:0,y:0,width:i.target?.spatial.width,height:i.target?.spatial.height},backgroundColor:"#333",relative:!0,children:(0,si.jsx)("div",{style:{display:"flex",alignContent:"center",justifyContent:"center",alignItems:"center",height:"100%",width:"100%",background:"#444",color:"#BBB"},children:(0,si.jsxs)("div",{children:[(0,si.jsx)(Wn,{children:t||"Not authorised"}),n&&(0,si.jsx)("p",{children:(0,si.jsx)(Wn,{children:n})}),(0,si.jsx)("p",{children:e.id||e["@id"]||"unknown"})]})})}):null}function Gb({image:e,thumbnail:t,crop:n,enableSizes:i,enableThumbnail:r,renderOptions:s,rotation:l}){let u=mm(),f=Xe(e.service),p=Fb(f),c=Gs(),m=p?.service;c(e.service,e);let y=m&&p?.status==="done",w=(m?.preferredFormats||[])[0],v=t&&t.type==="fixed"&&t.id&&!t.id.includes("/full/full/")&&!t.id.includes("/max/")?t:void 0;if(y===!1)return null;if(!u){let S=e.service,E=S.width||e.width||0,R=S.height||e.height||0,b=0,I=0,M=e.target?.spatial.width||E,T=e.target?.spatial.height||R;return(l===90||l===270)&&([M,T]=[T,M],T>M?I=-(T-M)/2:b=-(M-T)/2),(0,si.jsx)(Dg,{enableThumbnail:r,renderOptions:s,rotation:l,tiles:{id:S.id||S["@id"]||"unknown",height:R,width:E,imageService:S,thumbnail:v},enableSizes:i,x:b,y:I,format:w,width:M,height:T,crop:n})}return(0,si.jsx)(gm,{resource:e.service,errorComponent:m_,extra:e,children:S=>{let E=S.width||e.width||0,R=S.height||e.height||0,b=0,I=0,M=e.target?.spatial.width||E,T=e.target?.spatial.height||R;return(l===90||l===270)&&([M,T]=[T,M],T<M?(I=-(T-M)/2,b=(M-T)/2):(I=(T-M)/2,b=-(M-T)/2)),(0,si.jsx)(Dg,{enableThumbnail:r,renderOptions:s,tiles:{id:S.id||S["@id"]||"unknown",height:R,width:E,imageService:S,thumbnail:v},rotation:l,format:w,enableSizes:i,x:b,y:I,width:M,height:T,crop:n})}},e.id)}var Gr=A(D(),1);function $r({id:e,image:t,thumbnail:n,isStatic:i,x:r=0,y:s=0,children:l,selector:u,onClick:f,enableSizes:p,enableAnnotations:c}){let m=(0,$s.useMemo)(()=>{if(!(!u||u.spatial.x===0&&u.spatial.y===0))return u.spatial},[u]),y=(0,$s.useMemo)(()=>{let I=Array.isArray(t.annotation.body)?t.annotation.body?.[0]:t.annotation.body;if(I&&I.selector?.type==="ImageApiSelector")return Number(I.selector.rotation)},[t]),w=r+t.target.spatial.x,v=s+t.target.spatial.y,S=t.target.spatial.width,E=t.target.spatial.height,R=t.target.spatial.width,b=t.target.spatial.height;return(y===90||y===270)&&([S,E]=[E,S],[R,b]=[b,R]),(0,Gr.jsxs)("world-object",{x:w,y:v,width:S,height:E,onClick:f,rotation:y,children:[t.service?(0,Gr.jsxs)($s.Fragment,{children:[(0,Gr.jsx)(Gb,{image:t,thumbnail:n,crop:m,enableSizes:p,rotation:y}),l]},"service"):(0,Gr.jsxs)($s.Fragment,{children:[(0,Gr.jsx)("world-image",{onClick:f,uri:t.id,target:{x:0,y:0,width:R,height:b},display:R&&b?{width:R,height:b}:void 0,crop:m}),l]},"no-service"),c&&t.annotationPages?t.annotationPages.map(I=>(0,Gr.jsx)(jr,{page:I,className:"image-service-annotation",ignoreTargetId:!0},I.id)):null]},e+(t.service?"server":"no-service"))}var ur=A(D(),1);function Yd({strategy:e,onClickPaintingAnnotation:t}){return(0,ur.jsx)(ur.Fragment,{children:e.items.map((n,i)=>(0,ur.jsx)(ur.Fragment,{children:(0,ur.jsx)(jn,{onClick:t?r=>{r.stopPropagation(),t(n.annotationId,n,r)}:void 0,target:n.target?.spatial||void 0,children:(0,ur.jsx)("div",{"data-textual-content":!0,children:(0,ur.jsx)(Wn,{enableDangerouslySetInnerHTML:!0,children:n.text})})},i)}))})}var ai=A(D(),1);function $b({strategy:e,children:t}){let{store:n}=(0,Kd.useMemo)(()=>kb({complexTimeline:e}),[e]),i=ve(n,l=>l.isReady),r=ve(n,l=>l.visibleElements);function s(l){return u=>{u&&n.getState().setElement(l,u)}}return(0,Kd.useLayoutEffect)(()=>{if(i){let{startClock:l,stopClock:u}=n.getState();return l(),()=>{u()}}},[e,i]),Kt("portal","custom-controls",Fg,{store:n,children:t},[i]),(0,ai.jsxs)(ai.Fragment,{children:[e.items.map(l=>l.type!=="Image"||!r[l.annotationId]?null:(0,ai.jsx)($r,{image:l,id:l.annotationId},l.id)),e.items.map((l,u)=>l.type!=="Text"||!r[l.annotationId]?null:(0,ai.jsx)(Yd,{strategy:{type:"textual-content",items:[l]}},u)),e.items.map((l,u)=>l.type!=="Video"||!l.target.spatial?null:(0,ai.jsx)(jn,{target:l.target.spatial,children:(0,ai.jsx)("video",{ref:s(l.annotationId),src:l.url,style:{height:"100%",width:"100%",opacity:r[l.annotationId]?1:0}})},u)),e.items.map((l,u)=>l.type!=="Sound"?null:(0,ai.jsx)(jn,{children:(0,ai.jsx)("audio",{ref:s(l.annotationId),src:l.url})},u)),e.highlights.map(({annotation:l})=>r[l.id]?(0,ai.jsx)(zo,{id:l.id,ignoreTargetId:!0,style:{outline:"3px solid red"},className:"image-service-annotation"},l.id):null)]})}var Qb=A(D(),1);function Bg(){let{strategy:e}=gt(),{renderComplexTimelineControls:t}=mn();return e.type!=="complex-timeline"?null:(0,Qb.jsx)($b,{strategy:e,children:t?t(e):null})}var Yb=A(D(),1);function Xd({style:e}){let t=Ce();return!t||!t.height||!t.width?null:(0,Yb.jsx)("box",{interactive:!1,target:{x:0,y:0,width:Number(t.width),height:Number(t.height)},style:e})}var Kb=A(D(),1);function Vg({backgroundStyle:e,alwaysShowBackground:t}){let{strategy:n}=gt();return n.type!=="empty"&&!t?null:(0,Kb.jsx)(Xd,{style:e})}var Zd=A(Q(),1),Pi=(0,Zd.createContext)(null);function El(){return(0,Zd.useContext)(Pi)}var Qs=A(D(),1);function jg({isStatic:e=!1,enableSizes:t=!1,enableAnnotations:n=!0,onClickPaintingAnnotation:i,children:r}){let{strategy:s}=gt(),{renderViewerControls:l,viewControlsDeps:u}=mn(),f=Ce(),p=El(),c=lr({maxWidth:256,maxHeight:256});return Kt(p&&s.type==="images"&&l?"overlay":"none",`canvas-portal-controls-${f?.id}`,Pi.Provider,l?{value:p||null,children:l(s)}:{},[f,p,s,...u||[]]),s.type!=="images"?null:(0,Qs.jsxs)(Qs.Fragment,{children:[s.images.map((m,y)=>(0,Qs.jsx)($r,{isStatic:e,image:m,id:m.id,thumbnail:y===0?c:void 0,selector:m.selector,enableSizes:t,enableAnnotations:n,onClick:i?w=>{i(m.annotationId,m,w)}:void 0},m.id+y)),r]})}var Ys=A(D(),1);function Hg({onClickPaintingAnnotation:e,children:t}){let{strategy:n}=gt(),{renderViewerControls:i,viewControlsDeps:r}=mn(),s=El(),l=Ce();return Kt(s&&n.type==="textual-content"&&i?"overlay":"none",`canvas-portal-controls-${l?.id}`,Pi.Provider,i?{value:s||null,children:i(n)}:{},[l,s,n,...r||[]]),n.type!=="textual-content"?null:(0,Ys.jsxs)(Ys.Fragment,{children:[(0,Ys.jsx)(Yd,{strategy:n,onClickPaintingAnnotation:e}),t]})}var Il=A(D(),1);function Wg({element:e,media:t,startTime:n,playPause:i,poster:r}){let s="div",l=n?`${t.url}#t=${n}`:t.url;return(0,Il.jsxs)(s,{className:"video-container",part:"video-container",onClick:i,children:[(0,Il.jsx)("style",{children:`
100
+ `}),(0,Al.jsx)("div",{className:"model-container",children:(0,Al.jsx)("model-viewer",{"interaction-prompt":"none",style:{width:"100%",height:"100%"},"camera-controls":"","ar-status":"not-presenting",src:t.id})})]})}function Ev({model:t,name:e}){return Qn("overlay",`model-${e}`,GR,{model:t},[t]),null}var BD=_(V(),1);function kR(){let{strategy:t}=Fe();return t.type!=="3d-model"?null:(0,BD.jsx)(Ev,{model:t.model})}var Rv=_(X(),1),Nh=(0,Rv.createContext)(null);Nh.displayName="Controls";function hi(){let t=(0,Rv.useContext)(Nh);if(!t)throw new Error("useStrategy must be used within a StrategyProvider");return t}var rr=_(V(),1);function YR(){let{strategy:t}=Fe(),{renderViewerControls:e,viewControlsDeps:n}=hi(),i=_t(),a=i?.accompanyingCanvas,o=i?.placeholderCanvas;return(0,rr.jsxs)(rr.Fragment,{children:[t.type==="media"&&t.media.type==="Sound"&&a?(0,rr.jsx)(Sa,{canvas:a.id,children:(0,rr.jsx)(Fs,{renderViewerControls:e,viewControlsDeps:n})}):null,t.type==="media"&&t.media.type==="Sound"&&o&&!a?(0,rr.jsx)(Sa,{canvas:o.id,children:(0,rr.jsx)(Fs,{renderViewerControls:e,viewControlsDeps:n})}):null]})}var Zc=_(X(),1);var lr=_(X(),1);var PD=_(X(),1);function QR(){let e=Ut().getStore();return(0,PD.useMemo)(()=>n=>e.dispatch(n),[e])}function HD(t){return typeof t!="string"&&t&&t.bindToVault}function XR(){let t=Ut(),e=(0,lr.useRef)([]),n=QR(),i=(0,lr.useMemo)(()=>`vault://annotation-page/${new Date().getTime()}/${Math.round(Math.random()*1e9).toString(16)}`,[]);(0,lr.useLayoutEffect)(()=>{let u={id:i,type:"AnnotationPage",behavior:[],label:null,thumbnail:[],summary:null,requiredStatement:null,metadata:[],rights:null,provider:[],items:[],seeAlso:[],homepage:[],rendering:[],service:[]};n(is.importEntities({entities:{AnnotationPage:{[u.id]:u}}}))},[i]);let a=ie(u=>i&&u.iiif.entities.AnnotationPage[i]||null,[i]),o=(0,lr.useCallback)((u,d)=>{if(i){if(HD(u)){let m=u;m.__vault||m.bindToVault(t),u=typeof m.source=="string"?m.source:m.source.id,e.current[u]=m}else typeof u!="string"&&(u=u.id);let p=t.get({id:i,type:"AnnotationPage"}),f=t.get({id:u,type:"Annotation"});p&&f&&(p.items.find(m=>m.id===f.id)||n(is.addReference({id:i,type:"AnnotationPage",key:"items",reference:{id:u,type:"Annotation"},index:d})))}},[i]),s=(0,lr.useCallback)(u=>{i&&(HD(u)?u=typeof u.source=="string"?u.source:u.source.id:typeof u!="string"&&(u=u.id),e.current[u]&&e.current[u].beforeRemove(),t.get({id:i,type:"AnnotationPage"})&&n(is.removeReference({id:i,type:"AnnotationPage",key:"items",reference:{id:u,type:"Annotation"}})))},[i]);return[a,{addAnnotation:o,removeAnnotation:s}]}var VD=_(V(),1),UD=(0,Zc.createContext)(null);function KR(){let t=(0,Zc.useContext)(UD);return[t.fullPage,{addAnnotation:t.addAnnotation,removeAnnotation:t.removeAnnotation}]}function ZR({children:t}){let[e,{addAnnotation:n,removeAnnotation:i}]=XR();return(0,VD.jsx)(UD.Provider,{value:(0,Zc.useMemo)(()=>({fullPage:e,addAnnotation:n,removeAnnotation:i}),[e]),children:t})}var Gs=_(V(),1);function JR({children:t}){let{strategy:e}=Fe(),[n]=KR();return e.type!=="images"?null:(0,Gs.jsxs)(Gs.Fragment,{children:[n?(0,Gs.jsx)(xl,{page:n}):null,e.annotations&&e.annotations.pages?e.annotations.pages.map(i=>(0,Gs.jsx)(xl,{page:i},i.id)):null,t]})}var Tl=_(X(),1);var jD=_(X(),1),WR=(t,e=[])=>{let n=Ut();(0,jD.useEffect)(()=>{t(n)},[n,...e])};var Av=_(X(),1);var qD=Av.default.createContext(new Zu);function Ih(){return(0,Av.useContext)(qD)}function sr(t,e,{canvasId:n,manifestId:i}={}){let a=Ut(),o=Ih(),s=(0,Tl.useMemo)(()=>Bb(a,{imageServiceLoader:o}),[a,o]),[u,d]=(0,Tl.useState)(),p=an(i?{id:i}:void 0),f=_t(n?{id:n}:void 0),m=f||p,g=(0,Tl.useRef)(!1);if((0,Tl.useEffect)(()=>(g.current=!1,()=>{g.current=!0}),[]),!m)throw new Error("Must be called under a manifest or canvas context.");return WR(v=>{s.getBestThumbnailAtSize(m,t,e).then(S=>{S.best&&!g.current&&d(S.best)})},[m]),u}var $R=_(V(),1);function ks({x:t=0,y:e=0}){let n=_t(),i=sr({maxWidth:256,maxHeight:256});return!n||!i||i.type!=="fixed"?null:(0,$R.jsx)("world-object",{height:n.height,width:n.width,x:t,y:e,children:(0,$R.jsx)("world-image",{uri:i.id,target:{x:0,y:0,width:n.width,height:n.height},display:i.width&&i.height?{width:i.width,height:i.height}:void 0,crop:void 0})})}var Tv=_(V(),1);function tA({as:t}){let{strategy:e}=Fe(),{renderMediaControls:n,mediaControlsDeps:i}=hi();return e.type!=="media"||e.media.type!=="Sound"?null:(0,Tv.jsxs)(Sv,{media:e.media,mediaControlsDeps:i,audioCopmonent:t,children:[(0,Tv.jsx)(ks,{}),n?n(e):null]},e.media.url)}var Nv=_(X(),1);var Cv=_(X(),1);var FD=_(V(),1),eA=(0,Cv.createContext)(null);eA.displayName="ComplexTimeline";function nA({children:t,store:e}){return(0,FD.jsx)(eA.Provider,{value:e,children:t})}function f7(t){let e=(0,Cv.useContext)(eA);if(!e)throw new Error("useComplexTimeline must be used within a ComplexTimelineProvider");return St(e,t)}function GD({currentKeyFrameIndex:t,keyframes:e,targetTime:n,currentTime:i}){if(i<=n){let a=e.findIndex(u=>u.time>n);if(a===-1)return[t,[]];let o={},s=e.slice(t,a);for(let u of s)u.type==="enter"&&(o[u.id]=u),u.type==="exit"&&(o[u.id]?delete o[u.id]:o[u.id]=u);return[a,Object.values(o)]}return[t,[]]}function kD({complexTimeline:t,startTime:e=0}){let n=Ka(),i={},a={progress:null,currentTime:null},o=0,s=null,u=0,d=null;function p(){let x=T.getState().visibleElements,A=i,C=[],M=Object.keys(A);for(let I of M){let z=A[I],D=x[I];z&&D&&C.push(z)}return C}function f(){return Object.keys(i).map(x=>i[x])}function m(E){a.currentTime&&(a.currentTime.innerHTML=vv(E),a.progress&&(a.progress.style.width=`${E/t.duration*100}%`))}let g=()=>{let E=T.getState(),x=E.currentPrime;if(!x)return;let A=i,C=E.visibleElements,M=Object.keys(A);for(let I of M){let z=A[I],D=C[I];if(z&&I!==x.id&&D){let k=u-D.time*1e3;Math.abs(u-D.time*1e3-z.currentTime*1e3)>300&&(z.currentTime=k/1e3)}}},v=(E=0)=>{let x=E-o,A=T.getState();if(A.isPlaying){let C=A.currentPrime;if(C){let D=i[C.id];D&&(D.paused?u+=x:u=(C.time+D.currentTime)*1e3)}else u+=x;let M=u/1e3;if(M>A.duration){T.getState().setTime(0),T.setState({isPlaying:!1}),S(),m(0);return}m(M);let[I,z]=GD({currentTime:M,currentKeyFrameIndex:A.nextKeyframeIndex,keyframes:A.complexTimeline.keyframes,targetTime:M});z.length&&A.applyKeyframes(I,z)}o=E,s=requestAnimationFrame(v)},S=()=>{s&&cancelAnimationFrame(s)},R=(E,x)=>{},T=Qi((E,x)=>({complexTimeline:t,elements:{},visibleElements:{},isBuffering:!1,bufferMap:{},isMuted:!1,playRequested:!1,isPlaying:!1,isFinished:!1,isReady:!1,volume:100,duration:t.duration,clockStartRequests:0,clockStartTime:0,primeTime:0,currentPrime:null,clockRunning:!1,nextKeyframeIndex:0,startClock:()=>{x().clockRunning||(v(),d=setInterval(g,500)),E({clockRunning:!0,clockStartRequests:x().clockStartRequests+1})},applyKeyframes(A,C){let M=x(),I={...M.visibleElements},z=M.currentPrime;for(let D of C)D.type==="enter"&&(I[D.id]=D,n.emit("complex-timeline.enter",{id:D.id})),D.type==="exit"&&(I[D.id]=null,n.emit("complex-timeline.exit",{id:D.id})),D.isPrime&&(z=D);E({nextKeyframeIndex:A,visibleElements:I,currentPrime:z})},stopClock:()=>{let A=x().clockStartRequests;if(A!==0){if(A===1){S(),d&&clearInterval(d),E({clockRunning:!1,clockStartRequests:0});return}E({clockStartRequests:A-1})}},setElement:(A,C)=>{i[A]=C;let M=Object.keys(i),I=x().complexTimeline;R(C,A),I.items.filter(D=>D.type!=="Image"&&D.type!=="Text").every(D=>M.includes(D.annotationId))&&!x().isReady&&(n.emit("complex-timeline.ready",{complexTimeline:I}),E({isReady:!0}))},removeElement:A=>{delete i[A]},mute(){for(let A of f())A.muted=!0;E({isMuted:!0})},unmute(){for(let A of f())A.muted=!1;E({isMuted:!1})},play(){if(!x().isPlaying){for(let C of p())C.play();E({isPlaying:!0})}},pause(){if(x().isPlaying){for(let C of p())C.pause();E({isPlaying:!1})}},playPause(){let A=x();A.isPlaying?A.pause():A.play()},setDurationPercent(A){let M=x().duration*A;x().setTime(M)},setTime(A){let C=x(),M=u/1e3,I=typeof A=="function"?A(M):A,z=C.nextKeyframeIndex;if(M>I){E({visibleElements:{},currentPrime:null});let et=Object.keys(C.visibleElements);for(let $ of et)n.emit("complex-timeline.exit",{id:$});M=0,z=0}let[D,k]=GD({currentTime:M,currentKeyFrameIndex:z,keyframes:C.complexTimeline.keyframes,targetTime:I});C.applyKeyframes(D,k),u=I*1e3;let Q=T.getState().visibleElements,it=i,lt=Object.keys(Q);for(let et of lt){let $=Q[et];if($){let ht=it[et];ht&&(ht.currentTime=(u-$.time*1e3)/1e3)}}m(I)},setVolume(A){for(let C of f())C.volume=Math.min(1,Math.max(0,A/100));E({volume:A})},toggleMute(){let A=x();A.isMuted?(A.unmute(),E({isMuted:!1})):(A.mute(),E({isMuted:!0}))},clearProgressElement(){a.progress=null},setProgressElement(A){a.progress=A},setCurrentTimeElement(A){a.currentTime=A},clearCurrentTimeElement(){a.currentTime=null}}));return n.on("complex-timeline.enter",E=>{let x=T.getState(),A=E.id,C=i[A];C&&x.isPlaying&&C.play()}),n.on("complex-timeline.exit",E=>{let x=T.getState(),A=E.id,C=i[A];C&&(C.currentTime=0,C.pause())}),T.getState().setTime(e),{store:T,emitter:n}}var Wc=_(X(),1);var wv=_(X(),1);var YD=wv.default.createContext(Lb.store);YD.displayName="ImageServicesHelper";function Mv(){return(0,wv.useContext)(YD)}function QD(t){let e=Mv();return St(e,({loaded:n})=>n[t])}function Jc(){let t=Mv();return St(t,({loadServiceSync:e})=>e)}function XD(){let t=Mv();return St(t,({loaded:e})=>e)}function KD(){let t=Mv();return St(t,({loadService:e})=>e)}var Ja=_(X(),1),Za=_(V(),1),JD=Ja.default.createContext("en"),WD=Ja.default.createContext({}),$D=Ja.default.createContext(null);function d7(t){return(0,Za.jsx)(WD.Provider,{value:t.translations,children:t.children})}function h7(t){return(0,Za.jsx)(JD.Provider,{value:t.language,children:t.children})}function p7(t){return(0,Za.jsx)($D.Provider,{value:t.convert,children:t.children})}function iA(){return Ja.default.useContext($D)}function Ov(){return Ja.default.useContext(JD)}function aA(){return Ja.default.useContext(WD)}function ZD(t){return t.indexOf("-")!==-1?t.slice(0,t.indexOf("-")):t}function tL({as:t,language:e,children:n,viewingDirection:i,...a}){let o=Ov();return(0,Ja.useMemo)(()=>ZD(o)===ZD(e),[o,e])?t?(0,Za.jsx)(t,{...a,children:n}):(0,Za.jsx)("span",{...a,children:n}):t?(0,Za.jsx)(t,{...a,lang:e,dir:i,children:n}):(0,Za.jsx)("span",{...a,lang:e,dir:i,children:n})}function eL(t,e,n){if(e.length===0)return;if(e.length===1)return e[0];if(e.indexOf(t)!==-1)return t;let i=t.indexOf("-")!==-1?t.slice(0,t.indexOf("-")):null;if(i&&e.indexOf(i)!==-1)return i;for(let a of n)if(e.indexOf(a)!==-1)return a;return e.indexOf("none")!==-1?"none":e.indexOf("@none")!==-1?"@none":e[0]}var nL=(t,e=[])=>{let n=Ov();return(0,Ja.useMemo)(()=>{let i=t();return eL(n,i,[])},[n,...e])};function Ys(t,e,n,i){return e?n?n(t[e]||e,i||"none"):t[e]||e:""}function iL(t,e,n=`
101
+ `,i={}){let a=iA(),o=nL(()=>Object.keys(t||{}),[t]);return[(0,Ja.useMemo)(()=>{if(!t)return Ys(i,e,a)||"";if(typeof t=="string")return Ys(i,t,a);let s=o?t[o]:void 0;return s?typeof s=="string"?s:s.map(u=>Ys(i,u,a,o)).join(n):""},[o,e,t]),o]}function m7(){let t=Ov(),e=aA(),n=iA();return function(a,o="",s=`
102
+ `,u=e){let d=Object.keys(a||{}),p=eL(t,d,[]);if(!a)return Ys(u,o,n)||"";if(typeof a=="string")return Ys(u,a,n);let f=p?a[p]:void 0;return f?typeof f=="string"?Ys(u,f,n,p):f.map(m=>Ys(u,m,n,p)).join(typeof s<"u"?s:`
103
+ `):""}}function sa({as:t,defaultText:e,enableDangerouslySetInnerHTML:n,children:i,separator:a,...o}){let s=aA(),[u,d]=iL(i,e,a,s);return d?(0,Za.jsx)(tL,{...o,as:t,language:d,title:n?void 0:u,dangerouslySetInnerHTML:n?{__html:u}:void 0,children:n?void 0:u}):t?(0,Za.jsx)(t,{...o,children:u}):(0,Za.jsx)("span",{...o,title:n?void 0:u,dangerouslySetInnerHTML:n?{__html:u}:void 0,children:n?void 0:u})}var _v=_(X(),1),Qs=_(V(),1),oA=t=>{let e=t.format||"jpg",n=t.width/(t.crop?.width||t.tiles.width),i=t.tiles.imageService.sizes||[],a=t.enableThumbnail,o=t.enableSizes,s=(0,_v.useMemo)(()=>{let p=t.tiles.imageService.id||t.tiles.imageService["@id"];return p?.endsWith("/info.json")?p.slice(0,-1*10):p},[t.tiles.imageService.id,t.tiles.imageService["@id"]]),u=(0,_v.useMemo)(()=>{let p=t.tiles.imageService.tiles||[];if(!p.length){let f=t.width,m=[1],g=1;for(;2**g<f;)g=g*2,m.push(g);return(t.tiles.imageService.maxArea||t.tiles.imageService.maxWidth||t.tiles.imageService.maxHeight)&&Ku(2,t.tiles.imageService)?[{width:256,height:256,scaleFactors:m}]:Ku(2,t.tiles.imageService)?[{width:256,height:256,scaleFactors:m}]:[]}return p},[t.tiles.imageService,t.width]),d=(0,_v.useMemo)(()=>{let p=t.tiles.imageService;return(p?p["@context"]?Array.isArray(p["@context"])?p["@context"]:[p["@context"]]:[]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1},[t.tiles.imageService.id,t.tiles.imageService]);return(0,Qs.jsx)("world-object",{rotation:t.rotation,scale:n,height:t.crop?.height||t.tiles.height,width:t.crop?.width||t.tiles.width,x:t.x,y:t.y,onClick:t.onClick,children:(0,Qs.jsxs)("composite-image",{id:t.tiles.imageService.id,width:t.crop?.width||t.tiles.width,height:t.crop?.height||t.tiles.height,crop:t.crop,renderOptions:t.renderOptions,children:[a&&t.tiles.thumbnail?(0,Qs.jsx)("world-image",{priority:!0,uri:t.tiles.thumbnail.id,target:{width:t.tiles.width,height:t.tiles.height},display:{width:t.tiles.thumbnail.width,height:t.tiles.thumbnail.height},crop:t.crop}):null,o&&i.map((p,f)=>(0,Qs.jsx)("world-image",{uri:`${s}/full/${p.width},${d?p.height:""}/0/default.${e}`,target:{width:t.tiles.width,height:t.tiles.height},display:{width:p.width,height:p.height},crop:t.crop},f)),u.map(p=>(p.scaleFactors||[]).map(f=>(0,Qs.jsx)("tiled-image",{uri:t.tiles.imageService.id,display:{width:t.tiles.width,height:t.tiles.height},format:e,tile:p,scaleFactor:f,crop:t.crop,version3:d},`${t.tiles.imageService.id}-tile-${f}`)))]},t.tiles.imageService.id)},t.tiles.imageService.id)};var Ia=_(V(),1);function g7({resource:t,heading:e,note:n,extra:i}){return i?(0,Ia.jsx)(Ni,{target:{x:0,y:0,width:i.target?.spatial.width,height:i.target?.spatial.height},backgroundColor:"#333",relative:!0,children:(0,Ia.jsx)("div",{style:{display:"flex",alignContent:"center",justifyContent:"center",alignItems:"center",height:"100%",width:"100%",background:"#444",color:"#BBB"},children:(0,Ia.jsxs)("div",{children:[(0,Ia.jsx)(sa,{children:e||"Not authorised"}),n&&(0,Ia.jsx)("p",{children:(0,Ia.jsx)(sa,{children:n})}),(0,Ia.jsx)("p",{children:t.id||t["@id"]||"unknown"})]})})}):null}function aL({image:t,thumbnail:e,crop:n,enableSizes:i,enableThumbnail:a,renderOptions:o,rotation:s}){let u=gb(),d=Re(t.service),p=QD(d),f=Jc(),m=p?.service;f(t.service,t);let g=m&&p?.status==="done",v=(m?.preferredFormats||[])[0],S=e&&e.type==="fixed"&&e.id&&!e.id.includes("/full/full/")&&!e.id.includes("/max/")?e:void 0;if(g===!1)return null;if(!u){let R=t.service,T=R.width||t.width||0,E=R.height||t.height||0,x=0,A=0,C=t.target?.spatial.width||T,M=t.target?.spatial.height||E;return(s===90||s===270)&&([C,M]=[M,C],M>C?A=-(M-C)/2:x=-(C-M)/2),(0,Ia.jsx)(oA,{enableThumbnail:a,renderOptions:o,rotation:s,tiles:{id:R.id||R["@id"]||"unknown",height:E,width:T,imageService:R,thumbnail:S},enableSizes:i,x,y:A,format:v,width:C,height:M,crop:n})}return(0,Ia.jsx)(yb,{resource:t.service,errorComponent:g7,extra:t,children:R=>{let T=R.width||t.width||0,E=R.height||t.height||0,x=0,A=0,C=t.target?.spatial.width||T,M=t.target?.spatial.height||E;return(s===90||s===270)&&([C,M]=[M,C],M<C?(A=-(M-C)/2,x=(C-M)/2):(A=(M-C)/2,x=-(C-M)/2)),(0,Ia.jsx)(oA,{enableThumbnail:a,renderOptions:o,tiles:{id:R.id||R["@id"]||"unknown",height:E,width:T,imageService:R,thumbnail:S},rotation:s,format:v,enableSizes:i,x,y:A,width:C,height:M,crop:n})}},t.id)}var Cl=_(V(),1);function wl({id:t,image:e,thumbnail:n,isStatic:i,x:a=0,y:o=0,children:s,selector:u,onClick:d,enableSizes:p,enableAnnotations:f}){let m=(0,Wc.useMemo)(()=>{if(!(!u||u.spatial.x===0&&u.spatial.y===0))return u.spatial},[u]),g=(0,Wc.useMemo)(()=>{let A=Array.isArray(e.annotation.body)?e.annotation.body?.[0]:e.annotation.body;if(A&&A.selector?.type==="ImageApiSelector")return Number(A.selector.rotation)},[e]),v=a+e.target.spatial.x,S=o+e.target.spatial.y,R=e.target.spatial.width,T=e.target.spatial.height,E=e.target.spatial.width,x=e.target.spatial.height;return(g===90||g===270)&&([R,T]=[T,R],[E,x]=[x,E]),(0,Cl.jsxs)("world-object",{x:v,y:S,width:R,height:T,onClick:d,rotation:g,children:[e.service?(0,Cl.jsxs)(Wc.Fragment,{children:[(0,Cl.jsx)(aL,{image:e,thumbnail:n,crop:m,enableSizes:p,rotation:g}),s]},"service"):(0,Cl.jsxs)(Wc.Fragment,{children:[(0,Cl.jsx)("world-image",{onClick:d,uri:e.id,target:{x:0,y:0,width:E,height:x},display:E&&x?{width:E,height:x}:void 0,crop:m}),s]},"no-service"),f&&e.annotationPages?e.annotationPages.map(A=>(0,Cl.jsx)(xl,{page:A,className:"image-service-annotation",ignoreTargetId:!0},A.id)):null]},t+(e.service?"server":"no-service"))}var ur=_(V(),1);function zv({strategy:t,onClickPaintingAnnotation:e}){return(0,ur.jsx)(ur.Fragment,{children:t.items.map((n,i)=>(0,ur.jsx)(ur.Fragment,{children:(0,ur.jsx)(Ni,{onClick:e?a=>{a.stopPropagation(),e(n.annotationId,n,a)}:void 0,target:n.target?.spatial||void 0,children:(0,ur.jsx)("div",{"data-textual-content":!0,children:(0,ur.jsx)(sa,{enableDangerouslySetInnerHTML:!0,children:n.text})})},i)}))})}var Da=_(V(),1);function oL({strategy:t,children:e}){let{store:n}=(0,Nv.useMemo)(()=>kD({complexTimeline:t}),[t]),i=St(n,s=>s.isReady),a=St(n,s=>s.visibleElements);function o(s){return u=>{u&&n.getState().setElement(s,u)}}return(0,Nv.useLayoutEffect)(()=>{if(i){let{startClock:s,stopClock:u}=n.getState();return s(),()=>{u()}}},[t,i]),Qn("portal","custom-controls",nA,{store:n,children:e},[i]),(0,Da.jsxs)(Da.Fragment,{children:[t.items.map(s=>s.type!=="Image"||!a[s.annotationId]?null:(0,Da.jsx)(wl,{image:s,id:s.annotationId},s.id)),t.items.map((s,u)=>s.type!=="Text"||!a[s.annotationId]?null:(0,Da.jsx)(zv,{strategy:{type:"textual-content",items:[s]}},u)),t.items.map((s,u)=>s.type!=="Video"||!s.target.spatial?null:(0,Da.jsx)(Ni,{target:s.target.spatial,children:(0,Da.jsx)("video",{ref:o(s.annotationId),src:s.url,style:{height:"100%",width:"100%",opacity:a[s.annotationId]?1:0}})},u)),t.items.map((s,u)=>s.type!=="Sound"?null:(0,Da.jsx)(Ni,{children:(0,Da.jsx)("audio",{ref:o(s.annotationId),src:s.url})},u)),t.highlights.map(({annotation:s})=>a[s.id]?(0,Da.jsx)(Vs,{id:s.id,ignoreTargetId:!0,style:{outline:"3px solid red"},className:"image-service-annotation"},s.id):null)]})}var rL=_(V(),1);function rA(){let{strategy:t}=Fe(),{renderComplexTimelineControls:e}=hi();return t.type!=="complex-timeline"?null:(0,rL.jsx)(oL,{strategy:t,children:e?e(t):null})}var lL=_(V(),1);function Iv({style:t}){let e=_t();return!e||!e.height||!e.width?null:(0,lL.jsx)("box",{interactive:!1,target:{x:0,y:0,width:Number(e.width),height:Number(e.height)},style:t})}var sL=_(V(),1);function lA({backgroundStyle:t,alwaysShowBackground:e}){let{strategy:n}=Fe();return n.type!=="empty"&&!e?null:(0,sL.jsx)(Iv,{style:t})}var Dv=_(X(),1),Wa=(0,Dv.createContext)(null);function Dh(){return(0,Dv.useContext)(Wa)}var $c=_(V(),1);function sA({isStatic:t=!1,enableSizes:e=!1,enableAnnotations:n=!0,onClickPaintingAnnotation:i,children:a}){let{strategy:o}=Fe(),{renderViewerControls:s,viewControlsDeps:u}=hi(),d=_t(),p=Dh(),f=sr({maxWidth:256,maxHeight:256});return Qn(p&&o.type==="images"&&s?"overlay":"none",`canvas-portal-controls-${d?.id}`,Wa.Provider,s?{value:p||null,children:s(o)}:{},[d,p,o,...u||[]]),o.type!=="images"?null:(0,$c.jsxs)($c.Fragment,{children:[o.images.map((m,g)=>(0,$c.jsx)(wl,{isStatic:t,image:m,id:m.id,thumbnail:g===0?f:void 0,selector:m.selector,enableSizes:e,enableAnnotations:n,onClick:i?v=>{i(m.annotationId,m,v)}:void 0},m.id+g)),a]})}var tf=_(V(),1);function uA({onClickPaintingAnnotation:t,children:e}){let{strategy:n}=Fe(),{renderViewerControls:i,viewControlsDeps:a}=hi(),o=Dh(),s=_t();return Qn(o&&n.type==="textual-content"&&i?"overlay":"none",`canvas-portal-controls-${s?.id}`,Wa.Provider,i?{value:o||null,children:i(n)}:{},[s,o,n,...a||[]]),n.type!=="textual-content"?null:(0,tf.jsxs)(tf.Fragment,{children:[(0,tf.jsx)(zv,{strategy:n,onClickPaintingAnnotation:t}),e]})}var Lh=_(V(),1);function cA({element:t,media:e,startTime:n,playPause:i,poster:a}){let o="div",s=n?`${e.url}#t=${n}`:e.url;return(0,Lh.jsxs)(o,{className:"video-container",part:"video-container",onClick:i,children:[(0,Lh.jsx)("style",{children:`
94
104
  .video-container {
95
105
  position: absolute;
96
106
  top: 0;
@@ -103,7 +113,7 @@ No matching component was found for:
103
113
  justify-content: center;
104
114
  pointer-events: visible;
105
115
  }
106
- `}),(0,Il.jsx)("video",{poster:r,ref:e,src:l,style:{width:"100%",objectFit:"contain"}})]})}function Jd({media:e,mediaControlsDeps:t,children:n,videoComponent:i=Wg,captions:r}){let s=Ce(),l=wl(),u=s&&s.placeholderCanvas&&s.placeholderCanvas.id||void 0,f=lr({},!1,{canvasId:u}),[{element:p,currentTime:c,progress:m},y,w]=Do({duration:e.duration});return Kt("overlay","video-element",i,{element:p,media:e,playPause:w.playPause,poster:f?.id,canvas:s,startTime:l?l.startTime:null,captions:r},[f]),Kt("portal","custom-controls",Sl,{state:y,actions:w,currentTime:c,progress:m,element:p,children:n},[c,y,e,...t||[]]),null}var ef=A(D(),1);function Ug({as:e}){let{strategy:t}=gt(),{renderMediaControls:n,mediaControlsDeps:i}=mn();return t.type!=="media"||t.media.type!=="Video"?null:(0,ef.jsxs)(Jd,{captions:t.captions,media:t.media,mediaControlsDeps:i,videoComponent:e,children:[(0,ef.jsx)(Ho,{}),n?n(t):null]},t.media.url)}var Xb=A(Q(),1),Cl=A(D(),1);function g_({element:e,media:t,playPause:n}){let i=(0,Xb.useRef)(null);return t.youTubeId?(0,Cl.jsxs)("div",{className:"video-container",part:"video-container",onClick:n,children:[(0,Cl.jsx)("style",{children:`
116
+ `}),(0,Lh.jsx)("video",{poster:a,ref:t,src:s,style:{width:"100%",objectFit:"contain"}})]})}function Lv({media:t,mediaControlsDeps:e,children:n,videoComponent:i=cA,captions:a}){let o=_t(),s=zh(),u=o&&o.placeholderCanvas&&o.placeholderCanvas.id||void 0,d=sr({},!1,{canvasId:u}),[{element:p,currentTime:f,progress:m},g,v]=js({duration:t.duration});return Qn("overlay","video-element",i,{element:p,media:t,playPause:v.playPause,poster:d?.id,canvas:o,startTime:s?s.startTime:null,captions:a},[d]),Qn("portal","custom-controls",_h,{state:g,actions:v,currentTime:f,progress:m,element:p,children:n},[f,g,t,...e||[]]),null}var Bv=_(V(),1);function fA({as:t}){let{strategy:e}=Fe(),{renderMediaControls:n,mediaControlsDeps:i}=hi();return e.type!=="media"||e.media.type!=="Video"?null:(0,Bv.jsxs)(Lv,{captions:e.captions,media:e.media,mediaControlsDeps:i,videoComponent:t,children:[(0,Bv.jsx)(ks,{}),n?n(e):null]},e.media.url)}var uL=_(X(),1),Bh=_(V(),1);function y7({element:t,media:e,playPause:n}){let i=(0,uL.useRef)(null);return e.youTubeId?(0,Bh.jsxs)("div",{className:"video-container",part:"video-container",onClick:n,children:[(0,Bh.jsx)("style",{children:`
107
117
  .video-container {
108
118
  position: absolute;
109
119
  top: 0;
@@ -121,15 +131,15 @@ No matching component was found for:
121
131
  width: 100%;
122
132
  object-fit: contain;
123
133
  }
124
- `}),(0,Cl.jsx)("iframe",{className:"video-yt",ref:i,src:`https://www.youtube.com/embed/${t.youTubeId}?enablejsapi=1&origin=${window.location.host}`,referrerPolicy:"no-referrer",sandbox:"allow-scripts allow-same-origin allow-presentation"})]}):null}function Zb({media:e,mediaControlsDeps:t,children:n}){let[{element:i,currentTime:r,progress:s},l,u]=Do({duration:e.duration});return Kt("overlay","video-element",g_,{element:i,media:e,playPause:u.playPause}),null}var tf=A(D(),1);function qg(){let{strategy:e}=gt(),{renderMediaControls:t,mediaControlsDeps:n}=mn();return e.type!=="media"||e.media.type!=="VideoYouTube"?null:(0,tf.jsxs)(Zb,{media:e.media,mediaControlsDeps:n,children:[(0,tf.jsx)(Ho,{}),t?t(e):null]})}var gf=A(Q(),1);var Yr=A(Q(),1);var sn=A(Q(),1);function Gg(e){let t=st(),n=ve(t,s=>s.polygons),i=ve(t,s=>s.polygonState),r=ve(t,s=>s.polygon);return Lo("atlas.polygon-render",({state:s,slowState:l,dt:u})=>{e(s,l,u)}),{currentShape:r,state:i,helper:n}}var Ve=A(D(),1),cr=ob(),Jb={shapeFill:"#ffffff33",shapeStroke:"#000",lineStroke:"#000",ghostLineStroke:"#0F0",activeLineStroke:"#4D7EEA",boundingBoxDottedStroke:"#0007",boundingBoxStroke:"#fffA",controlFill:"#fff"};function $g(e){let{image:t}=e,n={...Jb,...e.theme||{}},i=(0,sn.useRef)(),r=(0,sn.useRef)(),s=(0,sn.useRef)(),l=(0,sn.useRef)(),u=(0,sn.useRef)(),f=(0,sn.useRef)(),p=(0,sn.useRef)(),c=(0,sn.useRef)(),m=(0,sn.useRef)(),y=(0,sn.useRef)(),[w,v]=(0,sn.useState)(null),[S,E]=(0,sn.useState)(!1),{helper:R,state:b,currentShape:I}=Gg((G,K)=>{if(G.closestLineIndex,cr.updateTransitionBoundingBox(s.current,G,K),cr.updateBoundingBoxPolygon(i.current,G,K),cr.updateBoundingBoxPolygon(r.current,G,K),cr.updateTransitionShape(p.current,G,K),cr.updateClosestLinePointTransform(u.current,G,K),cr.updateSelectBox(l.current,G,K),cr.updatePointLine(c.current,G,K),cr.updateDrawPreview(f.current,G,K,3),cr.updateLineBox(m.current,G),v(G.transitionDirection),E(G.transitionRotate),G.closestLineIndex!==-1&&y.current){let ce=G.polygon,J=ce.points[G.closestLineIndex],te=ce.points[(G.closestLineIndex+1)%ce.points.length];J&&te&&y.current.setAttribute("points",`${J[0]},${J[1]} ${te[0]},${te[1]}`)}});(0,sn.useEffect)(()=>{let G=()=>{R.modifiers.reset()};return document.addEventListener("mouseleave",G),()=>{document.removeEventListener("mouseleave",G)}},[]);let M=(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsxs)("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:[(0,Ve.jsx)("circle",{cx:"5",cy:"5",r:"5",fill:n.lineStroke,className:"marker"}),(0,Ve.jsx)("circle",{cx:"5",cy:"5",r:"3",fill:n.controlFill})]}),(0,Ve.jsx)("marker",{id:"newdot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:(0,Ve.jsx)("circle",{cx:"5",cy:"5",r:"5",fill:n.activeLineStroke,className:"marker"})}),(0,Ve.jsxs)("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:[(0,Ve.jsx)("circle",{cx:"5",cy:"5",r:"5",fill:n.lineStroke}),(0,Ve.jsx)("circle",{cx:"5",cy:"5",r:"3",fill:n.activeLineStroke})]}),(0,Ve.jsxs)("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"6",markerHeight:"6",children:[(0,Ve.jsx)("rect",{width:"10",height:"10",fill:n.lineStroke}),(0,Ve.jsx)("rect",{x:"1",y:"1",width:"8",height:"8",fill:n.controlFill})]})]}),T=I?I.open?"polyline":"polygon":null,_=!b.showBoundingBox&&b.closestPoint!==null&&b.actionIntentType==="select-point",U=b.actionIntentType==="add-open-point",H=b.transitionIntentType==="split-line",Z=b.transitioning&&b.selectedStamp&&b.transitionIntentType==="stamp-shape",B=I&&T?(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(T,{fill:(!b.transitioning||b.transitionIntentType==="select-multiple-points")&&!I.open?n.shapeFill:"none",strokeWidth:Z||b.showBoundingBox&&b.boxMode||b.transitioning&&b.transitionIntentType==="split-line"||b.transitioning&&b.transitionIntentType==="move-point"?0:2,stroke:n.shapeStroke,points:I.points.map(G=>G.join(",")).join(" "),vectorEffect:"non-scaling-stroke",markerStart:b.showBoundingBox?void 0:b.boxMode?"url(#resizer)":"url(#dot)",markerMid:b.showBoundingBox?void 0:b.boxMode?"url(#resizer)":"url(#dot)",markerEnd:b.showBoundingBox?void 0:b.boxMode?"url(#resizer)":"url(#dot)",style:{pointerEvents:"none"},opacity:b.transitioning&&b.transitionIntentType==="move-shape"?0:1}),b.currentTool==="lineBox"&&b.actionIntentType==="close-line-box"?(0,Ve.jsx)("polygon",{fill:n.shapeFill,ref:m,stroke:n.lineStroke,strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,b.transitionIntentType==="draw-shape"&&b.transitioning?(0,Ve.jsx)("polyline",{ref:f,fill:"none",stroke:n.activeLineStroke,strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,!(b.transitioning&&b.transitionIntentType==="move-point")&&!(b.transitioning&&b.transitionIntentType==="stamp-shape")&&!b.showBoundingBox&&b.selectedPoints&&b.selectedPoints.length?(0,Ve.jsx)("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:I.points.filter((G,K)=>b.selectedPoints?.includes(K)).map(G=>G.join(",")).join(" "),opacity:b.transitioning&&b.transitionIntentType==="move-shape"?0:1}):null,_&&!b.transitioning&&b.closestPoint!==null&&I.points[b.closestPoint]?(0,Ve.jsx)("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:n.activeLineStroke,points:`${I.points[b.closestPoint][0]},${I.points[b.closestPoint][1]}`,opacity:b.transitioning&&b.transitionIntentType==="move-shape"?0:1}):null,!b.transitioning&&(b.actionIntentType==="add-open-point"||b.actionIntentType==="close-shape"||b.actionIntentType==="close-shape-line")?(0,Ve.jsx)("polyline",{stroke:n.activeLineStroke,ref:c,strokeWidth:b.actionIntentType==="add-open-point"?1:2,vectorEffect:"non-scaling-stroke"}):null,b.hasClosestLine&&!b.showBoundingBox&&!b.transitioning&&b.currentTool!=="box"&&b.transitionIntentType==="split-line"?(0,Ve.jsx)("g",{children:(0,Ve.jsx)("polyline",{ref:y,vectorEffect:"non-scaling-stroke",fill:"transparent",stroke:n.activeLineStroke,strokeWidth:3})}):null,b.hasClosestLine&&!b.showBoundingBox&&!b.transitioning&&b.currentTool!=="box"&&b.transitionIntentType==="split-line"?(0,Ve.jsx)("g",{ref:u,children:(0,Ve.jsx)("polyline",{markerStart:"url(#newdot)",points:"0,0 1,1",vectorEffect:"non-scaling-stroke",stroke:"transparent",fill:"transparent",strokeWidth:2})}):null,b.transitioning?(0,Ve.jsx)(T,{ref:p,fill:I.open?"none":n.shapeFill,stroke:b.transitionIntentType==="stamp-shape"?n.activeLineStroke:n.shapeStroke,vectorEffect:"non-scaling-stroke",strokeWidth:(I.open,2)}):null,b.transitioning&&b.transitionIntentType==="select-multiple-points"?(0,Ve.jsx)("rect",{ref:l,fill:"rgba(255, 255, 255, .3)",strokeWidth:1,stroke:"rgba(0,0,0,.2)",vectorEffect:"non-scaling-stroke"}):null,b.showBoundingBox&&!Z?(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)("polygon",{ref:i,strokeWidth:2,stroke:n.boundingBoxStroke,fill:"none",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"}),(0,Ve.jsx)("polygon",{ref:r,strokeWidth:2,stroke:n.boundingBoxDottedStroke,fill:"none",strokeDasharray:"4 4",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"})]}):null]}):null;return{currentTool:R.state.slowState.currentTool,setCurrentTool:R.tools.setTool,helper:R,currentShape:I,state:b,isAddingPoint:U,isSplitting:H,isStamping:Z,isHoveringPoint:_,transitionDirection:w,transitionRotate:S,defs:M,editor:B}}var Qr=A(D(),1);function eR(e){let t=Id(),{image:n}=e,{helper:i,defs:r,editor:s,state:l,transitionDirection:u,isSplitting:f,transitionRotate:p,isHoveringPoint:c,isAddingPoint:m}=$g({image:e.image,theme:e.theme}),y=(0,Yr.useCallback)(S=>{S.button!==2&&i.pointer([[~~S.atlas.x,~~S.atlas.y]])},[i]),w=(0,Yr.useCallback)(S=>{S.button!==2&&i.pointerDown()},[i]),v=(0,Yr.useCallback)(S=>{S.button!==2&&i.pointerUp()},[i]);return(0,Yr.useEffect)(()=>{let S=E=>{i.key.up(E.key)};return document.addEventListener("keyup",S),()=>{document.removeEventListener("keyup",S)}},[i]),(0,Yr.useEffect)(()=>{let S=E=>{E.target&&["INPUT","TEXTAREA"].includes(E.target.tagName)||E.target?.isContentEditable||document.activeElement&&(document.activeElement instanceof HTMLInputElement||document.activeElement instanceof HTMLTextAreaElement||document.activeElement.isContentEditable)||i.key.down(E.key)};return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[i]),(0,Yr.useEffect)(()=>{let S=[];return u&&S.push(`atlas-cursor-${u}`),l.actionIntentType==="cut-line"&&l.modifiers?.Shift&&S.push("atlas-cursor-cut"),(c||l.transitionIntentType==="move-shape"||l.transitionIntentType==="move-point")&&S.push("atlas-cursor-move"),m&&S.push("atlas-cursor-crosshair"),f&&S.push("atlas-cursor-copy"),p&&S.push("atlas-cursor-rotate"),l.transitionIntentType==="draw-shape"&&S.push("atlas-cursor-draw"),t?.canvas&&t.canvas.classList.add(...S),()=>{t?.canvas&&t.canvas.classList.remove(...S)}},[t?.canvas,m,c,f,l.modifiers?.Shift,l.actionIntentType,l.transitionIntentType,u,p]),(0,Qr.jsx)("world-object",{height:n.height,width:n.width,onMouseMove:y,onMouseDown:w,onMouseUp:v,onMouseLeave:i.blur,children:(0,Qr.jsx)(jn,{relative:!0,interactive:!1,children:(0,Qr.jsx)("div",{className:"absolute top-0 right-0 left-0 bottom-0",children:(0,Qr.jsxs)("svg",{width:"100%",height:"100%",viewBox:`0 0 ${n.width} ${n.height}`,tabIndex:-1,children:[(0,Qr.jsx)("title",{children:"Annotation Editor"}),(0,Qr.jsx)("defs",{children:r}),s]})})})})}var XR=A(Q(),1);var Ae=A(Q(),1);function nf(){return typeof window<"u"}function Kr(e){return tR(e)?(e.nodeName||"").toLowerCase():"#document"}function gn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ti(e){var t;return(t=(tR(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function tR(e){return nf()?e instanceof Node||e instanceof gn(e).Node:!1}function yt(e){return nf()?e instanceof Element||e instanceof gn(e).Element:!1}function Mn(e){return nf()?e instanceof HTMLElement||e instanceof gn(e).HTMLElement:!1}function Pl(e){return!nf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof gn(e).ShadowRoot}var y_=new Set(["inline","contents"]);function Ks(e){let{overflow:t,overflowX:n,overflowY:i,display:r}=_n(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!y_.has(r)}var v_=new Set(["table","td","th"]);function nR(e){return v_.has(Kr(e))}var x_=[":popover-open",":modal"];function Al(e){return x_.some(t=>{try{return e.matches(t)}catch{return!1}})}var S_=["transform","translate","scale","rotate","perspective"],w_=["transform","translate","scale","rotate","perspective","filter"],b_=["paint","layout","strict","content"];function rf(e){let t=Xs(),n=yt(e)?_n(e):e;return S_.some(i=>n[i]?n[i]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||w_.some(i=>(n.willChange||"").includes(i))||b_.some(i=>(n.contain||"").includes(i))}function iR(e){let t=Ai(e);for(;Mn(t)&&!Mi(t);){if(rf(t))return t;if(Al(t))return null;t=Ai(t)}return null}function Xs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var R_=new Set(["html","body","#document"]);function Mi(e){return R_.has(Kr(e))}function _n(e){return gn(e).getComputedStyle(e)}function Tl(e){return yt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ai(e){if(Kr(e)==="html")return e;let t=e.assignedSlot||e.parentNode||Pl(e)&&e.host||Ti(e);return Pl(t)?t.host:t}function rR(e){let t=Ai(e);return Mi(t)?e.ownerDocument?e.ownerDocument.body:e.body:Mn(t)&&Ks(t)?t:rR(t)}function Un(e,t,n){var i;t===void 0&&(t=[]),n===void 0&&(n=!0);let r=rR(e),s=r===((i=e.ownerDocument)==null?void 0:i.body),l=gn(r);if(s){let u=of(l);return t.concat(l,l.visualViewport||[],Ks(r)?r:[],u&&n?Un(u):[])}return t.concat(r,Un(r,[],n))}function of(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Fl=A(Q(),1),dR=A(Q(),1);var Zs=Math.min,dr=Math.max,_l=Math.round,Ol=Math.floor,_i=e=>({x:e,y:e}),E_={left:"right",right:"left",bottom:"top",top:"bottom"},I_={start:"end",end:"start"};function Qg(e,t,n){return dr(e,Zs(t,n))}function kl(e,t){return typeof e=="function"?e(t):e}function Xr(e){return e.split("-")[0]}function Ll(e){return e.split("-")[1]}function Yg(e){return e==="x"?"y":"x"}function Kg(e){return e==="y"?"height":"width"}var C_=new Set(["top","bottom"]);function fr(e){return C_.has(Xr(e))?"y":"x"}function Xg(e){return Yg(fr(e))}function aR(e,t,n){n===void 0&&(n=!1);let i=Ll(e),r=Xg(e),s=Kg(r),l=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(l=Ml(l)),[l,Ml(l)]}function lR(e){let t=Ml(e);return[sf(e),t,sf(t)]}function sf(e){return e.replace(/start|end/g,t=>I_[t])}var oR=["left","right"],sR=["right","left"],P_=["top","bottom"],A_=["bottom","top"];function T_(e,t,n){switch(e){case"top":case"bottom":return n?t?sR:oR:t?oR:sR;case"left":case"right":return t?P_:A_;default:return[]}}function uR(e,t,n,i){let r=Ll(e),s=T_(Xr(e),n==="start",i);return r&&(s=s.map(l=>l+"-"+r),t&&(s=s.concat(s.map(sf)))),s}function Ml(e){return e.replace(/left|right|bottom|top/g,t=>E_[t])}function M_(e){return{top:0,right:0,bottom:0,left:0,...e}}function cR(e){return typeof e!="number"?M_(e):{top:e,right:e,bottom:e,left:e}}function qo(e){let{x:t,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:t,right:t+i,bottom:n+r,x:t,y:n}}function Zg(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Pl(n)){let i=t;for(;i;){if(e===i)return!0;i=i.parentNode||i.host}}return!1}function Js(e){return"composedPath"in e?e.composedPath()[0]:e.target}function af(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function fR(e){return e.matches("html,body")}function Jg(e){return e?.ownerDocument||document}function Nl(e,t,n){return n===void 0&&(n=!0),e.filter(r=>{var s;return r.parentId===t&&(!n||((s=r.context)==null?void 0:s.open))}).flatMap(r=>[r,...Nl(e,r.id,n)])}function hR(e){return"nativeEvent"in e}var __=typeof document<"u",O_=function(){},lf=__?dR.useLayoutEffect:O_,k_={...Fl};var L_=k_.useInsertionEffect,F_=L_||(e=>e());function Go(e){let t=Fl.useRef(()=>{});return F_(()=>{t.current=e}),Fl.useCallback(function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return t.current==null?void 0:t.current(...i)},[])}var uy=A(D(),1);var jR=A(Oo(),1);function pR(e,t,n){let{reference:i,floating:r}=e,s=fr(t),l=Xg(t),u=Kg(l),f=Xr(t),p=s==="y",c=i.x+i.width/2-r.width/2,m=i.y+i.height/2-r.height/2,y=i[u]/2-r[u]/2,w;switch(f){case"top":w={x:c,y:i.y-r.height};break;case"bottom":w={x:c,y:i.y+i.height};break;case"right":w={x:i.x+i.width,y:m};break;case"left":w={x:i.x-r.width,y:m};break;default:w={x:i.x,y:i.y}}switch(Ll(t)){case"start":w[l]-=y*(n&&p?-1:1);break;case"end":w[l]+=y*(n&&p?-1:1);break}return w}var mR=async(e,t,n)=>{let{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:l}=n,u=s.filter(Boolean),f=await(l.isRTL==null?void 0:l.isRTL(t)),p=await l.getElementRects({reference:e,floating:t,strategy:r}),{x:c,y:m}=pR(p,i,f),y=i,w={},v=0;for(let S=0;S<u.length;S++){let{name:E,fn:R}=u[S],{x:b,y:I,data:M,reset:T}=await R({x:c,y:m,initialPlacement:i,placement:y,strategy:r,middlewareData:w,rects:p,platform:l,elements:{reference:e,floating:t}});c=b??c,m=I??m,w={...w,[E]:{...w[E],...M}},T&&v<=50&&(v++,typeof T=="object"&&(T.placement&&(y=T.placement),T.rects&&(p=T.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:r}):T.rects),{x:c,y:m}=pR(p,y,f)),S=-1)}return{x:c,y:m,placement:y,strategy:r,middlewareData:w}};async function ey(e,t){var n;t===void 0&&(t={});let{x:i,y:r,platform:s,rects:l,elements:u,strategy:f}=e,{boundary:p="clippingAncestors",rootBoundary:c="viewport",elementContext:m="floating",altBoundary:y=!1,padding:w=0}=kl(t,e),v=cR(w),E=u[y?m==="floating"?"reference":"floating":m],R=qo(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(E)))==null||n?E:E.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(u.floating)),boundary:p,rootBoundary:c,strategy:f})),b=m==="floating"?{x:i,y:r,width:l.floating.width,height:l.floating.height}:l.reference,I=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u.floating)),M=await(s.isElement==null?void 0:s.isElement(I))?await(s.getScale==null?void 0:s.getScale(I))||{x:1,y:1}:{x:1,y:1},T=qo(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:b,offsetParent:I,strategy:f}):b);return{top:(R.top-T.top+v.top)/M.y,bottom:(T.bottom-R.bottom+v.bottom)/M.y,left:(R.left-T.left+v.left)/M.x,right:(T.right-R.right+v.right)/M.x}}var gR=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,i;let{placement:r,middlewareData:s,rects:l,initialPlacement:u,platform:f,elements:p}=t,{mainAxis:c=!0,crossAxis:m=!0,fallbackPlacements:y,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:S=!0,...E}=kl(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};let R=Xr(r),b=fr(u),I=Xr(u)===u,M=await(f.isRTL==null?void 0:f.isRTL(p.floating)),T=y||(I||!S?[Ml(u)]:lR(u)),_=v!=="none";!y&&_&&T.push(...uR(u,S,v,M));let U=[u,...T],H=await ey(t,E),Z=[],B=((i=s.flip)==null?void 0:i.overflows)||[];if(c&&Z.push(H[R]),m){let J=aR(r,l,M);Z.push(H[J[0]],H[J[1]])}if(B=[...B,{placement:r,overflows:Z}],!Z.every(J=>J<=0)){var G,K;let J=(((G=s.flip)==null?void 0:G.index)||0)+1,te=U[J];if(te&&(!(m==="alignment"?b!==fr(te):!1)||B.every(de=>de.overflows[0]>0&&fr(de.placement)===b)))return{data:{index:J,overflows:B},reset:{placement:te}};let oe=(K=B.filter(Re=>Re.overflows[0]<=0).sort((Re,de)=>Re.overflows[1]-de.overflows[1])[0])==null?void 0:K.placement;if(!oe)switch(w){case"bestFit":{var ce;let Re=(ce=B.filter(de=>{if(_){let N=fr(de.placement);return N===b||N==="y"}return!0}).map(de=>[de.placement,de.overflows.filter(N=>N>0).reduce((N,re)=>N+re,0)]).sort((de,N)=>de[1]-N[1])[0])==null?void 0:ce[0];Re&&(oe=Re);break}case"initialPlacement":oe=u;break}if(r!==oe)return{reset:{placement:oe}}}return{}}}};var N_=new Set(["left","top"]);async function z_(e,t){let{placement:n,platform:i,elements:r}=e,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),l=Xr(n),u=Ll(n),f=fr(n)==="y",p=N_.has(l)?-1:1,c=s&&f?-1:1,m=kl(t,e),{mainAxis:y,crossAxis:w,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return u&&typeof v=="number"&&(w=u==="end"?v*-1:v),f?{x:w*c,y:y*p}:{x:y*p,y:w*c}}var yR=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,i;let{x:r,y:s,placement:l,middlewareData:u}=t,f=await z_(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(i=u.arrow)!=null&&i.alignmentOffset?{}:{x:r+f.x,y:s+f.y,data:{...f,placement:l}}}}},vR=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:i,placement:r}=t,{mainAxis:s=!0,crossAxis:l=!1,limiter:u={fn:E=>{let{x:R,y:b}=E;return{x:R,y:b}}},...f}=kl(e,t),p={x:n,y:i},c=await ey(t,f),m=fr(Xr(r)),y=Yg(m),w=p[y],v=p[m];if(s){let E=y==="y"?"top":"left",R=y==="y"?"bottom":"right",b=w+c[E],I=w-c[R];w=Qg(b,w,I)}if(l){let E=m==="y"?"top":"left",R=m==="y"?"bottom":"right",b=v+c[E],I=v-c[R];v=Qg(b,v,I)}let S=u.fn({...t,[y]:w,[m]:v});return{...S,data:{x:S.x-n,y:S.y-i,enabled:{[y]:s,[m]:l}}}}}};function wR(e){let t=_n(e),n=parseFloat(t.width)||0,i=parseFloat(t.height)||0,r=Mn(e),s=r?e.offsetWidth:n,l=r?e.offsetHeight:i,u=_l(n)!==s||_l(i)!==l;return u&&(n=s,i=l),{width:n,height:i,$:u}}function ny(e){return yt(e)?e:e.contextElement}function ea(e){let t=ny(e);if(!Mn(t))return _i(1);let n=t.getBoundingClientRect(),{width:i,height:r,$:s}=wR(t),l=(s?_l(n.width):n.width)/i,u=(s?_l(n.height):n.height)/r;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}var D_=_i(0);function bR(e){let t=gn(e);return!Xs()||!t.visualViewport?D_:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function B_(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==gn(e)?!1:t}function $o(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);let r=e.getBoundingClientRect(),s=ny(e),l=_i(1);t&&(i?yt(i)&&(l=ea(i)):l=ea(e));let u=B_(s,n,i)?bR(s):_i(0),f=(r.left+u.x)/l.x,p=(r.top+u.y)/l.y,c=r.width/l.x,m=r.height/l.y;if(s){let y=gn(s),w=i&&yt(i)?gn(i):i,v=y,S=of(v);for(;S&&i&&w!==v;){let E=ea(S),R=S.getBoundingClientRect(),b=_n(S),I=R.left+(S.clientLeft+parseFloat(b.paddingLeft))*E.x,M=R.top+(S.clientTop+parseFloat(b.paddingTop))*E.y;f*=E.x,p*=E.y,c*=E.x,m*=E.y,f+=I,p+=M,v=gn(S),S=of(v)}}return qo({width:c,height:m,x:f,y:p})}function iy(e,t){let n=Tl(e).scrollLeft;return t?t.left+n:$o(Ti(e)).left+n}function RR(e,t,n){n===void 0&&(n=!1);let i=e.getBoundingClientRect(),r=i.left+t.scrollLeft-(n?0:iy(e,i)),s=i.top+t.scrollTop;return{x:r,y:s}}function V_(e){let{elements:t,rect:n,offsetParent:i,strategy:r}=e,s=r==="fixed",l=Ti(i),u=t?Al(t.floating):!1;if(i===l||u&&s)return n;let f={scrollLeft:0,scrollTop:0},p=_i(1),c=_i(0),m=Mn(i);if((m||!m&&!s)&&((Kr(i)!=="body"||Ks(l))&&(f=Tl(i)),Mn(i))){let w=$o(i);p=ea(i),c.x=w.x+i.clientLeft,c.y=w.y+i.clientTop}let y=l&&!m&&!s?RR(l,f,!0):_i(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-f.scrollLeft*p.x+c.x+y.x,y:n.y*p.y-f.scrollTop*p.y+c.y+y.y}}function j_(e){return Array.from(e.getClientRects())}function H_(e){let t=Ti(e),n=Tl(e),i=e.ownerDocument.body,r=dr(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),s=dr(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight),l=-n.scrollLeft+iy(e),u=-n.scrollTop;return _n(i).direction==="rtl"&&(l+=dr(t.clientWidth,i.clientWidth)-r),{width:r,height:s,x:l,y:u}}function W_(e,t){let n=gn(e),i=Ti(e),r=n.visualViewport,s=i.clientWidth,l=i.clientHeight,u=0,f=0;if(r){s=r.width,l=r.height;let p=Xs();(!p||p&&t==="fixed")&&(u=r.offsetLeft,f=r.offsetTop)}return{width:s,height:l,x:u,y:f}}var U_=new Set(["absolute","fixed"]);function q_(e,t){let n=$o(e,!0,t==="fixed"),i=n.top+e.clientTop,r=n.left+e.clientLeft,s=Mn(e)?ea(e):_i(1),l=e.clientWidth*s.x,u=e.clientHeight*s.y,f=r*s.x,p=i*s.y;return{width:l,height:u,x:f,y:p}}function xR(e,t,n){let i;if(t==="viewport")i=W_(e,n);else if(t==="document")i=H_(Ti(e));else if(yt(t))i=q_(t,n);else{let r=bR(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return qo(i)}function ER(e,t){let n=Ai(e);return n===t||!yt(n)||Mi(n)?!1:_n(n).position==="fixed"||ER(n,t)}function G_(e,t){let n=t.get(e);if(n)return n;let i=Un(e,[],!1).filter(u=>yt(u)&&Kr(u)!=="body"),r=null,s=_n(e).position==="fixed",l=s?Ai(e):e;for(;yt(l)&&!Mi(l);){let u=_n(l),f=rf(l);!f&&u.position==="fixed"&&(r=null),(s?!f&&!r:!f&&u.position==="static"&&!!r&&U_.has(r.position)||Ks(l)&&!f&&ER(e,l))?i=i.filter(c=>c!==l):r=u,l=Ai(l)}return t.set(e,i),i}function $_(e){let{element:t,boundary:n,rootBoundary:i,strategy:r}=e,l=[...n==="clippingAncestors"?Al(t)?[]:G_(t,this._c):[].concat(n),i],u=l[0],f=l.reduce((p,c)=>{let m=xR(t,c,r);return p.top=dr(m.top,p.top),p.right=Zs(m.right,p.right),p.bottom=Zs(m.bottom,p.bottom),p.left=dr(m.left,p.left),p},xR(t,u,r));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function Q_(e){let{width:t,height:n}=wR(e);return{width:t,height:n}}function Y_(e,t,n){let i=Mn(t),r=Ti(t),s=n==="fixed",l=$o(e,!0,s,t),u={scrollLeft:0,scrollTop:0},f=_i(0);function p(){f.x=iy(r)}if(i||!i&&!s)if((Kr(t)!=="body"||Ks(r))&&(u=Tl(t)),i){let w=$o(t,!0,s,t);f.x=w.x+t.clientLeft,f.y=w.y+t.clientTop}else r&&p();s&&!i&&r&&p();let c=r&&!i&&!s?RR(r,u):_i(0),m=l.left+u.scrollLeft-f.x-c.x,y=l.top+u.scrollTop-f.y-c.y;return{x:m,y,width:l.width,height:l.height}}function ty(e){return _n(e).position==="static"}function SR(e,t){if(!Mn(e)||_n(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ti(e)===n&&(n=n.ownerDocument.body),n}function IR(e,t){let n=gn(e);if(Al(e))return n;if(!Mn(e)){let r=Ai(e);for(;r&&!Mi(r);){if(yt(r)&&!ty(r))return r;r=Ai(r)}return n}let i=SR(e,t);for(;i&&nR(i)&&ty(i);)i=SR(i,t);return i&&Mi(i)&&ty(i)&&!rf(i)?n:i||iR(e)||n}var K_=async function(e){let t=this.getOffsetParent||IR,n=this.getDimensions,i=await n(e.floating);return{reference:Y_(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function X_(e){return _n(e).direction==="rtl"}var ry={convertOffsetParentRelativeRectToViewportRelativeRect:V_,getDocumentElement:Ti,getClippingRect:$_,getOffsetParent:IR,getElementRects:K_,getClientRects:j_,getDimensions:Q_,getScale:ea,isElement:yt,isRTL:X_};function CR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Z_(e,t){let n=null,i,r=Ti(e);function s(){var u;clearTimeout(i),(u=n)==null||u.disconnect(),n=null}function l(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),s();let p=e.getBoundingClientRect(),{left:c,top:m,width:y,height:w}=p;if(u||t(),!y||!w)return;let v=Ol(m),S=Ol(r.clientWidth-(c+y)),E=Ol(r.clientHeight-(m+w)),R=Ol(c),I={rootMargin:-v+"px "+-S+"px "+-E+"px "+-R+"px",threshold:dr(0,Zs(1,f))||1},M=!0;function T(_){let U=_[0].intersectionRatio;if(U!==f){if(!M)return l();U?l(!1,U):i=setTimeout(()=>{l(!1,1e-7)},1e3)}U===1&&!CR(p,e.getBoundingClientRect())&&l(),M=!1}try{n=new IntersectionObserver(T,{...I,root:r.ownerDocument})}catch{n=new IntersectionObserver(T,I)}n.observe(e)}return l(!0),s}function uf(e,t,n,i){i===void 0&&(i={});let{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:f=!1}=i,p=ny(e),c=r||s?[...p?Un(p):[],...Un(t)]:[];c.forEach(R=>{r&&R.addEventListener("scroll",n,{passive:!0}),s&&R.addEventListener("resize",n)});let m=p&&u?Z_(p,n):null,y=-1,w=null;l&&(w=new ResizeObserver(R=>{let[b]=R;b&&b.target===p&&w&&(w.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var I;(I=w)==null||I.observe(t)})),n()}),p&&!f&&w.observe(p),w.observe(t));let v,S=f?$o(e):null;f&&E();function E(){let R=$o(e);S&&!CR(S,R)&&n(),S=R,v=requestAnimationFrame(E)}return n(),()=>{var R;c.forEach(b=>{r&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),m?.(),(R=w)==null||R.disconnect(),w=null,f&&cancelAnimationFrame(v)}}var PR=yR;var AR=vR,TR=gR;var cf=(e,t,n)=>{let i=new Map,r={platform:ry,...n},s={...r.platform,_c:i};return mR(e,t,{...r,platform:s})};var Ot=A(Q(),1),OR=A(Q(),1),kR=A(Oo(),1),J_=typeof document<"u",eO=function(){},df=J_?OR.useLayoutEffect:eO;function ff(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,i,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(i=n;i--!==0;)if(!ff(e[i],t[i]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(t,r[i]))return!1;for(i=n;i--!==0;){let s=r[i];if(!(s==="_owner"&&e.$$typeof)&&!ff(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function LR(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function MR(e,t){let n=LR(e);return Math.round(t*n)/n}function oy(e){let t=Ot.useRef(e);return df(()=>{t.current=e}),t}function FR(e){e===void 0&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:i=[],platform:r,elements:{reference:s,floating:l}={},transform:u=!0,whileElementsMounted:f,open:p}=e,[c,m]=Ot.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,w]=Ot.useState(i);ff(y,i)||w(i);let[v,S]=Ot.useState(null),[E,R]=Ot.useState(null),b=Ot.useCallback(de=>{de!==_.current&&(_.current=de,S(de))},[]),I=Ot.useCallback(de=>{de!==U.current&&(U.current=de,R(de))},[]),M=s||v,T=l||E,_=Ot.useRef(null),U=Ot.useRef(null),H=Ot.useRef(c),Z=f!=null,B=oy(f),G=oy(r),K=oy(p),ce=Ot.useCallback(()=>{if(!_.current||!U.current)return;let de={placement:t,strategy:n,middleware:y};G.current&&(de.platform=G.current),cf(_.current,U.current,de).then(N=>{let re={...N,isPositioned:K.current!==!1};J.current&&!ff(H.current,re)&&(H.current=re,kR.flushSync(()=>{m(re)}))})},[y,t,n,G,K]);df(()=>{p===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,m(de=>({...de,isPositioned:!1})))},[p]);let J=Ot.useRef(!1);df(()=>(J.current=!0,()=>{J.current=!1}),[]),df(()=>{if(M&&(_.current=M),T&&(U.current=T),M&&T){if(B.current)return B.current(M,T,ce);ce()}},[M,T,ce,B,Z]);let te=Ot.useMemo(()=>({reference:_,floating:U,setReference:b,setFloating:I}),[b,I]),oe=Ot.useMemo(()=>({reference:M,floating:T}),[M,T]),Re=Ot.useMemo(()=>{let de={position:n,left:0,top:0};if(!oe.floating)return de;let N=MR(oe.floating,c.x),re=MR(oe.floating,c.y);return u?{...de,transform:"translate("+N+"px, "+re+"px)",...LR(oe.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:N,top:re}},[n,u,oe.floating,c.x,c.y]);return Ot.useMemo(()=>({...c,update:ce,refs:te,elements:oe,floatingStyles:Re}),[c,ce,te,oe,Re])}var hf=(e,t)=>({...PR(e),options:[e,t]}),sy=(e,t)=>({...AR(e),options:[e,t]});var ay=(e,t)=>({...TR(e),options:[e,t]});var tO="data-floating-ui-focusable",NR="active",zR="selected",nO="ArrowLeft",iO="ArrowRight",rO="ArrowUp",oO="ArrowDown";var sO=[nO,iO],aO=[rO,oO],o5=[...sO,...aO];var lO={...Ae},DR=!1,uO=0,BR=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+uO++;function cO(){let[e,t]=Ae.useState(()=>DR?BR():void 0);return lf(()=>{e==null&&t(BR())},[]),Ae.useEffect(()=>{DR=!0},[]),e}var dO=lO.useId,fO=dO||cO;function hO(){let e=new Map;return{emit(t,n){var i;(i=e.get(t))==null||i.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var i;(i=e.get(t))==null||i.delete(n)}}}var pO=Ae.createContext(null),mO=Ae.createContext(null),gO=()=>{var e;return((e=Ae.useContext(pO))==null?void 0:e.id)||null},HR=()=>Ae.useContext(mO);function yO(e){return"data-floating-ui-"+e}function vO(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}var xO={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},SO={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},VR=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e?.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e?.outsidePress)!=null?n:!0}};function WR(e,t){t===void 0&&(t={});let{open:n,onOpenChange:i,elements:r,dataRef:s}=e,{enabled:l=!0,escapeKey:u=!0,outsidePress:f=!0,outsidePressEvent:p="pointerdown",referencePress:c=!1,referencePressEvent:m="pointerdown",ancestorScroll:y=!1,bubbles:w,capture:v}=t,S=HR(),E=Go(typeof f=="function"?f:()=>!1),R=typeof f=="function"?E:f,b=Ae.useRef(!1),{escapeKey:I,outsidePress:M}=VR(w),{escapeKey:T,outsidePress:_}=VR(v),U=Ae.useRef(!1),H=Ae.useRef(-1),Z=Go(te=>{var oe;if(!n||!l||!u||te.key!=="Escape"||U.current)return;let Re=(oe=s.current.floatingContext)==null?void 0:oe.nodeId,de=S?Nl(S.nodesRef.current,Re):[];if(!I&&(te.stopPropagation(),de.length>0)){let N=!0;if(de.forEach(re=>{var Le;if((Le=re.context)!=null&&Le.open&&!re.context.dataRef.current.__escapeKeyBubbles){N=!1;return}}),!N)return}i(!1,hR(te)?te.nativeEvent:te,"escape-key")}),B=Go(te=>{var oe;let Re=()=>{var de;Z(te),(de=Js(te))==null||de.removeEventListener("keydown",Re)};(oe=Js(te))==null||oe.addEventListener("keydown",Re)}),G=Go(te=>{var oe;let Re=s.current.insideReactTree;s.current.insideReactTree=!1;let de=b.current;if(b.current=!1,p==="click"&&de||Re||typeof R=="function"&&!R(te))return;let N=Js(te),re="["+yO("inert")+"]",Le=Jg(r.floating).querySelectorAll(re),je=yt(N)?N:null;for(;je&&!Mi(je);){let Ze=Ai(je);if(Mi(Ze)||!yt(Ze))break;je=Ze}if(Le.length&&yt(N)&&!fR(N)&&!Zg(N,r.floating)&&Array.from(Le).every(Ze=>!Zg(je,Ze)))return;if(Mn(N)&&J){let Ze=Mi(N),Ct=_n(N),xt=/auto|scroll/,xn=Ze||xt.test(Ct.overflowX),Pt=Ze||xt.test(Ct.overflowY),Ne=xn&&N.clientWidth>0&&N.scrollWidth>N.clientWidth,fe=Pt&&N.clientHeight>0&&N.scrollHeight>N.clientHeight,ae=Ct.direction==="rtl",De=fe&&(ae?te.offsetX<=N.offsetWidth-N.clientWidth:te.offsetX>N.clientWidth),Rt=Ne&&te.offsetY>N.clientHeight;if(De||Rt)return}let Ge=(oe=s.current.floatingContext)==null?void 0:oe.nodeId,$e=S&&Nl(S.nodesRef.current,Ge).some(Ze=>{var Ct;return af(te,(Ct=Ze.context)==null?void 0:Ct.elements.floating)});if(af(te,r.floating)||af(te,r.domReference)||$e)return;let Qe=S?Nl(S.nodesRef.current,Ge):[];if(Qe.length>0){let Ze=!0;if(Qe.forEach(Ct=>{var xt;if((xt=Ct.context)!=null&&xt.open&&!Ct.context.dataRef.current.__outsidePressBubbles){Ze=!1;return}}),!Ze)return}i(!1,te,"outside-press")}),K=Go(te=>{var oe;let Re=()=>{var de;G(te),(de=Js(te))==null||de.removeEventListener(p,Re)};(oe=Js(te))==null||oe.addEventListener(p,Re)});Ae.useEffect(()=>{if(!n||!l)return;s.current.__escapeKeyBubbles=I,s.current.__outsidePressBubbles=M;let te=-1;function oe(Le){i(!1,Le,"ancestor-scroll")}function Re(){window.clearTimeout(te),U.current=!0}function de(){te=window.setTimeout(()=>{U.current=!1},Xs()?5:0)}let N=Jg(r.floating);u&&(N.addEventListener("keydown",T?B:Z,T),N.addEventListener("compositionstart",Re),N.addEventListener("compositionend",de)),R&&N.addEventListener(p,_?K:G,_);let re=[];return y&&(yt(r.domReference)&&(re=Un(r.domReference)),yt(r.floating)&&(re=re.concat(Un(r.floating))),!yt(r.reference)&&r.reference&&r.reference.contextElement&&(re=re.concat(Un(r.reference.contextElement)))),re=re.filter(Le=>{var je;return Le!==((je=N.defaultView)==null?void 0:je.visualViewport)}),re.forEach(Le=>{Le.addEventListener("scroll",oe,{passive:!0})}),()=>{u&&(N.removeEventListener("keydown",T?B:Z,T),N.removeEventListener("compositionstart",Re),N.removeEventListener("compositionend",de)),R&&N.removeEventListener(p,_?K:G,_),re.forEach(Le=>{Le.removeEventListener("scroll",oe)}),window.clearTimeout(te)}},[s,r,u,R,p,n,i,y,l,I,M,Z,T,B,G,_,K]),Ae.useEffect(()=>{s.current.insideReactTree=!1},[s,R,p]);let ce=Ae.useMemo(()=>({onKeyDown:Z,...c&&{[xO[m]]:te=>{i(!1,te.nativeEvent,"reference-press")},...m!=="click"&&{onClick(te){i(!1,te.nativeEvent,"reference-press")}}}}),[Z,i,c,m]),J=Ae.useMemo(()=>({onKeyDown:Z,onMouseDown(){b.current=!0},onMouseUp(){b.current=!0},[SO[p]]:()=>{s.current.insideReactTree=!0},onBlurCapture(){S||(vO(H),s.current.insideReactTree=!0,H.current=window.setTimeout(()=>{s.current.insideReactTree=!1}))}}),[Z,p,s,S]);return Ae.useMemo(()=>l?{reference:ce,floating:J}:{},[l,ce,J])}function wO(e){let{open:t=!1,onOpenChange:n,elements:i}=e,r=fO(),s=Ae.useRef({}),[l]=Ae.useState(()=>hO()),u=gO()!=null,[f,p]=Ae.useState(i.reference),c=Go((w,v,S)=>{s.current.openEvent=w?v:void 0,l.emit("openchange",{open:w,event:v,reason:S,nested:u}),n?.(w,v,S)}),m=Ae.useMemo(()=>({setPositionReference:p}),[]),y=Ae.useMemo(()=>({reference:f||i.reference||null,floating:i.floating||null,domReference:i.reference}),[f,i.reference,i.floating]);return Ae.useMemo(()=>({dataRef:s,open:t,onOpenChange:c,elements:y,events:l,floatingId:r,refs:m}),[t,c,y,l,r,m])}function UR(e){e===void 0&&(e={});let{nodeId:t}=e,n=wO({...e,elements:{reference:null,floating:null,...e.elements}}),i=e.rootContext||n,r=i.elements,[s,l]=Ae.useState(null),[u,f]=Ae.useState(null),c=r?.domReference||s,m=Ae.useRef(null),y=HR();lf(()=>{c&&(m.current=c)},[c]);let w=FR({...e,elements:{...r,...u&&{reference:u}}}),v=Ae.useCallback(I=>{let M=yt(I)?{getBoundingClientRect:()=>I.getBoundingClientRect(),getClientRects:()=>I.getClientRects(),contextElement:I}:I;f(M),w.refs.setReference(M)},[w.refs]),S=Ae.useCallback(I=>{(yt(I)||I===null)&&(m.current=I,l(I)),(yt(w.refs.reference.current)||w.refs.reference.current===null||I!==null&&!yt(I))&&w.refs.setReference(I)},[w.refs]),E=Ae.useMemo(()=>({...w.refs,setReference:S,setPositionReference:v,domReference:m}),[w.refs,S,v]),R=Ae.useMemo(()=>({...w.elements,domReference:c}),[w.elements,c]),b=Ae.useMemo(()=>({...w,...i,refs:E,elements:R,nodeId:t}),[w,E,R,t,i]);return lf(()=>{i.dataRef.current.floatingContext=b;let I=y?.nodesRef.current.find(M=>M.id===t);I&&(I.context=b)}),Ae.useMemo(()=>({...w,context:b,refs:E,elements:R}),[w,E,R,b])}function ly(e,t,n){let i=new Map,r=n==="item",s=e;if(r&&e){let{[NR]:l,[zR]:u,...f}=e;s=f}return{...n==="floating"&&{tabIndex:-1,[tO]:""},...s,...t.map(l=>{let u=l?l[n]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((l,u)=>(u&&Object.entries(u).forEach(f=>{let[p,c]=f;if(!(r&&[NR,zR].includes(p)))if(p.indexOf("on")===0){if(i.has(p)||i.set(p,[]),typeof c=="function"){var m;(m=i.get(p))==null||m.push(c),l[p]=function(){for(var y,w=arguments.length,v=new Array(w),S=0;S<w;S++)v[S]=arguments[S];return(y=i.get(p))==null?void 0:y.map(E=>E(...v)).find(E=>E!==void 0)}}}else l[p]=c}),l),{})}}function qR(e){e===void 0&&(e=[]);let t=e.map(u=>u?.reference),n=e.map(u=>u?.floating),i=e.map(u=>u?.item),r=Ae.useCallback(u=>ly(u,e,"reference"),t),s=Ae.useCallback(u=>ly(u,e,"floating"),n),l=Ae.useCallback(u=>ly(u,e,"item"),i);return Ae.useMemo(()=>({getReferenceProps:r,getFloatingProps:s,getItemProps:l}),[r,s,l])}var KR=A(Oo(),1);var Gt=A(Q(),1);var GR=A(Q(),1),pf=A(Q(),1);var QR=A(D(),1),$R=Ei(),Qo=(0,pf.createContext)({emitter:$R});Qo.displayName="Events";function zl(){return GR.default.useContext(Qo).emitter}function bO({emitter:e,children:t}){return(0,QR.jsx)(Qo.Provider,{value:(0,pf.useMemo)(()=>({emitter:e}),[e]),children:t})}var qn=A(D(),1),Dl=Gt.default.createContext({});function Bl(){let e=(0,Gt.useContext)(Dl),t=Object.keys(e),n={};for(let i of t)e[i].Provider&&(n[i]={value:(0,Gt.useContext)(e[i]),Provider:e[i].Provider});return n}function YR(e){let t=Object.keys(e),n=e.children;for(let i of t){if(i==="children")continue;let{value:r,Provider:s}=e[i];n=(0,qn.jsx)(s,{value:r,children:n})}return n}function RO(e){let t=(0,Gt.useContext)(Dl),n=(0,Gt.useMemo)(()=>({...t,...e.providers}),[e.providers]);return(0,qn.jsx)(Dl.Provider,{value:n,children:e.children})}function Vl(){return{VaultContext:(0,Gt.useContext)(Ar),ResourceContext:(0,Gt.useContext)(Oa),SimpleViewerReactContext:(0,Gt.useContext)(_s),VisibleCanvasReactContext:(0,Gt.useContext)(Ro),AuthRContext:(0,Gt.useContext)(Co),SearchReactContext:(0,Gt.useContext)(Ms),ReactEventContext:(0,Gt.useContext)(Qo),ContextBridgeReactContext:(0,Gt.useContext)(Dl),StrategyReactContext:(0,Gt.useContext)(Wr),AtlasStoreReactContext:(0,Gt.useContext)(Fo)}}function jl(e){return(0,qn.jsx)(bo,{vault:e.bridge.VaultContext.vault||void 0,resources:e.bridge.ResourceContext,children:(0,qn.jsx)(Ro.Provider,{value:e.bridge.VisibleCanvasReactContext,children:(0,qn.jsx)(_s.Provider,{value:e.bridge.SimpleViewerReactContext,children:(0,qn.jsx)(Qo.Provider,{value:e.bridge.ReactEventContext,children:(0,qn.jsx)(Fo.Provider,{value:e.bridge.AtlasStoreReactContext,children:(0,qn.jsx)(Co.Provider,{value:e.bridge.AuthRContext,children:(0,qn.jsx)(Ms.Provider,{value:e.bridge.SearchReactContext,children:(0,qn.jsx)(Dl.Provider,{value:e.bridge.ContextBridgeReactContext,children:(0,qn.jsx)(Wr.Provider,{value:e.bridge.StrategyReactContext,children:e.custom?(0,qn.jsx)(YR,{...e.custom,children:e.children}):e.children})})})})})})})})})}var ta=A(D(),1);function mf({annotation:e,target:t,children:n,dismissable:i,isOpen:r,onOpenChange:s,placement:l}){let u=Vl(),f=Bl(),{refs:p,floatingStyles:c,context:m}=UR({open:r,onOpenChange:s,nodeId:e.id,placement:l||"bottom",middleware:[hf(10),sy(),ay({mainAxis:!0})],whileElementsMounted:uf}),y=WR(m),{getReferenceProps:w,getFloatingProps:v}=qR([i?y:null].filter(S=>S!==null));return(0,ta.jsxs)(jn,{relative:!0,target:t,interactive:!1,children:[(0,ta.jsx)("div",{ref:p.setReference,...w(),style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"}}),(0,KR.createPortal)((0,ta.jsx)(jl,{bridge:u,custom:f,children:(0,ta.jsx)("div",{ref:p.setFloating,style:c,...v(),children:n})}),document.getElementById("atlas-floating-ui"))]})}var Hl=A(D(),1),ZR=i0()(e=>({isMenuOpen:!1,menuPosition:{x:0,y:0},setMenuPosition(t){e({menuPosition:t})},toggle(t){e(n=>({isMenuOpen:!n.isMenuOpen,menuPosition:t}))},open(t){e({isMenuOpen:!0,menuPosition:t})},setIsMenuOpen(t){e(typeof t=="function"?n=>({isMenuOpen:t(n.isMenuOpen)}):{isMenuOpen:t})},close(){e({isMenuOpen:!1})}}));function Wl(e,t,n){let{isMenuOpen:i,setIsMenuOpen:r,close:s,open:l,menuPosition:u,setMenuPosition:f,toggle:p}=ZR(),c=(0,XR.useCallback)(w=>{n&&(w.preventDefault(),w.stopPropagation(),p(w.atlas))},[p,n]);return[(0,Hl.jsx)(Hl.Fragment,{children:n&&i&&(0,Hl.jsx)(mf,{dismissable:!0,placement:"bottom-start",isOpen:i,onOpenChange:r,annotation:{id:e},target:{x:u.x,y:u.y,height:1,width:1},children:i&&n({canvasId:t,position:u,close:()=>r(!1)})})}),{onContextMenu:c},{open:l,close:s,toggle:p,isMenuOpen:i,setIsMenuOpen:r,menuPosition:u,setMenuPosition:f}]}function cy(){let e=st();return ve(e,t=>t.tool.requestId&&t.requests[t.tool.requestId]||null)}var an=A(D(),1);function dy({theme:e,renderContextMenu:t,children:n}){let i=st(),r=Ce(),s=ve(i,T=>T.polygon),l=ve(i,T=>T.polygonState.currentTool),u=ve(i,T=>T.mode),f=ve(i,T=>T.changeMode),p=ve(i,T=>T.polygonState.transitioning),{enabled:c,requestId:m}=ve(i,T=>T.tool),y=(0,gf.useMemo)(()=>Br(s),[s]),w=cy(),[v,S]=Wl("editing-annotation",r?.id,t),E=w?.annotationPopup||n||(0,an.jsx)(JR,{}),R=w?.svgTheme||e,b=()=>{f("sketch")};if(!c||!r||!m||!s)return null;let I=y&&s.id&&!p&&(l==="pointer"||l==="hand"||!s.open)?(0,an.jsx)(mf,{annotation:s,target:y,children:E}):null,M="shape";return u==="explore"?(0,an.jsxs)(an.Fragment,{children:[(0,an.jsx)(M,{id:`shape-${s.id}`,points:s.points,open:s.open,onClick:b,relativeStyle:!0,target:{x:0,y:0,width:r.width,height:r.height},style:{":hover":{backgroundColor:"rgba(0,0,0,0.2)"},backgroundColor:"rgba(0,0,0,0)",borderWidth:"4px",borderColor:"rgba(255, 255, 255, .4)"},...S}),(0,an.jsx)(M,{id:`shape-${s.id}`,points:s.points,open:s.open,onClick:b,relativeStyle:!0,target:{x:0,y:0,width:r.width,height:r.height},style:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(0, 0, 0, .4)"}}),I]}):(0,an.jsxs)(an.Fragment,{children:[t?(0,an.jsx)(M,{id:`shape-${s.id}`,points:s.points,open:s.open,target:{x:0,y:0,width:r.width,height:r.height},...S}):null,(0,an.jsx)(eR,{image:r,theme:R}),I,v]})}function JR(){let e=st(),t=ve(e,l=>l.changeMode),n=ve(e,l=>l.mode),i=ve(e,l=>l.completeRequest),r=ve(e,l=>l.tool),s=()=>{(0,gf.startTransition)(()=>{i()})};return r.enabled?(0,an.jsxs)("div",{className:"svg-tools-container animate-fadeIn",children:[n!=="sketch"&&(0,an.jsx)("button",{className:"svg-tools-button",onClick:()=>{t("sketch")},children:"Edit"}),(0,an.jsx)("button",{className:"svg-tools-button",onClick:s,children:"Save"})]}):null}var Zr=A(Q(),1);var na=A(Q(),1);function EO(e){return e.type==="SpecificResource"?[e.source,{selector:e.selector}]:[e,{selector:null}]}function Ul(e,t){let{selector:n,source:i}=Tt(t);if(i.id!==e.id)return[null,i];let r={type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}};return[n?n.type==="TemporalSelector"?{type:"TemporalBoxSelector",temporal:n.temporal,spatial:r.spatial}:n:null,i]}var fy={makeChoice:()=>{}},ql={type:"unknown"},ut=e=>({type:"unknown",reason:e,annotations:{pages:[]}}),hy=(e,t)=>({type:"empty",width:e,height:t,annotations:{pages:[]},image:null,images:[]});var Gl=A(Q(),1);function IO(e,t){let n=e?.iiif?.meta[t];return n?n.annotationPageManager:null}function eE(e,t){return qe(n=>{let i=[];if(!e)return i;let r=Object.keys(n.iiif.entities.AnnotationPage);for(let s of r)if(!t||t.indexOf(s)!==-1){let l=IO(n,s);l&&l.views&&l.views[e]&&i.push(s)}return i},[e,t])}function py({canvas:e,manifest:t,all:n,canvases:i}){let r=[];if(t)for(let s of t.annotations)r.indexOf(s.id)===-1&&r.push(s.id);if(n){if(i&&i.length)for(let s of i)for(let l of s.annotations)r.indexOf(l.id)===-1&&r.push(l.id)}else if(e)for(let s of e.annotations)r.indexOf(s.id)===-1&&r.push(s.id);return r}function CO(e,t){let n=e?.iiif?.meta[t];return n?n.annotationPageManager:null}function $l(e,t={}){let n=ze(),i=It(),r=Ce(),s=Eo(),l=(0,Gl.useMemo)(()=>py({all:t.all,manifest:i,canvas:r,canvases:s}),[t.all,r,s,i]),u=eE(e,t.all?void 0:l),f=(0,Gl.useCallback)(c=>{e&&n.setMetaValue([c,"annotationPageManager","views"],m=>m&&!m[e]?m:{...m||{},[e]:!1})},[e,n]),p=(0,Gl.useCallback)((c,m={})=>{if(!e)return;let y=n.getState(),w=[];if(m?.deselectOthers){let v=Object.keys(y.iiif.entities.AnnotationPage);for(let S of v){let E=CO(y,S);E&&E.views&&E.views[e]&&w.push(S)}}for(let v of w)f(v);n.setMetaValue([c,"annotationPageManager","views"],v=>v&&v[e]?v:{...v||{},[e]:!0})},[e,f,n]);return{availablePageIds:l,enabledPageIds:u,setPageEnabled:p,setPageDisabled:f}}function my(e,t){return qe((n,i)=>i.get(e.map(r=>({id:r,type:t}))),[e,t])}var tE=A(Q(),1);var PO=zn((e,t)=>({loaded:{},setLoaded:(n,i="done")=>{e(r=>({loaded:{...r.loaded,[n]:i}}))}})),AO=Ei();AO.on("loaded",e=>{PO.getState().setLoaded(e.imageServiceId)});function Ql(){let e=Gs(),t=Nb();return[(0,tE.useCallback)((i,{height:r,width:s})=>i&&e(i,{height:r,width:s},!0),[e]),t]}var Ko=A(Q(),1);function Yo(e={}){let t=yl(),n=Ce(e.canvasId?{id:e.canvasId}:void 0);return qe((i,r)=>{if(!n)return[];if(t&&e.enableSingleAnnotation)return[t];let s=r.get(n.items),l=[];for(let u of s)l.push(...r.get(u.items));return l},[n])}function gy(e,t=[]){let n=ze(),i=(0,Ko.useMemo)(()=>xg(n),[]),r=Yo({enableSingleAnnotation:e?.enableSingleAnnotation}),[s,l]=(0,Ko.useState)(e?.defaultChoices||[]),u=(0,Ko.useMemo)(()=>i.getPaintables(r,s),[n,r,s,...t]),p={makeChoice:(0,Ko.useCallback)((c,{deselectOthers:m=!0,deselect:y=!1}={})=>{u.choice&&l(w=>{if(y){let S=w.filter(E=>E!==c);if(S.length===0){let E=u.items[0].resource.id;return E?[E]:[]}return S}if(m)return[c];let v=[...w];if(v.length===0&&u.items.length){let S=u.items[0].resource.id;S&&v.push(S)}return w.indexOf(c)!==-1?w:[...w,c]})},[u.choice])};return[u,p]}var TO=["model/gltf-binary"];function yy(e,t){let n=t.items[0],i=n.resource;return i.format?TO.indexOf(i.format)===-1?ut(`3D format: ${i.format} is unsupported`):{type:"3d-model",model:i,annotationId:n.annotationId,annotation:n.annotation}:ut("Unknown format")}function yf(e,t){let n=t.items,i=n[0];if(n.length===0||!i)return ut("No audio");if(!e.duration)return ut("No duration on canvas");if(n.length>1)return ut("Only one audio source supported");let r=i.resource;return r?("format"in r||(r.format="audio/mpeg"),{type:"media",media:{annotationId:i.annotationId,annotation:i.annotation,duration:e.duration,url:r.id,type:"Sound",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}},format:r.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}}},annotations:{pages:[]}}):ut("Unknown audio")}function Yl(e,t,n){let i=[],r=[];for(let s of t.items){let l=s.resource&&s.resource.type==="SpecificResource"?s.resource.source:s.resource;if(!l.id)return ut("No resource Identifier");let u;if(l.service){let E=Lr(l);E[0]&&(u=n(E[0],e))}let f={type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}},[p,c]=Ul(e,s.target),m=e.id?.split("?")[0]||"";if(!(c.id===e.id||decodeURIComponent(c.id||"")===(e.id||"")||c.id===m||decodeURIComponent(c.id||"")===m))continue;let y=s.resource.width&&s.resource.height?{type:"BoxSelector",spatial:{x:0,y:0,width:s.resource.width,height:s.resource.height}}:void 0,w=s.resource.type==="SpecificResource"?Tt(s.resource):null;if(s.selector){let E=Tt({type:"SpecificResource",source:s.resource,selector:s.selector});E&&(w=E)}let v=w&&w.selector&&(w.selector.type==="BoxSelector"||w.selector.type==="TemporalBoxSelector")?{type:"BoxSelector",spatial:{x:w.selector.spatial.x,y:w.selector.spatial.y,width:w.selector.spatial.width,height:w.selector.spatial.height}}:void 0;u&&!u.id&&(u.id=u["@id"]);let S={id:l.id,type:"Image",annotationId:s.annotationId,annotation:s.annotation,width:Number(p||v?l.width:e.width),height:Number(p||v?l.height:e.height),service:u,sizes:u&&u.sizes?u.sizes:l.width&&l.height?[{width:l.width,height:l.height}]:[],target:p&&p.type!=="PointSelector"?p:f,selector:v||{type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}},annotationPages:s.resource.annotations||[]};i.push(S)}return{type:"images",image:i[0],images:i,choice:t.choice}}function nE(e,t={},n){let i=e.language||n||"none";switch(e.type){case"TextualBody":{typeof e.value<"u"&&(t[i]=[e.value]);break}case"List":case"Composite":case"Choice":e.items&&e.items.forEach(r=>nE(r,t,i))}return t}function Kl(e,t){let n=[];return t.items.forEach(i=>{if(i.resource){let[r]=Ul(e,i.target);n.push({type:"Text",annotationId:i.annotationId,annotation:i.annotation,text:nE(i.resource),target:r})}}),{type:"textual-content",items:n}}var MO=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;function Xl(e,t,n){let i=t.items.filter(w=>w.type==="video"),r=i[0],s=!1;if(e.duration||(s=!0),i.length>1||!r)return ut("Only one video source supported");let l=i[0]?.resource,u=!!(l.service||[]).find(w=>(w.profile||"").includes("youtube.com"));if(!u&&s)return ut("Video does not have duration");if(!l)return ut("Unknown video");if((!l.format||l.format==="text/html")&&!u)return ut("Video does not have format");let f=[],p=n.get(e.annotations||[]);for(let w of p){let v=n.get(w.items||[]);for(let S of v)if((S.motivation?Array.isArray(S.motivation||"")?S.motivation:[S.motivation]:[]).includes("supplementing")){let R=n.get(S.body||[]);for(let b of R){let I=b;if(I.type==="Choice")for(let M of I.items){let T=n.get(M);T.format==="text/vtt"&&f.push({id:T.id,type:"Text",format:"text/vtt",label:T.label,language:T.language})}else I.format==="text/vtt"&&f.push({id:I.id,type:"Text",format:"text/vtt",label:I.label,language:I.language})}}}let c={annotationId:r.annotationId,annotation:r.annotation,duration:e.duration,url:l.id,type:"Video",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}},format:l.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}}},m=Tt(r.target);m.selector&&m.selector.type==="TemporalBoxSelector"&&(c.target=m.selector);let{selector:y}=er(r.selector);if(y===null){let w=c.target.temporal.startTime,S=(c.target.temporal.endTime||e.duration)-w;c.selector={type:"TemporalSelector",temporal:{startTime:0,endTime:S}}}else y.type==="TemporalSelector"&&(c.selector=y);if(u){c.type="VideoYouTube";let w=l.id.match(MO);if(!w[1])return ut("Video is not known youtube video");c.youTubeId=w[1]}return{type:"media",media:c,annotations:{pages:[]},captions:f}}function vy(e,t,n,i){let r={type:"complex-timeline",items:[],keyframes:[],highlights:[],duration:e.duration||0},s={type:"complex-choice",items:[]},l=i.get(e.annotations);function u(c){c.choice&&(c.choice.type==="complex-choice"?s.items.push(...c.choice.items):s.items.push(c.choice))}for(let c of t.items){if(c.type==="image"){let m=Yl(e,{choice:null,allChoices:null,types:["image"],items:[c]},n);if(m.type==="images"){u(m),r.items.push(m.image);let y={id:m.image.annotationId,type:"enter",resourceType:"image",time:m.image.target?.temporal?.startTime||0};r.keyframes.push(y);let w={id:m.image.annotationId,type:"exit",resourceType:"image",time:m.image.target?.temporal?.endTime||e.duration||0};r.keyframes.push(w)}}if(c.type==="textualbody"){let m=Kl(e,{choice:null,allChoices:null,types:["textualbody"],items:[c]});if(m.type==="textual-content"){u(m);let y=m.items[0];r.items.push(y);let w=y.target,v={id:y.annotationId,type:"enter",resourceType:"text",time:w.temporal?.startTime||0};r.keyframes.push(v);let S={id:y.annotationId,type:"exit",resourceType:"text",time:w.temporal?.endTime||e.duration||0};r.keyframes.push(S)}}if(c.type==="video"){let m=Xl(e,{choice:null,allChoices:null,types:["video"],items:[c]},i);if(m.type==="media"){u(m);let y=m.media;r.items.push(y);let w={id:y.annotationId,type:"enter",resourceType:"video",time:y.target?.temporal?.startTime||0};r.keyframes.push(w);let v={id:y.annotationId,type:"exit",resourceType:"video",time:y.target?.temporal?.endTime||e.duration||0};r.keyframes.push(v)}}if(c.type==="audio"||c.type==="sound"){let m=yf(e,{choice:null,allChoices:null,types:["audio"],items:[c]});if(m.type==="media"){u(m);let y=m.media;r.items.push(y);let w={id:y.annotationId,type:"enter",resourceType:"audio",time:y.target?.temporal?.startTime||0};r.keyframes.push(w);let v={id:y.annotationId,type:"exit",resourceType:"audio",time:y.target?.temporal?.endTime||e.duration||0};r.keyframes.push(v)}}}for(let c of l)for(let m of c.items){let y=i.get(m),w=Tt(y.target,{typeMap:i.getState?.().iiif.mapping});if(w.selector?.temporal){let v={id:y.id,type:"enter",resourceType:"highlight",time:w.selector.temporal.startTime||0};r.keyframes.push(v);let S={id:y.id,type:"exit",resourceType:"highlight",time:w.selector.temporal.endTime||e.duration||0};r.keyframes.push(S)}r.highlights.push({annotation:y,target:w})}r.keyframes.sort((c,m)=>c.time-m.time);let f=[],p=[];for(let c of r.keyframes){if(c.resourceType==="image"||c.resourceType==="text"||c.resourceType==="highlight"){p.push(c);continue}if(c.type==="enter"){f.length===0&&(c.isPrime=!0),f.push(c),p.push(c);continue}if(c.type==="exit"&&(p.push(c),f=f.filter(m=>m.id!==c.id),f.length!==0)){let m=f[0],y={id:m.id,type:"change",isPrime:!0,resourceType:m.resourceType,time:c.time};p.push(y)}}return r.keyframes=p,s.items.length&&(r.choice=s),r}var vf={},xy={get(e){return e},setMetaValue([e,t,n],i){let r=xy.getResourceMeta(e,t),s=r?r[n]:void 0,l=typeof i=="function"?i(s):i;vf[e]={...vf[e]||{},[t]:{...(vf[e]||{})[t]||{},[n]:l}}},getResourceMeta:(e,t)=>{let n=vf[e];if(n)return t?n[t]:n},async load(e){let t=typeof e=="string"?e:e.id;return fetch(t).then(n=>n.json())},requestStatus(e){}};function Sy({canvas:e,paintables:t,supports:n,loadImageService:i,vault:r=xy}){if(!e)return ql;if(t.types.length===0)return n.indexOf("empty")!==-1?hy(e.width,e.height):ql;if(t.types.length!==1)if(t.types.length===2&&t.types.indexOf("text")!==-1)t.types=t.types.filter(l=>l!=="text");else return n.indexOf("complex-timeline")===-1?ut("Complex timeline not supported"):vy(e,t,i,r);let s=t.types[0];return s==="image"?n.indexOf("images")===-1?ut("Image not supported"):Yl(e,t,i):s==="Model"||s==="model"?n.indexOf("3d-model")===-1?ut("3D not supported"):yy(e,t):s==="textualbody"?n.indexOf("textual-content")===-1?ut("Textual content not supported"):Kl(e,t):s==="sound"||s==="audio"?n.indexOf("media")===-1?ut("Media not supported"):yf(e,t):s==="video"?n.indexOf("media")===-1?ut("Media not supported"):Xl(e,t,r):ql}function wy(e){let t=It(),n=Ce(),i=ze(),r=zl(),s=e?.emitter||r,[l,u]=Ql(),{enabledPageIds:f}=$l(e?.annotationPageManagerId||t?.id||n?.id,{all:!1}),p=my(f,"AnnotationPage"),c=e?.strategies||["empty","images","media","textual-content","complex-timeline"],[m,y]=gy(e,[u]);(0,na.useEffect)(()=>{let v=S=>{y.makeChoice(S.choiceId,{deselectOthers:S.deselectOthers,deselect:S.deselect})};return s.on("make-choice",v),()=>{s.off("make-choice",v)}},[]);let w=(0,na.useMemo)(()=>Sy({canvas:n,paintables:m,supports:c,loadImageService:l,vault:i}),[n,m,i,y.makeChoice]);return(0,na.useEffect)(()=>{let v=m.allChoices,S={canvasId:n?.id,manifestId:t?.id};v&&s.emit("choice-change",{choice:v,partOf:S})},[n?.id,m.allChoices]),(0,na.useMemo)(()=>w.type==="unknown"?[w,fy]:[{...w,annotations:{pages:p}},y],[w,p])}var by=A(D(),1);function Ry({strategies:e,registerActions:t,defaultChoices:n,onChoiceChange:i,mediaControlsDeps:r,renderMediaControls:s,renderViewerControls:l,viewControlsDeps:u,renderComplexTimelineControls:f,complexTimelineControlsDeps:p,throwOnUnknown:c,children:m}){let y=Ce(),w=ze(),v=(0,Zr.useMemo)(()=>Vr(w),[w]),[S,E]=wy({strategies:e||["images"],defaultChoices:n?.map(({id:M})=>M)}),R="choice"in S?S.choice:void 0;if((0,Zr.useEffect)(()=>{t&&t(E)},[S.annotations]),(0,Zr.useEffect)(()=>{i&&i(R)},[R]),(0,Zr.useEffect)(()=>{if(n)for(let M of n)typeof M.opacity<"u"&&v.applyStyles({id:M.id},"atlas",{opacity:M.opacity})},[n]),S.type==="unknown"&&c)throw new Error(S.reason||"Unknown strategy");let b=(0,Zr.useMemo)(()=>({renderMediaControls:s,mediaControlsDeps:r||[],renderViewerControls:l,viewControlsDeps:u||[],renderComplexTimelineControls:f,complexTimelineControlsDeps:p||[]}),[r,s,l,u,f,p]),I=(0,Zr.useMemo)(()=>({strategy:S,actions:E,choices:"choice"in S?S.choice:[]}),[S,y]);return(0,by.jsx)(bl.Provider,{value:b,children:(0,by.jsx)(Wr.Provider,{value:I,children:m})})}var Zl=A(Q(),1);var ia=A(Q(),1);var Ey=(0,ia.createContext)(()=>{});function iE(e){let t=Ce(),n=(0,ia.useContext)(Ey);(0,ia.useEffect)(()=>t&&t.id?(n(t.id,e),()=>n(t.id,-1)):()=>{},[t,e])}var rE=A(D(),1);function Iy({x:e=0,y:t=0,keepCanvasScale:n=!0,renderContextMenu:i,children:r}){let{strategy:s}=gt(),l=Ce(),u=st(),f=xl(l,["deep-zoom"]),p=ve(u,S=>S.setCanvasRelativePosition),c=ve(u,S=>S.clearCanvasRelativePosition),[m,y]=Wl(`context-menu/${l?.id}`,l?.id,i),w=(0,Zl.useMemo)(()=>n?1:Math.max(1,...s.type==="images"?s.images.map(S=>(S.width||0)/S.target?.spatial.width):[]),[n,s]);(0,Zl.useEffect)(()=>{if(l)return p(l.id,{x:e,y:t,width:l.width,height:l.height}),()=>{c(l.id)}},[e,t,l,c,p]),(0,Zl.useEffect)(()=>{l&&u.getState().reset()},[u,l]),iE(w);let v=s.type==="images"?s.images.length:0;return l?(0,rE.jsxs)("world-object",{height:l.height,width:l.width,scale:w,x:e,y:t,...y,...f,children:[m,r]},`${l.id}/${s.type}/${v}`):null}var yn=A(D(),1);function Vo({x:e,y:t,onChoiceChange:n,registerActions:i,defaultChoices:r,isStatic:s,renderViewerControls:l,renderMediaControls:u,renderComplexTimelineControls:f,complexTimelineControlsDeps:p,viewControlsDeps:c,mediaControlsDeps:m,strategies:y,throwOnUnknown:w,backgroundStyle:v,alwaysShowBackground:S,keepCanvasScale:E=!1,enableSizes:R=!1,enableYouTube:b=!0,onClickPaintingAnnotation:I,components:M={},children:T,annotationPopup:_,svgTheme:U,renderContextMenu:H,renderAnnotationContextMenu:Z}){return(0,yn.jsxs)(Ry,{throwOnUnknown:w,onChoiceChange:n,registerActions:i,strategies:y,defaultChoices:r,mediaControlsDeps:m,renderMediaControls:u,renderViewerControls:l,renderComplexTimelineControls:f,complexTimelineControlsDeps:p,viewControlsDeps:c,children:[(0,yn.jsxs)(Iy,{keepCanvasScale:E,x:e,y:t,renderContextMenu:H,children:[(0,yn.jsx)(Vg,{alwaysShowBackground:S,backgroundStyle:v}),(0,yn.jsx)(Bg,{}),(0,yn.jsx)(Hg,{}),(0,yn.jsx)(jg,{isStatic:s,enableSizes:R,onClickPaintingAnnotation:I}),(0,yn.jsx)(Mg,{}),(0,yn.jsx)(Eg,{}),(0,yn.jsx)(kg,{as:M.Audio}),(0,yn.jsx)(Ug,{as:M.Video}),b?(0,yn.jsx)(qg,{}):null,(0,yn.jsx)(dy,{theme:U,renderContextMenu:Z,children:_}),T]}),(0,yn.jsx)(Ig,{})]})}var Cy=A(D(),1);function oE(e){let t=Ce();return!t||!t.placeholderCanvas?null:(0,Cy.jsx)(ni,{canvas:t.placeholderCanvas.id,children:(0,Cy.jsx)(Vo,{renderViewerControls:e.renderViewerControls})})}var vn=A(Q(),1);var Gn=A(Q()),_O=(0,Gn.createContext)(null),Py={didCatch:!1,error:null},ra=class extends Gn.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Py}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){let{error:t}=this.state;if(t!==null){for(var n,i,r=arguments.length,s=new Array(r),l=0;l<r;l++)s[l]=arguments[l];(n=(i=this.props).onReset)===null||n===void 0||n.call(i,{args:s,reason:"imperative-api"}),this.setState(Py)}}componentDidCatch(t,n){var i,r;(i=(r=this.props).onError)===null||i===void 0||i.call(r,t,n)}componentDidUpdate(t,n){let{didCatch:i}=this.state,{resetKeys:r}=this.props;if(i&&n.error!==null&&OO(t.resetKeys,r)){var s,l;(s=(l=this.props).onReset)===null||s===void 0||s.call(l,{next:r,prev:t.resetKeys,reason:"keys"}),this.setState(Py)}}render(){let{children:t,fallbackRender:n,FallbackComponent:i,fallback:r}=this.props,{didCatch:s,error:l}=this.state,u=t;if(s){let f={error:l,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")u=n(f);else if(i)u=(0,Gn.createElement)(i,f);else if(r===null||(0,Gn.isValidElement)(r))u=r;else throw l}return(0,Gn.createElement)(_O.Provider,{value:{didCatch:s,error:l,resetErrorBoundary:this.resetErrorBoundary}},u)}};function OO(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,i)=>!Object.is(n,t[i]))}var xf=A(Q(),1);function sE(e,t=2e3){let{currentSequenceIndex:n,sequence:i,items:r}=Po(),s=Ce(),l=(0,xf.useMemo)(()=>{let f=i[n]||[];return f.length===0&&s?[{id:s.id,type:"Canvas"}]:f.map(p=>r[p])},[i,n,s,r]),u=st();(0,xf.useEffect)(()=>{let p=setInterval(()=>{if(e&&t!==-1){let c={x:e.x,y:e.y,width:e.width,height:e.height},m=u.getState().canvasRelativePositions,y={};for(let w of l){let v=m[w.id];if(v){let S=v.x,E=v.y,R=v.width,b=v.height,I={x:Math.max(S,c.x),y:Math.max(E,c.y),width:Math.min(S+R,c.x+c.width)-Math.max(S,c.x),height:Math.min(E+b,c.y+c.height)-Math.max(E,c.y)};I.width<=0||I.height<=0||(y[w.id]={x:I.x-v.x,y:I.y-v.y,width:I.width,height:I.height}),u.setState({canvasViewports:y})}}}},t);return()=>{clearTimeout(p)}},[l,e,u,t])}var oa=A(D(),1);function Sf({width:e,style:t,height:n,error:i,resetErrorBoundary:r}){return(0,oa.jsxs)("div",{style:{width:e,height:n,minHeight:500,...t||{},background:"#f9f9f9"},children:[(0,oa.jsx)("h3",{children:"Error occurred"}),(0,oa.jsx)("p",{children:i.message}),(0,oa.jsx)("button",{type:"button",onClick:r,children:"Reset"})]})}var vt=A(D(),1);function wf(e){let t=st();return(0,vt.jsx)(Ws,{name:e.name,existing:t,children:(0,vt.jsx)(kO,{...e})})}function kO({name:e,children:t,errorFallback:n,outerContainerProps:i={},worldScale:r,updateViewportTimeout:s,...l}){let u=st(),f=ve(u,K=>K.mode),p=ve(u,K=>K.setAtlasRuntime),[c,m]=(0,vn.useState)(),y=Bl(),w=Vl(),v=n||Sf,[S,E]=(0,vn.useState)({}),R=Object.entries(S),[b,I]=(0,vn.useState)({}),M=Object.entries(b),[T,_]=(0,vn.useState)({}),U=(0,vn.useMemo)(()=>r||Math.max(...Object.values(T)),[T]),H=(0,vn.useMemo)(()=>({maxOverZoom:U||1,...l.runtimeOptions||{}}),[U,l.runtimeOptions]);sE(c?.runtime,s);let Z=(0,vn.useCallback)((K,ce)=>{_(J=>{if(ce===-1){let{[K]:te,...oe}=J;return oe}return{...J,[K]:ce}})},[]),B=(0,vn.useCallback)((K,ce,J)=>{E(({[K]:te,...oe})=>ce?{...oe,[K]:{element:ce,props:J}}:oe)},[]),G=(0,vn.useCallback)((K,ce,J)=>{I(({[K]:te,...oe})=>ce?{...oe,[K]:{element:ce,props:J}}:oe)},[]);return(0,vt.jsxs)(ra,{resetKeys:[],fallbackRender:K=>(0,vt.jsx)(v,{...l,...K}),children:[(0,vt.jsx)(O1,{...l,mode:f,containerProps:{style:{position:"relative"},...l.containerProps||{}},htmlChildren:(0,vt.jsx)(vt.Fragment,{children:R.map(([K,{element:ce,props:J}])=>(0,vt.jsx)(vn.default.Fragment,{children:(0,vt.jsx)(ce,{...J||{}})},K))}),onCreated:K=>{m(K),p(K.runtime),l.onCreated&&l.onCreated(K)},runtimeOptions:H,children:(0,vt.jsx)(Ws,{name:e,existing:u,children:(0,vt.jsx)(Pi.Provider,{value:c,children:(0,vt.jsx)(Ey.Provider,{value:Z,children:(0,vt.jsx)(Sg.Provider,{value:B,children:(0,vt.jsx)(wg.Provider,{value:G,children:(0,vt.jsx)(jl,{bridge:w,custom:y,children:(0,vt.jsx)(Tg,{children:t})})})})})})})}),(0,vt.jsx)("div",{children:M.map(([K,{element:ce,props:J}])=>(0,vt.jsx)(vn.default.Fragment,{children:(0,vt.jsx)(ce,{...J||{}})},K))}),(0,vt.jsx)("div",{id:"atlas-floating-ui",style:{position:"relative",zIndex:999999}})]})}var ln=A(D(),1),LO=(0,Xo.forwardRef)(function(t,n){let i=It(),r=Eo(),s=Po(),{ViewerControls:l,MediaControls:u,ComplexTimelineControls:f}=t.components||{};if((0,Xo.useImperativeHandle)(n,()=>s,[s]),!i)return(0,ln.jsx)("div",{});let p=0,c=i.viewingDirection==="top-to-bottom",m=i.viewingDirection==="bottom-to-top",y=i.viewingDirection==="left-to-right",w=i.viewingDirection==="right-to-left",S=i.behavior.includes("continuous")?0:t.spacing||0,E=m||w,R=(0,Xo.useMemo)(()=>E?[...r].reverse():r,[r,E]);return(0,ln.jsxs)(ln.Fragment,{children:[t.header,(0,ln.jsx)(jt.Viewer,{height:t.height,mode:t.mode,renderPreset:t.renderPreset,runtimeOptions:t.runtimeOptions,updateViewportTimeout:t.updateViewportTimeout,children:R.map((b,I)=>{let M=0,T=0;return c?(M=p,p+=b.width+S):(T=p,p+=b.height+S),(0,ln.jsx)(ni,{canvas:b.id,children:(0,ln.jsx)(jt.RenderCanvas,{strategies:["3d-model","media","images","empty","textual-content","complex-timeline"],renderViewerControls:I===0&&l?()=>(0,ln.jsx)(l,{}):void 0,renderMediaControls:I===0&&u?()=>(0,ln.jsx)(u,{}):void 0,annotationPopup:t.annotationPopup,renderContextMenu:t.renderContextMenu,keepCanvasScale:t.keepCanvasScale,renderComplexTimelineControls:I===0&&f?()=>(0,ln.jsx)(f,{}):void 0,renderAnnotationContextMenu:t.renderAnnotationContextMenu,x:M,y:T,svgTheme:t.svgTheme,...t.canvasProps||{},children:t.annotations},b.id)},b.id)})},t.reuseAtlas?"":s.currentSequenceIndex),t.children]})}),jt=(0,Xo.forwardRef)(function({children:t,height:n,annotations:i,canvasProps:r,spacing:s,header:l,components:u,mode:f,reuseAtlas:p,renderPreset:c,runtimeOptions:m,annotationPopup:y,name:w,svgTheme:v,updateViewportTimeout:S,renderContextMenu:E,keepCanvasScale:R,renderAnnotationContextMenu:b,...I},M){let T=Io();return(0,ln.jsx)(Ws,{name:w,children:(0,ln.jsx)(bo,{vault:T,children:(0,ln.jsx)(vm,{...I,children:(0,ln.jsx)(LO,{ref:M,height:n,components:u,spacing:s,canvasProps:r,annotations:i,header:l,mode:f,reuseAtlas:p,renderPreset:c,runtimeOptions:m,annotationPopup:y,svgTheme:v,updateViewportTimeout:S,renderContextMenu:E,keepCanvasScale:R,renderAnnotationContextMenu:b,children:t})})})})});jt.RenderImage=$r;jt.RenderCanvas=Vo;jt.RenderAnnotationPage=jr;jt.RenderAnnotation=zo;jt.Viewer=wf;jt.CanvasBackground=Xd;jt.Audio=zd;jt.Video=Jd;jt.Model=Vd;jt.AudioHTML=bg;jt.VideoHTML=Wg;jt.ModelHTML=Rg;jt.PlaceholderCanvas=oE;jt.getAtlasStoreByName=fg;var aE=A(Q(),1);var li=A(Q(),1);function Ay(e){let[t,n]=(0,li.useState)(0),i=st(),r=ve(i,T=>T.tool.enabled),s=ve(i,T=>T.tool.requestId),l=ve(i,T=>T.getRequestId),u=ve(i,T=>T.requestAnnotation),f=ve(i,T=>T.completeRequest),p=ve(i,T=>T.cancelRequest),c=(0,li.useRef)(e?.onSuccess);c.current=e?.onSuccess;let[m,y]=(0,li.useState)(!1),[w,v]=(0,li.useState)(null),[S,E]=(0,li.useState)(null),R=r&&s!==S,b=r&&s===S,I=(0,li.useCallback)(async(T,_)=>{if(S){let U=c.current;y(!0);let H=await u(T,{..._,requestId:S});if(H)return U?.(H),n(B=>B+1),y(!1),v(H),H;let Z={id:S,cancelled:!0,...ml(T)};return U?.(Z),v(Z),n(B=>B+1),y(!1),Z}return null},[u,S]),M=(0,li.useCallback)(()=>{v(null),y(!1)},[]);return(0,li.useEffect)(()=>{let T=l();return E(T.requestId),()=>{T.clear()}},[t]),{id:t,busy:R,isPending:m,isActive:b,requestId:S,requestAnnotation:I,cancelRequest:()=>S?p(S):void 0,completeRequest:()=>S?f(S):void 0,reset:M,data:w}}var FO=[{name:"Default",outer:{borderWidth:4,borderColor:"rgba(255, 255, 255, .4)"},inner:{borderWidth:2,borderColor:"#000"}},{name:"High contrast",outer:{borderWidth:3,borderColor:"#fff"},inner:{borderWidth:1,borderColor:"#000"}},{name:"Lightsaber",outer:{borderWidth:"4",borderColor:"rgba(56,68,255,0.64)"},inner:{borderWidth:"2",borderColor:"#fff"}},{name:"Bright",outer:{borderWidth:"6",borderColor:"#25d527"},inner:{borderWidth:"3",borderColor:"#a916ff"}},{name:"pink",outer:{borderWidth:"4",borderColor:"#ff00ff"},inner:{borderWidth:"2",borderColor:"#ffffff"}},{name:"fine (dark)",outer:{borderWidth:"1",borderColor:"#000000"},inner:{}},{name:"fine (light)",outer:{borderWidth:"1",borderColor:"#FFF"},inner:{}}];function Ty(e){let{id:t,data:n,requestAnnotation:i,cancelRequest:r,isPending:s}=Ay({onSuccess:l=>{e.updateShape(l.polygon)}});return(0,aE.useEffect)(()=>(i({type:"polygon",open:e.shape?.open,points:e.shape?.points}),()=>{r()}),[]),null}var Xt=A(Q(),1);var lE=A(D(),1),bf=(0,Xt.createContext)(Ei());bf.displayName="SelectorHelper";function NO({children:e}){return(0,lE.jsx)(bf.Provider,{value:(0,Xt.useMemo)(()=>Ei(),[]),children:e})}function zO(){return(0,Xt.useContext)(bf)}function My(e){let t=_y(),[n,i]=(0,Xt.useState)(!1);(0,Xt.useEffect)(()=>t.withSelector(e).on("highlight",()=>{i(!0)}),[t,e]),(0,Xt.useEffect)(()=>t.withSelector(e).on("clear-highlight",()=>{i(!1)}),[t,e]);let r=(0,Xt.useCallback)(l=>{t.emit("click",{selectorId:e,event:l})},[e,t]),s=(0,Xt.useCallback)(l=>{t.emit("hover",{selectorId:e,event:l})},[e,t]);return{controller:t,onClick:r,onHover:s,isHighlighted:n}}function _y(){let e=(0,Xt.useContext)(bf);return(0,Xt.useMemo)(()=>({withSelector(t){return{on(n,i){let r=s=>{s&&s.selectorId===t&&i(s)};return e.on(n,r),()=>{e.off(n,r)}},emit(n,i){e.emit(n,{...i,selectorId:t})}}},on(t,n){return e.on(t,n),()=>{e.off(t,n)}},emit(t,n){e.emit(t,n)}}),[e])}function DO(){let e=_y();return(0,Xt.useMemo)(()=>({withSelector(t){return{highlight(){e.emit("highlight",{selectorId:t})},clearHighlight(){e.emit("clear-highlight",{selectorId:t})},zoomTo(){e.emit("zoom-to",{selectorId:t})},addEventListener(n,i){return e.emit("event-listener",{selectorId:t,name:n,callback:i}),()=>{e.emit("remove-event-listener",{selectorId:t,name:n,callback:i})}},getImagePreview(){return new Promise((n,i)=>{e.emit("image-preview-request",{selectorId:t,resolve:n,reject:i})})},on(n,i){return e.withSelector(t).on(n,i)}}},highlight(t){e.emit("highlight",{selectorId:t})},clearHighlight(t){e.emit("clear-highlight",{selectorId:t})},zoomTo(t){e.emit("zoom-to",{selectorId:t})},addEventListener(t,n,i){return e.emit("event-listener",{selectorId:t,name:n,callback:i}),()=>{e.emit("remove-event-listener",{selectorId:t,name:n,callback:i})}},getImagePreview(t){return new Promise((n,i)=>{e.emit("image-preview-request",{selectorId:t,resolve:n,reject:i})})},on(t,n){return e.on(t,n)}}),[e])}var Oy=A(D(),1);function BO(e){let t=Ce(),n=e.annotationBucket,i=e.readOnly,r=e.id,{onClick:s,isHighlighted:l}=My(e.id),u=gl(),f=l?u.highlighted:u[n||"hidden"]||u.hidden;if(!t)return null;if(i){let p="shape",c=e.polygon,m=c.open;return c?(0,Oy.jsx)(p,{id:`shape-${r}`,points:c.points,open:m,onClick:s,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:f}):null}return(0,Oy.jsx)(Ty,{image:t,shape:e.polygon||{id:e.id,open:!0,points:[]},updateShape:e.updatePolygon,theme:e.theme,controlsHtmlId:e.controlsHtmlId,renderControls:e.renderControls})}var Rf=A(Q(),1),Jl=A(D(),1),VO=(0,Rf.forwardRef)(function({canvasId:t},n){let i=Pd(),r=$l(t||i?.id),s=ze();return(0,Rf.useImperativeHandle)(n,()=>r,[t,i]),!i||r.enabledPageIds.length===0?null:(0,Jl.jsx)(Jl.Fragment,{children:r.enabledPageIds.map(l=>(0,Jl.jsx)(jt.RenderAnnotationPage,{page:s.get(l)},l))})});var cE=A(Q(),1);var uE=A(Q(),1);var kt=A(D(),1);function eu({metadata:e=[],config:t,labelWidth:n=16,showEmptyMessage:i=!0,allowHtml:r,emptyFallback:s,classes:l={},emptyMessage:u="No metadata available",emptyValueFallback:f="No value",emptyLabelFallback:p="",separator:c,tableFooter:m,tableHeader:y}){let w=(0,uE.useMemo)(()=>{let S=(t||[]).reduce((R,b)=>[...R,...b.keys],[]),E={};for(let R of e){let b=R&&R.label?Object.values(R.label):[];for(let I of b)if(I&&I.length&&(S.indexOf(`metadata.${I[0]}`)!==-1||S.length===0)&&R){let M=`metadata.${I[0]}`;E[M]=E[M]?E[M]:[],E[M].push(R);break}}return E},[t,e]);return Object.keys(w).length===0&&i?(0,kt.jsx)(kt.Fragment,{children:s})||(0,kt.jsx)("div",{className:l.empty,children:u}):t&&t.length?(0,kt.jsxs)("table",{className:l.container,children:[y,(0,kt.jsx)("tbody",{children:t.map((S,E)=>{let R=[];for(let b of S.keys)for(let I of w[b]||[])R.push((0,kt.jsx)(Wn,{enableDangerouslySetInnerHTML:r,defaultText:f,separator:c,children:I.value},E+"__"+b));return R.length===0?null:(0,kt.jsxs)("tr",{className:l.row,children:[(0,kt.jsx)("td",{className:l.label,style:n?{minWidth:n}:{},children:(0,kt.jsx)(Wn,{enableDangerouslySetInnerHTML:r,separator:c,defaultText:p,children:S.label})}),(0,kt.jsx)("td",{className:l.value,children:R})]},E)})}),m]}):(0,kt.jsxs)("table",{className:l.container,children:[y,(0,kt.jsx)("tbody",{children:e&&e.length?e.map((S,E)=>S?(0,kt.jsxs)("tr",{className:l.row,children:[(0,kt.jsx)("td",{className:l.label,style:n?{minWidth:n}:{},children:(0,kt.jsx)(Wn,{enableDangerouslySetInnerHTML:r,defaultText:f,separator:c,children:S.label})}),(0,kt.jsx)("td",{className:l.value,children:(0,kt.jsx)(Wn,{enableDangerouslySetInnerHTML:r,defaultText:f,separator:c,children:S.value})})]},E):null):null}),m]})}var dE=A(D(),1);function jO(e){let t=It(),n=Ce(),i=qa(),r=(0,cE.useMemo)(()=>{let s=t?.metadata||[],l=n?.metadata||[],u=i?.metadata||[];return[...s,...l,...u]},[t,n,i]);return(0,dE.jsx)(eu,{metadata:r,...e})}var If=A(Q(),1);var fE=A(Q(),1);function Ef(e,t={},n=[]){return(0,fE.useMemo)(()=>{if(!e)return null;let i=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(i="default"));let r=Xc(e);return Kc({identifier:r.identifier,server:r.server,scheme:r.scheme,type:"image",size:{max:!t.size?.width&&!t.size?.height,confined:!1,upscaled:!1,...t.size||{}},format:t.format||"jpg",region:t.region||{full:!0},rotation:t?.rotation?Number.isInteger(t.rotation)?{angle:t.rotation}:t.rotation:{angle:0},quality:i||"default",prefix:r.prefix,originalPath:r.originalPath})},[...n])}var tu=A(D(),1);function HO(e){let t=typeof e.src=="string"?e.src:e.src.id,n=Rl(),[i,r]=(0,If.useState)(!1),s;if(t){let u=n.loadServiceSync({id:t});u&&(s=u)}!s&&!i&&n.loadService({id:t}).then(()=>{r(!0)});let l=Ef(s,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[i,e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return(0,If.useEffect)(()=>()=>{r(!1)},[t]),l?(0,tu.jsx)("img",{src:l,alt:e.alt,className:e.className,style:e.style}):(0,tu.jsx)(hE,{...e,fetchImageService:!1})}function hE(e){if(e.fetchImageService)return(0,tu.jsx)(HO,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,n=Ef(t,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return n?(0,tu.jsx)("img",{src:n,alt:e.alt,className:e.className,style:e.style}):null}var Cf=A(Q(),1);var Jr=A(D(),1);function WO({src:e,errorFallback:t,interactive:n,skipSizes:i,children:r,renderViewerControls:s,viewControlsDeps:l,fluid:u,x:f,y:p,...c}){let[m,y]=(0,Cf.useState)(),w=t||Sf,[v,S]=Ql(),E=(0,Cf.useMemo)(()=>{let b=S[e]?.status,I=v({id:e},{});return I?.height&&I.width&&b!=="loading"?{id:e,width:I.width,height:I.height,service:I,type:"Image",selector:{type:"BoxSelector",spatial:{x:0,y:0,width:I.width,height:I.height}},target:{type:"BoxSelector",spatial:{x:0,y:0,width:I.width,height:I.height}}}:null},[v,e,S]);if(!E||!E.height||!E.width)return null;let R=u?void 0:c.homePosition?c.homePosition.width/c.homePosition.height:E.width/E.height;return(0,Jr.jsx)(ra,{resetKeys:[],fallbackRender:b=>(0,Jr.jsx)(w,{...c,...b}),children:(0,Jr.jsx)(wf,{...c,aspectRatio:R,containerProps:{style:{position:"relative"},...c.containerProps||{}},onCreated:b=>{y(b),c.onCreated&&c.onCreated(b)},children:(0,Jr.jsxs)(Pi.Provider,{value:m,children:[(0,Jr.jsx)($r,{image:E,id:E.id,isStatic:!n,x:f,y:p},E.id),(0,Jr.jsx)(UO,{viewerPreset:m,renderViewerControls:s,image:E,src:e,viewControlsDeps:l}),r]})})})}function UO({viewerPreset:e,renderViewerControls:t,image:n,src:i,viewControlsDeps:r}){return Kt(e&&t?"overlay":"none",`canvas-portal-controls-${i}`,Pi.Provider,t&&n?{value:e||null,children:t({image:n,images:[n],type:"images"})}:{},[i,e,...r||[]]),null}var pE=A(D(),1);function qO(e){let t=It();return(0,pE.jsx)(eu,{metadata:t?.metadata||[],...e})}var Pf=A(Q(),1);var ky=A(gE(),1);var On=A(D(),1),{LazyLoadComponent:GO}=ky||ky.default;function Ly(e){let{size:t,visible:n,classes:i,canvasId:r,figure:s}=e,l=t?.width||128,u=t?.height||t?.width||128,f=(0,On.jsx)($O,{...e}),p=(0,On.jsx)(GO,{threshold:300,style:{height:u,width:l},visibleByDefault:n,children:r?(0,On.jsx)(ni,{canvas:r,children:f}):f});return s?(0,On.jsx)("figure",{className:i?.figure,children:p}):p}function $O({fallback:e,size:t,classes:n,showLabel:i,alt:r,dereference:s=!1}){let l=Ce(),u=t?.width||128,f=t?.height||t?.width||128,p=r||Fd(l?.label)||"",c=lr({width:u,height:f,allowUnsafe:!0},s);return!c||c.type!=="fixed"?(0,On.jsx)(On.Fragment,{children:e}):(0,On.jsxs)(On.Fragment,{children:[(0,On.jsx)("div",{className:n?.imageWrapper,children:(0,On.jsx)("img",{className:n?.img,src:c.id,alt:p})}),i?(0,On.jsx)(Wn,{as:"figcaption",className:n?.label,children:l?.label}):null]})}var sa=A(D(),1);function QO({scrollBehaviour:e,dereference:t,flat:n,size:i,classes:r={},showLabel:s,figure:l,fallback:u}){let f=(0,Pf.useRef)(null),{items:p,sequence:c,currentSequenceIndex:m,setSequenceIndex:y}=Po(),w={row:r.selected?.row||r.row,item:r.selected?.item||r.item,figure:r.selected?.figure||r.figure,img:r.selected?.img||r.img,label:r.selected?.label||r.label,imageWrapper:r.selected?.imageWrapper||r.imageWrapper};(0,Pf.useLayoutEffect)(()=>{if(!f.current)return;let S=f.current.querySelector("[data-selected=true]");S&&S.scrollIntoView({behavior:e||"instant",block:"nearest",inline:"center"})},[m]);let v=[];for(let S of c){let E=[],R=c[m]===S;for(let b of S){let I=p[b];E.push((0,sa.jsx)("div",{className:R?w.item:r.item,children:(0,sa.jsx)(Ly,{classes:R?w:r,canvasId:I.id,size:i,dereference:t,showLabel:s,figure:l,placeholder:(0,sa.jsx)("div",{style:{height:128,width:128}}),fallback:u})},b))}if(n){v.push(E);continue}v.push((0,sa.jsx)("div",{onClick:b=>{y(c.indexOf(S))},"data-selected":R,className:R?w.row:r.row,children:E},S.join("-")))}return(0,sa.jsx)("div",{ref:f,className:r.container,children:v})}function Fy(){let e=st(),t=ve(e,s=>s.completeRequest),n=ve(e,s=>s.polygonState.currentTool),i=ve(e,s=>s.polygonState.selectedStamp),r=ve(e,s=>s.switchTool);return{completeRequest:t,currentTool:n,selectedStamp:i,switchTool:r}}var $t=A(D(),1),YO={draw:!0,polygon:!0,line:!0,lineBox:!0,box:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0,pen:!0};function KO({showShapes:e=!0,enabled:t=YO,classNames:n={},icons:i={}}){let{currentTool:r,switchTool:s,selectedStamp:l}=Fy();return(0,$t.jsxs)($t.Fragment,{children:[r,(0,$t.jsx)("button",{className:n.button,onClick:s.pointer,"data-active":r==="pointer",children:i.PointerIcon||"Pointer"}),(0,$t.jsx)("button",{className:n.button,onClick:s.hand,"data-active":r==="hand",children:i.HandIcon||"Hand"}),e?(0,$t.jsxs)($t.Fragment,{children:[t.box&&(0,$t.jsx)("button",{className:n.button,onClick:s.box,"data-active":r==="box",children:i.BoxIcon||"Box"}),t.pen&&(0,$t.jsx)("button",{className:n.button,onClick:s.pen,"data-active":r==="pen",children:i.PenIcon||"Pen"}),t.draw&&(0,$t.jsx)("button",{className:n.button,onClick:s.draw,"data-active":r==="pencil",children:i.DrawIcon||"Draw"}),t.line&&(0,$t.jsx)("button",{className:n.button,onClick:s.line,"data-active":r==="line",children:i.LineIcon||"Line"}),t.lineBox&&(0,$t.jsx)("button",{className:n.button,onClick:s.lineBox,"data-active":r==="lineBox",children:i.LineBoxIcon||"LineBox"}),t.triangle&&(0,$t.jsx)("button",{className:n.button,onClick:s.triangle,"data-active":r==="stamp"&&l?.id==="triangle",children:i.TriangleIcon||"Triangle"}),t.hexagon&&(0,$t.jsx)("button",{className:n.button,onClick:s.hexagon,"data-active":r==="stamp"&&l?.id==="hexagon",children:i.HexagonIcon||"Hexagon"}),t.circle&&(0,$t.jsx)("button",{className:n.button,"data-active":r==="stamp"&&l?.id==="circle",onClick:s.circle,children:i.CircleIcon||"Circle"})]}):null,t.delete&&(0,$t.jsx)("button",{className:n.button,onClick:s.remove,children:i.DeleteForeverIcon||"Delete"})]})}var yE=A(D(),1);function XO({annotation:e,children:t}){return(0,yE.jsx)(dn,{value:{annotation:e},children:t})}var vE=A(D(),1);function ZO({annotationPage:e,children:t}){return(0,vE.jsx)(dn,{value:{annotationPage:e},children:t})}var xE=A(D(),1);function JO({collection:e,children:t}){return(0,xE.jsx)(dn,{value:{collection:e},children:t})}function ek(e,t={}){return Yo(t)}var eo=A(Q(),1);function tk({canvasId:e}={}){let t=Pd(),n=Eo(),i=(0,eo.useMemo)(()=>e?[e]:t?[t.id]:n.map(p=>p.id),[e,t,n]),[r,s]=(0,eo.useState)({}),l=zl();(0,eo.useEffect)(()=>{let p=c=>{let m=c.partOf.canvasId;m&&s(y=>({...y,[m]:c.choice}))};return l.on("choice-change",p),()=>{l.off("choice-change",p)}},[]);let u=(0,eo.useMemo)(()=>{let p=[];for(let c of i){let m=r[c];m&&p.push({canvasId:c,choice:m})}return p},[i,r]),f=(0,eo.useMemo)(()=>({makeChoice:(p,c)=>{l.emit("make-choice",{choiceId:p,...c})}}),[l]);return{choices:u,actions:f}}function nk(e,t=!1){}function ik(e){let n=rn().manifest,i=e?e.map(r=>typeof r=="string"?r:r?.id):[];return qe(r=>{let s=n?r.iiif.entities.Manifest[n]:void 0,l=s?.items||[];if(typeof e>"u")return l;let u=[];for(let f of s?.items||[])i.indexOf(f.id)!==-1&&u.push(f);return u},[i.join("/")])}var SE=A(Q(),1);function rk(e,t=[]){let{id:n,selector:i}=e,r=rn(),s=n||r.collection,l=qe(u=>s?u.iiif.entities.Collection[s]:void 0,[s]);return(0,SE.useMemo)(()=>{if(l)return i?i(l):l},[l,i,...t])}var Af=A(Q(),1);function ok(){let e=st(),t=ve(e,i=>i.completeRequest),n=ve(e,i=>i.cancelRequest);return(0,Af.useMemo)(()=>({saveAnnotation:()=>{(0,Af.startTransition)(()=>{t()})},cancelRequest:n}),[t,n])}var wE=A(Q(),1);function sk({requestId:e}={}){let t=st(),n=ve(t,u=>u.metadata),i=ve(t,u=>u.tool.requestId),r=e||i,s=ve(t,u=>u.setMetadata),l=(0,wE.useCallback)(u=>s(u,r||void 0),[s,r]);return[r?n[r]||{}:{},l]}function ak(e){let t=st(),n=ve(t,i=>i.tool.requestId);Lo("polygons.start-transition",i=>{e.requestId&&n!==e.requestId||e?.onStart?.(i.transitionIntent)},[n,e.requestId]),Lo("polygons.end-transition",i=>{e.requestId&&n!==e.requestId||e?.onEnd?.(i.transitionIntent,i.response)},[n,e.requestId]),Lo("polygons.transition",i=>{e.requestId&&n!==e.requestId||e?.onTransition?.(i.transitionIntent)},[n,e.requestId])}var Tf=A(Q(),1);function lk(e,t,n,i,r=[]){let s=ze(),l=(0,Tf.useMemo)(()=>vl(s),[s]);(0,Tf.useEffect)(()=>{let u=e;return u?(l.addEventListener(u,t,n,i),()=>{l.removeEventListener(u,t,n)}):()=>{}},[l,e,t,...r])}function uk(e,t){let{id:n,isLoaded:i,error:r,resource:s,requestId:l,cached:u}=Ua(e,t);return{id:n,isLoaded:i,error:r,manifest:s,requestId:l,cached:u}}var Gi=A(Q(),1);function Ny({cacheKey:e}={}){let t=Ce(),n=Yo(),i=ze(),r=Gs(),s=zb(),[l,u]=(0,Gi.useState)(void 0),[f,p]=(0,Gi.useState)(!1),[c,m]=(0,Gi.useState)("idle"),[y,w]=(0,Gi.useState)(void 0),v=t?t.id:"undefined",S=(0,Gi.useMemo)(()=>{try{if(t&&n.length){let R=n[0],b=i.get(R.body[0]),M=Lr(b)[0];return M&&r(M,{width:M.width||t.width,height:M.height||t.height},!0)||void 0}}catch(R){console.error(R)}},[v,e,t]),E=c==="success"&&l?l:S;return(0,Gi.useEffect)(()=>{(async()=>{try{if(t&&n.length){let R=n[0],b=i.get(R.body[0]),M=Lr(b)[0];if(!M)return;p(!0),m("loading");try{let T=await s(M,{width:M.width||t.width,height:M.height||t.height})||void 0;u(T),m("success"),p(!1)}catch(T){m("error"),w(T)}}}catch(R){m("error"),w(R)}})()},[v,e]),(0,Gi.useMemo)(()=>({data:E,isFetching:f,status:c,error:y}),[E,f,c,y])}function ck(){let e=Ny();return{isLoading:e.isFetching,tile:e.data?{id:e.data.id||e.data["@id"],width:e.data.width,height:e.data.height,imageService:e.data,thumbnail:void 0}:null}}var bE=A(Q(),1);function dk(){let e=ze();return(0,bE.useMemo)(()=>Vr(e),[e])}function fk(e,t){let{x:n,y:i,width:r,height:s}=e,{x:l,y:u}=t,{width:f,height:p}=t;return n+r>l&&n<l+f&&i+s>u&&i<u+p}var hk=!0,zy="Invariant failed";function RE(e,t){if(!e){if(hk)throw new Error(zy);var n=typeof t=="function"?t():t,i=n?"".concat(zy,": ").concat(n):zy;throw new Error(i)}}function pk(e,t){let n=e.boundingBox||Br(e.polygon);if(e.polygon&&!js(e.polygon.points)){let i=e.target||Hs(e.polygon,t);return RE(i?.type==="SvgSelector"),{type:"SvgSelector",points:e.polygon.points,spatial:{unit:"pixel",...n||{}},svgShape:e.polygon.open?"polyline":"polygon",svg:i.value}}return{type:"BoxSelector",spatial:n}}return VI(mk);})();
134
+ `}),(0,Bh.jsx)("iframe",{className:"video-yt",ref:i,src:`https://www.youtube.com/embed/${e.youTubeId}?enablejsapi=1&origin=${window.location.host}`,referrerPolicy:"no-referrer",sandbox:"allow-scripts allow-same-origin allow-presentation"})]}):null}function cL({media:t,mediaControlsDeps:e,children:n}){let[{element:i,currentTime:a,progress:o},s,u]=js({duration:t.duration});return Qn("overlay","video-element",y7,{element:i,media:t,playPause:u.playPause}),null}var Pv=_(V(),1);function dA(){let{strategy:t}=Fe(),{renderMediaControls:e,mediaControlsDeps:n}=hi();return t.type!=="media"||t.media.type!=="VideoYouTube"?null:(0,Pv.jsxs)(cL,{media:t.media,mediaControlsDeps:n,children:[(0,Pv.jsx)(ks,{}),e?e(t):null]})}var Jv=_(X(),1);var Ol=_(X(),1);var ti=_(X(),1);function hA(t){let e=Ne(),n=St(e,o=>o.polygons),i=St(e,o=>o.polygonState),a=St(e,o=>o.polygon);return Ps("atlas.polygon-render",({state:o,slowState:s,dt:u})=>{t(o,s,u)}),{currentShape:a,state:i,helper:n}}var Wt=_(V(),1),cr=gD(),fL={shapeFill:"#ffffff33",shapeStroke:"#000",lineStroke:"#000",ghostLineStroke:"#0F0",activeLineStroke:"#4D7EEA",boundingBoxDottedStroke:"#0007",boundingBoxStroke:"#fffA",controlFill:"#fff"};function pA(t){let{image:e}=t,n={...fL,...t.theme||{}},i=(0,ti.useRef)(),a=(0,ti.useRef)(),o=(0,ti.useRef)(),s=(0,ti.useRef)(),u=(0,ti.useRef)(),d=(0,ti.useRef)(),p=(0,ti.useRef)(),f=(0,ti.useRef)(),m=(0,ti.useRef)(),g=(0,ti.useRef)(),[v,S]=(0,ti.useState)(null),[R,T]=(0,ti.useState)(!1),{helper:E,state:x,currentShape:A}=hA((Q,it)=>{if(Q.closestLineIndex,cr.updateTransitionBoundingBox(o.current,Q,it),cr.updateBoundingBoxPolygon(i.current,Q,it),cr.updateBoundingBoxPolygon(a.current,Q,it),cr.updateTransitionShape(p.current,Q,it),cr.updateClosestLinePointTransform(u.current,Q,it),cr.updateSelectBox(s.current,Q,it),cr.updatePointLine(f.current,Q,it),cr.updateDrawPreview(d.current,Q,it,3),cr.updateLineBox(m.current,Q),S(Q.transitionDirection),T(Q.transitionRotate),Q.closestLineIndex!==-1&&g.current){let lt=Q.polygon,et=lt.points[Q.closestLineIndex],$=lt.points[(Q.closestLineIndex+1)%lt.points.length];et&&$&&g.current.setAttribute("points",`${et[0]},${et[1]} ${$[0]},${$[1]}`)}});(0,ti.useEffect)(()=>{let Q=()=>{E.modifiers.reset()};return document.addEventListener("mouseleave",Q),()=>{document.removeEventListener("mouseleave",Q)}},[]);let C=(0,Wt.jsxs)(Wt.Fragment,{children:[(0,Wt.jsxs)("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:[(0,Wt.jsx)("circle",{cx:"5",cy:"5",r:"5",fill:n.lineStroke,className:"marker"}),(0,Wt.jsx)("circle",{cx:"5",cy:"5",r:"3",fill:n.controlFill})]}),(0,Wt.jsx)("marker",{id:"newdot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:(0,Wt.jsx)("circle",{cx:"5",cy:"5",r:"5",fill:n.activeLineStroke,className:"marker"})}),(0,Wt.jsxs)("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:[(0,Wt.jsx)("circle",{cx:"5",cy:"5",r:"5",fill:n.lineStroke}),(0,Wt.jsx)("circle",{cx:"5",cy:"5",r:"3",fill:n.activeLineStroke})]}),(0,Wt.jsxs)("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"6",markerHeight:"6",children:[(0,Wt.jsx)("rect",{width:"10",height:"10",fill:n.lineStroke}),(0,Wt.jsx)("rect",{x:"1",y:"1",width:"8",height:"8",fill:n.controlFill})]})]}),M=A?A.open?"polyline":"polygon":null,I=!x.showBoundingBox&&x.closestPoint!==null&&x.actionIntentType==="select-point",z=x.actionIntentType==="add-open-point",D=x.transitionIntentType==="split-line",k=x.transitioning&&x.selectedStamp&&x.transitionIntentType==="stamp-shape",B=A&&M?(0,Wt.jsxs)(Wt.Fragment,{children:[(0,Wt.jsx)(M,{fill:(!x.transitioning||x.transitionIntentType==="select-multiple-points")&&!A.open?n.shapeFill:"none",strokeWidth:k||x.showBoundingBox&&x.boxMode||x.transitioning&&x.transitionIntentType==="split-line"||x.transitioning&&x.transitionIntentType==="move-point"?0:2,stroke:n.shapeStroke,points:A.points.map(Q=>Q.join(",")).join(" "),vectorEffect:"non-scaling-stroke",markerStart:x.showBoundingBox?void 0:x.boxMode?"url(#resizer)":"url(#dot)",markerMid:x.showBoundingBox?void 0:x.boxMode?"url(#resizer)":"url(#dot)",markerEnd:x.showBoundingBox?void 0:x.boxMode?"url(#resizer)":"url(#dot)",style:{pointerEvents:"none"},opacity:x.transitioning&&x.transitionIntentType==="move-shape"?0:1}),x.currentTool==="lineBox"&&x.actionIntentType==="close-line-box"?(0,Wt.jsx)("polygon",{fill:n.shapeFill,ref:m,stroke:n.lineStroke,strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,x.transitionIntentType==="draw-shape"&&x.transitioning?(0,Wt.jsx)("polyline",{ref:d,fill:"none",stroke:n.activeLineStroke,strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,!(x.transitioning&&x.transitionIntentType==="move-point")&&!(x.transitioning&&x.transitionIntentType==="stamp-shape")&&!x.showBoundingBox&&x.selectedPoints&&x.selectedPoints.length?(0,Wt.jsx)("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:A.points.filter((Q,it)=>x.selectedPoints?.includes(it)).map(Q=>Q.join(",")).join(" "),opacity:x.transitioning&&x.transitionIntentType==="move-shape"?0:1}):null,I&&!x.transitioning&&x.closestPoint!==null&&A.points[x.closestPoint]?(0,Wt.jsx)("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:n.activeLineStroke,points:`${A.points[x.closestPoint][0]},${A.points[x.closestPoint][1]}`,opacity:x.transitioning&&x.transitionIntentType==="move-shape"?0:1}):null,!x.transitioning&&(x.actionIntentType==="add-open-point"||x.actionIntentType==="close-shape"||x.actionIntentType==="close-shape-line")?(0,Wt.jsx)("polyline",{stroke:n.activeLineStroke,ref:f,strokeWidth:x.actionIntentType==="add-open-point"?1:2,vectorEffect:"non-scaling-stroke"}):null,x.hasClosestLine&&!x.showBoundingBox&&!x.transitioning&&x.currentTool!=="box"&&x.transitionIntentType==="split-line"?(0,Wt.jsx)("g",{children:(0,Wt.jsx)("polyline",{ref:g,vectorEffect:"non-scaling-stroke",fill:"transparent",stroke:n.activeLineStroke,strokeWidth:3})}):null,x.hasClosestLine&&!x.showBoundingBox&&!x.transitioning&&x.currentTool!=="box"&&x.transitionIntentType==="split-line"?(0,Wt.jsx)("g",{ref:u,children:(0,Wt.jsx)("polyline",{markerStart:"url(#newdot)",points:"0,0 1,1",vectorEffect:"non-scaling-stroke",stroke:"transparent",fill:"transparent",strokeWidth:2})}):null,x.transitioning?(0,Wt.jsx)(M,{ref:p,fill:A.open?"none":n.shapeFill,stroke:x.transitionIntentType==="stamp-shape"?n.activeLineStroke:n.shapeStroke,vectorEffect:"non-scaling-stroke",strokeWidth:(A.open,2)}):null,x.transitioning&&x.transitionIntentType==="select-multiple-points"?(0,Wt.jsx)("rect",{ref:s,fill:"rgba(255, 255, 255, .3)",strokeWidth:1,stroke:"rgba(0,0,0,.2)",vectorEffect:"non-scaling-stroke"}):null,x.showBoundingBox&&!k?(0,Wt.jsxs)(Wt.Fragment,{children:[(0,Wt.jsx)("polygon",{ref:i,strokeWidth:2,stroke:n.boundingBoxStroke,fill:"none",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"}),(0,Wt.jsx)("polygon",{ref:a,strokeWidth:2,stroke:n.boundingBoxDottedStroke,fill:"none",strokeDasharray:"4 4",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"})]}):null]}):null;return{currentTool:E.state.slowState.currentTool,setCurrentTool:E.tools.setTool,helper:E,currentShape:A,state:x,isAddingPoint:z,isSplitting:D,isStamping:k,isHoveringPoint:I,transitionDirection:v,transitionRotate:R,defs:C,editor:B}}var Ml=_(V(),1);function dL(t){let e=lv(),{image:n}=t,{helper:i,defs:a,editor:o,state:s,transitionDirection:u,isSplitting:d,transitionRotate:p,isHoveringPoint:f,isAddingPoint:m}=pA({image:t.image,theme:t.theme}),g=(0,Ol.useCallback)(R=>{R.button!==2&&i.pointer([[~~R.atlas.x,~~R.atlas.y]])},[i]),v=(0,Ol.useCallback)(R=>{R.button!==2&&i.pointerDown()},[i]),S=(0,Ol.useCallback)(R=>{R.button!==2&&i.pointerUp()},[i]);return(0,Ol.useEffect)(()=>{let R=T=>{i.key.up(T.key)};return document.addEventListener("keyup",R),()=>{document.removeEventListener("keyup",R)}},[i]),(0,Ol.useEffect)(()=>{let R=T=>{T.target&&["INPUT","TEXTAREA"].includes(T.target.tagName)||T.target?.isContentEditable||document.activeElement&&(document.activeElement instanceof HTMLInputElement||document.activeElement instanceof HTMLTextAreaElement||document.activeElement.isContentEditable)||i.key.down(T.key)};return document.addEventListener("keydown",R),()=>{document.removeEventListener("keydown",R)}},[i]),(0,Ol.useEffect)(()=>{let R=[];return u&&R.push(`atlas-cursor-${u}`),s.actionIntentType==="cut-line"&&s.modifiers?.Shift&&R.push("atlas-cursor-cut"),(f||s.transitionIntentType==="move-shape"||s.transitionIntentType==="move-point")&&R.push("atlas-cursor-move"),m&&R.push("atlas-cursor-crosshair"),d&&R.push("atlas-cursor-copy"),p&&R.push("atlas-cursor-rotate"),s.transitionIntentType==="draw-shape"&&R.push("atlas-cursor-draw"),e?.canvas&&e.canvas.classList.add(...R),()=>{e?.canvas&&e.canvas.classList.remove(...R)}},[e?.canvas,m,f,d,s.modifiers?.Shift,s.actionIntentType,s.transitionIntentType,u,p]),(0,Ml.jsx)("world-object",{height:n.height,width:n.width,onMouseMove:g,onMouseDown:v,onMouseUp:S,onMouseLeave:i.blur,children:(0,Ml.jsx)(Ni,{relative:!0,interactive:!1,children:(0,Ml.jsx)("div",{className:"absolute top-0 right-0 left-0 bottom-0",children:(0,Ml.jsxs)("svg",{width:"100%",height:"100%",viewBox:`0 0 ${n.width} ${n.height}`,tabIndex:-1,children:[(0,Ml.jsx)("title",{children:"Annotation Editor"}),(0,Ml.jsx)("defs",{children:a}),o]})})})})}var u4=_(X(),1);var It=_(X(),1);function Hv(){return typeof window<"u"}function _l(t){return hL(t)?(t.nodeName||"").toLowerCase():"#document"}function pi(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function to(t){var e;return(e=(hL(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function hL(t){return Hv()?t instanceof Node||t instanceof pi(t).Node:!1}function Ge(t){return Hv()?t instanceof Element||t instanceof pi(t).Element:!1}function Ii(t){return Hv()?t instanceof HTMLElement||t instanceof pi(t).HTMLElement:!1}function Ph(t){return!Hv()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof pi(t).ShadowRoot}var v7=new Set(["inline","contents"]);function ef(t){let{overflow:e,overflowX:n,overflowY:i,display:a}=Di(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!v7.has(a)}var S7=new Set(["table","td","th"]);function pL(t){return S7.has(_l(t))}var b7=[":popover-open",":modal"];function Hh(t){return b7.some(e=>{try{return t.matches(e)}catch{return!1}})}var x7=["transform","translate","scale","rotate","perspective"],E7=["transform","translate","scale","rotate","perspective","filter"],R7=["paint","layout","strict","content"];function Uv(t){let e=nf(),n=Ge(t)?Di(t):t;return x7.some(i=>n[i]?n[i]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||E7.some(i=>(n.willChange||"").includes(i))||R7.some(i=>(n.contain||"").includes(i))}function mL(t){let e=$a(t);for(;Ii(e)&&!eo(e);){if(Uv(e))return e;if(Hh(e))return null;e=$a(e)}return null}function nf(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var A7=new Set(["html","body","#document"]);function eo(t){return A7.has(_l(t))}function Di(t){return pi(t).getComputedStyle(t)}function Uh(t){return Ge(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function $a(t){if(_l(t)==="html")return t;let e=t.assignedSlot||t.parentNode||Ph(t)&&t.host||to(t);return Ph(e)?e.host:e}function gL(t){let e=$a(t);return eo(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ii(e)&&ef(e)?e:gL(e)}function ua(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);let a=gL(t),o=a===((i=t.ownerDocument)==null?void 0:i.body),s=pi(a);if(o){let u=Vv(s);return e.concat(s,s.visualViewport||[],ef(a)?a:[],u&&n?ua(u):[])}return e.concat(a,ua(a,[],n))}function Vv(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}var kh=_(X(),1),RL=_(X(),1);var af=Math.min,fr=Math.max,jh=Math.round,qh=Math.floor,no=t=>({x:t,y:t}),T7={left:"right",right:"left",bottom:"top",top:"bottom"},C7={start:"end",end:"start"};function mA(t,e,n){return fr(t,af(e,n))}function Fh(t,e){return typeof t=="function"?t(e):t}function zl(t){return t.split("-")[0]}function Gh(t){return t.split("-")[1]}function gA(t){return t==="x"?"y":"x"}function yA(t){return t==="y"?"height":"width"}var w7=new Set(["top","bottom"]);function dr(t){return w7.has(zl(t))?"y":"x"}function vA(t){return gA(dr(t))}function SL(t,e,n){n===void 0&&(n=!1);let i=Gh(t),a=vA(t),o=yA(a),s=a==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Vh(s)),[s,Vh(s)]}function bL(t){let e=Vh(t);return[jv(t),e,jv(e)]}function jv(t){return t.replace(/start|end/g,e=>C7[e])}var yL=["left","right"],vL=["right","left"],M7=["top","bottom"],O7=["bottom","top"];function _7(t,e,n){switch(t){case"top":case"bottom":return n?e?vL:yL:e?yL:vL;case"left":case"right":return e?M7:O7;default:return[]}}function xL(t,e,n,i){let a=Gh(t),o=_7(zl(t),n==="start",i);return a&&(o=o.map(s=>s+"-"+a),e&&(o=o.concat(o.map(jv)))),o}function Vh(t){return t.replace(/left|right|bottom|top/g,e=>T7[e])}function z7(t){return{top:0,right:0,bottom:0,left:0,...t}}function EL(t){return typeof t!="number"?z7(t):{top:t,right:t,bottom:t,left:t}}function Xs(t){let{x:e,y:n,width:i,height:a}=t;return{width:i,height:a,top:n,left:e,right:e+i,bottom:n+a,x:e,y:n}}function SA(t,e){if(!t||!e)return!1;let n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Ph(n)){let i=e;for(;i;){if(t===i)return!0;i=i.parentNode||i.host}}return!1}function of(t){return"composedPath"in t?t.composedPath()[0]:t.target}function qv(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);let n=t;return n.target!=null&&e.contains(n.target)}function AL(t){return t.matches("html,body")}function bA(t){return t?.ownerDocument||document}function Yh(t,e,n){return n===void 0&&(n=!0),t.filter(a=>{var o;return a.parentId===e&&(!n||((o=a.context)==null?void 0:o.open))}).flatMap(a=>[a,...Yh(t,a.id,n)])}function TL(t){return"nativeEvent"in t}var N7=typeof document<"u",I7=function(){},Fv=N7?RL.useLayoutEffect:I7,D7={...kh};var L7=D7.useInsertionEffect,B7=L7||(t=>t());function Ks(t){let e=kh.useRef(()=>{});return B7(()=>{e.current=t}),kh.useCallback(function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e.current==null?void 0:e.current(...i)},[])}var _A=_(V(),1);var $L=_(ms(),1);function CL(t,e,n){let{reference:i,floating:a}=t,o=dr(e),s=vA(e),u=yA(s),d=zl(e),p=o==="y",f=i.x+i.width/2-a.width/2,m=i.y+i.height/2-a.height/2,g=i[u]/2-a[u]/2,v;switch(d){case"top":v={x:f,y:i.y-a.height};break;case"bottom":v={x:f,y:i.y+i.height};break;case"right":v={x:i.x+i.width,y:m};break;case"left":v={x:i.x-a.width,y:m};break;default:v={x:i.x,y:i.y}}switch(Gh(e)){case"start":v[s]-=g*(n&&p?-1:1);break;case"end":v[s]+=g*(n&&p?-1:1);break}return v}var wL=async(t,e,n)=>{let{placement:i="bottom",strategy:a="absolute",middleware:o=[],platform:s}=n,u=o.filter(Boolean),d=await(s.isRTL==null?void 0:s.isRTL(e)),p=await s.getElementRects({reference:t,floating:e,strategy:a}),{x:f,y:m}=CL(p,i,d),g=i,v={},S=0;for(let R=0;R<u.length;R++){let{name:T,fn:E}=u[R],{x,y:A,data:C,reset:M}=await E({x:f,y:m,initialPlacement:i,placement:g,strategy:a,middlewareData:v,rects:p,platform:s,elements:{reference:t,floating:e}});f=x??f,m=A??m,v={...v,[T]:{...v[T],...C}},M&&S<=50&&(S++,typeof M=="object"&&(M.placement&&(g=M.placement),M.rects&&(p=M.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:a}):M.rects),{x:f,y:m}=CL(p,g,d)),R=-1)}return{x:f,y:m,placement:g,strategy:a,middlewareData:v}};async function xA(t,e){var n;e===void 0&&(e={});let{x:i,y:a,platform:o,rects:s,elements:u,strategy:d}=t,{boundary:p="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:v=0}=Fh(e,t),S=EL(v),T=u[g?m==="floating"?"reference":"floating":m],E=Xs(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(T)))==null||n?T:T.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(u.floating)),boundary:p,rootBoundary:f,strategy:d})),x=m==="floating"?{x:i,y:a,width:s.floating.width,height:s.floating.height}:s.reference,A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u.floating)),C=await(o.isElement==null?void 0:o.isElement(A))?await(o.getScale==null?void 0:o.getScale(A))||{x:1,y:1}:{x:1,y:1},M=Xs(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:x,offsetParent:A,strategy:d}):x);return{top:(E.top-M.top+S.top)/C.y,bottom:(M.bottom-E.bottom+S.bottom)/C.y,left:(E.left-M.left+S.left)/C.x,right:(M.right-E.right+S.right)/C.x}}var ML=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,i;let{placement:a,middlewareData:o,rects:s,initialPlacement:u,platform:d,elements:p}=e,{mainAxis:f=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:R=!0,...T}=Fh(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};let E=zl(a),x=dr(u),A=zl(u)===u,C=await(d.isRTL==null?void 0:d.isRTL(p.floating)),M=g||(A||!R?[Vh(u)]:bL(u)),I=S!=="none";!g&&I&&M.push(...xL(u,R,S,C));let z=[u,...M],D=await xA(e,T),k=[],B=((i=o.flip)==null?void 0:i.overflows)||[];if(f&&k.push(D[E]),m){let et=SL(a,s,C);k.push(D[et[0]],D[et[1]])}if(B=[...B,{placement:a,overflows:k}],!k.every(et=>et<=0)){var Q,it;let et=(((Q=o.flip)==null?void 0:Q.index)||0)+1,$=z[et];if($&&(!(m==="alignment"?x!==dr($):!1)||B.every(st=>st.overflows[0]>0&&dr(st.placement)===x)))return{data:{index:et,overflows:B},reset:{placement:$}};let ht=(it=B.filter(bt=>bt.overflows[0]<=0).sort((bt,st)=>bt.overflows[1]-st.overflows[1])[0])==null?void 0:it.placement;if(!ht)switch(v){case"bestFit":{var lt;let bt=(lt=B.filter(st=>{if(I){let rt=dr(st.placement);return rt===x||rt==="y"}return!0}).map(st=>[st.placement,st.overflows.filter(rt=>rt>0).reduce((rt,Y)=>rt+Y,0)]).sort((st,rt)=>st[1]-rt[1])[0])==null?void 0:lt[0];bt&&(ht=bt);break}case"initialPlacement":ht=u;break}if(a!==ht)return{reset:{placement:ht}}}return{}}}};var P7=new Set(["left","top"]);async function H7(t,e){let{placement:n,platform:i,elements:a}=t,o=await(i.isRTL==null?void 0:i.isRTL(a.floating)),s=zl(n),u=Gh(n),d=dr(n)==="y",p=P7.has(s)?-1:1,f=o&&d?-1:1,m=Fh(e,t),{mainAxis:g,crossAxis:v,alignmentAxis:S}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return u&&typeof S=="number"&&(v=u==="end"?S*-1:S),d?{x:v*f,y:g*p}:{x:g*p,y:v*f}}var OL=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,i;let{x:a,y:o,placement:s,middlewareData:u}=e,d=await H7(e,t);return s===((n=u.offset)==null?void 0:n.placement)&&(i=u.arrow)!=null&&i.alignmentOffset?{}:{x:a+d.x,y:o+d.y,data:{...d,placement:s}}}}},_L=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:i,placement:a}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:u={fn:T=>{let{x:E,y:x}=T;return{x:E,y:x}}},...d}=Fh(t,e),p={x:n,y:i},f=await xA(e,d),m=dr(zl(a)),g=gA(m),v=p[g],S=p[m];if(o){let T=g==="y"?"top":"left",E=g==="y"?"bottom":"right",x=v+f[T],A=v-f[E];v=mA(x,v,A)}if(s){let T=m==="y"?"top":"left",E=m==="y"?"bottom":"right",x=S+f[T],A=S-f[E];S=mA(x,S,A)}let R=u.fn({...e,[g]:v,[m]:S});return{...R,data:{x:R.x-n,y:R.y-i,enabled:{[g]:o,[m]:s}}}}}};function IL(t){let e=Di(t),n=parseFloat(e.width)||0,i=parseFloat(e.height)||0,a=Ii(t),o=a?t.offsetWidth:n,s=a?t.offsetHeight:i,u=jh(n)!==o||jh(i)!==s;return u&&(n=o,i=s),{width:n,height:i,$:u}}function RA(t){return Ge(t)?t:t.contextElement}function rf(t){let e=RA(t);if(!Ii(e))return no(1);let n=e.getBoundingClientRect(),{width:i,height:a,$:o}=IL(e),s=(o?jh(n.width):n.width)/i,u=(o?jh(n.height):n.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!u||!Number.isFinite(u))&&(u=1),{x:s,y:u}}var U7=no(0);function DL(t){let e=pi(t);return!nf()||!e.visualViewport?U7:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function V7(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==pi(t)?!1:e}function Zs(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);let a=t.getBoundingClientRect(),o=RA(t),s=no(1);e&&(i?Ge(i)&&(s=rf(i)):s=rf(t));let u=V7(o,n,i)?DL(o):no(0),d=(a.left+u.x)/s.x,p=(a.top+u.y)/s.y,f=a.width/s.x,m=a.height/s.y;if(o){let g=pi(o),v=i&&Ge(i)?pi(i):i,S=g,R=Vv(S);for(;R&&i&&v!==S;){let T=rf(R),E=R.getBoundingClientRect(),x=Di(R),A=E.left+(R.clientLeft+parseFloat(x.paddingLeft))*T.x,C=E.top+(R.clientTop+parseFloat(x.paddingTop))*T.y;d*=T.x,p*=T.y,f*=T.x,m*=T.y,d+=A,p+=C,S=pi(R),R=Vv(S)}}return Xs({width:f,height:m,x:d,y:p})}function AA(t,e){let n=Uh(t).scrollLeft;return e?e.left+n:Zs(to(t)).left+n}function LL(t,e,n){n===void 0&&(n=!1);let i=t.getBoundingClientRect(),a=i.left+e.scrollLeft-(n?0:AA(t,i)),o=i.top+e.scrollTop;return{x:a,y:o}}function j7(t){let{elements:e,rect:n,offsetParent:i,strategy:a}=t,o=a==="fixed",s=to(i),u=e?Hh(e.floating):!1;if(i===s||u&&o)return n;let d={scrollLeft:0,scrollTop:0},p=no(1),f=no(0),m=Ii(i);if((m||!m&&!o)&&((_l(i)!=="body"||ef(s))&&(d=Uh(i)),Ii(i))){let v=Zs(i);p=rf(i),f.x=v.x+i.clientLeft,f.y=v.y+i.clientTop}let g=s&&!m&&!o?LL(s,d,!0):no(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-d.scrollLeft*p.x+f.x+g.x,y:n.y*p.y-d.scrollTop*p.y+f.y+g.y}}function q7(t){return Array.from(t.getClientRects())}function F7(t){let e=to(t),n=Uh(t),i=t.ownerDocument.body,a=fr(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=fr(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight),s=-n.scrollLeft+AA(t),u=-n.scrollTop;return Di(i).direction==="rtl"&&(s+=fr(e.clientWidth,i.clientWidth)-a),{width:a,height:o,x:s,y:u}}function G7(t,e){let n=pi(t),i=to(t),a=n.visualViewport,o=i.clientWidth,s=i.clientHeight,u=0,d=0;if(a){o=a.width,s=a.height;let p=nf();(!p||p&&e==="fixed")&&(u=a.offsetLeft,d=a.offsetTop)}return{width:o,height:s,x:u,y:d}}var k7=new Set(["absolute","fixed"]);function Y7(t,e){let n=Zs(t,!0,e==="fixed"),i=n.top+t.clientTop,a=n.left+t.clientLeft,o=Ii(t)?rf(t):no(1),s=t.clientWidth*o.x,u=t.clientHeight*o.y,d=a*o.x,p=i*o.y;return{width:s,height:u,x:d,y:p}}function zL(t,e,n){let i;if(e==="viewport")i=G7(t,n);else if(e==="document")i=F7(to(t));else if(Ge(e))i=Y7(e,n);else{let a=DL(t);i={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return Xs(i)}function BL(t,e){let n=$a(t);return n===e||!Ge(n)||eo(n)?!1:Di(n).position==="fixed"||BL(n,e)}function Q7(t,e){let n=e.get(t);if(n)return n;let i=ua(t,[],!1).filter(u=>Ge(u)&&_l(u)!=="body"),a=null,o=Di(t).position==="fixed",s=o?$a(t):t;for(;Ge(s)&&!eo(s);){let u=Di(s),d=Uv(s);!d&&u.position==="fixed"&&(a=null),(o?!d&&!a:!d&&u.position==="static"&&!!a&&k7.has(a.position)||ef(s)&&!d&&BL(t,s))?i=i.filter(f=>f!==s):a=u,s=$a(s)}return e.set(t,i),i}function X7(t){let{element:e,boundary:n,rootBoundary:i,strategy:a}=t,s=[...n==="clippingAncestors"?Hh(e)?[]:Q7(e,this._c):[].concat(n),i],u=s[0],d=s.reduce((p,f)=>{let m=zL(e,f,a);return p.top=fr(m.top,p.top),p.right=af(m.right,p.right),p.bottom=af(m.bottom,p.bottom),p.left=fr(m.left,p.left),p},zL(e,u,a));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function K7(t){let{width:e,height:n}=IL(t);return{width:e,height:n}}function Z7(t,e,n){let i=Ii(e),a=to(e),o=n==="fixed",s=Zs(t,!0,o,e),u={scrollLeft:0,scrollTop:0},d=no(0);function p(){d.x=AA(a)}if(i||!i&&!o)if((_l(e)!=="body"||ef(a))&&(u=Uh(e)),i){let v=Zs(e,!0,o,e);d.x=v.x+e.clientLeft,d.y=v.y+e.clientTop}else a&&p();o&&!i&&a&&p();let f=a&&!i&&!o?LL(a,u):no(0),m=s.left+u.scrollLeft-d.x-f.x,g=s.top+u.scrollTop-d.y-f.y;return{x:m,y:g,width:s.width,height:s.height}}function EA(t){return Di(t).position==="static"}function NL(t,e){if(!Ii(t)||Di(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return to(t)===n&&(n=n.ownerDocument.body),n}function PL(t,e){let n=pi(t);if(Hh(t))return n;if(!Ii(t)){let a=$a(t);for(;a&&!eo(a);){if(Ge(a)&&!EA(a))return a;a=$a(a)}return n}let i=NL(t,e);for(;i&&pL(i)&&EA(i);)i=NL(i,e);return i&&eo(i)&&EA(i)&&!Uv(i)?n:i||mL(t)||n}var J7=async function(t){let e=this.getOffsetParent||PL,n=this.getDimensions,i=await n(t.floating);return{reference:Z7(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function W7(t){return Di(t).direction==="rtl"}var TA={convertOffsetParentRelativeRectToViewportRelativeRect:j7,getDocumentElement:to,getClippingRect:X7,getOffsetParent:PL,getElementRects:J7,getClientRects:q7,getDimensions:K7,getScale:rf,isElement:Ge,isRTL:W7};function HL(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function $7(t,e){let n=null,i,a=to(t);function o(){var u;clearTimeout(i),(u=n)==null||u.disconnect(),n=null}function s(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),o();let p=t.getBoundingClientRect(),{left:f,top:m,width:g,height:v}=p;if(u||e(),!g||!v)return;let S=qh(m),R=qh(a.clientWidth-(f+g)),T=qh(a.clientHeight-(m+v)),E=qh(f),A={rootMargin:-S+"px "+-R+"px "+-T+"px "+-E+"px",threshold:fr(0,af(1,d))||1},C=!0;function M(I){let z=I[0].intersectionRatio;if(z!==d){if(!C)return s();z?s(!1,z):i=setTimeout(()=>{s(!1,1e-7)},1e3)}z===1&&!HL(p,t.getBoundingClientRect())&&s(),C=!1}try{n=new IntersectionObserver(M,{...A,root:a.ownerDocument})}catch{n=new IntersectionObserver(M,A)}n.observe(t)}return s(!0),o}function Gv(t,e,n,i){i===void 0&&(i={});let{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=i,p=RA(t),f=a||o?[...p?ua(p):[],...ua(e)]:[];f.forEach(E=>{a&&E.addEventListener("scroll",n,{passive:!0}),o&&E.addEventListener("resize",n)});let m=p&&u?$7(p,n):null,g=-1,v=null;s&&(v=new ResizeObserver(E=>{let[x]=E;x&&x.target===p&&v&&(v.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var A;(A=v)==null||A.observe(e)})),n()}),p&&!d&&v.observe(p),v.observe(e));let S,R=d?Zs(t):null;d&&T();function T(){let E=Zs(t);R&&!HL(R,E)&&n(),R=E,S=requestAnimationFrame(T)}return n(),()=>{var E;f.forEach(x=>{a&&x.removeEventListener("scroll",n),o&&x.removeEventListener("resize",n)}),m?.(),(E=v)==null||E.disconnect(),v=null,d&&cancelAnimationFrame(S)}}var UL=OL;var VL=_L,jL=ML;var kv=(t,e,n)=>{let i=new Map,a={platform:TA,...n},o={...a.platform,_c:i};return wL(t,e,{...a,platform:o})};var vn=_(X(),1),GL=_(X(),1),kL=_(ms(),1),tF=typeof document<"u",eF=function(){},Yv=tF?GL.useLayoutEffect:eF;function Qv(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,i,a;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(i=n;i--!==0;)if(!Qv(t[i],e[i]))return!1;return!0}if(a=Object.keys(t),n=a.length,n!==Object.keys(e).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(e,a[i]))return!1;for(i=n;i--!==0;){let o=a[i];if(!(o==="_owner"&&t.$$typeof)&&!Qv(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function YL(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function qL(t,e){let n=YL(t);return Math.round(e*n)/n}function CA(t){let e=vn.useRef(t);return Yv(()=>{e.current=t}),e}function QL(t){t===void 0&&(t={});let{placement:e="bottom",strategy:n="absolute",middleware:i=[],platform:a,elements:{reference:o,floating:s}={},transform:u=!0,whileElementsMounted:d,open:p}=t,[f,m]=vn.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,v]=vn.useState(i);Qv(g,i)||v(i);let[S,R]=vn.useState(null),[T,E]=vn.useState(null),x=vn.useCallback(st=>{st!==I.current&&(I.current=st,R(st))},[]),A=vn.useCallback(st=>{st!==z.current&&(z.current=st,E(st))},[]),C=o||S,M=s||T,I=vn.useRef(null),z=vn.useRef(null),D=vn.useRef(f),k=d!=null,B=CA(d),Q=CA(a),it=CA(p),lt=vn.useCallback(()=>{if(!I.current||!z.current)return;let st={placement:e,strategy:n,middleware:g};Q.current&&(st.platform=Q.current),kv(I.current,z.current,st).then(rt=>{let Y={...rt,isPositioned:it.current!==!1};et.current&&!Qv(D.current,Y)&&(D.current=Y,kL.flushSync(()=>{m(Y)}))})},[g,e,n,Q,it]);Yv(()=>{p===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,m(st=>({...st,isPositioned:!1})))},[p]);let et=vn.useRef(!1);Yv(()=>(et.current=!0,()=>{et.current=!1}),[]),Yv(()=>{if(C&&(I.current=C),M&&(z.current=M),C&&M){if(B.current)return B.current(C,M,lt);lt()}},[C,M,lt,B,k]);let $=vn.useMemo(()=>({reference:I,floating:z,setReference:x,setFloating:A}),[x,A]),ht=vn.useMemo(()=>({reference:C,floating:M}),[C,M]),bt=vn.useMemo(()=>{let st={position:n,left:0,top:0};if(!ht.floating)return st;let rt=qL(ht.floating,f.x),Y=qL(ht.floating,f.y);return u?{...st,transform:"translate("+rt+"px, "+Y+"px)",...YL(ht.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:rt,top:Y}},[n,u,ht.floating,f.x,f.y]);return vn.useMemo(()=>({...f,update:lt,refs:$,elements:ht,floatingStyles:bt}),[f,lt,$,ht,bt])}var Xv=(t,e)=>({...UL(t),options:[t,e]}),wA=(t,e)=>({...VL(t),options:[t,e]});var MA=(t,e)=>({...jL(t),options:[t,e]});var nF="data-floating-ui-focusable",XL="active",KL="selected",iF="ArrowLeft",aF="ArrowRight",oF="ArrowUp",rF="ArrowDown";var lF=[iF,aF],sF=[oF,rF],d$=[...lF,...sF];var uF={...It},ZL=!1,cF=0,JL=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+cF++;function fF(){let[t,e]=It.useState(()=>ZL?JL():void 0);return Fv(()=>{t==null&&e(JL())},[]),It.useEffect(()=>{ZL=!0},[]),t}var dF=uF.useId,hF=dF||fF;function pF(){let t=new Map;return{emit(e,n){var i;(i=t.get(e))==null||i.forEach(a=>a(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var i;(i=t.get(e))==null||i.delete(n)}}}var mF=It.createContext(null),gF=It.createContext(null),yF=()=>{var t;return((t=It.useContext(mF))==null?void 0:t.id)||null},t4=()=>It.useContext(gF);function vF(t){return"data-floating-ui-"+t}function SF(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}var bF={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},xF={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},WL=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function e4(t,e){e===void 0&&(e={});let{open:n,onOpenChange:i,elements:a,dataRef:o}=t,{enabled:s=!0,escapeKey:u=!0,outsidePress:d=!0,outsidePressEvent:p="pointerdown",referencePress:f=!1,referencePressEvent:m="pointerdown",ancestorScroll:g=!1,bubbles:v,capture:S}=e,R=t4(),T=Ks(typeof d=="function"?d:()=>!1),E=typeof d=="function"?T:d,x=It.useRef(!1),{escapeKey:A,outsidePress:C}=WL(v),{escapeKey:M,outsidePress:I}=WL(S),z=It.useRef(!1),D=It.useRef(-1),k=Ks($=>{var ht;if(!n||!s||!u||$.key!=="Escape"||z.current)return;let bt=(ht=o.current.floatingContext)==null?void 0:ht.nodeId,st=R?Yh(R.nodesRef.current,bt):[];if(!A&&($.stopPropagation(),st.length>0)){let rt=!0;if(st.forEach(Y=>{var At;if((At=Y.context)!=null&&At.open&&!Y.context.dataRef.current.__escapeKeyBubbles){rt=!1;return}}),!rt)return}i(!1,TL($)?$.nativeEvent:$,"escape-key")}),B=Ks($=>{var ht;let bt=()=>{var st;k($),(st=of($))==null||st.removeEventListener("keydown",bt)};(ht=of($))==null||ht.addEventListener("keydown",bt)}),Q=Ks($=>{var ht;let bt=o.current.insideReactTree;o.current.insideReactTree=!1;let st=x.current;if(x.current=!1,p==="click"&&st||bt||typeof E=="function"&&!E($))return;let rt=of($),Y="["+vF("inert")+"]",At=bA(a.floating).querySelectorAll(Y),Qt=Ge(rt)?rt:null;for(;Qt&&!eo(Qt);){let me=$a(Qt);if(eo(me)||!Ge(me))break;Qt=me}if(At.length&&Ge(rt)&&!AL(rt)&&!SA(rt,a.floating)&&Array.from(At).every(me=>!SA(Qt,me)))return;if(Ii(rt)&&et){let me=eo(rt),Ie=Di(rt),oe=/auto|scroll/,da=me||oe.test(Ie.overflowX),ii=me||oe.test(Ie.overflowY),fe=da&&rt.clientWidth>0&&rt.scrollWidth>rt.clientWidth,ue=ii&&rt.clientHeight>0&&rt.scrollHeight>rt.clientHeight,$t=Ie.direction==="rtl",Et=ue&&($t?$.offsetX<=rt.offsetWidth-rt.clientWidth:$.offsetX>rt.clientWidth),Tt=fe&&$.offsetY>rt.clientHeight;if(Et||Tt)return}let ce=(ht=o.current.floatingContext)==null?void 0:ht.nodeId,se=R&&Yh(R.nodesRef.current,ce).some(me=>{var Ie;return qv($,(Ie=me.context)==null?void 0:Ie.elements.floating)});if(qv($,a.floating)||qv($,a.domReference)||se)return;let ae=R?Yh(R.nodesRef.current,ce):[];if(ae.length>0){let me=!0;if(ae.forEach(Ie=>{var oe;if((oe=Ie.context)!=null&&oe.open&&!Ie.context.dataRef.current.__outsidePressBubbles){me=!1;return}}),!me)return}i(!1,$,"outside-press")}),it=Ks($=>{var ht;let bt=()=>{var st;Q($),(st=of($))==null||st.removeEventListener(p,bt)};(ht=of($))==null||ht.addEventListener(p,bt)});It.useEffect(()=>{if(!n||!s)return;o.current.__escapeKeyBubbles=A,o.current.__outsidePressBubbles=C;let $=-1;function ht(At){i(!1,At,"ancestor-scroll")}function bt(){window.clearTimeout($),z.current=!0}function st(){$=window.setTimeout(()=>{z.current=!1},nf()?5:0)}let rt=bA(a.floating);u&&(rt.addEventListener("keydown",M?B:k,M),rt.addEventListener("compositionstart",bt),rt.addEventListener("compositionend",st)),E&&rt.addEventListener(p,I?it:Q,I);let Y=[];return g&&(Ge(a.domReference)&&(Y=ua(a.domReference)),Ge(a.floating)&&(Y=Y.concat(ua(a.floating))),!Ge(a.reference)&&a.reference&&a.reference.contextElement&&(Y=Y.concat(ua(a.reference.contextElement)))),Y=Y.filter(At=>{var Qt;return At!==((Qt=rt.defaultView)==null?void 0:Qt.visualViewport)}),Y.forEach(At=>{At.addEventListener("scroll",ht,{passive:!0})}),()=>{u&&(rt.removeEventListener("keydown",M?B:k,M),rt.removeEventListener("compositionstart",bt),rt.removeEventListener("compositionend",st)),E&&rt.removeEventListener(p,I?it:Q,I),Y.forEach(At=>{At.removeEventListener("scroll",ht)}),window.clearTimeout($)}},[o,a,u,E,p,n,i,g,s,A,C,k,M,B,Q,I,it]),It.useEffect(()=>{o.current.insideReactTree=!1},[o,E,p]);let lt=It.useMemo(()=>({onKeyDown:k,...f&&{[bF[m]]:$=>{i(!1,$.nativeEvent,"reference-press")},...m!=="click"&&{onClick($){i(!1,$.nativeEvent,"reference-press")}}}}),[k,i,f,m]),et=It.useMemo(()=>({onKeyDown:k,onMouseDown(){x.current=!0},onMouseUp(){x.current=!0},[xF[p]]:()=>{o.current.insideReactTree=!0},onBlurCapture(){R||(SF(D),o.current.insideReactTree=!0,D.current=window.setTimeout(()=>{o.current.insideReactTree=!1}))}}),[k,p,o,R]);return It.useMemo(()=>s?{reference:lt,floating:et}:{},[s,lt,et])}function EF(t){let{open:e=!1,onOpenChange:n,elements:i}=t,a=hF(),o=It.useRef({}),[s]=It.useState(()=>pF()),u=yF()!=null,[d,p]=It.useState(i.reference),f=Ks((v,S,R)=>{o.current.openEvent=v?S:void 0,s.emit("openchange",{open:v,event:S,reason:R,nested:u}),n?.(v,S,R)}),m=It.useMemo(()=>({setPositionReference:p}),[]),g=It.useMemo(()=>({reference:d||i.reference||null,floating:i.floating||null,domReference:i.reference}),[d,i.reference,i.floating]);return It.useMemo(()=>({dataRef:o,open:e,onOpenChange:f,elements:g,events:s,floatingId:a,refs:m}),[e,f,g,s,a,m])}function n4(t){t===void 0&&(t={});let{nodeId:e}=t,n=EF({...t,elements:{reference:null,floating:null,...t.elements}}),i=t.rootContext||n,a=i.elements,[o,s]=It.useState(null),[u,d]=It.useState(null),f=a?.domReference||o,m=It.useRef(null),g=t4();Fv(()=>{f&&(m.current=f)},[f]);let v=QL({...t,elements:{...a,...u&&{reference:u}}}),S=It.useCallback(A=>{let C=Ge(A)?{getBoundingClientRect:()=>A.getBoundingClientRect(),getClientRects:()=>A.getClientRects(),contextElement:A}:A;d(C),v.refs.setReference(C)},[v.refs]),R=It.useCallback(A=>{(Ge(A)||A===null)&&(m.current=A,s(A)),(Ge(v.refs.reference.current)||v.refs.reference.current===null||A!==null&&!Ge(A))&&v.refs.setReference(A)},[v.refs]),T=It.useMemo(()=>({...v.refs,setReference:R,setPositionReference:S,domReference:m}),[v.refs,R,S]),E=It.useMemo(()=>({...v.elements,domReference:f}),[v.elements,f]),x=It.useMemo(()=>({...v,...i,refs:T,elements:E,nodeId:e}),[v,T,E,e,i]);return Fv(()=>{i.dataRef.current.floatingContext=x;let A=g?.nodesRef.current.find(C=>C.id===e);A&&(A.context=x)}),It.useMemo(()=>({...v,context:x,refs:T,elements:E}),[v,T,E,x])}function OA(t,e,n){let i=new Map,a=n==="item",o=t;if(a&&t){let{[XL]:s,[KL]:u,...d}=t;o=d}return{...n==="floating"&&{tabIndex:-1,[nF]:""},...o,...e.map(s=>{let u=s?s[n]:null;return typeof u=="function"?t?u(t):null:u}).concat(t).reduce((s,u)=>(u&&Object.entries(u).forEach(d=>{let[p,f]=d;if(!(a&&[XL,KL].includes(p)))if(p.indexOf("on")===0){if(i.has(p)||i.set(p,[]),typeof f=="function"){var m;(m=i.get(p))==null||m.push(f),s[p]=function(){for(var g,v=arguments.length,S=new Array(v),R=0;R<v;R++)S[R]=arguments[R];return(g=i.get(p))==null?void 0:g.map(T=>T(...S)).find(T=>T!==void 0)}}}else s[p]=f}),s),{})}}function i4(t){t===void 0&&(t=[]);let e=t.map(u=>u?.reference),n=t.map(u=>u?.floating),i=t.map(u=>u?.item),a=It.useCallback(u=>OA(u,t,"reference"),e),o=It.useCallback(u=>OA(u,t,"floating"),n),s=It.useCallback(u=>OA(u,t,"item"),i);return It.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s}),[a,o,s])}var s4=_(ms(),1);var Ln=_(X(),1);var a4=_(X(),1),Kv=_(X(),1);var r4=_(V(),1),o4=Ka(),Js=(0,Kv.createContext)({emitter:o4});Js.displayName="Events";function Qh(){return a4.default.useContext(Js).emitter}function RF({emitter:t,children:e}){return(0,r4.jsx)(Js.Provider,{value:(0,Kv.useMemo)(()=>({emitter:t}),[t]),children:e})}var ca=_(V(),1),Xh=Ln.default.createContext({});function Kh(){let t=(0,Ln.useContext)(Xh),e=Object.keys(t),n={};for(let i of e)t[i].Provider&&(n[i]={value:(0,Ln.useContext)(t[i]),Provider:t[i].Provider});return n}function l4(t){let e=Object.keys(t),n=t.children;for(let i of e){if(i==="children")continue;let{value:a,Provider:o}=t[i];n=(0,ca.jsx)(o,{value:a,children:n})}return n}function AF(t){let e=(0,Ln.useContext)(Xh),n=(0,Ln.useMemo)(()=>({...e,...t.providers}),[t.providers]);return(0,ca.jsx)(Xh.Provider,{value:n,children:t.children})}function Zh(){return{VaultContext:(0,Ln.useContext)(Br),ResourceContext:(0,Ln.useContext)(Ff),SimpleViewerReactContext:(0,Ln.useContext)(ku),VisibleCanvasReactContext:(0,Ln.useContext)(ss),AuthRContext:(0,Ln.useContext)(fs),SearchReactContext:(0,Ln.useContext)(Gu),ReactEventContext:(0,Ln.useContext)(Js),ContextBridgeReactContext:(0,Ln.useContext)(Xh),StrategyReactContext:(0,Ln.useContext)(Rl),AtlasStoreReactContext:(0,Ln.useContext)(Hs)}}function Jh(t){return(0,ca.jsx)(ls,{vault:t.bridge.VaultContext.vault||void 0,resources:t.bridge.ResourceContext,children:(0,ca.jsx)(ss.Provider,{value:t.bridge.VisibleCanvasReactContext,children:(0,ca.jsx)(ku.Provider,{value:t.bridge.SimpleViewerReactContext,children:(0,ca.jsx)(Js.Provider,{value:t.bridge.ReactEventContext,children:(0,ca.jsx)(Hs.Provider,{value:t.bridge.AtlasStoreReactContext,children:(0,ca.jsx)(fs.Provider,{value:t.bridge.AuthRContext,children:(0,ca.jsx)(Gu.Provider,{value:t.bridge.SearchReactContext,children:(0,ca.jsx)(Xh.Provider,{value:t.bridge.ContextBridgeReactContext,children:(0,ca.jsx)(Rl.Provider,{value:t.bridge.StrategyReactContext,children:t.custom?(0,ca.jsx)(l4,{...t.custom,children:t.children}):t.children})})})})})})})})})}var lf=_(V(),1);function Zv({annotation:t,target:e,children:n,dismissable:i,isOpen:a,onOpenChange:o,placement:s}){let u=Zh(),d=Kh(),{refs:p,floatingStyles:f,context:m}=n4({open:a,onOpenChange:o,nodeId:t.id,placement:s||"bottom",middleware:[Xv(10),wA(),MA({mainAxis:!0})],whileElementsMounted:Gv}),g=e4(m),{getReferenceProps:v,getFloatingProps:S}=i4([i?g:null].filter(R=>R!==null));return(0,lf.jsxs)(Ni,{relative:!0,target:e,interactive:!1,children:[(0,lf.jsx)("div",{ref:p.setReference,...v(),style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"}}),(0,s4.createPortal)((0,lf.jsx)(Jh,{bridge:u,custom:d,children:(0,lf.jsx)("div",{ref:p.setFloating,style:f,...S(),children:n})}),document.getElementById("atlas-floating-ui"))]})}var Wh=_(V(),1),c4=km()(t=>({isMenuOpen:!1,menuPosition:{x:0,y:0},setMenuPosition(e){t({menuPosition:e})},toggle(e){t(n=>({isMenuOpen:!n.isMenuOpen,menuPosition:e}))},open(e){t({isMenuOpen:!0,menuPosition:e})},setIsMenuOpen(e){t(typeof e=="function"?n=>({isMenuOpen:e(n.isMenuOpen)}):{isMenuOpen:e})},close(){t({isMenuOpen:!1})}}));function $h(t,e,n){let{isMenuOpen:i,setIsMenuOpen:a,close:o,open:s,menuPosition:u,setMenuPosition:d,toggle:p}=c4(),f=(0,u4.useCallback)(v=>{n&&(v.preventDefault(),v.stopPropagation(),p(v.atlas))},[p,n]);return[(0,Wh.jsx)(Wh.Fragment,{children:n&&i&&(0,Wh.jsx)(Zv,{dismissable:!0,placement:"bottom-start",isOpen:i,onOpenChange:a,annotation:{id:t},target:{x:u.x,y:u.y,height:1,width:1},children:i&&n({canvasId:e,position:u,close:()=>a(!1)})})}),{onContextMenu:f},{open:s,close:o,toggle:p,isMenuOpen:i,setIsMenuOpen:a,menuPosition:u,setMenuPosition:d}]}function zA(){let t=Ne();return St(t,e=>e.tool.requestId&&e.requests[e.tool.requestId]||null)}var ei=_(V(),1);function NA({theme:t,renderContextMenu:e,children:n}){let i=Ne(),a=_t(),o=St(i,M=>M.polygon),s=St(i,M=>M.polygonState.currentTool),u=St(i,M=>M.mode),d=St(i,M=>M.changeMode),p=St(i,M=>M.polygonState.transitioning),{enabled:f,requestId:m}=St(i,M=>M.tool),g=(0,Jv.useMemo)(()=>Sl(o),[o]),v=zA(),[S,R]=$h("editing-annotation",a?.id,e),T=v?.annotationPopup||n||(0,ei.jsx)(f4,{}),E=v?.svgTheme||t,x=()=>{d("sketch")};if(!f||!a||!m||!o)return null;let A=g&&o.id&&!p&&(s==="pointer"||s==="hand"||!o.open)?(0,ei.jsx)(Zv,{annotation:o,target:g,children:T}):null,C="shape";return u==="explore"?(0,ei.jsxs)(ei.Fragment,{children:[(0,ei.jsx)(C,{id:`shape-${o.id}`,points:o.points,open:o.open,onClick:x,relativeStyle:!0,target:{x:0,y:0,width:a.width,height:a.height},style:{":hover":{backgroundColor:"rgba(0,0,0,0.2)"},backgroundColor:"rgba(0,0,0,0)",borderWidth:"4px",borderColor:"rgba(255, 255, 255, .4)"},...R}),(0,ei.jsx)(C,{id:`shape-${o.id}`,points:o.points,open:o.open,onClick:x,relativeStyle:!0,target:{x:0,y:0,width:a.width,height:a.height},style:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(0, 0, 0, .4)"}}),A]}):(0,ei.jsxs)(ei.Fragment,{children:[e?(0,ei.jsx)(C,{id:`shape-${o.id}`,points:o.points,open:o.open,target:{x:0,y:0,width:a.width,height:a.height},...R}):null,(0,ei.jsx)(dL,{image:a,theme:E}),A,S]})}function f4(){let t=Ne(),e=St(t,s=>s.changeMode),n=St(t,s=>s.mode),i=St(t,s=>s.completeRequest),a=St(t,s=>s.tool),o=()=>{(0,Jv.startTransition)(()=>{i()})};return a.enabled?(0,ei.jsxs)("div",{className:"svg-tools-container animate-fadeIn",children:[n!=="sketch"&&(0,ei.jsx)("button",{className:"svg-tools-button",onClick:()=>{e("sketch")},children:"Edit"}),(0,ei.jsx)("button",{className:"svg-tools-button",onClick:o,children:"Save"})]}):null}var Nl=_(X(),1);var sf=_(X(),1);function TF(t){return t.type==="SpecificResource"?[t.source,{selector:t.selector}]:[t,{selector:null}]}function tp(t,e){let{selector:n,source:i}=nn(e);if(i.id!==t.id)return[null,i];let a={type:"BoxSelector",spatial:{x:0,y:0,width:Number(t.width),height:Number(t.height)}};return[n?n.type==="TemporalSelector"?{type:"TemporalBoxSelector",temporal:n.temporal,spatial:a.spatial}:n:null,i]}var IA={makeChoice:()=>{}},ep={type:"unknown"},Be=t=>({type:"unknown",reason:t,annotations:{pages:[]}}),DA=(t,e)=>({type:"empty",width:t,height:e,annotations:{pages:[]},image:null,images:[]});var np=_(X(),1);function CF(t,e){let n=t?.iiif?.meta[e];return n?n.annotationPageManager:null}function d4(t,e){return ie(n=>{let i=[];if(!t)return i;let a=Object.keys(n.iiif.entities.AnnotationPage);for(let o of a)if(!e||e.indexOf(o)!==-1){let s=CF(n,o);s&&s.views&&s.views[t]&&i.push(o)}return i},[t,e])}function LA({canvas:t,manifest:e,all:n,canvases:i}){let a=[];if(e)for(let o of e.annotations)a.indexOf(o.id)===-1&&a.push(o.id);if(n){if(i&&i.length)for(let o of i)for(let s of o.annotations)a.indexOf(s.id)===-1&&a.push(s.id)}else if(t)for(let o of t.annotations)a.indexOf(o.id)===-1&&a.push(o.id);return a}function wF(t,e){let n=t?.iiif?.meta[e];return n?n.annotationPageManager:null}function ip(t,e={}){let n=Ut(),i=an(),a=_t(),o=us(),s=(0,np.useMemo)(()=>LA({all:e.all,manifest:i,canvas:a,canvases:o}),[e.all,a,o,i]),u=d4(t,e.all?void 0:s),d=(0,np.useCallback)(f=>{t&&n.setMetaValue([f,"annotationPageManager","views"],m=>m&&!m[t]?m:{...m||{},[t]:!1})},[t,n]),p=(0,np.useCallback)((f,m={})=>{if(!t)return;let g=n.getState(),v=[];if(m?.deselectOthers){let S=Object.keys(g.iiif.entities.AnnotationPage);for(let R of S){let T=wF(g,R);T&&T.views&&T.views[t]&&v.push(R)}}for(let S of v)d(S);n.setMetaValue([f,"annotationPageManager","views"],S=>S&&S[t]?S:{...S||{},[t]:!0})},[t,d,n]);return{availablePageIds:s,enabledPageIds:u,setPageEnabled:p,setPageDisabled:d}}function BA(t,e){return ie((n,i)=>i.get(t.map(a=>({id:a,type:e}))),[t,e])}var h4=_(X(),1);var MF=Qi((t,e)=>({loaded:{},setLoaded:(n,i="done")=>{t(a=>({loaded:{...a.loaded,[n]:i}}))}})),OF=Ka();OF.on("loaded",t=>{MF.getState().setLoaded(t.imageServiceId)});function ap(){let t=Jc(),e=XD();return[(0,h4.useCallback)((i,{height:a,width:o})=>i&&t(i,{height:a,width:o},!0),[t]),e]}var Ws=_(X(),1);function hr(t={}){let e=wh(),n=_t(t.canvasId?{id:t.canvasId}:void 0);return ie((i,a)=>{if(!n)return[];if(e&&t.enableSingleAnnotation)return[e];let o=a.get(n.items),s=[];for(let u of o)s.push(...a.get(u.items));return s},[n])}function PA(t,e=[]){let n=Ut(),i=(0,Ws.useMemo)(()=>Kc(n),[]),a=hr({enableSingleAnnotation:t?.enableSingleAnnotation}),[o,s]=(0,Ws.useState)(t?.defaultChoices||[]),u=(0,Ws.useMemo)(()=>i.getPaintables(a,o),[n,a,o,...e]),p={makeChoice:(0,Ws.useCallback)((f,{deselectOthers:m=!0,deselect:g=!1}={})=>{u.choice&&s(v=>{if(g){let R=v.filter(T=>T!==f);if(R.length===0){let T=u.items[0].resource.id;return T?[T]:[]}return R}if(m)return[f];let S=[...v];if(S.length===0&&u.items.length){let R=u.items[0].resource.id;R&&S.push(R)}return v.indexOf(f)!==-1?v:[...v,f]})},[u.choice])};return[u,p]}var _F=["model/gltf-binary"];function HA(t,e){let n=e.items[0],i=n.resource;return i.format?_F.indexOf(i.format)===-1?Be(`3D format: ${i.format} is unsupported`):{type:"3d-model",model:i,annotationId:n.annotationId,annotation:n.annotation}:Be("Unknown format")}function Wv(t,e){let n=e.items,i=n[0];if(n.length===0||!i)return Be("No audio");if(!t.duration)return Be("No duration on canvas");if(n.length>1)return Be("Only one audio source supported");let a=i.resource;return a?("format"in a||(a.format="audio/mpeg"),{type:"media",media:{annotationId:i.annotationId,annotation:i.annotation,duration:t.duration,url:a.id,type:"Sound",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:t.duration}},format:a.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:t.duration}}},annotations:{pages:[]}}):Be("Unknown audio")}function op(t,e,n){let i=[],a=[];for(let o of e.items){let s=o.resource&&o.resource.type==="SpecificResource"?o.resource.source:o.resource;if(!s.id)return Be("No resource Identifier");let u;if(s.service){let T=jr(s);T[0]&&(u=n(T[0],t))}let d={type:"BoxSelector",spatial:{x:0,y:0,width:Number(t.width),height:Number(t.height)}},[p,f]=tp(t,o.target),m=t.id?.split("?")[0]||"";if(!(f.id===t.id||decodeURIComponent(f.id||"")===(t.id||"")||f.id===m||decodeURIComponent(f.id||"")===m))continue;let g=o.resource.width&&o.resource.height?{type:"BoxSelector",spatial:{x:0,y:0,width:o.resource.width,height:o.resource.height}}:void 0,v=o.resource.type==="SpecificResource"?nn(o.resource):null;if(o.selector){let T=nn({type:"SpecificResource",source:o.resource,selector:o.selector});T&&(v=T)}let S=v&&v.selector&&(v.selector.type==="BoxSelector"||v.selector.type==="TemporalBoxSelector")?{type:"BoxSelector",spatial:{x:v.selector.spatial.x,y:v.selector.spatial.y,width:v.selector.spatial.width,height:v.selector.spatial.height}}:void 0;u&&!u.id&&(u.id=u["@id"]);let R={id:s.id,type:"Image",annotationId:o.annotationId,annotation:o.annotation,width:Number(p||S?s.width:t.width),height:Number(p||S?s.height:t.height),service:u,sizes:u&&u.sizes?u.sizes:s.width&&s.height?[{width:s.width,height:s.height}]:[],target:p&&p.type!=="PointSelector"?p:d,selector:S||{type:"BoxSelector",spatial:{x:0,y:0,width:Number(t.width),height:Number(t.height)}},annotationPages:o.resource.annotations||[]};i.push(R)}return{type:"images",image:i[0],images:i,choice:e.choice}}function p4(t,e={},n){let i=t.language||n||"none";switch(t.type){case"TextualBody":{typeof t.value<"u"&&(e[i]=[t.value]);break}case"List":case"Composite":case"Choice":t.items&&t.items.forEach(a=>p4(a,e,i))}return e}function rp(t,e){let n=[];return e.items.forEach(i=>{if(i.resource){let[a]=tp(t,i.target);n.push({type:"Text",annotationId:i.annotationId,annotation:i.annotation,text:p4(i.resource),target:a})}}),{type:"textual-content",items:n}}var zF=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;function lp(t,e,n){let i=e.items.filter(v=>v.type==="video"),a=i[0],o=!1;if(t.duration||(o=!0),i.length>1||!a)return Be("Only one video source supported");let s=i[0]?.resource,u=!!(s.service||[]).find(v=>(v.profile||"").includes("youtube.com"));if(!u&&o)return Be("Video does not have duration");if(!s)return Be("Unknown video");if((!s.format||s.format==="text/html")&&!u)return Be("Video does not have format");let d=[],p=n.get(t.annotations||[]);for(let v of p){let S=n.get(v.items||[]);for(let R of S)if((R.motivation?Array.isArray(R.motivation||"")?R.motivation:[R.motivation]:[]).includes("supplementing")){let E=n.get(R.body||[]);for(let x of E){let A=x;if(A.type==="Choice")for(let C of A.items){let M=n.get(C);M.format==="text/vtt"&&d.push({id:M.id,type:"Text",format:"text/vtt",label:M.label,language:M.language})}else A.format==="text/vtt"&&d.push({id:A.id,type:"Text",format:"text/vtt",label:A.label,language:A.language})}}}let f={annotationId:a.annotationId,annotation:a.annotation,duration:t.duration,url:s.id,type:"Video",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:t.duration}},format:s.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:t.duration}}},m=nn(a.target);m.selector&&m.selector.type==="TemporalBoxSelector"&&(f.target=m.selector);let{selector:g}=Do(a.selector);if(g===null){let v=f.target.temporal.startTime,R=(f.target.temporal.endTime||t.duration)-v;f.selector={type:"TemporalSelector",temporal:{startTime:0,endTime:R}}}else g.type==="TemporalSelector"&&(f.selector=g);if(u){f.type="VideoYouTube";let v=s.id.match(zF);if(!v[1])return Be("Video is not known youtube video");f.youTubeId=v[1]}return{type:"media",media:f,annotations:{pages:[]},captions:d}}function UA(t,e,n,i){let a={type:"complex-timeline",items:[],keyframes:[],highlights:[],duration:t.duration||0},o={type:"complex-choice",items:[]},s=i.get(t.annotations);function u(f){f.choice&&(f.choice.type==="complex-choice"?o.items.push(...f.choice.items):o.items.push(f.choice))}for(let f of e.items){if(f.type==="image"){let m=op(t,{choice:null,allChoices:null,types:["image"],items:[f]},n);if(m.type==="images"){u(m),a.items.push(m.image);let g={id:m.image.annotationId,type:"enter",resourceType:"image",time:m.image.target?.temporal?.startTime||0};a.keyframes.push(g);let v={id:m.image.annotationId,type:"exit",resourceType:"image",time:m.image.target?.temporal?.endTime||t.duration||0};a.keyframes.push(v)}}if(f.type==="textualbody"){let m=rp(t,{choice:null,allChoices:null,types:["textualbody"],items:[f]});if(m.type==="textual-content"){u(m);let g=m.items[0];a.items.push(g);let v=g.target,S={id:g.annotationId,type:"enter",resourceType:"text",time:v.temporal?.startTime||0};a.keyframes.push(S);let R={id:g.annotationId,type:"exit",resourceType:"text",time:v.temporal?.endTime||t.duration||0};a.keyframes.push(R)}}if(f.type==="video"){let m=lp(t,{choice:null,allChoices:null,types:["video"],items:[f]},i);if(m.type==="media"){u(m);let g=m.media;a.items.push(g);let v={id:g.annotationId,type:"enter",resourceType:"video",time:g.target?.temporal?.startTime||0};a.keyframes.push(v);let S={id:g.annotationId,type:"exit",resourceType:"video",time:g.target?.temporal?.endTime||t.duration||0};a.keyframes.push(S)}}if(f.type==="audio"||f.type==="sound"){let m=Wv(t,{choice:null,allChoices:null,types:["audio"],items:[f]});if(m.type==="media"){u(m);let g=m.media;a.items.push(g);let v={id:g.annotationId,type:"enter",resourceType:"audio",time:g.target?.temporal?.startTime||0};a.keyframes.push(v);let S={id:g.annotationId,type:"exit",resourceType:"audio",time:g.target?.temporal?.endTime||t.duration||0};a.keyframes.push(S)}}}for(let f of s)for(let m of f.items){let g=i.get(m),v=nn(g.target,{typeMap:i.getState?.().iiif.mapping});if(v.selector?.temporal){let S={id:g.id,type:"enter",resourceType:"highlight",time:v.selector.temporal.startTime||0};a.keyframes.push(S);let R={id:g.id,type:"exit",resourceType:"highlight",time:v.selector.temporal.endTime||t.duration||0};a.keyframes.push(R)}a.highlights.push({annotation:g,target:v})}a.keyframes.sort((f,m)=>f.time-m.time);let d=[],p=[];for(let f of a.keyframes){if(f.resourceType==="image"||f.resourceType==="text"||f.resourceType==="highlight"){p.push(f);continue}if(f.type==="enter"){d.length===0&&(f.isPrime=!0),d.push(f),p.push(f);continue}if(f.type==="exit"&&(p.push(f),d=d.filter(m=>m.id!==f.id),d.length!==0)){let m=d[0],g={id:m.id,type:"change",isPrime:!0,resourceType:m.resourceType,time:f.time};p.push(g)}}return a.keyframes=p,o.items.length&&(a.choice=o),a}var $v={},VA={get(t){return t},setMetaValue([t,e,n],i){let a=VA.getResourceMeta(t,e),o=a?a[n]:void 0,s=typeof i=="function"?i(o):i;$v[t]={...$v[t]||{},[e]:{...($v[t]||{})[e]||{},[n]:s}}},getResourceMeta:(t,e)=>{let n=$v[t];if(n)return e?n[e]:n},async load(t){let e=typeof t=="string"?t:t.id;return fetch(e).then(n=>n.json())},requestStatus(t){}};function sp({canvas:t,paintables:e,supports:n,loadImageService:i,vault:a=VA}){if(!t)return ep;if(e.types.length===0)return n.indexOf("empty")!==-1?DA(t.width,t.height):ep;if(e.types.length!==1)if(e.types.length===2&&e.types.indexOf("text")!==-1)e.types=e.types.filter(s=>s!=="text");else return n.indexOf("complex-timeline")===-1?Be("Complex timeline not supported"):UA(t,e,i,a);let o=e.types[0];return o==="image"?n.indexOf("images")===-1?Be("Image not supported"):op(t,e,i):o==="Model"||o==="model"?n.indexOf("3d-model")===-1?Be("3D not supported"):HA(t,e):o==="textualbody"?n.indexOf("textual-content")===-1?Be("Textual content not supported"):rp(t,e):o==="sound"||o==="audio"?n.indexOf("media")===-1?Be("Media not supported"):Wv(t,e):o==="video"?n.indexOf("media")===-1?Be("Media not supported"):lp(t,e,a):ep}function jA(t){let e=an(),n=_t(),i=Ut(),a=Qh(),o=t?.emitter||a,[s,u]=ap(),{enabledPageIds:d}=ip(t?.annotationPageManagerId||e?.id||n?.id,{all:!1}),p=BA(d,"AnnotationPage"),f=t?.strategies||["empty","images","media","textual-content","complex-timeline"],[m,g]=PA(t,[u]);(0,sf.useEffect)(()=>{let S=R=>{g.makeChoice(R.choiceId,{deselectOthers:R.deselectOthers,deselect:R.deselect})};return o.on("make-choice",S),()=>{o.off("make-choice",S)}},[]);let v=(0,sf.useMemo)(()=>sp({canvas:n,paintables:m,supports:f,loadImageService:s,vault:i}),[n,m,i,g.makeChoice]);return(0,sf.useEffect)(()=>{let S=m.allChoices,R={canvasId:n?.id,manifestId:e?.id};S&&o.emit("choice-change",{choice:S,partOf:R})},[n?.id,m.allChoices]),(0,sf.useMemo)(()=>v.type==="unknown"?[v,IA]:[{...v,annotations:{pages:p}},g],[v,p])}var qA=_(V(),1);function FA({strategies:t,registerActions:e,defaultChoices:n,onChoiceChange:i,mediaControlsDeps:a,renderMediaControls:o,renderViewerControls:s,viewControlsDeps:u,renderComplexTimelineControls:d,complexTimelineControlsDeps:p,throwOnUnknown:f,children:m}){let g=_t(),v=Ut(),S=(0,Nl.useMemo)(()=>bl(v),[v]),[R,T]=jA({strategies:t||["images"],defaultChoices:n?.map(({id:C})=>C)}),E="choice"in R?R.choice:void 0;if((0,Nl.useEffect)(()=>{e&&e(T)},[R.annotations]),(0,Nl.useEffect)(()=>{i&&i(E)},[E]),(0,Nl.useEffect)(()=>{if(n)for(let C of n)typeof C.opacity<"u"&&S.applyStyles({id:C.id},"atlas",{opacity:C.opacity})},[n]),R.type==="unknown"&&f)throw new Error(R.reason||"Unknown strategy");let x=(0,Nl.useMemo)(()=>({renderMediaControls:o,mediaControlsDeps:a||[],renderViewerControls:s,viewControlsDeps:u||[],renderComplexTimelineControls:d,complexTimelineControlsDeps:p||[]}),[a,o,s,u,d,p]),A=(0,Nl.useMemo)(()=>({strategy:R,actions:T,choices:"choice"in R?R.choice:[]}),[R,g]);return(0,qA.jsx)(Nh.Provider,{value:x,children:(0,qA.jsx)(Rl.Provider,{value:A,children:m})})}var up=_(X(),1);var uf=_(X(),1);var GA=(0,uf.createContext)(()=>{});function m4(t){let e=_t(),n=(0,uf.useContext)(GA);(0,uf.useEffect)(()=>e&&e.id?(n(e.id,t),()=>n(e.id,-1)):()=>{},[e,t])}var g4=_(V(),1);function kA({x:t=0,y:e=0,keepCanvasScale:n=!0,renderContextMenu:i,children:a}){let{strategy:o}=Fe(),s=_t(),u=Ne(),d=Oh(s,["deep-zoom"]),p=St(u,R=>R.setCanvasRelativePosition),f=St(u,R=>R.clearCanvasRelativePosition),[m,g]=$h(`context-menu/${s?.id}`,s?.id,i),v=(0,up.useMemo)(()=>n?1:Math.max(1,...o.type==="images"?o.images.map(R=>(R.width||0)/R.target?.spatial.width):[]),[n,o]);(0,up.useEffect)(()=>{if(s)return p(s.id,{x:t,y:e,width:s.width,height:s.height}),()=>{f(s.id)}},[t,e,s,f,p]),(0,up.useEffect)(()=>{s&&u.getState().reset()},[u,s]),m4(v);let S=o.type==="images"?o.images.length:0;return s?(0,g4.jsxs)("world-object",{height:s.height,width:s.width,x:t,y:e,...g,...d,children:[m,a]},`${s.id}/${o.type}/${S}`):null}var mi=_(V(),1);function Fs({x:t,y:e,onChoiceChange:n,registerActions:i,defaultChoices:a,isStatic:o,renderViewerControls:s,renderMediaControls:u,renderComplexTimelineControls:d,complexTimelineControlsDeps:p,viewControlsDeps:f,mediaControlsDeps:m,strategies:g,throwOnUnknown:v,backgroundStyle:S,alwaysShowBackground:R,keepCanvasScale:T=!1,enableSizes:E=!1,enableYouTube:x=!0,onClickPaintingAnnotation:A,components:C={},children:M,annotationPopup:I,svgTheme:z,renderContextMenu:D,renderAnnotationContextMenu:k}){return(0,mi.jsxs)(FA,{throwOnUnknown:v,onChoiceChange:n,registerActions:i,strategies:g,defaultChoices:a,mediaControlsDeps:m,renderMediaControls:u,renderViewerControls:s,renderComplexTimelineControls:d,complexTimelineControlsDeps:p,viewControlsDeps:f,children:[(0,mi.jsxs)(kA,{keepCanvasScale:T,x:t,y:e,renderContextMenu:D,children:[(0,mi.jsx)(lA,{alwaysShowBackground:R,backgroundStyle:S}),(0,mi.jsx)(rA,{}),(0,mi.jsx)(uA,{}),(0,mi.jsx)(sA,{isStatic:o,enableSizes:E,onClickPaintingAnnotation:A}),(0,mi.jsx)(JR,{}),(0,mi.jsx)(kR,{}),(0,mi.jsx)(tA,{as:C.Audio}),(0,mi.jsx)(fA,{as:C.Video}),x?(0,mi.jsx)(dA,{}):null,(0,mi.jsx)(NA,{theme:z,renderContextMenu:k,children:I}),M]}),(0,mi.jsx)(YR,{})]})}var YA=_(V(),1);function y4(t){let e=_t();return!e||!e.placeholderCanvas?null:(0,YA.jsx)(Sa,{canvas:e.placeholderCanvas.id,children:(0,YA.jsx)(Fs,{renderViewerControls:t.renderViewerControls})})}var gi=_(X(),1);var fa=_(X()),NF=(0,fa.createContext)(null),QA={didCatch:!1,error:null},cf=class extends fa.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=QA}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(e!==null){for(var n,i,a=arguments.length,o=new Array(a),s=0;s<a;s++)o[s]=arguments[s];(n=(i=this.props).onReset)===null||n===void 0||n.call(i,{args:o,reason:"imperative-api"}),this.setState(QA)}}componentDidCatch(e,n){var i,a;(i=(a=this.props).onError)===null||i===void 0||i.call(a,e,n)}componentDidUpdate(e,n){let{didCatch:i}=this.state,{resetKeys:a}=this.props;if(i&&n.error!==null&&IF(e.resetKeys,a)){var o,s;(o=(s=this.props).onReset)===null||o===void 0||o.call(s,{next:a,prev:e.resetKeys,reason:"keys"}),this.setState(QA)}}render(){let{children:e,fallbackRender:n,FallbackComponent:i,fallback:a}=this.props,{didCatch:o,error:s}=this.state,u=e;if(o){let d={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")u=n(d);else if(i)u=(0,fa.createElement)(i,d);else if(a===null||(0,fa.isValidElement)(a))u=a;else throw s}return(0,fa.createElement)(NF.Provider,{value:{didCatch:o,error:s,resetErrorBoundary:this.resetErrorBoundary}},u)}};function IF(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.length!==e.length||t.some((n,i)=>!Object.is(n,e[i]))}var t0=_(X(),1);function v4(t,e=2e3){let{currentSequenceIndex:n,sequence:i,items:a}=ds(),o=_t(),s=(0,t0.useMemo)(()=>{let d=i[n]||[];return d.length===0&&o?[{id:o.id,type:"Canvas"}]:d.map(p=>a[p])},[i,n,o,a]),u=Ne();(0,t0.useEffect)(()=>{let p=setInterval(()=>{if(t&&e!==-1){let f={x:t.x,y:t.y,width:t.width,height:t.height},m=u.getState().canvasRelativePositions,g={};for(let v of s){let S=m[v.id];if(S){let R=S.x,T=S.y,E=S.width,x=S.height,A={x:Math.max(R,f.x),y:Math.max(T,f.y),width:Math.min(R+E,f.x+f.width)-Math.max(R,f.x),height:Math.min(T+x,f.y+f.height)-Math.max(T,f.y)};A.width<=0||A.height<=0||(g[v.id]={x:A.x-S.x,y:A.y-S.y,width:A.width,height:A.height}),u.setState({canvasViewports:g})}}}},e);return()=>{clearTimeout(p)}},[s,t,u,e])}var ff=_(V(),1);function e0({width:t,style:e,height:n,error:i,resetErrorBoundary:a}){return(0,ff.jsxs)("div",{style:{width:t,height:n,minHeight:500,...e||{},background:"#f9f9f9"},children:[(0,ff.jsx)("h3",{children:"Error occurred"}),(0,ff.jsx)("p",{children:i.message}),(0,ff.jsx)("button",{type:"button",onClick:a,children:"Reset"})]})}var ke=_(V(),1);function n0(t){let e=Ne();return(0,ke.jsx)(Yc,{name:t.name,existing:e,children:(0,ke.jsx)(DF,{...t})})}function DF({name:t,children:e,errorFallback:n,outerContainerProps:i={},worldScale:a,updateViewportTimeout:o,...s}){let u=Ne(),d=St(u,lt=>lt.mode),p=St(u,lt=>lt.setAtlasRuntime),[f,m]=(0,gi.useState)(),g=Kh(),v=Zh(),S=n||e0,[R,T]=(0,gi.useState)({}),E=Object.entries(R),[x,A]=(0,gi.useState)({}),C=Object.entries(x),[M,I]=(0,gi.useState)({}),{worldScale:z,runtimeOptions:D}=(0,gi.useMemo)(()=>{if(Object.values(M).length===0)return{worldScale:1,runtimeOptions:s.runtimeOptions||{maxOverZoom:1}};let et=Math.max(...Object.values(M));return{worldScale:et,runtimeOptions:{maxOverZoom:et||1,...s.runtimeOptions||{}}}},[M,s.runtimeOptions]);v4(f?.runtime,o);let k=(0,gi.useCallback)((lt,et)=>{I($=>{if(et===-1){let{[lt]:ht,...bt}=$;return bt}return{...$,[lt]:et}})},[]),B=(0,gi.useCallback)((lt,et,$)=>{T(({[lt]:ht,...bt})=>et?{...bt,[lt]:{element:et,props:$}}:bt)},[]),Q=(0,gi.useCallback)((lt,et,$)=>{A(({[lt]:ht,...bt})=>et?{...bt,[lt]:{element:et,props:$}}:bt)},[]),it=(0,gi.useCallback)(lt=>{m(lt),p(lt.runtime),s.onCreated&&s.onCreated(lt)},[s.onCreated,p]);return(0,ke.jsxs)(cf,{resetKeys:[],fallbackRender:lt=>(0,ke.jsx)(S,{...s,...lt}),children:[(0,ke.jsx)(kI,{...s,mode:d,containerProps:{style:{position:"relative"},...s.containerProps||{}},htmlChildren:(0,ke.jsx)(ke.Fragment,{children:E.map(([lt,{element:et,props:$}])=>(0,ke.jsx)(gi.default.Fragment,{children:(0,ke.jsx)(et,{...$||{}})},lt))}),onCreated:it,runtimeOptions:D,children:(0,ke.jsx)(Yc,{name:t,existing:u,children:(0,ke.jsx)(Wa.Provider,{value:f,children:(0,ke.jsx)(GA.Provider,{value:k,children:(0,ke.jsx)(jR.Provider,{value:B,children:(0,ke.jsx)(qR.Provider,{value:Q,children:(0,ke.jsx)(Jh,{bridge:v,custom:g,children:(0,ke.jsx)(ZR,{children:e})})})})})})})}),(0,ke.jsx)("div",{children:C.map(([lt,{element:et,props:$}])=>(0,ke.jsx)(gi.default.Fragment,{children:(0,ke.jsx)(et,{...$||{}})},lt))}),(0,ke.jsx)("div",{id:"atlas-floating-ui",style:{position:"relative",zIndex:999999}})]})}var ni=_(V(),1),LF=(0,$s.forwardRef)(function(e,n){let i=an(),a=us(),o=ds(),{ViewerControls:s,MediaControls:u,ComplexTimelineControls:d}=e.components||{};if((0,$s.useImperativeHandle)(n,()=>o,[o]),!i)return(0,ni.jsx)("div",{});let p=0,f=i.viewingDirection==="top-to-bottom",m=i.viewingDirection==="bottom-to-top",g=i.viewingDirection==="left-to-right",v=i.viewingDirection==="right-to-left",R=i.behavior.includes("continuous")?0:e.spacing||0,T=m||v,E=(0,$s.useMemo)(()=>T?[...a].reverse():a,[a,T]);return(0,ni.jsxs)(ni.Fragment,{children:[e.header,(0,ni.jsx)(Mn.Viewer,{height:e.height,mode:e.mode,renderPreset:e.renderPreset,runtimeOptions:e.runtimeOptions,updateViewportTimeout:e.updateViewportTimeout,children:E.map((x,A)=>{let C=0,M=0;return!f&&!m?(C=p,p+=x.width+R):(M=p,p+=x.height+R),(0,ni.jsx)(Sa,{canvas:x.id,children:(0,ni.jsx)(Mn.RenderCanvas,{strategies:["3d-model","media","images","empty","textual-content","complex-timeline"],renderViewerControls:A===0&&s?()=>(0,ni.jsx)(s,{}):void 0,renderMediaControls:A===0&&u?()=>(0,ni.jsx)(u,{}):void 0,annotationPopup:e.annotationPopup,renderContextMenu:e.renderContextMenu,keepCanvasScale:e.keepCanvasScale,renderComplexTimelineControls:A===0&&d?()=>(0,ni.jsx)(d,{}):void 0,renderAnnotationContextMenu:e.renderAnnotationContextMenu,x:C,y:M,svgTheme:e.svgTheme,...e.canvasProps||{},children:e.annotations},x.id)},x.id)})},e.reuseAtlas?"":o.currentSequenceIndex),e.children]})}),Mn=(0,$s.forwardRef)(function({children:e,height:n,annotations:i,canvasProps:a,spacing:o,header:s,components:u,mode:d,reuseAtlas:p,renderPreset:f,runtimeOptions:m,annotationPopup:g,name:v,svgTheme:S,updateViewportTimeout:R,renderContextMenu:T,keepCanvasScale:E,renderAnnotationContextMenu:x,...A},C){let M=cs();return(0,ni.jsx)(Yc,{name:v,children:(0,ni.jsx)(ls,{vault:M,children:(0,ni.jsx)(Sb,{...A,children:(0,ni.jsx)(LF,{ref:C,height:n,components:u,spacing:o,canvasProps:a,annotations:i,header:s,mode:d,reuseAtlas:p,renderPreset:f,runtimeOptions:m,annotationPopup:g,svgTheme:S,updateViewportTimeout:R,renderContextMenu:T,keepCanvasScale:E,renderAnnotationContextMenu:x,children:e})})})})});Mn.RenderImage=wl;Mn.RenderCanvas=Fs;Mn.RenderAnnotationPage=xl;Mn.RenderAnnotation=Vs;Mn.Viewer=n0;Mn.CanvasBackground=Iv;Mn.Audio=Sv;Mn.Video=Lv;Mn.Model=Ev;Mn.AudioHTML=FR;Mn.VideoHTML=cA;Mn.ModelHTML=GR;Mn.PlaceholderCanvas=y4;Mn.getAtlasStoreByName=OR;var S4=_(X(),1);var La=_(X(),1);function XA(t){let[e,n]=(0,La.useState)(0),i=Ne(),a=St(i,M=>M.tool.enabled),o=St(i,M=>M.tool.requestId),s=St(i,M=>M.getRequestId),u=St(i,M=>M.requestAnnotation),d=St(i,M=>M.completeRequest),p=St(i,M=>M.cancelRequest),f=(0,La.useRef)(t?.onSuccess);f.current=t?.onSuccess;let[m,g]=(0,La.useState)(!1),[v,S]=(0,La.useState)(null),[R,T]=(0,La.useState)(null),E=a&&o!==R,x=a&&o===R,A=(0,La.useCallback)(async(M,I)=>{if(R){let z=f.current;g(!0);let D=await u(M,{...I,requestId:R});if(D)return z?.(D),n(B=>B+1),g(!1),S(D),D;let k={id:R,cancelled:!0,...Th(M)};return z?.(k),S(k),n(B=>B+1),g(!1),k}return null},[u,R]),C=(0,La.useCallback)(()=>{S(null),g(!1)},[]);return(0,La.useEffect)(()=>{let M=s();return T(M.requestId),()=>{M.clear()}},[e]),{id:e,busy:E,isPending:m,isActive:x,requestId:R,requestAnnotation:A,cancelRequest:()=>R?p(R):void 0,completeRequest:()=>R?d(R):void 0,reset:C,data:v}}var BF=[{name:"Default",outer:{borderWidth:4,borderColor:"rgba(255, 255, 255, .4)"},inner:{borderWidth:2,borderColor:"#000"}},{name:"High contrast",outer:{borderWidth:3,borderColor:"#fff"},inner:{borderWidth:1,borderColor:"#000"}},{name:"Lightsaber",outer:{borderWidth:"4",borderColor:"rgba(56,68,255,0.64)"},inner:{borderWidth:"2",borderColor:"#fff"}},{name:"Bright",outer:{borderWidth:"6",borderColor:"#25d527"},inner:{borderWidth:"3",borderColor:"#a916ff"}},{name:"pink",outer:{borderWidth:"4",borderColor:"#ff00ff"},inner:{borderWidth:"2",borderColor:"#ffffff"}},{name:"fine (dark)",outer:{borderWidth:"1",borderColor:"#000000"},inner:{}},{name:"fine (light)",outer:{borderWidth:"1",borderColor:"#FFF"},inner:{}}];function KA(t){let{id:e,data:n,requestAnnotation:i,cancelRequest:a,isPending:o}=XA({onSuccess:s=>{t.updateShape(s.polygon)}});return(0,S4.useEffect)(()=>(i({type:"polygon",open:t.shape?.open,points:t.shape?.points}),()=>{a()}),[]),null}var Xn=_(X(),1);var b4=_(V(),1),i0=(0,Xn.createContext)(Ka());i0.displayName="SelectorHelper";function PF({children:t}){return(0,b4.jsx)(i0.Provider,{value:(0,Xn.useMemo)(()=>Ka(),[]),children:t})}function HF(){return(0,Xn.useContext)(i0)}function ZA(t){let e=JA(),[n,i]=(0,Xn.useState)(!1);(0,Xn.useEffect)(()=>e.withSelector(t).on("highlight",()=>{i(!0)}),[e,t]),(0,Xn.useEffect)(()=>e.withSelector(t).on("clear-highlight",()=>{i(!1)}),[e,t]);let a=(0,Xn.useCallback)(s=>{e.emit("click",{selectorId:t,event:s})},[t,e]),o=(0,Xn.useCallback)(s=>{e.emit("hover",{selectorId:t,event:s})},[t,e]);return{controller:e,onClick:a,onHover:o,isHighlighted:n}}function JA(){let t=(0,Xn.useContext)(i0);return(0,Xn.useMemo)(()=>({withSelector(e){return{on(n,i){let a=o=>{o&&o.selectorId===e&&i(o)};return t.on(n,a),()=>{t.off(n,a)}},emit(n,i){t.emit(n,{...i,selectorId:e})}}},on(e,n){return t.on(e,n),()=>{t.off(e,n)}},emit(e,n){t.emit(e,n)}}),[t])}function UF(){let t=JA();return(0,Xn.useMemo)(()=>({withSelector(e){return{highlight(){t.emit("highlight",{selectorId:e})},clearHighlight(){t.emit("clear-highlight",{selectorId:e})},zoomTo(){t.emit("zoom-to",{selectorId:e})},addEventListener(n,i){return t.emit("event-listener",{selectorId:e,name:n,callback:i}),()=>{t.emit("remove-event-listener",{selectorId:e,name:n,callback:i})}},getImagePreview(){return new Promise((n,i)=>{t.emit("image-preview-request",{selectorId:e,resolve:n,reject:i})})},on(n,i){return t.withSelector(e).on(n,i)}}},highlight(e){t.emit("highlight",{selectorId:e})},clearHighlight(e){t.emit("clear-highlight",{selectorId:e})},zoomTo(e){t.emit("zoom-to",{selectorId:e})},addEventListener(e,n,i){return t.emit("event-listener",{selectorId:e,name:n,callback:i}),()=>{t.emit("remove-event-listener",{selectorId:e,name:n,callback:i})}},getImagePreview(e){return new Promise((n,i)=>{t.emit("image-preview-request",{selectorId:e,resolve:n,reject:i})})},on(e,n){return t.on(e,n)}}),[t])}var WA=_(V(),1);function VF(t){let e=_t(),n=t.annotationBucket,i=t.readOnly,a=t.id,{onClick:o,isHighlighted:s}=ZA(t.id),u=Ch(),d=s?u.highlighted:u[n||"hidden"]||u.hidden;if(!e)return null;if(i){let p="shape",f=t.polygon,m=f.open;return f?(0,WA.jsx)(p,{id:`shape-${a}`,points:f.points,open:m,onClick:o,relativeStyle:!0,target:{x:0,y:0,width:e.width,height:e.height},style:d}):null}return(0,WA.jsx)(KA,{image:e,shape:t.polygon||{id:t.id,open:!0,points:[]},updateShape:t.updatePolygon,theme:t.theme,controlsHtmlId:t.controlsHtmlId,renderControls:t.renderControls})}var a0=_(X(),1),cp=_(V(),1),jF=(0,a0.forwardRef)(function({canvasId:e},n){let i=uv(),a=ip(e||i?.id),o=Ut();return(0,a0.useImperativeHandle)(n,()=>a,[e,i]),!i||a.enabledPageIds.length===0?null:(0,cp.jsx)(cp.Fragment,{children:a.enabledPageIds.map(s=>(0,cp.jsx)(Mn.RenderAnnotationPage,{page:o.get(s)},s))})});var E4=_(X(),1);var x4=_(X(),1);var Sn=_(V(),1);function fp({metadata:t=[],config:e,labelWidth:n=16,showEmptyMessage:i=!0,allowHtml:a,emptyFallback:o,classes:s={},emptyMessage:u="No metadata available",emptyValueFallback:d="No value",emptyLabelFallback:p="",separator:f,tableFooter:m,tableHeader:g,customLabelRender:v,customValueRender:S}){let R=(0,x4.useMemo)(()=>{let E=(e||[]).reduce((A,C)=>[...A,...C.keys],[]),x={};for(let A of t){let C=A?.label?Object.values(A.label):[];for(let M of C)if(M?.length&&(E.indexOf(`metadata.${M[0]}`)!==-1||E.length===0)&&A){let I=`metadata.${M[0]}`;x[I]=x[I]?x[I]:[],x[I].push(A);break}}return x},[e,t]);return Object.keys(R).length===0&&i?(0,Sn.jsx)(Sn.Fragment,{children:o})||(0,Sn.jsx)("div",{className:s.empty,children:u}):e?.length?(0,Sn.jsxs)("table",{className:s.container,children:[g,(0,Sn.jsx)("tbody",{children:e.map((E,x)=>{let A=[];for(let M of E.keys)for(let I of R[M]||[]){let z=(0,Sn.jsx)(sa,{enableDangerouslySetInnerHTML:a,defaultText:d,separator:f,children:I.value},x+"__"+M);S?A.push(S(I,z)):A.push(z)}if(A.length===0)return null;let C=(0,Sn.jsx)(sa,{enableDangerouslySetInnerHTML:a,separator:f,defaultText:p,children:E.label});return(0,Sn.jsxs)("tr",{className:s.row,children:[(0,Sn.jsx)("td",{className:s.label,style:n?{minWidth:n}:{},children:v?v(E.label,C):C}),(0,Sn.jsx)("td",{className:s.value,children:A})]},x)})}),m]}):(0,Sn.jsxs)("table",{className:s.container,children:[g,(0,Sn.jsx)("tbody",{children:t?.length?t.map((E,x)=>{if(!E)return null;let A=(0,Sn.jsx)(sa,{enableDangerouslySetInnerHTML:a,defaultText:d,separator:f,children:E.label}),C=(0,Sn.jsx)(sa,{enableDangerouslySetInnerHTML:a,defaultText:d,separator:f,children:E.value});return(0,Sn.jsxs)("tr",{className:s.row,children:[(0,Sn.jsx)("td",{className:s.label,style:n?{minWidth:n}:{},children:v?v(E.label,A):A}),(0,Sn.jsx)("td",{className:s.value,children:S?S(E,C):C})]},x)}):null}),m]})}var R4=_(V(),1);function qF(t){let e=an(),n=_t(),i=ed(),a=(0,E4.useMemo)(()=>{let o=e?.metadata||[],s=n?.metadata||[],u=i?.metadata||[];return[...o,...s,...u]},[e,n,i]);return(0,R4.jsx)(fp,{metadata:a,...t})}var r0=_(X(),1);var A4=_(X(),1);function o0(t,e={},n=[]){return(0,A4.useMemo)(()=>{if(!t)return null;let i=e.quality;t&&t.extraQualities&&e.quality&&(t.extraQualities.includes(e.quality)||(i="default"));let a=ag(t);return ig({identifier:a.identifier,server:a.server,scheme:a.scheme,type:"image",size:{max:!e.size?.width&&!e.size?.height,confined:!1,upscaled:!1,...e.size||{}},format:e.format||"jpg",region:e.region||{full:!0},rotation:e?.rotation?Number.isInteger(e.rotation)?{angle:e.rotation}:e.rotation:{angle:0},quality:i||"default",prefix:a.prefix,originalPath:a.originalPath})},[...n])}var dp=_(V(),1);function FF(t){let e=typeof t.src=="string"?t.src:t.src.id,n=Ih(),[i,a]=(0,r0.useState)(!1),o;if(e){let u=n.loadServiceSync({id:e});u&&(o=u)}!o&&!i&&n.loadService({id:e}).then(()=>{a(!0)});let s=o0(o,{size:t.size,selector:t.region,rotation:t.rotation,format:t.format,region:t.region,quality:t.quality},[i,t.src,t.size,t.region,t.rotation,t.format,t.region,t.quality]);return(0,r0.useEffect)(()=>()=>{a(!1)},[e]),s?(0,dp.jsx)("img",{src:s,alt:t.alt,className:t.className,style:t.style}):(0,dp.jsx)(T4,{...t,fetchImageService:!1})}function T4(t){if(t.fetchImageService)return(0,dp.jsx)(FF,{...t});let e=typeof t.src=="string"?{id:t.src,profile:"level0"}:t.src,n=o0(e,{size:t.size,selector:t.region,rotation:t.rotation,format:t.format,region:t.region,quality:t.quality},[t.src,t.size,t.region,t.rotation,t.format,t.region,t.quality]);return n?(0,dp.jsx)("img",{src:n,alt:t.alt,className:t.className,style:t.style}):null}var l0=_(X(),1);var Il=_(V(),1);function GF({src:t,errorFallback:e,interactive:n,skipSizes:i,children:a,renderViewerControls:o,viewControlsDeps:s,fluid:u,x:d,y:p,...f}){let[m,g]=(0,l0.useState)(),v=e||e0,[S,R]=ap(),T=(0,l0.useMemo)(()=>{let x=R[t]?.status,A=S({id:t},{});return A?.height&&A.width&&x!=="loading"?{id:t,width:A.width,height:A.height,service:A,type:"Image",selector:{type:"BoxSelector",spatial:{x:0,y:0,width:A.width,height:A.height}},target:{type:"BoxSelector",spatial:{x:0,y:0,width:A.width,height:A.height}}}:null},[S,t,R]);if(!T||!T.height||!T.width)return null;let E=u?void 0:f.homePosition?f.homePosition.width/f.homePosition.height:T.width/T.height;return(0,Il.jsx)(cf,{resetKeys:[],fallbackRender:x=>(0,Il.jsx)(v,{...f,...x}),children:(0,Il.jsx)(n0,{...f,aspectRatio:E,containerProps:{style:{position:"relative"},...f.containerProps||{}},onCreated:x=>{g(x),f.onCreated&&f.onCreated(x)},children:(0,Il.jsxs)(Wa.Provider,{value:m,children:[(0,Il.jsx)(wl,{image:T,id:T.id,isStatic:!n,x:d,y:p},T.id),(0,Il.jsx)(kF,{viewerPreset:m,renderViewerControls:o,image:T,src:t,viewControlsDeps:s}),a]})})})}function kF({viewerPreset:t,renderViewerControls:e,image:n,src:i,viewControlsDeps:a}){return Qn(t&&e?"overlay":"none",`canvas-portal-controls-${i}`,Wa.Provider,e&&n?{value:t||null,children:e({image:n,images:[n],type:"images"})}:{},[i,t,...a||[]]),null}var C4=_(V(),1);function YF(t){let e=an();return(0,C4.jsx)(fp,{metadata:e?.metadata||[],...t})}var s0=_(X(),1);var $A=_(M4(),1);var Li=_(V(),1),{LazyLoadComponent:QF}=$A||$A.default;function tT(t){let{size:e,visible:n,classes:i,canvasId:a,figure:o}=t,s=e?.width||128,u=e?.height||e?.width||128,d=(0,Li.jsx)(XF,{...t}),p=(0,Li.jsx)(QF,{threshold:300,style:{height:u,width:s},visibleByDefault:n,children:a?(0,Li.jsx)(Sa,{canvas:a,children:d}):d});return o?(0,Li.jsx)("figure",{className:i?.figure,children:p}):p}function XF({fallback:t,size:e,classes:n,showLabel:i,alt:a,dereference:o=!1}){let s=_t(),u=e?.width||128,d=e?.height||e?.width||128,p=a||yv(s?.label)||"",f=sr({width:u,height:d,allowUnsafe:!0},o);return!f||f.type!=="fixed"?(0,Li.jsx)(Li.Fragment,{children:t}):(0,Li.jsxs)(Li.Fragment,{children:[(0,Li.jsx)("div",{className:n?.imageWrapper,children:(0,Li.jsx)("img",{className:n?.img,src:f.id,alt:p})}),i?(0,Li.jsx)(sa,{as:"figcaption",className:n?.label,children:s?.label}):null]})}var df=_(V(),1);function KF({scrollBehaviour:t,dereference:e,flat:n,size:i,classes:a={},showLabel:o,figure:s,fallback:u}){let d=(0,s0.useRef)(null),{items:p,sequence:f,currentSequenceIndex:m,setSequenceIndex:g}=ds(),v={row:a.selected?.row||a.row,item:a.selected?.item||a.item,figure:a.selected?.figure||a.figure,img:a.selected?.img||a.img,label:a.selected?.label||a.label,imageWrapper:a.selected?.imageWrapper||a.imageWrapper};(0,s0.useLayoutEffect)(()=>{if(!d.current)return;let R=d.current.querySelector("[data-selected=true]");R&&R.scrollIntoView({behavior:t||"instant",block:"nearest",inline:"center"})},[m]);let S=[];for(let R of f){let T=[],E=f[m]===R;for(let x of R){let A=p[x];T.push((0,df.jsx)("div",{className:E?v.item:a.item,children:(0,df.jsx)(tT,{classes:E?v:a,canvasId:A.id,size:i,dereference:e,showLabel:o,figure:s,placeholder:(0,df.jsx)("div",{style:{height:128,width:128}}),fallback:u})},x))}if(n){S.push(T);continue}S.push((0,df.jsx)("div",{onClick:x=>{g(f.indexOf(R))},"data-selected":E,className:E?v.row:a.row,children:T},R.join("-")))}return(0,df.jsx)("div",{ref:d,className:a.container,children:S})}function eT(){let t=Ne(),e=St(t,o=>o.completeRequest),n=St(t,o=>o.polygonState.currentTool),i=St(t,o=>o.polygonState.selectedStamp),a=St(t,o=>o.switchTool);return{completeRequest:e,currentTool:n,selectedStamp:i,switchTool:a}}var Bn=_(V(),1),ZF={draw:!0,polygon:!0,line:!0,lineBox:!0,box:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0,pen:!0};function JF({showShapes:t=!0,enabled:e=ZF,classNames:n={},icons:i={}}){let{currentTool:a,switchTool:o,selectedStamp:s}=eT();return(0,Bn.jsxs)(Bn.Fragment,{children:[a,(0,Bn.jsx)("button",{className:n.button,onClick:o.pointer,"data-active":a==="pointer",children:i.PointerIcon||"Pointer"}),(0,Bn.jsx)("button",{className:n.button,onClick:o.hand,"data-active":a==="hand",children:i.HandIcon||"Hand"}),t?(0,Bn.jsxs)(Bn.Fragment,{children:[e.box&&(0,Bn.jsx)("button",{className:n.button,onClick:o.box,"data-active":a==="box",children:i.BoxIcon||"Box"}),e.pen&&(0,Bn.jsx)("button",{className:n.button,onClick:o.pen,"data-active":a==="pen",children:i.PenIcon||"Pen"}),e.draw&&(0,Bn.jsx)("button",{className:n.button,onClick:o.draw,"data-active":a==="pencil",children:i.DrawIcon||"Draw"}),e.line&&(0,Bn.jsx)("button",{className:n.button,onClick:o.line,"data-active":a==="line",children:i.LineIcon||"Line"}),e.lineBox&&(0,Bn.jsx)("button",{className:n.button,onClick:o.lineBox,"data-active":a==="lineBox",children:i.LineBoxIcon||"LineBox"}),e.triangle&&(0,Bn.jsx)("button",{className:n.button,onClick:o.triangle,"data-active":a==="stamp"&&s?.id==="triangle",children:i.TriangleIcon||"Triangle"}),e.hexagon&&(0,Bn.jsx)("button",{className:n.button,onClick:o.hexagon,"data-active":a==="stamp"&&s?.id==="hexagon",children:i.HexagonIcon||"Hexagon"}),e.circle&&(0,Bn.jsx)("button",{className:n.button,"data-active":a==="stamp"&&s?.id==="circle",onClick:o.circle,children:i.CircleIcon||"Circle"})]}):null,e.delete&&(0,Bn.jsx)("button",{className:n.button,onClick:o.remove,children:i.DeleteForeverIcon||"Delete"})]})}var O4=_(V(),1);function WF({annotation:t,children:e}){return(0,O4.jsx)(si,{value:{annotation:t},children:e})}var _4=_(V(),1);function $F({annotationPage:t,children:e}){return(0,_4.jsx)(si,{value:{annotationPage:t},children:e})}var z4=_(V(),1);function t9({collection:t,children:e}){return(0,z4.jsx)(si,{value:{collection:t},children:e})}function e9(t,e={}){return hr(e)}var Dl=_(X(),1);function n9({canvasId:t}={}){let e=uv(),n=us(),i=(0,Dl.useMemo)(()=>t?[t]:e?[e.id]:n.map(p=>p.id),[t,e,n]),[a,o]=(0,Dl.useState)({}),s=Qh();(0,Dl.useEffect)(()=>{let p=f=>{let m=f.partOf.canvasId;m&&o(g=>({...g,[m]:f.choice}))};return s.on("choice-change",p),()=>{s.off("choice-change",p)}},[]);let u=(0,Dl.useMemo)(()=>{let p=[];for(let f of i){let m=a[f];m&&p.push({canvasId:f,choice:m})}return p},[i,a]),d=(0,Dl.useMemo)(()=>({makeChoice:(p,f)=>{s.emit("make-choice",{choiceId:p,...f})}}),[s]);return{choices:u,actions:d}}function i9(t,e=!1){}function a9(t){let n=Wn().manifest,i=t?t.map(a=>typeof a=="string"?a:a?.id):[];return ie(a=>{let o=n?a.iiif.entities.Manifest[n]:void 0,s=o?.items||[];if(typeof t>"u")return s;let u=[];for(let d of o?.items||[])i.indexOf(d.id)!==-1&&u.push(d);return u},[i.join("/")])}var N4=_(X(),1);function o9(t,e=[]){let{id:n,selector:i}=t,a=Wn(),o=n||a.collection,s=ie(u=>o?u.iiif.entities.Collection[o]:void 0,[o]);return(0,N4.useMemo)(()=>{if(s)return i?i(s):s},[s,i,...e])}var u0=_(X(),1);function r9(){let t=Ne(),e=St(t,i=>i.completeRequest),n=St(t,i=>i.cancelRequest);return(0,u0.useMemo)(()=>({saveAnnotation:()=>{(0,u0.startTransition)(()=>{e()})},cancelRequest:n}),[e,n])}var I4=_(X(),1);function l9({requestId:t}={}){let e=Ne(),n=St(e,u=>u.metadata),i=St(e,u=>u.tool.requestId),a=t||i,o=St(e,u=>u.setMetadata),s=(0,I4.useCallback)(u=>o(u,a||void 0),[o,a]);return[a?n[a]||{}:{},s]}function s9(t){let e=Ne(),n=St(e,i=>i.tool.requestId);Ps("polygons.start-transition",i=>{t.requestId&&n!==t.requestId||t?.onStart?.(i.transitionIntent)},[n,t.requestId]),Ps("polygons.end-transition",i=>{t.requestId&&n!==t.requestId||t?.onEnd?.(i.transitionIntent,i.response)},[n,t.requestId]),Ps("polygons.transition",i=>{t.requestId&&n!==t.requestId||t?.onTransition?.(i.transitionIntent)},[n,t.requestId])}var c0=_(X(),1);function u9(t,e,n,i,a=[]){let o=Ut(),s=(0,c0.useMemo)(()=>Mh(o),[o]);(0,c0.useEffect)(()=>{let u=t;return u?(s.addEventListener(u,e,n,i),()=>{s.removeEventListener(u,e,n)}):()=>{}},[s,t,e,...a])}function c9(t,e){let{id:n,isLoaded:i,error:a,resource:o,requestId:s,cached:u}=td(t,e);return{id:n,isLoaded:i,error:a,manifest:o,requestId:s,cached:u}}var xo=_(X(),1);function nT({cacheKey:t}={}){let e=_t(),n=hr(),i=Ut(),a=Jc(),o=KD(),[s,u]=(0,xo.useState)(void 0),[d,p]=(0,xo.useState)(!1),[f,m]=(0,xo.useState)("idle"),[g,v]=(0,xo.useState)(void 0),S=e?e.id:"undefined",R=(0,xo.useMemo)(()=>{try{if(e&&n.length){let E=n[0],x=i.get(E.body[0]),C=jr(x)[0];return C&&a(C,{width:C.width||e.width,height:C.height||e.height},!0)||void 0}}catch(E){console.error(E)}},[S,t,e]),T=f==="success"&&s?s:R;return(0,xo.useEffect)(()=>{(async()=>{try{if(e&&n.length){let E=n[0],x=i.get(E.body[0]),C=jr(x)[0];if(!C)return;p(!0),m("loading");try{let M=await o(C,{width:C.width||e.width,height:C.height||e.height})||void 0;u(M),m("success"),p(!1)}catch(M){m("error"),v(M)}}}catch(E){m("error"),v(E)}})()},[S,t]),(0,xo.useMemo)(()=>({data:T,isFetching:d,status:f,error:g}),[T,d,f,g])}function f9(){let t=nT();return{isLoading:t.isFetching,tile:t.data?{id:t.data.id||t.data["@id"],width:t.data.width,height:t.data.height,imageService:t.data,thumbnail:void 0}:null}}var f0=_(X(),1);function d9({supports:t=["empty","images","media","3d-model","textual-content","complex-timeline"]}={}){let e=Ut(),n=_t(),i=hr(),a=(0,f0.useMemo)(()=>Kc(e),[e]),o=(0,f0.useMemo)(()=>a.getPaintables(i),[a,i]);return(0,f0.useMemo)(()=>sp({canvas:n,loadImageService:s=>s,paintables:o,supports:t}),[n,o,t])}var D4=_(X(),1);function h9(){let t=Ut();return(0,D4.useMemo)(()=>bl(t),[t])}function p9(t,e){let{x:n,y:i,width:a,height:o}=t,{x:s,y:u}=e,{width:d,height:p}=e;return n+a>s&&n<s+d&&i+o>u&&i<u+p}var m9=!0,iT="Invariant failed";function L4(t,e){if(!t){if(m9)throw new Error(iT);var n=typeof e=="function"?e():e,i=n?"".concat(iT,": ").concat(n):iT;throw new Error(i)}}function g9(t,e){let n=t.boundingBox||Sl(t.polygon);if(t.polygon&&!Gc(t.polygon.points)){let i=t.target||kc(t.polygon,e);return L4(i?.type==="SvgSelector"),{type:"SvgSelector",points:t.polygon.points,spatial:{unit:"pixel",...n||{}},svgShape:t.polygon.open?"polyline":"polygon",svg:i.value}}return{type:"BoxSelector",spatial:n}}return aP(y9);})();
125
135
  /*! Bundled license information:
126
136
 
127
- react/cjs/react-jsx-runtime.production.min.js:
137
+ react/cjs/react-jsx-runtime.production.js:
128
138
  (**
129
139
  * @license React
130
- * react-jsx-runtime.production.min.js
140
+ * react-jsx-runtime.production.js
131
141
  *
132
- * Copyright (c) Facebook, Inc. and its affiliates.
142
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
133
143
  *
134
144
  * This source code is licensed under the MIT license found in the
135
145
  * LICENSE file in the root directory of this source tree.
@@ -157,41 +167,56 @@ use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.productio
157
167
  * LICENSE file in the root directory of this source tree.
158
168
  *)
159
169
 
160
- normalize-wheel/src/isEventSupported.js:
170
+ scheduler/cjs/scheduler.production.js:
161
171
  (**
162
- * Checks if an event is supported in the current execution environment.
163
- *
164
- * NOTE: This will not work correctly for non-generic events such as `change`,
165
- * `reset`, `load`, `error`, and `select`.
172
+ * @license React
173
+ * scheduler.production.js
166
174
  *
167
- * Borrows from Modernizr.
175
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
168
176
  *
169
- * @param {string} eventNameSuffix Event name, e.g. "click".
170
- * @param {?boolean} capture Check if the capture phase is supported.
171
- * @return {boolean} True if the event is supported.
172
- * @internal
173
- * @license Modernizr 3.0.0pre (Custom Build) | MIT
177
+ * This source code is licensed under the MIT license found in the
178
+ * LICENSE file in the root directory of this source tree.
174
179
  *)
175
180
 
176
- scheduler/cjs/scheduler.production.min.js:
181
+ react-reconciler/cjs/react-reconciler.production.js:
177
182
  (**
178
183
  * @license React
179
- * scheduler.production.min.js
184
+ * react-reconciler.production.js
180
185
  *
181
- * Copyright (c) Facebook, Inc. and its affiliates.
186
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
182
187
  *
183
188
  * This source code is licensed under the MIT license found in the
184
189
  * LICENSE file in the root directory of this source tree.
185
190
  *)
186
191
 
187
- react-reconciler/cjs/react-reconciler.production.min.js:
192
+ react-dom/cjs/react-dom-client.production.js:
188
193
  (**
189
194
  * @license React
190
- * react-reconciler.production.min.js
195
+ * react-dom-client.production.js
191
196
  *
192
- * Copyright (c) Facebook, Inc. and its affiliates.
197
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
193
198
  *
194
199
  * This source code is licensed under the MIT license found in the
195
200
  * LICENSE file in the root directory of this source tree.
196
201
  *)
202
+
203
+ @atlas-viewer/atlas/dist/index.js:
204
+ (*! Bundled license information:
205
+
206
+ normalize-wheel/src/isEventSupported.js:
207
+ (**
208
+ * Checks if an event is supported in the current execution environment.
209
+ *
210
+ * NOTE: This will not work correctly for non-generic events such as `change`,
211
+ * `reset`, `load`, `error`, and `select`.
212
+ *
213
+ * Borrows from Modernizr.
214
+ *
215
+ * @param {string} eventNameSuffix Event name, e.g. "click".
216
+ * @param {?boolean} capture Check if the capture phase is supported.
217
+ * @return {boolean} True if the event is supported.
218
+ * @internal
219
+ * @license Modernizr 3.0.0pre (Custom Build) | MIT
220
+ *)
221
+ *)
197
222
  */