@micrio/client 6.0.1 → 6.0.2

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.
Files changed (2) hide show
  1. package/micrio.min.js +3 -3
  2. package/package.json +1 -1
package/micrio.min.js CHANGED
@@ -1,4 +1,4 @@
1
- /* Micrio Client 6.0.1
1
+ /* Micrio Client 6.0.2
2
2
  * Copyright (C) 2015 - 2026 Q42 Internet B.V., Micrio <https://micr.io>
3
3
  *
4
4
  * GitHub: https://github.com/Q42/Micrio.Client
@@ -24,7 +24,7 @@
24
24
  */
25
25
 
26
26
  const _css=document.createElement('style');
27
- _css.className='micrio-interface';_css.textContent=`html{--micrio-color:#fff;--micrio-color-hover:#45a4e4;--micrio-border-radius:4px;--micrio-background:#292929bf;--micrio-background-filter:blur(8px);--micrio-popover-background:#292929bf;--micrio-scrubber-background:#ffffff40;--micrio-icon-size:18px;--micrio-text-align:left;--micrio-line-height:1.5em;--micrio-border-margin:16px;--micrio-button-size:48px;--micrio-button-shadow:0 4px 8px #00000054;--micrio-marker-size:16px;--micrio-marker-text-color:#fff;--micrio-marker-text-shadow:0px 2px 4px #0009;--micrio-marker-highlight:#00d4ee;--micrio-marker-color:#fff;--micrio-marker-border-radius:100%;--micrio-marker-border-color:#fff3;--micrio-marker-border-size:8px;--micrio-marker-icon:none;--micrio-marker-transition:background-color .25s ease, opacity .15s ease, border-width .15s ease, width .15s ease, height .15s ease;--micrio-popup-shadow:0 8px 16px #00000054;--micrio-popup-padding:16px;--micrio-progress-bar-background:#ffffff40;--micrio-progress-bar-height:4px;--micrio-waypoint-size:120px}micr-io[data-light-mode]{--micrio-color:#000;--micrio-color-hover:#196da6;--micrio-background:#ffffffa8;--micrio-progress-bar-background:#00000040;--micrio-popover-background:#d3d3d3bf;--micrio-scrubber-background:#ffffff80}@media (prefers-color-scheme:light){micr-io[data-auto-scheme]{--micrio-color:#000;--micrio-color-hover:#196da6;--micrio-background:#ffffffa8;--micrio-progress-bar-background:#00000040;--micrio-popover-background:#d3d3d3bf}}@media (width<=500px){html{--micrio-border-margin:5px;--micrio-button-size:48px}}micr-io{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;backface-visibility:hidden;background-position:50%;background-repeat:no-repeat;background-size:contain;width:100%;height:100%;min-height:200px;display:block;position:relative;overflow:hidden;container-type:size}micr-io,micr-io button{font-family:var(--micrio-font-family,inherit);font-size:var(--micrio-font-size,inherit);background-color:var(--micrio-background-color,transparent)}micr-io h3{font-weight:600}micr-io[dir=rtl]{--micrio-text-align:right}canvas.micrio{backface-visibility:hidden;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;display:block;position:absolute;top:0;left:0;width:100%!important;height:100%!important}micr-io:not([static]){overscroll-behavior:none}micr-io[data-hooked]:not([data-panning])>canvas.micrio{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:-ms-grab;cursor:grab;-ms-content-zooming:none;-ms-touch-action:none;touch-action:none}micr-io[data-panning]{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:-ms-grabbing;cursor:grabbing}micr-io[data-hooked][data-can-pan]>canvas.micrio{-ms-touch-action:pan-y;touch-action:pan-y;overscroll-behavior:initial}micr-io>.micrio-grid{grid-gap:0;will-change:transform;transform-origin:0 0;--translate:none;--scale:1;width:100%;height:100%;transform:var(--translate) scale3d(var(--scale), var(--scale), 1);grid-auto-flow:dense;display:grid;position:absolute;top:0;left:0}micr-io>.micrio-grid>button{cursor:pointer;background:0 0;border:none;grid-area:auto/auto/span 1/span 1;margin:0;padding:0}a.micrio-logo{top:calc(var(--micrio-border-margin) * 2);left:calc(var(--micrio-border-margin) * 2);z-index:2;cursor:pointer;width:22px;height:22px;transition:transform .25s;display:block;position:absolute}a.micrio-logo:hover{transform:rotate(-90deg)}a.micrio-logo:before,a.micrio-logo:after{content:"";will-change:transform;box-sizing:unset;display:block;position:absolute;transform:rotate(45deg)}a.micrio-logo:before{border:3px solid #00d4ee;width:16px;height:16px}a.loading.micrio-logo:before{animation:1s ease-out infinite micrio-logo-spin}a.micrio-logo:after{background:#c5ff5b;outline:1px solid #c5ff5b;width:6px;height:6px;top:8px;left:8px}a.loading.micrio-logo:after{animation:.5s ease-out infinite micrio-logo-spin}@keyframes micrio-logo-spin{0%{transform:rotate(45deg)}to{transform:rotate(135deg)}}a.micrio-logo-org{top:calc(var(--micrio-border-margin) * 2);right:calc(var(--micrio-border-margin) * 2);z-index:1;display:block;position:absolute}img.micrio-logo-org{max-height:64px;display:block}svg.micrio-icon{vertical-align:-.125em;height:1em;display:inline-block;overflow:visible}svg.small.micrio-icon{height:.75em}menu.micrio-menu{margin:0;padding:0;transition:background .2s,box-shadow .2s}.micrio-menu-action.micrio-menu{cursor:pointer;color:inherit;text-shadow:inherit;box-sizing:border-box;text-align:center;background:0 0;border:none;border-radius:0;padding:0 24px;font-family:inherit;font-size:.9em;text-decoration:none;display:block}@media (width<=500px){menu.micrio-menu{font-size:1em}.micrio-menu-action.micrio-menu{width:100%;margin-bottom:10px;padding:6px 0}strong.micrio-menu>svg{display:none}.items>menu.micrio-menu>.micrio-menu-action:where(.micrio-menu){font-size:1em}menu.micrio-toolbar>menu.micrio-menu>.micrio-menu-action:where(.micrio-menu){border-bottom:1px solid #ffffff80;margin-top:24px;font-size:1.5em}}@media (width>=501px){div.items.micrio-menu{max-height:calc(100vh - 160px);overflow:hidden auto}menu.micrio-toolbar>menu.micrio-menu{color:#fff;margin-right:var(--micrio-border-margin);border-radius:var(--micrio-border-radius);overflow:hidden}menu.micrio-toolbar>menu.micrio-menu:hover,menu.micrio-toolbar>menu.micrio-menu:focus-within{-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);background:var(--micrio-background);box-shadow:var(--micrio-button-shadow)}menu.micrio-toolbar>menu.micrio-menu>.micrio-menu-action:where(.micrio-menu){position:relative}menu.micrio-toolbar>menu.micrio-menu>.micrio-menu-action:where(.micrio-menu)>strong:where(.micrio-menu){margin:0 -5px;padding:5px}menu.micrio-toolbar>menu.micrio-menu:hover .micrio-menu-action:where(.micrio-menu),menu.micrio-toolbar>menu.micrio-menu:focus-within .micrio-menu-action:where(.micrio-menu){text-shadow:none;color:var(--micrio-color)}strong.micrio-menu>svg{margin-left:10px;line-height:2px}menu.micrio-menu{float:left;position:relative}menu.micrio-menu:not(:focus-within):not(:hover) .items:where(.micrio-menu){display:none}.micrio-menu-action.micrio-menu{height:var(--micrio-button-size);line-height:var(--micrio-button-size);width:100%;text-align:var(--micrio-text-align);white-space:pre;font-weight:600}.items menu.micrio-menu{float:none}.items .micrio-menu-action.micrio-menu{width:100%}.micrio-menu-action.micrio-menu:hover,.micrio-menu-action.micrio-menu:focus{text-shadow:none!important;color:var(--micrio-color-hover)!important}}.micrio-button{cursor:pointer;box-sizing:border-box;vertical-align:bottom;font:inherit;touch-action:none;color:var(--micrio-color);background:var(--micrio-button-background,var(--micrio-background,none)) var(--background,none) center center no-repeat;min-width:var(--micrio-button-size);height:var(--micrio-button-size);font-size:90%;line-height:var(--micrio-button-size);border-radius:var(--micrio-border-radius);box-shadow:var(--micrio-button-shadow);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);background-size:24px;border:none;margin:0;padding:0 8px;text-decoration:none;transition:opacity .25s;display:inline-block;position:relative}.micrio-button:hover{outline:none}.micrio-button.transparent.micrio-button,.micrio-button.transparent.micrio-button:hover{-webkit-backdrop-filter:none;backdrop-filter:none;background-color:#0000}.micrio-button>*{transition:opacity .25s}.micrio-button:disabled{pointer-events:none;cursor:default}.micrio-button:disabled>*{opacity:.4}.micrio-button.no-click.micrio-button{pointer-events:none}img.micrio-button{pointer-events:none;max-width:100%;max-height:100%;margin:0 auto;display:block}.micrio-button>*{width:var(--micrio-icon-size);font-size:var(--micrio-icon-size);fill:var(--micrio-color);margin:0 auto;display:block;height:var(--micrio-icon-size)!important}.micrio-button.active.micrio-button{color:var(--micrio-color-hover)}.micrio-button.active.micrio-button svg{fill:var(--micrio-color-hover)}@media (hover:hover){.micrio-button:hover{background-color:var(--micrio-button-background-hover,var(--micrio-button-background,var(--micrio-background)));color:var(--micrio-color-hover)}.micrio-button:hover svg{fill:var(--micrio-color-hover);stroke:var(--micrio-color-hover)}.micrio-button:focus{outline:1px solid var(--micrio-color-hover)}}menu.micrio-toolbar{top:calc(var(--micrio-border-margin) - (var(--micrio-button-size) / 2 - 27px));left:var(--micrio-border-margin);color:#fff;text-shadow:1px 1px 2px #000;z-index:1;margin:0;padding:0;transition:transform .25s;position:absolute}@media (width<=500px){.micrio-button.toggle{top:var(--micrio-border-margin);width:34px;height:34px;box-shadow:none;z-index:2;position:absolute;left:0}.micrio-button.toggle.indent{left:35px}menu.micrio-toolbar{box-sizing:border-box;width:100%;height:100%;-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);z-index:1;background:#000000bf;padding:32px 0;top:0;left:0;overflow:hidden auto;transform:translate(0,0)}menu.micrio-toolbar:not(.shown){transform:translate3d(calc(-100% - var(--micrio-border-margin) * 2), 0, 0)}}@media (width>=501px){menu.indent.micrio-toolbar{margin-left:calc(var(--micrio-border-margin) * 2 + 25px)}menu.micrio-toolbar>.micrio-menu:not(:hover)>button.micrio-menu{margin-bottom:-15px}}canvas.micrio-minimap{bottom:var(--micrio-border-margin);transform-origin:100% 100%;cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:-ms-grab;cursor:grab;-ms-content-zooming:none;-ms-touch-action:none;touch-action:none;border-radius:var(--micrio-border-radius);background-size:100%;transition:opacity .2s;display:block;position:absolute;right:5px}canvas:not(:hover).hidden.micrio-minimap{opacity:0;pointer-events:none}canvas.dragging.micrio-minimap{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:-ms-grabbing;cursor:grabbing}canvas.controls.micrio-minimap{right:calc(var(--micrio-border-margin) + var(--micrio-button-size) + 8px)}@media (width<=800px){canvas.micrio-minimap{pointer-events:none;right:65px;transform:scale(.5)}}div.micrio-button-group{box-shadow:var(--micrio-button-shadow);border-radius:var(--micrio-border-radius);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);background:var(--micrio-button-background,var(--micrio-background,none))}div.micrio-button-group:empty{display:none}div.micrio-button-group>.micrio-button{box-shadow:none;--micrio-background-filter:none;--micrio-button-background:none;display:block}div.micrio-button-group .micrio-button{border-radius:0}div.micrio-button-group .micrio-button:first-child{border-radius:var(--micrio-border-radius) var(--micrio-border-radius) 0 0}div.micrio-button-group .micrio-button:last-child{border-radius:0 0 var(--micrio-border-radius) var(--micrio-border-radius)}@media (width<=500px){div.micrio-button-group>*{height:calc(var(--micrio-button-size) - 4px)}div.micrio-button-group .micrio-button:first-child{padding-top:0}div.micrio-button-group .micrio-button:last-child{padding-bottom:0}}aside.micrio-controls{right:var(--micrio-border-margin);bottom:var(--micrio-border-margin);direction:rtl;margin:0;padding:0;transition:transform .25s,opacity .25s;position:absolute}aside.primary.micrio-controls:not(.portrait){right:calc(50% + var(--micrio-border-margin))}aside.primary.portrait.micrio-controls{bottom:calc(50% + var(--micrio-border-margin))}aside.hidden.micrio-controls{transform:translateX(calc(100% + var(--micrio-border-margin)));opacity:0;pointer-events:none}micr-io[data-switching]>aside.micrio-controls,micr-io[data-tour-active]>aside.micrio-controls{opacity:0;pointer-events:none}aside.micrio-controls>menu,aside.micrio-controls>button{width:var(--micrio-button-size);margin:8px 0;padding:0;display:block}menu.popout.micrio-controls{width:var(--micrio-button-size);height:var(--micrio-button-size);white-space:pre;pointer-events:none;box-shadow:var(--micrio-button-shadow);border-radius:var(--micrio-border-radius);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);direction:rtl;padding:0}menu.popout.micrio-controls:focus-within{pointer-events:all}menu.popout.micrio-controls button{pointer-events:all;--micrio-button-shadow:none;--micrio-background-filter:none;transition:border-radius .2s,opacity .2s}menu.popout.micrio-controls:hover>button:first-child{border-radius:0 var(--micrio-border-radius) var(--micrio-border-radius) 0}menu.popout.micrio-controls>:not(:first-child){border-radius:0;padding:0;transition:opacity .2s;display:inline-block}menu.popout.micrio-controls>button:last-child{border-radius:var(--micrio-border-radius) 0 0 var(--micrio-border-radius)}menu.popout.micrio-controls:not(:focus-within)>:not(:first-child){pointer-events:none;opacity:0}div.micrio-subtitles{text-align:center;color:#fff;pointer-events:none;width:100cqw;transition:transform .2s;position:absolute;bottom:50px;left:50cqw;transform:translate(-50%)}div.raised.micrio-subtitles{transform:translate3d(-50%, calc(-1 * var(--micrio-button-size)), 0)}div.micrio-subtitles p:where(.micrio-subtitles){-webkit-box-decoration-break:clone;box-decoration-break:clone;white-space:pre-wrap;text-shadow:2px 2px 1px #0005;font-size:2.5em;line-height:inherit;background-color:#0009;margin:.5em 0;padding:0 14px;display:inline}@media (width<=640px){div.micrio-subtitles{width:95cqw;font-size:.7em}}div.container.micrio-progress-bar{width:auto;color:var(--micrio-color);background:var(--micrio-background);cursor:default;flex:1;align-items:center;line-height:8px;display:flex}div.bars.micrio-progress-bar{height:var(--micrio-progress-bar-height);background:var(--micrio-progress-bar-background);flex:1;display:flex;position:relative}div.bars.micrio-progress-bar>*{box-sizing:border-box;cursor:pointer;width:100%;height:100%;display:block;position:relative;overflow:hidden}div.bars.micrio-progress-bar>:before{content:" ";background:var(--micrio-color);pointer-events:none;height:100%;width:var(--progress,0%);will-change:width;display:block;position:absolute}div.bars.micrio-progress-bar:after{content:"";width:16px;height:16px;left:var(--progress);background-color:var(--micrio-color);pointer-events:none;border-radius:8px;display:block;position:absolute;top:50%;transform:translate(-50%,-50%)}div.time.micrio-progress-bar{text-align:center;font-variant-numeric:tabular-nums;min-width:50px;padding:0 10px;font-size:90%;display:block}aside.micrio-media-controls{cursor:default;background:var(--micrio-background);align-items:center;margin:0;display:flex;position:relative}aside.micrio-media-controls>button{border:none;border-radius:0;margin:0}aside.micrio-media-controls>button:last-child{margin-right:16px}aside.micrio-media-controls>*{--micrio-button-background:none;--micrio-background-filter:none;--micrio-button-shadow:none}:fullscreen>aside.micrio-media-controls{border-radius:var(--micrio-border-radius);width:430px;max-width:90cqw;position:absolute;bottom:5px;left:50%;transform:translate(-50%)}svg.micrio-media-controls{pointer-events:none;width:42px;height:42px;position:absolute;top:-1px;left:-1px;transform:rotate(-90deg)}circle.micrio-media-controls{stroke-width:2px;stroke:#fff;fill:#0000;stroke-dasharray:119.4 119.4;transform-origin:50%;transition:stroke-dashoffset .25s linear}figure.micrio-media{width:100%;margin:0;display:block;position:relative}figure.micrio-media div:where(.micrio-media){cursor:pointer}figure.micrio-media div.videotour:where(.micrio-media){display:flex}figure.micrio-media:fullscreen div:where(.micrio-media){flex-direction:column;width:100vw;height:100vh;display:flex}figure.micrio-media:fullscreen div:where(.micrio-media)>:first-child{flex:1}.marker-popup>figure.micrio-media>div:where(.micrio-media){width:100%}iframe.micrio-media,video.micrio-media{max-width:unset;display:block}figure.is360.micrio-media{width:360px;position:absolute;bottom:5px;left:50%;transform:translate(-50%)}figure.is360.micrio-media video:where(.micrio-media){width:200px;height:200px;display:none}iframe.hooked.micrio-media{pointer-events:none}figcaption.micrio-media{text-align:center;color:var(--micrio-color);margin:.5em 1em;font-size:90%;font-style:italic}:not(.micrio-popover)>figure.micrio-media>figcaption:where(.micrio-media)>*,.micrio-popover figure.micrio-media{margin:0}aside.micrio-media{width:100%;display:flex}aside.inside.micrio-media{position:absolute;transform:translateY(-100%)}div.show-play.micrio-media{cursor:pointer;background:#0008;justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:fixed;top:0;left:0}div.show-play.micrio-media>button.micrio-button{transform:scale(2)}figure.micrio-media:not(.media-micrio) button.micrio-button{white-space:pre;--micrio-background-filter:none;--micrio-button-shadow:none;border:none;border-radius:0;margin:0}figure.media-micrio.micrio-media{text-align:var(--micrio-text-align)}article.micrio-article{text-align:var(--micrio-text-align);line-height:var(--micrio-line-height,1.5em)}article.micrio-article>:first-child{margin-top:0}article.micrio-article>:last-child{margin-bottom:0}article.micrio-article p a{color:var(--micrio-color-hover,inherit);word-wrap:break-word}main.micrio-marker-content{padding:var(--micrio-popup-padding);-webkit-user-select:text;user-select:text;color:var(--micrio-color);background:var(--micrio-background);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);box-shadow:var(--micrio-popup-shadow);border-radius:var(--micrio-border-radius);box-sizing:border-box;text-align:var(--micrio-text-align);padding-bottom:0;position:relative;overflow-y:auto}main.micrio-marker-content>*{--micrio-button-background:none;--micrio-background-filter:none;--micrio-button-shadow:none}main.micrio-marker-content .micrio-progress-bar.container{-webkit-backdrop-filter:none;backdrop-filter:none;background:0 0}main.micrio-marker-content::-webkit-scrollbar{background-color:#0000;width:10px}main.micrio-marker-content::-webkit-scrollbar-thumb{background:var(--micrio-color);border-radius:var(--micrio-border-radius);margin-top:10px}main.empty.micrio-marker-content{width:auto}main.micrio-marker-content h1:where(.micrio-marker-content){margin:0 0 1.25em;font-size:1.5em;font-weight:600}main.micrio-marker-content>figure.micrio-media{margin:calc(-1 * var(--micrio-popup-padding));--micrio-background:transparent;width:auto;margin-bottom:0}main.micrio-marker-content>figure.micrio-media:not(.media-video):not(:last-child)>:last-child:not(figcaption){margin-bottom:var(--micrio-popup-padding);background:var(--micrio-background);padding:0 var(--micrio-popup-padding)}main.micrio-marker-content>figure.micrio-media.media-video{margin-bottom:var(--micrio-popup-padding)}main.micrio-marker-content>figure.micrio-media>div>aside.micrio-media{--micrio-background:transparent}main.micrio-marker-content>article:last-child{margin-bottom:var(--micrio-popup-padding)}main.micrio-marker-content p{white-space:pre-line}main.micrio-marker-content figure.hidden{display:none}main.micrio-marker-content figure>div.micrio-media>:first-child{width:100%}button.micrio-marker-content{margin:0 calc(-1 * var(--micrio-popup-padding)) var(--micrio-popup-padding) calc(-1 * var(--micrio-popup-padding));padding:0}button.micrio-marker-content:disabled{cursor:default}figcaption.micrio-marker-content{margin-bottom:var(--micrio-popup-padding);text-align:center;padding:10px;font-size:.9em;font-style:italic}section.micrio-marker-content{margin-bottom:var(--micrio-popup-padding);grid-template-columns:repeat(auto-fit,minmax(100px,1fr));justify-items:center;gap:5px;display:grid}section.micrio-marker-content button:where(.micrio-marker-content){color:inherit;cursor:pointer;border:none;width:100%;margin:0;display:block}section.micrio-marker-content figure:where(.micrio-marker-content){margin:0;padding:0}section.micrio-marker-content img:where(.micrio-marker-content){object-fit:cover;width:100%;display:block}@media (width<=500px){section.micrio-marker-content{float:right;width:100px;margin-left:var(--micrio-border-margin);display:block}section.micrio-marker-content>button:where(.micrio-marker-content):not(:first-child),section.micrio-marker-content figcaption:where(.micrio-marker-content){display:none}}div.micrio-marker-popup{cursor:auto;pointer-events:all;top:var(--micrio-border-margin);left:var(--micrio-border-margin);display:block;position:absolute}div.destroying.micrio-marker-popup{pointer-events:none}div.micrio-marker-popup>main{max-height:80cqh}aside.micrio-marker-popup{padding:var(--micrio-border-margin)}aside.micrio-marker-popup progress:where(.micrio-marker-popup){display:none}@media (width>=501px){div.micrio-marker-popup{width:440px;min-width:20%}aside.micrio-marker-popup{padding-top:0;position:absolute;top:0;left:100%}aside.micrio-marker-popup>.micrio-button{margin:0 0 8px;padding:0;display:block}}div.micrio-marker-popup>main>:not(h3){transition-property:margin-top,margin-bottom,height,opacity;transition-duration:.5s;transition-timing-function:ease;overflow:hidden}div.minimized.micrio-marker-popup>main>:not(h3){opacity:0;margin-top:0;margin-bottom:0}@media (width<=500px){aside.micrio-marker-popup{margin-bottom:var(--micrio-border-margin);flex-direction:row-reverse;align-items:center;padding:0;display:flex;position:relative}aside.micrio-marker-popup progress:where(.micrio-marker-popup){opacity:0;pointer-events:none;flex:1;display:block}aside.micrio-marker-popup .micrio-tour-controls{display:flex;margin-bottom:0!important}aside.micrio-marker-popup .micrio-button{height:var(--micrio-button-size);margin:0 0 0 8px;padding:0!important;display:block!important}div.micrio-marker-popup{width:auto;right:var(--micrio-border-margin);bottom:calc(var(--micrio-button-size) + 2 * var(--micrio-border-margin));flex-direction:column;justify-content:space-between;display:flex}div.micrio-marker-popup>main{max-height:40vh}div.micrio-marker-popup>main>:not(h3){overflow:visible}}button.tour-step.micrio-marker-popup{vertical-align:middle;cursor:default;height:auto;line-height:normal}ol.micrio-serial-tour{color:var(--micrio-color);text-shadow:var(--micrio-marker-text-shadow);margin:0;list-style-type:decimal-leading-zero;position:absolute;bottom:75px;left:0}ol.micrio-serial-tour>li:where(.micrio-serial-tour){white-space:pre;height:1.5em;transition:height .25s,opacity .25s .25s}ol.micrio-serial-tour li.active:where(.micrio-serial-tour){font-weight:700}.minimized>ol.micrio-serial-tour>li:where(.micrio-serial-tour):not(.active){opacity:0;height:0;transition:height .25s .25s,opacity .25s}ol.micrio-serial-tour li:where(.micrio-serial-tour) button:where(.micrio-serial-tour){font:inherit;color:inherit;text-shadow:inherit;cursor:pointer;background:0 0;border:none;display:inline}ol.micrio-serial-tour li:where(.micrio-serial-tour) button:where(.micrio-serial-tour):hover{text-decoration:underline}aside.micrio-media-controls.micrio-serial-tour>figure.micrio-media{display:none}div.micrio-tour{bottom:var(--micrio-border-margin);max-width:calc(100% - var(--micrio-border-margin) * 2);box-sizing:border-box;border-radius:var(--micrio-border-radius);box-shadow:var(--micrio-button-shadow);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);background-color:var(--micrio-button-background,var(--micrio-background,none));padding:0;transition:transform .2s;display:flex;position:absolute;left:50%;transform:translate(-50%)}div:not(:hover).minimized.micrio-tour{transform:translate3d(-50%, calc(100% + var(--micrio-border-margin)), 0);pointer-events:none}.serial-tour.micrio-tour>*{--micrio-background:none}.serial-tour.minimized.micrio-tour{transform:translate3d(0, calc(100% + var(--micrio-border-margin)), 0)}.serial-tour.micrio-tour,.video-tour.micrio-tour{width:500px}div.micrio-tour>*{--micrio-button-background:none}div.micrio-tour button{white-space:pre;--micrio-background-filter:none;--micrio-button-shadow:none;border:none;border-radius:0;margin:0}article.scroll-tour.micrio-tour{scroll-snap-type:y mandatory;width:100%;height:100%;position:absolute;top:0;left:0;overflow:hidden scroll}button.micrio-button.scroll-tour-end{position:absolute;top:5px;right:5px}article.micrio-tour>div.micrio-marker-popup{scroll-snap-align:center;margin:20cqh 50px 50cqh;position:relative!important}article.micrio-tour>div.micrio-marker-popup:nth-child(2n){margin-left:auto}article.micrio-tour>div.micrio-marker-popup>aside{display:none}div.micrio-dial{bottom:var(--micrio-border-margin);width:320px;max-width:calc(100vw - calc(2 * (var(--micrio-button-size) + 4 * var(--micrio-border-margin))));max-width:calc(100cqw - calc(2 * (var(--micrio-button-size) + 4 * var(--micrio-border-margin))));height:calc(var(--micrio-button-size) * .6);touch-action:none;cursor:w-resize;background-color:#0000;position:absolute;left:50%;overflow:hidden;transform:translate(-50%)}div.micrio-dial:before,div.micrio-dial:after{content:"";background-position:var(--micrio-dial-offset,0px);width:100%;display:block;position:absolute}div.micrio-dial:before{background-image:repeating-linear-gradient(90deg,#8888 0% .5%,#0000 1% 2.5%);height:50%;top:25%}div.micrio-dial:after{background-image:repeating-linear-gradient(90deg,#fff8 0% .5%,#0000 1% 20%);height:100%}span.micrio-dial{line-height:calc(var(--micrio-button-size) * .6);color:var(--micrio-color);opacity:.85;pointer-events:none;text-shadow:1px 1px 3px #000,-1px -1px 3px #000;font-size:smaller;display:block;position:absolute;bottom:0;left:50%;transform:translate(calc(5px - 50%))}ul.micrio-gallery{bottom:var(--micrio-border-margin);background:var(--micrio-button-background,var(--micrio-background,none));box-shadow:var(--micrio-button-shadow);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);border-radius:var(--micrio-border-radius);height:var(--micrio-button-size);color:var(--micrio-color);touch-action:none;cursor:pointer;width:520px;max-width:calc(100cqw - 50px);margin:0;padding:0 16px;list-style-type:none;transition:transform .25s,opacity .25s;display:block;position:absolute;left:50%;transform:translate(-50%)}@media (width<=500px){ul.micrio-gallery{left:var(--micrio-border-margin);right:calc(var(--micrio-button-size) + var(--micrio-border-margin) * 2);width:auto;transform:none}}.track.micrio-gallery{background:var(--micrio-scrubber-background);pointer-events:none;border-radius:2px;height:2px;position:absolute;top:50%;left:16px;right:16px;overflow:hidden;transform:translateY(-50%)}.track-fill.micrio-gallery{background:var(--micrio-color);opacity:.85;border-radius:2px;height:100%;transition:width .15s;display:block;position:absolute;top:0;left:0}.ticks.micrio-gallery{pointer-events:none;position:absolute;inset:0 16px}.tick.micrio-gallery{background:var(--micrio-color);opacity:.55;border-radius:50%;width:6px;height:6px;transition:opacity .2s,transform .2s,background-color .2s;position:absolute;top:50%;transform:translate(-50%,-50%)}.tick.active.micrio-gallery{opacity:1;background:var(--micrio-color-hover,var(--micrio-color));transform:translate(-50%,-50%)scale(1.6)}@media (hover:hover){.tick.hover.micrio-gallery{opacity:1;transform:translate(-50%,-50%)scale(1.4)}}ul.dense.micrio-gallery .tick:where(.micrio-gallery){opacity:.35;border-radius:1px;width:1.5px;height:8px;transform:translate(-50%,-50%)}ul.dense.micrio-gallery .tick.major:where(.micrio-gallery){opacity:.6;height:12px}ul.dense.micrio-gallery .tick.active:where(.micrio-gallery){opacity:1;background:var(--micrio-color-hover,var(--micrio-color));width:2px;height:14px;transform:translate(-50%,-50%)}@media (hover:hover){ul.dense.micrio-gallery .tick.hover:where(.micrio-gallery){opacity:.9;transform:translate(-50%,-50%)}}.hover-label.micrio-gallery{font-variant-numeric:tabular-nums;color:var(--micrio-color);background:var(--micrio-popover-background);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);box-shadow:var(--micrio-button-shadow);pointer-events:none;white-space:nowrap;border-radius:999px;padding:2px 8px;font-size:11px;font-weight:600;line-height:1.4;position:absolute;bottom:calc(100% + 6px);transform:translate(-50%)}.handle.micrio-gallery{box-sizing:border-box;background:var(--micrio-color);border:2px solid var(--micrio-color);cursor:ew-resize;touch-action:none;min-width:28px;height:28px;box-shadow:0 2px 8px #00000059, 0 0 0 0 var(--micrio-color-hover);border-radius:999px;padding:0;transition:left .15s,height .15s,min-width .15s,background-color .2s,box-shadow .2s;position:absolute;top:50%;left:0;transform:translate(-50%,-50%)}.handle.micrio-gallery:hover{box-shadow:0 2px 8px #0006,0 0 0 4px #ffffff1f}.handle.dragging.micrio-gallery{cursor:grabbing;transition:none;box-shadow:0 2px 12px #00000080,0 0 0 6px #ffffff26}.handle-label.micrio-gallery{font-variant-numeric:tabular-nums;color:var(--micrio-color);background:var(--micrio-popover-background);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);box-shadow:var(--micrio-button-shadow);pointer-events:none;white-space:nowrap;border-radius:999px;padding:3px 9px;font-size:12px;font-weight:600;line-height:1.4;transition:left .15s,transform .15s;position:absolute;bottom:calc(100% + 8px);left:0;transform:translate(-50%)}.handle-label.dragging.micrio-gallery{transition:none;transform:translate(-50%)scale(1.05)}button.angular.micrio-gallery{width:var(--micrio-button-size);height:var(--micrio-button-size);background:var(--micrio-scrubber-background);border-radius:var(--micrio-border-radius);color:#444;cursor:move;border:none;padding:0;font-size:32px;line-height:42px;transition:background-color .2s;position:absolute;bottom:42px;left:50%;transform:translate(-50%)}button.angular.micrio-gallery:hover{background:#eee8}button.angular.dragging.micrio-gallery{transition:none}div.micrio-gallery{pointer-events:none;position:absolute;inset:0}div.micrio-gallery>*{pointer-events:auto}div.micrio-gallery>button.gallery-btn{transition:transform .25s,opacity .25s;position:absolute;top:50%;transform:translateY(-50%)}div.micrio-gallery>button.gallery-btn.arrow-left{left:var(--micrio-border-margin)}div.micrio-gallery>button.gallery-btn.arrow-right{right:var(--micrio-border-margin)}div.hidden.micrio-gallery:not(:hover)>ul{transform:translate(-50%, calc(100% + var(--micrio-border-margin)));opacity:0;pointer-events:none}@media (width<=500px){div.hidden.micrio-gallery:not(:hover)>ul{transform:translateY(calc(100% + var(--micrio-border-margin)))}}div.hidden.micrio-gallery:not(:hover)>button.gallery-btn.arrow-left{transform:translate(calc(-100% - var(--micrio-border-margin)), -50%);opacity:0;pointer-events:none}div.hidden.micrio-gallery:not(:hover)>button.gallery-btn.arrow-right{transform:translate(calc(100% + var(--micrio-border-margin)), -50%);opacity:0;pointer-events:none}div.micrio-gallery>button.gallery-btn:disabled{opacity:0;pointer-events:none}details.micrio-details{bottom:var(--micrio-border-margin);left:var(--micrio-border-margin);padding:var(--micrio-popup-padding);-webkit-user-select:text;user-select:text;white-space:normal;box-sizing:border-box;max-width:410px;color:var(--micrio-color);background:var(--micrio-background);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);box-shadow:var(--micrio-popup-shadow);border-radius:var(--micrio-border-radius);font-size:.9em;transition:all .5s;position:absolute}details.micrio-details summary:where(.micrio-details){cursor:pointer;list-style:none}details.micrio-details summary:where(.micrio-details)::-webkit-details-marker{display:none}details.micrio-details small:where(.micrio-details){font-style:italic;font-weight:400;display:block}details.micrio-details>:where(.micrio-details){text-overflow:ellipsis;margin:0;overflow:hidden}details.micrio-details a{color:var(--micrio-color-hover,inherit)}details.micrio-details button{position:absolute;top:0;left:calc(100% + 8px)}@media (width<=600px){details.micrio-details{max-width:calc(100% - 10px)}details.micrio-details:not([open]) cite:where(.micrio-details){display:none}details.micrio-details:not([open]) summary:where(.micrio-details)::marker{content:"?";margin-right:5px;font-size:20px;font-weight:700;line-height:20px;display:inline-block}details.micrio-details:not([open]) summary:where(.micrio-details)::-webkit-details-marker{content:"?";margin-right:5px;font-size:20px;font-weight:700;line-height:20px;display:inline-block}details.micrio-details button{position:absolute;inset:auto 0 calc(100% + 8px) auto}}div.micrio-error{color:#fff;text-align:center;white-space:pre-wrap;-webkit-user-select:text;user-select:text;z-index:10;background:#000000bf;border:1px solid #fff;border-radius:5px;padding:10px;line-height:24px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}div.micrio-error svg{vertical-align:middle;width:24px;height:24px;fill:var(--micrio-color);margin-right:10px}@media screen and (width<=520px){div.micrio-error{box-sizing:border-box;width:90%}}figure.micrio-micrio-gallery{position:relative}micr-io.micrio-micrio-gallery{background:0 0;width:100%;height:100%;display:block}micr-io.micrio-micrio-gallery ul.micrio-gallery{--micrio-border-margin:16px}figcaption.micrio-micrio-gallery{top:var(--micrio-border-margin);left:var(--micrio-border-margin);padding:var(--micrio-popup-padding);box-sizing:border-box;max-width:410px;color:var(--micrio-color);background:var(--micrio-background);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);box-shadow:var(--micrio-popup-shadow);border-radius:var(--micrio-border-radius);position:absolute}@media (width>=501px){micr-io.micrio-micrio-gallery:not(:fullscreen)>aside{position:fixed}}@media (width<=501px){figcaption.micrio-micrio-gallery{max-width:calc(100% - 3 * var(--micrio-border-margin) - var(--micrio-button-size))}}dialog.micrio-popover::backdrop{color:#fff;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);animation:.2s forwards micrio-popover-fadeInBg}@keyframes micrio-popover-fadeInBg{0%{background:0 0}to{background:var(--micrio-popover-background)}}@keyframes micrio-popover-fadeIn{0%{opacity:0}to{opacity:1}}dialog.micrio-popover{pointer-events:all;background:0 0;border:none;max-width:90cqw;max-height:90cqh;padding:0;animation:.5s forwards micrio-popover-fadeIn;overflow:visible}dialog.micrio-popover div.micrio-media>:first-child{border-radius:var(--micrio-border-radius);overflow:hidden}dialog.micrio-popover div.micrio-media>aside{--micrio-background:none;--micrio-button-background:none}dialog.page.article.micrio-popover figure.media-video iframe{width:100%}aside.micrio-popover{--micrio-background-filter:none;z-index:1;position:absolute}dialog.micrio-popover:not(.article){display:flex}dialog.micrio-popover:not(.article) figure>div.micrio-media{height:100%}@media (width>=640px){aside.micrio-popover{margin-left:var(--micrio-border-margin);display:block;top:0;left:100%}aside.inside.micrio-popover{margin-left:0;margin-top:var(--micrio-border-margin);margin-right:var(--micrio-border-margin);top:0;left:auto;right:0}aside.micrio-popover:not(.inside){z-index:2;position:absolute;top:0;left:100%}aside.micrio-popover>.micrio-button{margin:0 0 8px;padding:0;display:block}dialog.micrio-popover:not(.article){width:calc(85cqw - 56px);height:47.8125cqw}dialog.micrio-popover>main{width:25cqw;min-width:unset;max-width:320px}dialog.micrio-popover>main>h1{margin-right:55px}}@media (width<=639px){aside.micrio-popover{top:var(--micrio-border-margin);right:var(--micrio-border-margin);position:fixed}aside.micrio-popover .micrio-button{height:var(--micrio-button-size);box-shadow:var(--micrio-button-shadow);margin-left:8px;border-radius:var(--micrio-border-radius)!important;padding:0!important;display:inline-block!important}dialog.micrio-popover:not(.article){flex-direction:column;width:100%;height:100%}dialog.micrio-popover:not(.article) figure.micrio-media{flex:1}}dialog.micrio-popover>figure{flex:1;margin:0;position:relative}dialog.micrio-popover>figure>div.micrio-media>:first-child{width:100%;height:calc(100% - var(--micrio-button-size))}dialog.micrio-popover>figure>div.micrio-media>micr-io{height:100%!important}@media (aspect-ratio>=16/9){dialog.micrio-popover:not(.article){width:133.333cqh;height:75cqh}}@media (width<=639px){dialog.micrio-popover div.micrio-media>:first-child{border-radius:0}dialog.micrio-popover:not(.article)>:first-child{flex-direction:column;justify-content:center;height:50cqh}dialog.micrio-popover:not(.article)>figure:first-child{flex-direction:column;flex:none;display:flex}}dialog.article.micrio-popover>article{text-shadow:none;color:var(--micrio-color);background:var(--micrio-background);box-sizing:border-box;border-radius:var(--micrio-border-radius);max-height:calc(90vh - 48px);padding:20px;overflow:hidden auto}@media (width>=640px){dialog.article.micrio-popover{width:540px}}dialog.article.micrio-popover h2:where(.micrio-popover){text-align:center}dialog.article.micrio-popover article img{width:100%;height:auto}menu.micrio-popover{margin:10px 0;padding:0;list-style:none}menu.micrio-popover>.micrio-button{margin-right:10px}menu.right.micrio-popover{text-align:right}menu.right.micrio-popover>.micrio-button{margin:0 0 0 10px}dialog.gallery.micrio-popover{width:100%;height:100%;max-width:unset;max-height:unset}div.micrio-marker{transform:translate3d(calc(var(--x,0) - 50%), calc(var(--y,0) - 50%), 0) scale3d(var(--scale,1), var(--scale,1), 1);will-change:transform;display:block;position:absolute;top:0;left:0}div.micrio-marker:not(.cluster):not(.no-fade){animation:.25s forwards micrio-marker-fadeIn}div.overlapped.micrio-marker{display:none}@keyframes micrio-marker-fadeIn{0%{opacity:0}to{opacity:1}}div.behind.micrio-marker{pointer-events:none;opacity:0!important}div.mat3d.micrio-marker{transform:var(--mat);transform-style:preserve-3d;top:50%;left:50%}div.mat3d.micrio-marker>button:where(.micrio-marker){position:absolute;transform:translate(-50%,-50%)}button.micrio-marker{width:var(--micrio-marker-size);height:var(--micrio-marker-size);color:var(--micrio-marker-text-color);cursor:pointer;font:inherit;background:50% no-repeat;background-image:var(--micrio-marker-icon);background-size:contain;border:none;margin:0;padding:0;display:block;position:relative}div.micrio-marker:not(.cluster) label:where(.micrio-marker){text-align:var(--micrio-text-align);cursor:pointer;white-space:pre-wrap;width:max-content;max-width:170px;text-shadow:var(--micrio-marker-text-shadow);opacity:0;pointer-events:none;padding-left:10px;font-size:90%;font-weight:600;line-height:1em;transition:opacity .1s;position:absolute;top:50%;left:100%;transform:translateY(-50%)}div.micrio-marker:hover{z-index:2}.show-titles>div.micrio-marker label:where(.micrio-marker),div.micrio-marker:hover label:where(.micrio-marker){opacity:1}@media (width<=640px){div.micrio-marker:not(.cluster) label:where(.micrio-marker){font-size:12px}}.show-titles>div.micrio-marker label:where(.micrio-marker){pointer-events:all}label.static.micrio-marker{transform:translate(-50%, 4px) scale3d(calc(1 / var(--scale,1)), calc(1 / var(--scale,1)), 1)}div.default.micrio-marker button:where(.micrio-marker){box-sizing:content-box;border-radius:var(--micrio-marker-border-radius);border:var(--micrio-marker-border-size) solid var(--micrio-marker-border-color);transition:var(--micrio-marker-transition);background-clip:content-box;background-color:var(--micrio-marker-color)}div.default.micrio-marker:hover,div.default.hovered.micrio-marker,div.default.opened.micrio-marker{z-index:1}div.default.micrio-marker:hover button:where(.micrio-marker),div.default.hovered.micrio-marker button:where(.micrio-marker),div.default.opened.micrio-marker button:where(.micrio-marker){background-color:var(--micrio-marker-highlight);width:calc(var(--micrio-marker-size) + var(--micrio-marker-border-size) * 2);height:calc(var(--micrio-marker-size) + var(--micrio-marker-border-size) * 2);border-width:0}div.has-icon.micrio-marker button:where(.micrio-marker){--micrio-marker-icon:none}div.has-custom-icon.micrio-marker{--micrio-marker-size:32px}div.default.has-icon.micrio-marker button:where(.micrio-marker){color:#fff;width:calc(var(--micrio-marker-size) + 24px);height:calc(var(--micrio-marker-size) + 24px);background-color:var(--micrio-marker-border-color);border:none}div.default.has-icon.micrio-marker button:where(.micrio-marker)>svg{margin:0 auto}div.default.has-icon.opened.micrio-marker button:where(.micrio-marker)>svg,div.default.has-icon.hovered.micrio-marker button:where(.micrio-marker)>svg,div.default.has-icon.micrio-marker:hover button:where(.micrio-marker)>svg{color:var(--micrio-marker-highlight)}div.default.has-custom-icon.micrio-marker button:where(.micrio-marker){background-color:var(--micrio-marker-color)}div.default.has-custom-icon.opened.micrio-marker button:where(.micrio-marker),div.default.has-custom-icon.hovered.micrio-marker button:where(.micrio-marker),div.default.has-custom-icon.micrio-marker:hover button:where(.micrio-marker){background-color:var(--micrio-marker-highlight,var(--micrio-marker-color))}div.cluster.micrio-marker button:where(.micrio-marker){border:2px solid var(--micrio-marker-color);background:var(--micrio-cluster-marker-background,#fff);color:var(--micrio-cluster-marker-color,#000);width:calc(var(--micrio-marker-size) + 12px);height:calc(var(--micrio-marker-size) + 12px);box-sizing:content-box;border-radius:100%}div.cluster.micrio-marker:hover button:where(.micrio-marker){background:var(--micrio-marker-highlight,#fff);border-color:var(--micrio-marker-highlight,#fff)}div.cluster.micrio-marker label:where(.micrio-marker){pointer-events:none;display:none}div.micrio-marker img:where(.micrio-marker){max-width:100%;max-height:100%;margin:auto;display:block}div.micrio-waypoint{transform-style:preserve-3d;transform:var(--matrix);--micrio-bb:var(--micrio-button-background);--micrio-bbh:var(--micrio-button-background-hover);width:0;height:0;display:block;position:absolute;top:50%;left:50%}div.micrio-waypoint>button{--micrio-button-background:var(--micrio-waypoint-background,var(--micrio-bb));--micrio-button-background-hover:var(--micrio-waypoint-background-hover,var(--micrio-bbh));--micrio-button-size:var(--micrio-waypoint-size);--micrio-border-radius:var(--micrio-waypoint-border-radius,100%);--micrio-icon-size:var(--micrio-waypoint-icon-size,calc(var(--micrio-button-size) - 50px));pointer-events:all;border:var(--micrio-waypoint-border-size,var(--micrio-marker-border-size)) solid var(--micrio-waypoint-border-color,var(--micrio-marker-border-color));margin:0;transition:background-color .25s,opacity .25s,border-color .25s,transform .25s;transform:translate(-50%,-50%)scale(.5)}div.micrio-waypoint>button>svg{pointer-events:none;margin:0 auto}div.micrio-waypoint:hover>button,div.active.micrio-waypoint>button{transition:background-color .25s,opacity .25s,transform .25s;transform:translate(-50%,-50%)scale(.6)}div.clicked.micrio-waypoint>button{animation:.75s infinite alternate micrio-waypoint-pulse}@keyframes micrio-waypoint-pulse{0%{transform:translate(-50%,-50%)scale(.5)}to{transform:translate(-50%,-50%)scale(.75)}}.embed-container.micrio-embed{transform:translate3d(calc(var(--x,0) - 50%), calc(var(--y,0) - 50%), 0) scale3d(var(--s),var(--s),1);opacity:var(--opacity,1);will-change:transform, opacity;direction:ltr;display:block;position:absolute;top:0;left:0}.embed3d.micrio-embed{top:50%;left:50%}.embed-container.no-events.micrio-embed{pointer-events:none}.embed-container.micrio-embed>:where(.micrio-embed){cursor:pointer}.embed-container.micrio-embed>*{transform:translate3d(-50%,-50%,0) scale3d(var(--scale,1), var(--scale,1), 1);position:absolute}.embed-container.micrio-embed>:not(button){width:auto!important}.embed-container.micrio-embed:not(.no-events)>*{pointer-events:all}.embed-container.behind.micrio-embed>*{pointer-events:none}.embed-container.micrio-embed>img:where(.micrio-embed){max-width:none}.embed-container.micrio-embed>button{--scale:1;--ratio:1;width:100px;aspect-ratio:var(--ratio);background:0 0;border:none;margin:0;padding:0}.embed-container.micrio-embed>button,.embed-container.micrio-embed>img:where(.micrio-embed){touch-action:none}div.micrio-markers{pointer-events:none;will-change:width, height, top, left, opacity;width:100%;height:100%;perspective:inherit;position:absolute;top:0;left:0;overflow:hidden}div.micrio-markers:empty{display:none}div.micrio-markers>*{pointer-events:all}div.inactive.micrio-markers>*{pointer-events:none}div.is360.micrio-markers{transition:opacity .25s}div.is360.inactive.micrio-markers{opacity:0}aside.micrio-markers{pointer-events:none}aside.micrio-markers section:where(.micrio-markers){width:10cqw;min-width:200px;color:var(--micrio-marker-color);flex-direction:column;font-size:1em;font-weight:500;line-height:1em;display:flex;position:absolute;top:0;bottom:0}aside.micrio-markers section:where(.micrio-markers):first-child{align-items:flex-end;left:10px}aside.micrio-markers section:where(.micrio-markers):nth-child(2){align-items:flex-start;right:10px}aside.micrio-markers section:where(.micrio-markers) article:where(.micrio-markers){flex:1;align-items:center;max-height:30cqh;padding:10px;display:flex}aside.micrio-markers section:where(.micrio-markers) label:where(.micrio-markers){pointer-events:all;cursor:pointer;opacity:.75;max-width:160px;text-shadow:var(--micrio-marker-text-shadow);padding:10px;transition:opacity .25s,color .25s}label.hover.micrio-markers{color:var(--micrio-marker-highlight);opacity:1}aside.micrio-markers section:where(.micrio-markers):first-child article:where(.micrio-markers){justify-content:right}aside.micrio-markers section:where(.micrio-markers):first-child label:where(.micrio-markers){text-align:right}svg.micrio-markers{pointer-events:none;width:100%;height:100%;position:absolute}svg.micrio-markers line:where(.micrio-markers){stroke:var(--micrio-marker-highlight);stroke-width:2px}svg.micrio-markers line:where(.micrio-markers):not(.hovered){stroke:var(--micrio-marker-color);stroke-dasharray:10;stroke-width:1px;opacity:.75}svg.micrio-progress-circle{pointer-events:none;z-index:10;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)rotate(-90deg)}circle.micrio-progress-circle{transition:stroke-dashoffset .25s}
27
+ _css.className='micrio-interface';_css.textContent=`html{--micrio-color:#fff;--micrio-color-hover:#45a4e4;--micrio-border-radius:4px;--micrio-background:#292929bf;--micrio-background-filter:blur(8px);--micrio-popover-background:#292929bf;--micrio-scrubber-background:#ffffff40;--micrio-icon-size:18px;--micrio-text-align:left;--micrio-line-height:1.5em;--micrio-border-margin:16px;--micrio-button-size:48px;--micrio-button-shadow:0 4px 8px #00000054;--micrio-marker-size:16px;--micrio-marker-text-color:#fff;--micrio-marker-text-shadow:0px 2px 4px #0009;--micrio-marker-highlight:#00d4ee;--micrio-marker-color:#fff;--micrio-marker-border-radius:100%;--micrio-marker-border-color:#fff3;--micrio-marker-border-size:8px;--micrio-marker-icon:none;--micrio-marker-transition:background-color .25s ease, opacity .15s ease, border-width .15s ease, width .15s ease, height .15s ease;--micrio-popup-shadow:0 8px 16px #00000054;--micrio-popup-padding:16px;--micrio-progress-bar-background:#ffffff40;--micrio-progress-bar-height:4px;--micrio-waypoint-size:120px}micr-io[data-light-mode]{--micrio-color:#000;--micrio-color-hover:#196da6;--micrio-background:#ffffffa8;--micrio-progress-bar-background:#00000040;--micrio-popover-background:#d3d3d3bf;--micrio-scrubber-background:#ffffff80}@media (prefers-color-scheme:light){micr-io[data-auto-scheme]{--micrio-color:#000;--micrio-color-hover:#196da6;--micrio-background:#ffffffa8;--micrio-progress-bar-background:#00000040;--micrio-popover-background:#d3d3d3bf}}@media (width<=500px){html{--micrio-border-margin:5px;--micrio-button-size:48px}}micr-io{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;backface-visibility:hidden;background-position:50%;background-repeat:no-repeat;background-size:contain;width:100%;height:100%;min-height:200px;display:block;position:relative;overflow:hidden;container-type:size}micr-io,micr-io button{font-family:var(--micrio-font-family,inherit);font-size:var(--micrio-font-size,inherit);background-color:var(--micrio-background-color,transparent)}micr-io h3{font-weight:600}micr-io[dir=rtl]{--micrio-text-align:right}canvas.micrio{backface-visibility:hidden;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;display:block;position:absolute;top:0;left:0;width:100%!important;height:100%!important}micr-io:not([static]){overscroll-behavior:none}micr-io[data-hooked]:not([data-panning])>canvas.micrio{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:-ms-grab;cursor:grab;-ms-content-zooming:none;-ms-touch-action:none;touch-action:none}micr-io[data-panning]{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:-ms-grabbing;cursor:grabbing}micr-io[data-hooked][data-can-pan]>canvas.micrio{-ms-touch-action:pan-y;touch-action:pan-y;overscroll-behavior:initial}micr-io>.micrio-grid{grid-gap:0;will-change:transform;transform-origin:0 0;--translate:none;--scale:1;width:100%;height:100%;transform:var(--translate) scale3d(var(--scale), var(--scale), 1);grid-auto-flow:dense;display:grid;position:absolute;top:0;left:0}micr-io>.micrio-grid>button{cursor:pointer;background:0 0;border:none;grid-area:auto/auto/span 1/span 1;margin:0;padding:0}a.micrio-logo{top:calc(var(--micrio-border-margin) * 2);left:calc(var(--micrio-border-margin) * 2);z-index:2;cursor:pointer;width:22px;height:22px;transition:transform .25s;display:block;position:absolute}a.micrio-logo:hover{transform:rotate(-90deg)}a.micrio-logo:before,a.micrio-logo:after{content:"";will-change:transform;box-sizing:unset;display:block;position:absolute;transform:rotate(45deg)}a.micrio-logo:before{border:3px solid #00d4ee;width:16px;height:16px}a.loading.micrio-logo:before{animation:1s ease-out infinite micrio-logo-spin}a.micrio-logo:after{background:#c5ff5b;outline:1px solid #c5ff5b;width:6px;height:6px;top:8px;left:8px}a.loading.micrio-logo:after{animation:.5s ease-out infinite micrio-logo-spin}@keyframes micrio-logo-spin{0%{transform:rotate(45deg)}to{transform:rotate(135deg)}}a.micrio-logo-org{top:calc(var(--micrio-border-margin) * 2);right:calc(var(--micrio-border-margin) * 2);z-index:1;display:block;position:absolute}img.micrio-logo-org{max-height:64px;display:block}svg.micrio-icon{vertical-align:-.125em;height:1em;display:inline-block;overflow:visible}svg.small.micrio-icon{height:.75em}menu.micrio-menu{margin:0;padding:0;transition:background .2s,box-shadow .2s}.micrio-menu-action.micrio-menu{cursor:pointer;color:inherit;text-shadow:inherit;box-sizing:border-box;text-align:center;background:0 0;border:none;border-radius:0;padding:0 24px;font-family:inherit;font-size:.9em;text-decoration:none;display:block}@media (width<=500px){menu.micrio-menu{font-size:1em}.micrio-menu-action.micrio-menu{width:100%;margin-bottom:10px;padding:6px 0}strong.micrio-menu>svg{display:none}.items>menu.micrio-menu>.micrio-menu-action:where(.micrio-menu){font-size:1em}menu.micrio-toolbar>menu.micrio-menu>.micrio-menu-action:where(.micrio-menu){border-bottom:1px solid #ffffff80;margin-top:24px;font-size:1.5em}}@media (width>=501px){div.items.micrio-menu{max-height:calc(100vh - 160px);overflow:hidden auto}menu.micrio-toolbar>menu.micrio-menu{color:#fff;margin-right:var(--micrio-border-margin);border-radius:var(--micrio-border-radius);overflow:hidden}menu.micrio-toolbar>menu.micrio-menu:hover,menu.micrio-toolbar>menu.micrio-menu:focus-within{-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);background:var(--micrio-background);box-shadow:var(--micrio-button-shadow)}menu.micrio-toolbar>menu.micrio-menu>.micrio-menu-action:where(.micrio-menu){position:relative}menu.micrio-toolbar>menu.micrio-menu>.micrio-menu-action:where(.micrio-menu)>strong:where(.micrio-menu){margin:0 -5px;padding:5px}menu.micrio-toolbar>menu.micrio-menu:hover .micrio-menu-action:where(.micrio-menu),menu.micrio-toolbar>menu.micrio-menu:focus-within .micrio-menu-action:where(.micrio-menu){text-shadow:none;color:var(--micrio-color)}strong.micrio-menu>svg{margin-left:10px;line-height:2px}menu.micrio-menu{float:left;position:relative}menu.micrio-menu:not(:focus-within):not(:hover) .items:where(.micrio-menu){display:none}.micrio-menu-action.micrio-menu{height:var(--micrio-button-size);line-height:var(--micrio-button-size);width:100%;text-align:var(--micrio-text-align);white-space:pre;font-weight:600}.items menu.micrio-menu{float:none}.items .micrio-menu-action.micrio-menu{width:100%}.micrio-menu-action.micrio-menu:hover,.micrio-menu-action.micrio-menu:focus{text-shadow:none!important;color:var(--micrio-color-hover)!important}}.micrio-button{cursor:pointer;box-sizing:border-box;vertical-align:bottom;font:inherit;touch-action:none;color:var(--micrio-color);background:var(--micrio-button-background,var(--micrio-background,none)) var(--background,none) center center no-repeat;min-width:var(--micrio-button-size);height:var(--micrio-button-size);font-size:90%;line-height:var(--micrio-button-size);border-radius:var(--micrio-border-radius);box-shadow:var(--micrio-button-shadow);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);background-size:24px;border:none;margin:0;padding:0 8px;text-decoration:none;transition:opacity .25s;display:inline-block;position:relative}.micrio-button:hover{outline:none}.micrio-button.transparent.micrio-button,.micrio-button.transparent.micrio-button:hover{-webkit-backdrop-filter:none;backdrop-filter:none;background-color:#0000}.micrio-button>*{transition:opacity .25s}.micrio-button:disabled{pointer-events:none;cursor:default}.micrio-button:disabled>*{opacity:.4}.micrio-button.no-click.micrio-button{pointer-events:none}img.micrio-button{pointer-events:none;max-width:100%;max-height:100%;margin:0 auto;display:block}.micrio-button>*{width:var(--micrio-icon-size);font-size:var(--micrio-icon-size);fill:var(--micrio-color);margin:0 auto;display:block;height:var(--micrio-icon-size)!important}.micrio-button.active.micrio-button{color:var(--micrio-color-hover)}.micrio-button.active.micrio-button svg{fill:var(--micrio-color-hover)}@media (hover:hover){.micrio-button:hover{background-color:var(--micrio-button-background-hover,var(--micrio-button-background,var(--micrio-background)));color:var(--micrio-color-hover)}.micrio-button:hover svg{fill:var(--micrio-color-hover);stroke:var(--micrio-color-hover)}.micrio-button:focus{outline:1px solid var(--micrio-color-hover)}}menu.micrio-toolbar{top:calc(var(--micrio-border-margin) - (var(--micrio-button-size) / 2 - 27px));left:var(--micrio-border-margin);color:#fff;text-shadow:1px 1px 2px #000;z-index:1;margin:0;padding:0;transition:transform .25s;position:absolute}@media (width<=500px){.micrio-button.toggle{top:var(--micrio-border-margin);width:34px;height:34px;box-shadow:none;z-index:2;position:absolute;left:0}.micrio-button.toggle.indent{left:35px}menu.micrio-toolbar{box-sizing:border-box;width:100%;height:100%;-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);z-index:1;background:#000000bf;padding:32px 0;top:0;left:0;overflow:hidden auto;transform:translate(0,0)}menu.micrio-toolbar:not(.shown){transform:translate3d(calc(-100% - var(--micrio-border-margin) * 2), 0, 0)}}@media (width>=501px){menu.indent.micrio-toolbar{margin-left:calc(var(--micrio-border-margin) * 2 + 25px)}menu.micrio-toolbar>.micrio-menu:not(:hover)>button.micrio-menu{margin-bottom:-15px}}canvas.micrio-minimap{bottom:var(--micrio-border-margin);transform-origin:100% 100%;cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:-ms-grab;cursor:grab;-ms-content-zooming:none;-ms-touch-action:none;touch-action:none;border-radius:var(--micrio-border-radius);background-size:100%;transition:opacity .2s;display:block;position:absolute;right:5px}canvas:not(:hover).hidden.micrio-minimap{opacity:0;pointer-events:none}canvas.dragging.micrio-minimap{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:-ms-grabbing;cursor:grabbing}canvas.controls.micrio-minimap{right:calc(var(--micrio-border-margin) + var(--micrio-button-size) + 8px)}@media (width<=800px){canvas.micrio-minimap{pointer-events:none;right:65px;transform:scale(.5)}}div.micrio-button-group{box-shadow:var(--micrio-button-shadow);border-radius:var(--micrio-border-radius);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);background:var(--micrio-button-background,var(--micrio-background,none))}div.micrio-button-group:empty{display:none}div.micrio-button-group>.micrio-button{box-shadow:none;--micrio-background-filter:none;--micrio-button-background:none;display:block}div.micrio-button-group .micrio-button{border-radius:0}div.micrio-button-group .micrio-button:first-child{border-radius:var(--micrio-border-radius) var(--micrio-border-radius) 0 0}div.micrio-button-group .micrio-button:last-child{border-radius:0 0 var(--micrio-border-radius) var(--micrio-border-radius)}@media (width<=500px){div.micrio-button-group>*{height:calc(var(--micrio-button-size) - 4px)}div.micrio-button-group .micrio-button:first-child{padding-top:0}div.micrio-button-group .micrio-button:last-child{padding-bottom:0}}aside.micrio-controls{right:var(--micrio-border-margin);bottom:var(--micrio-border-margin);direction:rtl;margin:0;padding:0;transition:transform .25s,opacity .25s;position:absolute}aside.primary.micrio-controls:not(.portrait){right:calc(50% + var(--micrio-border-margin))}aside.primary.portrait.micrio-controls{bottom:calc(50% + var(--micrio-border-margin))}aside.hidden.micrio-controls{transform:translateX(calc(100% + var(--micrio-border-margin)));opacity:0;pointer-events:none}micr-io[data-switching]>aside.micrio-controls,micr-io[data-tour-active]>aside.micrio-controls{opacity:0;pointer-events:none}aside.micrio-controls>menu,aside.micrio-controls>button{width:var(--micrio-button-size);margin:8px 0;padding:0;display:block}menu.popout.micrio-controls{width:var(--micrio-button-size);height:var(--micrio-button-size);white-space:pre;pointer-events:none;box-shadow:var(--micrio-button-shadow);border-radius:var(--micrio-border-radius);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);direction:rtl;padding:0}menu.popout.micrio-controls:focus-within{pointer-events:all}menu.popout.micrio-controls button{pointer-events:all;--micrio-button-shadow:none;--micrio-background-filter:none;transition:border-radius .2s,opacity .2s}menu.popout.micrio-controls:hover>button:first-child{border-radius:0 var(--micrio-border-radius) var(--micrio-border-radius) 0}menu.popout.micrio-controls>:not(:first-child){border-radius:0;padding:0;transition:opacity .2s;display:inline-block}menu.popout.micrio-controls>button:last-child{border-radius:var(--micrio-border-radius) 0 0 var(--micrio-border-radius)}menu.popout.micrio-controls:not(:focus-within)>:not(:first-child){pointer-events:none;opacity:0}div.micrio-subtitles{text-align:center;color:#fff;pointer-events:none;width:100cqw;transition:transform .2s;position:absolute;bottom:50px;left:50cqw;transform:translate(-50%)}div.raised.micrio-subtitles{transform:translate3d(-50%, calc(-1 * var(--micrio-button-size)), 0)}div.micrio-subtitles p:where(.micrio-subtitles){-webkit-box-decoration-break:clone;box-decoration-break:clone;white-space:pre-wrap;text-shadow:2px 2px 1px #0005;font-size:2.5em;line-height:inherit;background-color:#0009;margin:.5em 0;padding:0 14px;display:inline}@media (width<=640px){div.micrio-subtitles{width:95cqw;font-size:.7em}}div.container.micrio-progress-bar{width:auto;color:var(--micrio-color);background:var(--micrio-background);cursor:default;flex:1;align-items:center;line-height:8px;display:flex}div.bars.micrio-progress-bar{height:var(--micrio-progress-bar-height);background:var(--micrio-progress-bar-background);flex:1;display:flex;position:relative}div.bars.micrio-progress-bar>*{box-sizing:border-box;cursor:pointer;width:100%;height:100%;display:block;position:relative;overflow:hidden}div.bars.micrio-progress-bar>:before{content:" ";background:var(--micrio-color);pointer-events:none;height:100%;width:var(--progress,0%);will-change:width;display:block;position:absolute}div.bars.micrio-progress-bar:after{content:"";width:16px;height:16px;left:var(--progress);background-color:var(--micrio-color);pointer-events:none;border-radius:8px;display:block;position:absolute;top:50%;transform:translate(-50%,-50%)}div.time.micrio-progress-bar{text-align:center;font-variant-numeric:tabular-nums;min-width:50px;padding:0 10px;font-size:90%;display:block}aside.micrio-media-controls{cursor:default;background:var(--micrio-background);align-items:center;margin:0;display:flex;position:relative}aside.micrio-media-controls>button{border:none;border-radius:0;margin:0}aside.micrio-media-controls>button:last-child{margin-right:16px}aside.micrio-media-controls>*{--micrio-button-background:none;--micrio-background-filter:none;--micrio-button-shadow:none}:fullscreen>aside.micrio-media-controls{border-radius:var(--micrio-border-radius);width:430px;max-width:90cqw;position:absolute;bottom:5px;left:50%;transform:translate(-50%)}svg.micrio-media-controls{pointer-events:none;width:42px;height:42px;position:absolute;top:-1px;left:-1px;transform:rotate(-90deg)}circle.micrio-media-controls{stroke-width:2px;stroke:#fff;fill:#0000;stroke-dasharray:119.4 119.4;transform-origin:50%;transition:stroke-dashoffset .25s linear}figure.micrio-media{width:100%;margin:0;display:block;position:relative}figure.micrio-media div:where(.micrio-media){cursor:pointer}figure.micrio-media div.videotour:where(.micrio-media){display:flex}figure.micrio-media:fullscreen div:where(.micrio-media){flex-direction:column;width:100vw;height:100vh;display:flex}figure.micrio-media:fullscreen div:where(.micrio-media)>:first-child{flex:1}.marker-popup>figure.micrio-media>div:where(.micrio-media){width:100%}iframe.micrio-media,video.micrio-media{max-width:unset;display:block}figure.is360.micrio-media{width:360px;position:absolute;bottom:5px;left:50%;transform:translate(-50%)}figure.is360.micrio-media video:where(.micrio-media){width:200px;height:200px;display:none}iframe.hooked.micrio-media{pointer-events:none}figcaption.micrio-media{text-align:center;color:var(--micrio-color);margin:.5em 1em;font-size:90%;font-style:italic}:not(.micrio-popover)>figure.micrio-media>figcaption:where(.micrio-media)>*,.micrio-popover figure.micrio-media{margin:0}aside.micrio-media{width:100%;display:flex}aside.inside.micrio-media{position:absolute;transform:translateY(-100%)}div.show-play.micrio-media{cursor:pointer;background:#0008;justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:fixed;top:0;left:0}div.show-play.micrio-media>button.micrio-button{transform:scale(2)}figure.micrio-media:not(.media-micrio) button.micrio-button{white-space:pre;--micrio-background-filter:none;--micrio-button-shadow:none;border:none;border-radius:0;margin:0}figure.media-micrio.micrio-media{text-align:var(--micrio-text-align)}article.micrio-article{text-align:var(--micrio-text-align);line-height:var(--micrio-line-height,1.5em)}article.micrio-article>:first-child{margin-top:0}article.micrio-article>:last-child{margin-bottom:0}article.micrio-article p a{color:var(--micrio-color-hover,inherit);word-wrap:break-word}main.micrio-marker-content{padding:var(--micrio-popup-padding);-webkit-user-select:text;user-select:text;color:var(--micrio-color);background:var(--micrio-background);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);box-shadow:var(--micrio-popup-shadow);border-radius:var(--micrio-border-radius);box-sizing:border-box;text-align:var(--micrio-text-align);padding-bottom:0;position:relative;overflow-y:auto}main.micrio-marker-content>*{--micrio-button-background:none;--micrio-background-filter:none;--micrio-button-shadow:none}main.micrio-marker-content .micrio-progress-bar.container{-webkit-backdrop-filter:none;backdrop-filter:none;background:0 0}main.micrio-marker-content::-webkit-scrollbar{background-color:#0000;width:10px}main.micrio-marker-content::-webkit-scrollbar-thumb{background:var(--micrio-color);border-radius:var(--micrio-border-radius);margin-top:10px}main.empty.micrio-marker-content{width:auto}main.micrio-marker-content h1:where(.micrio-marker-content){margin:0 0 1.25em;font-size:1.5em;font-weight:600}main.micrio-marker-content>figure.micrio-media{margin:calc(-1 * var(--micrio-popup-padding));--micrio-background:transparent;width:auto;margin-bottom:0}main.micrio-marker-content>figure.micrio-media:not(.media-video):not(:last-child)>:last-child:not(figcaption){margin-bottom:var(--micrio-popup-padding);background:var(--micrio-background);padding:0 var(--micrio-popup-padding)}main.micrio-marker-content>figure.micrio-media.media-video{margin-bottom:var(--micrio-popup-padding)}main.micrio-marker-content>figure.micrio-media>div>aside.micrio-media{--micrio-background:transparent}main.micrio-marker-content>article:last-child{margin-bottom:var(--micrio-popup-padding)}main.micrio-marker-content p{white-space:pre-line}main.micrio-marker-content figure.hidden{display:none}main.micrio-marker-content figure>div.micrio-media>:first-child{width:100%}button.micrio-marker-content{margin:0 calc(-1 * var(--micrio-popup-padding)) var(--micrio-popup-padding) calc(-1 * var(--micrio-popup-padding));padding:0}button.micrio-marker-content:disabled{cursor:default}figcaption.micrio-marker-content{margin-bottom:var(--micrio-popup-padding);text-align:center;padding:10px;font-size:.9em;font-style:italic}section.micrio-marker-content{margin-bottom:var(--micrio-popup-padding);grid-template-columns:repeat(auto-fit,minmax(100px,1fr));justify-items:center;gap:5px;display:grid}section.micrio-marker-content button:where(.micrio-marker-content){color:inherit;cursor:pointer;border:none;width:100%;margin:0;display:block}section.micrio-marker-content figure:where(.micrio-marker-content){margin:0;padding:0}section.micrio-marker-content img:where(.micrio-marker-content){object-fit:cover;width:100%;display:block}@media (width<=500px){section.micrio-marker-content{float:right;width:100px;margin-left:var(--micrio-border-margin);display:block}section.micrio-marker-content>button:where(.micrio-marker-content):not(:first-child),section.micrio-marker-content figcaption:where(.micrio-marker-content){display:none}}div.micrio-marker-popup{cursor:auto;pointer-events:all;top:var(--micrio-border-margin);left:var(--micrio-border-margin);display:block;position:absolute}div.destroying.micrio-marker-popup{pointer-events:none}div.micrio-marker-popup>main{max-height:80cqh}aside.micrio-marker-popup{padding:var(--micrio-border-margin)}aside.micrio-marker-popup progress:where(.micrio-marker-popup){display:none}@media (width>=501px){div.micrio-marker-popup{width:440px;min-width:20%}aside.micrio-marker-popup{padding-top:0;position:absolute;top:0;left:100%}aside.micrio-marker-popup>.micrio-button{margin:0 0 8px;padding:0;display:block}}div.micrio-marker-popup>main>:not(h3){transition-property:margin-top,margin-bottom,height,opacity;transition-duration:.5s;transition-timing-function:ease;overflow:hidden}div.minimized.micrio-marker-popup>main>:not(h3){opacity:0;margin-top:0;margin-bottom:0}@media (width<=500px){aside.micrio-marker-popup{margin-bottom:var(--micrio-border-margin);flex-direction:row-reverse;align-items:center;padding:0;display:flex;position:relative}aside.micrio-marker-popup progress:where(.micrio-marker-popup){opacity:0;pointer-events:none;flex:1;display:block}aside.micrio-marker-popup .micrio-tour-controls{display:flex;margin-bottom:0!important}aside.micrio-marker-popup .micrio-button{height:var(--micrio-button-size);margin:0 0 0 8px;padding:0!important;display:block!important}div.micrio-marker-popup{width:auto;right:var(--micrio-border-margin);bottom:calc(var(--micrio-button-size) + 2 * var(--micrio-border-margin));flex-direction:column;justify-content:space-between;display:flex}div.micrio-marker-popup>main{max-height:40vh}div.micrio-marker-popup>main>:not(h3){overflow:visible}}button.tour-step.micrio-marker-popup{vertical-align:middle;cursor:default;height:auto;line-height:normal}ol.micrio-serial-tour{color:var(--micrio-color);text-shadow:var(--micrio-marker-text-shadow);margin:0;list-style-type:decimal-leading-zero;position:absolute;bottom:75px;left:0}ol.micrio-serial-tour>li:where(.micrio-serial-tour){white-space:pre;height:1.5em;transition:height .25s,opacity .25s .25s}ol.micrio-serial-tour li.active:where(.micrio-serial-tour){font-weight:700}.minimized>ol.micrio-serial-tour>li:where(.micrio-serial-tour):not(.active){opacity:0;height:0;transition:height .25s .25s,opacity .25s}ol.micrio-serial-tour li:where(.micrio-serial-tour) button:where(.micrio-serial-tour){font:inherit;color:inherit;text-shadow:inherit;cursor:pointer;background:0 0;border:none;display:inline}ol.micrio-serial-tour li:where(.micrio-serial-tour) button:where(.micrio-serial-tour):hover{text-decoration:underline}aside.micrio-media-controls.micrio-serial-tour>figure.micrio-media{display:none}div.micrio-tour{bottom:var(--micrio-border-margin);max-width:calc(100% - var(--micrio-border-margin) * 2);box-sizing:border-box;border-radius:var(--micrio-border-radius);box-shadow:var(--micrio-button-shadow);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);background-color:var(--micrio-button-background,var(--micrio-background,none));padding:0;transition:transform .2s;display:flex;position:absolute;left:50%;transform:translate(-50%)}div:not(:hover).minimized.micrio-tour{transform:translate3d(-50%, calc(100% + var(--micrio-border-margin)), 0);pointer-events:none}.serial-tour.micrio-tour>*{--micrio-background:none}.serial-tour.minimized.micrio-tour{transform:translate3d(0, calc(100% + var(--micrio-border-margin)), 0)}.serial-tour.micrio-tour,.video-tour.micrio-tour{width:500px}div.micrio-tour>*{--micrio-button-background:none}div.micrio-tour button{white-space:pre;--micrio-background-filter:none;--micrio-button-shadow:none;border:none;border-radius:0;margin:0}article.scroll-tour.micrio-tour{scroll-snap-type:y mandatory;width:100%;height:100%;position:absolute;top:0;left:0;overflow:hidden scroll}button.micrio-button.scroll-tour-end{position:absolute;top:5px;right:5px}article.micrio-tour>div.micrio-marker-popup{scroll-snap-align:center;margin:20cqh 50px 50cqh;position:relative!important}article.micrio-tour>div.micrio-marker-popup:nth-child(2n){margin-left:auto}article.micrio-tour>div.micrio-marker-popup>aside{display:none}div.micrio-dial{bottom:var(--micrio-border-margin);width:320px;max-width:calc(100vw - calc(2 * (var(--micrio-button-size) + 4 * var(--micrio-border-margin))));max-width:calc(100cqw - calc(2 * (var(--micrio-button-size) + 4 * var(--micrio-border-margin))));height:calc(var(--micrio-button-size) * .6);touch-action:none;cursor:w-resize;background-color:#0000;position:absolute;left:50%;overflow:hidden;transform:translate(-50%)}div.micrio-dial:before,div.micrio-dial:after{content:"";background-position:var(--micrio-dial-offset,0px);width:100%;display:block;position:absolute}div.micrio-dial:before{background-image:repeating-linear-gradient(90deg,#8888 0% .5%,#0000 1% 2.5%);height:50%;top:25%}div.micrio-dial:after{background-image:repeating-linear-gradient(90deg,#fff8 0% .5%,#0000 1% 20%);height:100%}span.micrio-dial{line-height:calc(var(--micrio-button-size) * .6);color:var(--micrio-color);opacity:.85;pointer-events:none;text-shadow:1px 1px 3px #000,-1px -1px 3px #000;font-size:smaller;display:block;position:absolute;bottom:0;left:50%;transform:translate(calc(5px - 50%))}ul.micrio-gallery{bottom:var(--micrio-border-margin);background:var(--micrio-button-background,var(--micrio-background,none));box-shadow:var(--micrio-button-shadow);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);border-radius:var(--micrio-border-radius);height:var(--micrio-button-size);color:var(--micrio-color);touch-action:none;cursor:pointer;width:520px;max-width:calc(100cqw - 50px);margin:0;padding:0 16px;list-style-type:none;transition:transform .25s,opacity .25s;display:block;position:absolute;left:50%;transform:translate(-50%)}@media (width<=500px){ul.micrio-gallery{left:var(--micrio-border-margin);right:calc(var(--micrio-button-size) + var(--micrio-border-margin) * 2);width:auto;transform:none}}.track.micrio-gallery{background:var(--micrio-scrubber-background);pointer-events:none;border-radius:2px;height:2px;position:absolute;top:50%;left:16px;right:16px;overflow:hidden;transform:translateY(-50%)}.track-fill.micrio-gallery{background:var(--micrio-color);opacity:.85;border-radius:2px;height:100%;transition:width .15s;display:block;position:absolute;top:0;left:0}.ticks.micrio-gallery{pointer-events:none;position:absolute;inset:0 16px}.tick.micrio-gallery{background:var(--micrio-color);opacity:.55;border-radius:50%;width:6px;height:6px;transition:opacity .2s,transform .2s,background-color .2s;position:absolute;top:50%;transform:translate(-50%,-50%)}.tick.active.micrio-gallery{opacity:1;background:var(--micrio-color-hover,var(--micrio-color));transform:translate(-50%,-50%)scale(1.6)}@media (hover:hover){.tick.hover.micrio-gallery{opacity:1;transform:translate(-50%,-50%)scale(1.4)}}ul.dense.micrio-gallery .tick:where(.micrio-gallery){opacity:.35;border-radius:1px;width:1.5px;height:8px;transform:translate(-50%,-50%)}ul.dense.micrio-gallery .tick.major:where(.micrio-gallery){opacity:.6;height:12px}ul.dense.micrio-gallery .tick.active:where(.micrio-gallery){opacity:1;background:var(--micrio-color-hover,var(--micrio-color));width:2px;height:14px;transform:translate(-50%,-50%)}@media (hover:hover){ul.dense.micrio-gallery .tick.hover:where(.micrio-gallery){opacity:.9;transform:translate(-50%,-50%)}}.hover-label.micrio-gallery{font-variant-numeric:tabular-nums;color:var(--micrio-color);background:var(--micrio-popover-background);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);box-shadow:var(--micrio-button-shadow);pointer-events:none;white-space:nowrap;border-radius:999px;padding:2px 8px;font-size:11px;font-weight:600;line-height:1.4;position:absolute;bottom:calc(100% + 6px);transform:translate(-50%)}.handle.micrio-gallery{box-sizing:border-box;background:var(--micrio-color);border:2px solid var(--micrio-color);cursor:ew-resize;touch-action:none;min-width:28px;height:28px;box-shadow:0 2px 8px #00000059, 0 0 0 0 var(--micrio-color-hover);border-radius:999px;padding:0;transition:left .15s,height .15s,min-width .15s,background-color .2s,box-shadow .2s;position:absolute;top:50%;left:0;transform:translate(-50%,-50%)}.handle.micrio-gallery:hover{box-shadow:0 2px 8px #0006,0 0 0 4px #ffffff1f}.handle.dragging.micrio-gallery{cursor:grabbing;transition:none;box-shadow:0 2px 12px #00000080,0 0 0 6px #ffffff26}.handle-label.micrio-gallery{font-variant-numeric:tabular-nums;color:var(--micrio-color);background:var(--micrio-popover-background);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);box-shadow:var(--micrio-button-shadow);pointer-events:none;white-space:nowrap;border-radius:999px;padding:3px 9px;font-size:12px;font-weight:600;line-height:1.4;transition:left .15s,transform .15s;position:absolute;bottom:calc(100% + 8px);left:0;transform:translate(-50%)}.handle-label.dragging.micrio-gallery{transition:none;transform:translate(-50%)scale(1.05)}button.angular.micrio-gallery{width:var(--micrio-button-size);height:var(--micrio-button-size);background:var(--micrio-scrubber-background);border-radius:var(--micrio-border-radius);color:#444;cursor:move;border:none;padding:0;font-size:32px;line-height:42px;transition:background-color .2s;position:absolute;bottom:42px;left:50%;transform:translate(-50%)}button.angular.micrio-gallery:hover{background:#eee8}button.angular.dragging.micrio-gallery{transition:none}div.micrio-gallery{pointer-events:none;position:absolute;inset:0}div.micrio-gallery>*{pointer-events:auto}div.micrio-gallery>button.gallery-btn{transition:transform .25s,opacity .25s;position:absolute;top:50%;transform:translateY(-50%)}div.micrio-gallery>button.gallery-btn.arrow-left{left:var(--micrio-border-margin)}div.micrio-gallery>button.gallery-btn.arrow-right{right:var(--micrio-border-margin)}div.hidden.micrio-gallery:not(:hover)>ul{transform:translate(-50%, calc(100% + var(--micrio-border-margin)));opacity:0;pointer-events:none}@media (width<=500px){div.hidden.micrio-gallery:not(:hover)>ul{transform:translateY(calc(100% + var(--micrio-border-margin)))}}div.hidden.micrio-gallery:not(:hover)>button.gallery-btn.arrow-left{transform:translate(calc(-100% - var(--micrio-border-margin)), -50%);opacity:0;pointer-events:none}div.hidden.micrio-gallery:not(:hover)>button.gallery-btn.arrow-right{transform:translate(calc(100% + var(--micrio-border-margin)), -50%);opacity:0;pointer-events:none}div.micrio-gallery>button.gallery-btn:disabled{opacity:0;pointer-events:none}details.micrio-details{bottom:var(--micrio-border-margin);left:var(--micrio-border-margin);padding:var(--micrio-popup-padding);-webkit-user-select:text;user-select:text;white-space:normal;box-sizing:border-box;max-width:410px;color:var(--micrio-color);background:var(--micrio-background);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);box-shadow:var(--micrio-popup-shadow);border-radius:var(--micrio-border-radius);font-size:.9em;transition:all .5s;position:absolute}details.micrio-details summary:where(.micrio-details){cursor:pointer;list-style:none}details.micrio-details summary:where(.micrio-details)::-webkit-details-marker{display:none}details.micrio-details small:where(.micrio-details){font-style:italic;font-weight:400;display:block}details.micrio-details>:where(.micrio-details){text-overflow:ellipsis;margin:0;overflow:hidden}details.micrio-details a{color:var(--micrio-color-hover,inherit)}details.micrio-details button{position:absolute;top:0;left:calc(100% + 8px)}@media (width<=600px){details.micrio-details{max-width:calc(100% - 10px)}details.micrio-details:not([open]) cite:where(.micrio-details){display:none}details.micrio-details:not([open]) summary:where(.micrio-details)::marker{content:"?";margin-right:5px;font-size:20px;font-weight:700;line-height:20px;display:inline-block}details.micrio-details:not([open]) summary:where(.micrio-details)::-webkit-details-marker{content:"?";margin-right:5px;font-size:20px;font-weight:700;line-height:20px;display:inline-block}details.micrio-details button{position:absolute;inset:auto 0 calc(100% + 8px) auto}}div.micrio-error{color:#fff;text-align:center;white-space:pre-wrap;-webkit-user-select:text;user-select:text;z-index:10;background:#000000bf;border:1px solid #fff;border-radius:5px;padding:10px;line-height:24px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}div.micrio-error svg{vertical-align:middle;width:24px;height:24px;fill:var(--micrio-color);margin-right:10px}@media screen and (width<=520px){div.micrio-error{box-sizing:border-box;width:90%}}figure.micrio-micrio-gallery{position:relative}micr-io.micrio-micrio-gallery{background:0 0;width:100%;height:100%;display:block}micr-io.micrio-micrio-gallery ul.micrio-gallery{--micrio-border-margin:16px}figcaption.micrio-micrio-gallery{top:var(--micrio-border-margin);left:var(--micrio-border-margin);padding:var(--micrio-popup-padding);box-sizing:border-box;max-width:410px;color:var(--micrio-color);background:var(--micrio-background);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);box-shadow:var(--micrio-popup-shadow);border-radius:var(--micrio-border-radius);position:absolute}@media (width<=501px){figcaption.micrio-micrio-gallery{max-width:calc(100% - 3 * var(--micrio-border-margin) - var(--micrio-button-size))}}dialog.micrio-popover::backdrop{color:#fff;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);animation:.2s forwards micrio-popover-fadeInBg}@keyframes micrio-popover-fadeInBg{0%{background:0 0}to{background:var(--micrio-popover-background)}}@keyframes micrio-popover-fadeIn{0%{opacity:0}to{opacity:1}}dialog.micrio-popover{pointer-events:all;background:0 0;border:none;max-width:90cqw;max-height:90cqh;padding:0;animation:.5s forwards micrio-popover-fadeIn;overflow:visible}dialog.micrio-popover div.micrio-media>:first-child{border-radius:var(--micrio-border-radius);overflow:hidden}dialog.micrio-popover div.micrio-media>aside{--micrio-background:none;--micrio-button-background:none}dialog.page.article.micrio-popover figure.media-video iframe{width:100%}aside.micrio-popover{--micrio-background-filter:none;z-index:1;position:absolute}dialog.micrio-popover:not(.article){display:flex}dialog.micrio-popover:not(.article) figure>div.micrio-media{height:100%}@media (width>=640px){aside.micrio-popover{margin-left:var(--micrio-border-margin);display:block;top:0;left:100%}aside.inside.micrio-popover{margin-left:0;margin-top:var(--micrio-border-margin);margin-right:var(--micrio-border-margin);top:0;left:auto;right:0}aside.micrio-popover:not(.inside){z-index:2;position:absolute;top:0;left:100%}aside.micrio-popover>.micrio-button{margin:0 0 8px;padding:0;display:block}dialog.micrio-popover:not(.article){width:calc(85cqw - 56px);height:47.8125cqw}dialog.micrio-popover>main{width:25cqw;min-width:unset;max-width:320px}dialog.micrio-popover>main>h1{margin-right:55px}}@media (width<=639px){aside.micrio-popover{top:var(--micrio-border-margin);right:var(--micrio-border-margin);position:fixed}aside.micrio-popover .micrio-button{height:var(--micrio-button-size);box-shadow:var(--micrio-button-shadow);margin-left:8px;border-radius:var(--micrio-border-radius)!important;padding:0!important;display:inline-block!important}dialog.micrio-popover:not(.article){flex-direction:column;width:100%;height:100%}dialog.micrio-popover:not(.article) figure.micrio-media{flex:1}}dialog.micrio-popover>figure{flex:1;margin:0;position:relative}dialog.micrio-popover>figure>div.micrio-media>:first-child{width:100%;height:calc(100% - var(--micrio-button-size))}dialog.micrio-popover>figure>div.micrio-media>micr-io{height:100%!important}@media (aspect-ratio>=16/9){dialog.micrio-popover:not(.article){width:133.333cqh;height:75cqh}}@media (width<=639px){dialog.micrio-popover div.micrio-media>:first-child{border-radius:0}dialog.micrio-popover:not(.article)>:first-child{flex-direction:column;justify-content:center;height:50cqh}dialog.micrio-popover:not(.article)>figure:first-child{flex-direction:column;flex:none;display:flex}}dialog.article.micrio-popover>article{text-shadow:none;color:var(--micrio-color);background:var(--micrio-background);box-sizing:border-box;border-radius:var(--micrio-border-radius);max-height:calc(90vh - 48px);padding:20px;overflow:hidden auto}@media (width>=640px){dialog.article.micrio-popover{width:540px}}dialog.article.micrio-popover h2:where(.micrio-popover){text-align:center}dialog.article.micrio-popover article img{width:100%;height:auto}menu.micrio-popover{margin:10px 0;padding:0;list-style:none}menu.micrio-popover>.micrio-button{margin-right:10px}menu.right.micrio-popover{text-align:right}menu.right.micrio-popover>.micrio-button{margin:0 0 0 10px}dialog.gallery.micrio-popover{width:100%;height:100%;max-width:unset;max-height:unset}div.micrio-marker{transform:translate3d(calc(var(--x,0) - 50%), calc(var(--y,0) - 50%), 0) scale3d(var(--scale,1), var(--scale,1), 1);will-change:transform;display:block;position:absolute;top:0;left:0}div.micrio-marker:not(.cluster):not(.no-fade){animation:.25s forwards micrio-marker-fadeIn}div.overlapped.micrio-marker{display:none}@keyframes micrio-marker-fadeIn{0%{opacity:0}to{opacity:1}}div.behind.micrio-marker{pointer-events:none;opacity:0!important}div.mat3d.micrio-marker{transform:var(--mat);transform-style:preserve-3d;top:50%;left:50%}div.mat3d.micrio-marker>button:where(.micrio-marker){position:absolute;transform:translate(-50%,-50%)}button.micrio-marker{width:var(--micrio-marker-size);height:var(--micrio-marker-size);color:var(--micrio-marker-text-color);cursor:pointer;font:inherit;background:50% no-repeat;background-image:var(--micrio-marker-icon);background-size:contain;border:none;margin:0;padding:0;display:block;position:relative}div.micrio-marker:not(.cluster) label:where(.micrio-marker){text-align:var(--micrio-text-align);cursor:pointer;white-space:pre-wrap;width:max-content;max-width:170px;text-shadow:var(--micrio-marker-text-shadow);opacity:0;pointer-events:none;padding-left:10px;font-size:90%;font-weight:600;line-height:1em;transition:opacity .1s;position:absolute;top:50%;left:100%;transform:translateY(-50%)}div.micrio-marker:hover{z-index:2}.show-titles>div.micrio-marker label:where(.micrio-marker),div.micrio-marker:hover label:where(.micrio-marker){opacity:1}@media (width<=640px){div.micrio-marker:not(.cluster) label:where(.micrio-marker){font-size:12px}}.show-titles>div.micrio-marker label:where(.micrio-marker){pointer-events:all}label.static.micrio-marker{transform:translate(-50%, 4px) scale3d(calc(1 / var(--scale,1)), calc(1 / var(--scale,1)), 1)}div.default.micrio-marker button:where(.micrio-marker){box-sizing:content-box;border-radius:var(--micrio-marker-border-radius);border:var(--micrio-marker-border-size) solid var(--micrio-marker-border-color);transition:var(--micrio-marker-transition);background-clip:content-box;background-color:var(--micrio-marker-color)}div.default.micrio-marker:hover,div.default.hovered.micrio-marker,div.default.opened.micrio-marker{z-index:1}div.default.micrio-marker:hover button:where(.micrio-marker),div.default.hovered.micrio-marker button:where(.micrio-marker),div.default.opened.micrio-marker button:where(.micrio-marker){background-color:var(--micrio-marker-highlight);width:calc(var(--micrio-marker-size) + var(--micrio-marker-border-size) * 2);height:calc(var(--micrio-marker-size) + var(--micrio-marker-border-size) * 2);border-width:0}div.has-icon.micrio-marker button:where(.micrio-marker){--micrio-marker-icon:none}div.has-custom-icon.micrio-marker{--micrio-marker-size:32px}div.default.has-icon.micrio-marker button:where(.micrio-marker){color:#fff;width:calc(var(--micrio-marker-size) + 24px);height:calc(var(--micrio-marker-size) + 24px);background-color:var(--micrio-marker-border-color);border:none}div.default.has-icon.micrio-marker button:where(.micrio-marker)>svg{margin:0 auto}div.default.has-icon.opened.micrio-marker button:where(.micrio-marker)>svg,div.default.has-icon.hovered.micrio-marker button:where(.micrio-marker)>svg,div.default.has-icon.micrio-marker:hover button:where(.micrio-marker)>svg{color:var(--micrio-marker-highlight)}div.default.has-custom-icon.micrio-marker button:where(.micrio-marker){background-color:var(--micrio-marker-color)}div.default.has-custom-icon.opened.micrio-marker button:where(.micrio-marker),div.default.has-custom-icon.hovered.micrio-marker button:where(.micrio-marker),div.default.has-custom-icon.micrio-marker:hover button:where(.micrio-marker){background-color:var(--micrio-marker-highlight,var(--micrio-marker-color))}div.cluster.micrio-marker button:where(.micrio-marker){border:2px solid var(--micrio-marker-color);background:var(--micrio-cluster-marker-background,#fff);color:var(--micrio-cluster-marker-color,#000);width:calc(var(--micrio-marker-size) + 12px);height:calc(var(--micrio-marker-size) + 12px);box-sizing:content-box;border-radius:100%}div.cluster.micrio-marker:hover button:where(.micrio-marker){background:var(--micrio-marker-highlight,#fff);border-color:var(--micrio-marker-highlight,#fff)}div.cluster.micrio-marker label:where(.micrio-marker){pointer-events:none;display:none}div.micrio-marker img:where(.micrio-marker){max-width:100%;max-height:100%;margin:auto;display:block}div.micrio-waypoint{transform-style:preserve-3d;transform:var(--matrix);--micrio-bb:var(--micrio-button-background);--micrio-bbh:var(--micrio-button-background-hover);width:0;height:0;display:block;position:absolute;top:50%;left:50%}div.micrio-waypoint>button{--micrio-button-background:var(--micrio-waypoint-background,var(--micrio-bb));--micrio-button-background-hover:var(--micrio-waypoint-background-hover,var(--micrio-bbh));--micrio-button-size:var(--micrio-waypoint-size);--micrio-border-radius:var(--micrio-waypoint-border-radius,100%);--micrio-icon-size:var(--micrio-waypoint-icon-size,calc(var(--micrio-button-size) - 50px));pointer-events:all;border:var(--micrio-waypoint-border-size,var(--micrio-marker-border-size)) solid var(--micrio-waypoint-border-color,var(--micrio-marker-border-color));margin:0;transition:background-color .25s,opacity .25s,border-color .25s,transform .25s;transform:translate(-50%,-50%)scale(.5)}div.micrio-waypoint>button>svg{pointer-events:none;margin:0 auto}div.micrio-waypoint:hover>button,div.active.micrio-waypoint>button{transition:background-color .25s,opacity .25s,transform .25s;transform:translate(-50%,-50%)scale(.6)}div.clicked.micrio-waypoint>button{animation:.75s infinite alternate micrio-waypoint-pulse}@keyframes micrio-waypoint-pulse{0%{transform:translate(-50%,-50%)scale(.5)}to{transform:translate(-50%,-50%)scale(.75)}}.embed-container.micrio-embed{transform:translate3d(calc(var(--x,0) - 50%), calc(var(--y,0) - 50%), 0) scale3d(var(--s),var(--s),1);opacity:var(--opacity,1);will-change:transform, opacity;direction:ltr;display:block;position:absolute;top:0;left:0}.embed3d.micrio-embed{top:50%;left:50%}.embed-container.no-events.micrio-embed{pointer-events:none}.embed-container.micrio-embed>:where(.micrio-embed){cursor:pointer}.embed-container.micrio-embed>*{transform:translate3d(-50%,-50%,0) scale3d(var(--scale,1), var(--scale,1), 1);position:absolute}.embed-container.micrio-embed>:not(button){width:auto!important}.embed-container.micrio-embed:not(.no-events)>*{pointer-events:all}.embed-container.behind.micrio-embed>*{pointer-events:none}.embed-container.micrio-embed>img:where(.micrio-embed){max-width:none}.embed-container.micrio-embed>button{--scale:1;--ratio:1;width:100px;aspect-ratio:var(--ratio);background:0 0;border:none;margin:0;padding:0}.embed-container.micrio-embed>button,.embed-container.micrio-embed>img:where(.micrio-embed){touch-action:none}div.micrio-markers{pointer-events:none;will-change:width, height, top, left, opacity;width:100%;height:100%;perspective:inherit;position:absolute;top:0;left:0;overflow:hidden}div.micrio-markers:empty{display:none}div.micrio-markers>*{pointer-events:all}div.inactive.micrio-markers>*{pointer-events:none}div.is360.micrio-markers{transition:opacity .25s}div.is360.inactive.micrio-markers{opacity:0}aside.micrio-markers{pointer-events:none}aside.micrio-markers section:where(.micrio-markers){width:10cqw;min-width:200px;color:var(--micrio-marker-color);flex-direction:column;font-size:1em;font-weight:500;line-height:1em;display:flex;position:absolute;top:0;bottom:0}aside.micrio-markers section:where(.micrio-markers):first-child{align-items:flex-end;left:10px}aside.micrio-markers section:where(.micrio-markers):nth-child(2){align-items:flex-start;right:10px}aside.micrio-markers section:where(.micrio-markers) article:where(.micrio-markers){flex:1;align-items:center;max-height:30cqh;padding:10px;display:flex}aside.micrio-markers section:where(.micrio-markers) label:where(.micrio-markers){pointer-events:all;cursor:pointer;opacity:.75;max-width:160px;text-shadow:var(--micrio-marker-text-shadow);padding:10px;transition:opacity .25s,color .25s}label.hover.micrio-markers{color:var(--micrio-marker-highlight);opacity:1}aside.micrio-markers section:where(.micrio-markers):first-child article:where(.micrio-markers){justify-content:right}aside.micrio-markers section:where(.micrio-markers):first-child label:where(.micrio-markers){text-align:right}svg.micrio-markers{pointer-events:none;width:100%;height:100%;position:absolute}svg.micrio-markers line:where(.micrio-markers){stroke:var(--micrio-marker-highlight);stroke-width:2px}svg.micrio-markers line:where(.micrio-markers):not(.hovered){stroke:var(--micrio-marker-color);stroke-dasharray:10;stroke-width:1px;opacity:.75}svg.micrio-progress-circle{pointer-events:none;z-index:10;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)rotate(-90deg)}circle.micrio-progress-circle{transition:stroke-dashoffset .25s}
28
28
  /*$vite$:1*/`;
29
29
  document.head.insertBefore(_css,document.head.firstChild);
30
- !function(){"undefined"!=typeof window&&((window.__svelte??={}).v??=new Set).add("5");var t={},e=Symbol(),i=(Symbol("filename"),"http://www.w3.org/2000/svg"),s=Array.isArray,r=Array.prototype.indexOf,n=Array.prototype.includes,a=Array.from,o=Object.keys,h=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyDescriptors,d=Object.prototype,u=Array.prototype,m=Object.getPrototypeOf,g=Object.isExtensible;function p(t){return"function"==typeof t}var f=()=>{};function v(){var t,e;return{promise:new Promise((i,s)=>{t=i,e=s}),resolve:t,reject:e}}function w(t,e){if(Array.isArray(t))return t;if(void 0===e||!(Symbol.iterator in t))return Array.from(t);const i=[];for(const s of t)if(i.push(s),i.length===e)break;return i}var y=1024,b=2048,x=4096,T=8192,k=32768,_=1<<25,M=65536,S=1<<19,E=1<<25,I=65536,A=1<<21,L=1<<23,P=Symbol("$state"),$=Symbol("legacy props"),C=Symbol(""),D=(Symbol("proxy path"),Symbol("hmr anchor"),new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"}),z=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml");function O(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function R(t,e,i){throw new Error("https://svelte.dev/e/each_key_duplicate")}function X(t){console.warn("https://svelte.dev/e/hydration_mismatch")}var F,V=!1;function Y(t){V=t}function N(e){if(null===e)throw X(),t;return F=e}function B(){return N(Te(F))}function q(e){if(V){if(null!==Te(F))throw X(),t;F=e}}function W(t=1){if(V){for(var e=t,i=F;e--;)i=Te(i);F=i}}function U(t=!0){for(var e=0,i=F;;){if(8===i.nodeType){var s=i.data;if("]"===s){if(0===e)return i;e-=1}else("["===s||"[!"===s||"["===s[0]&&!isNaN(Number(s.slice(1))))&&(e+=1)}var r=Te(i);t&&i.remove(),i=r}}function H(e){if(!e||8!==e.nodeType)throw X(),t;return e.data}function G(t){return t===this.v}function j(t,e){return t!=t?e==e:t!==e||null!==t&&"object"==typeof t||"function"==typeof t}function Z(t){return!j(t,this.v)}var J=null;function K(t){J=t}function Q(t){return st("getContext").get(t)}function tt(t,e){return st("setContext").set(t,e),e}function et(t,e=!1,i){J={p:J,i:!1,c:null,e:null,s:t,x:null,r:hi,l:null}}function it(t){var e=J,i=e.e;if(null!==i)for(var s of(e.e=null,i))Xe(s);return void 0!==t&&(e.x=t),e.i=!0,J=e.p,t??{}}function st(t){return null===J&&O(),J.c??=new Map(function(t){let e=t.p;for(;null!==e;){const t=e.c;if(null!==t)return t;e=e.p}return null}(J)||void 0)}var rt=[];function nt(){var t=rt;rt=[],function(t){for(var e=0;e<t.length;e++)t[e]()}(t)}function at(t){if(0===rt.length&&!It){var e=rt;queueMicrotask(()=>{e===rt&&nt()})}rt.push(t)}function ot(){for(;rt.length>0;)nt()}function ht(t){var e=hi;if(null===e)return ni.f|=L,t;if(!(32768&e.f||4&e.f))throw t;ct(t,e)}function ct(t,e){for(;null!==e;){if(128&e.f){if(!(32768&e.f))throw t;try{return void e.b.error(t)}catch(i){t=i}}e=e.parent}throw t}var lt=-7169;function dt(t,e){t.f=t.f&lt|e}function ut(t){512&t.f||null===t.deps?dt(t,y):dt(t,x)}function mt(t){if(null!==t)for(const e of t)2&e.f&&65536&e.f&&(e.f^=I,mt(e.deps))}function gt(t,e,i){2048&t.f?e.add(t):4096&t.f&&i.add(t),mt(t.deps),dt(t,y)}function pt(t,e,i){if(null==t)return e(void 0),i&&i(void 0),f;const s=Li(()=>t.subscribe(e,i));return s.unsubscribe?()=>s.unsubscribe():s}var ft=[];function vt(t,e=f){let i=null;const s=new Set;function r(e){if(j(t,e)&&(t=e,i)){const e=!ft.length;for(const i of s)i[1](),ft.push(i,t);if(e){for(let t=0;t<ft.length;t+=2)ft[t][0](ft[t+1]);ft.length=0}}}function n(e){r(e(t))}return{set:r,update:n,subscribe:function(a,o=f){const h=[a,o];return s.add(h),1===s.size&&(i=e(r,n)||f),a(t),()=>{s.delete(h),0===s.size&&i&&(i(),i=null)}}}}function wt(t){let e;return pt(t,t=>e=t)(),e}var yt=!1,bt=Symbol();function xt(t,e,i){const s=i[e]??={store:null,source:ae(void 0),unsubscribe:f};if(s.store!==t&&!(bt in i))if(s.unsubscribe(),s.store=t??null,null==t)s.source.v=void 0,s.unsubscribe=f;else{var r=!0;s.unsubscribe=pt(t,t=>{r?s.source.v=t:oe(s.source,t)}),r=!1}return t&&bt in i?wt(t):Ei(s.source)}function Tt(t,e,i){let s=i[e];return s&&s.store!==t&&(s.unsubscribe(),s.unsubscribe=f),t}function kt(){const t={};return[t,function(){Oe(()=>{for(var e in t)t[e].unsubscribe();h(t,bt,{enumerable:!1,value:!0})})}]}var _t=new Set,Mt=null,St=null,Et=null,It=!1,At=!1,Lt=null,Pt=null,$t=0,Ct=1,Dt=class t{id=Ct++;current=new Map;previous=new Map;#t=new Set;#e=new Set;#i=new Set;#s=new Map;#r=new Map;#n=null;#a=[];#o=[];#h=new Set;#c=new Set;#l=new Map;#d=new Set;is_fork=!1;#u=!1;#m=new Set;#g(){return this.is_fork||this.#r.size>0}#p(){for(const i of this.#m)for(const s of i.#r.keys()){for(var t=!1,e=s;null!==e.parent;){if(this.#l.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(t){this.#l.has(t)||this.#l.set(t,{d:[],m:[]}),this.#d.delete(t)}unskip_effect(t,e=t=>this.schedule(t)){var i=this.#l.get(t);if(i){for(var s of(this.#l.delete(t),i.d))dt(s,b),e(s);for(s of i.m)dt(s,x),e(s)}this.#d.add(t)}#f(){if($t++>1e3&&(_t.delete(this),function(){try{!function(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}()}catch(t){0,ct(t,Et)}}()),!this.#g()){for(const t of this.#h)this.#c.delete(t),dt(t,b),this.schedule(t);for(const t of this.#c)dt(t,x),this.schedule(t)}const e=this.#a;this.#a=[],this.apply();var i=Lt=[],s=[],r=Pt=[];for(const t of e)try{this.#v(t,i,s)}catch(o){throw Nt(t),o}if(Mt=null,r.length>0){var n=t.ensure();for(const t of r)n.schedule(t)}if(Lt=null,Pt=null,this.#g()||this.#p()){this.#w(s),this.#w(i);for(const[t,e]of this.#l)Yt(t,e)}else{0===this.#s.size&&_t.delete(this),this.#h.clear(),this.#c.clear();for(const t of this.#t)t(this);this.#t.clear(),Rt(s),Rt(i),this.#n?.resolve()}var a=Mt;if(this.#a.length>0){const t=a??=this;t.#a.push(...this.#a.filter(e=>!t.#a.includes(e)))}null!==a&&(_t.add(a),a.#f())}#v(t,e,i){t.f^=y;for(var s=t.first;null!==s;){var r=s.f,n=!!(96&r);if(!(n&&1024&r||8192&r||this.#l.has(s))&&null!==s.fn){n?s.f^=y:4&r?e.push(s):bi(s)&&(16&r&&this.#c.add(s),Mi(s));var a=s.first;if(null!==a){s=a;continue}}for(;null!==s;){var o=s.next;if(null!==o){s=o;break}s=s.parent}}}#w(t){for(var e=0;e<t.length;e+=1)gt(t[e],this.#h,this.#c)}capture(t,i,s=!1){t.v===e||this.previous.has(t)||this.previous.set(t,t.v),8388608&t.f||(this.current.set(t,[i,s]),St?.set(t,i)),this.is_fork||(t.v=i)}activate(){Mt=this}deactivate(){Mt=null,St=null}flush(){try{At=!0,Mt=this,this.#f()}finally{$t=0,Et=null,Lt=null,Pt=null,At=!1,Mt=null,St=null,ie.clear()}}discard(){for(const t of this.#e)t(this);this.#e.clear(),this.#i.clear(),_t.delete(this)}register_created_effect(t){this.#o.push(t)}#y(){for(const c of _t){var t=c.id<this.id,e=[];for(const[s,[r,n]]of this.current){if(c.current.has(s)){var i=c.current.get(s)[0];if(!t||r===i)continue;c.current.set(s,[r,n])}e.push(s)}var s=[...c.current.keys()].filter(t=>!this.current.has(t));if(0===s.length)t&&c.discard();else if(e.length>0){if(t)for(const t of this.#d)c.unskip_effect(t,t=>{4194320&t.f?c.schedule(t):c.#w([t])});c.activate();var r=new Set,n=new Map;for(var a of e)Xt(a,s,r,n);n=new Map;var o=[...c.current.keys()].filter(t=>!this.current.has(t)||this.current.get(t)[0]!==t);for(const t of this.#o)155648&t.f||!Ft(t,o,n)||(4194320&t.f?(dt(t,b),c.schedule(t)):c.#h.add(t));if(c.#a.length>0){for(var h of(c.apply(),c.#a))c.#v(h,[],[]);c.#a=[]}c.deactivate()}}for(const c of _t)c.#m.has(this)&&(c.#m.delete(this),0!==c.#m.size||c.#g()||(c.activate(),c.#f()))}increment(t,e){let i=this.#s.get(e)??0;if(this.#s.set(e,i+1),t){let t=this.#r.get(e)??0;this.#r.set(e,t+1)}}decrement(t,e,i){let s=this.#s.get(e)??0;if(1===s?this.#s.delete(e):this.#s.set(e,s-1),t){let t=this.#r.get(e)??0;1===t?this.#r.delete(e):this.#r.set(e,t-1)}this.#u||i||(this.#u=!0,at(()=>{this.#u=!1,this.flush()}))}transfer_effects(t,e){for(const i of t)this.#h.add(i);for(const i of e)this.#c.add(i);t.clear(),e.clear()}oncommit(t){this.#t.add(t)}ondiscard(t){this.#e.add(t)}on_fork_commit(t){this.#i.add(t)}run_fork_commit_callbacks(){for(const t of this.#i)t(this);this.#i.clear()}settled(){return(this.#n??=v()).promise}static ensure(){if(null===Mt){const e=Mt=new t;At||(_t.add(Mt),It||at(()=>{Mt===e&&e.flush()}))}return Mt}apply(){St=null}schedule(t){if(Et=t,!(t.b?.is_pending&&16777228&t.f)||32768&t.f){for(var e=t;null!==e.parent;){var i=(e=e.parent).f;if(!(null===Lt||e!==hi||null!==ni&&2&ni.f))return;if(96&i){if(!(1024&i))return;e.f^=y}}this.#a.push(e)}else t.b.defer_effect(t)}};function zt(t){var e=It;It=!0;try{var i;for(t&&(null===Mt||Mt.is_fork||Mt.flush(),i=t());;){if(ot(),null===Mt)return i;Mt.flush()}}finally{It=e}}var Ot=null;function Rt(t){var e=t.length;if(0!==e){for(var i=0;i<e;){var s=t[i++];if(!(24576&s.f)&&bi(s)&&(Ot=new Set,Mi(s),null===s.deps&&null===s.first&&null===s.nodes&&null===s.teardown&&null===s.ac&&je(s),Ot?.size>0)){ie.clear();for(const t of Ot){if(24576&t.f)continue;const e=[t];let i=t.parent;for(;null!==i;)Ot.has(i)&&(Ot.delete(i),e.push(i)),i=i.parent;for(let t=e.length-1;t>=0;t--){const i=e[t];24576&i.f||Mi(i)}}Ot.clear()}}Ot=null}}function Xt(t,e,i,s){if(!i.has(t)&&(i.add(t),null!==t.reactions))for(const r of t.reactions){const t=r.f;2&t?Xt(r,e,i,s):4194320&t&&!(2048&t)&&Ft(r,e,s)&&(dt(r,b),Vt(r))}}function Ft(t,e,i){const s=i.get(t);if(void 0!==s)return s;if(null!==t.deps)for(const r of t.deps){if(n.call(e,r))return!0;if(2&r.f&&Ft(r,e,i))return i.set(r,!0),!0}return i.set(t,!1),!1}function Vt(t){Mt.schedule(t)}function Yt(t,e){if(!(32&t.f&&1024&t.f)){2048&t.f?e.d.push(t):4096&t.f&&e.m.push(t),dt(t,y);for(var i=t.first;null!==i;)Yt(i,e),i=i.next}}function Nt(t){dt(t,y);for(var e=t.first;null!==e;)Nt(e),e=e.next}var Bt=class{parent;is_pending=!1;transform_error;#b;#x=V?F:null;#T;#k;#_;#M=null;#S=null;#E=null;#I=null;#A=0;#L=0;#P=!1;#h=new Set;#c=new Set;#$=null;#C=function(t){let e,i=0,s=re(0);return()=>{ze()&&(Ei(s),Ve(()=>(0===i&&(e=Li(()=>t(()=>le(s)))),i+=1,()=>{at(()=>{i-=1,0===i&&(e?.(),e=void 0,le(s))})})))}}(()=>(this.#$=re(this.#A),()=>{this.#$=null}));constructor(t,e,i,s){this.#b=t,this.#T=e,this.#k=t=>{var e=hi;e.b=this,e.f|=128,i(t)},this.parent=hi.b,this.transform_error=s??this.parent?.transform_error??(t=>t),this.#_=Ne(()=>{if(V){const t=this.#x;B();const e="[!"===t.data;if(t.data.startsWith("[?")){const e=JSON.parse(t.data.slice(2));this.#D(e)}else e?this.#z():this.#O()}else this.#R()},589824),V&&(this.#b=F)}#O(){try{this.#M=qe(()=>this.#k(this.#b))}catch(t){this.error(t)}}#D(t){const e=this.#T.failed;e&&(this.#E=qe(()=>{e(this.#b,()=>t,()=>()=>{})}))}#z(){const t=this.#T.pending;t&&(this.is_pending=!0,this.#S=qe(()=>t(this.#b)),at(()=>{var t=this.#I=document.createDocumentFragment(),e=be();t.append(e),this.#M=this.#X(()=>qe(()=>this.#k(e))),0===this.#L&&(this.#b.before(t),this.#I=null,Ze(this.#S,()=>{this.#S=null}),this.#F(Mt))}))}#R(){try{if(this.is_pending=this.has_pending_snippet(),this.#L=0,this.#A=0,this.#M=qe(()=>{this.#k(this.#b)}),this.#L>0){var t=this.#I=document.createDocumentFragment();ti(this.#M,t);const e=this.#T.pending;this.#S=qe(()=>e(this.#b))}else this.#F(Mt)}catch(e){this.error(e)}}#F(t){this.is_pending=!1,t.transfer_effects(this.#h,this.#c)}defer_effect(t){gt(t,this.#h,this.#c)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#T.pending}#X(t){var e=hi,i=ni,s=J;ci(this.#_),oi(this.#_),K(this.#_.ctx);try{return Dt.ensure(),t()}catch(r){return ht(r),null}finally{ci(e),oi(i),K(s)}}#V(t,e){this.has_pending_snippet()?(this.#L+=t,0===this.#L&&(this.#F(e),this.#S&&Ze(this.#S,()=>{this.#S=null}),this.#I&&(this.#b.before(this.#I),this.#I=null))):this.parent&&this.parent.#V(t,e)}update_pending_count(t,e){this.#V(t,e),this.#A+=t,this.#$&&!this.#P&&(this.#P=!0,at(()=>{this.#P=!1,this.#$&&he(this.#$,this.#A)}))}get_effect_pending(){return this.#C(),Ei(this.#$)}error(t){if(!this.#T.onerror&&!this.#T.failed)throw t;Mt?.is_fork?(this.#M&&Mt.skip_effect(this.#M),this.#S&&Mt.skip_effect(this.#S),this.#E&&Mt.skip_effect(this.#E),Mt.on_fork_commit(()=>{this.#Y(t)})):this.#Y(t)}#Y(t){this.#M&&(He(this.#M),this.#M=null),this.#S&&(He(this.#S),this.#S=null),this.#E&&(He(this.#E),this.#E=null),V&&(N(this.#x),W(),N(U()));var e=this.#T.onerror;let i=this.#T.failed;var s=!1,r=!1;const n=()=>{s?console.warn("https://svelte.dev/e/svelte_boundary_reset_noop"):(s=!0,r&&function(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}(),null!==this.#E&&Ze(this.#E,()=>{this.#E=null}),this.#X(()=>{this.#R()}))},a=s=>{try{r=!0,e?.(s,n),r=!1}catch(t){ct(t,this.#_&&this.#_.parent)}i&&(this.#E=this.#X(()=>{try{return qe(()=>{var t=hi;t.b=this,t.f|=128,i(this.#b,()=>s,()=>n)})}catch(t){return ct(t,this.#_.parent),null}}))};at(()=>{var e;try{e=this.transform_error(t)}catch(i){return void ct(i,this.#_&&this.#_.parent)}null!==e&&"object"==typeof e&&"function"==typeof e.then?e.then(a,t=>ct(t,this.#_&&this.#_.parent)):a(e)})}};function qt(t,e,i,s){const r=Ht;var n=t.filter(t=>!t.settled);if(0!==i.length||0!==n.length){var a=hi,o=function(){var t=hi,e=ni,i=J,s=Mt;return function(r=!0){ci(t),oi(e),K(i),!r||16384&t.f||(s?.activate(),s?.apply())}}(),h=1===n.length?n[0].promise:n.length>1?Promise.all(n.map(t=>t.promise)):null;if(0!==i.length){var c=Ut();h?h.then(()=>{o(),d(),Wt()}):d()}else h.then(()=>l(e.map(r)))}else s(e.map(r));function l(t){o();try{s(t)}catch(e){16384&a.f||ct(e,a)}Wt()}function d(){Promise.all(i.map(t=>Gt(t))).then(t=>l([...e.map(r),...t])).catch(t=>ct(t,a)).finally(()=>c())}}function Wt(t=!0){ci(null),oi(null),K(null),t&&Mt?.deactivate()}function Ut(){var t=hi,e=t.b,i=Mt,s=e.is_rendered();return e.update_pending_count(1,i),i.increment(s,t),(r=!1)=>{e.update_pending_count(-1,i),i.decrement(s,t,r)}}function Ht(t){null!==hi&&(hi.f|=S);const i={ctx:J,deps:null,effects:null,equals:G,f:2050,fn:t,reactions:null,rv:0,v:e,wv:0,parent:hi,ac:null};return i}function Gt(t,i,s){let r=hi;null===r&&function(){throw new Error("https://svelte.dev/e/async_derived_orphan")}();var n=void 0,a=re(e);var o=!ni,h=new Map;return function(t){De(4718592,t)}(()=>{var e=hi;var i=v();n=i.promise;try{Promise.resolve(t()).then(i.resolve,i.reject).finally(Wt)}catch(d){i.reject(d),Wt()}var s=Mt;if(o){if(32768&e.f)var c=Ut();if(r.b.is_rendered())h.get(s)?.reject(D),h.delete(s);else{for(const t of h.values())t.reject(D);h.clear()}h.set(s,i)}const l=(t,i=void 0)=>{if(c&&c(i===D),!(i===D||16384&e.f)){if(s.activate(),i)a.f|=L,he(a,i);else{8388608&a.f&&(a.f^=L),he(a,t);for(const[t,e]of h){if(h.delete(t),t===s)break;e.reject(D)}0}s.deactivate()}};i.promise.then(l,t=>l(null,t||"unknown"))}),Oe(()=>{for(const t of h.values())t.reject(D)}),new Promise(t=>{!function e(i){function s(){i===n?t(a):e(n)}i.then(s,s)}(n)})}function jt(t){const e=Ht(t);return di(e),e}function Zt(t){const e=Ht(t);return e.equals=Z,e}function Jt(t){var e=t.effects;if(null!==e){t.effects=null;for(var i=0;i<e.length;i+=1)He(e[i])}}function Kt(t){var e,i=hi,s=t.parent;if(!si&&null!==s&&24576&s.f)return console.warn("https://svelte.dev/e/derived_inert"),t.v;ci(s);try{t.f&=-65537,Jt(t),e=Ti(t)}finally{ci(i)}return e}function Qt(t){var e=Kt(t);t.equals(e)||(t.wv=yi(),Mt?.is_fork&&null!==t.deps||(null!==Mt?Mt.capture(t,e,!0):t.v=e,null!==t.deps))?si||(null!==St?(ze()||Mt?.is_fork)&&St.set(t,e):ut(t)):dt(t,y)}function te(t){if(null!==t.effects)for(const e of t.effects)e.teardown&&Mi(e)}var ee=new Set,ie=new Map;var se=!1;function re(t,e){var i={f:0,v:t,reactions:null,equals:G,rv:0,wv:0};return i}function ne(t,e){const i=re(t);return di(i),i}function ae(t,e=!1,i=!0){const s=re(t);return e||(s.equals=Z),s}function oe(t,e,i=!1){null!==ni&&(!ai||131072&ni.f)&&4325394&ni.f&&(null===li||!n.call(li,t))&&function(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}();let s=i?ue(e):e;return he(t,s,Pt)}function he(t,e,i=null){if(!t.equals(e)){ie.set(t,si?e:t.v);var s=Dt.ensure();if(s.capture(t,e),2&t.f){const e=t;2048&t.f&&Kt(e),null===St&&ut(e)}t.wv=yi(),de(t,b,i),null!==hi&&1024&hi.f&&!(96&hi.f)&&(null===gi?function(t){gi=t}([t]):gi.push(t)),!s.is_fork&&ee.size>0&&!se&&ce()}return e}function ce(){se=!1;for(const t of ee)1024&t.f&&dt(t,x),bi(t)&&Mi(t);ee.clear()}function le(t){oe(t,t.v+1)}function de(t,e,i){var s=t.reactions;if(null!==s)for(var r=s.length,n=0;n<r;n++){var a=s[n],o=a.f;0;var h=0===(o&b);if(h&&dt(a,e),2&o){var c=a;St?.delete(c),65536&o||(512&o&&(a.f|=I),de(c,x,i))}else if(h){var l=a;16&o&&null!==Ot&&Ot.add(l),null!==i?i.push(l):Vt(l)}}}function ue(t){if("object"!=typeof t||null===t||P in t)return t;const i=m(t);if(i!==d&&i!==u)return t;var r=new Map,n=s(t),a=ne(0),o=vi,h=t=>{if(vi===o)return t();var e=ni,i=vi;oi(null),wi(o);var s=t();return oi(e),wi(i),s};n&&r.set("length",ne(t.length));return new Proxy(t,{defineProperty(t,e,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}();var s=r.get(e);return void 0===s?h(()=>{var t=ne(i.value);return r.set(e,t),t}):oe(s,i.value,!0),!0},deleteProperty(t,i){var s=r.get(i);if(void 0===s){if(i in t){const t=h(()=>ne(e));r.set(i,t),le(a)}}else oe(s,e),le(a);return!0},get(i,s,n){if(s===P)return t;var a=r.get(s),o=s in i;if(void 0!==a||o&&!c(i,s)?.writable||(a=h(()=>{var t=ne(ue(o?i[s]:e));return t}),r.set(s,a)),void 0!==a){var l=Ei(a);return l===e?void 0:l}return Reflect.get(i,s,n)},getOwnPropertyDescriptor(t,i){var s=Reflect.getOwnPropertyDescriptor(t,i);if(s&&"value"in s){var n=r.get(i);n&&(s.value=Ei(n))}else if(void 0===s){var a=r.get(i),o=a?.v;if(void 0!==a&&o!==e)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return s},has(t,i){if(i===P)return!0;var s=r.get(i),n=void 0!==s&&s.v!==e||Reflect.has(t,i);return!((void 0!==s||null!==hi&&(!n||c(t,i)?.writable))&&(void 0===s&&(s=h(()=>{var s=ne(n?ue(t[i]):e);return s}),r.set(i,s)),Ei(s)===e))&&n},set(t,i,s,o){var l=r.get(i),d=i in t;if(n&&"length"===i)for(var u=s;u<l.v;u+=1){var m=r.get(u+"");void 0!==m?oe(m,e):u in t&&(m=h(()=>ne(e)),r.set(u+"",m))}void 0===l?d&&!c(t,i)?.writable||(oe(l=h(()=>ne(void 0)),ue(s)),r.set(i,l)):(d=l.v!==e,oe(l,h(()=>ue(s))));var g=Reflect.getOwnPropertyDescriptor(t,i);if(g?.set&&g.set.call(o,s),!d){if(n&&"string"==typeof i){var p=r.get("length"),f=Number(i);Number.isInteger(f)&&f>=p.v&&oe(p,f+1)}le(a)}return!0},ownKeys(t){Ei(a);var i=Reflect.ownKeys(t).filter(t=>{var i=r.get(t);return void 0===i||i.v!==e});for(var[s,n]of r)n.v===e||s in t||i.push(s);return i},setPrototypeOf(){!function(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}()}})}function me(t){try{if(null!==t&&"object"==typeof t&&P in t)return t[P]}catch{}return t}function ge(t,e){return Object.is(me(t),me(e))}var pe,fe,ve,we;new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function ye(){if(void 0===pe){pe=window,document,fe=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,i=Text.prototype;ve=c(e,"firstChild").get,we=c(e,"nextSibling").get,g(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),g(i)&&(i.__t=void 0)}}function be(t=""){return document.createTextNode(t)}function xe(t){return ve.call(t)}function Te(t){return we.call(t)}function ke(t,e){if(!V)return xe(t);var i=xe(F);if(null===i)i=F.appendChild(be());else if(e&&3!==i.nodeType){var s=be();return i?.before(s),N(s),s}return e&&Ie(i),N(i),i}function _e(t,e=!1){if(!V){var i=xe(t);return i instanceof Comment&&""===i.data?Te(i):i}if(e){if(3!==F?.nodeType){var s=be();return F?.before(s),N(s),s}Ie(F)}return F}function Me(t,e=1,i=!1){let s=V?F:t;for(var r;e--;)r=s,s=Te(s);if(!V)return s;if(i){if(3!==s?.nodeType){var n=be();return null===s?r?.after(n):s.before(n),N(n),n}Ie(s)}return N(s),s}function Se(t){t.textContent=""}function Ee(t,e,i){let s=i?{is:i}:void 0;return document.createElementNS(e??"http://www.w3.org/1999/xhtml",t,s)}function Ie(t){if(t.nodeValue.length<65536)return;let e=t.nextSibling;for(;null!==e&&3===e.nodeType;)e.remove(),t.nodeValue+=e.nodeValue,e=t.nextSibling}function Ae(t,e){if(e){const e=document.body;t.autofocus=!0,at(()=>{document.activeElement===e&&t.focus()})}}var Le=!1;function Pe(t,e,i,s=!0){for(var r of(s&&i(),e))t.addEventListener(r,i);Oe(()=>{for(var s of e)t.removeEventListener(s,i)})}function $e(t){var e=ni,i=hi;oi(null),ci(null);try{return t()}finally{oi(e),ci(i)}}function Ce(t){null===hi&&(null===ni&&function(){throw new Error("https://svelte.dev/e/effect_orphan")}(),function(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}()),si&&function(){throw new Error("https://svelte.dev/e/effect_in_teardown")}()}function De(t,e){var i=hi;null!==i&&8192&i.f&&(t|=T);var s={ctx:J,deps:null,nodes:null,f:t|b|512,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};Mt?.register_created_effect(s);var r=s;if(4&t)null!==Lt?Lt.push(s):Dt.ensure().schedule(s);else if(null!==e){try{Mi(s)}catch(r){throw He(s),r}null!==r.deps||null!==r.teardown||null!==r.nodes||r.first!==r.last||524288&r.f||(r=r.first,16&t&&65536&t&&null!==r&&(r.f|=M))}if(null!==r&&(r.parent=i,null!==i&&function(t,e){var i=e.last;null===i?e.last=e.first=t:(i.next=t,t.prev=i,e.last=t)}(r,i),null!==ni&&2&ni.f&&!(64&t))){var n=ni;(n.effects??=[]).push(r)}return s}function ze(){return null!==ni&&!ai}function Oe(t){const e=De(8,null);return dt(e,y),e.teardown=t,e}function Re(t){Ce();var e=hi.f;if(ni||!(32&e)||32768&e)return Xe(t);var i=J;(i.e??=[]).push(t)}function Xe(t){return De(1048580,t)}function Fe(t){return De(4,t)}function Ve(t,e=0){return De(8|e,t)}function Ye(t,e=[],i=[],s=[]){qt(s,e,i,e=>{De(8,()=>t(...e.map(Ei)))})}function Ne(t,e=0){var i=De(16|e,t);return i}function Be(t,e=0){var i=De(16777216|e,t);return i}function qe(t){return De(524320,t)}function We(t){var e=t.teardown;if(null!==e){const t=si,i=ni;ri(!0),oi(null);try{e.call(null)}finally{ri(t),oi(i)}}}function Ue(t,e=!1){var i=t.first;for(t.first=t.last=null;null!==i;){const t=i.ac;null!==t&&$e(()=>{t.abort(D)});var s=i.next;64&i.f?i.parent=null:He(i,e),i=s}}function He(t,e=!0){var i=!1;(e||262144&t.f)&&null!==t.nodes&&null!==t.nodes.end&&(Ge(t.nodes.start,t.nodes.end),i=!0),dt(t,_),Ue(t,e&&!i),_i(t,0);var s=t.nodes&&t.nodes.t;if(null!==s)for(const n of s)n.stop();We(t),t.f^=_,t.f|=16384;var r=t.parent;null!==r&&null!==r.first&&je(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function Ge(t,e){for(;null!==t;){var i=t===e?null:Te(t);t.remove(),t=i}}function je(t){var e=t.parent,i=t.prev,s=t.next;null!==i&&(i.next=s),null!==s&&(s.prev=i),null!==e&&(e.first===t&&(e.first=s),e.last===t&&(e.last=i))}function Ze(t,e,i=!0){var s=[];Je(t,s,!0);var r=()=>{i&&He(t),e&&e()},n=s.length;if(n>0){var a=()=>--n||r();for(var o of s)o.out(a)}else r()}function Je(t,e,i){if(!(8192&t.f)){t.f^=T;var s=t.nodes&&t.nodes.t;if(null!==s)for(const t of s)(t.is_global||i)&&e.push(t);for(var r=t.first;null!==r;){var n=r.next;if(!(64&r.f))Je(r,e,!!(!!(65536&r.f)||!!(32&r.f)&&!!(16&t.f))&&i);r=n}}}function Ke(t){Qe(t,!0)}function Qe(t,e){if(8192&t.f){t.f^=T,1024&t.f||(dt(t,b),Dt.ensure().schedule(t));for(var i=t.first;null!==i;){var s=i.next;Qe(i,!!(!!(65536&i.f)||!!(32&i.f))&&e),i=s}var r=t.nodes&&t.nodes.t;if(null!==r)for(const t of r)(t.is_global||e)&&t.in()}}function ti(t,e){if(t.nodes)for(var i=t.nodes.start,s=t.nodes.end;null!==i;){var r=i===s?null:Te(i);e.append(i),i=r}}var ei=null,ii=!1,si=!1;function ri(t){si=t}var ni=null,ai=!1;function oi(t){ni=t}var hi=null;function ci(t){hi=t}var li=null;function di(t){null!==ni&&(null===li?li=[t]:li.push(t))}var ui=null,mi=0,gi=null;var pi=1,fi=0,vi=fi;function wi(t){vi=t}function yi(){return++pi}function bi(t){var e=t.f;if(2048&e)return!0;if(2&e&&(t.f&=-65537),4096&e){for(var i=t.deps,s=i.length,r=0;r<s;r++){var n=i[r];if(bi(n)&&Qt(n),n.wv>t.wv)return!0}512&e&&null===St&&dt(t,y)}return!1}function xi(t,e,i=!0){var s=t.reactions;if(null!==s&&(null===li||!n.call(li,t)))for(var r=0;r<s.length;r++){var a=s[r];2&a.f?xi(a,e,!1):e===a&&(i?dt(a,b):1024&a.f&&dt(a,x),Vt(a))}}function Ti(t){var e=ui,i=mi,s=gi,r=ni,n=li,a=J,o=ai,h=vi,c=t.f;ui=null,mi=0,gi=null,ni=96&c?null:t,li=null,K(t.ctx),ai=!1,vi=++fi,null!==t.ac&&($e(()=>{t.ac.abort(D)}),t.ac=null);try{t.f|=A;var l=(0,t.fn)();t.f|=k;var d=t.deps,u=Mt?.is_fork;if(null!==ui){var m;if(u||_i(t,mi),null!==d&&mi>0)for(d.length=mi+ui.length,m=0;m<ui.length;m++)d[mi+m]=ui[m];else t.deps=d=ui;if(ze()&&512&t.f)for(m=mi;m<d.length;m++)(d[m].reactions??=[]).push(t)}else!u&&null!==d&&mi<d.length&&(_i(t,mi),d.length=mi);if(!(null===gi||ai||null===d||6146&t.f))for(m=0;m<gi.length;m++)xi(gi[m],t);if(null!==r&&r!==t){if(fi++,null!==r.deps)for(let t=0;t<i;t+=1)r.deps[t].rv=fi;if(null!==e)for(const t of e)t.rv=fi;null!==gi&&(null===s?s=gi:s.push(...gi))}return 8388608&t.f&&(t.f^=L),l}catch(g){return ht(g)}finally{t.f^=A,ui=e,mi=i,gi=s,ni=r,li=n,K(a),ai=o,vi=h}}function ki(t,i){let s=i.reactions;if(null!==s){var a=r.call(s,t);if(-1!==a){var o=s.length-1;0===o?s=i.reactions=null:(s[a]=s[o],s.pop())}}if(null===s&&2&i.f&&(null===ui||!n.call(ui,i))){var h=i;512&h.f&&(h.f^=512,h.f&=-65537),h.v!==e&&ut(h),function(t){if(null!==t.effects)for(const e of t.effects)(e.teardown||e.ac)&&(e.teardown?.(),e.ac?.abort(D),e.teardown=f,e.ac=null,_i(e,0),Ue(e))}(h),_i(h,0)}}function _i(t,e){var i=t.deps;if(null!==i)for(var s=e;s<i.length;s++)ki(t,i[s])}function Mi(t){var e=t.f;if(!(16384&e)){dt(t,y);var i=hi,s=ii;hi=t,ii=!0;try{16777232&e?function(t){for(var e=t.first;null!==e;){var i=e.next;32&e.f||He(e),e=i}}(t):Ue(t),We(t);var r=Ti(t);t.teardown="function"==typeof r?r:null,t.wv=pi}finally{ii=s,hi=i}}}async function Si(){await Promise.resolve(),zt()}function Ei(t){var e=!!(2&t.f);if(ei?.add(t),null!==ni&&!ai&&!(null!==hi&&16384&hi.f||null!==li&&n.call(li,t))){var i=ni.deps;if(2097152&ni.f)t.rv<fi&&(t.rv=fi,null===ui&&null!==i&&i[mi]===t?mi++:null===ui?ui=[t]:ui.push(t));else{(ni.deps??=[]).push(t);var s=t.reactions;null===s?t.reactions=[ni]:n.call(s,ni)||s.push(ni)}}if(si&&ie.has(t))return ie.get(t);if(e){var r=t;if(si){var a=r.v;return(1024&r.f||null===r.reactions)&&!Ai(r)||(a=Kt(r)),ie.set(r,a),a}var o=!(512&r.f)&&!ai&&null!==ni&&(ii||!!(512&ni.f)),h=0===(r.f&k);bi(r)&&(o&&(r.f|=512),Qt(r)),o&&!h&&(te(r),Ii(r))}if(St?.has(t))return St.get(t);if(8388608&t.f)throw t.v;return t.v}function Ii(t){if(t.f|=512,null!==t.deps)for(const e of t.deps)(e.reactions??=[]).push(t),2&e.f&&!(512&e.f)&&(te(e),Ii(e))}function Ai(t){if(t.v===e)return!0;if(null===t.deps)return!1;for(const e of t.deps){if(ie.has(e))return!0;if(2&e.f&&Ai(e))return!0}return!1}function Li(t){var e=ai;try{return ai=!0,t()}finally{ai=e}}function Pi(t,e=new Set){if(!("object"!=typeof t||null===t||t instanceof EventTarget||e.has(t))){e.add(t),t instanceof Date&&t.getTime();for(let r in t)try{Pi(t[r],e)}catch(i){}const s=m(t);if(s!==Object.prototype&&s!==Array.prototype&&s!==Map.prototype&&s!==Set.prototype&&s!==Date.prototype){const e=l(s);for(let s in e){const r=e[s].get;if(r)try{r.call(t)}catch(i){}}}}}var $i=Symbol("events"),Ci=new Set,Di=new Set;function zi(t,e,i,s={}){function r(t){if(s.capture||Fi.call(e,t),!t.cancelBubble)return $e(()=>i?.call(this,t))}return t.startsWith("pointer")||t.startsWith("touch")||"wheel"===t?at(()=>{e.addEventListener(t,r,s)}):e.addEventListener(t,r,s),r}function Oi(t,e,i,s,r){var n={capture:s,passive:r},a=zi(t,e,i,n);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Oe(()=>{e.removeEventListener(t,a,n)})}function Ri(t,e,i){(e[$i]??={})[t]=i}function Xi(t){for(var e=0;e<t.length;e++)Ci.add(t[e]);for(var i of Di)i(t)}function Fi(t){var e=this,i=e.ownerDocument,s=t.type,r=t.composedPath?.()||[],n=r[0]||t.target,a=0,o=t===t&&t[$i];if(o){var c=r.indexOf(o);if(-1!==c&&(e===document||e===window))return void(t[$i]=e);var l=r.indexOf(e);if(-1===l)return;c<=l&&(a=c)}if((n=r[a]||t.target)!==e){h(t,"currentTarget",{configurable:!0,get:()=>n||i});var d=ni,u=hi;oi(null),ci(null);try{for(var m,g=[];null!==n;){var p=n.assignedSlot||n.parentNode||n.host||null;try{var f=n[$i]?.[s];null==f||n.disabled&&t.target!==n||f.call(n,t)}catch(v){m?g.push(v):m=v}if(t.cancelBubble||p===e||null===p)break;n=p}if(m){for(let t of g)queueMicrotask(()=>{throw t});throw m}}finally{t[$i]=e,delete t.currentTarget,oi(d),ci(u)}}}var Vi=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function Yi(t){var e=Ee("template");return e.innerHTML=function(t){return Vi?.createHTML(t)??t}(t.replaceAll("<!>","\x3c!----\x3e")),e.content}function Ni(t,e){var i=hi;null===i.nodes&&(i.nodes={start:t,end:e,a:null,t:null})}function Bi(t,e){var i,s=!!(1&e),r=!!(2&e),n=!t.startsWith("<!>");return()=>{if(V)return Ni(F,null),F;void 0===i&&(i=Yi(n?t:"<!>"+t),s||(i=xe(i)));var e=r||fe?document.importNode(i,!0):i.cloneNode(!0);s?Ni(xe(e),e.lastChild):Ni(e,e);return e}}function qi(t,e,i="svg"){var s,r=!t.startsWith("<!>"),n=!!(1&e),a=`<${i}>${r?t:"<!>"+t}</${i}>`;return()=>{if(V)return Ni(F,null),F;if(!s){var t=xe(Yi(a));if(n)for(s=document.createDocumentFragment();xe(t);)s.appendChild(xe(t));else s=xe(t)}var e=s.cloneNode(!0);n?Ni(xe(e),e.lastChild):Ni(e,e);return e}}function Wi(t,e){return qi(t,e,"svg")}function Ui(t=""){if(!V){var e=be(t+"");return Ni(e,e),e}var i=F;return 3!==i.nodeType?(i.before(i=be()),N(i)):Ie(i),Ni(i,i),i}function Hi(){if(V)return Ni(F,null),F;var t=document.createDocumentFragment(),e=document.createComment(""),i=be();return t.append(e,i),Ni(e,i),t}function Gi(t,e){if(V){var i=hi;return 32768&i.f&&null!==i.nodes.end||(i.nodes.end=F),void B()}null!==t&&t.before(e)}function ji(t){return t.endsWith("capture")&&"gotpointercapture"!==t&&"lostpointercapture"!==t}var Zi=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Ji(t){return Zi.includes(t)}var Ki={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function Qi(t){return t=t.toLowerCase(),Ki[t]??t}var ts=["touchstart","touchmove"];function es(t){return ts.includes(t)}var is=["textarea","script","style","title"];var ss=!0;function rs(t){ss=t}function ns(t,e){var i=null==e?"":"object"==typeof e?`${e}`:e;i!==(t.__t??=t.nodeValue)&&(t.__t=i,t.nodeValue=`${i}`)}function as(t,e){return cs(t,e)}function os(e,i){ye(),i.intro=i.intro??!1;const s=i.target,r=V,n=F;try{for(var a=xe(s);a&&(8!==a.nodeType||"["!==a.data);)a=Te(a);if(!a)throw t;Y(!0),N(a);const r=cs(e,{...i,anchor:a});return Y(!1),r}catch(o){if(o instanceof Error&&o.message.split("\n").some(t=>t.startsWith("https://svelte.dev/e/")))throw o;return o!==t&&console.warn("Failed to hydrate: ",o),!1===i.recover&&function(){throw new Error("https://svelte.dev/e/hydration_failed")}(),ye(),Se(s),Y(!1),as(e,i)}finally{Y(r),N(n)}}var hs=new Map;function cs(e,{target:i,anchor:s,props:r={},events:n,context:o,intro:h=!0,transformError:c}){ye();var l=void 0,d=function(t){Dt.ensure();const e=De(524352,t);return(t={})=>new Promise(i=>{t.outro?Ze(e,()=>{He(e),i(void 0)}):(He(e),i(void 0))})}(()=>{var d=s??i.appendChild(be());!function(t,e,i,s){new Bt(t,e,i,s)}(d,{pending:()=>{}},i=>{if(et({}),o&&(J.c=o),n&&(r.$$events=n),V&&Ni(i,null),ss=h,l=e(i,r)||{},ss=!0,V&&(hi.nodes.end=F,null===F||8!==F.nodeType||"]"!==F.data))throw X(),t;it()},c);var u=new Set,m=t=>{for(var e=0;e<t.length;e++){var s=t[e];if(!u.has(s)){u.add(s);var r=es(s);for(const t of[i,document]){var n=hs.get(t);void 0===n&&(n=new Map,hs.set(t,n));var a=n.get(s);void 0===a?(t.addEventListener(s,Fi,{passive:r}),n.set(s,1)):n.set(s,a+1)}}}};return m(a(Ci)),Di.add(m),()=>{for(var t of u)for(const s of[i,document]){var e=hs.get(s),r=e.get(t);0==--r?(s.removeEventListener(t,Fi),e.delete(t),0===e.size&&hs.delete(s)):e.set(t,r)}Di.delete(m),d!==s&&d.parentNode?.removeChild(d)}});return ls.set(l,d),l}var ls=new WeakMap;function ds(t,e){const i=ls.get(t);return i?(ls.delete(t),i(e)):Promise.resolve()}var us,ms=class{anchor;#N=new Map;#B=new Map;#q=new Map;#W=new Set;#U=!0;constructor(t,e=!0){this.anchor=t,this.#U=e}#y=t=>{if(this.#N.has(t)){var e=this.#N.get(t),i=this.#B.get(e);if(i)Ke(i),this.#W.delete(e);else{var s=this.#q.get(e);s&&(this.#B.set(e,s.effect),this.#q.delete(e),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),i=s.effect)}for(const[e,i]of this.#N){if(this.#N.delete(e),e===t)break;const s=this.#q.get(i);s&&(He(s.effect),this.#q.delete(i))}for(const[t,s]of this.#B){if(t===e||this.#W.has(t))continue;const r=()=>{if(Array.from(this.#N.values()).includes(t)){var e=document.createDocumentFragment();ti(s,e),e.append(be()),this.#q.set(t,{effect:s,fragment:e})}else He(s);this.#W.delete(t),this.#B.delete(t)};this.#U||!i?(this.#W.add(t),Ze(s,r,!1)):r()}}};#H=t=>{this.#N.delete(t);const e=Array.from(this.#N.values());for(const[i,s]of this.#q)e.includes(i)||(He(s.effect),this.#q.delete(i))};ensure(t,e){var i=Mt;!e||this.#B.has(t)||this.#q.has(t)||this.#B.set(t,qe(()=>e(this.anchor)));this.#N.set(i,t),V&&(this.anchor=F),this.#y(i)}};function gs(t,e,...i){var s=new ms(t);Ne(()=>{const t=e()??null;s.ensure(t,t&&(e=>t(e,...i)))},M)}function ps(t){null===J&&O(),Re(()=>{const e=Li(t);if("function"==typeof e)return e})}function fs(t){null===J&&O(),ps(()=>()=>Li(t))}function vs(t,e,i=!1){var s;V&&(s=F,B());var r=new ms(t);function n(t,e){if(V){var i=H(s);if(t!==parseInt(i.substring(1))){var n=U();return N(n),r.anchor=n,Y(!1),r.ensure(t,e),void Y(!0)}}r.ensure(t,e)}Ne(()=>{var t=!1;e((e,i=0)=>{t=!0,n(i,e)}),t||n(-1,null)},i?M:0)}function ws(t,e){return e}function ys(t,e,i=!0){var s;if(t.pending.size>0){s=new Set;for(const e of t.pending.values())for(const i of e)s.add(t.items.get(i).e)}for(var r=0;r<e.length;r++){var n=e[r];s?.has(n)?(n.f|=E,ti(n,document.createDocumentFragment())):He(e[r],i)}}function bs(t,e,i,r,n,o=null){var h=t,c=new Map;if(4&e){var l=t;h=V?N(xe(l)):l.appendChild(be())}V&&B();var d,u=null,m=Zt(()=>{var t=i();return s(t)?t:null==t?[]:a(t)});var g=new Map,p=!0;function f(t){16384&v.effect.f||(v.pending.delete(t),v.fallback=u,function(t,e,i,s,r){var n,o,h,c,l,d=!!(8&s),u=e.length,m=t.items,g=xs(t.effect.first),p=null,f=[],v=[];if(d)for(l=0;l<u;l+=1)h=r(e[l],l),33554432&(c=m.get(h).e).f||(c.nodes?.a?.measure(),(o??=new Set).add(c));for(l=0;l<u;l+=1){if(h=r(e[l],l),c=m.get(h).e,null!==t.outrogroups)for(const e of t.outrogroups)e.pending.delete(c),e.done.delete(c);if(8192&c.f&&(Ke(c),d&&(c.nodes?.a?.unfix(),(o??=new Set).delete(c))),33554432&c.f){if(c.f^=E,c!==g){var w=p?p.next:g;c===t.effect.last&&(t.effect.last=c.prev),c.prev&&(c.prev.next=c.next),c.next&&(c.next.prev=c.prev),_s(t,p,c),_s(t,c,w),ks(c,w,i),f=[],v=[],g=xs((p=c).next);continue}ks(c,null,i)}if(c!==g){if(void 0!==n&&n.has(c)){if(f.length<v.length){var y,b=v[0];p=b.prev;var x=f[0],T=f[f.length-1];for(y=0;y<f.length;y+=1)ks(f[y],b,i);for(y=0;y<v.length;y+=1)n.delete(v[y]);_s(t,x.prev,T.next),_s(t,p,x),_s(t,T,b),g=b,p=T,l-=1,f=[],v=[]}else n.delete(c),ks(c,g,i),_s(t,c.prev,c.next),_s(t,c,null===p?t.effect.first:p.next),_s(t,p,c),p=c;continue}for(f=[],v=[];null!==g&&g!==c;)(n??=new Set).add(g),v.push(g),g=xs(g.next);if(null===g)continue}33554432&c.f||f.push(c),p=c,g=xs(c.next)}if(null!==t.outrogroups){for(const e of t.outrogroups)0===e.pending.size&&(ys(t,a(e.done)),t.outrogroups?.delete(e));0===t.outrogroups.size&&(t.outrogroups=null)}if(null!==g||void 0!==n){var k=[];if(void 0!==n)for(c of n)8192&c.f||k.push(c);for(;null!==g;)8192&g.f||g===t.fallback||k.push(g),g=xs(g.next);var _=k.length;if(_>0){var M=4&s&&0===u?i:null;if(d){for(l=0;l<_;l+=1)k[l].nodes?.a?.measure();for(l=0;l<_;l+=1)k[l].nodes?.a?.fix()}!function(t,e,i){for(var s,r=e.length,n=e.length,o=0;o<r;o++){let i=e[o];Ze(i,()=>{if(s){if(s.pending.delete(i),s.done.add(i),0===s.pending.size){var e=t.outrogroups;ys(t,a(s.done)),e.delete(s),0===e.size&&(t.outrogroups=null)}}else n-=1},!1)}if(0===n){var h=null!==i;if(h){var c=i,l=c.parentNode;Se(l),l.append(c),t.items.clear()}ys(t,e,!h)}else s={pending:new Set(e),done:new Set},(t.outrogroups??=new Set).add(s)}(t,k,M)}}d&&at(()=>{if(void 0!==o)for(c of o)c.nodes?.a?.apply()})}(v,d,h,e,r),null!==u&&(0===d.length?33554432&u.f?(u.f^=E,ks(u,null,h)):Ke(u):Ze(u,()=>{u=null})))}var v={effect:Ne(()=>{var t=(d=Ei(m)).length;let s=!1;V&&"[!"===H(h)!=(0===t)&&(N(h=U()),Y(!1),s=!0);for(var a=new Set,l=Mt,v=0;v<t;v+=1){V&&8===F.nodeType&&"]"===F.data&&(h=F,s=!0,Y(!1));var w=d[v],y=r(w,v),b=p?null:c.get(y);b?(b.v&&he(b.v,w),b.i&&he(b.i,v)):(b=Ts(c,p?h:us??=be(),w,y,v,n,e,i),p||(b.e.f|=E),c.set(y,b)),a.add(y)}0===t&&o&&!u&&(p?u=qe(()=>o(h)):(u=qe(()=>o(us??=be()))).f|=E),t>a.size&&R(),V&&t>0&&N(U()),p||(g.set(l,a),f(l)),s&&Y(!0),Ei(m)}),flags:e,items:c,pending:g,outrogroups:null,fallback:u};p=!1,V&&(h=F)}function xs(t){for(;null!==t&&!(32&t.f);)t=t.next;return t}function Ts(t,e,i,s,r,n,a,o){var h=1&a?16&a?re(i):ae(i,!1,!1):null,c=2&a?re(r):null;return{v:h,i:c,e:qe(()=>(n(e,h??i,c??r,o),()=>{t.delete(s)}))}}function ks(t,e,i){if(t.nodes)for(var s=t.nodes.start,r=t.nodes.end,n=!e||33554432&e.f?i:e.nodes.start;null!==s;){var a=Te(s);if(n.before(s),s===r)return;s=a}}function _s(t,e,i){null===e?t.effect.first=i:e.next=i,null===i?t.effect.last=e:i.prev=e}function Ms(e,s,r=!1,n=!1,a=!1,o=!1){var h=e,c="";if(r){var l=e;V&&(h=N(xe(l)))}Ye(()=>{var e=hi;if(c!==(c=s()??"")){if(r&&!V)return e.nodes=null,l.innerHTML=c,void(""!==c&&Ni(xe(l),l.lastChild));if(null!==e.nodes&&(Ge(e.nodes.start,e.nodes.end),e.nodes=null),""!==c){if(V){F.data;for(var o=B(),d=o;null!==o&&(8!==o.nodeType||""!==o.data);)d=o,o=Te(o);if(null===o)throw X(),t;return Ni(F,d),void(h=N(o))}var u=Ee(n?"svg":a?"math":"template",n?i:a?"http://www.w3.org/1998/Math/MathML":void 0);u.innerHTML=c;var m=n||a?u:u.content;if(Ni(xe(m),m.lastChild),n||a)for(;xe(m);)h.before(xe(m));else h.before(m)}}else V&&B()})}var Ss=()=>performance.now(),Es={tick:t=>requestAnimationFrame(t),now:()=>Ss(),tasks:new Set};function Is(){const t=Es.now();Es.tasks.forEach(e=>{e.c(t)||(Es.tasks.delete(e),e.f())}),0!==Es.tasks.size&&Es.tick(Is)}function As(t,e){$e(()=>{t.dispatchEvent(new CustomEvent(e))})}function Ls(t){if("float"===t)return"cssFloat";if("offset"===t)return"cssOffset";if(t.startsWith("--"))return t;const e=t.split("-");return 1===e.length?e[0]:e[0]+e.slice(1).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function Ps(t){const e={},i=t.split(";");for(const s of i){const[t,i]=s.split(":");if(!t||void 0===i)break;e[Ls(t.trim())]=i.trim()}return e}var $s=t=>t;function Cs(t){0}function Ds(t,e,i,s){var r,n,a,o=!!(1&t),h=!!(2&t),c=!!(4&t),l=o&&h?"both":o?"in":"out",d=e.inert,u=e.style.overflow;function m(){return $e(()=>r??=i()(e,s?.()??{},{direction:l}))}var g={is_global:c,in(){if(e.inert=d,!o)return a?.abort(),void a?.reset?.();h||n?.abort(),n=zs(e,m(),a,1,()=>{As(e,"introend"),n?.abort(),n=r=void 0,e.style.overflow=u})},out(t){if(!h)return t?.(),void(r=void 0);e.inert=!0,a=zs(e,m(),n,0,()=>{As(e,"outroend"),t?.()})},stop:()=>{n?.abort(),a?.abort()}},p=hi;if((p.nodes.t??=[]).push(g),o&&ss){var f=c;if(!f){for(var v=p.parent;v&&65536&v.f;)for(;(v=v.parent)&&!(16&v.f););f=!v||!!(32768&v.f)}f&&Fe(()=>{Li(()=>g.in())})}}function zs(t,e,i,s,r){var n=1===s;if(p(e)){var a,o=!1;return at(()=>{o||(a=zs(t,e({direction:n?"in":"out"}),i,s,r))}),{abort:()=>{o=!0,a?.abort()},deactivate:()=>a.deactivate(),reset:()=>a.reset(),t:()=>a.t()}}if(i?.deactivate(),!e?.duration&&!e?.delay)return As(t,n?"introstart":"outrostart"),r(),{abort:f,deactivate:f,reset:f,t:()=>s};const{delay:h=0,css:c,tick:l,easing:d=$s}=e;var u=[];if(n&&void 0===i&&(l&&l(0,1),c)){var m=Ps(c(0,1));u.push(m,m)}var g=()=>1-s,v=t.animate(u,{duration:h,fill:"forwards"});return v.onfinish=()=>{v.cancel(),As(t,n?"introstart":"outrostart");var a=i?.t()??1-s;i?.abort();var o=s-a,h=e.duration*Math.abs(o),u=[];if(h>0){var m=!1;if(c)for(var p=Math.ceil(h/(1e3/60)),f=0;f<=p;f+=1){var w=a+o*d(f/p),y=Ps(c(w,1-w));u.push(y),m||="hidden"===y.overflow}m&&(t.style.overflow="hidden"),g=()=>{var t=v.currentTime;return a+o*d(t/h)},l&&function(t){let e;0===Es.tasks.size&&Es.tick(Is),new Promise(i=>{Es.tasks.add(e={c:t,f:i})})}(()=>{if("running"!==v.playState)return!1;var t=g();return l(t,1-t),!0})}(v=t.animate(u,{duration:h,fill:"forwards"})).onfinish=()=>{g=()=>s,l?.(s,1-s),r()}},{abort:()=>{v&&(v.cancel(),v.effect=null,v.onfinish=f)},deactivate:()=>{r=f},reset:()=>{0===s&&l?.(1,0)},t:()=>g()}}function Os(t,e,s,r,n,a){let o=V;V&&B();var h=null;V&&1===F.nodeType&&(h=F,B());var c=V?F:t,l=hi,d=new ms(c,!1);Ne(()=>{const t=e()||null;var a=n?n():s||"svg"===t?i:void 0;return null===t?(d.ensure(null,null),void rs(!0)):(d.ensure(t,e=>{if(t){if(Ni(h=V?h:Ee(t,a),h),r){V&&(s=t,is.includes(s))&&h.append(document.createComment(""));var i=V?xe(h):h.appendChild(be());V&&(null===i?Y(!1):N(i)),Cs(l),r(h,i),Cs(null)}hi.nodes.end=h,e.before(h)}var s;V&&N(e)}),rs(!0),()=>{t&&rs(!1)})},M),Oe(()=>{rs(!0)}),o&&(Y(!0),N(c))}function Rs(t,e,i){Fe(()=>{var s=Li(()=>e(t,i?.())||{});if(i&&s?.update){var r=!1,n={};Ve(()=>{var t=i();!function(t){if("object"==typeof t&&t&&!(t instanceof EventTarget))if(P in t)Pi(t);else if(!Array.isArray(t))for(let e in t){const i=t[e];"object"==typeof i&&i&&P in i&&Pi(i)}}(t),r&&j(n,t)&&(n=t,s.update(t))}),r=!0}if(s?.destroy)return()=>s.destroy()})}function Xs(t,e){var i,s=void 0;Be(()=>{s!==(s=e())&&(i&&(He(i),i=null),s&&(i=qe(()=>{Fe(()=>s(t))})))})}function Fs(t){var e,i,s="";if("string"==typeof t||"number"==typeof t)s+=t;else if("object"==typeof t)if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(i=Fs(t[e]))&&(s&&(s+=" "),s+=i)}else for(i in t)t[i]&&(s&&(s+=" "),s+=i);return s}function Vs(t){return"object"==typeof t?function(){for(var t,e,i=0,s="",r=arguments.length;i<r;i++)(t=arguments[i])&&(e=Fs(t))&&(s&&(s+=" "),s+=e);return s}(t):t??""}var Ys=[..." \t\n\r\f \v\ufeff"];function Ns(t,e=!1){var i=e?" !important;":";",s="";for(var r of Object.keys(t)){var n=t[r];null!=n&&""!==n&&(s+=" "+r+": "+n+i)}return s}function Bs(t){return"-"!==t[0]||"-"!==t[1]?t.toLowerCase():t}function qs(t,e,i,s,r,n){var a=t.__className;if(V||a!==i||void 0===a){var o=function(t,e,i){var s=null==t?"":""+t;if(e&&(s=s?s+" "+e:e),i)for(var r of Object.keys(i))if(i[r])s=s?s+" "+r:r;else if(s.length)for(var n=r.length,a=0;(a=s.indexOf(r,a))>=0;){var o=a+n;0!==a&&!Ys.includes(s[a-1])||o!==s.length&&!Ys.includes(s[o])?a=o:s=(0===a?"":s.substring(0,a))+s.substring(o+1)}return""===s?null:s}(i,s,n);V&&o===t.getAttribute("class")||(null==o?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t.__className=i}else if(n&&r!==n)for(var h in n){var c=!!n[h];null!=r&&c===!!r[h]||t.classList.toggle(h,c)}return n}function Ws(t,e={},i,s){for(var r in i){var n=i[r];e[r]!==n&&(null==i[r]?t.style.removeProperty(r):t.style.setProperty(r,n,s))}}function Us(t,e,i,s){var r=t.__style;if(V||r!==e){var n=function(t,e){if(e){var i,s,r="";if(Array.isArray(e)?(i=e[0],s=e[1]):i=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var n=!1,a=0,o=!1,h=[];i&&h.push(...Object.keys(i).map(Bs)),s&&h.push(...Object.keys(s).map(Bs));var c=0,l=-1;const e=t.length;for(var d=0;d<e;d++){var u=t[d];if(o?"/"===u&&"*"===t[d-1]&&(o=!1):n?n===u&&(n=!1):"/"===u&&"*"===t[d+1]?o=!0:'"'===u||"'"===u?n=u:"("===u?a++:")"===u&&a--,!o&&!1===n&&0===a)if(":"===u&&-1===l)l=d;else if(";"===u||d===e-1){if(-1!==l){var m=Bs(t.substring(c,l).trim());h.includes(m)||(";"!==u&&d++,r+=" "+t.substring(c,d).trim()+";")}c=d+1,l=-1}}}return i&&(r+=Ns(i)),s&&(r+=Ns(s,!0)),""===(r=r.trim())?null:r}return null==t?null:String(t)}(e,s);V&&n===t.getAttribute("style")||(null==n?t.removeAttribute("style"):t.style.cssText=n),t.__style=e}else s&&(Array.isArray(s)?(Ws(t,i?.[0],s[0]),Ws(t,i?.[1],s[1],"important")):Ws(t,i,s));return s}function Hs(t,e,i=!1){if(t.multiple){if(null==e)return;if(!s(e))return void console.warn("https://svelte.dev/e/select_multiple_invalid_value");for(var r of t.options)r.selected=e.includes(Gs(r))}else{for(r of t.options)if(ge(Gs(r),e))return void(r.selected=!0);i&&void 0===e||(t.selectedIndex=-1)}}function Gs(t){return"__value"in t?t.__value:t.value}var js=Symbol("class"),Zs=Symbol("style"),Js=Symbol("is custom element"),Ks=Symbol("is html"),Qs=z?"link":"LINK",tr=z?"input":"INPUT",er=z?"option":"OPTION",ir=z?"select":"SELECT",sr=z?"progress":"PROGRESS";function rr(t){if(V){var e=!1,i=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var i=t.value;ar(t,"value",null),t.value=i}if(t.hasAttribute("checked")){var s=t.checked;ar(t,"checked",null),t.checked=s}}};t.__on_r=i,at(i),Le||(Le=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{if(!t.defaultPrevented)for(const e of t.target.elements)e.__on_r?.()})},{capture:!0}))}}function nr(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function ar(t,e,i,s){var r=cr(t);V&&(r[e]=t.getAttribute(e),"src"===e||"srcset"===e||"href"===e&&t.nodeName===Qs)||r[e]!==(r[e]=i)&&("loading"===e&&(t[C]=i),null==i?t.removeAttribute(e):"string"!=typeof i&&dr(t).includes(e)?t[e]=i:t.setAttribute(e,i))}function or(t,e,i){var s=ni,r=hi;let n=V;V&&Y(!1),oi(null),ci(null);try{"style"!==e&&(lr.has(t.getAttribute("is")||t.nodeName)||!customElements||customElements.get(t.getAttribute("is")||t.nodeName.toLowerCase())?dr(t).includes(e):i&&"object"==typeof i)?t[e]=i:ar(t,e,null==i?i:String(i))}finally{oi(s),ci(r),n&&Y(!0)}}function hr(t,i,s=[],r=[],n=[],a,o=!1,h=!1){qt(n,s,r,s=>{var r=void 0,n={},c=t.nodeName===ir,l=!1;if(Be(()=>{var d=i(...s.map(Ei)),u=function(t,i,s,r,n=!1){if(V&&n&&t.nodeName===tr){var a=t;("checkbox"===a.type?"defaultChecked":"defaultValue")in s||rr(a)}var o=cr(t),h=o[Js],c=!o[Ks];let l=V&&h;l&&Y(!1);var d=i||{},u=t.nodeName===er;for(var m in i)m in s||(s[m]=null);s.class?s.class=Vs(s.class):(r||s[js])&&(s.class=null),s[Zs]&&(s.style??=null);var g=dr(t);for(const x in s){let T=s[x];if(u&&"value"===x&&null==T)t.value=t.__value="",d[x]=T;else if("class"!==x)if("style"!==x){var p=d[x];if(T!==p||void 0===T&&t.hasAttribute(x)){d[x]=T;var f=x[0]+x[1];if("$$"!==f)if("on"===f){const k={},_="$$"+x;let M=x.slice(2);var v=Ji(M);if(ji(M)&&(M=M.slice(0,-7),k.capture=!0),!v&&p){if(null!=T)continue;t.removeEventListener(M,d[_],k),d[_]=null}if(v)Ri(M,t,T),Xi([M]);else if(null!=T){function w(t){d[x].call(this,t)}d[_]=zi(M,t,w,k)}}else if("style"===x)ar(t,x,T);else if("autofocus"===x)Ae(t,Boolean(T));else if(h||"__value"!==x&&("value"!==x||null==T))if("selected"===x&&u)nr(t,T);else{var y=x;c||(y=Qi(y));var b="defaultValue"===y||"defaultChecked"===y;if(null!=T||h||b)b||g.includes(y)&&(h||"string"!=typeof T)?(t[y]=T,y in o&&(o[y]=e)):"function"!=typeof T&&ar(t,y,T);else if(o[x]=null,"value"===y||"checked"===y){let S=t;const E=void 0===i;if("value"===y){let I=S.defaultValue;S.removeAttribute(y),S.defaultValue=I,S.value=S.__value=E?I:null}else{let A=S.defaultChecked;S.removeAttribute(y),S.defaultChecked=A,S.checked=!!E&&A}}else t.removeAttribute(x)}else t.value=t.__value=T}}else Us(t,T,i?.[Zs],s[Zs]),d[x]=T,d[Zs]=s[Zs];else qs(t,"http://www.w3.org/1999/xhtml"===t.namespaceURI,T,r,i?.[js],s[js]),d[x]=T,d[js]=s[js]}return l&&Y(!0),d}(t,r,d,a,o,h);l&&c&&"value"in d&&Hs(t,d.value);for(let t of Object.getOwnPropertySymbols(n))d[t]||He(n[t]);for(let e of Object.getOwnPropertySymbols(d)){var m=d[e];"@attach"!==e.description||r&&m===r[e]||(n[e]&&He(n[e]),n[e]=qe(()=>Xs(t,()=>m))),u[e]=m}r=u}),c){var d=t;Fe(()=>{Hs(d,r.value,!0),function(t){var e=new MutationObserver(()=>{Hs(t,t.__value)});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Oe(()=>{e.disconnect()})}(d)})}l=!0})}function cr(t){return t.__attributes??={[Js]:t.nodeName.includes("-"),[Ks]:"http://www.w3.org/1999/xhtml"===t.namespaceURI}}var lr=new Map;function dr(t){var e,i=t.getAttribute("is")||t.nodeName,s=lr.get(i);if(s)return s;lr.set(i,s=[]);for(var r=t,n=Element.prototype;n!==r;){for(var a in e=l(r))e[a].set&&s.push(a);r=m(r)}return s}function ur(t,e,i=e){var s,r,n=()=>{cancelAnimationFrame(s),t.paused||(s=requestAnimationFrame(n));var e=t.currentTime;r!==e&&i(r=e)};s=requestAnimationFrame(n),t.addEventListener("timeupdate",n),Ve(()=>{var i=Number(e());r===i||isNaN(i)||(t.currentTime=r=i)}),Oe(()=>{cancelAnimationFrame(s),t.removeEventListener("timeupdate",n)})}function mr(t,e){Pe(t,["seeking","seeked"],()=>e(t.seeking))}function gr(t,e,i=e){var s=e();Pe(t,["play","pause","canplay"],()=>{s!==t.paused&&i(s=t.paused)},null==s),Fe(()=>{(s=!!e())!==t.paused&&(s?t.pause():t.play().catch(t=>{throw i(s=!0),t}))})}function pr(t,e){return t===e||t?.[P]===e}function fr(t={},e,i,s){var r=J.r,n=hi;return Fe(()=>{var a,o;return Ve(()=>{a=o,o=s?.()||[],Li(()=>{t!==i(...o)&&(e(t,...o),a&&pr(i(...a),t)&&e(null,...a))})}),()=>{let s=n;for(;s!==r&&null!==s.parent&&33554432&s.parent.f;)s=s.parent;const a=s.teardown;s.teardown=()=>{o&&pr(i(...o),t)&&e(null,...o),a?.()}}}),t}function vr(t,e,i,s,r){var n=()=>{s(i[t])};i.addEventListener(e,n),r?Ve(()=>{i[t]=r()}):n(),i!==document.body&&i!==window&&i!==document||Oe(()=>{i.removeEventListener(e,n)})}var wr={get(t,e){let i=t.props.length;for(;i--;){let s=t.props[i];if(p(s)&&(s=s()),"object"==typeof s&&null!==s&&e in s)return s[e]}},set(t,e,i){let s=t.props.length;for(;s--;){let r=t.props[s];p(r)&&(r=r());const n=c(r,e);if(n&&n.set)return n.set(i),!0}return!1},getOwnPropertyDescriptor(t,e){let i=t.props.length;for(;i--;){let s=t.props[i];if(p(s)&&(s=s()),"object"==typeof s&&null!==s&&e in s){const t=c(s,e);return t&&!t.configurable&&(t.configurable=!0),t}}},has(t,e){if(e===P||e===$)return!1;for(let i of t.props)if(p(i)&&(i=i()),null!=i&&e in i)return!0;return!1},ownKeys(t){const e=[];for(let i of t.props)if(p(i)&&(i=i()),i){for(const t in i)e.includes(t)||e.push(t);for(const t of Object.getOwnPropertySymbols(i))e.includes(t)||e.push(t)}return e}};function yr(...t){return new Proxy({props:t},wr)}function br(t,e,i,s){var r=!!(8&i),n=!!(16&i),a=s,o=!0,h=()=>(o&&(o=!1,a=n?Li(s):s),a);let l;if(r){var d=P in t||$ in t;l=c(t,e)?.set??(d&&e in t?i=>t[e]=i:void 0)}var u,m,g=!1;if(r?[u,g]=function(t){var e=yt;try{return yt=!1,[t(),yt]}finally{yt=e}}(()=>t[e]):u=t[e],void 0===u&&void 0!==s&&(u=h(),l&&(function(){throw new Error("https://svelte.dev/e/props_invalid_value")}(),l(u))),m=()=>{var i=t[e];return void 0===i?h():(o=!0,i)},!(4&i))return m;if(l){var p=t.$$legacy;return function(t,e){return arguments.length>0?((!e||p||g)&&l(e?m():t),t):m()}}var f=!1,v=(1&i?Ht:Zt)(()=>(f=!1,m()));r&&Ei(v);var w=hi;return function(t,e){if(arguments.length>0){const i=e?Ei(v):r?ue(t):t;return oe(v,i),f=!0,void 0!==a&&(a=i),t}return si&&f||16384&w.f?v.v:Ei(v)}}var xr=class{#G;#j;constructor(t){var e=new Map,i=(t,i)=>{var s=ae(i,!1,!1);return e.set(t,s),s};const s=new Proxy({...t.props||{},$$events:{}},{get:(t,s)=>Ei(e.get(s)??i(s,Reflect.get(t,s))),has:(t,s)=>s===$||(Ei(e.get(s)??i(s,Reflect.get(t,s))),Reflect.has(t,s)),set:(t,s,r)=>(oe(e.get(s)??i(s,r),r),Reflect.set(t,s,r))});this.#j=(t.hydrate?os:as)(t.component,{target:t.target,anchor:t.anchor,props:s,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError}),t?.props?.$$host&&!1!==t.sync||zt(),this.#G=s.$$events;for(const r of Object.keys(this.#j))"$set"!==r&&"$destroy"!==r&&"$on"!==r&&h(this,r,{get(){return this.#j[r]},set(t){this.#j[r]=t},enumerable:!0});this.#j.$set=t=>{Object.assign(s,t)},this.#j.$destroy=()=>{ds(this.#j)}}$set(t){this.#j.$set(t)}$on(t,e){this.#G[t]=this.#G[t]||[];const i=(...t)=>e.call(this,...t);return this.#G[t].push(i),()=>{this.#G[t]=this.#G[t].filter(t=>t!==i)}}$destroy(){this.#j.$destroy()}};function Tr(t,e,i,s){const r=i[t]?.type;if(e="Boolean"===r&&"boolean"!=typeof e?null!=e:e,!s||!i[t])return e;if("toAttribute"===s)switch(r){case"Object":case"Array":return null==e?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return null==e?null:e;default:return e}else switch(r){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":default:return e;case"Number":return null!=e?+e:e}}"function"==typeof HTMLElement&&HTMLElement;var kr="E001",_r="E002",Mr="E003",Sr="E004",Er="E005",Ir="E100",Ar="E101",Lr="E102",Pr="E103",$r="E200",Cr="E201",Dr="E202",zr="E203",Or="E300",Rr="E301",Xr="E302",Fr="E303",Vr="E999",Yr={[kr]:"You appear to be offline. Please check your internet connection and try again.",[_r]:"The connection timed out. Please try again.",[Mr]:"Unable to load content due to security restrictions.",[Sr]:"The requested image or content could not be found.",[Er]:"The server encountered an error. Please try again later.",[Ir]:"Your browser does not support WebGL, which is required to view this content. Please try a different browser.",[Ar]:"The graphics context was lost. The page will attempt to recover.",[Lr]:"There was a problem initializing the graphics. Please try refreshing the page.",[Pr]:"Your device is low on memory. Try closing other browser tabs or applications.",[$r]:"The image data appears to be invalid or corrupted.",[Cr]:"The requested content could not be loaded.",[Dr]:"There was a problem processing the image information.",[zr]:"This image uses an unsupported format version.",[Or]:"Failed to load the image viewer engine. Please try refreshing the page.",[Rr]:"An error occurred in the image viewer. Please try refreshing the page.",[Xr]:"Failed to load the image. Please try again.",[Fr]:"Failed to load the tour. Some features may be unavailable.",[Vr]:"An unexpected error occurred. Please try refreshing the page."},Nr=class t extends Error{constructor(e,i){super(e),this.name="MicrioError",this.code=i?.code??Vr,this.displayMessage=i?.displayMessage??Yr[this.code],this.cause=i?.cause,this.statusCode=i?.statusCode,"captureStackTrace"in Error&&"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t)}static fromResponse(e,i){const s=e.status;let r=Vr;return 404===s?r=Sr:s>=500&&s<600?r=Er:0===s?r=kr:408!==s&&504!==s||(r=_r),new t(`${i?i+": ":""}HTTP ${s}`,{code:r,statusCode:s})}static fromError(e,i){const s=e.message.toLowerCase();let r=Vr;return s.includes("network")||s.includes("internet")||s.includes("offline")?r=kr:s.includes("timeout")?r=_r:s.includes("cors")||s.includes("cross-origin")?r=Mr:s.includes("webgl")||s.includes("webglcontext")?r=Ir:s.includes("memory")||s.includes("out of memory")?r=Pr:(s.includes("wasm")||s.includes("webassembly"))&&(r=Or),new t(`${i?i+": ":""}${e.message}`,{code:r,cause:e})}},Br=(t,e=1)=>(t%e+e)%e,qr=t=>JSON.parse(JSON.stringify(t));function Wr(t,e,i={}){if(!t||"object"!=typeof t)return e;for(const s in t){const r=t[s];if(r&&"object"==typeof r&&Object.getPrototypeOf(r)===Object.prototype){const t=e;t[s]&&"object"==typeof t[s]||(t[s]={}),Wr(r,t[s],i)}else{const t=e;i.mergeArrays&&t[s]instanceof Array&&r instanceof Array?t[s].push(...r):i.noOverwrite&&s in e||(t[s]=r)}}return e}var Ur=()=>Math.floor(65536*(1+Math.random())).toString(16).substring(1),Hr=()=>Ur()+Ur()+"-"+Ur()+"-"+Ur()+"-"+Ur()+"-"+Ur()+Ur()+Ur(),Gr=t=>{if(void 0===t)return t;t=(t=t.replace(/^\s+|\s+$/g,"")).toLowerCase();for(let e=0,i=28;e<i;e++)t=t.replace(new RegExp("àáäâèéëêìíïîòóöôùúüûñç·/_,:;".charAt(e),"g"),"aaaaeeeeiiiioooouuuunc------".charAt(e));return t=t.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")};function jr(t){const e=t<0;e&&(t=-t);const i=Math.ceil(t),s=Math.floor(i/3600),r=Math.floor(i%3600/60),n=i%60,a=t=>t<10?"0"+t:""+t;return(e?"-":"")+(s?s+":"+a(r):""+r)+":"+a(n)}var Zr=navigator.userAgent,Jr={iOS:/ipad|iphone|ipod/i.test(Zr),firefox:/firefox/i.test(Zr),OSX:/macintosh/i.test(Zr)&&/os\ x/i.test(Zr),hasTouch:"TouchEvent"in self,safari:!1};Jr.safari=(Jr.OSX||Jr.iOS)&&(/safari/i.test(Zr)||/instagram/i.test(Zr))&&!/chrome/i.test(Zr),Jr.OSX&&Jr.safari&&"TouchEvent"in self&&(Jr.iOS=!0,Jr.OSX=!1);var Kr=t=>new Promise(e=>t?setTimeout(e,t):e()),Qr=[],tn=(t,e,i)=>new Promise((s,r)=>{if(i||Qr.includes(t))return s();const n=document.createElement("script"),a=()=>{Qr.push(t),s()};e?self[e]=a:n.onload=a,n.onerror=()=>r&&r(),n.async=!0,n.defer=!0,self.crossOriginIsolated&&(n.crossOrigin="anonymous"),n.src=t,document.head.appendChild(n)}),en=(t,e={})=>new Promise(i=>{let s,r=!0;s=t.subscribe(t=>{r&&e.allowUndefined&&void 0===t||(r=!1,(void 0!==e.targetValue?t===e.targetValue:e.allowUndefined||void 0!==t)&&(s?s():Si().then(()=>s()),i(t)))})}),sn=new WeakSet,rn={fromLegacy:t=>{if(!t)return;if(sn.has(t))return t;const e=[t[0],t[1],t[2]-t[0],t[3]-t[1]];return sn.add(t),e},toCenterJSON:t=>({centerX:t[0]+t[2]/2,centerY:t[1]+t[3]/2,width:t[2],height:t[3]}),rectToCenterJSON:t=>rn.toCenterJSON([t[0],t[1],t[2]-t[0],t[3]-t[1]])},nn={"micrio-cdn.azureedge.net":"micrio.vangoghmuseum.nl/micrio","micrio-cdn.vangoghmuseum.nl":"micrio.vangoghmuseum.nl/micrio","rijks-micrio.azureedge.net":"micrio.rijksmuseum.nl"},an=t=>{if(t instanceof Object&&"fileUrl"in t&&!t.src&&(t.src=t.fileUrl),t?.src)for(let e in nn)t.src.includes(e)&&(t.src=t.src.replace(e,nn[e]))},on=t=>!t.viewsWH,hn=new WeakMap,cn=t=>{an(t.image),t.children?.forEach(cn)},ln=new WeakSet,dn=(t,e,i,s)=>{if(ln.has(t))return;ln.add(t),t.data||(t.data={}),t.id||(t.id=Hr()),t.tags||(t.tags=[]),"type"in t||(t.type="default"),t.popupType||(t.popupType="popup"),"string"==typeof t.data.icon&&(t.data.icon={title:"",size:0,uploaded:0,width:-1,height:-1,src:t.data.icon}),t.images?.forEach(an),an(t.positionalAudio),an(t.data?.icon),Object.values(t.i18n??{}).forEach(t=>an(t.audio));const r="embedImages"in t?t.embedImages:void 0;r&&r.forEach(t=>an(t));const n=t.data?._meta?.secondary;n&&(t.data.micrioSplitLink=n),i&&"class"in t&&(t.tags??=[]).push(...t.class.split(" ").map(t=>t.trim()).filter(e=>!!e&&!t.tags.includes(e))),t.tags?.includes("default")&&(t.type="default"),s&&(t.view=rn.fromLegacy(t.view),un(t.videoTour))};function un(t){if(!t||!("i18n"in t)&&!("timeline"in t))return;const e="i18n"in t?t.i18n:{en:t};for(const i in e)e[i]?.timeline.forEach(t=>t.rect=rn.fromLegacy(t.rect))}var mn="6.0.1",gn="https://b.micr.io/";var pn=function(){try{const t=location.hostname;if(t.endsWith("micrio.dev"))return"micrio.dev";if(t.endsWith("micrio.net"))return"micrio.net"}catch{}return"micr.io"}(),fn=`https://viewer.${pn}/`,vn=["ttBWO","IicaE","KLTce","xjQrB","pfhXT","rNIPa","rdFIY","mvRXc"],wn="micrio-muted",yn={id:"",version:mn,path:gn,width:0,height:0,tileSize:1024,lang:"en",settings:{camspeed:1,view:[0,0,1,1],restrict:[0,0,1,1],focus:[.5,.5],zoomLimit:1,fullscreen:!0,hookEvents:!0,hookScroll:!0,hookPinch:!0,hookDrag:!0,minimap:!0,doTourJumps:!0,audio:!0,startVolume:1,mutedVolume:0,_markers:{showTitles:!1,popupAnimation:{duration:200,x:-50},zoomOutAfterClose:!0},ui:{controls:{cultureSwitch:!0}},_360:{},_meta:{}}},bn={STRINGS:{id:{r:!0},lang:{r:!0},"data-thumb":{f:"thumbSrc"},"data-title":{r:!0},"data-format":{r:!0},"data-extension":{r:!0,f:"tileExtension"},"data-tiles":{r:!0,f:"tilesId"},"data-path":{r:!0},"data-inittype":{f:"initType"},"data-start":{f:"gallery.startId"},"data-gallery":{f:"gallery.archive"},"data-gallery-sort":{f:"gallery.sort"},"data-iiif":{r:!0,f:"iiifManifest"},"data-grid":{r:!0},"data-gallery-type":{f:"gallery.type"}},BOOLEANS:{"data-static":{},muted:{f:"audio",n:!0},"data-png":{r:!0,f:"isPng"},"data-webp":{r:!0,f:"isWebP"},"data-dz":{r:!0,f:"isDeepZoom"},"data-is360":{r:!0},"data-no-externals":{f:"noExternals"},"data-skipmeta":{f:"skipMeta"},"data-force-data-refresh":{f:"forceDataRefresh"},"data-keeprendering":{f:"keepRendering"},"data-coverlimit":{f:"limitToCoverScale"},"data-events":{f:"hookEvents"},"data-keys":{f:"hookKeys"},"data-zooming":{f:"noZoom",n:!0},"data-scroll-zoom":{f:"hookScroll"},"data-pinch-zoom":{f:"hookPinch"},"data-dragging":{f:"hookDrag"},"data-two-finger-pan":{f:"twoFingerPan"},"data-control-zoom":{f:"controlZoom"},"data-ui":{f:"noUI",n:!0},"data-gtag":{f:"noGTag",n:!0},"data-controls":{f:"noControls",n:!0},"data-logo":{f:"noLogo",n:!0},"data-logo-org":{f:"noOrgLogo",n:!0},"data-toolbar":{f:"noToolbar",n:!0},"data-show-info":{f:"showInfo"},"data-social":{},"data-fullscreen":{},"data-minimap":{},"data-minimap-hide":{f:"alwaysShowMinimap",n:!0},"data-normalize-dpr":{f:"zoomLimitDPRFix"},"data-grid-clickable":{f:"gridClickable"},"data-gallery-spreads":{f:"gallery.isSpreads"},"data-freemove":{f:"freeMove"},"data-force-path":{f:"forceInfoPath",r:!0}},NUMBERS:{"data-version":{r:!0},height:{r:!0},width:{r:!0},volume:{f:"startVolume"},"data-tilesize":{r:!0,f:"tileSize"},"data-camspeed":{},"data-zoomlimit":{f:"zoomLimit"},"data-minimap-height":{f:"minimapHeight"},"data-minimap-width":{f:"minimapWidth"},"data-mutedvolume":{f:"mutedVolume"},"data-width-cm":{f:"cmWidth"},"data-height-cm":{f:"cmHeight"},"data-gallery-cover-pages":{f:"gallery.coverPages"},lazyload:{dN:0},"data-elasticity":{f:"dragElasticity"},"data-skip-base-levels":{f:"skipBaseLevels"},"data-watermark-opacity":{f:"watermarkOpacity"}},ARRAYS:{"data-focus":{},"data-view":{}}},xn=new Map,Tn=new Map,kn=new Map,_n=async(t,e)=>{if(!e&&xn.has(t))return qr(xn.get(t));if(Tn.has(t))return Tn.get(t);if(kn.has(t))throw kn.get(t)[1];const i=fetch(t+(e?(t.includes("?")?"&":"?")+Math.random():"")).then(async e=>{if(200==e.status)return e.json();{const i=Nr.fromResponse(e,`fetchJson(${t})`);throw kn.set(t,[e.status,i.message]),i}}).then(i=>(e||xn.set(t,i),Tn.delete(t),qr(i))).catch(e=>{throw Tn.delete(t),e});return Tn.set(t,i),i},Mn=t=>"MICRIO_DATA"in self?(self?.MICRIO_DATA).find(e=>e[0]==t):void 0,Sn=(t,e,i)=>{const s=Mn(t)?.[1];return s?Promise.resolve(s):_n(`${e??fn}${t}/info.json`,i).then(t=>{var e;return t&&("Height"in t&&(t.height=t.Height,t.version=1,t.tileSize=512),"Width"in t&&(t.width=t.Width)),(e=t)&&(hn.has(e)||(an(e.organisation?.logo),an(e.settings?._markers?.markerIcon),e.settings?._markers?.customIcons?.forEach(an),an(e.settings?._360?.video),e?.settings&&on(e)&&(e.settings.view=rn.fromLegacy(e.settings.view),e.settings.restrict=rn.fromLegacy(e.settings.restrict)),hn.set(e,!0))),t})};async function En(t,e,i,s){if(!("steps"in e)||e.stepInfo)return;const r=[...new Set(e.steps.map(t=>t.split(",")[1]).filter(e=>!!e&&e!=t.id))],[n,a]=await Promise.all([Promise.all(r.map(e=>_n((e=>t.dataPath+(t.isV5?e+"/data/pub.json":e+"/data."+i+".json"))(e)))),Promise.all(r.map(t=>Sn(t)))]);n.forEach((e,s)=>{const r=on(a[s]);e?.markers?.forEach(e=>dn(e,i,!t.isV5,r))}),an(e.image);let o=-1;const h=[];e.stepInfo=e.steps.map((e,a)=>{const[c,l]=e.split(","),d=n[r.indexOf(l)]??s,u=d?.markers?.find(t=>t.id==c),m=u?.i18n?.[i]??u;m?.title&&(o=a);const g=u?.videoTour?"timeline"in u.videoTour?u.videoTour:u.videoTour.i18n?.[i]??void 0:void 0;return an(g?.audio),an(g?.subtitle),u?(an(m?.audio),u.videoTour&&m?.audio&&(u.videoTour.audio=m.audio),{markerId:c,marker:u,micrioId:l||t.id,duration:Number(g?.duration||m?.audio?.duration||0),startView:g?.timeline?.length?g.timeline[0].rect:u?.view,imageHasOtherMarkers:!!l&&!!d?.markers?.find(t=>t.id!=c&&!t.noMarker),gridView:!(!u.data?._meta?.gridView&&!u.data?._meta?.gridAction),chapter:o,hasSubtitle:!!g?.subtitle}):(console.warn(`[Micrio] Warning: tour step ${a+1} with id [${c}] not found! Removing it from the tour`),void h.push(a))}).filter(t=>void 0!==t),h.reverse().forEach(t=>e.steps.splice(t,1)),e.initialStep=0,e.duration=e.stepInfo.reduce((t,e)=>t+(e.duration||0),0)}var In=t=>{let e=t.charCodeAt(0),i=e<91;return(e-=i?65:97)-(e>7?1:0)+(i?24:e>10?-1:0)},An=t=>6==t.length||7==t.length;function Ln(t,e){const i=t.$current;if(!i)return;const s=t.spaceData?.images.find(t=>t.id==i.id),r=t.spaceData?.images.find(t=>t.id==e);if(!s||!r)return;const n=[(r.x??.5)-(s.x??.5),(s.y??.5)-(r.y??.5),(r.z??.5)-(s.z??.5)];let a=n[0]*n[0]+n[1]*n[1]+n[2]*n[2];a>0&&(a=1/Math.sqrt(a));const o=[n[0]*a,n[1]*a,n[2]*a],h=Br(Math.atan2(-o[0],o[2])/Math.PI/2);return{v:n,vN:o,directionX:h,vector:{direction:h%1,distanceX:Math.max(0,Math.min(.4,Math.sqrt(o[0]*o[0]+o[2]*o[2]))),distanceY:-n[1]}}}function Pn([t,e,i=0,s=0],[r,n,a=0,o=0],h){const c=Math.max(s/2,h),l=Math.max(o/2,h);return!(t+i+h<r-h||t-h>r+a+h||e+c<n-l||e-c>n+l)}var $n,Cn=function(t){return t[t.None=0]="None",t[t.IFrame=1]="IFrame",t[t.Video=2]="Video",t[t.Audio=3]="Audio",t[t.VideoTour=4]="VideoTour",t[t.Micrio=5]="Micrio",t}({}),Dn=function(t){return t[t.YouTube=1]="YouTube",t[t.Vimeo=2]="Vimeo",t}({}),zn=/((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be|youtube-nocookie\.com))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)?/,On=/vimeo\.com/,Rn=/^.*t=(\d+).*$/,Xn="https://www.youtube-nocookie.com";function Fn(t){if(t)return"fileUrl"in t?t.fileUrl:t.src}function Vn(t,e){return t.i18n?.[e]??t}var Yn=t=>t;function Nn(t){const e=t-1;return e*e*e+1}function Bn(t){const e="string"==typeof t&&t.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[t,"px"]}function qn(t,{delay:e=0,duration:i=400,easing:s=Yn}={}){const r=+getComputedStyle(t).opacity;return{delay:e,duration:i,easing:s,css:t=>"opacity: "+t*r}}function Wn(t,{delay:e=0,duration:i=400,easing:s=Nn,x:r=0,y:n=0,opacity:a=0}={}){const o=getComputedStyle(t),h=+o.opacity,c="none"===o.transform?"":o.transform,l=h*(1-a),[d,u]=Bn(r),[m,g]=Bn(n);return{delay:e,duration:i,easing:s,css:(t,e)=>`\n\t\t\ttransform: ${c} translate(${(1-t)*d}${u}, ${(1-t)*m}${g});\n\t\t\topacity: ${h-l*e}`}}var Un=Bi('<a rel="noopener" href="https://micr.io/" title="Powered by Micrio" aria-label="Micrio homepage"></a>');function Hn(t,e){et(e,!0);const[i,s]=kt(),r=Q("micrio"),{tour:n,marker:a}=r.state,o=/micr\.io/.test(location.origin)&&self.parent==self?void 0:"_blank";let h,c=ne(!1);ps(()=>r.loading.subscribe(t=>{clearTimeout(h),t?Ei(c)||(h=setTimeout(()=>oe(c,!0),750)):oe(c,!1)}));const l=jt(()=>!!xt(n,"$tour",i)||!!xt(a,"$marker",i));var d=Hi(),u=_e(d),m=t=>{var e=Un();let i;Ye(()=>{ar(e,"target",o),i=qs(e,1,"micrio-logo",null,i,{loading:Ei(c)})}),Ds(3,e,()=>qn,()=>({duration:200})),Gi(t,e)};vs(u,t=>{Ei(l)||t(m)}),Gi(t,d),it(),s()}var Gn=Bi('<a rel="noopener" target="_blank" class="micrio-logo-org"><img alt="Logo" class="micrio-logo-org"/></a>');function jn(t,e){et(e,!0);const[i,s]=kt(),{tour:r,marker:n,popover:a}=Q("micrio").state;const o=jt(()=>!!xt(r,"$tour",i)||!!xt(n,"$marker",i)||!!xt(a,"$popover",i));var h=Hi(),c=_e(h),l=t=>{var i=Gn(),s=ke(i);q(i),Ye(t=>{ar(i,"href",e.organisation.href??"#"),ar(i,"title",e.organisation.name),ar(i,"aria-label",`${e.organisation.name??""} homepage`),ar(s,"src",t)},[()=>function(t){if("string"==typeof t)return t;let e=0,i=Math.max(t.width,t.height);for(;i>1024;)e++,i/=2;return t.micrioId&&t.width>1024?"https://r2.micr.io/"+t.micrioId+"/"+e+"/0-0."+(t.isPng?"png":t.isWebP?"webp":"jpg"):t.src}(e.organisation.logo)]),Ds(3,i,()=>qn,()=>({duration:200})),Gi(t,i)};vs(c,t=>{!Ei(o)&&e.organisation.logo&&t(l)}),Gi(t,h),it(),s()}var Zn={en:{close:"Close",zoomIn:"Zoom in",zoomOut:"Zoom out",fullscreenToggle:"Toggle fullscreen",switchLanguage:"Switch language",share:"Share",audioMute:"Mute audio",audioUnmute:"Unmute audio",closeMarker:"Close this marker",tourStepNext:"Next step",tourStepPrev:"Previous step",tourStop:"Stop this tour",minimize:"Minimize",play:"Play",pause:"Pause",stop:"Stop",subtitlesToggle:"Toggle subtitles",galleryPrev:"Previous image",galleryNext:"Next image",menuToggle:"Toggle menu",waypointFollow:"Go this way"},nl:{close:"Sluit",zoomIn:"Zoom in",zoomOut:"Zoom uit",fullscreenToggle:"Volledig scherm aan / uit",switchLanguage:"Kies taal",share:"Deel",audioMute:"Geluid uit",audioUnmute:"Geluid aan",closeMarker:"Sluit deze marker",tourStepNext:"Volgende stap",tourStepPrev:"Vorige stap",tourStop:"Stop deze tour",minimize:"Minimaliseer",play:"Start",pause:"Pauzeer",stop:"Stop",subtitlesToggle:"Ondertitels aan / uit",galleryPrev:"Vorige afbeelding",galleryNext:"Volgende afbeelding",menuToggle:"Menu openen / sluiten",waypointFollow:"Ga deze richting"}},Jn=vt(Zn.en),Kn=navigator?.language??"en-EN",Qn="Intl"in self&&Intl.DisplayNames?new Intl.DisplayNames([Kn],{type:"language"}):void 0,ta=["ar","ar-AE","ar-BH","ar-DJ","ar-DZ","ar-EG","ar-IQ","ar-JO","ar-KW","ar-LB","ar-LY","ar-MA","ar-OM","ar-QA","ar-SA","ar-SD","ar-SY","ar-TN","ar-YE","dv","dv-MV","fa","fa-AF","fa-IR","he","he-IL","iw","iw-PS","kd","ku","ku-IQ","ku-IR","ku-SY","ku-TR","pk-PK","ps","ps-AF","sd","sd-PK","syr-SY","ug","ug-CN","ur","ur-IN","ur-PK","yi","yi-IL","yi-US"],ea={arrowDown:[384,512,"M169.4 502.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 402.7 224 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 370.7-105.4-105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z"],arrowLeft:[512,512,"M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 288 480 288c17.7 0 32-14.3 32-32s-14.3-32-32-32l-370.7 0 105.4-105.4c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"],arrowRight:[512,512,"M502.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l370.7 0-105.4 105.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z"],arrowUp:[384,512,"M214.6 9.4c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 109.3 160 480c0 17.7 14.3 32 32 32s32-14.3 32-32l0-370.7 105.4 105.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-160-160z"],bars:[448,512,"M0 96C0 78.3 14.3 64 32 64l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32L32 448c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"],chevronDown:[448,512,"M201.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 338.7 54.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"],circleExclamation:[512,512,"M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zm0-192a32 32 0 1 0 0 64 32 32 0 1 0 0-64zm0-192c-18.2 0-32.7 15.5-31.4 33.7l7.4 104c.9 12.6 11.4 22.3 23.9 22.3 12.6 0 23-9.7 23.9-22.3l7.4-104c1.3-18.2-13.1-33.7-31.4-33.7z"],closedCaptioning:[512,512,"M0 128C0 92.7 28.7 64 64 64l384 0c35.3 0 64 28.7 64 64l0 256c0 35.3-28.7 64-64 64L64 448c-35.3 0-64-28.7-64-64L0 128zm152 80l32 0c4.4 0 8 3.6 8 8 0 13.3 10.7 24 24 24s24-10.7 24-24c0-30.9-25.1-56-56-56l-32 0c-30.9 0-56 25.1-56 56l0 80c0 30.9 25.1 56 56 56l32 0c30.9 0 56-25.1 56-56 0-13.3-10.7-24-24-24s-24 10.7-24 24c0 4.4-3.6 8-8 8l-32 0c-4.4 0-8-3.6-8-8l0-80c0-4.4 3.6-8 8-8zm168 8c0-4.4 3.6-8 8-8l32 0c4.4 0 8 3.6 8 8 0 13.3 10.7 24 24 24s24-10.7 24-24c0-30.9-25.1-56-56-56l-32 0c-30.9 0-56 25.1-56 56l0 80c0 30.9 25.1 56 56 56l32 0c30.9 0 56-25.1 56-56 0-13.3-10.7-24-24-24s-24 10.7-24 24c0 4.4-3.6 8-8 8l-32 0c-4.4 0-8-3.6-8-8l0-80z"],compress:[448,512,"M160 64c0-17.7-14.3-32-32-32S96 46.3 96 64l0 64-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32l0-96zM32 320c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 0 64c0 17.7 14.3 32 32 32s32-14.3 32-32l0-96c0-17.7-14.3-32-32-32l-96 0zM352 64c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 96c0 17.7 14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64 0 0-64zM320 320c-17.7 0-32 14.3-32 32l0 96c0 17.7 14.3 32 32 32s32-14.3 32-32l0-64 64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-96 0z"],ellipsisVertical:[128,512,"M64 144a56 56 0 1 1 0-112 56 56 0 1 1 0 112zm0 224c30.9 0 56 25.1 56 56s-25.1 56-56 56-56-25.1-56-56 25.1-56 56-56zm56-112c0 30.9-25.1 56-56 56s-56-25.1-56-56 25.1-56 56-56 56 25.1 56 56z"],expand:[448,512,"M32 32C14.3 32 0 46.3 0 64l0 96c0 17.7 14.3 32 32 32s32-14.3 32-32l0-64 64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 32zM64 352c0-17.7-14.3-32-32-32S0 334.3 0 352l0 96c0 17.7 14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64 0 0-64zM320 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 0 64c0 17.7 14.3 32 32 32s32-14.3 32-32l0-96c0-17.7-14.3-32-32-32l-96 0zM448 352c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 64-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32l0-96z"],externalLink:[512,512,"M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l82.7 0-201.4 201.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3 448 192c0 17.7 14.3 32 32 32s32-14.3 32-32l0-160c0-17.7-14.3-32-32-32L320 0zM80 96C35.8 96 0 131.8 0 176L0 432c0 44.2 35.8 80 80 80l256 0c44.2 0 80-35.8 80-80l0-80c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 80c0 8.8-7.2 16-16 16L80 448c-8.8 0-16-7.2-16-16l0-256c0-8.8 7.2-16 16-16l80 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L80 96z"],globe:[512,512,"M351.9 280l-190.9 0c2.9 64.5 17.2 123.9 37.5 167.4 11.4 24.5 23.7 41.8 35.1 52.4 11.2 10.5 18.9 12.2 22.9 12.2s11.7-1.7 22.9-12.2c11.4-10.6 23.7-28 35.1-52.4 20.3-43.5 34.6-102.9 37.5-167.4zM160.9 232l190.9 0C349 167.5 334.7 108.1 314.4 64.6 303 40.2 290.7 22.8 279.3 12.2 268.1 1.7 260.4 0 256.4 0s-11.7 1.7-22.9 12.2c-11.4 10.6-23.7 28-35.1 52.4-20.3 43.5-34.6 102.9-37.5 167.4zm-48 0C116.4 146.4 138.5 66.9 170.8 14.7 78.7 47.3 10.9 131.2 1.5 232l111.4 0zM1.5 280c9.4 100.8 77.2 184.7 169.3 217.3-32.3-52.2-54.4-131.7-57.9-217.3L1.5 280zm398.4 0c-3.5 85.6-25.6 165.1-57.9 217.3 92.1-32.7 159.9-116.5 169.3-217.3l-111.4 0zm111.4-48C501.9 131.2 434.1 47.3 342 14.7 374.3 66.9 396.4 146.4 399.9 232l111.4 0z"],image:[448,512,"M64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32zm64 80a48 48 0 1 1 0 96 48 48 0 1 1 0-96zM272 224c8.4 0 16.1 4.4 20.5 11.5l88 144c4.5 7.4 4.7 16.7 .5 24.3S368.7 416 360 416L88 416c-8.9 0-17.2-5-21.3-12.9s-3.5-17.5 1.6-24.8l56-80c4.5-6.4 11.8-10.2 19.7-10.2s15.2 3.8 19.7 10.2l26.4 37.8 61.4-100.5c4.4-7.1 12.1-11.5 20.5-11.5z"],layerGroup:[512,512,"M232.5 5.2c14.9-6.9 32.1-6.9 47 0l218.6 101c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L13.9 149.8C5.4 145.8 0 137.3 0 128s5.4-17.9 13.9-21.8L232.5 5.2zM48.1 218.4l164.3 75.9c27.7 12.8 59.6 12.8 87.3 0l164.3-75.9 34.1 15.8c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L13.9 277.8C5.4 273.8 0 265.3 0 256s5.4-17.9 13.9-21.8l34.1-15.8zM13.9 362.2l34.1-15.8 164.3 75.9c27.7 12.8 59.6 12.8 87.3 0l164.3-75.9 34.1 15.8c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L13.9 405.8C5.4 401.8 0 393.3 0 384s5.4-17.9 13.9-21.8z"],link:[576,512,"M419.5 96c-16.6 0-32.7 4.5-46.8 12.7-15.8-16-34.2-29.4-54.5-39.5 28.2-24 64.1-37.2 101.3-37.2 86.4 0 156.5 70 156.5 156.5 0 41.5-16.5 81.3-45.8 110.6l-71.1 71.1c-29.3 29.3-69.1 45.8-110.6 45.8-86.4 0-156.5-70-156.5-156.5 0-1.5 0-3 .1-4.5 .5-17.7 15.2-31.6 32.9-31.1s31.6 15.2 31.1 32.9c0 .9 0 1.8 0 2.6 0 51.1 41.4 92.5 92.5 92.5 24.5 0 48-9.7 65.4-27.1l71.1-71.1c17.3-17.3 27.1-40.9 27.1-65.4 0-51.1-41.4-92.5-92.5-92.5zM275.2 173.3c-1.9-.8-3.8-1.9-5.5-3.1-12.6-6.5-27-10.2-42.1-10.2-24.5 0-48 9.7-65.4 27.1L91.1 258.2c-17.3 17.3-27.1 40.9-27.1 65.4 0 51.1 41.4 92.5 92.5 92.5 16.5 0 32.6-4.4 46.7-12.6 15.8 16 34.2 29.4 54.6 39.5-28.2 23.9-64 37.2-101.3 37.2-86.4 0-156.5-70-156.5-156.5 0-41.5 16.5-81.3 45.8-110.6l71.1-71.1c29.3-29.3 69.1-45.8 110.6-45.8 86.6 0 156.5 70.6 156.5 156.9 0 1.3 0 2.6 0 3.9-.4 17.7-15.1 31.6-32.8 31.2s-31.6-15.1-31.2-32.8c0-.8 0-1.5 0-2.3 0-33.7-18-63.3-44.8-79.6z"],minus:[448,512,"M0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32z"],pause:[384,512,"M48 32C21.5 32 0 53.5 0 80L0 432c0 26.5 21.5 48 48 48l64 0c26.5 0 48-21.5 48-48l0-352c0-26.5-21.5-48-48-48L48 32zm224 0c-26.5 0-48 21.5-48 48l0 352c0 26.5 21.5 48 48 48l64 0c26.5 0 48-21.5 48-48l0-352c0-26.5-21.5-48-48-48l-64 0z"],play:[448,512,"M91.2 36.9c-12.4-6.8-27.4-6.5-39.6 .7S32 57.9 32 72l0 368c0 14.1 7.5 27.2 19.6 34.4s27.2 7.5 39.6 .7l336-184c12.8-7 20.8-20.5 20.8-35.1s-8-28.1-20.8-35.1l-336-184z"],playCircle:[512,512,"M0 256a256 256 0 1 1 512 0 256 256 0 1 1 -512 0zM188.3 147.1c-7.6 4.2-12.3 12.3-12.3 20.9l0 176c0 8.7 4.7 16.7 12.3 20.9s16.8 4.1 24.3-.5l144-88c7.1-4.4 11.5-12.1 11.5-20.5s-4.4-16.1-11.5-20.5l-144-88c-7.4-4.5-16.7-4.7-24.3-.5z"],plus:[448,512,"M256 64c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 160-160 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l160 0 0 160c0 17.7 14.3 32 32 32s32-14.3 32-32l0-160 160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-160 0 0-160z"],share:[512,512,"M307.8 18.4c-12 5-19.8 16.6-19.8 29.6l0 80-112 0c-97.2 0-176 78.8-176 176 0 113.3 81.5 163.9 100.2 174.1 2.5 1.4 5.3 1.9 8.1 1.9 10.9 0 19.7-8.9 19.7-19.7 0-7.5-4.3-14.4-9.8-19.5-9.4-8.8-22.2-26.4-22.2-56.7 0-53 43-96 96-96l96 0 0 80c0 12.9 7.8 24.6 19.8 29.6s25.7 2.2 34.9-6.9l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-9.2-9.2-22.9-11.9-34.9-6.9z"],video:[576,512,"M96 64c-35.3 0-64 28.7-64 64l0 256c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-256c0-35.3-28.7-64-64-64L96 64zM464 336l73.5 58.8c4.2 3.4 9.4 5.2 14.8 5.2 13.1 0 23.7-10.6 23.7-23.7l0-240.6c0-13.1-10.6-23.7-23.7-23.7-5.4 0-10.6 1.8-14.8 5.2L464 176 464 336z"],volumeHigh:[640,512,"M533.6 32.5c-10.3-8.4-25.4-6.8-33.8 3.5s-6.8 25.4 3.5 33.8C557.5 113.8 592 180.8 592 256s-34.5 142.2-88.7 186.3c-10.3 8.4-11.8 23.5-3.5 33.8s23.5 11.8 33.8 3.5C598.5 426.7 640 346.2 640 256S598.5 85.2 533.6 32.5zM473.1 107c-10.3-8.4-25.4-6.8-33.8 3.5s-6.8 25.4 3.5 33.8C475.3 170.7 496 210.9 496 256s-20.7 85.3-53.2 111.8c-10.3 8.4-11.8 23.5-3.5 33.8s23.5 11.8 33.8 3.5c43.2-35.2 70.9-88.9 70.9-149s-27.7-113.8-70.9-149zm-60.5 74.5c-10.3-8.4-25.4-6.8-33.8 3.5s-6.8 25.4 3.5 33.8C393.1 227.6 400 241 400 256s-6.9 28.4-17.7 37.3c-10.3 8.4-11.8 23.5-3.5 33.8s23.5 11.8 33.8 3.5C434.1 312.9 448 286.1 448 256s-13.9-56.9-35.4-74.5zM80 352l48 0 134.1 119.2c6.4 5.7 14.6 8.8 23.1 8.8 19.2 0 34.8-15.6 34.8-34.8l0-378.4c0-19.2-15.6-34.8-34.8-34.8-8.5 0-16.7 3.1-23.1 8.8L128 160 80 160c-26.5 0-48 21.5-48 48l0 96c0 26.5 21.5 48 48 48z"],volumeXmark:[576,512,"M48 352l48 0 134.1 119.2c6.4 5.7 14.6 8.8 23.1 8.8 19.2 0 34.8-15.6 34.8-34.8l0-378.4c0-19.2-15.6-34.8-34.8-34.8-8.5 0-16.7 3.1-23.1 8.8L96 160 48 160c-26.5 0-48 21.5-48 48l0 96c0 26.5 21.5 48 48 48zM367 175c-9.4 9.4-9.4 24.6 0 33.9l47 47-47 47c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l47-47 47 47c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-47-47 47-47c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-47 47-47-47c-9.4-9.4-24.6-9.4-33.9 0z"],xmark:[384,512,"M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]},ia=Wi('<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path></path></svg>');function sa(t,e){et(e,!0);let i=br(e,"style",3,void 0);const s=Q("micrio"),r=jt(()=>"chevron-down"==e.name||"link-ext"==e.name),n=s.defaultSettings?.ui?.icons,a=jt(()=>n&&("zoom-in"==e.name?n.zoomIn:"zoom-out"==e.name?n.zoomOut:"maximize"==e.name?n.fullscreenEnter:"minimize"==e.name?n.fullscreenLeave:"close"==e.name?n.close:"arrow-right"==e.name?n.next:"arrow-left"==e.name?n.prev:"arrow-up"==e.name?n.up:"arrow-down"==e.name?n.down:"play"==e.name?n.play:"pause"==e.name?n.pause:"subtitles"==e.name?n.subtitles:"subtitles-off"==e.name?n.subtitlesOff:"volume-off"==e.name?n.muted:"volume-up"==e.name?n.unmuted:null)),o={play:ea.play,pause:ea.pause,close:ea.xmark,"play-filled":ea.playCircle,a11y:ea.globe,menu:ea.bars,"zoom-in":ea.plus,"zoom-out":ea.minus,maximize:ea.expand,minimize:ea.compress,"volume-off":ea.volumeXmark,"volume-up":ea.volumeHigh,subtitles:ea.closedCaptioning,"subtitles-off":ea.closedCaptioning,"arrow-left":ea.arrowLeft,"arrow-up":ea.arrowUp,"arrow-right":ea.arrowRight,"arrow-down":ea.arrowDown,video:ea.video,audio:ea.volumeHigh,image:ea.image,share:ea.share,error:ea.circleExclamation,"chevron-down":ea.chevronDown,link:ea.link,"link-ext":ea.externalLink,"ellipsis-vertical":ea.ellipsisVertical},h=jt(()=>o[e.name]);var c=Hi(),l=_e(c),d=t=>{var e=Hi();Ms(_e(e),()=>Ei(a),void 0,!0),Gi(t,e)},u=t=>{var e=ia();let s;var n=ke(e);q(e),Ye(()=>{ar(e,"viewBox",`0 0 ${Ei(h)[0]??""} ${Ei(h)[1]??""}`),s=qs(e,0,"svelte-fa micrio-icon",null,s,{small:Ei(r)}),Us(e,i()),ar(n,"d",Ei(h)[2])}),Gi(t,e)};vs(l,t=>{Ei(a)?t(d):Ei(h)&&t(u,1)}),Gi(t,c),it()}var ra=vt(void 0),na=()=>ra.set(void 0),aa=!1;ra.subscribe(t=>{t?aa||window.addEventListener("click",na):aa&&window.removeEventListener("click",na),aa=!!t});var oa=Bi('<a class="micrio-menu-action micrio-menu"><strong class="micrio-menu"> <!></strong></a>'),ha=Wi('<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="svelte-fa" style="height:1em;vertical-align:-.125em;margin-right:10px;"><path></path></svg>'),ca=Bi('<button class="micrio-menu-action micrio-menu" type="button"><!> <strong class="micrio-menu"> <!></strong></button>'),la=Bi('<div class="items micrio-menu"></div>'),da=Bi("<menu><!> <!></menu>");function ua(t,e){et(e,!0);const i=()=>xt(ra,"$opened",s),[s,r]=kt();let n=br(e,"menu",15),a=br(e,"originalId",3,null);const o=Q("micrio"),{events:h,state:c,_lang:l}=o;let d=ne(void 0);const u=jt(()=>{return t=n(),e=xt(l,"$_lang",s),t.i18n?.[e]??t;var t,e});function m(t){n().link||t.preventDefault(),n().action&&n().action();const i=!!(Ei(p)||n().action||n().link);ra.set(i?void 0:n()),i&&e.onclose?.()}ps(()=>{Ei(u)?.title||1!=n().children?.length||n(n().children[0]),n().action||(n().markerId?n(n().action=()=>{a()&&o.$current?.id!=a()&&o.open(a()),o.$current?.state.marker.set(n().markerId)},!0):(Ei(u)?.content||Ei(u)?.embed||n().image)&&n(n().action=()=>{h.dispatch("page-open",n()),c.popover.set({contentPage:n()})},!0)),n(n()._button=Ei(d),!0)});const g=t=>t==i()||!!t.children?.some(g),p=jt(()=>i()&&g(n()));var f=da();let v;var w=ke(f),y=t=>{var e=oa(),i=ke(e),s=ke(i),r=Me(s);{let t=jt(()=>n().linkTargetBlank?"link-ext":"link");sa(r,{style:"opacity:.75",get name(){return Ei(t)}})}q(i),q(e),Ye(()=>{ar(e,"href",n().link),ar(e,"target",n().linkTargetBlank?"_blank":void 0),ns(s,`${Ei(u)?.title??"(Unknown)"??""} `)}),Ri("click",e,m),Gi(t,e)},b=t=>{var e=ca(),i=ke(e),s=t=>{var e=ha(),i=ke(e);q(e),Ye(()=>{ar(e,"viewBox",`0 0 ${n().icon[0]??""} ${n().icon[1]??""}`),ar(i,"d",n().icon[2])}),Gi(t,e)};vs(i,t=>{n().icon&&t(s)});var r=Me(i,2),a=ke(r),o=Me(a),h=t=>{sa(t,{name:"chevron-down"})};vs(o,t=>{n().children&&n().children.length&&t(h)}),q(r),q(e),fr(e,t=>oe(d,t),()=>Ei(d)),Ye(()=>ns(a,`${Ei(u)?.title??"(Unknown)"??""} `)),Ri("click",e,m),Gi(t,e)};vs(w,t=>{n().link?t(y):t(b,-1)});var x=Me(w,2),T=t=>{var e=la();bs(e,23,()=>n().children,(t,e)=>e+t.id,(t,e)=>{ua(t,{get menu(){return Ei(e)},get originalId(){return a()},onclose:na})}),q(e),Gi(t,e)};vs(x,t=>{n().children&&n().children.length&&t(T)}),q(f),Ye(t=>{ar(f,"data-title",t),v=qs(f,1,"micrio-menu",null,v,{opened:Ei(p)})},[()=>Ei(u)?.title?.toLowerCase()]),Gi(t,f),it(),r()}Xi(["click"]);var ma=Bi('<img alt="Icon" class="micrio-button"/>'),ga=Bi("<!><!>",1);function pa(t,e){et(e,!0);let i=br(e,"type",3,void 0),s=br(e,"icon",3,void 0),r=br(e,"title",3,null),n=br(e,"disabled",3,!1),a=br(e,"active",3,!1),o=br(e,"className",3,""),h=br(e,"href",3,void 0),c=br(e,"blankTarget",3,!1),l=br(e,"noClick",3,!1);var d=Hi();Os(_e(d),()=>h()?"a":"button",!1,(t,d)=>{var u=t=>e.onclick?.(t),m=t=>e.onfocus?.(t),g=t=>e.onpointerdown?.(t);hr(t,()=>({href:h(),target:c()?"_blank":void 0,disabled:!!n()||void 0,title:r(),"aria-label":r(),role:h()?void 0:"button",tabindex:h()?void 0:0,class:`micrio-button ${i()??""??""} ${o()??""}`,onclick:u,onfocus:m,onpointerdown:g,[js]:{active:a(),"no-click":l()}}),void 0,void 0,void 0,"micrio-button");var p=ga(),v=_e(p),w=t=>{sa(t,{get name(){return i()}})},y=t=>{var e=ma();Ye(()=>ar(e,"src",s().src)),Gi(t,e)};vs(v,t=>{i()?t(w):s()&&t(y,1)}),gs(Me(v),()=>e.children??f),Gi(d,p)}),Gi(t,d),it()}var fa=Bi("<menu><!> <!> <!></menu> <!>",1);function va(t,e){et(e,!0);const i=()=>xt(c,"$current",r),s=()=>xt(l,"$_lang",r),[r,n]=kt();let a=ne(void 0);const o=Q("micrio"),{state:h,current:c,_lang:l,spaceData:d}=o,{tour:u,marker:m,popover:g}=h;let p=ne(!1),f=ne(!1);const v=i().id;let w=ne(void 0),y=ne(window.innerWidth<=500);const b=()=>oe(y,window.innerWidth<=500),x=()=>{Ei(y)&&oe(p,!1)},T=jt(()=>!!xt(u,"$tour",r)||!!xt(m,"$marker",r)||!!xt(g,"$popover",r)),k=jt(()=>(Ei(a)?.markerTours??[]).concat(d?.markerTours??[])),_=jt(()=>Ei(k)?.length>0),M=jt(()=>Ei(a)?.tours&&Ei(a)?.tours?.length>0),S=jt(()=>Ei(_)&&Ei(M)),E=jt(()=>!(Ei(w)?.length||Ei(_)||Ei(M))),I=[],A=(t,e)=>("title"in t?t.title:t.i18n?.[e]?.title)??"(Untitled)";ps(()=>{const t=o.current.subscribe(t=>{if(t){for(;I.length;)I.shift()?.();en(t.info).then(()=>oe(f,!t.$settings.noLogo)),I.push(t.data.subscribe(t=>{oe(a,t,!0),Si().then(()=>{if(!t?.pages)return;Ei(w)||oe(w,t.pages?.filter(t=>!t.id?.startsWith("_")),!0);const e=t.pages?.filter(t=>t.id?.startsWith("_"));e.length&&oe(w,[...Ei(w)?.filter(t=>!t.id?.startsWith("_"))??[],...e],!0)})}))}});return window.addEventListener("resize",b),()=>{for(window.removeEventListener("resize",b);I.length;)I.shift()?.();t()}});var L=Hi(),P=_e(L),$=t=>{var e=fa(),n=_e(e);let h;var c=ke(n),l=t=>{var e=Hi();bs(_e(e),17,()=>Ei(w),t=>t.id,(t,e)=>{ua(t,{get menu(){return Ei(e)},get originalId(){return v},onclose:x})}),Gi(t,e)};vs(c,t=>{Ei(w)&&t(l)});var d=Me(c,2),m=t=>{{let e=jt(()=>({id:Hr(),i18n:{[s()]:{title:Ei(S)?"Marker tours":"Tours"}},children:Ei(k).map(t=>({id:Hr(),i18n:{[s()]:{title:A(t,s())}},action:()=>{t.initialStep=0,u.set(t)}}))}));ua(t,{onclose:x,get menu(){return Ei(e)}})}};vs(d,t=>{Ei(_)&&t(m)});var g=Me(d,2),b=t=>{{let e=jt(()=>({id:Hr(),i18n:{[s()]:{title:Ei(S)?"Video tours":"Tours"}},children:Ei(a)&&Ei(a).tours?Ei(a).tours.map(t=>({id:Hr(),i18n:{[s()]:{title:A(t,s())}},action:()=>{i()&&i().id!=v&&o.open(v),u.set(t)}})):[]}));ua(t,{onclose:x,get menu(){return Ei(e)}})}};vs(g,t=>{Ei(M)&&t(b)}),q(n);var E=Me(n,2),I=t=>{{let e=jt(()=>Ei(p)?"close":"ellipsis-vertical"),i=jt(()=>"toggle transparent"+(Ei(f)?" indent":""));pa(t,{get title(){return xt(Jn,"$i18n",r).menuToggle},get type(){return Ei(e)},get className(){return Ei(i)},onclick:()=>oe(p,!Ei(p))})}};vs(E,t=>{Ei(y)&&t(I)}),Ye(()=>h=qs(n,1,"micrio-toolbar micrio-toolbar",null,h,{shown:!Ei(T)&&Ei(p),indent:Ei(f)})),Ds(3,n,()=>qn,()=>({duration:200})),Gi(t,e)};vs(P,t=>{Ei(E)||Ei(T)||t($)}),Gi(t,L),it(),n()}var wa=Bi("<canvas></canvas>");function ya(t,e){et(e,!0);const[i,s]=kt(),r=Q("micrio"),{current:n}=r,a=Li(()=>e.image).$info,o=Li(()=>e.image).camera,h=Li(()=>e.image).$settings,c=h.minimapWidth??200,l=h.minimapHeight??160,d=!h.alwaysShowMinimap,u=!!h.noControls,m=a.width/a.height,g=c/m>l?Math.round(l*m):c,p=c/m<=l?Math.round(c/m):l;let f,v=ne(void 0),w=ne(!1),y=ne(ue(!a.is360&&o.isZoomedOut()));function b(t){if(!t||!f)return;I();const i=rn.toCenterJSON(t);if(f.clearRect(0,0,g,p),e.image.thumbSrc?(f.globalCompositeOperation="source-over",f.fillStyle="rgba(0,0,0,.5)",f.fillRect(0,0,g,p),f.globalAlpha=1,f.globalCompositeOperation="destination-out"):(f.fillStyle="rgba(0,0,0,.5)",f.fillRect(0,0,g,p)),f.beginPath(),f.fillStyle="white",a.is360){const e=function(t){const e=[];let{centerX:i,centerY:s,width:r,height:n}=rn.toCenterJSON(t);i=(i%1+1)%1;let a=i-r/2,o=i+r/2;const h=Math.max(0,s-n/2),c=Math.min(1,s+n/2);return a<0?(e.push({x:a+1,y:h,width:1-(a+1),height:c-h}),e.push({x:0,y:h,width:o,height:c-h})):o>1?(e.push({x:a,y:h,width:1-a,height:c-h}),e.push({x:0,y:h,width:o-1,height:c-h})):e.push({x:a,y:h,width:o-a,height:c-h}),e}(t);for(const t of e)f.rect(Math.floor(t.x*g),Math.floor(t.y*p),Math.ceil(t.width*g),Math.ceil(t.height*p))}else oe(y,o.isZoomedOut(),!0),f.rect(Math.floor((i.centerX-i.width/2)*g),Math.floor((i.centerY-i.height/2)*p),Math.ceil(i.width*g),Math.ceil(i.height*p));e.image.thumbSrc&&(f.fill(),f.globalCompositeOperation="source-over"),f.stroke()}const x=-1!=navigator.userAgent.indexOf("Firefox");let T,k=ne(!1);let _,M=ne(void 0);function S(t){if(T){const e=Math.max(0,Math.min(1,(t.clientX-T.left)/T.width)),i=Math.max(0,Math.min(1,(t.clientY-T.top)/T.height));if(Ei(M)){const t=[e-Ei(M).width/2,i-Ei(M).height/2,Ei(M).width,Ei(M).height];o.setView(t)}else o.setCoo(e,i)}}function E(){window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",E),oe(k,!1),oe(M,void 0)}function I(){oe(w,!1),clearTimeout(_),_=setTimeout(()=>oe(w,!0),2500)}const A=-Li(()=>e.image).camera.rotationY/(2*Math.PI),L=self.crossOriginIsolated;let P=ne(ue(L?void 0:Li(()=>e.image).thumbSrc));const $={passive:!0};let C=ne(!1);ps(()=>{let t;f=Ei(v).getContext("2d"),f&&(f.lineWidth=1,f.strokeStyle="white"),L&&e.image.thumbSrc&&fetch(e.image.thumbSrc).then(t=>t.blob()).then(e=>oe(P,t=URL.createObjectURL(e),!0)),r.canvas.element.addEventListener("mousemove",I,$);const i=e.image.state.view.subscribe(b);return setTimeout(()=>oe(C,!0),10),()=>{t&&URL.revokeObjectURL(t),r.canvas.element.removeEventListener("mousemove",I,$),E(),i()}});const D=jt(()=>Ei(P)?`background-image: url('${Ei(P)}')`+(0!=A?`;background-position-x:${g*A}px`:""):null);var z=wa();let O;fr(z,t=>oe(v,t),()=>Ei(v)),Ye(()=>{ar(z,"width",g),ar(z,"height",p),Us(z,Ei(D)),O=qs(z,1,"micrio-minimap",null,O,{hidden:!Ei(C)||xt(n,"$current",i)!=e.image||d&&(Ei(y)||Ei(w)),dragging:Ei(k),controls:!u})}),Oi("wheel",z,function(t){o.zoom(t.deltaY*(x?50:1))}),Ri("mousedown",z,function(t){if(0!=t.button)return;window.addEventListener("mousemove",S),window.addEventListener("mouseup",E),T=Ei(v).getClientRects()[0];const e=o.getView();e&&oe(M,{width:e[2],height:e[3]},!0),S(t),oe(k,!0)}),Gi(t,z),it(),s()}Xi(["mousedown"]);var ba=Bi("<div><!></div>");function xa(t,e){let i=br(e,"className",3,"");var s=ba();gs(ke(s),()=>e.children??f),q(s),Ye(()=>qs(s,1,Vs(i()),"micrio-button-group")),Gi(t,s)}function Ta(t,e){et(e,!0);const[i,s]=kt(),r="requestFullscreen"in Li(()=>e.el),n="webkitRequestFullscreen"in Li(()=>e.el),a=Q("micrio"),o=()=>r?document.fullscreenElement:document.webkitFullscreenElement??null;let h=ne(o()===Li(()=>e.el));const c=r||n&&!o(),l=()=>new Promise(t=>setTimeout(t,500));let d;function u(){Ei(h)?async function(){r?(await document.exitFullscreen().then(l),d&&d instanceof HTMLElement&&d.requestFullscreen(),d=void 0):"webkitExitFullscreen"in document&&document.webkitExitFullscreen()}():async function(){r?(d=o(),Jr.safari&&d&&await document.exitFullscreen().then(l),e.el.requestFullscreen()):"webkitRequestFullscreen"in e.el&&e.el.webkitRequestFullscreen()}()}const m=Li(()=>e.el)==a&&!a.events.scrollHooked,g=()=>{oe(h,o()===e.el),m&&(Ei(h)?a.events.hookScroll():a.events.unhookScroll())};c&&ps(()=>{const t=r?"fullscreenchange":"webkitfullscreenchange";return document.addEventListener(t,g),()=>document.removeEventListener(t,g)});var p=Hi(),f=_e(p),v=t=>{{let e=jt(()=>Ei(h)?"minimize":"maximize");pa(t,{get type(){return Ei(e)},get title(){return xt(Jn,"$i18n",i).fullscreenToggle},onclick:u})}};vs(f,t=>{c&&t(v)}),Gi(t,p),it(),s()}var ka=Bi("<!> <!>",1);function _a(t,e){et(e,!0);const i=()=>xt(Jn,"$i18n",s),[s,r]=kt();let n=br(e,"image",15,void 0);const a=Q("micrio");let o=ne(!1),h=ne(!1),c=ne(!1),l=ne(!1);const d=()=>{a.events.clicked=!0},u=()=>{d(),n()?.camera.zoomIn().then(()=>a.events.clicked=!1)},m=()=>{d(),n()?.camera.zoomOut().then(()=>a.events.clicked=!1)};function g(){oe(o,n()?.camera.isZoomedIn()??!0,!0),oe(h,n()?.camera.isZoomedOut(!0)??!0,!0);const t=n()?.camera.getMinScale()??0;oe(c,t>1&&t>(n()?.$settings.zoomLimit??1),!0)}let p,f,v;const w=t=>{p&&(p(),p=void 0),n(t),t?p=t.state.view.subscribe(g):g()};ps(()=>(n()?p=n().state.view.subscribe(g):f=a.current.subscribe(t=>{if(v&&(v(),v=void 0),p&&(p(),p=void 0),oe(l,!0),!t)return n(void 0),void oe(l,!1);en(t.info).then(()=>Si()).then(()=>{t.album?.currentImage?v=t.album.currentImage.subscribe(w):w(t),oe(l,!1)})}),()=>{f&&f(),v&&v(),p&&p()}));var y=Hi(),b=_e(y),x=t=>{var e=ka(),s=_e(e);{let t=jt(()=>Ei(l)||Ei(o));pa(s,{type:"zoom-in",get title(){return i().zoomIn},get disabled(){return Ei(t)},onclick:u})}var r=Me(s,2);{let t=jt(()=>Ei(l)||Ei(h));pa(r,{type:"zoom-out",get title(){return i().zoomOut},get disabled(){return Ei(t)},onclick:m})}Gi(t,e)};vs(b,t=>{Ei(c)||Ei(o)&&Ei(h)||t(x)}),Gi(t,y),it(),r()}var Ma=Bi('<menu class="popout micrio-controls"><!> <!></menu>'),Sa=Bi("<!> <!> <!>",1),Ea=Bi("<!> <!>",1),Ia=Bi("<aside><!></aside>"),Aa=Bi("<aside><!> <!></aside> <!>",1);function La(t,e){et(e,!0);const i=()=>xt(m,"$current",c),s=()=>xt(Ei(k),"$info",c),r=()=>xt(f,"$_lang",c),n=()=>xt(v,"$tour",c),a=()=>xt(b,"$zoom",c),o=()=>xt(p,"$isMuted",c),h=()=>xt(Jn,"$i18n",c),[c,l]=kt();let d=br(e,"hasAudio",3,!1);const u=ue(Q("micrio")),{current:m,state:g,isMuted:p,_lang:f}=u,{tour:v,popup:w}=g,{controls:y,zoom:b,hidden:x,hover:T}=u.state.ui,k=jt(()=>i()?.info),_=jt(()=>s()&&i()?i().isV5?Object.keys(s().revision??{[r()]:0}):("cultures"in s()?s().cultures:"")?.split(",")??[]:[]),M=jt(()=>n()&&"steps"in n()&&n().isSerialTour);function S(){if(navigator.share&&i()?.$info){const t=i().$data?i().$data?.i18n?i().$data.i18n[r()]:i().$data:void 0;navigator.share({title:i().$info?.title,text:t?.description||`${i().$info.width} x ${i().$info.height} | Micrio`,url:location.href})}}let E=ne(null),I=ne(!1);function A(t){const e=t.detail;oe(I,u.canvas.viewport.portrait,!0),e.opts.isPassive||oe(E,e,!0)}function L(){oe(E,null)}let P=ne(!1),$=ne(!1),C=ne(!1);function D(t){b.set(!t.noZoom),y.set(!t.noControls),oe(P,!!t.ui?.controls?.cultureSwitch),oe($,!!t.social),oe(C,!!t.fullscreen)}i()&&D(i().$settings),ps(()=>{let t;u.addEventListener("splitscreen-start",A),u.addEventListener("splitscreen-stop",L);const e=u.current.subscribe(e=>{e&&en(e.info).then(i=>{!i||n()&&"steps"in n()||(t?.(),t=e.settings.subscribe(D))})});return()=>{u.removeEventListener("splitscreen-start",A),u.removeEventListener("splitscreen-stop",L),t?.(),e()}});const z=jt(()=>"micrioAudioContext"in window||d()),O=jt(()=>Ei(P)&&Ei(_).length>1),R=jt(()=>Ei($)&&"share"in navigator),X=jt(()=>Ei(C)&&!Ei(M)),F=jt(()=>xt(y,"$controls",c)&&(Ei(z)||Ei(O)||Ei(R)||a()||Ei(X))),V=jt(()=>xt(w,"$popup",c)&&u.canvas.$isMobile);var Y=Hi(),N=_e(Y),B=t=>{var e=Aa(),i=_e(e);let s;var n=ke(i),l=t=>{var e=Sa(),i=_e(e),s=t=>{{let e=jt(()=>o()?"volume-off":"volume-up"),i=jt(()=>o()?h().audioUnmute:h().audioMute);pa(t,{get type(){return Ei(e)},get title(){return Ei(i)},onclick:()=>p.set(!o())})}};vs(i,t=>{Ei(z)&&t(s)});var n=Me(i,2),a=t=>{var e=Ma(),i=ke(e);pa(i,{get title(){return h().switchLanguage},type:"a11y"}),bs(Me(i,2),17,()=>Ei(_),ws,(t,e)=>{{let i=jt(()=>Qn?.of(Ei(e))??Ei(e)),s=jt(()=>Ei(e)==r());pa(t,{onclick:()=>u.lang=Ei(e),get title(){return Ei(i)},get active(){return Ei(s)},children:(t,i)=>{W();var s=Ui();Ye(t=>ns(s,t),[()=>Ei(e).toUpperCase()]),Gi(t,s)},$$slots:{default:!0}})}}),q(e),Gi(t,e)};vs(n,t=>{Ei(O)&&t(a)});var c=Me(n,2),l=t=>{pa(t,{type:"share",get title(){return h().share},onclick:S})};vs(c,t=>{Ei(R)&&t(l)}),Gi(t,e)};vs(n,t=>{Ei(V)||t(l)}),xa(Me(n,2),{children:(t,e)=>{var i=Ea(),s=_e(i),r=t=>{var e=Hi(),i=_e(e),s=t=>{_a(t,{get image(){return Ei(E)}})},r=t=>{_a(t,{})};vs(i,t=>{Ei(E)?t(s):t(r,-1)}),Gi(t,e)};vs(s,t=>{a()&&!Ei(V)&&t(r)});var n=Me(s,2),o=t=>{Ta(t,{get el(){return u}})};vs(n,t=>{Ei(X)&&t(o)}),Gi(t,i)},$$slots:{default:!0}}),q(i);var d=Me(i,2),m=t=>{var e=Ia();let i;xa(ke(e),{children:(t,e)=>{_a(t,{})},$$slots:{default:!0}}),q(e),Ye(()=>i=qs(e,1,"primary micrio-controls",null,i,{portrait:Ei(I)})),Ds(3,e,()=>qn),Gi(t,e)};vs(d,t=>{a()&&Ei(E)&&t(m)}),Ye(()=>s=qs(i,1,"micrio-controls",null,s,{hidden:xt(x,"$hidden",c)&&!xt(T,"$hover",c)})),Ri("pointerover",i,()=>T.set(!0)),Ri("pointerout",i,t=>{t.currentTarget.contains(t.relatedTarget)||T.set(!1)}),Ri("focusin",i,()=>T.set(!0)),Ri("focusout",i,t=>{t.currentTarget.contains(t.relatedTarget)||T.set(!1)}),Gi(t,e)};vs(N,t=>{Ei(F)&&t(B)}),Gi(t,Y),it(),l()}Xi(["pointerover","pointerout","focusin","focusout"]);var Pa=class{constructor(t,e){this.image=t,this.data=e,this.timeline=[],this._paused=!0,this.playing=!1,this.wasPaused=!1,this.unhookEvents=!1,this.micrio=t.engine.micrio;const i="timeline"in e?e:e.i18n?.[wt(this.micrio._lang)]??void 0;if(!i)throw new Error("No valid content for video tour!");this.content=i,this.unhookEvents=!e.keepInteraction&&this.micrio.events.$enabled,e.instance=this,this.read(),this.micrio.events.dispatch("videotour-start",this.data)}destroy(){this.unhookEvents&&this.micrio.events.enabled.set(!0),this.playing&&(this.image.camera.stop(),this.micrio.removeAttribute("data-videotour-playing"),this.micrio.events.dispatch("videotour-stop",this.data),this.playing=!1,delete this.startedAt,delete this.data.instance,this.startAt=void 0,clearTimeout(this._to))}read(){const t=this.data.i18n?1:this.content.duration,e=this.content.timeline;this.timeline.length=0;for(let i=0;i<e.length;i++){const s=e[i],r=e[i-1],n=r?r.end*t:0;this.timeline.push({view:this.data.isLegacy?rn.fromLegacy(s.rect):s.rect,start:1e3*n,duration:1e3*(s.start*t-n),pauseDuration:(s.end-s.start)*t*1e3})}this.startedAt&&!this.playing&&(this.progress=this.currentTime)}get duration(){return Number(this.content.duration)}set duration(t){this.content.duration=t}get paused(){return this._paused}get ended(){return this.currentTime>=this.duration}get currentTime(){return(this.pausedAt?this.pausedAt:this.startedAt?Date.now()-this.startedAt:0)/1e3}set currentTime(t){this.setProgress(t/this.content.duration)}get progress(){return this.currentTime/this.content.duration}set progress(t){this.setProgress(t)}play(){this.startedPlaying(),this.wasPaused=!1,this.pausedAt?(this.startedAt=Date.now()-this.pausedAt,this._paused=!1,this.gotoTime(this.pausedAt),this.pausedAt=void 0):this.playing||(this.startedAt=Date.now(),void 0===this.startAt?this.gotoStep(0,0):this.gotoTime(this.duration*this.startAt*1e3),this.startAt=void 0),this._paused=!1,this.playing=!0}pause(){this._paused||null==this.currentIndex||null==this.startedAt||(this._paused=!0,this.stoppedPlaying(),clearTimeout(this._to),this.currentIndex>=0&&this.image.camera.stop(),this.ended?this.reset():this.pausedAt=Date.now()-this.startedAt)}reset(){this.stoppedPlaying(),this.pausedAt=void 0,this.playing=!1,this.read()}gotoStep(t,e){if(null==this.startedAt)return;if(clearTimeout(this._to),!this.timeline[t]){if(!this.paused||!this.wasPaused){const t=Math.max(0,Math.round(1e3*this.duration-(Date.now()-this.startedAt)));this._to=setTimeout(()=>this.pause(),t)}return}const i=this.timeline[t],s=Math.round(i.start-(Date.now()-this.startedAt));this.currentIndex=t,this.image.camera.stop(),s>0?this._paused||(this._to=setTimeout(()=>this.startAni(e),s)):this.startAni(e)}nextStep(){null!=this.currentIndex&&this.gotoStep(this.currentIndex+1)}getView(t){return this.timeline[t]?.view}startAni(t=0){if(null==this.currentIndex||isNaN(t))return;const e=this.timeline[this.currentIndex];if(null==e)return;const i=rn.toCenterJSON(e.view),s=this.getView(this.currentIndex-1),r=s?rn.toCenterJSON(s):void 0,n=this.image.opts?.area;if(this.wasPaused&&r){const e=this.micrio.engine.ease(t),s={centerX:r.centerX*(1-e)+i.centerX*e,centerY:r.centerY*(1-e)+i.centerY*e,width:r.width*(1-e)+i.width*e,height:r.height*(1-e)+i.height*e};this.image.camera.setView([s.centerX-s.width/2,s.centerY-s.height/2,s.width,s.height],{noLimit:!0,area:n}),this.nextStep()}else this.image.camera.flyToView(e.view,{duration:e.duration,progress:t,prevView:r?[r.centerX-r.width/2,r.centerY-r.height/2,r.width,r.height]:void 0,area:n}).then(()=>{null!=this.currentIndex&&e==this.timeline[this.currentIndex]&&this.nextStep()}).catch(()=>{})}startedPlaying(){this.micrio.setAttribute("data-videotour-playing",""),this.micrio.events.dispatch("videotour-play"),this.unhookEvents&&this.micrio.events.enabled.set(!1)}stoppedPlaying(){this.micrio.removeAttribute("data-videotour-playing"),this.micrio.events.dispatch("videotour-pause"),this.unhookEvents&&this.micrio.events.enabled.set(!0)}setProgress(t){t=Math.max(0,Math.min(1,t)),this.wasPaused=!!this.paused||!this.playing,this.pause(),this.wasPaused||(this._paused=!1,this.startedPlaying());const e=this.duration*t*1e3;this.pausedAt=e,this.gotoTime(e),this.wasPaused?this.pause():(this.pausedAt=void 0,this._paused=!1)}gotoTime(t){let e=null,i=0;for(;i<this.timeline.length&&!(this.timeline[i].start>t);i++)e=this.timeline[i];if(i--,e||!(i>0))if(e){this.image.camera.stop();const s=e.duration>0?(t-e.start)/e.duration:0;this.startedAt=Date.now()-e.start-e.duration*s,isNaN(this.startedAt)&&(this.startedAt=Date.now()-t),s>1?(this.gotoStep(i+1),null!=e.view&&this.image.camera.setView(e.view,{noLimit:!0})):(i>0&&this.image.camera.setView(this.timeline[i-1].view,{noLimit:!0}),this.gotoStep(i,s))}else this.timeline.length&&this.image.camera.stop(),this.paused||this.gotoStep(0)}};window.MicrioVideoTour=Pa;var $a={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5},Ca=class{constructor(t,e,i={}){this.frame=t,this.config=e,this.callbacks=i,this.requiresTimeTick=!0,this.destroyed=!1}async initialize(){if("YT"in window||await tn("https://r2.micr.io/youtube.js","onYouTubeIframeAPIReady"),!("YT"in window))throw new Error("Failed to load YouTube API");return new Promise((t,e)=>{this.player=new window.YT.Player(this.frame,{host:Xn,width:this.config.width.toString(),height:this.config.height.toString(),playerVars:{controls:0},events:{onError:()=>{this.callbacks.onError?.(new Error("YouTube player error")),e(new Error("YouTube player error"))},onReady:()=>{this.destroyed?e(new Error("Player destroyed during initialization")):(this.callbacks.onReady?.(),this.callbacks.onDurationChange?.(this.player.getDuration()),t())},onStateChange:t=>this.handleStateChange(t.data)}})})}handleStateChange(t){switch(t){case $a.UNSTARTED:this.callbacks.onBlocked?.(),this.callbacks.onPause?.();break;case $a.ENDED:this.callbacks.onEnded?.();break;case $a.PLAYING:this.callbacks.onPlay?.(),this.callbacks.onSeeked?.();break;case $a.PAUSED:this.callbacks.onPause?.();break;case $a.BUFFERING:this.callbacks.onBuffering?.(),this.callbacks.onSeeking?.()}}async play(){this.player?.playVideo()}pause(){this.destroyed||this.player?.pauseVideo?.()}async getCurrentTime(){return this.player?.getCurrentTime?.()??0}setCurrentTime(t){this.callbacks.onSeeking?.(),this.player?.seekTo?.(t)}async getDuration(){return this.player?.getDuration?.()??0}async isPaused(){if(!this.player)return!0;const t=this.player.getPlayerState?.();return void 0===t||[$a.UNSTARTED,$a.ENDED,$a.PAUSED].includes(t)}setMuted(t){t?this.player?.mute?.():this.player?.unMute?.()}setVolume(t){}destroy(){this.destroyed=!0,this.player?.destroy?.(),this.player=void 0}},Da=class{constructor(t,e,i={}){this.frame=t,this.config=e,this.callbacks=i,this.requiresTimeTick=!1,this.destroyed=!1}async initialize(){if("Vimeo"in window||await tn("https://r2.micr.io/vimeo.min.js"),!("Vimeo"in window))throw new Error("Failed to load Vimeo API");return new Promise((t,e)=>{this.player=new window.Vimeo.Player(this.frame,{width:this.config.width.toString(),height:this.config.height.toString(),title:!1,autoplay:!1});const i=this.player;i.on("error",()=>{this.callbacks.onError?.(new Error("Vimeo player error")),e(new Error("Vimeo player error"))}),i.on("loaded",()=>{this.destroyed?e(new Error("Player destroyed during initialization")):i.getVolume().then(()=>{this.callbacks.onReady?.(),t()})}),i.on("play",()=>{this.callbacks.onPlay?.(),this.callbacks.onSeeked?.()}),i.on("bufferstart",()=>{this.callbacks.onBuffering?.(),this.callbacks.onSeeking?.()}),i.on("seeked",()=>{this.callbacks.onSeeked?.()}),i.on("pause",()=>{this.callbacks.onPause?.()}),i.on("timeupdate",t=>{t&&(this.callbacks.onDurationChange?.(t.duration),this.callbacks.onTimeUpdate?.(t.seconds))}),i.on("ended",()=>{this.callbacks.onEnded?.()})})}async play(){this.player?.play()}pause(){this.player?.pause()}async getCurrentTime(){return await(this.player?.getCurrentTime?.())??0}setCurrentTime(t){this.player?.setCurrentTime?.(t)}async getDuration(){return await(this.player?.getDuration?.())??0}async isPaused(){return await(this.player?.getPaused?.())??!0}setMuted(t){this.player?.setVolume?.(t?0:1)}setVolume(t){this.player?.setVolume?.(Math.max(0,Math.min(1,t)))}destroy(){if(this.destroyed=!0,this.player){for(const t of["error","loaded","play","bufferstart","seeked","pause","volumechange","timeupdate","ended"])this.player.off(t);this.player.destroy(),this.player=void 0}}},za=class{constructor(t,e={}){this.element=t,this.callbacks=e,this.requiresTimeTick=!1,this.attachEventListeners()}attachEventListeners(){const t=this.element,e=this.callbacks;e.onPlay&&t.addEventListener("play",e.onPlay),e.onPause&&t.addEventListener("pause",e.onPause),e.onEnded&&t.addEventListener("ended",e.onEnded),e.onSeeking&&t.addEventListener("seeking",e.onSeeking),e.onSeeked&&t.addEventListener("seeked",e.onSeeked),e.onTimeUpdate&&t.addEventListener("timeupdate",()=>e.onTimeUpdate?.(t.currentTime)),e.onDurationChange&&t.addEventListener("durationchange",()=>e.onDurationChange?.(t.duration)),e.onError&&t.addEventListener("error",()=>e.onError?.(new Error("Media playback error"))),e.onReady&&t.addEventListener("canplay",e.onReady)}async play(){try{await this.element.play()}catch(t){throw t instanceof Error&&!/pause\(\)/.test(t.message)&&this.callbacks.onBlocked?.(),t}}pause(){this.element.pause()}async getCurrentTime(){return this.element.currentTime}setCurrentTime(t){this.element.currentTime=t}async getDuration(){return this.element.duration}async isPaused(){return this.element.paused}setMuted(t){this.element.muted=t}setVolume(t){this.element.volume=Math.max(0,Math.min(1,t))}destroy(){const t=this.element,e=this.callbacks;e.onPlay&&t.removeEventListener("play",e.onPlay),e.onPause&&t.removeEventListener("pause",e.onPause),e.onEnded&&t.removeEventListener("ended",e.onEnded),e.onSeeking&&t.removeEventListener("seeking",e.onSeeking),e.onSeeked&&t.removeEventListener("seeked",e.onSeeked)}},Oa=class{constructor(t,e,i={}){this.element=t,this.hlsSrc=e,this.callbacks=i,this.requiresTimeTick=!1,this.destroyed=!1}async initialize(){if("Hls"in window||await tn("https://r2.micr.io/hls-1.6.15.min.js",void 0,"Hls"in window?{}:void 0),!("Hls"in window))throw new Error("Failed to load HLS.js");if(this.destroyed)throw new Error("Adapter destroyed during initialization");const t=new window.Hls({abrEwmaDefaultEstimate:1e7,abrEwmaDefaultEstimateMax:5e7});this.hls=t,t.loadSource(this.hlsSrc),t.attachMedia(this.element),this.html5Adapter=new za(this.element,this.callbacks),this.callbacks.onReady?.()}async play(){return this.html5Adapter?.play()}pause(){this.html5Adapter?.pause()}async getCurrentTime(){return this.html5Adapter?.getCurrentTime()??Promise.resolve(0)}setCurrentTime(t){this.html5Adapter?.setCurrentTime(t)}async getDuration(){return this.html5Adapter?.getDuration()??Promise.resolve(0)}async isPaused(){return this.html5Adapter?.isPaused()??Promise.resolve(!0)}setMuted(t){this.html5Adapter?.setMuted(t)}setVolume(t){this.html5Adapter?.setVolume(t)}destroy(){this.destroyed=!0,this.html5Adapter?.destroy(),this.hls?.destroy(),this.hls=void 0,this.html5Adapter=void 0}},Ra="micrio-captions-disable",Xa=vt("1"!=localStorage.getItem(Ra));Xa.subscribe(t=>{t?localStorage.removeItem(Ra):localStorage.setItem(Ra,"1")});var Fa=Bi('<div><p class="micrio-subtitles"> </p></div>');function Va(t,e){et(e,!0);const[i,s]=kt();let r=br(e,"raised",3,!1);const n=ue([]);fetch(Li(()=>e.src)).then(t=>t.text()).then(t=>{const e=t.split("\n");for(let i=0;i<e.length;i++)if(/-->/.test(e[i])){let t=i+1;const s=[];for(;!e[t]&&t<e.length;)t++;for(;e[t]&&e[t].trim();)s.push(e[t++]);const[r,a]=e[i].split(" --\x3e ").map(t=>t.trim().replace(",",".").split(":").map(Number)).map(t=>3===t.length?3600*t[0]+60*t[1]+t[2]:2===t.length?60*t[0]+t[1]:0);n.push({start:r,end:a,data:s.join("\n")}),i+=s.length+1}}).catch(t=>console.error("Subtitles: fetch error:",t));const a=Q("micrio");let o=ne(0);const h=t=>oe(o,t.detail,!0);ps(()=>(a.addEventListener("timeupdate",h),()=>a.removeEventListener("timeupdate",h)));const c=jt(()=>n.filter(t=>t.start<=Ei(o)&&t.end>=Ei(o)));var l=Hi(),d=_e(l),u=t=>{var e=Hi();bs(_e(e),16,()=>Ei(c),t=>t,(t,e)=>{var i=Fa();let s;var n=ke(i),a=ke(n,!0);q(n),q(i),Ye(()=>{s=qs(i,1,"micrio-subtitles",null,s,{raised:r()}),ns(a,e.data)}),Ds(3,i,()=>qn),Gi(t,i)}),Gi(t,e)};vs(d,t=>{xt(Xa,"$captionsEnabled",i)&&t(u)}),Gi(t,l),it(),s()}var Ya=Bi('<div class="container micrio-progress-bar"><div class="bars micrio-progress-bar"><!></div> <div class="time micrio-progress-bar"> </div></div>');function Na(t,e){et(e,!0);let i=br(e,"ended",11,!1);var s=Ya(),r=ke(s);gs(ke(r),()=>e.children??f),q(r);var n=Me(r,2),a=ke(n,!0);q(n),q(s),Ye((t,e)=>{Us(s,t),ns(a,e)},[()=>`--progress: ${Math.round((e.currentTime??0)/e.duration*1e4)/100}%;--time: '${jr(e.currentTime??0)}';`,()=>jr(i()||!e.currentTime||e.currentTime<=0?e.duration:(e.currentTime??0)-e.duration)]),Ri("click",s,t=>t.stopPropagation()),Ri("keydown",s,t=>t.stopPropagation()),Gi(t,s),it()}Xi(["click","keydown"]);var Ba=Wi('<svg height="42" width="42" class="micrio-media-controls"><circle r="19" cx="21" cy="21" class="micrio-media-controls"></circle></svg>'),qa=Bi("<!> <!> <!>",1),Wa=Bi('<div class="bar active"></div>'),Ua=Bi('<aside class="micrio-media-controls"><!> <!></aside> <!>',1);Xi(["click","keydown","mousedown"]);var Ha=Bi("<iframe></iframe>"),Ga=Bi('<source type="video/mp4;codecs=hvc1"/>'),ja=Bi("<!> <source/>",1),Za=Bi('<video playsinline="" class="micrio-media"><!></video>',2),Ja=Bi("<audio></audio>"),Ka=Bi("<micr-io></micr-io>",2),Qa=Bi("<aside><!></aside>"),to=Bi('<figcaption class="micrio-media"></figcaption>'),eo=Bi('<div class="show-play micrio-media" role="button"><!></div>'),io=Bi('<figure><div role="button"><!> <!> <!></div> <!></figure> <!>',1);function so(t,e){et(e,!0);const i=()=>xt(R,"$_lang",s),[s,r]=kt(),n=Q("micrio");let a=br(e,"src",11,void 0),o=br(e,"volume",15,1),h=br(e,"width",3,640),c=br(e,"height",3,380),l=br(e,"frameScale",3,1),d=br(e,"autoplay",15,!1),u=br(e,"loop",3,!1),m=br(e,"loopDelay",3,void 0),g=br(e,"controls",15,!1),p=br(e,"title",3,void 0),f=br(e,"figcaption",3,null),v=br(e,"paused",15,!0),w=br(e,"forcePause",3,void 0),y=br(e,"seeking",15,!0),b=br(e,"duration",31,()=>-1),x=br(e,"currentTime",15),T=br(e,"is360",3,!1),k=br(e,"tour",3,null),_=br(e,"secondary",3,!1),M=br(e,"fullscreen",3,void 0),S=br(e,"className",3,null),E=br(e,"hasTransparentH265",3,!1),I=br(e,"noPlayOverlay",3,!1),A=br(e,"uuid",15,""),L=br(e,"image",19,()=>wt(n.current)),P=br(e,"destroying",3,void 0),$=br(e,"_media",15,void 0),C=ne(!1);A(A()+(a()??Li(()=>k())?.id));const D=Li(()=>L()).$info,{events:z,state:O,_lang:R}=n,X=Q("volume"),F=0==xt(X,"$mainVolume",s),Y=Q("srt"),N=Q("mediaPaused"),B=n.hasAttribute("data-native-frame"),W=function(t,e,i=!1,s=0){t=function(t){if(t)return/<iframe /.test(t)&&(t=t.replace(/^.* src="([^"]+)".*$/,"$1")),t.startsWith("video://")&&(t=t.replace("video:","https:")),t}(t);const r=t?.toLowerCase(),n={type:Cn.None,originalSrc:t,isCloudflare:!1};if(!t&&e)return n.type=Cn.VideoTour,n;if(!t||!r)return n;if(t.startsWith("cfvid://"))return n.isCloudflare=!0,n.cloudflareId=t.slice(8),n.hlsSrc=`https://videodelivery.net/${n.cloudflareId}/manifest/video.m3u8`,n.type=Cn.Video,n;if(r.endsWith(".mp3"))return n.type=Cn.Audio,n.src=t,n;if(r.endsWith(".mp4")||r.endsWith(".webm"))return n.type=Cn.Video,n.src=t,n;if(r.startsWith("micrio://"))return n.type=Cn.Micrio,n.micrioEmbed=t.slice(9).split(","),n;if(!i){const e=zn.exec(t);if(e?.[5]){if("playlist"!==e[5]){n.type=Cn.IFrame,n.frameType=Dn.YouTube,n.youtubeId=e[5];const i=Rn.test(t)?Number(t.replace(Rn,"$1")):s;return n.startTime=Math.round(i),n.src=`${Xn}/embed/${e[5]}?autoplay=0&enablejsapi=1&controls=0&start=${n.startTime}`,n}{const e=/list=([^&]+)/.exec(t);if(e?.[1])return n.type=Cn.IFrame,n.src=`${Xn}/embed/videoseries?list=${e[1]}`,n}}if(On.test(t)){const e=t.match(/\/(\d+)/);if(e?.[1]){n.type=Cn.IFrame,n.frameType=Dn.Vimeo,n.vimeoId=e[1],n.vimeoToken=t.slice(t.indexOf(e[1])+e[1].length+1).replace(/\?.*$/,"")||void 0;const i=Math.round(s);return n.src=`https://player.vimeo.com/video/${e[1]}?${n.vimeoToken?`h=${n.vimeoToken}&`:""}title=0&portrait=0&sidedock=0&byline=0&controls=0#t=${i}s`,n}}}return r.startsWith("http")?(n.type=Cn.IFrame,n.src=t,n):n}(a(),Li(()=>k()),B,x()??0),{type:U,frameType:H,isCloudflare:G,micrioEmbed:j,hlsSrc:Z}=W;let J,K=ne(ue(W.src??a()));U==Cn.Micrio&&v(!1),(U==Cn.Micrio||U==Cn.IFrame&&!H)&&g(!1);let tt=-1,st=ne(ue(H==Dn.YouTube||H==Dn.Vimeo));const rt=U==Cn.Audio&&Jr.iOS;let nt,at=ne(void 0);const ot=O.mediaState.get(A());ot&&(x(ot.currentTime),d(!v(ot.paused))),O.mediaState.set(A(),{get currentTime(){return x()??0},set currentTime(t){Et(t)},get paused(){return v()},set paused(t){t?yt():vt()}});let ht=ne(void 0);{const t=Li(()=>k());if(t){const e=new Pa(Li(()=>L()),t);null!=x()&&x()>0&&(e.currentTime=x()),U==Cn.VideoTour&&(b("duration"in t?Number(t.duration):t.i18n?.[i()]?.duration??0),o(NaN)),oe(ht,e,!0)}}const ct=Li(()=>k()&&!("steps"in k())?"subtitle"in k()?k().subtitle:k().i18n?.[n.lang]?.subtitle:void 0),lt=ct&&("fileUrl"in ct?ct.fileUrl:ct.src);let dt,ut=ne(!1),mt=ne(!1),gt=!1,pt=ne(!1);function ft(t){t&&"button"in t&&0!=t.button||(v()?vt():yt())}async function vt(t){if(!(t instanceof PointerEvent&&0!=t.button)&&(!gt||await async function(){return $()?$().paused:Ei(ht)?v():!!J&&J.isPaused()}())){switch(oe(mt,!1),b()>0&&null!=x()&&x()>=b()&&x(0),!_()&&lt&&Y.set(lt),U){case Cn.VideoTour:v(y(!1)),Ei(ht)?.play(),Lt();break;case Cn.Audio:case Cn.Video:$()?.addEventListener("play",()=>{$()&&(isNaN($().duration)?$().addEventListener("durationchange",bt,{once:!0}):bt())},{once:!0}),$()?.play().catch(t=>{I()?v(!0):/pause\(\)/.test(t.toString())||(oe(ut,!0),n.events.dispatch("media-blocked"),e.onblocked?.())});break;case Cn.IFrame:J?.play();break;default:return}gt=!0,z.dispatch("media-play"),N.set(!1),e.onplay?.(),T()||F||Ei(ht)&&!$()||X.set(L().$settings.mutedVolume||0)}}function yt(){z.dispatch("media-pause"),N.set(!0),$()?($().pause(),rt&&v(!0)):Ei(ht)?(Ei(ht).pause(),v(!0),Pt()):J&&!Ei(Ot)&&J.pause()}function bt(){oe(ut,!1),v(!1),Ei(ht)&&$()&&($().duration>Ei(ht).duration&&(Ei(ht).duration=$().duration),Ei(ht).currentTime=$().currentTime,Ei(ht).play())}function Tt(){y(!1),T()&&L()&&!L()._video&&L().video.set($())}function _t(){Ei(mt)||(Ei(ht)?yt():(v(!0),Pt()),oe(mt,!0),z.dispatch("media-ended"),e.onended?.(),zt())}function Mt(t){$()?$($().muted=t,!0):J&&J.setMuted(t)}function St(){oe(C,!Ei(C)),Mt(Ei(C)),F||X.set(Ei(C)?1:L().$settings.mutedVolume||0)}function Et(t){y(!0),$()?$($().currentTime=t,!0):Ei(ht)?(x(Ei(ht).currentTime=t),y(!1)):J&&J.setCurrentTime(t)}function It(){Ei(ht)?(x(Ei(ht).currentTime),Ei(ht).ended&&_t()):J&&J.getCurrentTime().then(t=>{x(t)}),At()}function At(){_()||z.dispatch("timeupdate",x())}function Lt(){tt>=0||(tt=setInterval(It,250),It())}function Pt(){clearInterval(tt),tt=-1}async function $t(){if(G&&Z&&("MediaSource"in window||"ManagedMediaSource"in window)){const t=new Oa($(),Z,{onReady:()=>y(!1),onEnded:_t});return await t.initialize(),void(J=t)}if(U==Cn.IFrame&&Ei(at)){if(H==Dn.YouTube){const t=new Ca(Ei(at),{width:Ei(qt),height:Ei(Wt)},{onReady:()=>y(!1),onDurationChange:t=>b(t),onPlay:()=>{Lt(),oe(pt,v(y(!1)),!0)},onPause:()=>{v(!0),Pt()},onEnded:_t,onBlocked:()=>{oe(pt,v(!0),!0),Pt()},onSeeking:()=>{It(),y(!0),Pt()}});return y(!0),await t.initialize(),void(J=t)}if(H==Dn.Vimeo){const t=new Da(Ei(at),{width:Ei(qt),height:Ei(Wt)},{onReady:()=>y(!1),onPlay:()=>v(y(!1)),onPause:()=>v(!0),onSeeking:()=>y(!0),onSeeked:()=>y(!1),onTimeUpdate:t=>x(t),onDurationChange:t=>b(t),onEnded:_t});return y(!0),await t.initialize(),void(J=t)}}$()&&(G&&Z&&oe(K,Z,!0),function(){if(!$())return;$($().ontimeupdate=At,!0),Ei(ht)&&($($().onpause=()=>{Dt=!!$()?.ended,$()?.ended||Ei(ht).pause()},!0),$($().onseeked=()=>{!$()||$().ended||Dt||(Ei(ht).currentTime=$().currentTime,Ct&&($().pause(),Ct=!1))},!0));null!=x()&&x()>0&&($().duration>0?$($().currentTime=x(),!0):$($().oncanplay=()=>{$()&&($($().oncanplay=null,!0),d()||($().play(),Ct=!0),$($().currentTime=nt,!0))},!0));const t=u()&&void 0!==m()?m():-1;$($().onended=t>=0?()=>{clearTimeout(dt),dt=setTimeout(()=>{w()||$()?.play()},1e3*t)}:_t,!0)}())}let Ct=!1,Dt=!1;function zt(){F||X.set(1)}let Ot=ne(!1);const Rt=Li(()=>P()&&P().subscribe(t=>{t&&Ft()})),Xt=()=>x($()?.currentTime??0);function Ft(){Ei(Ot)||(oe(Ot,!0),Rt&&Rt(),T()&&L()&&L().video.set(void 0),O.mediaState.delete(A()),Pt(),yt(),zt(),lt&&Y.set(void 0),$()&&($($().onended=null,!0),rt&&($($().onloadedmetadata=$($().onplay=$($().onseeking=$($().onseeked=null,!0),!0),!0),!0),$().removeEventListener("timeupdate",Xt)),$($().ontimeupdate=$($().onpause=$($().onseeked=$($().oncanplay=null,!0),!0),!0),!0)),Ei(ht)&&Ei(ht).destroy(),J&&(J.destroy(),J=void 0))}const Vt=U==Cn.Video;let Yt=ne(ue(Li(()=>Vt&&G&&1!=l()&&Jr.iOS)));const Nt=D.is360?Math.PI/2:1,Bt=jt(()=>Vt?l()*Nt:U==Cn.IFrame?Math.max(l(),Math.min(h()/512,c()/512)):1),qt=jt(()=>Vt?h():Math.round(h()/Ei(Bt)*Nt)),Wt=jt(()=>Vt?c():Math.round(c()/Ei(Bt)*Nt));let Ut=ne(void 0),Ht=ne(void 0);const Gt=jt(()=>Ei(ht)&&k()?"events"in k()?k().events:k().i18n?.[i()]?.events??void 0:void 0);ps(()=>{e.onid?.(A()),a()&&rt&&($(($n||($n=new Audio),$n)),$($().controls=!1,!0),$($().onloadedmetadata=()=>b($()?.duration??0),!0),$($().src=a(),!0),$($().oncanplay=Tt,!0),$($().onended=_t,!0),$().addEventListener("timeupdate",Xt),$($().onseeking=()=>y(!0),!0),$($().onseeked=()=>y(!1),!0)),nt=x()||0,oe(st,H==Dn.YouTube||H==Dn.Vimeo,!0),$t().then(()=>{d()&&vt()}).catch(()=>{}),Ei(Yt)&&$()?.addEventListener("playing",()=>oe(Yt,!1),{once:!0});let t=!1;const i=n.isMuted.subscribe(e=>{t?(oe(C,e,!0),Mt(e)):t=!0});return()=>{Ft(),i(),rt&&$(void 0),J?.destroy()}}),Re(()=>{void 0!==w()&&v(w())}),Re(()=>{u()&&void 0!==m()&&clearTimeout(dt)});var Zt=Hi(),Jt=_e(Zt),Kt=t=>{var e=io(),i=_e(e);let r;Us(i,null);var n=ke(i);let a;ar(n,"tabindex",-1);var l=ke(n),w=t=>{var e=Ha();hr(e,t=>({...t,title:p(),src:Ei(K),width:Ei(qt),height:Ei(Wt),frameborder:"0",allow:"fullscreen *;autoplay *;encrypted-media *",[js]:{hooked:Ei(st)&&!Ei(pt)}}),[()=>({credentialless:!0})],void 0,void 0,"micrio-media"),fr(e,t=>oe(at,t),()=>Ei(at)),function(t){if(!V)return;t.removeAttribute("onload"),t.removeAttribute("onerror");const e=t.__e;void 0!==e&&(t.__e=void 0,queueMicrotask(()=>{t.isConnected&&t.dispatchEvent(e)}))}(e),Gi(t,e)},k=t=>{var e=Za();e.controls=!1;var i=ke(e),s=t=>{var e=ja(),i=_e(e),s=t=>{var e=Ga();Ye(t=>ar(e,"src",t),[()=>Ei(K).replace(".webm",".mp4")]),Gi(t,e)},r=jt(()=>E()&&Ei(K).endsWith(".webm"));vs(i,t=>{Ei(r)&&t(s)});var n=Me(i,2);Ye(()=>{ar(n,"src",Ei(K)),ar(n,"type",G?"application/x-mpegURL":void 0)}),Gi(t,e)};vs(i,t=>{Ei(K)&&t(s)}),q(e),fr(e,t=>$(t),()=>$()),Ye(()=>{e.loop=u()&&(null==m()||m()<=0),ar(e,"width",h()),ar(e,"height",c()),Us(e,Ei(Yt)?"opacity: 0":void 0),e.muted=Ei(C),e.autoplay=!!d()}),Oi("canplay",e,Tt),Oi("ended",e,_t),vr("duration","durationchange",e,b),ur(e,x),mr(e,y),gr(e,v),Gi(t,e)},_=t=>{var e=Ja();e.controls=!1,fr(e,t=>$(t),()=>$()),Ye(()=>{ar(e,"src",Ei(K)),e.muted=Ei(C)}),Oi("canplay",e,()=>y(!1)),Oi("ended",e,_t),vr("duration","durationchange",e,b),ur(e,x),mr(e,y),gr(e,v),Gi(t,e)},I=t=>{var e=Ka();or(e,"data-logo","false"),Ye(()=>or(e,"id",j[0])),Ye(()=>or(e,"width",j[1])),Ye(()=>or(e,"height",j[2])),Ye(()=>or(e,"lang",j[3])),Ye(()=>or(e,"data-path",D.path)),Gi(t,e)};vs(l,t=>{U==Cn.IFrame?t(w):U==Cn.Video?t(k,1):U!=Cn.Audio||rt?U==Cn.Micrio&&j&&t(I,3):t(_,2)});var A=Me(l,2),L=t=>{!function(t,e){et(e,!0);let i=br(e,"currentTime",11,0);const s=Q("micrio");e.events.forEach(t=>{t.start=Number(t.start||0),t.end=Math.min(Number(t.end||0),e.duration)});const r=t=>e.events.forEach(e=>{const i=e.start<=t&&e.end>=t;i!=!!e.active&&(e.active=i,s.events.dispatch("tour-event",{...e}))});Re(()=>{r(i())}),fs(()=>r(1/0)),it()}(0,{get events(){return Ei(Gt)},get currentTime(){return x()},set currentTime(t){x(t)},get duration(){return b()},set duration(t){b(t)}})};vs(A,t=>{Ei(Gt)?.length&&b()>0&&!Ei(Ot)&&t(L)});var P=Me(A,2),z=t=>{var e=Qa();let i;var s=ke(e);{let t=jt(()=>!!lt),e=jt(()=>!isNaN(o())),i=jt(()=>T()||U!=Cn.IFrame&&U!=Cn.Video?M():Ei(Ut));!function(t,e){et(e,!0);const i=()=>xt(Jn,"$i18n",r),s=()=>xt(Xa,"$captionsEnabled",r),[r,n]=kt();let a=br(e,"currentTime",15),o=br(e,"duration",11,0),h=br(e,"seeking",11,!0),c=br(e,"minimal",3,!1),l=br(e,"ended",15),d=br(e,"fullscreen",3,void 0),u=br(e,"subtitles",3,!1),m=br(e,"hasAudio",3,!0),g=br(e,"muted",3,!1),p=ne(void 0);function f(t){0==t.button&&(window.addEventListener("mousemove",v),window.addEventListener("mouseup",w),v(t))}function v(t){const i=Ei(p).getClientRects()[0],s=Math.min(1,Math.max(0,(t.clientX-i.left)/i.width));e.onseek?.(s*o())}function w(){window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",w)}var y=Ua(),b=_e(y),x=ke(b);{let t=jt(()=>e.paused?"play":"pause"),s=jt(()=>e.paused?i().play:i().pause);pa(x,{get type(){return Ei(t)},get title(){return Ei(s)},get onclick(){return e.onplaypause},children:(t,e)=>{var i=Hi(),s=_e(i),r=t=>{var e=Ba(),i=ke(e);q(e),Ye(()=>ar(i,"stroke-dashoffset",119.4*(1-a()/o()))),Gi(t,e)};vs(s,t=>{c()&&void 0!==a()&&a()>0&&t(r)}),Gi(t,i)},$$slots:{default:!0}})}var T=Me(x,2),k=t=>{var r=qa(),n=_e(r),a=t=>{{let s=jt(()=>g()?"volume-off":"volume-up"),r=jt(()=>g()?i().audioUnmute:i().audioMute);pa(t,{get disabled(){return h()},get type(){return Ei(s)},get title(){return Ei(r)},get onclick(){return e.onmute}})}};vs(n,t=>{m()&&t(a)});var o=Me(n,2),c=t=>{{let e=jt(()=>s()?"subtitles":"subtitles-off");pa(t,{get type(){return Ei(e)},get active(){return s()},get title(){return i().subtitlesToggle},onclick:()=>Xa.set(!s())})}};vs(o,t=>{u()&&t(c)});var l=Me(o,2),p=t=>{Ta(t,{get el(){return d()}})};vs(l,t=>{d()&&t(p)}),Gi(t,r)};vs(T,t=>{c()||t(k)}),q(b);var _=Me(b,2),M=t=>{Na(t,{get duration(){return o()},get currentTime(){return a()},set currentTime(t){a(t)},get ended(){return l()},set ended(t){l(t)},children:(t,e)=>{var i=Wa();fr(i,t=>oe(p,t),()=>Ei(p)),Ye(()=>Us(i,`--progress:${(a()??0)/o()*100}%;`)),Ri("mousedown",i,f),Gi(t,i)},$$slots:{default:!0}})};vs(_,t=>{c()||t(M)}),Ri("click",b,t=>t.stopPropagation()),Ri("keydown",b,t=>t.stopPropagation()),Gi(t,y),it(),n()}(s,{get subtitles(){return Ei(t)},get hasAudio(){return Ei(e)},get muted(){return Ei(C)},get fullscreen(){return Ei(i)},onplaypause:ft,onmute:St,onseek:t=>Et(t),get paused(){return v()},set paused(t){v(t)},get seeking(){return y()},set seeking(t){y(t)},get duration(){return b()},set duration(t){b(t)},get currentTime(){return x()},set currentTime(t){x(t)},get ended(){return Ei(mt)},set ended(t){oe(mt,t,!0)}})}q(e),Ye(()=>i=qs(e,1,"micrio-media",null,i,{inside:"inside"==g()})),Gi(t,e)};vs(P,t=>{g()&&t(z)}),q(n),fr(n,t=>oe(Ht,t),()=>Ei(Ht));var O=Me(n,2),R=t=>{var e=to();Ms(e,f,!0),q(e),Gi(t,e)};vs(O,t=>{f()&&t(R)}),q(i),fr(i,t=>oe(Ut,t),()=>Ei(Ut));var X=Me(i,2),F=t=>{var e=eo();ar(e,"tabindex",-1),pa(ke(e),{get title(){return xt(Jn,"$i18n",s).play},type:"play"}),q(e),Ri("pointerup",e,vt),Gi(t,e)};vs(X,t=>{Ei(ut)&&t(F)}),Ye(()=>{r=qs(i,1,Vs(S()),"micrio-media",r,{paused:v(),is360:T(),"media-video":U==Cn.IFrame||U==Cn.Video,"media-micrio":U==Cn.Micrio}),Us(n,1==Ei(Bt)||U!=Cn.Video&&D.is360?"":`transform:scale(${Ei(Bt)})`),a=qs(n,1,"micrio-media",null,a,{videotour:!!Ei(ht)})}),Ri("pointerup",n,t=>{t.target==Ei(Ht)&&ft(t)}),Gi(t,e)};vs(Jt,t=>{L().$settings.noUI||t(Kt)}),Gi(t,Zt),it(),r()}Xi(["pointerup"]);var ro=Bi("<article><!></article>");function no(t,e){et(e,!0);let i=br(e,"cn",3,null);function s(t){t.target&&t.target instanceof HTMLAnchorElement&&!t.target.getAttribute("href")?.startsWith("#")&&(t.target.target="_blank")}var r=ro();gs(ke(r),()=>e.children??f),q(r),Ye(()=>qs(r,1,Vs(i()),"micrio-article")),Ri("click",r,t=>t.stopPropagation()),Ri("keydown",r,s),Ri("pointerdown",r,s),Gi(t,r),it()}Xi(["click","keydown","pointerdown"]);var ao=Bi('<h1 class="micrio-marker-content"> </h1>'),oo=Bi('<figcaption class="micrio-marker-content"> </figcaption>'),ho=Bi('<button class="micrio-marker-content"><figure class="micrio-marker-content"><img class="micrio-marker-content"/> <!></figure></button>'),co=Bi('<section class="micrio-marker-content"></section>'),lo=Bi("<!> <!>",1),uo=Bi("<main><!> <!> <!> <!> <!> <!> <!></main>");function mo(t,e){et(e,!0);const i=()=>xt(m,"$tour",r),s=()=>xt(u,"$lang",r),[r,n]=kt();let a=br(e,"noEmbed",3,!1),o=br(e,"noImages",3,!1),h=br(e,"noGallery",3,!1),c=br(e,"_content",15),l=br(e,"_title",15);const d=Q("micrio"),u=d._lang,m=d.state.tour,g=i()&&"steps"in i()&&i().isSerialTour,p=Q("markerImages").get(Li(()=>e.marker).id),f=p.$settings._markers??{},v=!f.preventAutoPlay,w=Li(()=>!e.marker.data?.preventImageOpen&&!h()),y=Li(()=>1==e.marker.images?.length),b=jt(()=>Vn(e.marker,s())),x=jt(()=>!(Ei(b)?.title||Ei(b)?.audio||e.marker.images&&e.marker.images.length||Ei(b)?.embedUrl||e.marker.videoTour||Ei(b)?.body||Ei(b)?.bodySecondary)),T=()=>{i()&&"steps"in i()&&(i().isSerialTour||f.tourAutoProgress)&&e.onclose?.()};const k=jt(()=>!v||!e.marker?.audioAutoPlay),_=jt(()=>!1===e.marker?.embedAutoPlay||!v||!(!Ei(b)?.audio||!e.marker?.audioAutoPlay)),M=p.tileBase?.includes("micrio.dev"),S=t=>t.i18n?.[s()]?.title,E=jt(()=>e.marker.videoTour?.i18n?.[s()]?.audio??Ei(b)?.audio),I=jt(()=>Fn(Ei(E))),A=jt(()=>y&&e.marker.images?.[0]?.i18n?.[s()]?.description);var L=Hi(),P=_e(L),$=t=>{var i=uo();let s;var r=ke(i),n=t=>{var e=ao(),i=ke(e,!0);q(e),fr(e,t=>l(t),()=>l()),Ye(()=>ns(i,Ei(b).title)),Gi(t,e)};vs(r,t=>{Ei(b).title&&t(n)});var h=Me(r,2),u=t=>{no(t,{children:(t,e)=>{var i=Hi();Ms(_e(i),()=>Ei(b).body),Gi(t,i)},$$slots:{default:!0}})};vs(h,t=>{Ei(b).body&&f.primaryBodyFirst&&t(u)});var m=Me(h,2),E=t=>{{let i=jt(()=>e.marker.audioAutoPlay||!Ei(b).audio&&!!e.marker.videoTour),s=jt(()=>!e.marker.videoTour||!Ei(b)||!Ei(b).embedUrl);so(t,{get src(){return Ei(I)},noPlayOverlay:!0,get image(){return p},get uuid(){return e.marker.id},get tour(){return e.marker.videoTour},get autoplay(){return Ei(i)},get controls(){return Ei(s)},onended:T,get paused(){return Ei(k)}})}};vs(m,t=>{!g&&((!Ei(b)||!Ei(b).embedUrl)&&e.marker.videoTour||Ei(b)&&Ei(b).audio)&&t(E)});var L=Me(m,2),P=t=>{var i=co();bs(i,21,()=>e.marker.images,t=>t.id??t.src,(t,i)=>{var s=ho(),r=ke(s),n=ke(r),a=Me(n,2),o=t=>{var e=oo(),i=ke(e,!0);q(e),Ye(()=>ns(i,Ei(A))),Gi(t,e)};vs(a,t=>{Ei(A)&&t(o)}),q(r),q(s),Ye((t,e,i)=>{ar(s,"title",t),s.disabled=!w,ar(n,"alt",e),ar(n,"src",i)},[()=>S(Ei(i)),()=>S(Ei(i)),()=>Ei(i).micrioId?`https://iiif.${M?"micrio.dev":"micr.io"}/${Ei(i).micrioId}/full/${y?"^"+Math.min(Ei(i).width,640)+",":"^,320"}/0/default.webp`:Ei(i).src]),Ri("click",s,function(...t){(w?()=>{return t=Ei(i).micrioId,void(w&&d.state.popover.set({gallery:e.marker.images,galleryStart:t,image:p}));var t}:void 0)?.apply(this,t)}),Gi(t,s)}),q(i),Gi(t,i)};vs(L,t=>{!o()&&e.marker.images?.length&&t(P)});var $=Me(L,2),C=t=>{var i=lo(),s=_e(i),r=t=>{so(t,{get image(){return p},className:"hidden",get uuid(){return e.marker.id},get tour(){return e.marker.videoTour},get autoplay(){return v},secondary:!0})};vs(s,t=>{!Ei(b).audio&&e.marker.videoTour&&t(r)});var n=Me(s,2);{let t=jt(()=>!Ei(_));so(n,{get image(){return p},get src(){return Ei(b).embedUrl},get uuid(){return e.marker.id},width:400,height:240,controls:!0,get title(){return Ei(b).embedTitle},get figcaption(){return Ei(b).embedDescription},get autoplay(){return Ei(t)},onended:T,get paused(){return Ei(_)}})}Gi(t,i)};vs($,t=>{Ei(b).embedUrl&&!a()&&t(C)});var D=Me($,2),z=t=>{no(t,{children:(t,e)=>{var i=Hi();Ms(_e(i),()=>Ei(b).body),Gi(t,i)},$$slots:{default:!0}})};vs(D,t=>{Ei(b).body&&!f.primaryBodyFirst&&t(z)});var O=Me(D,2),R=t=>{no(t,{cn:"secondary",children:(t,e)=>{var i=Hi();Ms(_e(i),()=>Ei(b).bodySecondary),Gi(t,i)},$$slots:{default:!0}})};vs(O,t=>{Ei(b).bodySecondary&&t(R)}),q(i),fr(i,t=>c(t),()=>c()),Ye(()=>s=qs(i,1,"micrio-marker-content",null,s,{empty:Ei(x)})),Gi(t,i)};vs(P,t=>{Ei(b)&&t($)}),Gi(t,L),it(),n()}Xi(["click"]);var go=Bi('<button class="micrio-button tour-step micrio-marker-popup" disabled=""> </button>'),po=Bi("<!> <!> <!>",1),fo=Bi('<progress class="progress micrio-marker-popup"></progress> <!>',1),vo=Bi('<div><aside class="micrio-marker-popup"><!> <!> <!></aside> <!></div>');function wo(t,e){et(e,!0);const i=()=>xt(c,"$tour",n),s=()=>xt(h,"$current",n),r=()=>xt(Jn,"$i18n",n),[n,a]=kt(),o=Q("micrio"),{current:h}=o,c=o.state.tour,l=Q("markerImages").get(Li(()=>e.marker).id),d=l.$settings._markers??{},u=jt(()=>i()&&"steps"in i()?o.canvases.find(t=>t.$data?.markerTours?.find(t=>t.id===i().id)):void 0),m=Li(()=>e.marker.data||{}),g=d.canMinimizePopup;let p=ne(void 0);function f(t){i()&&Ei(w)&&"steps"in i()?t instanceof Event&&Ei(T)?c.set(void 0):i().next?.():s()&&!l.opts.secondaryTo&&s().id!=l.id&&m.micrioLink?.id==s().id?(o.open(l.id),l.state.marker.set(void 0),o.state.popup.set(void 0)):l.state.marker.set(void 0)}const v=jt(()=>i()&&"steps"in i()?i():void 0),w=jt(()=>Ei(v)&&Ei(v)?.steps.findIndex(t=>t.startsWith(e.marker.id))>=0),y=jt(()=>Ei(w)&&!Ei(v)?.isSerialTour&&(Ei(u)?.$settings._markers?.tourControlsInPopup??d.tourControlsInPopup)),b=jt(()=>Ei(w)&&!Ei(v)?.isSerialTour&&(Ei(u)?.$settings._markers?.tourStepCounterInPopup??d.tourStepCounterInPopup)),x=jt(()=>Ei(v)?.currentStep??-1),T=jt(()=>Ei(y)||(Ei(v)?Ei(v).currentStep==Ei(v).steps.length-1:void 0));let k=ne(!1);const _=(t=!1)=>{Ei(v)&&(t?Ei(v).prev?.():Ei(v).next?.(),oe(k,!0),setTimeout(()=>oe(k,!1),200))};let M=ne(!1),S=ne(void 0),E=ne(void 0);const I=new WeakMap,A=()=>{if(oe(M,!Ei(M)),Ei(S))for(let t=0;t<Ei(S).children.length;t++){const e=Ei(S).children[t];e instanceof HTMLElement&&e!=Ei(E)&&(I.has(e)||(I.set(e,e.offsetHeight),e.style.height=e.offsetHeight+"px"),setTimeout(()=>{e.style.height=Ei(M)?"0px":I.get(e)+"px"},100))}};let L=ne(!1);ps(()=>{e.marker.tags?.forEach(t=>Ei(p)?.classList.add(t)),setTimeout(()=>Ei(p)?.querySelector("button")?.focus(),500);const t="embedImages"in e.marker?e.marker.embedImages:void 0;t&&o.$current?.data.update(e=>(e||(e={embeds:[]}),e.embeds=[...e.embeds??[],...t],e));const i=o.state.popup.subscribe(t=>oe(L,!t||t!=e.marker,!0));return()=>{i(),t&&o.$current?.data.update(e=>e?.embeds?(e.embeds=e.embeds.filter(e=>!t.find(t=>t.id==e.id)),e):e)}});var P=vo();let $;var C=ke(P),D=ke(C),z=t=>{{let e=jt(()=>!Ei(w)||Ei(T)?"close":"arrow-right"),i=jt(()=>!Ei(w)||Ei(T)?r().closeMarker:r().tourStepNext);pa(t,{get type(){return Ei(e)},get title(){return Ei(i)},get disabled(){return Ei(k)},onclick:f})}};vs(D,t=>{m.alwaysOpen||t(z)});var O=Me(D,2),R=t=>{{let e=jt(()=>Ei(M)?"arrow-up":"arrow-down");pa(t,{get type(){return Ei(e)},get title(){return r().minimize},onclick:A})}};vs(O,t=>{g&&t(R)});var X=Me(O,2),F=t=>{var e=fo(),s=_e(e);ar(s,"aria-hidden",!0),xa(Me(s,2),{className:"micrio-tour-controls",children:(t,e)=>{var s=po(),n=_e(s);{let t=jt(()=>Ei(k)||0==Ei(x));pa(n,{type:"arrow-left",get disabled(){return Ei(t)},get title(){return r().tourStepPrev},onclick:()=>_(!0)})}var a=Me(n,2),o=t=>{var e=go(),s=ke(e);q(e),Ye(()=>ns(s,`${Ei(x)+1} / ${i().steps.length??""}`)),Gi(t,e)};vs(a,t=>{Ei(b)&&t(o)});var h=Me(a,2);{let t=jt(()=>Ei(k)||Ei(x)+1==i().steps.length);pa(h,{type:"arrow-right",get disabled(){return Ei(t)},get title(){return r().tourStepNext},onclick:()=>_()})}Gi(t,s)},$$slots:{default:!0}}),Ye(()=>function(t,e){var i=cr(t);i.value!==(i.value=e??void 0)&&(t.value!==e||0===e&&t.nodeName===sr)&&(t.value=e??"")}(s,(Ei(x)+1)/i().steps.length)),Gi(t,e)};vs(X,t=>{Ei(y)&&i()&&"steps"in i()&&t(F)}),q(C),mo(Me(C,2),{get marker(){return e.marker},onclose:f,get _content(){return Ei(S)},set _content(t){oe(S,t,!0)},get _title(){return Ei(E)},set _title(t){oe(E,t,!0)}}),q(P),fr(P,t=>oe(p,t),()=>Ei(p)),Ye(()=>$=qs(P,1,"micrio-marker-popup",null,$,{destroying:Ei(L),minimized:Ei(M)})),Ds(3,P,()=>Wn,()=>d.popupAnimation),Gi(t,P),it(),a()}var yo=Bi('<li><button class="micrio-serial-tour"> </button></li>'),bo=Bi('<ol class="micrio-serial-tour"></ol>'),xo=Bi("<!> <!> <!> <!>",1),To=Bi('<div role="progressbar"></div>'),ko=Bi('<!> <aside class="micrio-media-controls micrio-serial-tour"><!> <!></aside> <!>',1);function _o(t,e){et(e,!0);const i=()=>xt(c,"$lang",n),s=()=>xt(Jn,"$i18n",n),r=()=>xt(Xa,"$captionsEnabled",n),[n,a]=kt(),o=Li(()=>e.tour).stepInfo,h=Q("micrio"),c=h._lang,l=h.$current,d=h.state.marker,u=!!l.$settings?.ui?.controls?.serialTourNoTimeScrub,m=o.reduce((t,e)=>t+e.duration,0)??0,g=Li(()=>"controls"in e.tour?!1!==e.tour.controls:!e.tour.noControls);let p=ne(!1),f=ne(!1),v=ne(!1);Re(()=>h.isMuted.subscribe(t=>{oe(v,t,!0)}));let w=ne(void 0),y=ne(void 0),b=ne(0),x=ne("");function T(){const t=h.state.mediaState.get(Ei(x));t&&(t.paused=oe(p,!t.paused)),Ei(p)?(h.events.dispatch("serialtour-pause",e.tour),h.events.enabled.set(!0)):(h.events.dispatch("serialtour-play",e.tour),h.events.enabled.set(!1))}function k(t,i){if(!e.tour.goto)return;const s=t==e.tour.currentStep;if(u&&s)return;s||e.tour.goto(t);const r=!u&&i?i.offsetX/i.target.offsetWidth:0;o.forEach((e,s)=>e.ended=!i&&s<t),S();const n=o[t];n.currentTime=r*n.duration,s&&Ei(w)?.instance&&(Ei(w).instance.currentTime=n.currentTime),I(t)}function _(){h.isMuted.update(t=>!t)}function M(){const t=Ei(y);t&&(t.ended=!0),null!=e.tour.currentStep&&e.tour.currentStep<e.tour.steps.length-1&&e.tour.next?e.tour.next():(oe(p,oe(f,!0),!0),e.onended?.()),Si().then(()=>{S(),t&&(t.ended=!1)})}function S(){e.tour.stepInfo?.forEach(t=>t.currentTime=0)}const E=vt([]);function I(t=e.tour.currentStep??0){const i=o.map((e,i)=>i<t||e.ended||Ei(f)?100:i==t?Math.round((e.currentTime||0)/e.duration*1e4)/100:0);oe(b,i.reduce((t,e,i)=>t+e/100*o[i].duration,0),!0),E.set(i)}function A(t){const i=t&&!!e.tour.steps.find(e=>e.startsWith(t.id));oe(w,void 0),i&&t.videoTour&&setTimeout(()=>{const i=o[e.tour.currentStep??0];i.markerId==t.id&&(i.ended=!1,oe(y,i,!0),oe(w,t.videoTour,!0),I())},10)}const L=t=>t.i18n?t.i18n[i()]?.title:t.title;ps(()=>{const t=()=>I();h.addEventListener("timeupdate",t);const e=d.subscribe(A);return()=>{e(),h.removeEventListener("timeupdate",t),S()}});const P=jt(()=>Ei(w)?"audio"in Ei(w)?Ei(w).audio:Ei(w).i18n?.[i()]?.audio:void 0),$=jt(()=>Fn(Ei(P))),C=jt(()=>!!Ei(y)?.hasSubtitle),D=jt(()=>o.some(t=>t.hasSubtitle));var z=ko(),O=_e(z),R=t=>{var e=bo();bs(e,21,()=>o,ws,(t,e,i)=>{var s=Hi(),r=_e(s),n=t=>{var s=yo();let r;var n=ke(s),a=ke(n,!0);q(n),q(s),Ye(t=>{r=qs(s,1,"micrio-serial-tour",null,r,{active:Ei(y)&&Ei(y).chapter==i,enriched:Ei(e).imageHasOtherMarkers}),ns(a,t)},[()=>L(Ei(e).marker)]),Ri("click",n,()=>k(i)),Gi(t,s)},a=jt(()=>L(Ei(e).marker));vs(r,t=>{Ei(a)&&t(n)}),Gi(t,s)}),q(e),Gi(t,e)};vs(O,t=>{e.tour.printChapters&&t(R)});var X=Me(O,2),F=ke(X),V=t=>{{let e=jt(()=>!Ei(p));so(t,{get tour(){return Ei(w)},get src(){return Ei($)},get autoplay(){return Ei(e)},onid:t=>oe(x,t,!0),onended:M,onplay:()=>oe(p,!1),onblocked:()=>oe(p,!0),get currentTime(){return Ei(y).currentTime},set currentTime(t){Ei(y).currentTime=t}})}};vs(F,t=>{Ei(w)&&Ei(y)&&t(V)});var Y=Me(F,2),N=t=>{var e=xo(),i=_e(e);{let t=jt(()=>Ei(p)?"play":"pause"),e=jt(()=>Ei(p)?s().play:s().pause);pa(i,{get type(){return Ei(t)},get title(){return Ei(e)},onclick:T})}var n=Me(i,2);{let t=jt(()=>Ei(v)?"volume-off":"volume-up"),e=jt(()=>Ei(v)?s().audioUnmute:s().audioMute);pa(n,{get type(){return Ei(t)},get title(){return Ei(e)},onclick:_})}var a=Me(n,2),o=t=>{{let e=jt(()=>!Ei(C)),i=jt(()=>r()?"subtitles":"subtitles-off");pa(t,{get disabled(){return Ei(e)},get type(){return Ei(i)},get active(){return r()},get title(){return s().subtitlesToggle},onclick:()=>Xa.set(!r())})}};vs(a,t=>{Ei(D)&&t(o)}),Ta(Me(a,2),{get el(){return h}}),Gi(t,e)};vs(Y,t=>{g&&t(N)}),q(X);var B=Me(X,2),W=t=>{Na(t,{get duration(){return m},get currentTime(){return Ei(b)},set currentTime(t){oe(b,t,!0)},get ended(){return Ei(f)},set ended(t){oe(f,t,!0)},children:(t,i)=>{var s=Hi();bs(_e(s),17,()=>o,ws,(t,i,s)=>{var r=Hi(),a=_e(r),o=t=>{var r=To();let a;Ye(t=>{a=qs(r,1,"bar",null,a,{active:s==e.tour.currentStep}),ar(r,"title",t),Us(r,`width:${Ei(i).duration/m*100}%; --progress: ${xt(E,"$times",n)[s]||0}%`)},[()=>L(Ei(i).marker)]),Ri("click",r,t=>k(s,t)),Oi("keypress",r,t=>{"Enter"===t.key&&k(s)}),Gi(t,r)};vs(a,t=>{Ei(i).duration>0&&t(o)}),Gi(t,r)}),Gi(t,s)},$$slots:{default:!0}})};vs(B,t=>{g&&t(W)}),Gi(t,z),it(),a()}Xi(["click"]);var Mo=Bi('<article class="scroll-tour micrio-tour"></article> <!>',1),So=Bi("<!> <!> <!>",1),Eo=Bi("<div><!> <!></div>");function Io(t,e){et(e,!0);const i=()=>xt(l,"$_lang",r),s=()=>xt(Jn,"$i18n",r),[r,n]=kt();let a=br(e,"noHTML",3,!1);const o=Q("micrio"),{events:h,state:c,_lang:l}=o,d=c.$tour,u=o.$current,m=u.$data,g=u.$settings,p=o.canvases[0].grid,f=u.state.marker,v="steps"in e.tour&&e.tour.isSerialTour,w=!("steps"in e.tour),y="scrollable"in e.tour&&e.tour.scrollable,b="steps"in e.tour&&("controls"in e.tour?!1!==e.tour.controls:!!e.tour.noControls),x=!(!v&&"steps"in e.tour&&g._markers?.tourControlsInPopup),T=x&&(w||v),k=!!g._markers?.keepPopupsDuringTourTransitions,_=()=>I(Ei(C)-1),M=()=>I(Ei(C)+1),S=()=>h.enabled.set(!0);let E;function I(t){if(!("steps"in e.tour)||!e.tour.stepInfo)return;const i=e.tour.stepInfo[t];if(i&&i.markerId==o.state.$marker?.id)return A(i);const s=e.tour.stepInfo[Ei(C)]?.micrioImage?.state;s&&s.marker.set(void 0),o.$current?.state.marker.set(void 0),k||o.state.popup.set(void 0),o.removeEventListener("marker-opened",S),f.set(void 0),i&&(E=setTimeout(L,200,i))}async function A(t){let i=u,s=!1;if(p&&!t.gridView&&p.images.find(e=>e.id==t.micrioId)){const r=!!("steps"in e.tour&&e.tour.stepInfo&&t)&&e.tour.stepInfo?.indexOf(t)<Ei(C),n=t.marker.data?.gridTourTransition??t.marker.data?._meta?.gridTourTransition,a=n?.startsWith("slide")?"slide":"swipe";await Si().then(()=>{const e=p.focus(i=p.images.find(e=>e.id==t.micrioId),{view:t.startView,transition:n==a||n==`${a}-horiz`?r?`${a}-left`:`${a}-right`:n==`${a}-vert`?r?`${a}-up`:`${a}-down`:"behind"==n?r?"behind-left":"behind-right":n}).catch(()=>s=!0);return o.events.enabled.set(!1),e})}else if(o.$current?.id!=t.micrioId){if(t.gridView&&t.marker.data?._meta?.gridAction&&p){t.micrioImage||(t.micrioImage=p.images.find(e=>e.id==t.micrioId)),i=t.micrioImage;const e=t.marker.data._meta.gridAction.split("|");p.action(e.shift(),e.join("|"))}else"steps"in e.tour&&e.tour.stepInfo&&oe(C,e.tour.stepInfo.indexOf(t),!0),i=o.open(t.micrioId,{gridView:t.gridView,startView:t.startView});await Si()}else i=o.$current;return[i,s]}async function L(t){let i=u,s=!1;t.micrioId&&([i,s]=await A(t)),s||(t.micrioImage||(t.micrioImage=i),h.enabled.set(!1),i.state.marker.set(t.markerId),o.addEventListener("marker-opened",S,{once:!0}),await Si(),h.dispatch("tour-step",e.tour))}function P(){c.tour.set(void 0)}function $(){h.dispatch("tour-ended",e.tour),(e.tour.closeOnFinish||!e.tour.cannotClose&&b)&&P()}let C=ne(-1),D=ne(!1);const z=u.camera.getView(),O=g._markers;if("steps"in e.tour){const t=d;t.prev=_,t.next=M,t.goto=I,Re(()=>{t.currentStep=Ei(C)})}const R=vt(!1);let X;function F(){R.set(!1),clearTimeout(X),X=setTimeout(()=>R.set(!0),5e3)}R.subscribe(t=>h.dispatch("tour-minimize",t));let V,Y=ne(void 0);function N(t){if(!("steps"in e.tour)||!Ei(Y))return;const i=e.tour.steps,s=t.filter(t=>t.isIntersecting).map(t=>t.target)[0];if(s)for(let e=0;e<Ei(Y).children.length;e++)if(Ei(Y).children[e]==s){const t=m.markers?.find(t=>t.id==i[e].split(",")[0]);return void(t&&o.$current?.camera.flyToView(t.view).catch(()=>{}))}}let B=[];ps(()=>("steps"in e.tour&&En(u,e.tour,i(),u.$data).then(()=>function(t){if(y||o.$current?.state.$marker||void 0!==t.initialStep&&I(t.initialStep),y&&Ei(Y)){V=new IntersectionObserver(N,{root:Ei(Y),threshold:1});for(let t=0;t<Ei(Y).children.length;t++)V.observe(Ei(Y).children[t])}B.push(o.state.marker.subscribe(e=>{if(!e)return void oe(D,!1);const i="string"==typeof e?e:e.id,s=t.steps.findIndex(t=>t.startsWith(i));if(s>=0&&t.stepInfo){const e=t.stepInfo[oe(C,s,!0)];e&&!e.micrioImage&&(e.micrioImage=o.canvases.find(t=>t.id==e.micrioId)??p?.images.find(t=>t.id==e.micrioId)??o.$current)}oe(D,s<0)}))}(e.tour)),b||B.push(R.subscribe(t=>e.onminimize?.(t))),a()||"steps"in e.tour&&!v||!1===e.tour.minimize||(o.addEventListener("pointermove",F),o.addEventListener("touchstart",F),F()),T&&o.setAttribute("data-tour-active",""),()=>{for(clearTimeout(X),clearTimeout(E);B.length;)B.shift()?.();o.removeEventListener("pointermove",F),o.removeEventListener("touchstart",F),o.removeEventListener("marker-opened",S),T&&o.removeAttribute("data-tour-active"),S(),V&&V.disconnect();const t=o.state.$marker;if("steps"in d&&d.stepInfo&&null!=d.currentStep){const e=d.stepInfo[d.currentStep];delete d.goto,delete d.next,delete d.prev,t&&e?.markerId==t.id&&(e.micrioImage?.state.marker.set(void 0),o.state.marker.set(void 0))}u.camera.aniDone=void 0,p||"steps"in d&&d.keepLastStep||o.$current==u||o.open(u.id),Si().then(()=>{h.dispatch("tour-stop",d),"steps"in d&&delete d.currentStep,!("steps"in d)&&O?.zoomOutAfterClose&&!t&&z&&u.camera.flyToView(z,{speed:O?.zoomOutAfterCloseSpeed})})})),h.dispatch("tour-start",e.tour);let U=ne(0),H=ne(!1);const G=jt(()=>"steps"in e.tour?void 0:e.tour),j=jt(()=>Ei(G)?"audio"in e.tour?e.tour.audio:Ei(G).i18n?.[i()]?.audio:void 0),Z=jt(()=>Fn(Ei(j)));var J=Hi(),K=_e(J),tt=t=>{var i=Hi(),n=_e(i),a=t=>{var i=Mo(),r=_e(i);bs(r,21,()=>e.tour.steps.map(t=>m.markers&&m.markers.find(e=>e.id==t.split(",")[0])),ws,(t,e)=>{var i=Hi(),s=_e(i),r=t=>{wo(t,{get marker(){return Ei(e)}})};vs(s,t=>{Ei(e)&&t(r)}),Gi(t,i)}),q(r),fr(r,t=>oe(Y,t),()=>Ei(Y));var n=Me(r,2),a=t=>{pa(t,{type:"close",get title(){return s().tourStop},className:"scroll-tour-end",onclick:P})};vs(n,t=>{e.tour.cannotClose||t(a)}),Gi(t,i)},h=t=>{var i=Eo();let n;var a=ke(i),h=t=>{var i=Hi(),r=_e(i),n=t=>{_o(t,{get tour(){return e.tour},onended:$})},a=t=>{var i=So(),r=_e(i);{let t=jt(()=>0==Ei(C));pa(r,{type:"arrow-left",get title(){return s().tourStepPrev},get disabled(){return Ei(t)},onclick:_})}var n=Me(r,2);pa(n,{noClick:!0,children:(t,i)=>{W();var s=Ui();Ye(()=>ns(s,`${Ei(C)+1} / ${e.tour.steps.length??""}`)),Gi(t,s)},$$slots:{default:!0}});var a=Me(n,2);{let t=jt(()=>Ei(C)==e.tour.steps.length-1);pa(a,{type:"arrow-right",get title(){return s().tourStepNext},get disabled(){return Ei(t)},onclick:M})}Gi(t,i)};vs(r,t=>{v?t(n):t(a,-1)}),Gi(t,i)},c=t=>{so(t,{get tour(){return e.tour},get src(){return Ei(Z)},get fullscreen(){return o},controls:!0,autoplay:!0,onended:$,get paused(){return Ei(H)},set paused(t){oe(H,t,!0)},get currentTime(){return Ei(U)},set currentTime(t){oe(U,t,!0)}})};vs(a,t=>{"steps"in e.tour?t(h):t(c,-1)});var l=Me(a,2),d=t=>{pa(t,{type:"close",get title(){return s().close},onclick:P})};vs(l,t=>{e.tour.cannotClose||t(d)}),q(i),Ye(()=>n=qs(i,1,"micrio-tour",null,n,{left:v,"serial-tour":v,"video-tour":w,"no-controls":b,minimized:!Ei(H)&&(xt(R,"$minimized",r)||Ei(D))})),Ds(1,i,()=>qn,()=>({duration:200})),Gi(t,i)},c=t=>{so(t,{get tour(){return Ei(G)},get src(){return Ei(Z)},autoplay:!0,onended:$,get currentTime(){return Ei(U)},set currentTime(t){oe(U,t,!0)}})};vs(n,t=>{y&&"steps"in e.tour?t(a):x?t(h,1):Ei(G)&&t(c,2)}),Gi(t,i)},st=t=>{so(t,{get tour(){return Ei(G)},get src(){return Ei(Z)},autoplay:!0,onended:$,get currentTime(){return Ei(U)},set currentTime(t){oe(U,t,!0)}})};vs(K,t=>{a()?Ei(G)&&t(st,1):t(tt)}),Gi(t,J),it(),n()}var Ao,Lo=class{get currentIndex(){return this.micrio.engine.getActiveImageIdx(this.image.ptr)}constructor(t,e,i,s={}){this.micrio=t,this.length=e,this.goto=i,this.opts=s,this.hitTresh=!1,this.snapTo=[],this.pointers=new Map,this.isFullWidth=!1,this.startedWithShift=!1,this.isDragging=()=>2==this.pointers.size||(this.isFullWidth||this.startedWithShift)&&1==this.pointers.size,s.sensitivity||(s.sensitivity=Number(t.getAttribute("data-swipe-sensitivity")??1));const r=t.getAttribute("data-swipe-snap");r&&(this.snapTo=r.split(",").map(Number)),this.micrio.setAttribute("data-hooked",""),this.dStart=this.dStart.bind(this),this.dMove=this.dMove.bind(this),this.dStop=this.dStop.bind(this),this.mouseleave=this.mouseleave.bind(this),this.image=t.$current,this.image.state.view.subscribe(t=>this.isFullWidth=s.coverLimit?this.image.camera.isZoomedOut():!t||Math.round(1e3*t[3])/1e3>=1),t.engine.setNoPinchPan(!0),t.engine.setIsSwipe(!0),this.micrio.canvas.element.addEventListener("pointerdown",this.dStart)}destroy(){this.micrio.canvas.element.removeEventListener("pointerdown",this.dStart),this.mouseleave()}dStart(t){this.startedWithShift=t.shiftKey;const e=!this.isDragging();this.pointers.set(t.pointerId,!0),this.pointers.size>2&&this.mouseleave(),e&&(this.hitTresh=!1,this.micrio.setAttribute("data-panning",""),this.startIndex=this.currentIndex,this.startX=t.clientX,this.firstTouchId=t.pointerId,this.micrio.addEventListener("pointermove",this.dMove),this.micrio.addEventListener("pointerup",this.dStop),this.micrio.setPointerCapture(t.pointerId))}dMove(t){if(!this.isDragging()||t.pointerId!=this.firstTouchId||void 0===this.startX||void 0===this.startIndex)return;if(!this.hitTresh&&void 0!==this.startX&&(this.hitTresh=2!=this.pointers.size||Math.abs(t.clientX-this.startX)>(this.micrio.events.pinchFactor&&this.micrio.events.pinchFactor>1.25?.3:.15)*this.micrio.offsetWidth)&&(this.startX=t.clientX),!this.hitTresh)return;const e=this.micrio.$current.camera,i=this.opts.continuous?Math.max(.1,(e.getXY(1,.5)[0]-e.getXY(0,.5)[0])/this.micrio.offsetWidth):1,s=Math.round((t.clientX-this.startX)/(this.micrio.offsetWidth*i)*this.length*(this.opts.sensitivity??1));let r=this.startIndex-s;if(this.opts.continuous){for(;r<0;)r+=this.length;for(;r>this.length-1;)r-=this.length}r=Math.max(0,Math.min(this.length-1,r)),r!=this.currentIndex&&this.goto(r)}dStop(t){this.pointers.delete(t.pointerId),t.pointerId==this.firstTouchId&&(this.micrio.releasePointerCapture(this.firstTouchId),this.firstTouchId=void 0),this.pointers.size||this.swipeEnd()}mouseleave(){this.pointers.clear(),this.swipeEnd()}swipeEnd(){if(this.micrio.removeAttribute("data-panning"),this.micrio.removeEventListener("pointermove",this.dMove),this.micrio.removeEventListener("pointerup",this.dStop),this.hitTresh=!1,this.snapTo.length){const t=this.snapTo[this.snapTo.map((t,e)=>[e,Math.abs(t-this.currentIndex)]).sort((t,e)=>t[1]>e[1]?1:t[1]<e[1]?-1:0)[0][0]];t!=this.currentIndex&&this.animateTo(t)}}animateTo(t){this.raf&&cancelAnimationFrame(this.raf);const e=performance.now(),i=this.currentIndex,s=i-t,r=t=>{const n=Math.min(1,(t-e)/250);n<1&&(this.raf=requestAnimationFrame(r));const a=i-Math.round(this.micrio.engine.ease(n)*s);a!=this.currentIndex&&this.goto(a)};this.raf=requestAnimationFrame(r)}},Po={0:[0,-.5,1,0],90:[1,0,1.5,1],180:[0,1,1,1.5],270:[-.5,0,0,1]},$o={0:[0,-1,1,0],90:[1,0,2,1],180:[0,1,1,2],270:[-1,0,0,1]},Co={0:[0,1,1,2],90:[-1,0,0,1],180:[0,-1,1,0],270:[1,0,2,1]},Do=t=>[t,0,t+1,1];!function(t){let e;let i;(e||(e=t.Grid||(t.Grid={}))).GridActionType=function(t){return t[t.focus=0]="focus",t[t.flyTo=1]="flyTo",t[t.focusWithTagged=2]="focusWithTagged",t[t.focusTagged=3]="focusTagged",t[t.reset=4]="reset",t[t.back=5]="back",t[t.switchToGrid=6]="switchToGrid",t[t.filterTourImages=7]="filterTourImages",t[t.nextFadeDuration=8]="nextFadeDuration",t}({}),(i||(i=t.Camera||(t.Camera={}))).TimingFunction=function(t){return t[t.ease=0]="ease",t[t["ease-in"]=1]="ease-in",t[t["ease-out"]=2]="ease-out",t[t.linear=3]="linear",t}({})}(Ao||(Ao={}));var zo=Bi('<span class="micrio-dial"> </span>'),Oo=Bi('<div data-scroll-through="" class="micrio-dial"><!></div>');var Ro,Xo=Bi("<button>&#10021;</button>"),Fo=Bi("<span></span>"),Vo=Bi('<span class="hover-label micrio-gallery"> </span>'),Yo=Bi('<div><!> <ul><span class="track micrio-gallery"><span class="track-fill micrio-gallery"></span></span> <span class="ticks micrio-gallery"></span> <!> <button aria-label="Gallery position" role="slider" tabindex="0"></button> <span> </span></ul> <!></div>');function No(t,e){et(e,!0);const i=()=>xt(y,"$settings",n),s=()=>xt(w,"$layer",n),r=()=>xt(Jn,"$i18n",n),[n,a]=kt();let o=br(e,"images",19,()=>[]),h=br(e,"omni",3,null);const c=Li(()=>o()),l=Li(()=>h()),d=Q("micrio"),{engine:u,current:m,events:g,_lang:p}=d,f=xt(m,"$current",n),v=f.$info,w=f.state.layer,y=f.settings,b=f.camera;if(l)for(let q=0;q<l.frames;q++)c.push({id:v.id+"/"+q,image:f,visible:vt(!1),frame:q,opts:{area:[0,0,1,1]},ptr:-1,baseTileIdx:-1,thumbSrc:f.getTileSrc(f.levels,0,0,q)});const x=i().gallery,T="omni"==x.type,k=T||"swipe-full"==x.type,_=k||"switch"==x.type,M=!_&&c.length>1&&!("frame"in(c[0]??{})),S=T,E=!!x.isSpreads,I=x.coverPages??0,A=i().omni,L=T&&!!A?.twoAxes,P=x.startId||d.getAttribute("data-gallery-start-id"),$=x.archive,C=!!i().limitToCoverScale,D=!!i().noUI,z=A?.frontIndex??0,O=A?.layers?.length??1,R=d.hasAttribute("data-gallery-start")?Number(d.getAttribute("data-gallery-start")):i()?.omni?.startIndex;let X=null==R||isNaN(R)?P?c.findIndex(t=>t.id==P):0:R;X<0&&(X=0);const F=[],V=[];if(M)for(let q=0;q<c.length;q++)F.push([0,0,1,1]),V.push([q]);else if(c)for(let q=0;q<c.length;q++){let t=c[q].opts?.area;if(!t)continue;const e=t.slice(0);if(V.push([q]),E&&q-I>=0&&(q-I)%2==0&&c[q+1]){if(t=c[++q].opts?.area,!t)continue;V[V.length-1].push(q),e[2]=t[2],e[3]=t[3]}F.push(e)}const Y=F.length/O,N=A?.layers?.map(t=>({i18n:Object.fromEntries(Object.entries(t.i18n).map(([t,e],i)=>[t,{title:e??"Layer "+(i+1)}]))}))??[];Object.keys(v.revision??{[(()=>xt(p,"$_lang",n))()]:0}).forEach(t=>N.forEach((e,i)=>{e.i18n[t]||(e.i18n[t]={title:"Layer "+(i+1)})}));let B=ne(-1),W=_,U=ne(!0),H=ne(!1),G=ne(!0),j=!1,Z=ne(0);function J(t,e=!1,i=150,s=!1){if(S){for(;t<0;)t+=Y;t%=Y}const r=t=Math.round(Math.max(0,Math.min(Y-1,t))),n=s||r!=Ei(B);if(oe(B,r,!0),n&&tt(),M)!function(t,e,i,s){if(!c[t])return;const r=0===i?0:e?K/2:K,n=c[Ei(B)>-1&&Ei(B)!=t?Ei(B):-1],a=s&&r>0&&n?.camera&&!n.camera.isZoomedOut(),o=()=>{u.setGridTransitionDuration(r);for(let e=0;e<c.length;e++){const i=c[e];if(!i?.camera)continue;const s=i.opts.area??[0,0,1,1],n=s[0],a=n>=-1&&n<=1,o=e-t,h=Do(o),l=Math.abs(o)<=1,d=Math.abs(s[0]-h[0])>1e-4||Math.abs(s[2]-h[2])>1e-4,u=r>0&&d&&(a||l);i.camera.setArea(h,{direct:!u,noDispatch:!0})}u.render()};a?n.camera.flyToCoverView({duration:1e3*r*.6,speed:2}).then(o).catch(o):o()}(Ei(B),e,i,n);else if(_){if(n)if(u.setActiveImage(f.ptr,V[Ei(B)][0],V[Ei(B)].length-1),T)u.render();else{const t=F[Ei(B)];b.flyToView([t[0],t[1],t[2]-t[0],t[3]-t[1]],{duration:i,speed:2}).then(()=>ot(F[Ei(B)],!0)).catch(()=>{}),ee()}}else{const s=b.getViewLegacy(),r=F[t],a=rn.fromLegacy(r),o=j&&(W&&!Ei(H)||n||s[0]<r[0]!=s[2]>r[2]);oe(H,!1),o?b.flyToView(a,{duration:i,speed:1,progress:e?.5:0}).then(()=>ot(r,!0)).catch(()=>{}):(a&&0==i&&b.setView(a),ot(r,!0))}f.album.hooked=j=!0}const K=.35;function tt(t){if(Kt&&t){if(Kt.currentIndex==Ei(B))return;oe(B,Kt.currentIndex,!0)}at(Ei(B)),g.dispatch("gallery-show",Ei(B)),T&&oe(Z,(Ei(B)-z)/Y*360),M&&f.album?.currentImage?.set(c[Ei(B)])}const st="requestIdleCallback"in self?T?Math.max(36,2*Math.floor(c.length/8)):100:50,rt=new Map,nt=self.requestIdleCallback??self.requestAnimationFrame;function at(t){const e=[];N.length&&(t+=s()*Math.floor(o().length/N.length)),E&&t>=I&&(t=2*t-I);const i=Math.floor(t/qt);for(let s=-st;s<=st;s++)if(s){let r=t+s;if(L){const t=Math.floor(r/qt);t<i&&(r+=qt),t>i&&(r-=qt)}if(S){for(;r<0;)r+=o().length;for(;r>=o().length;)r-=o().length}e.push(r)}if(L)for(let s=-st;s<=st;s++)s&&e.push(t+s*qt);e.filter((t,i)=>t>=0&&t<o().length&&e.indexOf(t)==i).map(t=>o()[t]).filter(t=>!!t&&!rt.has(t.id)).forEach(t=>rt.set(t.id,nt(()=>u.getTexture(t.baseTileIdx,t.thumbSrc,!1,{force:!!$}))))}function ot(t,e){W=b.isZoomedOut(),b.setLimit(!e&&W?[-1,t[1],2,t[3]]:t)}const ht=16;function ct(t){if(!Ei(ut))return 0;const e=Ei(ut).clientWidth;return ht+t/Math.max(1,Y-1)*(e-32)}function lt(t){const e=V[t];return e?.length?1===e.length?String(e[0]+1):`${e[0]+1}–${e[e.length-1]+1}`:String(t+1)}let dt,ut=ne(void 0),mt=ne(0);const gt=jt(()=>!Ei(ut)||Ei(U)?Ei(mt):ct(Ei(B)));let pt=!1;function ft(t){t.preventDefault(),t.stopPropagation(),Ei(U)||(pt="button"in t)&&0!=t.button||!Ei(ut)||(dt=Ei(ut).getClientRects()[0],d.keepRendering=oe(U,!0),oe(Mt,-1),window.addEventListener(pt?"pointermove":"touchmove",yt),window.addEventListener(pt?"pointerup":"touchend",Et),yt(t))}function wt(t){const e=dt??Ei(ut).getClientRects()[0],i="button"in t?t.clientX:t.touches[0].clientX,s=Math.min(1,Math.max(0,(i-e.left-ht)/(e.width-32)));return[s,Math.max(0,Math.min(Y-1,Math.round(s*Math.max(1,Y-1))))]}function yt(t){const[e,i]=wt(t);oe(mt,ht+e*(dt.width-32)),i!=Ei(B)&&J(i,!0)}let bt,Tt,_t,Mt=ne(-1);function St(t){Ei(U)||oe(Mt,wt(t)[1],!0)}function Et(){window.removeEventListener(pt?"pointermove":"touchmove",yt),window.removeEventListener(pt?"pointerup":"touchend",Et),oe(U,d.keepRendering=!1,!0),J(Ei(B))}function It(){W&&(Tt=bt=Ei(B),oe(H,W,!0),ot(F[Ei(B)],!1))}function At(t){const e=t.detail;"panend"!=t.type||e?J(Tt!=Ei(B)?Tt:Ei(B)+(bt==Ei(B)&&Ei(H)&&e?Math.round(Math.min(1,Math.max(-1,-e.movedX/e.duration))):0)):oe(H,!1)}function Lt(t){if(!t)return;const e=rn.toCenterJSON(t),i=e.centerX,s=F.map((t,s)=>(1-Math.min(Math.abs(i-t[0]),Math.abs(i-t[2])))*Math.max(0,(Math.min(i+e.width/2,t[2])-Math.max(i-e.width/2,t[0]))/(t[2]-t[0]))*(1-.1*Math.abs(Ei(B)-s)));u.setFocus(f.ptr,F[Tt=s.every(t=>!t)?Ei(B):s.indexOf(Math.max(...s))],Ei(H)),W=b.isZoomedOut()}let Pt=0,$t=0,Ct=0,Dt=0,zt=!1,Ot=!1,Rt=0;function Xt(t){c[Ei(B)]?.camera?.isZoomedOut()&&0==t.button&&void 0===_t&&(_t=t.pointerId,Pt=$t=t.clientX,Rt=t.clientY,Ct=t.timeStamp,Dt=0,zt=!1,Ot=!1,window.addEventListener("pointermove",Ft),window.addEventListener("pointerup",Vt),window.addEventListener("pointercancel",Vt))}function Ft(t){if(t.pointerId!==_t)return;const e=t.clientX-Pt,i=t.clientY-Rt;if(!zt){if(Math.abs(e)<6&&Math.abs(i)<6)return;if(Ot=Math.abs(e)>Math.abs(i),!Ot)return void Vt(t);zt=!0,d.setAttribute("data-panning",""),d.keepRendering=!0,d.canvas.element.setPointerCapture(t.pointerId)}const s=Math.max(1,t.timeStamp-Ct);Dt=(t.clientX-$t)/s,$t=t.clientX,Ct=t.timeStamp,function(t){const e=0==Ei(B)&&t>0,i=Ei(B)==c.length-1&&t<0,s=e||i?Math.sign(t)*Math.sqrt(Math.abs(t))*.3:t;c[Ei(B)]?.camera?.setArea(Do(s),{direct:!0,noDispatch:!0}),s<0&&Ei(B)<c.length-1?c[Ei(B)+1]?.camera?.setArea(Do(1+s),{direct:!0,noDispatch:!0}):s>0&&Ei(B)>0&&c[Ei(B)-1]?.camera?.setArea(Do(-1+s),{direct:!0,noDispatch:!0});u.render()}(e/(d.offsetWidth||1))}function Vt(t){if(t.pointerId!==_t)return;window.removeEventListener("pointermove",Ft),window.removeEventListener("pointerup",Vt),window.removeEventListener("pointercancel",Vt);const e=zt;if(_t=void 0,zt=!1,d.removeAttribute("data-panning"),d.keepRendering=!1,!e)return;try{d.canvas.element.releasePointerCapture(t.pointerId)}catch(n){}const i=d.offsetWidth||1,s=(t.clientX-Pt)/i;let r=Ei(B);s<-.3||Dt<-.5?r=Math.min(c.length-1,Ei(B)+1):(s>.3||Dt>.5)&&(r=Math.max(0,Ei(B)-1)),J(r)}let Yt=0,Nt=[0,0,0,0];function Bt(t){t.stopPropagation(),t.preventDefault(),0==t.button&&(oe(U,!0),Nt=[t.clientX,t.clientY,Ei(B),Yt],window.addEventListener("pointermove",Ut),window.addEventListener("pointerup",Ht))}const qt=c.length,Wt=1;function Ut(t){Yt=Math.max(0,Math.min(Wt-1,Nt[3]+Math.round((Nt[1]-t.clientY)/360*Wt)));let e=(Nt[2]+Math.round((Nt[0]-t.clientX)/360*qt))%qt;for(;e<0;)e+=qt;J(Yt*qt+e)}function Ht(){removeEventListener("pointermove",Ut),removeEventListener("pointerup",Ht),oe(U,!1)}let Gt=-1;const Zt=()=>{N.length&&f.data.update(t=>{t||(t={}),t.pages||(t.pages=[]);const e={id:"_omni-layers",i18n:N[s()].i18n,icon:ea.layerGroup,children:N.map((t,e)=>({id:"omni-layer-"+e,i18n:t.i18n,action:()=>{w.set(e),at(Ei(B))}})).filter(t=>t.id!="omni-layer-"+s())};return Gt>=0&&Gt<t.pages.length?t.pages.splice(Gt,1,e):t.pages.push(e),Gt=t.pages.length-1,t})};let Jt,Kt,Qt=d.state.ui.hidden,te=d.state.ui.hover;function ee(){Qt.set(!1),clearTimeout(Jt),Jt=setTimeout(()=>Qt.set(!0),2e3)}f.album={numPages:F.length,get currentIndex(){return Ei(B)},info:f.$settings.album,prev:()=>J(Ei(B)-1),next:()=>J(Ei(B)+1),goto:J,...M?{currentImage:vt(c[X])}:{}},ps(()=>{(M?Promise.all(c.map(t=>u.addChild(t,f))):Promise.all(o().map(t=>("state"in t&&!("image"in t)&&(t.camera=f.camera),u.addEmbed(t,f,{opacity:0,asImage:"camera"in t}))))).then(()=>{if(M){u.setGridTransitionTimingFunction(Ao.Camera.TimingFunction["ease-out"]);for(let t=0;t<c.length;t++){const e=c[t];e.camera&&(e.camera.setCoverLimit(!1),e.camera.setArea(Do(t-X),{direct:!0,noDispatch:!0}),e.camera.setView([0,0,1,1],{noRender:!0}))}oe(B,X,!0),tt(),f.album.hooked=j=!0,u.render()}else u.setActiveImage(f.ptr,X),J(X,!1,0);oe(U,!1)}),T&&O>1&&Zt(),oe(G,!1),d.goto=J;const t=[],e=[];if(T&&t.push(f.state.layer.subscribe(Zt)),k&&(Kt=f.swiper=new Lo(d,Y,J,{continuous:S,coverLimit:C})),e.push(()=>{d.canvas.element.removeEventListener("pointermove",ee),d.canvas.element.removeEventListener("pointerdown",ee)}),T||L||k||(d.canvas.element.addEventListener("pointermove",ee),d.canvas.element.addEventListener("pointerdown",ee),ee()),_&&t.push(f.state.view.subscribe(()=>{W=b.isZoomedOut()})),!(_||k||o().length<=1))if(L||oe(mt,ct(X),!0),M){const t=Xt;d.canvas.element.addEventListener("pointerdown",t),e.push(()=>d.canvas.element.removeEventListener("pointerdown",t))}else t.push(f.state.view.subscribe(Lt)),d.addEventListener("panstart",It),d.addEventListener("panend",At),d.addEventListener("pinchend",At),e.push(()=>{d.removeEventListener("panstart",It),d.removeEventListener("panend",At),d.removeEventListener("pinchend",At)});return T&&d.addEventListener("move",tt),()=>{for(Kt&&Kt.destroy();t.length;)t.shift()?.();for(;e.length;)e.shift()?.();T&&d.removeEventListener("move",tt),te.set(!1)}});var ie=Hi();Oi("keydown",pe,function(t){if(!i().omni?.noKeys){switch(t.key){case"PageUp":case"ArrowLeft":J(Ei(B)-(T?-1:1),!0);break;case"PageDown":case"ArrowRight":J(Ei(B)+(T?-1:1),!0);break;case"ArrowUp":L&&J(Ei(B)+qt);break;case"ArrowDown":L&&J(Ei(B)-qt);break;case"Home":J(0);break;case"End":J(Y);break;default:return}ee()}});var se=_e(ie),re=t=>{var e=Hi(),s=_e(e),a=t=>{var e=Xo();let i;Ye(()=>i=qs(e,1,"angular micrio-gallery",null,i,{dragging:Ei(U)})),Oi("pointerdown",e,Bt,!0),Gi(t,e)},h=t=>{{let e=jt(()=>i().omni?.showDegrees);!function(t,e){et(e,!0);const i=Q("micrio"),s=i.$current.camera;let r,n=ne(void 0),a=0,o=0;function h(t){const r=Math.max(1,(s.getXY(1,.5)[0]-s.getXY(0,.5)[0])/i.offsetWidth),h=(o/360+(a-t.clientX)/(Ei(n).offsetWidth*r))*e.frames;e.onturn?.(h)}function c(){r&&i.releasePointerCapture(r),i.removeAttribute("data-panning"),i.removeEventListener("pointermove",h),i.removeEventListener("pointerup",c)}const l=jt(()=>-e.currentRotation/360*(Ei(n)?.offsetWidth??0));var d=Oo(),u=ke(d),m=t=>{var i=zo(),s=ke(i);q(i),Ye(t=>ns(s,`${t??""}º`),[()=>Math.round(10*e.currentRotation)/10]),Gi(t,i)};vs(u,t=>{e.degrees&&t(m)}),q(d),fr(d,t=>oe(n,t),()=>Ei(n)),Ye(()=>Us(d,`--micrio-dial-offset:${Ei(l)??""}px;`)),Oi("pointerdown",d,function(t){t.stopPropagation(),t.preventDefault(),0==t.button&&(i.addEventListener("pointermove",h),i.addEventListener("pointerup",c),i.setAttribute("data-panning",""),i.setPointerCapture(r=t.pointerId),o=e.currentRotation,a=t.clientX)},!0),Gi(t,d),it()}(t,{get currentRotation(){return Ei(Z)},get frames(){return Y},get degrees(){return Ei(e)},onturn:t=>J(t)})}},l=t=>{const e=jt(()=>Y),i=jt(()=>c.length),s=jt(()=>Ei(e)>24),a=jt(()=>Ei(s)?Math.max(1,Math.ceil(Ei(e)/24)):1),o=jt(()=>Ei(e)>1?Ei(B)/(Ei(e)-1)*100:0);var h=Yo();let l;var d=ke(h);{let t=jt(()=>0==Ei(B));pa(d,{type:"arrow-left",get title(){return r().galleryPrev},className:"gallery-btn",onpointerdown:t=>0===t.button&&J(Ei(B)-1),get disabled(){return Ei(t)}})}var u=Me(d,2);let m;var g=ke(u),p=ke(g);q(g);var f=Me(g,2);bs(f,21,()=>F,ws,(t,i,r)=>{var n=Hi(),o=_e(n),h=t=>{var i=Fo();let n;Ye(()=>{n=qs(i,1,"tick micrio-gallery",null,n,{major:Ei(s)&&r%(5*Ei(a))==0,active:r===Ei(B),hover:r===Ei(Mt)}),Us(i,`left:${Ei(e)>1?r/(Ei(e)-1)*100:50}%`)}),Gi(t,i)};vs(o,t=>{Ei(s)&&r%Ei(a)!==0&&r!==Ei(e)-1&&r!==Ei(B)||t(h)}),Gi(t,n)}),q(f);var v=Me(f,2),w=t=>{var i=Vo(),s=ke(i,!0);q(i),Ye(t=>{Us(i,`left:${Ei(e)>1?Ei(Mt)/(Ei(e)-1)*100:50}%`),ns(s,t)},[()=>lt(Ei(Mt))]),Gi(t,i)};vs(v,t=>{Ei(Mt)>=0&&Ei(Mt)!==Ei(B)&&!Ei(U)&&t(w)});var y=Me(v,2);let b;ar(y,"aria-valuemin",1);var x=Me(y,2);let T;var k=ke(x);q(x),q(u),fr(u,t=>oe(ut,t),()=>Ei(ut));var _=Me(u,2);{let t=jt(()=>Ei(B)>=Ei(e)-1);pa(_,{type:"arrow-right",get title(){return r().galleryNext},className:"gallery-btn",onpointerdown:t=>0===t.button&&J(Ei(B)+1),get disabled(){return Ei(t)}})}q(h),Ye(t=>{l=qs(h,1,"micrio-gallery",null,l,{hidden:Ei(G)||xt(Qt,"$hidden",n)&&!xt(te,"$hover",n)&&!Ei(U)&&!Ei(H)}),m=qs(u,1,"micrio-gallery",null,m,{dense:Ei(s)}),Us(p,`width:${Ei(o)}%`),b=qs(y,1,"handle micrio-gallery",null,b,{dragging:Ei(U)}),Us(y,`left: ${Ei(gt)}px`),ar(y,"aria-valuemax",Ei(i)),ar(y,"aria-valuenow",(V[Ei(B)]?.[0]??Ei(B))+1),T=qs(x,1,"handle-label micrio-gallery",null,T,{dragging:Ei(U)}),Us(x,`left: ${Ei(gt)}px`),ns(k,`${t??""}${Ei(s)?` / ${Ei(i)}`:""}`)},[()=>lt(Ei(B))]),Ri("pointerover",h,()=>te.set(!0)),Ri("pointerout",h,t=>{t.currentTarget.contains(t.relatedTarget)||te.set(!1)}),Ri("focusin",h,()=>te.set(!0)),Ri("focusout",h,t=>{t.currentTarget.contains(t.relatedTarget)||te.set(!1)}),Oi("pointerdown",u,ft,!0),Oi("touchstart",u,ft,!0,!0),Ri("pointermove",u,St),Oi("pointerleave",u,()=>oe(Mt,-1)),Gi(t,h)};vs(s,t=>{L?t(a):A&&!A.noDial&&T?t(h,1):!k&&o().length>1&&t(l,2)}),Gi(t,e)};vs(se,t=>{D||t(re)}),Gi(t,ie),it(),a()}Xi(["pointerover","pointerout","focusin","focusout","pointermove"]);var Bo,qo,Wo={},Uo=vt(),Ho=vt(!1);function Go(t,e,i){qo&&(qo.setPosition?qo.setPosition(t,e,i):"positionX"in qo&&(qo.positionX.value=t,qo.positionY.value=e,qo.positionZ.value=i))}function jo(t,e,i){qo&&(qo.setOrientation?qo.setOrientation(t,e,i,0,1,0):"forwardX"in qo&&(qo.forwardX.value=t,qo.forwardY.value=e,qo.forwardZ.value=i))}function Zo(t,e){et(e,!0);const[i,s]=kt();let r=br(e,"volume",3,1);const{events:n,current:a}=Q("micrio"),o=xt(a,"$current",i),h=o.$info,c=h.height/h.width,l="AudioContext"in window||"webkitAudioContext"in window;const d=()=>Ho.set(!0),u=new Audio("data:audio/mpeg;base64,/+MYxAAAAANIAUAAAASEEB/jwOFM/0MM/90b/+RhST//w4NFwOjf///PZu////9lns5GFDv//l9GlUIEEIAAAgIg8Ir/JGq3/+MYxDsLIj5QMYcoAP0dv9HIjUcH//yYSg+CIbkGP//8w0bLVjUP///3Z0x5QCAv/yLjwtGKTEFNRTMuOTeqqqqqqqqqqqqq/+MYxEkNmdJkUYc4AKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq");u.volume=Jr.iOS?0:1e-4,l&&ps(()=>{let t,i;return i=Ho.subscribe(s=>{s&&(Bo||(!function(t){if(!Ro){if(Bo||(Bo="micrioAudioContext"in window?window.micrioAudioContext:"AudioContext"in window?new window.AudioContext:"webkitAudioContext"in window?new window.webkitAudioContext:null),!Bo)return console.warn("[Micrio] Your browser does not support the Web Audio API");(Ro=Bo.createGain()).connect(Bo.destination),Ro.gain.value=t,Uo.set(Bo),"upX"in(qo=Bo.listener)&&(qo.upX.value=0,qo.upY.value=1,qo.upZ.value=0)}}(r()),n.dispatch("audio-init")),Bo&&e.data.markers?.filter(t=>!!t.positionalAudio).length&&(t=o.state.view.subscribe(t=>{if(!t)return;const i=Math.max(0,1.05-o.camera.getScale());!function(t,i,s){if(e.is360){t*=2*-Math.PI,i-=.5,i*=-Math.PI;const e=10*(1-s),r=Math.cos(i)*Math.sin(t)*e,n=Math.sin(i)*e,a=Math.cos(i)*Math.cos(t)*e;Go(r,n,a);let o=r*r+n*n+a*a;o>0&&(o=1/Math.sqrt(o)),jo(r*o,n*o,a*o)}else Go(2*(t-.5),2*(.5-i)*c,s),jo(0,0,-1)}(t[0]+t[2]/2,t[1]+t[3]/2,i*(e.is360?1:1.5))})),i&&(i(),i=null))}),Bo||u.play().then(d).catch(()=>{n.dispatch("autoplay-blocked"),addEventListener("pointerup",d,{once:!0})}),()=>{t&&t(),i&&i(),removeEventListener("pointerup",d)}}),Re(()=>{Ro&&(Ro.gain.value=r())});var m=Hi(),g=_e(m),p=t=>{{let t=jt(()=>r()*(e.data.music.volume??1));!function(t,e){et(e,!0);let i=br(e,"loop",3,!0),s=br(e,"volume",3,1);const r=ue(new Audio);r.preload="none",r.loop=!1,r.onended=a;let n=-1;function a(){if(!i()&&n+1==e.list.length)return;const t=e.list[++n%e.list.length];r.src=Fn(t)??"",r.play()}ps(()=>(a(),()=>r.pause())),Re(()=>{r.volume=s()}),it()}(0,{get list(){return e.data.music.items},get loop(){return e.data.music.loop},get volume(){return Ei(t)}})}};vs(g,t=>{xt(Ho,"$interacted",i)&&xt(Uo,"$ctx",i)&&e.data.music?.items.length&&t(p)}),Gi(t,m),it(),s()}var Jo=Bi('<cite class="micrio-details"> </cite>'),Ko=Bi('<small class="micrio-details"> </small>'),Qo=Bi('<summary class="micrio-details"><!> <!></summary>'),th=Bi('<p class="micrio-details"><a rel="noopener noreferrer" target="_blank"> </a></p>'),eh=Bi("<details><!> <!> <!> <!></details>");function ih(t,e){et(e,!0);const i=()=>xt(o,"$current",r),s=()=>xt(e.data,"$data",r),[r,n]=kt(),{_lang:a,current:o}=Q("micrio");let h=ne(!1);function c(t){let e="cm";return t>=1e5?(e="km",t/=1e5):t>=100?(e="m",t/=100):t<1e-6?(e="nm",t*=1e7):t<.001?(e="µm",t*=1e4):t<1&&(e="mm",t*=10),t.toFixed(2)+" "+e}const l=jt(()=>i()?.$settings.cmWidth),d=jt(()=>i()?.$settings.cmHeight),u=jt(()=>s()?s()?.i18n?s().i18n[xt(a,"$_lang",r)]:s():void 0),m=jt(()=>Ei(u)?.title??xt(e.info,"$info",r)?.title??""),g=jt(()=>Ei(u)?.description),p=jt(()=>Ei(u)?.sourceUrl),f=jt(()=>Ei(u)?.copyright),v=jt(()=>Ei(l)&&Ei(d)?c(Ei(l))+" x "+c(Ei(d)):null);let w=ne(void 0);ps(()=>{Ei(w).ontoggle=()=>{oe(h,Ei(w).open,!0)}});var y=Hi(),b=_e(y),x=t=>{var e=eh();let i;var s=ke(e),n=t=>{var e=Qo(),i=ke(e),s=t=>{var e=Jo(),i=ke(e,!0);q(e),Ye(()=>ns(i,Ei(m))),Gi(t,e)};vs(i,t=>{Ei(m)&&t(s)});var r=Me(i,2),n=t=>{var e=Ko(),i=ke(e,!0);q(e),Ye(()=>ns(i,Ei(v))),Gi(t,e)};vs(r,t=>{Ei(v)&&t(n)}),q(e),Gi(t,e)};vs(s,t=>{(Ei(m)||Ei(v))&&t(n)});var a=Me(s,2),o=t=>{var e=Hi();Ms(_e(e),()=>Ei(g)),Gi(t,e)};vs(a,t=>{Ei(g)&&t(o)});var c=Me(a,2),l=t=>{var e=th(),i=ke(e),s=ke(i,!0);q(i),q(e),Ye(()=>{ar(i,"href",Ei(p)),ns(s,Ei(f)||Ei(p))}),Gi(t,e)};vs(c,t=>{Ei(p)&&t(l)});var d=Me(c,2),u=t=>{pa(t,{type:"close",get title(){return xt(Jn,"$i18n",r).close},onclick:()=>Ei(w).open=!1})};vs(d,t=>{Ei(h)&&t(u)}),q(e),fr(e,t=>oe(w,t),()=>Ei(w)),Ye(()=>i=qs(e,1,"micrio-details",null,i,{opened:Ei(h)})),Ds(3,e,()=>qn,()=>({duration:200})),Gi(t,e)};vs(b,t=>{(Ei(m)||Ei(g)||Ei(p))&&t(x)}),Gi(t,y),it(),n()}var sh=Bi('<div class="micrio-error"><!> </div>');var rh=Bi('<figcaption class="micrio-micrio-gallery"></figcaption>'),nh=Bi('<figure class="micrio-micrio-gallery"><micr-io></micr-io> <!></figure>',2);function ah(t,e){et(e,!0);const i=()=>xt(o,"$current",s),[s,r]=kt();let n=br(e,"startId",3,void 0);const{_lang:a,current:o}=Q("micrio");let h=ne(void 0),c=ne(0);const l=jt(()=>e.gallery[Ei(c)]),d=jt(()=>Ei(l)?.i18n?.[xt(a,"$_lang",s)]?.description??void 0);fs(()=>Ei(h)?.destroy());var u=nh(),m=ke(u);Ye(()=>or(m,"data-gallery",e.gallery.map(t=>`${t.micrioId},${t.width},${t.height},${t.isDeepZoom?"d":""}${t.isWebP?",w":t.isPng||!i()?.isV5&&t.src?.endsWith(".png")?",p":""}`).join(";"))),Ye(()=>or(m,"data-start",n())),Ye(()=>or(m,"data-path",i()&&i().$info&&i().$info.path)),or(m,"data-logo","false"),qs(m,1,"micrio-micrio-gallery"),fr(m,t=>oe(h,t),()=>Ei(h));var g=Me(m,2),p=t=>{var e=rh();Ms(e,()=>Ei(d),!0),q(e),Gi(t,e)};vs(g,t=>{Ei(d)&&t(p)}),q(u),Oi("gallery-show",m,t=>{oe(c,t.detail,!0)}),Gi(t,u),it(),r()}var oh=Bi("<!> <!>",1),hh=Bi("<aside><!> <!></aside>"),ch=Bi("<!> <!>",1),lh=Bi('<menu class="micrio-popover"></menu>'),dh=Bi('<h2 class="micrio-popover"> </h2>'),uh=Bi('<img alt=""/>'),mh=Bi("<!> <!> <!> <!>",1),gh=Bi('<menu class="right micrio-popover"></menu>'),ph=Bi("<!> <!> <!>",1),fh=Bi("<dialog><!> <!></dialog>");function vh(t,e){et(e,!0);const i=()=>xt(l,"$current",n),s=()=>xt(d,"$_lang",n),r=()=>xt(Jn,"$i18n",n),[n,a]=kt(),o=ue(Q("micrio")),{events:h,state:c,current:l,_lang:d}=o,u=i()?.$data,m=Object.keys(u?.revision??{[s()]:0});function g(){Ei(w)?.close()}const p=vt(!1);let f=ne(!0),v=s(),w=ne(void 0);ps(()=>{Ei(w).showModal(),Si().then(()=>{(Ei(w).querySelector("button.active")??Ei(w).querySelector("button"))?.focus()});const t=d.subscribe(t=>{t&&t!=v&&(oe(f,!1),v=t,setTimeout(()=>oe(f,!0),200))});return()=>{t()}});const y=jt(()=>e.popover.marker),b=jt(()=>Ei(y)?Vn(Ei(y),s()):void 0),x=jt(()=>e.popover.markerTour),T=jt(()=>e.popover.contentPage),k=jt(()=>{return Ei(T)?(t=Ei(T),e=s(),t.i18n?.[e]??t):void 0;var t,e}),_=jt(()=>Ei(T)&&Ei(k)&&!Ei(T)?.buttons?.length?!(!Ei(k).embed||Ei(k).content&&!(Ei(k).content.length<250)||Ei(T).image):void 0),M=jt(()=>Ei(T)?.image?"string"==typeof Ei(T).image?Ei(T).image:Ei(T).image.src:void 0),S=jt(()=>!!Ei(k)?.embed||!!Ei(M)),E=jt(()=>!!Ei(T)?.buttons?.find(t=>"close"==t.type)),I=jt(()=>!!e.popover.marker?.images&&e.popover.marker.images.length>0),A=jt(()=>!(!Ei(b)||!Ei(b).body)||Ei(I)),L=jt(()=>Ei(b)&&Ei(b).body||Ei(I)&&Ei(k)?.embed),P=jt(()=>!Ei(E)||Ei(x)&&null!=Ei(x).currentStep);var $=fh();let C;var D=ke($),z=t=>{var e=hh();let i;var s=ke(e),n=t=>{pa(t,{type:"close",get title(){return r().close},className:"close-popover",onclick:g})};vs(s,t=>{Ei(E)||t(n)});var a=Me(s,2),o=t=>{var e=oh(),i=_e(e),s=t=>{pa(t,{type:"arrow-left",get title(){return r().tourStepPrev},className:"prev-tour-step",onclick:()=>Ei(x)&&Ei(x).prev&&Ei(x).prev()})};vs(i,t=>{Ei(x).currentStep>0&&t(s)});var n=Me(i,2),a=t=>{pa(t,{type:"arrow-right",get title(){return r().tourStepNext},className:"next-tour-step",onclick:()=>Ei(x)&&Ei(x).next&&Ei(x).next()})};vs(n,t=>{Ei(x).currentStep<Ei(x).steps.length-1&&t(a)}),Gi(t,e)};vs(a,t=>{Ei(x)&&null!=Ei(x).currentStep&&t(o)}),q(e),Ye(()=>i=qs(e,1,"micrio-popover",null,i,{inside:Ei(T)?!Ei(_):!Ei(A)&&!Ei(b)?.embedUrl})),Gi(t,e)};vs(D,t=>{Ei(P)&&t(z)});var O=Me(D,2),R=t=>{var e=ch(),i=_e(e),s=t=>{so(t,{get src(){return Ei(b).embedUrl},get uuid(){return Ei(y).id},get figcaption(){return Ei(b).embedDescription},controls:!0,get autoplay(){return Ei(y).embedAutoPlay}})},r=t=>{ah(t,{get gallery(){return Ei(y).images}})};vs(i,t=>{Ei(b)&&Ei(b).embedUrl?t(s):Ei(y).images&&Ei(y).images.length&&t(r,1)});var n=Me(i,2),a=t=>{{let e=jt(()=>!Ei(b)||!Ei(b).embedUrl);mo(t,{get marker(){return Ei(y)},noEmbed:!0,noGallery:!0,get noImages(){return Ei(e)},onclose:g})}};vs(n,t=>{Ei(L)&&t(a)}),Gi(t,e)},X=t=>{ah(t,{get gallery(){return e.popover.gallery},get startId(){return e.popover.galleryStart}})},F=t=>{var e=ph(),r=_e(e),n=t=>{var e=lh();bs(e,21,()=>m,ws,(t,e)=>{{let i=jt(()=>Qn?.of(Ei(e))??Ei(e)),r=jt(()=>Ei(e)==s());pa(t,{onclick:()=>o.lang=Ei(e),get title(){return Ei(i)},get active(){return Ei(r)},children:(t,i)=>{W();var s=Ui();Ye(t=>ns(s,t),[()=>Ei(e).toUpperCase()]),Gi(t,s)},$$slots:{default:!0}})}}),q(e),Gi(t,e)};vs(r,t=>{m.length>1&&t(n)});var a=Me(r,2),h=t=>{var e=Hi(),i=_e(e),s=t=>{so(t,{get src(){return Ei(k).embed},get figcaption(){return Ei(k).content},controls:!0,autoplay:!0})};vs(i,t=>{Ei(f)&&t(s)}),Gi(t,e)},c=t=>{no(t,{children:(t,e)=>{var i=mh(),s=_e(i),r=t=>{var e=dh(),i=ke(e,!0);q(e),Ye(()=>ns(i,Ei(k).title)),Gi(t,e)};vs(s,t=>{Ei(k).title&&t(r)});var n=Me(s,2),a=t=>{so(t,{get src(){return Ei(k).embed},controls:!0})};vs(n,t=>{Ei(k).embed&&Ei(f)&&t(a)});var o=Me(n,2),h=t=>{var e=uh();Ye(()=>ar(e,"src",Ei(M))),Gi(t,e)};vs(o,t=>{Ei(M)&&t(h)});var c=Me(o,2),l=t=>{var e=Hi();Ms(_e(e),()=>Ei(k).content),Gi(t,e)};vs(c,t=>{Ei(k).content&&t(l)}),Gi(t,i)},$$slots:{default:!0}})};vs(a,t=>{Ei(_)?t(h):t(c,-1)});var l=Me(a,2),d=t=>{var e=gh();bs(e,21,()=>Ei(T).buttons,ws,(t,e)=>{{let r=jt(()=>"link"==Ei(e).type?Ei(e).action:void 0);pa(t,{get href(){return Ei(r)},get blankTarget(){return Ei(e).blankTarget},onclick:()=>function(t){g(),"close"!=t.type&&setTimeout(()=>{switch(t.type){case"marker":i()?.state.marker.set(t.action);break;case"mtour":o.state.tour.set(u?.markerTours?.find(e=>e.id==t.action));break;case"vtour":o.state.tour.set(u?.tours?.find(e=>e.id==t.action))}},200)}(Ei(e)),children:(t,i)=>{W();var r=Ui();Ye(()=>ns(r,Ei(e).i18nTitle[s()])),Gi(t,r)},$$slots:{default:!0}})}}),q(e),Gi(t,e)};vs(l,t=>{Ei(T).buttons&&Ei(T).buttons.length&&t(d)}),Gi(t,e)};vs(O,t=>{Ei(y)?t(R):e.popover.gallery?t(X,1):Ei(T)&&Ei(k)&&t(F,2)}),q($),fr($,t=>oe(w,t),()=>Ei(w)),Ye(()=>C=qs($,1,"micrio-popover",null,C,{page:!!Ei(T),article:!!Ei(T)&&!Ei(_),"has-media":Ei(S),gallery:!!e.popover.gallery})),Oi("close",$,function(){e.popover.contentPage?h.dispatch("page-closed"):Ei(x)?c.tour.set(void 0):e.popover.marker&&e.popover.image?.state.marker.set(void 0),c.popover.set(void 0)}),Oi("outrostart",$,()=>p.set(!0)),Gi(t,$),it(),a()}function wh(t,e){et(e,!0);const i=jt(()=>e.marker.positionalAudio),s=Li(()=>e.ctx).createGain();s.connect(Ro);const r=Q("micrio"),n=r.$current.$info,a=n.width,o=n.height,h=Li(()=>e.ctx).createPanner();h.panningModel="equalpower",h.rolloffFactor=1,h.coneOuterGain=0;function c(){if(s.gain.value=Ei(i).volume??1,e.is360){h.refDistance=2.75*Ei(i).radius,h.maxDistance=Ei(i).radius*(11/3);const t=e.marker.x*-Math.PI*2,s=(e.marker.y-.5)*-Math.PI,r=Math.cos(s)*Math.sin(t)*11,n=11*Math.sin(s),a=Math.cos(s)*Math.cos(t)*11;h.positionX.value=r,h.positionY.value=n,h.positionZ.value=a;let o=r*r+n*n+a*a;o>0&&(o=1/Math.sqrt(o)),h.orientationX.value=r*o,h.orientationY.value=n*o,h.orientationZ.value=a*o}else h.distanceModel="linear",h.positionX.value=2*(e.marker.x-.5),h.positionY.value=2*(.5-e.marker.y)*(o/a),h.positionZ.value=-.2,h.rolloffFactor=2,h.refDistance=Ei(i).radius*Ei(i).radius*10,h.maxDistance=5*Ei(i).radius}let l,d;function u(){l&&l.disconnect(),l=e.ctx.createBufferSource(),Ei(i).loop&&(Ei(i).repeatAfter>0?l.onended=()=>{d=setTimeout(u,1e3*Ei(i).repeatAfter)}:l.loop=!0),s.gain.value=Ei(i).volume??1,l.buffer=Wo[Ei(i).src],l.connect(h),l.start()}let m=ne(ue(JSON.stringify(Li(()=>e.marker.positionalAudio))));Re(()=>{const t=JSON.stringify(Ei(i));Ei(m)!=t&&oe(m,t,!0)&&c()}),ps(()=>(c(),h.connect(s),async function(){Ei(i).src&&(Wo[Ei(i).src]||(Wo[Ei(i).src]=await fetch(Ei(i).src).then(t=>t.arrayBuffer()).then(t=>e.ctx.decodeAudioData(t))),Ei(i).alwaysPlay&&Ei(i).repeatAfter>0?d=setTimeout(u,1e3*Ei(i).repeatAfter):u())}(),r.addEventListener("audio-update",c),()=>{r.removeEventListener("audio-update",c),l&&l.disconnect(),clearTimeout(d),h.disconnect(),s.disconnect()})),it()}var yh=Bi('<img alt="" class="micrio-marker"/>'),bh=Bi('<label data-scroll-through=""> </label>'),xh=Bi('<button data-scroll-through="" class="micrio-marker"><!> <!></button>'),Th=Bi("<div><!></div>"),kh=Bi("<!> <!>",1);function _h(t,e){et(e,!0);const i=()=>xt(d,"$current",h),s=()=>xt(T,"$tour",h),r=()=>xt(x,"$currentPopup",h),n=()=>xt(g,"$_lang",h),a=()=>xt(f,"$isMobile",h),o=()=>xt(Uo,"$ctx",h),[h,c]=kt(),l=Q("micrio"),{current:d,events:u,state:m,_lang:g,spaceData:p}=l,f=l.canvas.isMobile,v=m.markerHoverId,y=Q("inView"),b=Q("markerImages"),x=l.state.popup,T=m.tour;let k=br(e,"marker",15),_=br(e,"image",31,()=>ue(i())),M=br(e,"forceHidden",3,!1),S=br(e,"coords",3,void 0),E=br(e,"overlapped",3,!1);k().tags||k(k().tags=[],!0);const I=b.has(k().id);!I&&_()&&b.set(k().id,_());const A=!(!_().isOmni||!_().$settings.omni?.sideLabels||_().$settings._markers?.noTitles),L=t=>t.steps.findIndex(t=>t.startsWith(k().id))>=0,P=k().data??{},$=P._meta||{},C=_().$settings.omni;k().imageLayer&&k().imageLayer>(C?.layers?.length??1)-1&&delete k().imageLayer,i()?.$data?.markers?.find(t=>t.data?._micrioSplitLink?.markerId==k().id&&"none"!=t.popupType)&&(k(k().popupType="none",!0),k(k().noMarker=!0,!0)),"embedUrl"in k()&&k().embedUrl&&"embedInPopover"in k()&&k().embedInPopover&&k(k().popupType="popover",!0);const D=_().$settings._markers??{},z=!!_().$settings.doTourJumps,O=k().tags.join(" "),R="cluster"==k().type,X=!1===k().data?.showTitle||!!D.noTitles||!!C?.sideLabels,F=!!P.scales||!!_().$settings.markersScale,V=F&&!!D.titlesNoScale,Y=P._micrioSplitLink,N=!!D.keepPopupsDuringTourTransitions,B=/[?&]micrioNoTooltips/.test(location.search)||!!C?.sideLabels,W=$.gridAction,U=_().$settings?._markers?.autoStartTour?l.engine.images.map(t=>"camera"in t?t.$data?.markerTours?.find(L):void 0).filter(t=>!!t)[0]??p?.markerTours?.find(L):void 0,H=U?.steps.findIndex(t=>t.startsWith(k().id)),G=!!_().$settings?._markers?.autoStartTourAtBeginning;let j=!I&&(!!P.alwaysOpen||m.$marker==k())||m.$tour?.id==U?.id&&U?.currentStep==(H??0);let Z,J,K,tt=ne(ue(I&&_().state.$marker==k())),st=ne(!1),rt=ne(""),nt=ne(0),at=ne(0),ot=ne(1),ht=!1;function ct(){if(dt(),k().onclick)return k().onclick(k());if(!D.noMarkerActions)if("cluster"==k().type){if(k().view&&i()?.$info){const t=i().camera.getScale();_().camera.flyToView(k().view,{area:_().opts?.area,limitZoom:!0,margin:[20/i().$info.width*t,20/i().$info.height*t]})}}else _().state.marker.set(k())}function lt(){D.noMarkerActions||(Ei(Mt)?.parentNode?.scrollTo(0,0),dt(),K=setTimeout(()=>{const t=_().camera.getXY(k().x,k().y);!Ei(tt)&&(t[0]<0||t[0]>=l.offsetWidth||t[1]<0||t[1]>=l.offsetHeight||_().is360&&t[3]>4)&&_().camera.flyToCoo([k().x,k().y],{speed:2,limit:!0}).catch(()=>{})},150))}function dt(){clearTimeout(K)}const ut=()=>v.set(k().id),mt=()=>v.set(void 0);let gt;async function pt(){if(R)return;if(_().state.$marker!=k())return _().state.marker.set(k());if(D.noMarkerActions)return;if(U&&U.id!=s()?.id&&!s()){U.initialStep=G?0:H;const t=U.stepInfo?.[0];if(G&&t&&t.micrioId!=_().id){const e=l.canvases[0]?.grid;e?.images.find(e=>e.id==t.micrioId)?l.current.set(e.image):l.open(t.micrioId)}if(T.set(U),setTimeout(()=>$.gridAction=W,100),G&&null!=H&&H>0)return void _().state.marker.set(void 0);await Si()}var t;j=!1,u.dispatch("marker-opened",k()),s()&&"steps"in s()&&s().isSerialTour&&s().printChapters&&s().steps.findIndex(t=>t.startsWith(k().id))>=0&&k().videoTour||(Ei(Pt)?"popover"==k().popupType?(await Si(),l.state.popover.set({marker:k(),image:_(),markerTour:s()&&"steps"in s()?s():void 0})):k().videoTour&&!s()&&(T.set(k().videoTour),(t=T,new Promise(e=>{let i;i=t.subscribe(t=>{null==t&&(i?i():Si().then(()=>i()),e(t))})})).then(()=>_().state.marker.set(void 0))):Si().then(()=>x.set(k())));const e=P.micrioLink?.id;if(e&&Si().then(()=>{_().camera.stop();const t=Ln(l,e);t&&(_(_().openedView=void 0,!0),_().state.marker.set(void 0)),l.open(e,{vector:t?.vector})}),Y&&!ht&&!_().opts.secondaryTo){const t=l.canvases[0]?.grid;t?.lastPromise&&await t.lastPromise,gt=setTimeout(()=>{Y&&(J=l.open(Y.micrioId,{splitScreen:!0,splitTo:_(),isPassive:!(!Y.follows||l.state.$tour),startView:Y.view}),ht=!0)},200)}}let ft,vt,yt=ne(!1);function bt(){if(_().is360&&F)oe(rt,_().camera.getMatrix(k().x,k().y,1,1,0,0,0).join(","),!0);else{let i=Ei(nt),s=Ei(at);if(t=_().camera.getXYDirect(k().x,k().y,{radius:k().radius,rotation:k().rotation}),e=w(t,4),oe(nt,e[0],!0),oe(at,e[1],!0),oe(ot,e[2],!0),Z=e[3],_().is360)oe(st,Z>0);else if(_().isOmni&&C){if(null!=Ei(Ct)[0]&&null!=Ei(Ct)[1]&&null!=k().rotation){const t=C.frames/(C.layers?.length??1);let e=(_().swiper?.currentIndex??0)-(Ei($t)??0);e>t/2&&(e-=t),e<-t/2&&(e+=t),oe(st,e<=Ei(Ct)[0]||e>=Ei(Ct)[1],!0)}else C.distance&&oe(st,Z<0);C.sideLabels&&!D.noTitles&&Ei(It)?.title&&y&&(i!=Ei(nt)||s!=Ei(at))&&function(t,e){const i=l.canvas.element.offsetWidth,s=l.canvas.element.offsetHeight,r=!(t<0||t>i||e<0||e>s||Ei(st));(r||Ei(yt))&&y.update(s=>{const n=s.findIndex(([t])=>t==k());return r?n>=0?s[n]=[k(),t/i,e]:s.push([k(),t/i,e]):n>=0&&s.splice(n,1),oe(yt,r,!0),s})}(Ei(nt),Ei(at))}_().$settings.clusterMarkers&&S()&&S().set(k().id,[Ei(nt),Ei(at),E()?ft:ft=Ei(St)?.offsetWidth,E()?vt:vt=Ei(St)?.offsetHeight])}var t,e}function Tt(t){const e=t.detail;k(k().x=e.x,!0),k(k().y=e.y,!0),bt()}let _t=ne(void 0),Mt=ne(void 0),St=ne(void 0);const Et=Q("mediaPaused");ps(()=>{if(k().videoTour){const t="timeline"in k().videoTour?k().videoTour.timeline:k().videoTour.i18n?.[n()]?.timeline;t?.length&&k(k().view=t[0].rect,!0)}const t=[_().state.marker.subscribe(t=>{"string"==typeof t&&t==k().id?_().state.marker.set(k()):t==k()?async function(){if(Ei(tt))return;if(oe(tt,!0),dt(),D.noMarkerActions)return;u.dispatch("marker-open",k()),!s()||"steps"in s()&&(L(s())||s().cannotClose)||(T.set(void 0),await Si());const t=s()&&"steps"in s();Ei(Pt)||t&&N||(x.set(void 0),l.state.popover.set(void 0)),mt(),Y?.markerId&&(J||(J=l.canvases.find(t=>t.id==Y.micrioId)),J&&(ht=wt(J.visible),ht&&Y?.view&&J.camera.flyToView(Y.view,{isJump:!0}).catch(()=>{}))),void 0!==k().imageLayer&&_().state.layer.set(k().imageLayer);const e=U&&G&&U!=s()&&null!=H&&H>0;e&&delete $.gridAction;const i=k().view;e||!i||P.noAnimate||k().videoTour||$.gridView?pt():j?(_().camera.setView(k().view,{area:_().opts?.area}),pt()):_().camera.flyToView(k().view,{omniIndex:Ei($t),area:_().opts?.area,isJump:!!P.doJump||z&&!!m.$tour}).then(pt).catch(()=>{s()||_().state.marker.set(void 0)})}():P.alwaysOpen||(Ei(tt)&&function(){clearTimeout(gt),u.dispatch("marker-closed",k());const t=s()&&"steps"in s();if(s()||_().state.$marker||(k().videoTour||_().openedView?setTimeout(()=>_().camera.aniDoneAdd.push(()=>{wt(T)||_().state.$marker||Ei(_t)?.focus()}),10):Ei(_t)?.focus()),l.state.popover.set(void 0),!Ei(Pt)){r()!=k()||t&&N||x.set(void 0);const e=l.canvases.find(t=>t!=_()&&t.state.$marker);e&&Si().then(()=>{const t=e.state.$marker;t&&"popup"==t.popupType&&x.set(t)})}Y&&J&&setTimeout(()=>{const t=wt(l.state.marker);J&&Y.micrioId!=t?.data?._micrioSplitLink?.micrioId&&l.close(J)},210)}(),oe(tt,!1))})];return Ei(Lt)||(t.push(_().camera.image.state.view.subscribe(bt)),bt()),M()||Si().then(()=>{Ei(tt)&&!k().noMarker&&r()&&r()!=k()&&!s()?_().state.marker.set(void 0):(j||P.alwaysOpen)&&pt()}),k().htmlElement&&Ei(Mt)&&Ei(Mt).appendChild(k().htmlElement),()=>{for(clearTimeout(gt);t.length;)t.shift()?.()}});const It=jt(()=>Vn(k(),n())),At=jt(()=>!(Ei(It)?.title||Ei(It)?.body||Ei(It)?.bodySecondary||Ei(It)?.embedUrl||k().images&&k().images.length)),Lt=jt(()=>M()||k().noMarker),Pt=jt(()=>"popup"!=k().popupType||Ei(At)),$t=jt(()=>_().camera.getOmniFrame((k().rotation??0)+(k().backside?Math.PI:0))),Ct=jt(()=>k().visibleArc?[_().camera.getOmniFrame(k().visibleArc[0]),_().camera.getOmniFrame(k().visibleArc[1])]:[]),Dt=jt(()=>s()&&(!("steps"in s())&&!s().keepMarkers||D.hideMarkersDuringTour&&!xt(Et,"$tourPaused",h))&&!Ei(tt));Re(()=>{Ei(Dt)&&Ei(yt)&&y.update(t=>{const e=t.findIndex(t=>t[0]==k());return e>=0&&t.splice(e,1),t})});const zt=jt(()=>"default"==k().type?void 0:"link"==k().type?"link":"media"==k().type?"play":"cluster"==k().type?void 0:k().type??void 0),Ot=jt(()=>(null!=k().data?.customIconIdx?_().$settings._markers?.customIcons?.[k().data?.customIconIdx]:void 0)??k().data?.icon??D.markerIcon??void 0),Rt=jt(()=>!!Ei(zt)||!!Ei(Ot)),Xt=jt(()=>!("class"in k()&&""===k().class||!Ei(Rt)&&"default"!=k().type)),Ft=jt(()=>Ei(It)&&(!X||a()&&A)&&(Ei(It).label||Ei(It).title));var Vt=kh(),Yt=_e(Vt),Nt=t=>{var e=Th();let i;var s=ke(e),r=t=>{var e=xh(),i=ke(e),s=t=>{var e=yh();Ye(()=>ar(e,"src","string"==typeof Ei(Ot)?Ei(Ot):Ei(Ot).src)),Gi(t,e)},r=t=>{sa(t,{get name(){return Ei(zt)}})};vs(i,t=>{Ei(Ot)?t(s):Ei(zt)&&t(r,1)});var n=Me(i,2),a=t=>{var e=bh();let i;var s=ke(e,!0);q(e),fr(e,t=>oe(St,t),()=>Ei(St)),Ye(()=>{ar(e,"for",k().id),i=qs(e,1,"micrio-marker",null,i,{static:V}),ns(s,Ei(It)?.label||Ei(It)?.title)}),Gi(t,e)};vs(n,t=>{Ei(Ft)&&t(a)}),q(e),fr(e,t=>oe(_t,t),()=>Ei(_t)),Ye(()=>{ar(e,"title",B||R?null:Ei(It)?Ei(It).label||Ei(It).title:null),ar(e,"id",k().id)}),Ri("click",e,ct),Oi("focus",e,lt),Oi("blur",e,dt),Oi("mouseenter",e,ut),Oi("mouseleave",e,mt),Gi(t,e)};vs(s,t=>{k().htmlElement||t(r)}),q(e),fr(e,t=>oe(Mt,t),()=>Ei(Mt)),Rs(e,(t,e)=>{return s=e,(i=t).addEventListener("change",s),{destroy:()=>i.removeEventListener("change",s)};var i,s},()=>Tt),Ye(()=>{ar(e,"id",`m-${k().id}`),i=qs(e,1,Vs(O),"micrio-marker",i,{overlapped:E()&&!Ei(tt),cluster:R,behind:Ei(st),hovered:xt(v,"$hovered",h)==k().id,default:Ei(Xt),mat3d:!!Ei(rt),opened:Ei(tt),"micrio-link":!!P.micrioLink,"has-icon":Ei(Rt),"has-custom-icon":!!Ei(Ot)}),Us(e,Ei(rt)?`--mat:matrix3d(${Ei(rt)})`:Ei(nt)?`--x:${Ei(nt)}px;--y:${Ei(at)}px${F?`;--scale:${Ei(ot)}`:""}`:null)}),Gi(t,e)};vs(Yt,t=>{Ei(Lt)||!_()||Ei(Dt)||t(Nt)});var Bt=Me(Yt,2),qt=t=>{wh(0,{get marker(){return k()},get ctx(){return o()},get is360(){return _().is360}})};vs(Bt,t=>{k().positionalAudio&&o()&&(!k().positionalAudio.noMobile||a())&&(k().positionalAudio.alwaysPlay||Ei(tt))&&t(qt)}),Gi(t,Vt),it(),c()}Xi(["click"]);var Mh=Bi("<div><!></div>");function Sh(t,e){et(e,!0);const i=()=>xt(h,"$_lang",s),[s,r]=kt();let n=br(e,"settings",31,()=>ue({i18n:{}})),a=br(e,"image",15);const o=Q("micrio"),{_lang:h,spaceData:c}=o,l=a().$info,d=a().$settings,u=Mn(Li(()=>e.targetId))?.[2],m=Ln(o,Li(()=>e.targetId));m||console.error(`[Micrio Waypoint] Could not calculate vector for target ${Li(()=>e.targetId)}`);const{directionX:g,v:p,vN:f,vector:v}=m;let w=ne(void 0);const y=Math.abs(f[1])<.3,b=y?.65:.5+f[1]/10,x={x:g,y:b,baseScale:l.width/1024,scale:1,rotX:(1+(y?-(1-b):f[1]))*Math.PI/2,rotY:0,rotZ:0},T=n()?.coords??qr(x);let k,_=T.custom,M=_?T:x;function S(){d._markers?.noMarkerActions||(Ei(w).parentNode.scrollTo(0,0),clearTimeout(k),k=setTimeout(()=>{const t=a().camera.getXY(M.x,M.y);!Ei(L)&&(t[0]<0||t[0]>=o.offsetWidth||t[1]<0||t[1]>=o.offsetHeight||a().is360&&t[3]>4)&&a().camera.flyToCoo([M.x,M.y],{speed:2,limit:!0}).catch(()=>{})},150))}let E=ne(""),I=n().customIconIdx;const A=()=>{C.deleted?oe($,!0):(I!=C.settings.customIconIdx&&(n(n().customIconIdx=C.settings.customIconIdx,!0),I=n().customIconIdx),T.custom!=_&&(_=T.custom,M=_?T:x),oe(E,a().camera.getMatrix(M.x,M.y,M.baseScale*M.scale,1,M.rotX,M.rotY,M.rotZ,0,1,1,!0).join(","),!0))};let L=ne(!1);function P(){d._markers?.noMarkerActions||(oe(L,!0),a(a().openedView=void 0,!0),a().state.marker.set(void 0),o.open(e.targetId,{vector:v}))}let $=ne(!1);const C={coords:T,settings:n()};A(),ps(()=>{C.el=Ei(w),Ei(w)._iface=C,o.dispatchEvent(new CustomEvent("wp-print",{detail:C}));const t=a().state.view.subscribe(A);return()=>t()});const D=jt(()=>n().i18n?.[i()]?.title||u?.i18n?.[i()]?.title),z=jt(()=>c?.icons?.[n().customIconIdx??-1]);var O=Hi(),R=_e(O),X=t=>{var i=Mh();let r;var n=ke(i);{let t=jt(()=>Ei(z)?void 0:"arrow-up"),e=jt(()=>Ei(D)??xt(Jn,"$i18n",s).waypointFollow);pa(n,{get type(){return Ei(t)},get icon(){return Ei(z)},onclick:P,onfocus:S,get title(){return Ei(e)}})}q(i),fr(i,t=>oe(w,t),()=>Ei(w)),Ye(()=>{Us(i,`--matrix: matrix3d(${Ei(E)??""})`),ar(i,"id",`w-${e.targetId}`),r=qs(i,1,"micrio-waypoint",null,r,{clicked:Ei(L),active:Ei(L),"direction-up":p[1]<0,"direction-down":p[1]>0})}),Ds(3,i,()=>qn),Gi(t,i)};vs(R,t=>{Ei($)||t(X)}),Gi(t,O),it(),r()}var Eh,Ih=class{constructor(t){if(this.image=t,this.center=[0,0,1],this.view=[0,0,1,1],this.rotationY=0,this.aniDoneAdd=[],this.cooToArea=(t,e,i)=>({x:i[0]+t*(i[2]-i[0]),y:i[1]+e*(i[3]-i[1])}),this.getView=()=>this.view,this.getViewRaw=()=>this._view,this.getViewLegacy=()=>{if(this._engineCanvas)return[this._view[0]-this._view[2]/2,this._view[1]-this._view[3]/2,this._view[0]+this._view[2]/2,this._view[1]+this._view[3]/2]},this.getCoo=(t,e,i=!1,s=!1)=>this.getCooDirect(t,e,i,s).slice(0).map(t=>Math.round(1e6*t)/1e6),this.getXY=(t,e,i=!1,s,r,n)=>this.getXYDirect(t,e,{abs:i,radius:s,rotation:r,noTrueNorth:n}).slice(0),this.getScale=()=>this.center[2]??1,this.setScale=t=>this.setCoo(this.center[0],this.center[1],t),this.getCoverScale=()=>this._engineCanvas?.camera.coverScale??1,this.getMinScale=()=>this._engineCanvas?.camera.minScale??.1,this.isZoomedIn=()=>!!this._engineCanvas?.isZoomedIn(),this.isZoomedOut=(t=!1)=>!!this._engineCanvas?.isZoomedOut(t),this.getCoverLimit=()=>!!this._engineCanvas?.coverLimit,this.flyToView=(t,e={})=>new Promise((i,s)=>{if(!this._engineCanvas)return s(new Error("engine not ready"));let{centerX:r,centerY:n,width:a,height:o}=rn.toCenterJSON(t);if(2==e.margin?.length&&(r+=e.margin[0],n+=e.margin[1],a-=2*e.margin[0],o-=2*e.margin[1]),e.area){const t=this.cooToArea(r,n,e.area);r=t.x,n=t.y,a*=e.area[2]-e.area[0],o*=e.area[3]-e.area[1]}if(e.prevView){const t=rn.toCenterJSON(e.prevView);this._c.ani.setStartView(t.centerX,t.centerY,t.width,t.height,!1)}if(this.image.$settings.omni?.frames){const i=this.image.$settings.omni.layers?.length??1,s=this.image.$settings.omni.frames/i;if(null==e.omniIndex){const i=t[4]?t[4]:Array.isArray(t)&&void 0!==t[5]?t[5]:void 0;void 0!==i&&(e.omniIndex=Math.round(Br(i/(2*Math.PI))*s))}null!=e.omniIndex&&(e.omniIndex=Br(e.omniIndex,s))}const h=this._c.camera.flyTo(r,n,a,o,e.duration??-1,e.speed??-1,e.progress??0,!!e.isJump,!!e.limit,!!e.limitZoom,e.omniIndex??0,Ao.Camera.TimingFunction[e.timingFunction??"ease"],performance.now());this.image.engine.render(),0==h?i():this.setAniPromises(i,s)}),this.flyToFullView=(t={})=>this.flyToCoo([.5,.5,this.getMinScale()],t),this.flyToCoverView=(t={})=>{const e=this.image.$settings.focus??[.5,.5];return e[2]=this.getCoverScale(),this.flyToCoo(e,t)},this.flyToCoo=(t,e={})=>new Promise((i,s)=>{if(!this._engineCanvas)return s(new Error("engine not ready"));const r=Ao.Camera.TimingFunction[e.timingFunction??"ease"];e.duration=this._c.camera.setCoo(t[0],t[1],t[2]||this.center[2],e.duration??-1,e.speed??-1,e.limit??!1,r,performance.now()),this.image.engine.render(),0==e.duration?i():this.setAniPromises(i,s)}),this.zoom=(t,e=0,i=void 0,s=void 0,r=1,n=!1)=>new Promise((r,a)=>{if(!this._engineCanvas)return a(new Error("engine not ready"));const o=this.getXY(this.center[0],this.center[1]);if(null==i&&(i=o[0]),null==s&&(s=o[1]),this.image.album&&!this.image.album.hooked)return r();e=this._c.camera.zoom(t,i,s,e,n,performance.now()),this.image.engine.render(),0==e?r():this.setAniPromises(r,a)}),this.zoomIn=(t=1,e=250,i=1)=>this.zoom(200*-t,e,void 0,void 0,i).catch(()=>{}),this.zoomOut=(t=1,e=250,i=1)=>{const s=this.image.engine.micrio.canvas.viewport,r=s.width/s.height,n=this.image.$info.width/this.image.$info.height;return this.zoom(t*(400/Math.max(1,r/n/2)),e,void 0,void 0,i).catch(()=>{})},this.getDirection=()=>this._engineCanvas?this._c.webgl.yaw:0,this.getPitch=()=>this._engineCanvas?this._c.webgl.pitch:0,!t.is360){const e=t.state.$view;e&&t.$info?.width&&Si().then(()=>this.setView(e))}}bindEngineCanvas(t){this._engineCanvas=t}assign(t,e,i,s){this._view=t,this._xy=e,this._coo=i,this._mat=s}get _c(){return this._engineCanvas}_getXY(t,e,i,s,r){const n=this._c;n.is360?n.webgl.getXYZ(t,e):void 0===r||isNaN(r)?n.camera.getXY(t,e,!!i):n.camera.getXYOmni(t,e,s??0,r,!!i)}_getCoo(t,e,i,s){const r=this._c;r.is360?r.webgl.getCoo(t,e):r.camera.getCoo(t,e,!!i,!!s)}_setMinScale(t){const e=this._c;e.camera.minScale=t,e.camera.correctMinMax(),e.camera.setView(),e.webgl.update()}viewChanged(){const t=this._view,e=this.center.join(","),i=this.getCoo(0,0);this.view[0]=t[0]-t[2]/2,this.view[1]=t[1]-t[3]/2,this.view[2]=t[2],this.view[3]=t[3],this.center[0]=t[0],this.center[1]=t[1],this.center[2]=i[2],this.image.is360&&(this.center[3]=i[3],this.center[4]=i[4]),this.image.isOmni&&(this.center[5]=this.image.swiper?.currentIndex),(this.center.join(",")!=e||this.image.engine.micrio.canvas.resizing||this._engineCanvas?.areaAnimating())&&this.image.state.view.set(this.view)}getXYDirect(t,e,i={}){const s=this.image.is360&&!i.noTrueNorth?-this.rotationY/(2*Math.PI):0;return this._getXY(t-s,e,!0===i.abs,i.radius,i.rotation),this._xy}getCooDirect(t,e,i=!1,s=!1){if(i){const i=this.image.engine.micrio.getBoundingClientRect();t-=i.left,e-=i.top}return this._getCoo(t,e,!0===i,!0===s),this._coo}setView(t,e={}){if(!this._engineCanvas)return;let{centerX:i,centerY:s,width:r,height:n}=rn.toCenterJSON(t);if(e.area){const t=this.cooToArea(i,s,e.area);i=t.x,s=t.y,r*=e.area[2]-e.area[0],n*=e.area[3]-e.area[1]}this._c.setView(i,s,r,n,!!e.noLimit,!1,e.correctNorth),e.noRender||this.image.engine.render()}setCoo(t,e,i=this.center[2]??1){this._engineCanvas&&(this._c.camera.setCoo(t,e,i,0,0,!1,0,performance.now()),this.image.engine.render())}getMatrix(t,e,i,s,r,n,a,o,h,c,l){return this._engineCanvas?(this._c.getMatrix(t,e,i??1,s??10,r||0,n||0,a||0,o||0,h??1,c??1,!!l),this._mat):new Float32Array(16)}setMinScale(t){this._engineCanvas&&this._setMinScale(t)}setMinScreenSize(t){!this.image.album&&this._engineCanvas&&(this._c.camera.minSize=Math.max(0,Math.min(1,t??1)))}setLimit(t){if(!this._engineCanvas)return;const e=rn.rectToCenterJSON(t);this._c.view.setLimit(e.centerX,e.centerY,e.width,e.height),this.image.engine.render()}setCoverLimit(t){this._engineCanvas&&(this._c.coverLimit=!!t,this._c.camera.correctMinMax())}stop(){this._engineCanvas?.aniStop()}pause(){this._engineCanvas?.aniPause(performance.now())}resume(){this._engineCanvas?.aniResume(performance.now()),this.image.engine.render()}set360RangeLimit(t=0,e=0){this._engineCanvas&&(this._c.webgl.setLimits(t,e),this.image.engine.render())}aniIsKinetic(){return!!this._engineCanvas?.kinetic.started}setAniPromises(t,e){this.aniDone=t,this.aniAbort=e}pan(t,e,i=0,s={}){this._engineCanvas&&(this._c.camera.pan(t,e,i,!!s.noLimit,performance.now()),(i>0||s.render)&&this.image.engine.render())}setDirection(t,e){this._engineCanvas&&(this._c.setDirection(t,e??this._c.webgl.pitch,!1),this.image.engine.render())}setArea(t,e={}){if(this._engineCanvas){if(this.image.opts.isEmbed){if(this.image.ptr>0){this.image.opts.area=t;for(const e of this._c.images)if(e.localIdx>0)return void e.setArea(t[0],t[1],t[2],t[3])}}else this.image.opts.area=t,this._c.setArea(t[0],t[1],t[2],t[3],!!e.direct,!!e.noDispatch);e.noRender||this.image.engine.render()}}setRotation(t=0,e=0,i=0){if(this.image.opts.isEmbed&&this._engineCanvas&&this.image.engine.ready){for(const s of this._c.images)if(s.localIdx>0){s.rotX=t,s.rotY=e,s.rotZ=i;break}this.image.engine.render()}}getOmniRotation(){const t=this.image.$settings.omni;return t&&this._engineCanvas?(this.image.swiper?.currentIndex??0)/((t?.frames??1)/(t?.layers?.length??1))*Math.PI*2:0}getOmniFrame(t){const e=this.image.$settings.omni;if(!e||null==t)return;const i=e.frames/(e.layers?.length??1);return Math.floor(t/(2*Math.PI)*i)}getOmniXY(t,e,i){return this._engineCanvas?(this._c.camera.getXYOmniCoo(t,e,i,0,!1),this._xy):new Float64Array(5)}setOmniSettings(){const t=this.image.$settings.omni;if(!t||!this._engineCanvas)return;const e=this._c;e.omniDistance=-t.distance||0,e.omniFieldOfView=t.fieldOfView??0,e.omniVerticalAngle=t.verticalAngle??0,e.omniOffsetX=t.offsetX??0,this.image.state.view.set(this.view)}};!function(t){t.Main=class{get $tour(){return this._tour}get $marker(){return this._marker}constructor(t){this.micrio=t,this.tour=vt(),this.marker=vt(),this.markerHoverId=vt(),this.popup=vt(),this.popover=vt(),this.ui={controls:vt(!0),zoom:vt(!0),hidden:vt(!1),hover:vt(!1)},this.mediaState=new Map,this.tour.subscribe(t=>{"string"!=typeof t&&(this._tour=t)}),this.marker.subscribe(t=>{"string"!=typeof t&&(this._marker=t)})}get(){if(this.micrio.$current)return this.value={id:this.micrio.$current.id,c:this.micrio.canvases.map(t=>t.state.get())},this._tour&&(this.value.t=[this._tour.id],"instance"in this._tour&&this._tour.instance?this.value.t.push(this._tour.instance.currentTime,this._tour.instance.paused?"p":void 0):"steps"in this._tour&&void 0!==this._tour.currentStep&&this.value.t.push(this._tour.currentStep)),this.value}async set(t){if(this.value=t){if(void 0!==t.t?.[1]){const e=t.t[0],i=this.mediaState.get(e);i?(i.currentTime=t.t[1],i.paused="p"==t.t[2]):this.mediaState.set(e,{currentTime:t.t[1],paused:"p"==t.t[2]})}if(t.c?.forEach(t=>{if(void 0!==t[6]&&void 0!==t[7]){const e=t[6],i=this.mediaState.get(e);i?(i.currentTime=t[7],i.paused="p"==t[8]):this.mediaState.set(e,{currentTime:t[7],paused:"p"==t[8]})}}),t.t&&await this.setTour(t.t[0]),this.micrio.$current?.id!=t.id&&(this.micrio.open(t.id),this.micrio.$current&&await en(this.micrio.$current.data,{allowUndefined:!0})),this.micrio.canvases.forEach(e=>{e.state.set(t.c.find(t=>t[0]==e.id))}),t.t)return this.setTour(t.t[0],t.t[1]);{const e=t.c.find(e=>e[0]==t.id);e&&!e[5]&&this.micrio.$current&&this.micrio.$current.camera.flyToView(e.slice(1,5),{speed:2}).catch(()=>{})}}}async setTour(t,e){if(!this.micrio.$current)return;const i=await en(this.micrio.$current.data,{allowUndefined:!0});if(i){const s=i.markerTours?.find(e=>e.id==t)||i.tours?.find(e=>e.id==t);s&&"steps"in s&&void 0!==e&&(s.initialStep=e),this._tour?.id!=t&&this.tour.set(s)}}};t.Image=class{get $view(){return this._view}get $marker(){return this._marker}constructor(t){this.image=t,this.view=vt(void 0),this.marker=vt(void 0),this.layer=vt(0);const e=t.engine.micrio;let i,s,r;this.view.subscribe(n=>{this._view=n;const a=n?.toString();if(n&&a&&i!=a){const o={image:t,view:n};i=a;const h=n[2],c=n[3];(!s||!r||Math.abs(h-s+(c-r))>1e-5)&&(e.events.dispatch("zoom",o),s=h,r=c),e.events.dispatch("move",o)}}),this.marker.subscribe(t=>{const i=this._marker;this._marker=t&&"string"!=typeof t?t:void 0,this._marker?e.state.marker.set(this._marker):t||e.state.$marker!=i||e.state.marker.set(void 0)})}hookOmni(){const t=this.image;this.layer.subscribe(e=>{t.ptr<0||!t.engine.ready||(t.engine.setActiveLayer(t.ptr,e),t.engine.render())})}get(){const t=this._marker,e=t?Array.from(this.image.engine.micrio.state.mediaState).reverse().find(e=>e[0].startsWith(t.id)):null;return[this.image.id,...this._view?this._view.slice(0,4):[0,0,1,1],...t?[t.id,...e?[e[0],e[1].currentTime,e[1].paused?"p":void 0]:[]]:[void 0]].filter(t=>void 0!==t)}set(t){t?.length&&(this.view.set(t.slice(1,4)),t[5]?this._marker?.id!=t[5]&&this.marker.set(t[5]):this._marker&&this.marker.set(void 0))}}}(Eh||(Eh={}));var Ah=new class{constructor(){this.data=new Map,this.db=new Map,this.images=[],this.get=t=>new Promise((e,i)=>{const s=this.db.get(t);if(!s||!this.data.has(s[0]))return i(new Error("Could not get blob: "+t));const r=new FileReader;r.onload=()=>e(JSON.parse(r.result)),r.readAsText(new Blob([new Uint8Array(this.data.get(s[0]),s[1],s[2])]))}),this.getImage=async t=>new Promise((e,i)=>{const s=this.db.get(t);if(!s||!this.data.has(s[0]))return i(new Error("Could not get blob: "+t));const r=new Blob([new Uint8Array(this.data.get(s[0]),s[1],s[2])]);if("createImageBitmap"in self)e(self.createImageBitmap(r));else{let t=this.images.find(t=>!t.src);t||this.images.push(t=new Image),t.onload=()=>{t&&(e(t),requestAnimationFrame(()=>{t&&(URL.revokeObjectURL(t.src),t.src="")}))},t.src=URL.createObjectURL(r)}})}async load(t,e,i){if(this.data.has(e))return;const s=e.replace(/^.*\//,"").split(".")[0],r=/\/base$/.test(e),n=r||An(s),a=new XMLHttpRequest,o=await new Promise((s,r)=>{let o=0;a.responseType="arraybuffer",a.onprogress=t=>{o||(o=Number(a.getResponseHeader("Content-Length"))),i?.(Math.min(1,t.loaded/o))},a.onload=()=>{4===a.readyState&&200===a.status?(i?.(1),s(a.response)):r()},a.onerror=r,a.open("GET",t+e+(n?".bin":".mdp")),a.send()});if(!o)return;this.data.set(e,o);const h=r?e.split("/")[0]+"/":"";let c=0;for(;c<o.byteLength&&!(c+32>o.byteLength);){const i=this.parseHeader(new Uint8Array(o,c,32));if(i.name&&i.size>0)this.db.set(t+h+i.name.replace("./",""),[e,c+32,i.size]);else if(0===i.size&&!i.name)break;c+=32+i.size}}parseHeader(t){const e=(new TextDecoder).decode(t),i=t=>e.slice(s,s+=t).replace(/\x00/g,"").trim();let s=0;return{name:i(20),size:parseInt(i(12),8)}}},Lh=[],Ph=class t{get $info(){return this.__info}get $settings(){return wt(this.settings)}get $data(){return wt(this.data)}constructor(t,e,i={}){if(this.engine=t,this.attr=e,this.opts=i,this.uuid=Hr(),this.__info=qr(yn),this.settings=vt({}),this.data=vt(void 0),this.video=vt(void 0),this.visible=vt(!1),this.ptr=-1,this.baseTileIdx=-1,this.is360=!1,this.isVideo=!1,this.isOmni=!1,this.levels=1,this.dzLevels=0,this.noImage=!1,this.opacity=1,this.viewport=vt(),this.embeds=[],this.isV5=!1,this._loadedData=!1,this.embedElements=new Map,this.state=new Eh.Image(this),i.useParentCamera||(this.camera=new Ih(this)),this.id=(e.id??"").replace(fn,""),this.id.startsWith("external/")){const t=this.id.indexOf("/",this.id.indexOf("/")+1);-1!==t&&(this.id=this.id.substring(0,t+1)+encodeURIComponent(this.id.substring(t+1)))}this.isV5=An(this.id.split("/")[0]),this.infoBasePath=e.path&&e.forceInfoPath?e.path:void 0,this.dataPath=e.path||this.__info.path,this.isV5&&!e.path&&(this.dataPath="https://r2.micr.io/"),i.secondaryTo?(this.opacity=0,i.area=this.engine.micrio.canvas.viewport.portrait?[0,1,1,1]:[1,0,1,1],void 0===i.isPassive&&(i.isPassive=!0)):i.area||(i.area=[0,0,1,1]),this.preset=Mn(this.id);let s=!1;var r;this.info=(r=t=>{s?t(this.__info):this.load().then(t),s=!0},{subscribe:vt(void 0,r).subscribe});const n=this.engine.micrio,a=!!this.attr.revision;let o,h=wt(this.visible);i.isEmbed&&!a||this.visible.subscribe(t=>{t!=h&&(h=t,t&&!this._loadedData&&(!a&&this.isV5?(this._loadedData=!0,this.data.set(void 0)):this.loadData()),i.secondaryTo&&(i.isPassive&&(o?(o(),o=null):t&&(o=i.secondaryTo.state.view.subscribe(t=>{t&&!this.camera.aniDone&&this.camera.setView(t,{noLimit:!0})}))),t?n.events.dispatch("splitscreen-start",this):n.events.dispatch("splitscreen-stop",this)),n.visible.update(e=>(t?e.push(this):e.splice(e.indexOf(this),1),e)),t&&n.$current==this&&n.switching.set(!1))}),this.video.subscribe(t=>this._video=t),this.data.subscribe(t=>{t&&((t,e,i,s)=>{t&&(t.revision&&(t.revision=Object.fromEntries(Object.entries(t.revision??{}).filter(t=>Number(t[1])>0))),t.embeds?.forEach(t=>{t.uuid||(t.uuid=t.id??t.micrioId),an(t.video),an(t),s&&(t.area=rn.fromLegacy(t.area))}),t.markers?.forEach(t=>dn(t,e,i,s)),s&&t.tours?.forEach(un),t.music?.items?.forEach(an),t.pages?.forEach(cn))})(t,n.lang,this.isV5,on(this.__info))})}setError(t,e){const i=t instanceof Nr?t.displayMessage:e??(t instanceof Error?t.message:t)??"An unknown error has occurred";throw this.error=i,this.engine.micrio.printError(t instanceof Nr?t:i),this.engine.micrio.loading.set(!1),t instanceof Error?t:new Error(i)}async load(){let t=this.__info;const e=this.attr,i=this.engine.micrio;e.id&&e.width&&(e.settings&&Wr(yn.settings,e.settings,{noOverwrite:!0}),this.__info=t=e);let s=t.iiifManifest||e.iiifManifest;t.isIIIF=this.id.startsWith("http")||"iiif"==t.format;const r=!!e.settings?.forceDataRefresh;let n;if(!this.id||e.width&&e.height&&!s)this.preset?.[1]&&Wr(this.preset[1],t);else{const e=t=>this.setError(t,"string"==typeof t?t:'Image with id "'+this.id+'" not found, published, or embeddable.');Wr(this.preset?.[1]||await(t.isIIIF?_n(this.id):Sn(this.id,this.infoBasePath,r).then(e=>(e?.id&&!t.isIIIF&&this.id.split("/").length>=3&&this.id.startsWith("external/")&&(n=e.id.split("/").reverse()[0],(this.isV5=An(n))&&(this.dataPath=e.path||"https://r2.micr.io/")),e))).catch(e),t),!s&&t.iiifManifest&&(s=t.iiifManifest),t.isIIIF||(t.isIIIF=!!s),s&&Wr(await _n(s).catch(e),t),t.settings?._meta?.noLogo&&(t.settings.noLogo=!0),t.settings?._meta?.noSmoothing&&(t.settings.noSmoothing=!0)}if(t.id.startsWith("https://iiif.micr.io/")&&(t.id=t.id.slice(21)),7==this.id?.length){const e=In(this.id[1+In(this.id)%6]);t.is360=!!(e>>4&1)||t.is360,t.isWebP=!(3&e),t.isPng=2==(3&e),e>>3&1&&An(t.tilesId??this.id)&&(t.format="dz"),t.path||(t.path=`https://${e>>2&1?"eu":"r2"}.micr.io/`)}const a=this.isV5&&this.id.startsWith("i")&&!this.id.includes("/");a&&!t.tilesId&&(t.tilesId=this.id.slice(1));const o=vn.includes(t.id)||t.tilesId&&vn.includes(t.tilesId);if(Wr(e,t),n&&(this.id=t.id=n),this.tileBase=a&&!t.tileBasePath?.includes("micr.io")?t.tileBasePath??"https://b.micr.io/":o||a?gn:t.tileBasePath??t.path??(this.isV5?"https://r2.micr.io/":"https://b.micr.io/"),t.organisation?.baseUrl&&!e.path?(this.dataPath=t.path=t.organisation.baseUrl,a&&!o||(this.tileBase=this.dataPath)):"https://eu.micr.io/"==t.path&&(this.dataPath=t.path),t.settings?.omni&&(this.isOmni=!0,parseFloat(t.version)>=5&&(await Ah.load(this.tileBase??this.dataPath,(t.tilesId??t.id)+"/base",t=>i._ui?.setProps?.({loadingProgress:t})).catch(t=>this.setError(t,"Could not find object base package.")),t.settings.gallery||(t.settings.gallery={}),t.settings.gallery.type="omni",t.settings.gallery.archive=t.id)),!t.organisation?.branding||t.settings&&t.settings.noUI||this.loadStyle(this.dataPath+"style/"+t.organisation.slug+".css").then(()=>{const t=getComputedStyle(this.engine.micrio).getPropertyValue("--micrio-font-family")?.replace(/^'([^']+)'.*$/,"$1");t&&document.fonts.ready.then(()=>{document.fonts.check("16px "+t)||this.loadStyle(`https://fonts.googleapis.com/css2?family=${t}:ital,wght@0,300;0,400;0,500;0,600;0,800;1,300;1,400;1,500;1,600;1,800&display=swap`)})}),t.isIIIF)if(t.sequences&&t.sequences.length)this.parseIIIFSequenceV2(t,!!s);else if("Manifest"==t.type)this.parseIIIFSequenceV3(t);else{const e=(s||("@id"in t?t["@id"]:t.id)).replace("/info.json","");t.path=e.replace(/\/[^/]*$/,""),t.id=e.replace(/^.*\/([^/]*)$/,"$1")}if(t.spacesId&&!i.spaceData&&(i.spaceData="MICRIO_SPACE_DATA"in self?self.MICRIO_SPACE_DATA:await _n((this.infoBasePath??fn)+"spaces/"+t.spacesId+".json"),1==i.spaceData?.images.length&&delete i.spaceData),t.is360&&this.camera){const e=i.spaceData?.images.find(t=>t.id==this.id)?.rotationY;null!=e?this.camera.rotationY=e:null!=t.settings?._360?.trueNorth&&(this.camera.rotationY=(t.settings._360.trueNorth-.5)*Math.PI*2)}this.noImage=this.noImage||this.isOmni||!t.id&&!t.tilesId,this.extension=t.tileExtension||t.isPng&&"png"||t.isWebP&&"webp"||"jpg","dz"==t.format&&(t.isDeepZoom=!0),this.is360=!!t.is360,this.isVideo=!!t.isVideo;let h=this.isV5?wt(i._lang):("cultures"in t?void 0:e.lang)??void 0;if(this.isV5){if(t.revision){const e=Object.keys(t.revision);e.length&&!e.includes(h)&&(i.lang=e[0])}}else if(!t.settings?.skipMeta&&"cultures"in t){const e=(t.cultures||"").split(","),s=this.opts.isEmbed||!!this.opts.area,r=t.settings?.onlyPreferredLang||s;h=t.lang&&e.includes(t.lang)?t.lang:r?void 0:e[0],h&&!s&&(i.lang=h)}const c=t.settings;c&&!c?.noExternals&&await Promise.all([c.css?this.loadStyle(c.css.href):null,c.js?this.loadScript(c.js.href,h):null].filter(t=>!!t));for(let d=t.tileSize;d<Math.max(t.width,t.height);d*=2,this.levels++);let l=Math.max(t.width,t.height);do{this.dzLevels++}while((l/=2)>1);return c?.gallery?.archive&&(this.levels-=1-(c.gallery.archiveLayerOffset??0)),this.noImage||(this.thumbSrc=this.getTileSrc(this.levels,0,0)),i.events.dispatch("pre-info",t),this.isV5&&null!=t.revision&&!this.opts.isEmbed?await this.loadData():t.settings?.skipMeta||this.opts.isEmbed||this.isV5||i._lang.subscribe(t=>{!t||!this.id||"cultures"in this.__info&&(this.__info.cultures||"").split(",").includes(t)||(t=void 0),this.data.set(void 0),!t&&this.preset?.[2]&&(t="preset"),t&&this.id&&(this.isV5||(i.state.tour.set(void 0),this.state.marker.set(void 0)),this.preset?.[2]?this.enrichData(this.preset[2]).then(t=>{this.data.set(t),this.preset?.[2]&&(this.preset[2]=void 0)}):_n(this.dataPath+this.id+"/data."+t+".json").catch(()=>{}).then(t=>t&&this.enrichData(t).then(t=>this.data.update(e=>(Wr(t,e||(e={}),{mergeArrays:!0}),e)))))}),t.settings?.micrioSplitLink&&!this.opts.secondaryTo&&i.open({id:t.settings.micrioSplitLink,settings:{hookEvents:!1!==t.settings.secondaryInteractive}},{splitScreen:!0,isPassive:!t.settings.noFollow}),t.settings&&this.settings.set(t.settings),t.watermark&&this.engine.micrio.webgl.loadWatermark(t.watermark,t.settings?.watermarkOpacity),delete t.settings,this.isOmni&&this.state.hookOmni(),t}async loadData(){const t=this.$settings?.skipMeta||this.__info.settings?.skipMeta;if(this._loadedData||t)return Promise.resolve();this._loadedData=!0;const e=this.preset?.[2]??(this.isV5&&await _n(this.dataPath+this.id+"/data/pub.json",this.__info.settings?.forceDataRefresh).catch(()=>{}));e&&this.enrichData(e).then(t=>this.data.set(t))}getTileSrc(t,e,i,s){const r=this.__info;if(r){if(r.isDeepZoom&&(t=this.dzLevels-t),r.isIIIF){const s=r.tileSize,n=Math.pow(2,t)*s,a=Math.min(r.width,e*n),o=Math.min(r.height,i*n),h=Math.min(r.width-a,n),c=Math.min(r.height-o,n),l=Math.round(Math.min(s,h/n*s)),d=Math.round(Math.min(s,c/n*s));return`${r.path}/${r.id}/${[a,o,h,c].join(",")}/${[l,d].join(",")}/0/default.jpg`}if(r.settings?._360?.video?.src)throw"Video thumb";return`${this.tileBase}${r.tilesId||r.id}/${void 0!==s?s+"/":""}${t}/${e}${r.isDeepZoom?"_":"-"}${i}.${this.extension}`}}loadScript(t,e=""){return new Promise(i=>{if(Lh.includes(t)||document.querySelector('script[src="'+t+'"]'))i();else{Lh.push(t);const s=document.createElement("script");s.type="text/javascript",s.async=!0,s.defer=!0,s.micrioElement=this.engine.micrio,s.src=t.replace("$lang",e),s.onload=i,document.head.appendChild(s)}})}loadStyle(t){return new Promise(e=>{if(Lh.includes(t)||document.head.querySelector('link[href="'+t+'"]'))e();else{Lh.push(t);const i=document.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",t),i.onload=e,document.head.appendChild(i)}})}async enrichData(e){if(!e)return e;"error"in e&&(this.__info.error="403"==e.status?"Could not load image data. Are you logged in and do you have the right credentials?":e.error);const i=this.engine.micrio.lang,s=[];e.markers?.forEach(t=>{if(dn(t,i,!this.isV5,on(this.__info)),t.data?.micrioSplitLink){const e=t.data.micrioSplitLink.split(",").map(t=>t.trim()),i=t.data._micrioSplitLink={micrioId:e[0],markerId:e[1],follows:!!e[2]&&"false"!=e[2]};i.markerId&&s.push(i.micrioId)}}),e.markerTours?.length&&s.push(...e.markerTours.flatMap(t=>t.steps).map(t=>t.split(",")[1]).filter(t=>!!t&&t!=this.id));const r=t=>"autostart"in t&&t.autostart,n=e.markerTours?.find(r)||e.tours?.find(r);n&&(this.$settings.start={type:"steps"in n?"markerTour":"tour",id:n.id});const a=s.filter((t,e)=>s.indexOf(t)==e),o=t=>this.dataPath+(this.isV5?t+"/data/pub.json":t+"/data."+i+".json"),[h,c]=await Promise.all([Promise.all(a.map(t=>_n(o(t)))),Promise.all(a.map(t=>Sn(t,this.infoBasePath)))]);h.forEach((t,e)=>{const s=on(c[e]);t?.markers?.forEach(t=>dn(t,i,5==a[e].length,s))});const l=this.engine.micrio.spaceData;return e.markerTours&&(await Promise.all(e.markerTours.map(t=>En(this,t,i,e))),l&&(e.markerTours=e.markerTours.filter(t=>!t.steps.find(t=>t.includes(","))))),l?.markerTours&&await Promise.all(l.markerTours.filter(t=>!t.stepInfo).map(t=>En(this,t,i,e))),e.markers?.forEach(t=>{if(!t.data?._micrioSplitLink)return;const e=t.data?._micrioSplitLink?.markerId;if(e)for(let i=0;i<h.length;i++){const s=h[i]?.markers?.find(t=>t.id==e);if(s)return void(t.data._micrioSplitLink.view=s.view)}}),this.engine.micrio.events.dispatch("pre-data",{[this.id]:e,...Object.fromEntries(a.map((t,e)=>[t,h[e]]))}),h.forEach((e,i)=>{if(e){const r=this.engine.images.find(t=>t.id==a[i]);r&&r instanceof t&&!r.$data&&(s=o(r.id),!xn.has(s)&&!Tn.has(s))&&r.data.set(e)}var s}),e}setupIIIFGalleryContainer(t,e){this.noImage=!0;const i=this.engine.micrio,s=i.canvas.getRatio();t.width=Math.max(1,i.offsetWidth*s),t.height=Math.max(1,i.offsetHeight*s),t.settings||(t.settings={}),t.settings.gallery||(t.settings.gallery={}),t.settings.view=[0,0,1,1],t.gallery=[];const r=t.settings.gallery.startId,n=r?e.findIndex(t=>t==r):-1;return n<0?0:n}parseIIIFSequenceV2(e,i=!1){const s=e.sequences?.[0];if(!s)return;const r=s.canvases.map(t=>t.images[0]).map(t=>t.resource);if(i&&r.length>10){const i=this.setupIIIFGalleryContainer(e,r.map(t=>t.service["@id"]));return void r.forEach((s,r)=>e.gallery.push(new t(this.engine,{id:s.service["@id"],width:s.width,height:s.height,isPng:"image/png"==s.format,settings:{}},{area:[r-i,0,r-i+1,1]})))}const n="top-to-bottom"==s.viewingDirection;this.noImage=!0,e.width=n?Math.max(...r.map(t=>t.width)):r.reduce((t,e)=>t+e.width,0),e.height=n?r.reduce((t,e)=>t+e.height,0):Math.max(...r.map(t=>t.height)),e.settings||(e.settings={});let a=0;r.forEach(i=>{const s=[(1-i.width/e.width)/2,(1-i.height/e.height)/2];this.embeds.push(new t(this.engine,{id:i.service["@id"],width:i.width,height:i.height,isPng:"image/png"==i.format,settings:{}},{area:n?[s[0],a/e.height,1-s[0],(a+i.height)/e.height]:[a/e.width,s[1],(a+i.width)/e.width,1-s[1]]})),a+=n?i.height:i.width})}parseIIIFSequenceV3(e){const i=e.items?.flatMap(t=>t.items?.[0]?.items?.[0]?.body).filter(t=>!!t?.service?.[0]?.id).filter(t=>!!t);if(!i?.length)return;const s=this.setupIIIFGalleryContainer(e,i.map(t=>t.service[0].id));i.forEach((i,r)=>e.gallery.push(new t(this.engine,{id:i.service[0].id,width:i.width,height:i.height,isPng:"image/png"==i.format,tileSize:e.tileSize,settings:{}},{area:[r-s,0,r-s+1,1]})))}addEmbed(e,i,s={}){const r=i.slice(0),n=new t(this.engine,e,{area:r,isEmbed:!0,useParentCamera:s.asImage});return n.camera||(n.camera=this.camera),this.embeds.push(n),void 0===s.opacity&&(s.opacity=1),en(n.info).then(t=>{if(t){if("cover"==s.fit||"contain"==s.fit){const e=this.is360?2:1,i="cover"==s.fit,n=r[2]-r[0],a=r[3]-r[1],o=r[0]+n/2,h=r[1]+a/2,c=n/a*e,l=t.width/t.height;if(i&&l<c||!i&&l>=c){const t=n/l*e;r[1]=h-t/2,r[3]=h+t/2}else{const t=a*l/e;r[0]=o-t/2,r[2]=o+t/2}}this.engine.addEmbed(n,this,s),this.engine.render()}}),n}setEmbedMediaElement(t,e){e?this.embedElements.set(t,e):this.embedElements.delete(t)}getEmbedMediaElement(t){return this.embedElements.get(t)}splitStart(){const t=this.engine.micrio.canvas.viewport.portrait;this.opts.secondaryTo?.camera.setArea(t?[0,0,1,.5]:[0,0,.5,1],{noRender:!0}),this.camera.setArea(t?[0,.5,1,1]:[.5,0,1,1],{noRender:!0}),this.camera.setView(this.__info?.settings?.view??[0,0,1,1]),this.engine.render()}splitEnd(){const t=this.opts.area;if(!t)return;const e=t[2]-t[0],i=t[3]-t[1];if(Math.round(1e3*e)/1e3==0||Math.round(1e3*i)/1e3==0)return;const s=e>i;this.camera.setArea(s?[0,1,1,1]:[1,0,1,1],{noRender:!0}),this.opts.secondaryTo?.grid&&this.opts.secondaryTo.camera.aniDone||this.opts.secondaryTo?.camera.setArea([0,0,1,1],{noRender:!0}),this.engine.render()}fadeIn(t=!1){this.engine.fadeImage(this.ptr,1,t),this.engine.render()}fadeOut(t=!1){this.engine.fadeImage(this.ptr,0,t),this.engine.render()}},$h=class{constructor(t,e,i,s,r){this.engine=t,this.image=e,this.embed=i,this.paused=s,this.moved=r,this.ism3u=!1,this.hlsPlayer=void 0,this.usVid=void 0,this.vidRepeatTo=void 0,this.placeTo=void 0,this.autoplay=!0,this._vid=void 0,this.isMounted=!0,this.events={play:()=>this.setPlaying(!0),pause:()=>this.setPlaying(!1),playing:()=>{!this.image._video&&this._vid&&("requestVideoFrameCallback"in this._vid?this._vid.requestVideoFrameCallback(()=>{this._vid&&this.isMounted&&(this.image.video.set(this._vid),this.engine.render())}):this.image.video.set(this._vid))},canplayEvt:Jr.iOS?"loadedmetadata":"canplay",canplay:()=>{this._vid&&this.isMounted&&(this.autoplay&&!this.paused?(this._vid.play().catch(t=>console.warn("WebGL Embed video play() failed on canplay:",t)),this.moved()):this.embed.hideWhenPaused||(this.setPlaying(!0),Si().then(()=>{this.setPlaying(!1),setTimeout(()=>this._vid?.remove(),50)})))}},this.ism3u=!!i.video?.streamId&&!i.video?.transparent,this._vid=e._video,this.autoplay=i.video?.autoplay??!0;let n=!0;this.usVid=this.image.visible.subscribe(t=>{clearTimeout(this.placeTo),this.placeTo=t?setTimeout(()=>{this.isMounted&&(this._vid?(this.hook(),this.autoplay&&!this.paused&&this._vid.play().catch(t=>console.warn("WebGL Embed video play() failed",t))):this.load())},n?0:100):setTimeout(()=>this._vid?.pause(),0),n=!1})}unmount(){this.isMounted=!1,clearTimeout(this.placeTo),clearTimeout(this.vidRepeatTo),this._vid?.pause(),this.unhook(),this.usVid?.()}setPlaying(t){this._vid&&(this.paused=!t,t?this._vid.dataset.playing="1":delete this._vid.dataset.playing,this.engine.setImageVideoPlaying(this.image.ptr,t),this.embed.hideWhenPaused&&this.engine.fadeImage(this.image.ptr,t?1:0),t&&this.engine.render())}load(){if(!this.embed.video||this._vid)return;const t=this.ism3u?`https://videodelivery.net/${this.embed.video.streamId}/manifest/video.m3u8`:this.embed.video.src;t?(this._vid=document.createElement("video"),this._vid.crossOrigin="anonymous",this._vid.playsInline=!0,this._vid.width=this.embed.width,this._vid.height=this.embed.height,this._vid.muted=this.embed.video.muted,this.hook(),this.ism3u&&("MediaSource"in window||"ManagedMediaSource"in window)?tn("https://r2.micr.io/hls-1.6.15.min.js",void 0,"Hls"in window?{}:void 0).then(()=>{this.hlsPlayer=new window.Hls({abrEwmaDefaultEstimate:1e7,abrEwmaDefaultEstimateMax:5e7}),this.hlsPlayer.loadSource(t),this._vid&&this.hlsPlayer.attachMedia(this._vid)}).catch(t=>console.error("[Micrio GL Embed] Failed to load HLS.js:",t)):this._vid.src=t):console.error("[Micrio GL Embed] No video source found for embed:",this.embed.id)}hook(){if(!this.embed.video||!this._vid)return;const t=this.embed.video.loopAfter;this.embed.video.loop&&t?(this._vid.loop=!1,this._vid.onended=()=>{this.setPlaying(!1),this.vidRepeatTo=setTimeout(()=>this._vid?.play().catch(t=>console.warn("WebGL Embed video loop play() failed:",t)),1e3*t)},this._vid.onplay=()=>this.setPlaying(!0)):(this._vid.loop=this.embed.video.loop,this._vid.onended=null,this._vid.onplay=null),this._vid.parentNode||this.autoplay||this.ism3u||(this._vid.setAttribute("style","opacity:0;position:absolute;top:0;left:0;transform-origin:left top;transform:scale(0.1);pointer-events:none;"),document.body.appendChild(this._vid)),this._vid.addEventListener("play",this.events.play),this._vid.addEventListener("pause",this.events.pause),this._vid.addEventListener("playing",this.events.playing,{once:!0}),this._vid.addEventListener(this.events.canplayEvt,this.events.canplay,{once:!0})}unhook(){this._vid&&(this._vid.removeEventListener("play",this.events.play),this._vid.removeEventListener("pause",this.events.pause),this._vid.removeEventListener("playing",this.events.playing),this._vid.removeEventListener(this.events.canplayEvt,this.events.canplay),this._vid.onended=null,this._vid.onplay=null)}},Ch=Bi('<img alt="Embed" data-scroll-through="" class="micrio-embed"/>'),Dh=Bi('<button data-scroll-through="" aria-label="embed-button" class="micrio-embed"></button>');function zh(t,e){et(e,!0);const i=()=>xt(a,"$current",s),[s,r]=kt(),n=Q("micrio"),{current:a,engine:o,canvas:h,_lang:c}=n;let l=br(e,"embed",15);l().src?.startsWith("/r2")&&l(l().src="http://localhost:6100"+l().src,!0);const d=i(),u=d.$info;l().uuid||l(l().uuid=Hr(),!0);const m=l().uuid,g=d.is360,p=l().video?.autoplay??!0;let f=d.embeds.find(t=>t.uuid==m||t.$info?.title==m);const v=window.matchMedia("(dynamic-range: high)").matches||Jr.OSX,y=l().area,b=l().src?.toLowerCase().endsWith(".svg"),x=!(!l().width||!l().height)&&l().width*l().height<Math.pow(1024,2),T=/iPhone OS 14_/i.test(navigator.userAgent),k="data-embeds-inside-gl",_=n.getAttribute(k),M=!(b||T||!v&&!n.hasAttribute(k)&&l().video||"false"==_||(!l().micrioId||x&&l().src)&&(!l().video||l().video.controls||l().video.transparent)),S=!l().clickAction&&!l().frameSrc&&!Li(()=>e.marker),E="href"==l().clickAction?l().clickTarget:void 0,I=E&&l().clickTargetBlank;let A=ne(ue(y[2])),L=ne(ue(y[3])),P=ne(y[0]+y[2]/2),$=ne(y[1]+y[3]/2),C=ne(ue(l().scale||1)),D=ne(ue(l().rotX??0)),z=ne(ue(l().rotY??0)),O=ne(ue(l().rotZ??0)),R=ne(ue(l().scaleX??1)),X=ne(ue(l().scaleY??1)),F=ne(""),V=ne(0);function Y(){const t=l().area;oe(A,t[2],!0),oe(L,t[3],!0),oe(P,t[0]+Ei(A)/2),oe($,t[1]+Ei(L)/2),oe(C,l().scale||1,!0),oe(D,l().rotX??0,!0),oe(z,l().rotY??0,!0),oe(O,l().rotZ??0,!0),oe(R,l().scaleX??1,!0),oe(X,l().scaleY??1,!0);const e=M&&l().micrioId&&l().width,i=e?10:1;let s=Ei(A)*u.width/(l().width??100)/(M?l().width?Ei(A):1:Ei(C))*(g?Math.PI/2:1);const r=[];e&&l().width&&(s=Ei(A)/(l().width/u.width)*i*(g?Math.PI/2:1),r.push(`width:${l().width/i}px`)),r.push(`--ratio:${Ei(A)/Ei(L)*u.width/u.height};--scale:${s}`),b&&oe(F,Ei(F)+`height:${l().height}px`),oe(F,r.join(";"),!0),l().video&&(l().video.width>l().video.height?oe(V,Math.min(l().video.width,Ei(A)*u.width,2048),!0):oe(V,Math.min(l().video.height,Ei(L)*u.height,2048)/(l().video.height/l().video.width)))}Y();const N=jt(()=>Math.round(Ei(A)*u.width)),B=jt(()=>Math.round(Ei(L)*u.height));let q,W=ne(!1),U=ne(0),H=ne(0),G=ne(""),j=ne(!1),Z=ne("");function J(){if(!d.engine.ready)return;const t=d.camera.getXYDirect(Ei(P),Ei($));if((t=>{var e=w(t,3);oe(U,e[0],!0),oe(H,e[1],!0),q=e[2]})(t),g&&(oe(G,d.camera.getMatrix(Ei(P),Ei($),Ei(C),1,Ei(D),Ei(z),Ei(O),void 0,Ei(R),Ei(X)).join(","),!0),oe(j,t[3]>2)),oe(Z,(g?`transform:matrix3d(${Ei(G)});`:`--x:${Ei(U)}px;--y:${Ei(H)}px;--s:${q};`)+(void 0!==l().opacity&&1!==l().opacity?`--opacity:${l().opacity};`:"")),(l().video?.pauseWhenSmallerThan||l().video?.pauseWhenLargerThan)&&Ei(N)){const t=Ei(W);oe(W,function(){if(!l().video?.pauseWhenSmallerThan&&!l().video?.pauseWhenLargerThan)return!p;const t=q?Math.max(Ei(N)*q/h.viewport.width,Ei(B)*q/h.viewport.height):0;return!!(l().video.pauseWhenSmallerThan&&t<l().video.pauseWhenSmallerThan||l().video.pauseWhenLargerThan&&t>l().video.pauseWhenLargerThan)}(),!0),Ei(nt)?._vid&&Ei(W)!=t&&(Ei(W)?Ei(nt)._vid.pause():(d?.$settings?.embedRestartWhenShown&&(Ei(nt)._vid.currentTime=0),Ei(nt)._vid.play()))}}function K(){const t="markerId"==l().clickAction?l().clickTarget:e.marker?.id;t&&i()&&!E&&i().state.marker.set(t)}function tt(t){if(t&&"detail"in t){const e=t.detail;for(const t in e)l(l()[t]=e[t],!0)}Y(),J()}const st=vt(!1);l().video&&(l().video.controls||l(l().video.muted=!0,!0));const rt=M&&!!l().video;let nt=ne(void 0);const at=!M||!!l().clickAction;let ot=ne(void 0);Re(()=>{l().video&&l().id&&i()&&i().setEmbedMediaElement(l().id,Ei(ot)??Ei(nt)?._vid)});const ht=jt(()=>l().video||M?Ei(V):Ei(N)),ct=jt(()=>l().video?Ei(V)/(l().video.width/l().video.height):Ei(B)),lt=jt(()=>Ei(N)/Ei(ht));ps(()=>{const t=[];return M&&function(){const t=l().hideWhenPaused?.01:l().opacity??1,e=[l().area[0],l().area[1],l().area[0]+l().area[2],l().area[1]+l().area[3]];f&&f.ptr>=0?(f.camera.setArea(e),f.camera.setRotation(l().rotX,l().rotY,l().rotZ),o.fadeImage(f.ptr,t)):f=d.addEmbed({id:l().video?l().id:l().micrioId,title:m,width:l().width,height:l().height,isPng:l().isPng,isWebP:l().isWebP,isDeepZoom:l().isDeepZoom,path:u.tileBasePath??u.path,isSingle:!!l().video,isVideo:!!l().video,settings:{_360:{rotX:Ei(D),rotY:Ei(z),rotZ:Ei(O)}}},e,{opacity:t,asImage:!1}),rt&&en(f.visible,{targetValue:!0}).then(()=>{oe(nt,new $h(o,f,l(),Ei(W),J),!0)}),o.render()}(),(at||l().video?.pauseWhenSmallerThan||l().video?.pauseWhenLargerThan)&&t.push(d.state.view.subscribe(J)),()=>{for(Ei(nt)?.unmount(),f&&f.ptr>=0&&(o.fadeImage(f.ptr,0),o.render()),l().video&&l().id&&i()&&i().setEmbedMediaElement(l().id);t.length;)t.shift()?.()}});var dt=Hi(),ut=_e(dt),mt=t=>{var i=Hi();Os(_e(i),()=>E?"a":"div",!1,(t,i)=>{Rs(t,(t,e)=>{return s=e,(i=t).addEventListener("change",s),{destroy:()=>i.removeEventListener("change",s)};var i,s},()=>tt),hr(t,()=>({id:l().id?"e-"+l().id:void 0,style:Ei(Z),role:E?void 0:"figure",onclick:K,onkeypress:K,href:E,target:E&&I?"_blank":null,class:"",[js]:{"embed-container":!0,embed3d:g,"no-events":S,behind:g&&Ei(j)}}),void 0,void 0,void 0,"micrio-embed");var r=Hi(),n=_e(r),a=t=>{{let e=jt(()=>l().video.streamId&&!l().video.transparent?"cfvid://"+l().video.streamId:l().video.src),i=jt(()=>l().video.muted?0:1),s=jt(()=>!Ei(W)&&l().video.autoplay),r=jt(()=>l().video.transparent&&l().video.hasH265);so(t,{get forcePause(){return Ei(W)},get src(){return Ei(e)},get width(){return Ei(ht)},get height(){return Ei(ct)},get frameScale(){return Ei(lt)},get controls(){return l().video.controls},get destroying(){return st},get loop(){return l().video.loop},get loopDelay(){return l().video.loopAfter},get volume(){return Ei(i)},get autoplay(){return Ei(s)},get hasTransparentH265(){return Ei(r)},get _media(){return Ei(ot)},set _media(t){oe(ot,t,!0)}})}},o=t=>{so(t,{get src(){return l().frameSrc},get width(){return Ei(N)},get height(){return Ei(B)},get frameScale(){return l().scale},get autoplay(){return l().autoplayFrame},get destroying(){return st}})},h=t=>{var e=Ch();Ye(()=>{ar(e,"src",l().src),Us(e,Ei(F)),ar(e,"width",b?l().width:void 0),ar(e,"height",b?l().height:void 0)}),Gi(t,e)},d=t=>{var i=Dh();Ye(()=>{Us(i,Ei(F)),ar(i,"title",l().title||e.marker?.i18n?.[xt(c,"$_lang",s)]?.title)}),Gi(t,i)};vs(n,t=>{l().video&&!M?t(a):l().frameSrc?t(o,1):!M&&l().src?t(h,2):t(d,-1)}),Gi(i,r)}),Gi(t,i)};vs(ut,t=>{at&&(Ei(G)||Ei(U)||Ei(H))&&t(mt)}),Gi(t,dt),it(),r()}var Oh=Wi("<line></line>"),Rh=Bi('<article class="micrio-markers"><label> </label></article>'),Xh=Bi('<article class="micrio-markers"><label> </label></article>'),Fh=Bi('<svg class="micrio-markers"></svg> <aside class="micrio-markers"><section class="micrio-markers"></section> <section class="micrio-markers"></section></aside>',1),Vh=Bi("<!> <!>",1),Yh=Bi("<div><!> <!></div>"),Nh=Bi("<!> <!> <!> <!>",1);function Bh(t,e){et(e,!0);const i=()=>xt(m,"$settings",h),s=()=>xt(M,"$inView",h),r=()=>xt(_,"$hoveredId",h),n=()=>xt(f,"$switching",h),a=()=>xt(d,"$data",h),o=()=>xt(v,"$_lang",h),[h,c]=kt();let l=br(e,"image",15);const{data:d,info:u,settings:m}=l(),g=l().state.marker,p=l().engine.micrio,{switching:f,_lang:v,state:w}=p,y=p.canvas.isMobile,b=p.canvases[0]?.grid,x=b?.focussed,T=b?.markersShown,k=i().clusterMarkerRadius??16,_=w.markerHoverId,M=vt([]);tt("inView",M);const S=i()._markers??{},E=i().omni,I=!(S.noTitles||E?.sideLabels||!S.showTitles&&5!=l().id.length);let A=!1;function L(t){t?"string"==typeof t||l().openedView||t.noMarker||!t.view||(l(l().openedView=p.state.$tour&&!("steps"in p.state.$tour)?void 0:qr(l().state.$view),!0),A=!!t.videoTour):l().openedView&&!p.state.$tour&&setTimeout(()=>{Ei(j)||l().camera.aniDone||!l().openedView||l().camera.flyToView((t=>{const e=Math.min(1,t[2]),i=Math.min(1,t[3]),s=e/2,r=i/2;return[Math.max(s,Math.min(1-s,t[0]+t[2]/2))-s,Math.max(r,Math.min(1-r,t[1]+t[3]/2))-r,e,i]})(l().openedView),{speed:i()._markers?.zoomOutAfterCloseSpeed}).catch(()=>{}),l(l().openedView=void 0,!0),A=!1},A?250:10)}let P=!1;w.tour.subscribe(t=>{t&&"steps"in t?(P=!0,t.keepLastStep&&l(l().openedView=void 0,!0)):(t||l().openedView||!P||l().camera.stop(),P=!1)});const $=[];let C=ne(""),D=ne(!1),z=ne(!1);const O=t=>(t=t?.map(t=>Math.round(100*t)/100))&&oe(C,[...$,t[0]?`left: ${t[0]}px`:null,t[1]?`top: ${t[1]}px`:null,`width: ${t[2]}px`,`height: ${t[3]}px`].filter(t=>!!t).join(";")+";");let R=ne(ue([])),X=k,F=ne(ue([]));const V=new Map,Y=()=>{const t=function(t,e,i,s){if(!t)return{overlapped:[],clusterMarkers:[]};const r=t,n=[],a=r.length,o=[];for(let h=0;h<a;h++)for(let t=h+1;t<a;t++){if(r[t].tags?.includes("no-cluster"))continue;const s=e.get(r[h].id),a=e.get(r[t].id);if(s&&a&&Pn(s,a,i)){o.push(h,t);const e=n.find(e=>e.findIndex(e=>e==h||e==t)>-1);e?e.push(h,t):n.push([h,t])}}return{overlapped:o,clusterMarkers:n.map(t=>t.filter((e,i)=>t.indexOf(e)===i)).map(t=>{let e,i,n,a,o,h;if(s){o=t.reduce((t,e)=>t+r[e].x,0)/t.length,h=t.reduce((t,e)=>t+r[e].y,0)/t.length;const s=.3;e=Math.max(0,o-s/2),n=Math.max(0,h-s/2),i=Math.min(1,o+s/2),a=Math.min(1,h+s/2)}else e=Math.min(...t.map(t=>r[t].view?r[t].view[0]:r[t].x)),i=Math.max(...t.map(t=>r[t].view?r[t].view[0]+r[t].view[2]:r[t].x)),n=Math.min(...t.map(t=>r[t].view?r[t].view[1]:r[t].y)),a=Math.max(...t.map(t=>r[t].view?r[t].view[1]+r[t].view[3]:r[t].y)),o=(e+i)/2,h=(n+a)/2;const c=s?t.reduce((t,e)=>t+(r[e].rotation??0),0)/t.length:void 0,l=s?t.reduce((t,e)=>t+(r[e].radius??1),0)/t.length:void 0;return{title:t.length+"",type:"cluster",view:[e,n,Math.max(.1,i-e),Math.max(.1,a-n)],x:o,y:h,rotation:c,radius:l,id:t.sort((t,e)=>t-e).join(","),data:{},popupType:"none",tags:[]}})}}(Ei(J),V,X,l().isOmni);oe(R,t.overlapped,!0),oe(F,t.clusterMarkers,!0)},N=[];ps(()=>{const t=[];return en(u).then(e=>{if(!e)return;oe(D,!!e.is360);const s=i()._markers;if(!s)return;const r=parseFloat(e.version)>=4.2;s.markerIcon&&$.push(`--micrio-marker-icon: url("${s.markerIcon}")`),s.markerColor&&s.markerColor!=(r?"#ffffff":"#ffbb00")&&$.push("--micrio-marker-color: "+s.markerColor),s.markerSize&&s.markerSize!=(r?"16":"25")&&$.push("--micrio-marker-size: "+(X=Number(s.markerSize))+"px"),t.push(l().viewport.subscribe(O)),i().clusterMarkers&&(t.push(l().state.view.subscribe(Y)),t.push(l().data.subscribe(()=>Si().then(Y)))),!l().grid&&i()._markers?.zoomOutAfterClose&&t.push(l().state.marker.subscribe(L)),l().isOmni&&i().omni?.sideLabels&&!i()._markers?.noTitles&&t.push(y.subscribe(t=>{t&&Ei(z)?function(){for(;N.length;)N.shift()?.()}():t||Ei(z)||(N.push(l().state.view.subscribe(H)),N.push(_.subscribe(H)),N.push(g.subscribe(H))),oe(z,!t)}))}),()=>{for(;t.length;)t.shift()?.()}});const B=t=>!t.noMarker;let W=ne(void 0),U=ne(ue([]));function H(){Si().then(()=>{if(!Ei(W))return;const t=p.canvas,e=t.element.offsetWidth,i=[];s().forEach(([s,n,a])=>{const o=Ei(W).querySelector('label[for="'+s.id+'"]')?.getBoundingClientRect();o?.width&&o.width>0&&i.push([n*e,a,(n>=.5?o.left:o.right)-t.viewport.left,o.top+o.height/2-t.viewport.top,r()==s.id])}),oe(U,i,!0)})}const G=(t,e)=>t.i18n?t.i18n[e]?.title:t.title,j=jt(()=>b&&xt(x,"$focussed",h)!=l()&&T&&wt(T).indexOf(l())<0),Z=jt(()=>!n()&&p.spaceData?p.spaceData.links.filter(t=>t[0]==l().id||t[1]==l().id).map(t=>({targetId:t[0]==l().id?t[1]:t[0],settings:t[2]?.[l().id]})):void 0),J=jt(()=>Ei(j)?[]:a()?.markers?.filter(B)),K=jt(()=>Ei(j)?a()?.markers:a()?.markers?.filter(t=>!B(t))),Q=jt(()=>Ei(j)?[]:a()?.markers?.filter(t=>t.clickableArea)),st=jt(()=>!(!Ei(J)?.length&&!Ei(Z)?.length)),rt=jt(()=>[...s()].sort(([,,t],[,,e])=>t>e?1:t<e?-1:0));var nt=Nh(),at=_e(nt),ot=t=>{var e=Fh(),i=_e(e);bs(i,21,()=>Ei(U),ws,(t,e)=>{var i=Oh();let s;Ye(()=>{ar(i,"x1",Ei(e)[0]),ar(i,"y1",Ei(e)[1]),ar(i,"x2",Ei(e)[2]),ar(i,"y2",Ei(e)[3]),s=qs(i,0,"micrio-markers",null,s,{hovered:Ei(e)[4]})}),Gi(t,i)}),q(i);var s=Me(i,2),n=ke(s);bs(n,21,()=>Ei(rt).filter(([,t])=>t<.5),t=>t[0].id,(t,e)=>{var i=Rh(),s=ke(i);let n;var a=ke(s,!0);q(s),q(i),Ye(t=>{ar(s,"for",Ei(e)[0].id),n=qs(s,1,"micrio-markers",null,n,{hover:r()==Ei(e)[0].id}),ns(a,t)},[()=>G(Ei(e)[0],o())]),Oi("mouseenter",s,()=>_.set(Ei(e)[0].id)),Oi("mouseleave",s,()=>_.set(void 0)),Gi(t,i)}),q(n);var a=Me(n,2);bs(a,21,()=>Ei(rt).filter(([,t])=>t>=.5),t=>t[0].id,(t,e)=>{var i=Xh(),s=ke(i);let n;var a=ke(s,!0);q(s),q(i),Ye(t=>{ar(s,"for",Ei(e)[0].id),n=qs(s,1,"micrio-markers",null,n,{hover:r()==Ei(e)[0].id}),ns(a,t)},[()=>G(Ei(e)[0],o())]),Oi("mouseenter",s,()=>_.set(Ei(e)[0].id)),Oi("mouseleave",s,()=>_.set(void 0)),Gi(t,i)}),q(a),q(s),fr(s,t=>oe(W,t),()=>Ei(W)),Gi(t,e)};vs(at,t=>{Ei(z)&&Ei(rt).length&&!xt(g,"$currentMarker",h)&&t(ot)});var ht=Me(at,2),ct=t=>{var e=Hi();bs(_e(e),17,()=>Ei(Q),t=>t.id,(t,e)=>{var i=Hi(),s=_e(i),r=t=>{zh(t,{get embed(){return Ei(e).clickableArea},get marker(){return Ei(e)}})};vs(s,t=>{Ei(e).clickableArea&&t(r)}),Gi(t,i)}),Gi(t,e)};vs(ht,t=>{Ei(Q)&&t(ct)});var lt=Me(ht,2),dt=t=>{var e=Yh();let i;var s=ke(e),r=t=>{var e=Hi();bs(_e(e),17,()=>Ei(Z),t=>t.targetId,(t,e)=>{Sh(t,yr({get image(){return l()}},()=>Ei(e)))}),Gi(t,e)};vs(s,t=>{Ei(Z)&&Ei(Z).length&&t(r)});var a=Me(s,2),o=t=>{var e=Vh(),i=_e(e);bs(i,19,()=>Ei(J),t=>t.id,(t,e,i)=>{{let s=jt(()=>Ei(R).includes(Ei(i)));_h(t,{get marker(){return Ei(e)},get image(){return l()},get coords(){return V},get overlapped(){return Ei(s)}})}}),bs(Me(i,2),17,()=>Ei(F),t=>t.id,(t,e)=>{_h(t,{get marker(){return Ei(e)},get image(){return l()}})}),Gi(t,e)};vs(a,t=>{Ei(J)&&t(o)}),q(e),Ye(()=>{Us(e,Ei(st)?Ei(C):null),i=qs(e,1,"micrio-markers",null,i,{"show-titles":I,is360:Ei(D),inactive:Ei(j)||Ei(D)&&n()})}),Gi(t,e)};vs(lt,t=>{Ei(st)&&t(dt)});var ut=Me(lt,2),mt=t=>{var e=Hi();bs(_e(e),17,()=>Ei(K),t=>t.id,(t,e)=>{_h(t,{get marker(){return Ei(e)},get image(){return l()},forceHidden:!0})}),Gi(t,e)};vs(ut,t=>{Ei(K)&&t(mt)}),Gi(t,nt),it(),c()}var qh=Wi('<svg width="100" height="100" class="micrio-progress-circle"><circle fill="transparent" stroke="#e0e0e0" stroke-width="8px" class="micrio-progress-circle"></circle><circle fill="transparent" stroke="#00d4ee" stroke-width="8px" class="micrio-progress-circle"></circle></svg>');var Wh=Bi("<!> <!> <!>",1),Uh=Bi("<!> <!> <!>",1),Hh=Bi("<!> <!>",1),Gh=Bi("<!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!>",1);var jh=!self.createImageBitmap,Zh=URL.createObjectURL(new Blob(["let controller = null, prevUri = null;\nself.addEventListener('message', e => {\n\t// Handle abort message\n\tif(e.data == 'abort') return controller && controller.abort();\n\t// Create new AbortController for this fetch\n\tcontroller = new AbortController();\n\t// Fetch the image blob\n\tfetch(e.data.src, { signal: controller.signal })\n\t\t.then(r => r.blob())"+(jh?"\n\t\t// Fallback for older Safari: create Object URL\n\t\t.then(blob => {\n\t\t\t// Revoke previous Object URL to free memory\n\t\t\tURL.revokeObjectURL(prevUri);\n\t\t\t// Post Object URL back\n\t\t\tself.postMessage({src: (prevUri = URL.createObjectURL(blob, {type: e.data.type}))})\n\t\t})":"\n\t\t// If createImageBitmap is supported, use it (preferred)\n\t\t.then(blob => self.createImageBitmap(blob))\n\t\t// Post ImageBitmap back, transferring ownership\n\t\t.then(data => self.postMessage({data:data, src:e.data.src}, [data]))")+"\n\t\t// Handle fetch errors (including abort)\n\t\t.catch(err => self.postMessage({error: e.data.src+': '+err.message, type: err.name}))\n})"],{type:"text/javascript"})),Jh=Math.max(2,Math.min(6,(navigator.hardwareConcurrency||2)-1)),Kh=[],Qh=new Map,tc=new Map,ec=[],ic=new Map;for(let al=0;al<Jh;al++){const t=new Worker(Zh);t.onmessage=t=>rc(al,t.data.src,t.data.data,t.data.error,t.data.type),Qh.set(al,t),jh&&tc.set(al,new Image)}var sc=t=>new Promise((e,i)=>{ec.push([t,e,i]),function(){if(!ec.length)return;let t=0;for(;t<Jh&&Kh.includes(t);t++);if(t>=Jh)return;Kh.push(t);const e=ec.shift();if(!e)return void Kh.splice(Kh.indexOf(t),1);ic.set(t,e);const i=Qh.get(t);if(!i)return console.error(`[Micrio Texture] Worker ${t} not found!`),e[2]("Internal error: Worker not found"),void Kh.splice(Kh.indexOf(t),1);i.postMessage({src:e[0],type:"image/"+e[0].split(".").pop()})}()});function rc(t,e,i,s,r){const n=ic.get(t);if(null!=n)if(ic.delete(t),setTimeout(()=>{Kh.splice(Kh.indexOf(t),1)},50),s)n[2](s),"AbortError"!=r&&console.error(`[Micrio Texture] Error loading ${n[0]}: ${r} - ${s}`);else if(i)n[1](i);else if(e&&jh){const i=tc.get(t);if(!i)return void n[2]("Internal error: Image element fallback not found");i.onload=()=>{n[1](i)},i.onerror=()=>{n[2](`Failed to load image from Object URL: ${e}`)},i.src=e}else n[2](`Worker ${t} sent invalid message.`),console.error(`[Micrio Texture] Worker ${t} sent invalid message for ${n[0]}`);else console.warn(`[Micrio Texture] Received message from worker ${t} but no matching promise found.`)}function nc(){return Kh.length}function ac(t){const e=[...ic.entries()].find(e=>e[1][0]==t);if(null==e)return;const i=Qh.get(e[0]);i&&i.postMessage("abort")}var oc=Math.PI,hc=oc/2,cc=2*oc;function lc(t){return 1<<t}var dc=t=>function(t,e=1){return(t%e+e)%e}(t,1);function uc(t){return(t%cc+cc)%cc}function mc(t,e){const i=dc(t),s=dc(e)-i,r=s>0?s-1:s+1;return Math.abs(s)<=Math.abs(r)?s:r}var gc=class{constructor(t,e,i,s){this.isLinear=t===e&&i===s&&0===t&&1===i;const r=3*t,n=3*(i-t)-r;this.Cx=r,this.Bx=n,this.Ax=1-r-n;const a=3*e,o=3*(s-e)-a;this.Cy=a,this.By=o,this.Ay=1-a-o}bezier_x(t){return t*(this.Cx+t*(this.Bx+t*this.Ax))}bezier_y(t){return t*(this.Cy+t*(this.By+t*this.Ay))}bezier_x_der(t){return this.Cx+t*(2*this.Bx+3*this.Ax*t)}find_x_for(t){let e=t,i=0,s=0,r=0;for(;i<5&&(s=this.bezier_x(e)-t,r=this.bezier_x_der(e),0!==r);)e-=s/r,i++;return e}get(t){return this.isLinear?t:this.bezier_y(this.find_x_for(t))}},pc=new gc(.42,0,.58,1),fc=new gc(.42,0,1,1),vc=new gc(0,0,.58,1),wc=new gc(0,0,1,1),yc=class{constructor(t=0,e=0,i=0,s=0,r=0,n=0,a=0){this.x0=t,this.y0=e,this.x1=i,this.y1=s,this.layer=r,this.x=n,this.y=a}},bc=class{constructor(t,e=.5,i=.5,s=1,r=1,n=.5,a=.5,o=1,h=1){this.canvas=t,this.centerX=e,this.centerY=i,this.width=s,this.height=r,this.lCenterX=n,this.lCenterY=a,this.lWidth=o,this.lHeight=h,this.arr=new Float64Array(4),this.changed=!1,this.limitChanged=!1,this.toArray()}get x0(){let t=this.centerX;return this.canvas.is360&&(t=dc(t)),this.canvas.is360?dc(t-this.width/2):t-this.width/2}get y0(){return this.centerY-this.height/2}get x1(){let t=this.centerX;return this.canvas.is360&&(t=dc(t)),this.canvas.is360?dc(t+this.width/2):t+this.width/2}get y1(){return this.centerY+this.height/2}get lX0(){return this.lCenterX-this.lWidth/2}get lY0(){return this.lCenterY-this.lHeight/2}get lX1(){return this.lCenterX+this.lWidth/2}get lY1(){return this.lCenterY+this.lHeight/2}get yaw(){return(this.centerX-.5)*oc*2}get pitch(){return(this.centerY-.5)*oc}get aspect(){return this.width/this.height}get size(){return Math.sqrt(this.width*this.width+this.height*this.height)*(1/Math.sqrt(2))}set(t,e,i,s,r=!1){if(r){const t=Math.min(1,this.width)/Math.min(1,this.height);i/s>1.5*t&&i<this.width&&(s=i/t)}this.centerX=t,this.centerY=e,this.width=i,this.height=s,this.toArray(),this.changed=!0}setArea(t,e,i,s){this.centerX=(t+i)/2,this.centerY=(e+s)/2,this.width=i-t,this.height=s-e,this.toArray()}setLimit(t,e,i,s){this.lCenterX=t,this.lCenterY=e,this.lWidth=i,this.lHeight=s,this.changed=!0,this.limitChanged=!0}copy(t,e=!1){this.centerX=t.centerX,this.centerY=t.centerY,this.width=t.width,this.height=t.height,e||(this.lCenterX=t.lCenterX,this.lCenterY=t.lCenterY,this.lWidth=t.lWidth,this.lHeight=t.lHeight),this.changed=!0,this.toArray()}getPerspective(){const t=this.canvas,e=t.webgl;return e.maxPerspective-.5/(this.height*t.height/t.el.height)*oc/e.scaleY}getScale(){const t=this.canvas;return 1/Math.max(this.width*t.width/t.el.width,this.height*t.height/t.el.height)}getDistance(t,e){e&&this.canvas.currentArea.isFull()&&(t.correctAspectRatio(),this.correctAspectRatio());return(Math.abs(this.centerX-t.centerX)+Math.abs(this.centerY-t.centerY)+Math.abs(this.width-t.width)+Math.abs(this.height-t.height))/4}limit(t,e=!1,i=!1){const s=this.canvas,r=s.camera.minSize,n=this.getScale();if(r<1&&n<s.camera.minScale&&!e){const t=1/r,e=Math.min(t,this.width),i=Math.min(t,this.height);return this.centerX=.5,this.centerY=.5,this.width=e,this.height=i,void this.toArray()}const a=t?Math.max(1,n/Math.max(s.camera.minScale,s.maxScale/s.el.scale)):1,o=this.lWidth,h=this.lHeight,c=Math.min(o,this.width*a),l=Math.min(h,this.height*a);if(t&&(a>1||e&&n<s.camera.minScale)&&(this.width=c,this.height=l),(o<1||h<1)&&(this.width=Math.min(this.width,o),this.height=Math.min(this.height,h)),e)return void this.toArray();const d=Math.min(1,this.width)/2,u=this.lWidth/2;this.canvas.is360?this.centerX=dc(this.centerX):i||(this.centerX=Math.max(this.lCenterX-u+d,Math.min(this.centerX,this.lCenterX+u-d)));const m=Math.min(1,this.height)/2,g=this.lHeight/2;i||(this.centerY=Math.max(this.lCenterY-g+m,Math.min(this.centerY,this.lCenterY+g-m))),this.toArray()}correctAspectRatio(){const t=this.canvas;if(t.is360)return;const e=t.camera.cpw/t.camera.cph;this.width/this.height>e?this.height=this.width/e:this.width=this.height*e,this.toArray()}toArray(){return this.arr[0]=this.centerX,this.arr[1]=this.centerY,this.arr[2]=this.width,this.arr[3]=this.height,this.arr}equals(t,e,i,s){return this.centerX===t&&this.centerY===e&&this.width===i&&this.height===s}isFull(){return 1===this.width&&1===this.height&&.5===this.centerX&&.5===this.centerY}},xc=class{constructor(t=.5,e=.5,i=1,s=0,r=0){this.x=t,this.y=e,this.scale=i,this.w=s,this.direction=r,this.arr=new Float64Array(5)}inView(t){return this.w<-1||this.w<3&&!(this.x<0||this.x>t.width||this.y<0||this.y>t.height)}toArray(){return this.arr[0]=this.x,this.arr[1]=this.y,this.arr[2]=this.scale,this.arr[3]=this.w,this.arr[4]=this.direction,this.arr}},Tc=class{constructor(t=0,e=0,i=0,s=0,r=0,n=0,a=1,o=1,h=!1){this.width=t,this.height=e,this.left=i,this.top=s,this.areaWidth=r,this.areaHeight=n,this.ratio=a,this.scale=o,this.isPortrait=h,this.arr=new Int32Array(4)}get centerX(){return this.left+this.width/2}get centerY(){return this.top+this.height/2}get aspect(){return 0===this.width||0===this.height?1:this.width/this.height}toArray(){return this.arr[0]=this.width,this.arr[1]=this.height,this.arr[2]=this.left,this.arr[3]=this.top,this.arr}set(t,e,i,s,r,n,a){return(this.width!==t*r||this.height!==e*r||this.left!==i||this.top!==s||this.ratio!==r||this.scale!==n||this.isPortrait!==a)&&(this.width=t*r,this.height=e*r,this.left=i*r,this.top=s*r,this.ratio=r,this.scale=n,this.isPortrait=a,!0)}copy(t){this.width=t.width,this.height=t.height,this.left=t.left,this.top=t.top,this.ratio=t.ratio,this.scale=t.scale,this.isPortrait=t.isPortrait}},kc=class{constructor(t){this.canvas=t,this.dX=0,this.dY=0,this.startTime=0,this.prevTime=0,this.endTime=0,this.lastInteraction=0,this.velocityX=0,this.velocityY=0,this.started=!1}addStep(t,e,i){if(this.endTime)return;0===this.startTime&&(this.startTime=i);const s=this.prevTime>0?16.67/(i-this.prevTime):1;Math.sqrt(t*t+e*e)*s>20&&(this.lastInteraction=i);const r=this.canvas.main.dragElasticity;this.dX+=t*r,this.dY+=e*r,this.prevTime=i}start(){this.canvas.camera.isUnderZoom()||(this.started=!0)}stop(){this.started=!1,this.endTime=0,this.startTime=0,this.prevTime=0,this.lastInteraction=0,this.dX=0,this.dY=0,this.velocityX=0,this.velocityY=0}step(t){const e=this.canvas.webgl,i=this.canvas.camera;if(!this.started||0===this.startTime)return 1;if(0===this.endTime){this.endTime=t;const e=1-Math.min(1,(this.endTime-this.lastInteraction)/250),i=this.endTime-this.startTime;this.velocityX=this.dX/(i/4)*e,this.velocityY=this.dY/(i/4)*e}else this.velocityX*=.94,this.velocityY*=.94;let s=Math.sqrt(this.velocityX*this.velocityX+this.velocityY*this.velocityY);return this.canvas.is360?e.rotate(this.velocityX,this.velocityY,0,t):i.pan(this.velocityX,this.velocityY,0,!1,t,!1,!0),s<=.01&&(s=0,this.stop()),1-s}},_c=class{constructor(t){this.canvas=t,this.isView=!1,this.isZoom=!1,this.isJump=!1,this.zFrom=0,this.zTo=0,this.zNoLimit=!1,this.fn=pc,this.started=0,this.duration=0,this.isRunning=!1,this.limit=!0,this.zoomingOut=!1,this.flying=!1,this.correcting=!1,this.pausedAt=0,this.fL=0,this.fT=0,this.fR=0,this.fB=0,this.mI=0,this.mO=0,this.omniStartIdx=-1,this.omniDelta=0,this.vFrom=new bc(t),this.vTo=new bc(t),this.lastView=new bc(t)}pause(t){this.pausedAt>0||(this.isRunning=!1,this.pausedAt=t)}resume(t){0!==this.pausedAt&&0!==this.started&&(this.started+=t-this.pausedAt,this.pausedAt=0,this.isRunning=!0)}stop(){this.isRunning&&this.canvas.aniAbort(),this.started=0,this.limit=!0,this.flying=!1,this.isRunning=!1,this.isView=!1,this.isZoom=!1,this.correcting=!1,this.pausedAt=0}isStarted(){return this.isRunning&&this.isView}toView(t,e,i,s,r,n,a,o,h,c,l,d,u=!1){if(u&&this.correcting)return this.updateTarget(t,e,i,s,!0),r;this.lastView.set(t,e,i,s),this.vTo.set(t,e,i,s);const m=this.canvas,g=m.view,p=this.vTo,f=this.vFrom;this.isJump=o,this.fn=3===l?wc:2===l?vc:1===l?fc:pc;const v=m.main.el;if(0!==v.areaHeight){const t=s/(1-v.areaHeight/v.height);t>0?s+=t:s-=t,v.areaHeight=0}if(0!==v.areaWidth){const t=i*(v.areaWidth/v.width);t>0?i+=t:i-=t,v.areaWidth=0}const w=g.centerX,y=g.centerY,b=g.width,x=g.height;f.set(w,y,b,x),m.is360&&(t=w+mc(w,t),p.set(t,e,i,s)),h&&(p.correctAspectRatio(),p.limit(!1)),this.fL=0,this.fR=0,this.fT=0,this.fB=0;let T=1;if(this.isJump){if(!m.is360){const t=p.centerX,e=p.centerY;if(p.aspect>f.aspect){const i=p.width/f.aspect;p.set(t,e,p.width,i)}else{const i=p.height*f.aspect;p.set(t,e,i,p.height)}}const r=f.centerX-f.width/2,n=f.centerX+f.width/2,a=f.centerY-f.height/2,o=f.centerY+f.height/2,h=p.centerX-p.width/2,c=p.centerX+p.width/2,l=p.centerY-p.height/2,d=p.centerY+p.height/2,u=h<r,g=l<a,v=c>n,w=d>o;!(u||g||v||w)||u&&g&&v&&w?p.set(t,e,i,s):(this.fL=u?1:h>r?2:0,this.fR=v?1:c<n?2:0,this.fT=g?1:l>a?2:0,this.fB=w?1:d<o?2:0,T=1.5)}u&&p.limit(!0,!h);const k=Math.max(1e4,Math.min(15e3,Math.sqrt(m.width*m.width+m.height*m.height)/2));let _=Math.abs(w-t);m.is360&&(_=Math.min(_,1-_));const M=i<b&&s<x?.125:.25,S=(_+Math.abs(y-e)+Math.abs(b-i)*M+Math.abs(x-s)*M)/3;this.mI=Math.max(.5,.8-S*(m.is360?1:2)),this.mO=Math.max(.05,Math.min(.9,S-(m.is360?.2:.1))),this.duration=r<0?S*k/m.camSpeed*T/(n<=0?1:n):r;const E=this.canvas.images.length/this.canvas.omniNumLayers;return this.omniStartIdx=this.canvas.activeImageIdx,this.omniDelta=0,!isNaN(c)&&c>0&&c!==this.omniStartIdx&&(this.omniDelta=c-this.omniStartIdx,this.omniDelta<-E/2&&(this.omniDelta+=E),this.omniDelta>E/2&&(this.omniDelta-=E),this.duration+=Math.abs(this.omniDelta)/this.canvas.images.length*6e3),0===this.duration?(m.setView(p.centerX,p.centerY,p.width,p.height,!1,!0),this.canvas.aniDone(),this.stop(),this.duration):(this.stop(),this.isView=!0,this.limit=!1,this.flying=!0,this.isZoom=!1,u&&(this.correcting=!0),this.started=d-a*this.duration,this.isRunning=!0,this.duration*(1-a))}updateTarget(t,e,i,s,r=!1){this.vTo.set(t,e,i,s),r&&this.vTo.limit(!0)}zoom(t,e,i,s,r){this.stop(),this.isView=!1,this.flying=!1,this.isZoom=!0,this.zNoLimit=s;const n=this.canvas,a=n.webgl;return this.zFrom=a.perspective,this.zTo=this.zFrom+t/(a.scale*Math.sqrt(n.width*n.width+n.height*n.height)/20),s||(this.zTo=Math.min(a.maxPerspective,Math.max(a.minPerspective,this.zTo))),this.started=r,this.isRunning=!0,this.duration=e>=0?e:1e3*Math.abs(this.zFrom-this.zTo)/i,e}setStartView(t,e,i,s,r){this.vFrom.set(t,e,i,s,r),this.vTo.set(t,e,i,s,r)}step(t){const e=0===this.started?1:Math.min(1,Math.max(0,(t-this.started)/this.duration)),i=this.fn.get(e),s=this.canvas.getScale();if(this.isRunning){if(this.isView){const t=this.vFrom,s=this.vTo,r=this.mO,n=this.fn.get(Math.min(1,e/this.mI)),a=this.fn.get(Math.max(0,(e-r)/(1-r)));let o=0,h=t.centerX+(s.centerX-t.centerX)*((o=this.fL||this.fR)?1===o?n:a:i),c=t.centerY+(s.centerY-t.centerY)*((o=this.fT||this.fB)?1===o?n:a:i);const l=t.width+(s.width-t.width)*i,d=t.height+(s.height-t.height)*i;if(this.canvas.is360){const e=mc(t.centerX,s.centerX);h=t.centerX+e*i}if(this.canvas.setView(h,c,l,d,!1,!0),this.omniDelta){let t=this.omniStartIdx+Math.trunc(this.omniDelta*this.fn.get(Math.min(1,1.5*e)));const i=this.canvas.images.length/this.canvas.omniNumLayers;t<0&&(t+=i),t>=i&&(t-=i),this.canvas.setActiveImage(t,0)}}this.isZoom&&this.canvas.webgl.setPerspective(this.zFrom*(1-i)+this.zTo*i,this.zNoLimit),e>=1&&(this.lastView.copy(this.canvas.view),this.canvas.aniDone(),this.stop())}return this.zoomingOut=this.isRunning&&this.canvas.getScale()<s,e}},Mc=class{constructor(t){this.canvas=t,this.scale=1,this.minScale=1,this.minSize=1,this.maxScale=1,this.fullScale=1,this.coverScale=1,this.xy=new xc,this.coo=new xc,this.startCoo=new xc,this.pinching=!1,this.inited=!1,this.hasStartCoo=!1,this.cpw=-1,this.cph=-1,this.wasCoverLimit=!0,this.prevSize=-1,this.prevCenterX=-1,this.prevCenterY=-1,t.is360&&(this.inited=!0)}getCoo(t,e,i,s){const r=this.canvas;(r.noImage||r.freeMove)&&(s=!0);const n=r.el,a=r.hasParent?r.parent.el.ratio:n.ratio;i&&(t-=n.left,e-=n.top);const o=t/this.scale*a/r.width+r.view.x0,h=e/this.scale*a/r.height+r.view.y0;return this.coo.x=s?o:Math.max(r.view.lX0,Math.min(r.view.lX1,o)),this.coo.y=s?h:Math.max(r.view.lY0,Math.min(r.view.lY1,h)),this.coo.scale=this.scale,this.coo.toArray(),this.coo}getXY(t,e,i){const s=this.canvas,r=s.el,n=s.hasParent?s.parent.el.ratio:r.ratio;return this.xy.x=(t-s.view.x0)*s.width*this.scale/n+(i?r.left:0),this.xy.y=(e-s.view.y0)*s.height*this.scale/n+(i?r.top:0),this.xy.scale=this.scale/n,this.xy.toArray(),this.xy}getXYOmni(t,e,i,s,r){return this.getXYOmniCoo(t-.5,e-.5,i,s,r)}getXYOmniCoo(t,e,i,s,r){const n=this.canvas,a=n.el,o=n.webgl.pMatrix,h=n.webgl.vec4,c=n.hasParent?n.parent.el.ratio:a.ratio;h.x=t,h.y=e,h.z=i,h.w=1,o.identity(),!r&&n.omniFieldOfView&&o.perspective(n.omniFieldOfView,n.aspect,1e-4,100),n.omniDistance&&o.translate(0,0,n.omniDistance),n.omniOffsetX&&o.translate(n.omniOffsetX,0,0),!r&&n.omniVerticalAngle&&o.rotateX(n.omniVerticalAngle);const l=n.images.length/n.omniNumLayers,d=n.layer*l,u=n.images.length>0?-(n.activeImageIdx+1-d)/l*2*oc:0;return o.rotateY(s+u),h.transformMat4(o),this.xy.x=(.5+h.x-n.view.x0)*n.width*this.scale/c+(r?a.left:0),this.xy.y=(.5+h.y-n.view.y0)*n.height*this.scale/c+(r?a.top:0),this.xy.w=-h.w-n.omniDistance,this.xy.toArray(),this.xy}setCanvas(){const t=this.canvas,e=t.el,i=e.width/t.width,s=e.height/t.height;if(!t.view.limitChanged&&this.cpw===i&&this.cph===s)return void(t.coverLimit!==this.wasCoverLimit&&this.correctMinMax());this.cpw=i,this.cph=s,this.fullScale=Math.min(i,s),this.coverScale=Math.max(i,s);const r=t.view.lWidth/t.view.lHeight;if(t.view.limitChanged=!1,t.view.lWidth<1||t.view.lHeight<1){const e=i/s;this.coverScale/=r<e?t.view.lWidth/e:t.view.lHeight*e}if(this.correctMinMax(),e.width&&e.height&&!this.canvas.ani.isStarted()&&(t.view.copy(t.ani.lastView,!0),!t.is360)){const e=t.ani.limit;t.ani.limit=!1,this.setView(),t.ani.limit=e}}correctMinMax(t=!1){const e=this.canvas;if(this.minScale=e.coverLimit?this.coverScale:this.fullScale,!t&&!e.main.isSwipe&&(0===e.activeImageIdx&&!e.coverLimit||e.activeImageIdx>0)){const t=e.focus.width*e.width,i=e.focus.height*e.height,s=e.el.width,r=e.el.height;this.minScale=s/r>t/i?r/i:s/t}this.maxScale=this.minScale>1&&e.maxScale<this.minScale?this.minScale:Math.max(this.minScale,e.maxScale*e.scaleMultiplier/e.el.scale),this.wasCoverLimit=e.coverLimit}isUnderZoom(){return this.minSize<1&&this.scale<this.minScale}isZoomedOut(t=!1){return Math.trunc(1e6*(this.scale-this.minScale*(t?this.minSize:1)))/1e6<=0}isZoomedIn(){return this.scale/this.maxScale>=1}setView(){if(-1===this.cpw)return!1;const t=this.canvas,e=this.canvas.view,i=!t.freeMove&&t.ani.limit;!t.ani.correcting&&(i||!t.ani.flying&&t.coverLimit)&&e.limit(!1);const s=e.width,r=e.height,n=this.cpw,a=this.cph;this.scale=Math.min(n/s,a/r),i&&!this.pinching&&this.isZoomedIn()&&t.ani.flying&&(this.scale=this.maxScale),(!t.ani.correcting&&!this.pinching||t.coverLimit)&&(this.scale=Math.max(this.minScale*this.minSize,this.scale)),!this.inited&&t.coverStart&&(this.scale=this.coverScale);const o=n/this.scale-s,h=a/this.scale-r;return e.set(e.centerX,e.centerY,e.width+o,e.height+h),!this.inited&&t.coverStart&&this.canvas.ani.lastView.copy(e),!t.ani.correcting&&t.coverLimit&&e.limit(!1),this.inited=this.cpw>0,e.toArray(),!this.hasStartCoo||(this.hasStartCoo=!1,this.setCoo(this.startCoo.x,this.startCoo.y,this.startCoo.scale,0,0,!1,0,0),!1)}isOutsideLimit(){const t=this.canvas.view;return!this.canvas.freeMove&&(Math.trunc(1e6*(t.x0-t.lX0))/1e6<0!=Math.trunc(1e6*(t.x1-t.lX1))/1e6>0||Math.trunc(1e6*(t.y0-t.lY0))/1e6<0!=Math.trunc(1e6*(t.y1-t.lY1))/1e6>0||Math.trunc(1e6*(this.scale-this.maxScale))/1e6>0)}pan(t,e,i,s,r,n=!1,a=!1){const o=this.canvas;if(o.is360)return void o.webgl.rotate(t,e,i,r);if((this.isUnderZoom()||this.pinching)&&!n)return;this.canvas.freeMove&&(s=!0);const h=o.hasParent?o.parent.el.ratio:o.el.ratio,c=o.view,l=t/o.width/this.scale*h,d=e/o.height/this.scale*h,u=c.centerX+l,m=c.centerY+d,g=c.width,p=c.height;this.pinching?(o.view.set(u,m,g,p),o.setView(u,m,g,p,s,!1,!1,!1)):n||!this.isOutsideLimit()||a?(o.ani.stop(),0===i?(a||o.kinetic.addStep(4*t,4*e,r),o.view.set(u,m,g,p),s||o.view.limit(!1,!1,o.freeMove),o.setView(u,m,g,p,s,!1,!1,a),o.view.changed=!0):o.ani.toView(u,m,g,p,i,0,0,!1,!1,-1,0,r)):o.ani.toView(u,m,g,p,i||150,0,0,!1,!1,-1,0,r,!s)}zoom(t,e,i,s,r,n){const a=this.canvas;if(a.is360)return a.webgl.zoom(t,s,0,r,n,e,i);if(!this.pinching&&this.isZoomedIn()&&t<0)return 0;if(this.canvas.freeMove&&(r=!0),t>0&&this.isZoomedOut()&&this.minSize>=1&&(!this.pinching||a.coverLimit))return 0;const o=a.el,h=a.view,c=this.cpw/this.cph;let l=t*(o.width/512)/a.width/this.scale,d=l/c;t<0&&l<-1&&(l=-.9999),t<0&&d<-1&&(d=-.9999);const u=!r&&!a.freeMove&&a.ani.limit&&0===s,m=a.hasParent?a.parent.el.ratio:o.ratio;e-=o.left,i-=o.top;const g=this.isUnderZoom(),p=e>0&&!g?e/o.width*m:.5,f=i>0&&!g?i/o.height*m:.5,v=h.centerX+l*(.5-p),w=h.centerY+d*(.5-f),y=h.width+l,b=h.height+d;return a.ani.limit=u,s=a.ani.toView(v,w,y,b,s,0,0,!1,!r&&!this.pinching,-1,0,n,u),a.ani.lastView.copy(a.view),a.ani.limit=!r,s}pinch(t,e,i,s){const r=this.canvas,n=r.main.el,a=(Math.min(t,i)-n.left)/n.scale,o=(Math.min(e,s)-n.top)/n.scale,h=(Math.max(t,i)-n.left)/n.scale,c=(Math.max(e,s)-n.top)/n.scale,l=a+(h-a)/2,d=o+(c-o)/2,u=Math.max(h-a,c-o),m=this.prevSize-u;if(r.kinetic.stop(),this.prevCenterX>0){const t=this.prevCenterX-l,e=this.prevCenterY-d;r.is360?(r.webgl.zoom(2*m,0,0,!1,1),r.webgl.rotate(t,e,0,0)):(!this.canvas.main.noPinchPan&&this.scale>this.minScale&&this.pan(t,e,0,!1,0,!0),this.zoom(2*m*n.scale,l,d,0,!this.canvas.pinchZoomOutLimit,0),r.ani.limit=!!this.canvas.pinchZoomOutLimit)}else r.ani.stop();this.prevCenterX=l,this.prevCenterY=d,this.prevSize=u}pinchStart(){this.pinching=!0}pinchStop(t){this.canvas.is360||this.snapToBounds(t),this.prevSize=-1,this.prevCenterX=-1,this.prevCenterY=-1,this.pinching=!1}snapToBounds(t){if(this.canvas.freeMove)return;const e=this.canvas.view,i=this.scale>this.maxScale,s=i?this.cpw/this.maxScale:e.width,r=i?this.cph/this.maxScale:e.height,n=s/2,a=r/2,o=e.lWidth/2,h=e.lHeight/2,c=n>=o?e.lCenterX:Math.max(e.lX0+n,Math.min(e.centerX,e.lX1-n)),l=a>=h?e.lCenterY:Math.max(e.lY0+a,Math.min(e.centerY,e.lY1-a));this.canvas.ani.toView(c,l,s,r,150,0,0,!1,!1,-1,0,t,!0)}flyTo(t,e,i,s,r,n,a,o,h,c,l,d,u){const m=this.canvas,g=m.ani;m.kinetic.stop();let p=t;if(m.is360){const e=m.view.centerX;p=e+mc(e,t)}return g.limit=!1,r=g.toView(p,e,i,s,r,n,a,o,h,l,d,u,c),g.limit=!1,g.flying=!0,r}setCoo(t,e,i,s,r,n,a,o){if(!this.inited)return this.hasStartCoo=!0,this.startCoo.x=t,this.startCoo.y=e,this.startCoo.scale=i,this.setView(),0;const h=this.canvas,c=h.is360;(0===i||!c&&isNaN(i))&&(i=h.getScale()),c||(i=Math.max(this.minScale,i)),h.kinetic.stop();const l=isNaN(i)&&c?h.view.width:1/i*this.cpw,d=isNaN(i)&&c?h.view.height:1/i*this.cph;return 0!==s||c||(t+l/2>1&&(t=1-l/2),t-l/2<0&&(t=l/2),e+d/2>1&&(e=1-d/2),e-d/2<0&&(e=d/2)),s=h.ani.toView(t,e,l,d,s,r,0,!1,!1,-1,a,o),h.ani.limit=0===s||n,h.ani.flying=s>0,s}},Sc=class{constructor(t=1,e=0,i=0,s=0,r=0,n=1,a=0,o=0,h=0,c=0,l=1,d=0,u=0,m=0,g=0,p=1){this.a0=t,this.a1=e,this.a2=i,this.a3=s,this.a4=r,this.a5=n,this.a6=a,this.a7=o,this.a8=h,this.a9=c,this.a10=l,this.a11=d,this.a12=u,this.a13=m,this.a14=g,this.a15=p,this.arr=new Float32Array(16)}toArray(){return this.arr[0]=this.a0,this.arr[1]=this.a1,this.arr[2]=this.a2,this.arr[3]=this.a3,this.arr[4]=this.a4,this.arr[5]=this.a5,this.arr[6]=this.a6,this.arr[7]=this.a7,this.arr[8]=this.a8,this.arr[9]=this.a9,this.arr[10]=this.a10,this.arr[11]=this.a11,this.arr[12]=this.a12,this.arr[13]=this.a13,this.arr[14]=this.a14,this.arr[15]=this.a15,this.arr}identity(){this.a0=1,this.a1=0,this.a2=0,this.a3=0,this.a4=0,this.a5=1,this.a6=0,this.a7=0,this.a8=0,this.a9=0,this.a10=1,this.a11=0,this.a12=0,this.a13=0,this.a14=0,this.a15=1}copy(t){this.a0=t.a0,this.a1=t.a1,this.a2=t.a2,this.a3=t.a3,this.a4=t.a4,this.a5=t.a5,this.a6=t.a6,this.a7=t.a7,this.a8=t.a8,this.a9=t.a9,this.a10=t.a10,this.a11=t.a11,this.a12=t.a12,this.a13=t.a13,this.a14=t.a14,this.a15=t.a15}rotateX(t){const e=Math.sin(t),i=Math.cos(t),s=this.a4,r=this.a5,n=this.a6,a=this.a7,o=this.a8,h=this.a9,c=this.a10,l=this.a11;this.a4=s*i+o*e,this.a5=r*i+h*e,this.a6=n*i+c*e,this.a7=a*i+l*e,this.a8=o*i-s*e,this.a9=h*i-r*e,this.a10=c*i-n*e,this.a11=l*i-a*e}rotateY(t){const e=Math.sin(t),i=Math.cos(t),s=this.a0,r=this.a1,n=this.a2,a=this.a3,o=this.a8,h=this.a9,c=this.a10,l=this.a11;this.a0=s*i-o*e,this.a1=r*i-h*e,this.a2=n*i-c*e,this.a3=a*i-l*e,this.a8=s*e+o*i,this.a9=r*e+h*i,this.a10=n*e+c*i,this.a11=a*e+l*i}rotateZ(t){const e=Math.sin(t),i=Math.cos(t),s=this.a0,r=this.a1,n=this.a2,a=this.a3,o=this.a4,h=this.a5,c=this.a6,l=this.a7;this.a0=s*i+o*e,this.a1=r*i+h*e,this.a2=n*i+c*e,this.a3=a*i+l*e,this.a4=o*i-s*e,this.a5=h*i-r*e,this.a6=c*i-n*e,this.a7=l*i-a*e}scaleFlat(t){this.a0*=t,this.a1*=t,this.a2*=t,this.a3*=t,this.a4*=t,this.a5*=t,this.a6*=t,this.a7*=t}translate(t,e,i){this.a12+=this.a0*t+this.a4*e+this.a8*i,this.a13+=this.a1*t+this.a5*e+this.a9*i,this.a14+=this.a2*t+this.a6*e+this.a10*i,this.a15+=this.a3*t+this.a7*e+this.a11*i}perspective(t,e,i,s){this.identity();const r=1/Math.tan(t/2),n=1/(i-s);this.a0=r/e,this.a5=r,this.a10=(s+i)*n,this.a11=-1,this.a14=2*s*i*n,this.a15=0}perspectiveCss(t){this.identity();const e=1/Math.tan(t/2);this.a0=e,this.a5=e}invert(){const t=this.a0,e=this.a1,i=this.a2,s=this.a3,r=this.a4,n=this.a5,a=this.a6,o=this.a7,h=this.a8,c=this.a9,l=this.a10,d=this.a11,u=this.a12,m=this.a13,g=this.a14,p=this.a15,f=t*n-e*r,v=t*a-i*r,w=t*o-s*r,y=e*a-i*n,b=e*o-s*n,x=i*o-s*a,T=h*m-c*u,k=h*g-l*u,_=h*p-d*u,M=c*g-l*m,S=c*p-d*m,E=l*p-d*g;let I=f*E-v*S+w*M+y*_-b*k+x*T;I&&(I=1/I,this.a0=(n*E-a*S+o*M)*I,this.a1=(i*S-e*E-s*M)*I,this.a2=(m*x-g*b+p*y)*I,this.a3=(l*b-c*x-d*y)*I,this.a4=(a*_-r*E-o*k)*I,this.a5=(t*E-i*_+s*k)*I,this.a6=(g*w-u*x-p*v)*I,this.a7=(h*x-l*w+d*v)*I,this.a8=(r*S-n*_+o*T)*I,this.a9=(e*_-t*S-s*T)*I,this.a10=(u*b-m*w+p*f)*I,this.a11=(c*w-h*b-d*f)*I,this.a12=(n*k-r*M-a*T)*I,this.a13=(t*M-e*k+i*T)*I,this.a14=(m*v-u*y-g*f)*I,this.a15=(h*y-c*v+l*f)*I)}multiply(t){let e=this.a0,i=this.a1,s=this.a2,r=this.a3;this.a0=e*t.a0+i*t.a4+s*t.a8+r*t.a12,this.a1=e*t.a1+i*t.a5+s*t.a9+r*t.a13,this.a2=e*t.a2+i*t.a6+s*t.a10+r*t.a14,this.a3=e*t.a3+i*t.a7+s*t.a11+r*t.a15,e=this.a4,i=this.a5,s=this.a6,r=this.a7,this.a4=e*t.a0+i*t.a4+s*t.a8+r*t.a12,this.a5=e*t.a1+i*t.a5+s*t.a9+r*t.a13,this.a6=e*t.a2+i*t.a6+s*t.a10+r*t.a14,this.a7=e*t.a3+i*t.a7+s*t.a11+r*t.a15,e=this.a8,i=this.a9,s=this.a10,r=this.a11,this.a8=e*t.a0+i*t.a4+s*t.a8+r*t.a12,this.a9=e*t.a1+i*t.a5+s*t.a9+r*t.a13,this.a10=e*t.a2+i*t.a6+s*t.a10+r*t.a14,this.a11=e*t.a3+i*t.a7+s*t.a11+r*t.a15,e=this.a12,i=this.a13,s=this.a14,r=this.a15,this.a12=e*t.a0+i*t.a4+s*t.a8+r*t.a12,this.a13=e*t.a1+i*t.a5+s*t.a9+r*t.a13,this.a14=e*t.a2+i*t.a6+s*t.a10+r*t.a14,this.a15=e*t.a3+i*t.a7+s*t.a11+r*t.a15}scaleXY(t,e,i=1){this.a0*=t,this.a1*=t,this.a2*=t,this.a3*=t,this.a4*=e,this.a5*=e,this.a6*=e,this.a7*=e,this.a8*=i,this.a9*=i,this.a10*=i,this.a11*=i}},Ec=class{constructor(t=0,e=0,i=0,s=1){this.x=t,this.y=e,this.z=i,this.w=s}copy(t){this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w}transformMat4(t){const e=this.x,i=this.y,s=this.z,r=t.a3*e+t.a7*i+t.a11*s+t.a15||1;this.x=(t.a0*e+t.a4*i+t.a8*s+t.a12)/r,this.y=(t.a1*e+t.a5*i+t.a9*s+t.a13)/r,this.z=(t.a2*e+t.a6*i+t.a10*s+t.a14)/r,this.w=r}normalize(){let t=this.x*this.x+this.y*this.y+this.z*this.z;t>0&&(t=1/Math.sqrt(t)),this.x*=t,this.y*=t,this.z*=t}},Ic=class{constructor(t,e,i,s,r,n,a){this.image=t,this.index=e,this.start=i,this.end=s,this.tileSize=r,this.cols=n,this.rows=a,this.tileWidth=r/t.width,this.tileHeight=r/t.height}getTileRect(t,e){const i=t-this.start,s=i%this.cols,r=Math.floor(i/this.cols),n=this.image;return e.x0=n.x0+s*this.tileSize/n.width*n.rWidth,e.y0=n.y0+r*this.tileSize/n.height*n.rHeight,e.x1=n.x0+Math.min((s+1)*this.tileSize/n.width,1)*n.rWidth,e.y1=n.y0+Math.min((r+1)*this.tileSize/n.height,1)*n.rHeight,e.image=n,e.layer=this.index,e.x=s,e.y=r,e}},Ac=class t{static{this.toDraw=[]}static{this.toDrawSeen=new Uint8Array(0)}static{this.toDrawSeenBase=0}static{this.sampledXs=new Float64Array(200)}static{this.sampledYs=new Float64Array(200)}static{this.uniqueXs=new Float64Array(200)}static{this.sampledLength=0}static{this.uniqueLength=0}constructor(t,e,i,s,r,n,a,o,h,c,l,d,u,m,g,p){this.canvas=t,this.index=e,this.localIdx=i,this.width=s,this.height=r,this.tileSize=n,this.isSingle=a,this.isVideo=o,this.startOffset=h,this.opacity=c,this.tOpacity=l,this.rotX=d,this.rotY=u,this.rotZ=m,this.scale=g,this.fromScale=p,this.vec=new Ec,this.mat=new Sc,this.rScale=0,this.layers=[],this.numLayers=0,this.targetLayer=0,this.x0=0,this.y0=0,this.x1=1,this.y1=1,this.rWidth=1,this.rHeight=1,this.areaCenterX=.5,this.areaCenterY=.5,this.areaWidth=1,this.areaHeight=1,this.sphere3DX=0,this.sphere3DY=0,this.sphere3DZ=-1,this.angularWidth=0,this.angularHeight=0,this.gotBase=0,this.aspect=0,this.doneTotal=0,this.doRender=!1,this.is360Embed=!1,this.isVideoPlaying=!1;const f=s>r?s:r;this.is360Embed=this.canvas.is360&&this.localIdx>0,this.numLayers=2;for(let w=n;w<f*t.main.underzoomLevels;w*=2)this.numLayers++;(t.main.hasArchive||this.fromScale>0)&&(this.numLayers-=3-t.main.archiveLayerOffset),this.fromScale>0&&this.numLayers--,this.numLayers=Math.max(1,this.numLayers);let v=h;for(let w=0;w<this.numLayers;w++){const t=lc(w)*this.tileSize,e=Math.ceil(s/t),i=Math.ceil(r/t);this.layers.push(new Ic(this,this.layers.length,v,this.endOffset=v+=e*i,t,e,i))}}setArea(t,e,i,s){this.x0=t,this.y0=e,this.x1=i,this.y1=s,this.areaWidth=i+(i<t?1:0)-t,this.areaHeight=s-e,this.areaCenterX=t+this.areaWidth/2,this.areaCenterY=e+this.areaHeight/2,this.canvas.is360&&(this.areaCenterX=dc(this.areaCenterX)),this.rWidth=this.areaWidth,this.rHeight=this.areaHeight,this.aspect=this.width/this.height,this.rScale=this.aspect>this.canvas.aspect?this.canvas.width/this.width*this.rWidth:this.canvas.height/this.height*this.rHeight,this.canvas.is360&&this.calculate3DSpherePosition()}calculate3DSpherePosition(){let t=2*(this.areaCenterX-.5)*oc;const e=(this.areaCenterY-.5)*oc;t+=this.canvas.webgl.baseYaw,this.sphere3DX=Math.cos(e)*Math.sin(t),this.sphere3DY=Math.sin(e),this.sphere3DZ=Math.cos(e)*Math.cos(t),this.angularWidth=2*this.areaWidth*oc,this.angularHeight=this.areaHeight*oc}sphere3DOverlap(){if(!this.canvas.is360)return!1;const t=this.sphere3DX*this.canvas.webgl.cameraForwardX+this.sphere3DY*this.canvas.webgl.cameraForwardY+this.sphere3DZ*this.canvas.webgl.cameraForwardZ,e=Math.acos(Math.max(-1,Math.min(1,t))),i=Math.max(this.angularWidth,this.angularHeight)/2;return e<this.canvas.webgl.fieldOfView+i}outsideView(){if(this.is360Embed)return!this.sphere3DOverlap();{const t=this.canvas.view;return this.x1<=t.x0||this.x0>=t.x1||this.y1<=t.y0||this.y0>=t.y1}}shouldRender(){return!(this.fromScale>0&&this.fromScale>this.canvas.camera.scale)&&((!(this.isVideo||this.localIdx>0)||0!==this.opacity||0!==this.tOpacity)&&(!!(this.index===this.canvas.activeImageIdx||this.canvas.is360&&0===this.localIdx)||!this.outsideView()))}opacityTick(t){const e=this.tOpacity;if(this.opacity===e)return!1;const i=1/(this.canvas.main.frameTime*this.canvas.main.embedFadeDuration);return this.opacity=Math.min(1,Math.max(0,t?e:e>this.opacity?Math.min(e,this.opacity+i):Math.max(e,this.opacity-i))),this.opacity!==e}getTiles(e){if(this.opacity<=0)return 0;if(this.doneTotal=0,this.is360Embed){if(e=this.getEmbeddedScale(e),!(this.doRender=e>0))return 0}else{const t=this.canvas.camera;e=Math.max(e,t.minScale)*this.rScale}const i=this.endOffset-this.startOffset;if(t.toDrawSeen.length<i)t.toDrawSeen=new Uint8Array(i);else for(let a=0;a<i;a++)t.toDrawSeen[a]=0;t.toDrawSeenBase=this.startOffset,0===this.gotBase?(t.toDraw.push(this.endOffset-1),t.toDrawSeen[this.endOffset-1-this.startOffset]=1,this.canvas.main.setTileOpacity(this.endOffset-1,!0,1)):this.is360Embed&&(t.toDraw.push(this.endOffset-1),t.toDrawSeen[this.endOffset-1-this.startOffset]=1,this.doneTotal++);const s=this.getTargetLayer(e),r=this.canvas,n=r.view;0===this.localIdx&&r.is360?this.get360Tiles(this.layers[s]):(this.is360Embed?this.getTilesViewport(s):r.is360?this.getTilesRect(s,n.x0,n.y0,n.x1,n.y1):r.visible.x0<r.visible.x1&&r.visible.y0<r.visible.y1&&this.getTilesRect(s,Math.max(r.visible.x0,n.x0),Math.max(r.visible.y0,n.y0),Math.min(r.visible.x1,n.x1),Math.min(r.visible.y1,n.y1)),this.is360Embed&&this.doneTotal++),t.toDraw.sort((t,e)=>t>e?-1:t<e?1:0);for(let a=0;a<t.toDraw.length;a++)r.toDraw.push(t.toDraw[a]);return t.toDraw.length=0,this.doneTotal}getTargetLayer(t){let e=this.isSingle||this.canvas.limited?this.numLayers:1+this.canvas.main.skipBaseLevels;if(!this.isSingle&&!this.canvas.limited)for(;e<this.numLayers&&!(lc(e)*t>=1);e++);return this.targetLayer=e-1}getTilesRect(t,e,i,s,r){if(this.outsideView())return;const n=this.layers[t],a=n.tileWidth,o=n.tileHeight,h=this.rWidth,c=this.rHeight,l=Math.min(n.cols-1,Math.floor(Math.max(0,s-this.x0)/h/a)),d=Math.floor(Math.max(0,r-this.y0)/c/o),u=Math.floor(Math.max(0,e-this.x0)/h/a);let m=Math.floor(Math.max(0,i-this.y0)/c/o);for(;m<=d;m++)if(!(m>=n.rows))for(let t=u;t<=l;t++)this.setToDraw(n,t,m)}getTilesViewport(t){if(this.outsideView())return;const e=this.layers[t],i=this.canvas,s=dc(i.view.centerX+i.webgl.offX),r=i.view.centerY,n=i.view.width+.1,a=i.view.height+.1,o=this.areaCenterX,h=this.areaCenterY,c=this.areaWidth,l=this.areaHeight,d=r-a/2,u=r+a/2,m=h-l/2,g=h+l/2,p=Math.max(d,m),f=Math.min(u,g);if(p>=f)return;let v=0,w=0,y=!1;if(i.is360){const t=dc(s-n/2),e=dc(s+n/2),i=dc(o-c/2),r=dc(o+c/2);e>t&&r>i?(v=Math.max(t,i),w=Math.min(e,r),y=v<w):e<t&&r>i?(i<=e||r>=t)&&(v=i,w=r,y=!0):e>t&&r<i?(t<=r||e>=i)&&(v=t,w=e,y=!0):e<t&&r<i&&(v=Math.max(t,i),w=Math.min(e,r),y=!0)}else{const t=s-n/2,e=s+n/2,i=o-c/2,r=o+c/2;v=Math.max(t,i),w=Math.min(e,r),y=v<w}if(!y)return;let b=o-c/2,x=o+c/2;i.is360&&(x>1?(v<b&&(v+=1),w<b&&(w+=1)):v>o+.5?v-=1:w>o+.5&&(w-=1));const T=(v-b)/c,k=(w-b)/c,_=(p-(h-l/2))/l,M=(f-(h-l/2))/l,S=e.tileWidth,E=e.tileHeight,I=Math.floor(Math.max(0,Math.min(1,T))/S),A=Math.min(e.cols-1,Math.floor(Math.max(0,Math.min(1,k))/S)),L=Math.floor(Math.max(0,Math.min(1,_))/E),P=Math.min(e.rows-1,Math.floor(Math.max(0,Math.min(1,M))/E));for(let $=L;$<=P;$++)for(let t=I;t<=A;t++)this.setToDraw(e,t,$)}setToDraw(e,i,s){const r=Math.min(this.endOffset-1,e.start+s*e.cols+i),n=r-t.toDrawSeenBase;if(!(n<t.toDrawSeen.length&&t.toDrawSeen[n]))if(n<t.toDrawSeen.length&&(t.toDrawSeen[n]=1),t.toDraw.push(r),this.canvas.main.setTileOpacity(r,r===this.endOffset-1,this.canvas.opacity)>=1)this.doneTotal++;else if(!this.isSingle&&!this.canvas.limited&&e.index<this.numLayers-1){const t=this.layers[e.index+1],r=i>>1,n=s>>1;this.setToDraw(t,r,n)}}setDrawRect(t){const e=this.canvas.main.vertexBuffer,i=this.canvas.webgl.radius,s=2*oc*i,r=this.vec,n=this.mat,a=this.x0+this.rWidth/2,o=this.y0+this.rHeight/2,h=this.canvas.webgl.getVec3(a-this.canvas.webgl.offX,o,!0,5);n.identity(),n.translate(h.x,h.y,h.z),n.rotateY(Math.atan2(h.x,h.z)+oc+this.rotY),n.rotateX(-Math.sin((o-.5)*oc)-this.rotX),n.rotateZ(-this.rotZ),n.scaleFlat(.5*this.scale);let c=(t.x0-a)*s,l=.5*-(t.y0-o)*s;r.x=0,r.y=0,r.z=0,n.translate(c,l,0),r.transformMat4(n),n.translate(-c,-l,0),e[0]=r.x,e[1]=r.y,e[2]=r.z,r.x=0,r.y=0,r.z=0,n.translate(c=(t.x0-a)*s,l=.5*-(t.y1-o)*s,0),r.transformMat4(n),n.translate(-c,-l,0),e[3]=e[9]=r.x,e[4]=e[10]=r.y,e[5]=e[11]=r.z,r.x=0,r.y=0,r.z=0,n.translate(c=(t.x1-a)*s,l=.5*-(t.y0-o)*s,0),r.transformMat4(n),n.translate(-c,-l,0),e[6]=e[15]=r.x,e[7]=e[16]=r.y,e[8]=e[17]=r.z,r.x=0,r.y=0,r.z=0,n.translate(c=(t.x1-a)*s,l=.5*-(t.y1-o)*s,0),r.transformMat4(n),n.translate(-c,-l,0),e[12]=r.x,e[13]=r.y,e[14]=r.z}getEmbeddedScale(t){if(this.is360Embed){return t*Math.max(2*this.areaWidth,this.areaHeight)*(this.canvas.width/this.width)}const e=this.areaWidth,i=this.areaHeight,s=this.areaCenterX-e/2,r=this.areaCenterX+e/2,n=this.areaCenterY,a=i/2.5,o=this.canvas.el,h=this.canvas.webgl,c=this.canvas.el.width;let l=h.getXYZ(s,n-a),d=l.w>0||l.x<0?0:Math.min(c,l.x),u=0;l.inView(o)&&u++,h.getXYZ(r,n-a).inView(o)&&u++;const m=(l.w>0||l.x>c?c:Math.max(0,l.x))-d;if(h.getXYZ(s,n+a).inView(o)&&u++,d=l.w>0||l.x<0?0:Math.min(c,l.x),h.getXYZ(r,n+a).inView(o)&&u++,0===u)return 0;const g=(l.w>0||l.x>c?c:Math.max(0,l.x))-d;return Math.min(1,Math.max(g,m)/this.width)}get360Tiles(e){const i=this.canvas,s=i.el,r=s.width,n=s.height;t.sampledLength=0,t.uniqueLength=0;const a=i.webgl.fieldOfView>oc/2?20:12;for(let v=0;v<=a;v++){const e=v/a;let s=i.webgl.getCoo(e*r,0);t.sampledXs[t.sampledLength]=s.x,t.sampledYs[t.sampledLength]=s.y,t.sampledLength++,s=i.webgl.getCoo((1-e)*r,n),t.sampledXs[t.sampledLength]=s.x,t.sampledYs[t.sampledLength]=s.y,t.sampledLength++,s=i.webgl.getCoo(r,e*n),t.sampledXs[t.sampledLength]=s.x,t.sampledYs[t.sampledLength]=s.y,t.sampledLength++,s=i.webgl.getCoo(0,(1-e)*n),t.sampledXs[t.sampledLength]=s.x,t.sampledYs[t.sampledLength]=s.y,t.sampledLength++}let o;for(let v=1;v<=3;v++){const e=n*v/4;for(let s=1;s<=3;s++)o=i.webgl.getCoo(r*s/4,e),t.sampledXs[t.sampledLength]=o.x,t.sampledYs[t.sampledLength]=o.y,t.sampledLength++;o=i.webgl.getCoo(r*v/4,n-1),t.sampledXs[t.sampledLength]=o.x,t.sampledYs[t.sampledLength]=o.y,t.sampledLength++}let h=1/0,c=-1/0;for(let v=0;v<t.sampledLength;v++){const e=t.sampledYs[v];e<h&&(h=e),e>c&&(c=e)}h=Math.max(0,h),c=Math.min(1,c),h-=.001,c+=.05,h=Math.max(0,h),c=Math.min(1,c);const l=i.webgl.offX;for(let v=0;v<t.sampledLength;v++)t.sampledXs[v]=dc(t.sampledXs[v]-l);t.uniqueLength=0;for(let v=0;v<t.sampledLength;v++){const e=t.sampledXs[v];let i=!1;for(let s=0;s<t.uniqueLength;s++)if(Math.abs(t.uniqueXs[s]-e)<1e-8){i=!0;break}i||(t.uniqueXs[t.uniqueLength]=e,t.uniqueLength++)}for(let v=1;v<t.uniqueLength;v++){const e=t.uniqueXs[v];let i=v-1;for(;i>=0&&t.uniqueXs[i]>e;)t.uniqueXs[i+1]=t.uniqueXs[i],i--;t.uniqueXs[i+1]=e}const d=t.uniqueLength;if(d<2)h=0,c=1,t.uniqueLength=0,t.uniqueXs[0]=0,t.uniqueXs[1]=1,t.uniqueLength=2;else{let e=0,i=-1;for(let h=0;h<d-1;h++){const s=t.uniqueXs[h+1]-t.uniqueXs[h];s>e&&(e=s,i=h)}const s=t.uniqueXs[0]+1-t.uniqueXs[d-1];let r=s>e;r&&(e=s,i=d-1);const n=1-e;let a=0,o=0;r?(a=t.uniqueXs[0],o=t.uniqueXs[d-1]):(a=t.uniqueXs[(i+1)%d],o=t.uniqueXs[i]+1),n>=.999999&&(a=0,o=1),t.uniqueLength=0,t.uniqueXs[0]=a,t.uniqueXs[1]=o,t.uniqueLength=2}let u=t.uniqueXs[1]-t.uniqueXs[0]>=.999999;(h<.05||c>.95)&&(u=!0);let m=Math.max(0,Math.max(0,Math.floor((h-.001)/e.tileHeight))),g=Math.min(e.rows-1,Math.max(0,Math.floor((c+e.tileHeight-1e-10)/e.tileHeight)));h<1e-5&&(m=0),c>.99999&&(g=e.rows-1);const p=e.tileWidth,f=t.uniqueXs[1]>1;for(let v=m;v<=g;v++)if(u)for(let t=0;t<e.cols;t++)this.setToDraw(e,t,v);else if(f){for(let s=Math.max(0,Math.max(0,Math.floor((t.uniqueXs[0]-.001)/p)-1));s<e.cols;s++)this.setToDraw(e,s,v);const i=Math.min(e.cols-1,Math.ceil(dc(t.uniqueXs[1]+.001)/p));for(let t=0;t<=i;t++)this.setToDraw(e,t,v)}else{const i=Math.max(0,Math.max(0,Math.floor((t.uniqueXs[0]-.001)/p)-1)),s=Math.min(e.cols-1,Math.ceil((t.uniqueXs[1]+.001)/p));for(let t=i;t<=s;t++)this.setToDraw(e,t,v)}}},Lc=class{constructor(t){this.canvas=t,this.pMatrix=new Sc,this.iMatrix=new Sc,this.cachedInverse=new Sc,this.inverseDirty=!0,this.rMatrix=new Sc,this.position=new Ec,this.radius=10,this.scale=0,this.scaleY=1,this.offY=0,this.dofY=1,this.limitX=0,this.limitY=0,this.baseYaw=0,this.yaw=0,this.pitch=0,this.defaultPerspective=hc,this.perspective=hc,this.maxPerspective=hc,this.minPerspective=hc,this.cameraForwardX=0,this.cameraForwardY=0,this.cameraForwardZ=-1,this.cameraUpX=0,this.cameraUpY=1,this.cameraUpZ=0,this.cameraRightX=1,this.cameraRightY=0,this.cameraRightZ=0,this.fieldOfView=0,this.aspectRatio=1,this.vec4=new Ec,this.coo=new xc,this.offX=0,this.baseYaw=-this.canvas.rotationY,this.offX=this.baseYaw/cc,this.canvas.is360&&(this.scaleY=this.canvas.height/(this.canvas.width/2),this.offY=(1-this.scaleY)/4),this.yaw=this.baseYaw,this.update()}setLimits(t,e){this.limitX=t,this.limitY=e,this.maxPerspective=hc,e>0&&(this.maxPerspective=Math.min(this.maxPerspective,this.maxPerspective*e*1.5)),this.setPerspective(this.perspective,!0)}update(t=!1){const e=this.canvas,i=e.el;if(t||this.pMatrix.perspective(this.perspective,i.aspect,1e-4,e.is360?20:100),this.inverseDirty=!0,e.is360){const t=this.pMatrix;this.pitch=Math.min(oc/2,Math.max(-oc/2,this.pitch)),t.rotateX(this.pitch),t.rotateY(this.yaw),t.translate(this.position.x,this.position.y,this.position.z);const e=this.rMatrix;e.perspectiveCss(this.perspective),e.translate(0,0,i.height/i.ratio/2),e.rotateX(-this.pitch),e.rotateY(this.yaw),this.coo.direction=this.yaw/oc*180%360}else{const t=e.view;this.pMatrix.translate(-(t.centerX-.5)*e.aspect,t.centerY-.5,-t.height/2)}this.pMatrix.toArray()}rotate(t,e,i,s){const r=this.canvas,n=r.el;this.yaw+=t*n.ratio/n.width*this.perspective*n.aspect,this.pitch+=e*n.ratio/n.height*this.perspective*this.scaleY,this.yaw=uc(this.yaw),(r.coverLimit||this.limitY>0)&&this.limitPitch(),this.limitX>0&&this.limitYaw(),0===i&&r.kinetic.addStep(2*t,2*e,s),this.update(),this.calculate3DFrustum(),this.syncLogicalView()}limitPitch(){const t=this.perspective/2,e=oc*this.scaleY/2*(this.limitY>0?this.limitY:1);this.pitch=this.pitch>0?Math.min(e,this.pitch+t)-t:Math.max(-e,this.pitch-t)+t}limitYaw(){const t=this.perspective/2*this.canvas.el.aspect,e=oc*(this.limitX>0?this.limitX:1);let i=this.yaw;for(;i>=oc;)i-=2*oc;for(;i<-oc;)i+=2*oc;this.yaw=uc(Math.min(Math.max(e,t)-t,Math.max(Math.min(-e,-t)+t,i)))}zoom(t,e,i,s,r,n=0,a=0){const o=this.canvas;if(t/=2,0!==e)e=o.ani.zoom(t,e,i,s,r);else{t/=this.scale*Math.sqrt(o.width*o.width+o.height*o.height)/20;const e=n>0&&a>0;let i=0,r=0;if(e){const t=this.getCoo(n,a);i=t.x,r=t.y}if(this.setPerspective(this.perspective+t,s),e){const t=this.getCoo(n,a);let e=i-t.x;e>.5&&(e-=1),e<-.5&&(e+=1);const s=r-t.y;this.yaw+=e*oc*2,this.pitch+=s*oc*this.scaleY,this.yaw=uc(this.yaw),(o.coverLimit||this.limitY>0)&&this.limitPitch(),this.limitX>0&&this.limitYaw(),this.update(),this.readScale(),this.calculate3DFrustum(),this.syncLogicalView()}}return e}setPerspective(t,e){const i=this.canvas;this.perspective=t,e&&!i.is360||(this.perspective=Math.min(this.maxPerspective,Math.max(this.minPerspective,this.perspective))),(i.coverLimit||this.limitY>0)&&this.limitPitch(),this.limitX>0&&this.limitYaw(),this.pMatrix.perspective(this.perspective,i.el.aspect,1e-4,i.is360?20:100),this.readScale(),this.update(!0),this.calculate3DFrustum(),this.syncLogicalView()}readScale(){const t=this.canvas.el,e=t.width/2,i=t.height/2,s=this.getCoo(e,i).x,r=this.getCoo(e+1,i+1).x;this.scale=1/(r+(r<s?1:0)-s)/this.canvas.width}setDirection(t,e,i){this.yaw=uc(t-this.baseYaw),this.pitch=e,0!==i?this.setPerspective(i,!1):this.update(),this.calculate3DFrustum(),this.syncLogicalView()}setView(t,e,i,s,r=!1,n=!1){this.yaw=((n?t+this.offX:t)-.5)*oc*2,this.pitch=(e-.5)*oc*this.scaleY,this.setPerspective(Math.min(this.maxPerspective,s*oc*this.scaleY),r),this.calculate3DFrustum(),this.syncLogicalView()}syncLogicalView(){const t=this.canvas;if(!t.is360)return;const e=dc(this.yaw/(2*oc)+.5),i=this.pitch/this.scaleY/oc+.5,s=this.perspective/oc/this.scaleY,r=s*(0===t.el.width?1:.5*Math.sqrt(t.el.aspect))/(t.aspect/2);t.view.set(e,i,r,s),t.view.changed=!0}calculate3DFrustum(){if(!this.canvas.is360)return;const t=this.yaw,e=this.pitch;this.cameraForwardX=Math.cos(e)*Math.sin(t),this.cameraForwardY=Math.sin(e),this.cameraForwardZ=Math.cos(e)*Math.cos(t),this.cameraUpX=-Math.sin(e)*Math.sin(t),this.cameraUpY=Math.cos(e),this.cameraUpZ=-Math.sin(e)*Math.cos(t),this.cameraRightX=Math.cos(t),this.cameraRightY=0,this.cameraRightZ=-Math.sin(t);const i=2*Math.atan(1/this.perspective);this.aspectRatio=this.canvas.el.width/this.canvas.el.height;const s=i/2;this.fieldOfView=2*Math.atan(Math.tan(s)*this.aspectRatio)}moveTo(t,e,i,s){const r=i*oc*2+s;this.position.x=-t*Math.sin(r),this.position.y=e,this.position.z=t*Math.cos(r),this.canvas.view.changed=!0,this.update()}resize(){const t=this.canvas,e=t.el;t.camera.setCanvas(),this.minPerspective=Math.min(.5,e.height/t.height)/t.maxScale*this.scaleY*oc/e.ratio*e.scale,this.setPerspective(this.perspective,!0)}ensureInverse(){this.inverseDirty&&(this.cachedInverse.copy(this.pMatrix),this.cachedInverse.invert(),this.inverseDirty=!1)}getCoo(t,e){const i=this.canvas.el;return this.vec4.x=t*i.ratio/i.width*2-1,this.vec4.y=-(e*i.ratio/i.height*2-1),this.vec4.z=1,this.vec4.w=1,this.ensureInverse(),this.vec4.transformMat4(this.cachedInverse),this.vec4.normalize(),this.coo.x=Math.atan2(this.vec4.x,-this.vec4.z)/oc/2+.5,this.coo.y=.5-Math.asin(this.vec4.y)/oc/this.scaleY,this.coo.scale=this.scale,this.coo.w=this.position.x+this.position.z,this.coo.direction=this.yaw+this.baseYaw,this.coo.toArray(),this.coo}getXYZ(t,e){const i=this.canvas.el;return this.getVec3(t+this.offX,e),this.coo.x=(this.vec4.x+1)/2*i.width/i.ratio,this.coo.y=(1-this.vec4.y)/2*i.height/i.ratio,this.coo.scale=this.scale,this.coo.w=-this.vec4.w,this.coo.toArray(),this.coo}getVec3(t,e,i=!1,s=this.radius){t*=2*-oc,e-=.5,e*=-oc,e*=this.scaleY;const r=Math.cos(e);return this.vec4.x=r*Math.sin(t)*s,this.vec4.y=Math.sin(e)*s,this.vec4.z=r*Math.cos(t)*s,this.vec4.w=1,i||this.vec4.transformMat4(this.pMatrix),this.vec4}getMatrix(t,e,i,s,r,n,a,o,h=1,c=1,l=!1){isNaN(s)&&(s=this.radius),this.iMatrix.identity(),s*=this.radius*(100/cc),t*=2*-oc,e-=.5,e*=oc*this.scaleY;const d=Math.cos(e);return this.vec4.x=d*Math.sin(t),this.vec4.y=Math.sin(e),this.vec4.z=d*Math.cos(t),this.iMatrix.translate(this.position.x*s/this.radius,-this.position.y*s/this.radius+o*this.radius,this.position.z*s/this.radius),this.iMatrix.translate(this.vec4.x*s,this.vec4.y*s,this.vec4.z*s),this.iMatrix.rotateY(Math.atan2(this.vec4.x,this.vec4.z)+oc+n),this.iMatrix.rotateX(this.vec4.y+r),this.iMatrix.rotateZ(a),this.iMatrix.scaleXY(h,c),this.iMatrix.scaleFlat(i/oc/this.radius),this.iMatrix.multiply(this.rMatrix),this.iMatrix}setTile360(t,e,i,s){e*=this.scaleY,e/=2,e-=.25,e+=this.offY,s*=this.scaleY,s/=2;const r=this.canvas.main.vertexBuffer360,n=this.radius,a=i/16,o=s/16,h=2*oc;for(let c=0;c<16;c++)for(let i=0;i<16;i++){const s=6*(16*c+i)*3,l=-dc(t+a*i+this.offX)*h,d=-(e+o*c)*h,u=-dc(t+a*(i+1)+this.offX)*h,m=-(e+o*(c+1))*h;let g=Math.cos(l)*n;isNaN(g)&&(g=0);let p=Math.sin(l)*n;isNaN(p)&&(p=0);let f=Math.cos(u)*n;isNaN(f)&&(f=0);let v=Math.sin(u)*n;isNaN(v)&&(v=0);const w=Math.cos(d),y=Math.cos(m),b=Math.sin(d)*n,x=Math.sin(m)*n;r[s+0]=w*p,r[s+1]=b,r[s+2]=w*g,r[s+3]=r[s+9]=y*p,r[s+4]=r[s+10]=x,r[s+5]=r[s+11]=y*g,r[s+6]=r[s+15]=w*v,r[s+7]=r[s+16]=b,r[s+8]=r[s+17]=w*f,r[s+12]=y*v,r[s+13]=x,r[s+14]=y*f}}},Pc=class t{get zIndex(){return this._zIndex}set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.parent&&(this.parent.childrenDirty=!0))}constructor(t,e,i,s,r,n,a=!1){this.main=t,this.width=e,this.height=i,this.targetOpacity=s,this.coverLimit=r,this.hasParent=a,this.rect=new yc,this.el=new Tc,this.images=[],this.children=[],this.areaAniPerc=1,this.areaAniPaused=!1,this._zIndex=0,this.childrenDirty=!1,this.toDraw=[],this.index=0,this.isVisible=!1,this.opacity=0,this.bOpacity=0,this.isReady=!1,this.activeImageIdx=-1,this.omniFieldOfView=0,this.omniVerticalAngle=0,this.omniDistance=0,this.omniOffsetX=0,this.limited=!1,this.layer=0,this.tileSize=n.tileSize,this.is360=n.is360,this.noImage=n.noImage,this.isSingle=n.isSingle,this.freeMove=n.freeMove,this.coverStart=!!r||n.coverStart,this.maxScale=n.maxScale,this.scaleMultiplier=n.scaleMultiplier,this.camSpeed=n.camSpeed,this.rotationY=n.rotationY,this.isGallerySwitch=n.isGallerySwitch,this.pagesHaveBackground=n.pagesHaveBackground,this.isOmni=n.isOmni,this.pinchZoomOutLimit=n.pinchZoomOutLimit,this.omniNumLayers=n.omniNumLayers,this.omniStartLayer=n.omniStartLayer,this.index=t.canvases.length,a||t.canvases.push(this),this.aspect=e/i,this.view=new bc(this),this.focus=new bc(this),this.ani=new _c(this),this.kinetic=new kc(this),this.camera=new Mc(this),this.webgl=new Lc(this),this.area=new bc(this),this.currentArea=new bc(this),this.targetArea=new bc(this),this.visible=new bc(this),this.full=new bc(this),n.is360&&this.view.set(.5,.5,1,.5),a||(this.el.copy(t.el),this.setView(this.view.centerX,this.view.centerY,this.view.width,this.view.height,!1,!1),this.resize()),n.noImage?(this.main.numImages++,this.bOpacity=1,this.opacity=1,this.isReady=!0,n.omniStartLayer>0&&this.setActiveLayer(n.omniStartLayer)):this.addImage(0,0,1,1,e,i,n.tileSize,n.isSingle,!1,s,0,0,0,1,0)}setParent(t){this.parent=t,this.index+=t.children.length}addImage(t,e,i,s,r,n,a,o,h,c,l,d,u,m,g){const p=new Ac(this,this.main.numImages++,this.images.length,r,n,a,o,h,this.main.numTiles,c,c,l,d,u,m,g);return p.setArea(t,e,i,s),this.images.push(p),this.main.numTiles=p.endOffset,1===this.images.length&&this.setActiveImage(0,0),p}addChild(e,i,s,r,n,a){const o=new t(this.main,n,a,1,!0,{tileSize:this.tileSize,is360:!1,noImage:!1,isSingle:!1,freeMove:!1,coverStart:!0,maxScale:1,scaleMultiplier:1,camSpeed:this.camSpeed,rotationY:0,isGallerySwitch:!1,pagesHaveBackground:!1,isOmni:!1,pinchZoomOutLimit:this.pinchZoomOutLimit,omniNumLayers:1,omniStartLayer:0},!0);return o.setParent(this),o.setArea(e,i,s,r,!0,!0),this.children.push(o),o}stepOpacity(){const t=1/(0!==this.main.distanceX||0!==this.main.distanceY?this.main.spacesTransitionDuration:1===this.main.canvases.length?.25:this.main.crossfadeDuration)/this.main.frameTime,e=this.targetOpacity>0&&this.targetOpacity>=this.opacity;if(this.opacity=e?Math.min(1,this.opacity+t):Math.max(0,this.opacity-t),this.bOpacity=pc.get(this.opacity),0!==this.main.distanceX||0!==this.main.distanceY){const t=0===this.opacity?0:pc.get(1-this.opacity)*(e?1:-1);this.webgl.moveTo(this.main.distanceX*t*8,this.main.distanceY*t*8,this.main.direction,0)}}setCanvasVisible(t){this.main.setCanvasVisible(this,t),this.isVisible=t}fadeOut(){this.targetOpacity=0,this.zIndex=0}fadeIn(){if(this.isReady=!0,!this.hasParent&&1===this.currentArea.width&&1===this.currentArea.height)for(let t=0;t<this.main.canvases.length;t++)this.main.canvases[t]!==this&&this.main.canvases[t].fadeOut();this.targetOpacity=1}areaAnimating(){return!this.areaAniPaused&&this.areaAniPerc<1}isHidden(){return 0===this.targetOpacity&&0===this.opacity||0===this.currentArea.width||0===this.currentArea.height}shouldDraw(){if(!this.areaAnimating()&&this.isHidden())return void(this.isVisible&&this.setCanvasVisible(!1));!this.isVisible&&this.opacity>=1&&this.setCanvasVisible(!0);let t=this.ani.step(this.main.now)<1||this.kinetic.step(this.main.now)<1||!this.isReady;if(this.toDraw.length=0,this.partialView(!1)&&(t=!0),!this.is360&&(this.visible.width<=0||this.visible.height<=0))return;this.webgl.calculate3DFrustum(),this.isReady&&this.opacity!==this.targetOpacity&&(this.stepOpacity(),t=!0);const e=(this.is360?this.webgl.scale:this.camera.scale)*this.el.scale;for(let i=0;i<this.images.length;i++){const s=this.images[i];s.shouldRender()?(i>0&&!s.doRender&&this.main.setImageVisible(s,s.doRender=!0),s.isVideo&&s.isVideoPlaying&&(t=!0),s.opacityTick(this.isGallerySwitch||this.opacity<1)&&(t=!0),s.opacity>0&&(this.main.doneTotal+=s.getTiles(e))):s.doRender&&this.main.setImageVisible(s,s.doRender=!1)}this.main.toDrawTotal+=this.toDraw.length,this.main.progress=0===this.main.toDrawTotal?1:this.main.doneTotal/this.main.toDrawTotal,this.view.toArray();for(let i=0;i<this.children.length;i++)this.children[i].shouldDraw();t&&(this.main.animating=!0)}draw(){if(0===this.targetOpacity&&0===this.opacity)return;const t=this.ani.isStarted();if(this.main.setViewport(this.el.left,this.main.el.height-this.el.height-this.el.top,this.el.width,this.el.height),this.main.setMatrix(this.webgl.pMatrix.arr),this.pagesHaveBackground)for(let i=0;i<this.images.length;i++){const t=this.images[i];t.x1<=this.view.x0||t.x0>=this.view.x1||t.y1<=this.view.y0||t.y0>=this.view.y1||(this.setTile(t.endOffset-1),this.main.drawQuad(t.tOpacity))}const e=this.rect;for(let i=0;i<this.toDraw.length;i++){const s=this.toDraw[i];this.setTile(s);const r=e.layer===e.image.targetLayer-1||!this.main.bareBone&&e.layer===e.image.targetLayer,n=s===e.image.endOffset-1,a=this.main.getTileOpacity(s);(r||1===a||n)&&this.main.drawTile(e.image.index,s,e.layer,e.x,e.y,a*this.bOpacity*e.image.opacity,t,e.layer===e.image.targetLayer-1)&&n&&(e.image.gotBase=this.main.now,this.isReady||this.fadeIn())}this.childrenDirty&&(this.children.sort((t,e)=>t.zIndex>e.zIndex?1:t.zIndex<e.zIndex?-1:0),this.childrenDirty=!1);for(let i=0;i<this.children.length;i++)this.children[i].draw();this.view.changed&&this.main.viewSet(this),this.view.changed=!1}partialView(t){const e=this.main.el,i=this.hasParent,s=i?this.parent.getScale():1/e.ratio,r=i?this.parent.width:e.width,n=i?this.parent.height:e.height,a=i?this.parent.view:this.full,o=this.view,h=this.currentArea,c=this.area,l=this.targetArea,d=this.areaAnimating();if(d){const t=1/this.main.gridTransitionDuration/this.main.frameTime;this.areaAniPerc=Math.min(1,this.areaAniPerc+t);const e=this.main.gridTransitionTimingFunction.get(this.areaAniPerc),i=c.centerX+(l.centerX-c.centerX)*e,s=c.centerY+(l.centerY-c.centerY)*e,r=c.width+(l.width-c.width)*e,n=c.height+(l.height-c.height)*e;h.set(i,s,r,n),1===this.areaAniPerc&&(1===this.zIndex&&(this.zIndex=0),c.copy(l)),this.view.changed=!0}let u=Math.max(o.x0,o.x0+(a.x0-h.x0)/h.width*o.width),m=Math.min(o.x1,o.x0+(1-(h.x1-Math.min(h.x1,a.x1))/h.width)*o.width);this.is360||(u=Math.max(0,u),m=Math.min(1,m));let g=Math.max(Math.max(0,o.y0),o.y0+(a.y0-h.y0)/h.height*o.height),p=Math.min(Math.min(1,o.y1),o.y0+(1-(h.y1-Math.min(h.y1,a.y1))/h.height)*o.height);g=Math.max(g,0),p=Math.min(p,1);const f=(u+m)/2,v=(g+p)/2,w=m-u,y=p-g;this.visible.set(f,v,w,y);const b=i?1:e.ratio;return this.targetOpacity<this.opacity||!this.el.set(h.width*s*r,h.height*s*n,(h.x0-a.x0)*r*s,(h.y0-a.y0)*n*s,b,i?1:e.scale,!i&&e.isPortrait)||(t||this.sendViewport(),this.view.changed=!0,this.resize(),this.camera.setCanvas(),this.webgl.update()),d}setArea(t,e,i,s,r,n){this.areaAniPaused=!1,r?(this.area.setArea(t,e,i,s),this.currentArea.setArea(t,e,i,s)):(this.area.copy(this.currentArea),this.areaAniPerc=0,0===this.zIndex&&(this.zIndex=1),this.ani.limit=!1),this.targetArea.setArea(t,e,i,s),this.partialView(n)}setTile(t){const e=this.rect;if(this.findTileRect(t),this.is360)0===e.image.localIdx?this.webgl.setTile360(e.x0,e.y0,e.x1-e.x0,e.y1-e.y0):e.image.setDrawRect(e);else{const t=this.main.vertexBuffer,i=this.aspect;t[0]=t[3]=t[9]=(e.x0-.5)*i,t[1]=t[7]=t[16]=.5-e.y0,t[4]=t[10]=t[13]=.5-e.y1,t[6]=t[12]=t[15]=(e.x1-.5)*i,t[2]=t[5]=t[8]=t[11]=t[14]=t[17]=0}}sendViewport(){const t=this.main.el;this.main.viewportSet(this,this.el.left/t.ratio,this.el.top/t.ratio,this.el.width/t.ratio,this.el.height/t.ratio)}findTileRect(t){let e=0;for(;t>=this.images[e].endOffset;)e++;const i=this.images[e];let s=0;for(;t>=i.layers[s].end;)s++;i.layers[s].getTileRect(t,this.rect)}resize(){if(this.children.length){const t=this.main.el;this.width=t.width,this.height=t.height}this.hasParent||(this.is360?this.webgl.resize():(this.camera.setCanvas(),this.webgl.update()))}reset(){if(this.kinetic.stop(),this.ani.stop(),this.images.length>0){const t=this.images[0];t.gotBase=0,t.opacity=0}}remove(){this.setCanvasVisible(!1),this.main.remove(this)}replace(){this.main.canvases.push(this)}setActiveLayer(t){this.layer=t,this.setActiveImage(this.activeImageIdx,0),this.view.changed=!0}setActiveImage(t,e){const i=this.layer*(this.images.length/this.omniNumLayers);for(let s=0;s<this.images.length;s++){const r=this.images[s],n=s-i-t;0!==n?r.tOpacity=n>=0&&n<=e?1:0:(r.tOpacity=1,this.activeImageIdx=t,this.view.changed=!0)}this.camera.correctMinMax()}setFocus(t,e,i,s,r){const n=(t+i)/2,a=(e+s)/2,o=i-t,h=s-e;if(!this.focus.equals(n,a,o,h)){this.activeImageIdx=-1;for(let r=0;r<this.images.length;r++){const n=this.images[r];n.x1<=t||n.x0>=i||n.y1<=e||n.y0>=s?n.tOpacity=0:(n.tOpacity=1,this.activeImageIdx=r)}this.focus.set(n,a,o,h),this.camera.correctMinMax(),r||(this.camera.setView(),this.webgl.update())}}getCoo(t,e,i,s){return(this.is360?this.webgl.getCoo(t,e):this.camera.getCoo(t,e,i,s)).toArray()}getXY(t,e,i,s,r){return(this.is360?this.webgl.getXYZ(t,e):isNaN(s)?this.camera.getXY(t,e,i):this.camera.getXYOmni(t,e,s,isNaN(r)?0:r,i)).toArray()}getView(){return this.view.arr}setView(t,e,i,s,r,n,a=!1,o=!1){const h=this.main.el;h.areaHeight>0&&(s+=s/(1-h.areaHeight/h.height),this.ani.limit=!1,h.areaHeight=0),h.areaWidth>0&&(i+=i*(h.areaWidth/h.width),this.ani.limit=!1,h.areaWidth=0),r&&(this.ani.limit=!1),this.view.set(t,e,i,s),o&&!r&&this.view.limit(!1,!1,this.freeMove),n||this.ani.lastView.copy(this.view),this.width>0&&(this.is360?(this.webgl.setView(t,e,i,s,r,a),this.view.set(t,e,i,s)):this.camera.setView()&&this.webgl.update())}getScale(){return this.is360?this.webgl.scale:this.camera.scale}isZoomedIn(){return this.is360?this.webgl.perspective<=this.webgl.minPerspective:this.camera.isZoomedIn()}isZoomedOut(t=!1){return this.is360?this.webgl.perspective>=this.webgl.maxPerspective:this.camera.isZoomedOut(t)}setDirection(t,e,i){isNaN(e)&&(e=this.webgl.pitch),this.webgl.setDirection(t,e,i?this.webgl.defaultPerspective:0)}getMatrix(t,e,i,s,r,n,a,o,h=1,c=1,l=!1){const d=2e4/this.width;return this.webgl.getMatrix(t,e,i*d,s,r,n,a,o,h,c,l).toArray()}aniPause(t){this.areaAniPaused=!0,this.ani.pause(t)}aniResume(t){this.areaAniPaused=!1,this.ani.resume(t)}aniStop(){this.ani.stop();for(let t=0;t<this.children.length;t++)this.children[t].aniStop()}aniDone(){this.main.aniDone(this)}aniAbort(){this.main.aniAbort(this)}},$c=class{constructor(t){this.el=new Tc,this.vertexBuffer=new Float32Array(18),this.vertexBuffer360=new Float32Array(4608),this.canvases=[],this.numTiles=0,this.numImages=0,this.now=0,this.animating=!1,this.progress=0,this.toDrawTotal=0,this.doneTotal=0,this.crossfadeDuration=.25,this.gridTransitionDuration=.5,this.gridTransitionTimingFunction=pc,this.spacesTransitionDuration=.5,this.embedFadeDuration=.5,this.dragElasticity=1,this.hasArchive=!1,this.archiveLayerOffset=0,this.underzoomLevels=4,this.skipBaseLevels=0,this.bareBone=!1,this.isSwipe=!1,this.noPinchPan=!1,this.direction=0,this.distanceX=0,this.distanceY=0,this.frameTime=1/60,this._host=t}get drawTile(){return this._host.drawTile}get drawQuad(){return this._host.drawQuad}get getTileOpacity(){return this._host.getTileOpacity}get setTileOpacity(){return this._host.setTileOpacity}get setMatrix(){return this._host.setMatrix}get setViewport(){return this._host.setViewport}get aniDone(){return this._host.aniDone}get aniAbort(){return this._host.aniAbort}get viewSet(){return this._host.viewSet}get viewportSet(){return this._host.viewportSet}get setCanvasVisible(){return this._host.setCanvasVisible}get setImageVisible(){return this._host.setImageVisible}shouldDraw(t){this.frameTime=1e3/Math.min(33,t-this.now),this.now=t,this.doneTotal=0,this.toDrawTotal=0,this.animating=!1;for(let e=0;e<this.canvases.length;e++)this.canvases[e].shouldDraw();return this.animating||this.progress<1}draw(){for(let t=0;t<this.canvases.length;t++)this.canvases[t].draw()}reset(){for(let t=0;t<this.canvases.length;t++)this.canvases[t].reset()}aniStop(){for(let t=0;t<this.canvases.length;t++)this.canvases[t].aniStop()}resize(t,e,i,s,r,n,a){this.el.set(t,e,i,s,r,n,a);for(let o=0;o<this.canvases.length;o++)this.canvases[o].resize()}remove(t){for(let e=0;e<this.canvases.length;e++)if(this.canvases[e]===t)return void this.canvases.splice(e,1)}},Cc=class t{static{this._textureBuffer=t.getTextureBuffer(1,1)}getCanvas(t){return this.canvasById.get(t.ptr)?.canvas}setEntry(t,e){this.canvasById.set(t,e),this.canvasToEntry.has(e.canvas)||this.canvasToEntry.set(e.canvas,e)}constructor(t){this.micrio=t,this.ready=!1,this.images=[],this.bareBone=!1,this.baseTiles=[],this.drawnSet=new Set,this.prevDrawnSet=new Set,this.tiles=new Map,this.requests=new Map,this.unsubscribe=[],this.cameras=new Map,this.ptrToImage=new Map,this.engImageToMicrio=new Map,this.preventDirectionSet=!1,this.isGallery=!1,this.now=-1,this.raf=-1,this.drawing=!1,this.activeCanvasEntry=null,this.canvasById=new Map,this.canvasToEntry=new Map,this.nextPtr=1,this.addImage=async(t,e,i=!1,s=1)=>en(t.info).then(r=>{if(!r)return;this.images.push(t);const n=t.opts.area??[0,0,1,1],a=t.$settings._360??{},o=this.canvasById.get(e.ptr);if(!o)return;let h;if(i){const e=o.canvas.addImage(n[0],n[1],n[2],n[3],r.width,r.height,r.tileSize||1024,r.isSingle??!1,r.isVideo??!1,s,a.rotX??0,a.rotY??0,a.rotZ??0,a.scale??1,0);this.engImageToMicrio.set(e,t);const i=this.nextPtr++;return t.ptr=i,this.setEntry(i,{canvas:o.canvas,micrioImage:t}),this.ptrToImage.set(i,t),t.baseTileIdx=this.engine.numTiles-1,this.getTileEntry(t.baseTileIdx).opacity=1,void this.baseTiles.push(t.baseTileIdx)}h=o.canvas.addChild(n[0],n[1],n[2],n[3],r.width,r.height);const c=this.nextPtr++;if(t.ptr=c,this.setEntry(c,{canvas:h,micrioImage:t}),this.ptrToImage.set(c,t),!i){this.bindCamera(t),t.$settings.focus&&h.camera.setCoo(t.$settings.focus[0],t.$settings.focus[1],0,0,0,!1,0,performance.now());const e=t.$info.view;e&&"0,0,1,1"!=e.toString()&&h.setView(e[0],e[1],e[2],e[3],!1,!1,!1,!1),h.sendViewport()}t.baseTileIdx=this.engine.numTiles-1,this.getTileEntry(t.baseTileIdx).opacity=1,this.baseTiles.push(t.baseTileIdx)}),this.addChild=(t,e)=>this.addImage(t,e),this.deleteAfterSeconds=Jr.iOS?5:wt(this.micrio.canvas.isMobile)?30:90,this.render=this.render.bind(this),this.draw=this.draw.bind(this),this.unsubscribe.push(t.current.subscribe(this.setCanvas.bind(this)))}static getTextureBuffer(t,e){const i=new Float32Array(12*t*e),s=1/t,r=1/e;for(let n=0,a=0;a<e;a++)for(let e=0;e<t;e++,n+=12)i[n+3]=i[n+7]=i[n+9]=(i[n+1]=i[n+5]=i[n+11]=a*r)+r,i[n+4]=i[n+8]=i[n+10]=(i[n+0]=i[n+2]=i[n+6]=e*s)+s;return i}async load(){if(this.engine)return;const e=new $c({drawTile:this.drawTile.bind(this),drawQuad:this._hostDrawQuad.bind(this),getTileOpacity:this._hostGetTileOpacity.bind(this),setTileOpacity:this._hostSetTileOpacity.bind(this),setMatrix:this._hostSetMatrix.bind(this),setViewport:this._hostSetViewport.bind(this),aniDone:this._hostAniDone.bind(this),aniAbort:this._hostAniAbort.bind(this),viewSet:this._hostViewSet.bind(this),viewportSet:this._hostViewportSet.bind(this),setCanvasVisible:this._hostSetCanvasVisible.bind(this),setImageVisible:this._hostSetImageVisible.bind(this)});this._vertexBuffer=e.vertexBuffer,this._vertexBuffer360=e.vertexBuffer360,t._textureBuffer360=t.getTextureBuffer(16,16),this.engine=e,this.unsubscribe.push(this.micrio.barebone.subscribe(t=>{this.bareBone=t,this.engine.bareBone=t}))}findCamera(t){const e=this.canvasToEntry.get(t);return e?this.cameras.get(e.micrioImage.ptr):void 0}findEntry(t){if(t instanceof Pc)return this.canvasToEntry.get(t)}_hostDrawQuad(t){this.micrio.webgl.drawTile(void 0,t)}_hostGetTileOpacity(t){return this.tiles.get(t)?.opacity||0}_hostSetTileOpacity(t,e=!1,i=1){const s=this.tiles.get(t);return s?(s.opacity<1&&(s.opacity=e?1:s.loadedAt&&s.loadedAt>0?Math.min(1,(this.now-s.loadedAt)/250)*i:0),s.opacity):0}_hostSetMatrix(t){this.micrio.webgl.gl.uniformMatrix4fv(this.micrio.webgl.pmLoc,!1,t)}_hostSetViewport(t,e,i,s){this.micrio.webgl.gl.viewport(Math.floor(t),Math.floor(e),Math.ceil(i),Math.ceil(s))}_hostAniDone(t){const e=this.findCamera(t);if(e){for(e.aniDone&&e.aniDone();e.aniDoneAdd.length;)e.aniDoneAdd.shift()?.();e.aniAbort=e.aniDone=void 0}}_hostAniAbort(t){const e=this.findCamera(t);e&&(e.aniAbort&&e.aniAbort(),e.aniDoneAdd.length=0,e.aniAbort=e.aniDone=void 0)}_hostViewSet(t){this.findCamera(t)?.viewChanged()}_hostViewportSet(t,e,i,s,r){const n=this.findEntry(t);n&&"viewport"in n.micrioImage&&n.micrioImage.viewport.set([e,i,s,r])}_hostSetCanvasVisible(t,e){this.findEntry(t)?.micrioImage?.visible?.set(e)}_hostSetImageVisible(t,e){const i=this.engImageToMicrio.get(t);i&&"visible"in i&&i.visible.set(e)}unbind(){for(this.stop();this.unsubscribe.length;)this.unsubscribe.shift()?.();this.requests.forEach(t=>ac(t)),this.requests.clear();for(const[t,e]of this.tiles.entries())e.timeoutId&&clearTimeout(e.timeoutId),this.deleteTile(t);this.tiles.clear(),this.engine&&this.engine.reset()}addCanvas(t){const e=t.$info;if(!e)return;if(t.error)return void this.micrio.loading.set(!1);if(!(t.noImage||e.width&&e.height))throw"Invalid Micrio image size";const i=t.$settings;this.isGallery=!!e.gallery||t.isOmni,i.gallery?.archive&&(this.engine.hasArchive=!0,this.engine.archiveLayerOffset=i.gallery.archiveLayerOffset??0),e.version&&parseFloat(e.version)<=3.1&&(this.engine.underzoomLevels=8),e.is360&&(i.limitToCoverScale=!1);const s=!!i.limitToCoverScale,r=s||"cover"==i.initType;t.noImage&&this.micrio.loading.set(!1);const n=[.5,.5],a=i.focus,o=!!e.spacesId;a&&(isNaN(a[0])||null===a[0]||(n[0]=a[0]),isNaN(a[1])||null===a[1]||(n[1]=a[1]));const h=i._360?.video,c=e.is360&&h&&(h.src||"video"in h&&h.video),l=!!this.isGallery&&("switch"==i.gallery?.type||"omni"==i.gallery?.type||"swipe-full"==i.gallery?.type),d=i.omni?.layers?.length??1;i.omni&&(i.omni.layerStartIndex=Math.min(d-1,i.omni?.layerStartIndex??0));const u=new Pc(this.engine,e.width,e.height,t.opacity,s,{tileSize:e.tileSize??1024,is360:e.is360??!1,noImage:t.noImage,isSingle:!(!e.isSingle&&!c),freeMove:i.freeMove??!1,coverStart:r,maxScale:i.zoomLimit||1,scaleMultiplier:!1!==i.zoomLimitDPRFix?this.micrio.canvas.getRatio(t.$settings):1,camSpeed:i.camspeed??1,rotationY:t.camera.rotationY,isGallerySwitch:l,pagesHaveBackground:!!i.gallery?.isSpreads&&"swipe"==i.gallery.type,isOmni:t.isOmni,pinchZoomOutLimit:i.pinchZoomOutLimit??!1,omniNumLayers:d,omniStartLayer:i.omni?.layerStartIndex??0},!1),m=this.nextPtr++;t.ptr=m,this.setEntry(m,{canvas:u,micrioImage:t}),this.images.push(t),this.ptrToImage.set(t.ptr,t),this.cameras.set(t.ptr,t.camera),this.bindCamera(t),t.opts.area&&t.camera.setArea(t.opts.area,{direct:!0,noDispatch:!0,noRender:!0}),i?.restrict&&t.camera.setLimit(i.restrict),i?.crossfadeDuration&&this.setCrossfadeDuration(i.crossfadeDuration),i?.embedFadeDuration&&(this.engine.embedFadeDuration=i.embedFadeDuration),void 0!==i?.dragElasticity&&(this.engine.dragElasticity=i.dragElasticity),i?.skipBaseLevels&&(this.engine.skipBaseLevels=i.skipBaseLevels),i?.omni&&t.camera.setOmniSettings(),this.micrio.hasAttribute("data-limited")&&this.setLimited(t.ptr,!0),u.sendViewport();const g=this.engine.numTiles;if(g>0){const t=g-1;this.getTileEntry(t).opacity=1,this.baseTiles.push(t)}const p=wt(t.state.view)||i.view;!p||0==p[0]&&0==p[1]&&1==p[2]&&1==p[3]?!o&&e.is360||!n||"0.5,0.5"==n.toString()||(u.camera.setCoo(n[0],n[1],0,0,0,!1,0,performance.now()),i.focus=void 0):u.setView(p[0]+p[2]/2,p[1]+p[3]/2,p[2],p[3],!1,!1,!1,!1),t.video.subscribe(t=>t&&t.addEventListener("play",this.render)),t.noImage&&t.visible.set(!0),this.setCanvas(t)}bindCamera(t){const e=this.canvasById.get(t.ptr).canvas;this.cameras.set(t.ptr,t.camera),t.camera.bindEngineCanvas(e),e.is360?t.camera.assign(e.view.arr,e.webgl.coo.arr,e.webgl.coo.arr,e.webgl.iMatrix.arr):t.camera.assign(e.view.arr,e.camera.xy.arr,e.camera.coo.arr,e.webgl.pMatrix.arr)}setCanvas(t){if(t&&!(t.ptr>0&&t.ptr===this.activeCanvasEntry?.micrioImage.ptr))if(t.ptr<0)en(t.info).then(e=>{e&&this.micrio.$current&&(e.isIIIF||t.opts.secondaryTo||e.id==this.micrio.$current.id)&&(this.addCanvas(t),t.embeds.length&&t.embeds.forEach(e=>this.addEmbed(e,t)))});else if(t.ptr!==this.activeCanvasEntry?.micrioImage.ptr){const e=this.canvasById.get(t.ptr);if(!e)return;const i=t.is360&&this.activeCanvasEntry?this.activeCanvasEntry.canvas.webgl.pitch:0;if(this.activeCanvasEntry=e,t.is360&&!this.preventDirectionSet){const s=(this.engine.direction+.5)%1*Math.PI*2;e.canvas.setDirection(s-t.camera.rotationY,i,!0)}0===e.canvas.targetOpacity&&e.canvas.fadeIn(),t.$settings.omni?.layerStartIndex&&t.state.layer.set(t.$settings.omni.layerStartIndex),this.preventDirectionSet=!1,this.ready=!0,this.render()}}removeCanvas(t){if(t.ptr<0)throw"Canvas is not placed yet";const e=this.canvasById.get(t.ptr);e&&(e.canvas.remove(),this.canvasById.delete(t.ptr),this.render())}render(){this.raf<0&&(this.raf=this.micrio.webgl.display.requestAnimationFrame(this.draw))}draw(t=performance.now()){this.micrio.isConnected&&this.micrio.$current&&(this.raf=-1,this.drawing=!1,this.now=t,(this.engine.shouldDraw(t)||this.micrio.keepRendering||this.micrio.events.isNavigating||!1===this.micrio._current?._video?.paused)&&this.render(),this.isGallery&&this.drawStart(),this.drawnSet.clear(),this.engine.draw(),this.micrio.events.dispatch("draw"),this.cleanup(),this.micrio.webgl.drawEnd())}stop(){this.raf<0||(this.micrio.webgl.display.cancelAnimationFrame(this.raf),this.raf=-1)}getTileEntry(t){let e=this.tiles.get(t);return e||(e={loadState:0,opacity:0},this.tiles.set(t,e)),e}drawTile(t,e,i,s,r,n,a,o){this.drawnSet.add(e);const h=this.getTileEntry(e);h.deleteAt=void 0;const c=nc(),l=this.images[t],d="camera"in l&&l.isVideo,u="camera"in l&&l.is360,m="camera"in l?l:l.image,g="frame"in l?l.frame:void 0;if(0===h.loadState&&c<Jh){if(this.bareBone?c>2&&a:o&&a&&c>0)return!1;if(d&&!u)h.loadState=2,h.texture=this.micrio.webgl.getTexture();else{h.loadState=1;const t=m.getTileSrc(i,s,r,g);if(!t)return h.loadState=0,!1;this.getTexture(e,t,a,{noSmoothing:"$info"in l&&l.$settings.noSmoothing})}}else if(h.loadState>=2){if(this.drawing||this.drawStart(),h.texture){if(d){if(!m._video||!m._video.dataset.playing)return!1;this.micrio.webgl.updateTexture(h.texture,m._video)}this.micrio.webgl.drawTile(h.texture,n,u)}return 2===h.loadState&&(h.loadState=3,h.loadedAt=this.now),!0}return!1}drawStart(){this.drawing||(this.micrio.webgl.drawStart(),this.drawing=!0)}getTexture(t,e,i,s={}){if(this.tiles.get(t)?.texture||this.requests.has(t)||!s.force&&nc()>=Jh)return;const r=Ah.db.has(e);r||this.micrio.loading.set(!0),this.requests.set(t,e),(r?Ah.getImage(e):sc(e)).then(e=>this.gotTexture(t,e,i,s.noSmoothing)).catch(()=>this.deleteRequest(t))}gotTexture(t,e,i,s){const r=this.getTileEntry(t);r.texture=this.micrio.webgl.getTexture(e,r.texture,s),void 0!==self.ImageBitmap&&e instanceof ImageBitmap&&e.close instanceof Function&&e.close(),r.loadState=2,r.timeoutId=setTimeout(()=>{this.deleteRequest(t)},i?150:50)}deleteRequest(t){this.requests.delete(t);const e=this.tiles.get(t);e?.timeoutId&&(clearTimeout(e.timeoutId),e.timeoutId=void 0),this.requests.size||this.micrio.loading.set(!1)}deleteTile(t){const e=this.tiles.get(t);e&&(e.texture&&this.micrio.webgl.gl.deleteTexture(e.texture),e.timeoutId&&clearTimeout(e.timeoutId),this.tiles.delete(t))}cleanup(){const t=performance.now();for(const e of this.prevDrawnSet){if(this.drawnSet.has(e))continue;if(this.baseTiles.includes(e))continue;const i=this.tiles.get(e);if(i&&0!==i.loadState)switch(i.opacity=0,i.loadState){case 1:const s=this.requests.get(e);s&&ac(s),i.loadState=0;break;case 2:this.requests.has(e)&&this.deleteRequest(e),this.deleteTile(e);break;case 3:i.deleteAt||(i.deleteAt=t)}}this.prevDrawnSet=new Set(this.drawnSet);for(const[e,i]of this.tiles.entries())i.deleteAt&&(t-i.deleteAt)/1e3>this.deleteAfterSeconds&&this.deleteTile(e)}resize(t){this.engine.resize(t.width,t.height,t.left,t.top,t.ratio,t.scale,t.portrait),this.ready&&(this.stop(),this.draw())}addEmbed(t,e,i={}){if("camera"in t&&i.asImage)return this.addImage(t,e,!0,i.opacity??1);{const s="$info"in t?t.$info:e.$info;if(!s)return;this.images.push(t);const r=t.opts.area??[0,0,1,1],n=t instanceof Ph?t.$settings._360??{}:{},a=this.canvasById.get(e.ptr);if(!a)return;const o=a.canvas.addImage(r[0],r[1],r[2],r[3],s.width,s.height,s.tileSize||1024,s.isSingle??!1,s.isVideo??!1,i.opacity??1,n.rotX??0,n.rotY??0,n.rotZ??0,n.scale??1,i.fromScale??0);this.engImageToMicrio.set(o,t);const h=this.nextPtr++;t.ptr=h,this.setEntry(h,{canvas:a.canvas,micrioImage:t}),this.ptrToImage.set(h,t),t.baseTileIdx=this.engine.numTiles-1,this.getTileEntry(t.baseTileIdx).opacity=1,this.baseTiles.push(t.baseTileIdx)}}setActiveImage(t,e,i){this.getCanvas(this.ptrToImage.get(t))?.setActiveImage(e,i??0)}setActiveLayer(t,e){this.getCanvas(this.ptrToImage.get(t))?.setActiveLayer(e)}fadeImage(t,e,i=!1){const s=this.getCanvas(this.ptrToImage.get(t));if(s){if(this.cameras.has(t))s.targetOpacity=e;else{const t=s.images;for(let s=0;s<t.length;s++){const r=t[s];r.localIdx>0&&(r.tOpacity=e,i&&(r.opacity=e))}}this.render()}}setFocus(t,e,i=!1){this.getCanvas(this.ptrToImage.get(t))?.setFocus(e[0],e[1],e[2],e[3],i)}setZIndex(t,e){const i=this.getCanvas(this.ptrToImage.get(t));i&&(i.zIndex=e)}setGridTransitionDuration(t){this.engine.gridTransitionDuration=t}setGridTransitionTimingFunction(t){this.engine.gridTransitionTimingFunction=0===t?pc:1===t?fc:2===t?vc:3===t?wc:pc}setCrossfadeDuration(t){this.engine.crossfadeDuration=t}fadeTo(t,e,i){const s=this.getCanvas(this.ptrToImage.get(t));s&&(s.targetOpacity=e,i&&(s.opacity=e))}fadeIn(t){this.getCanvas(this.ptrToImage.get(t))?.fadeIn()}fadeOut(t){this.getCanvas(this.ptrToImage.get(t))?.fadeOut()}areaAnimating(t){return this.getCanvas(this.ptrToImage.get(t))?.areaAnimating()??!1}getActiveImageIdx(t){return this.getCanvas(this.ptrToImage.get(t))?.activeImageIdx??-1}setNoPinchPan(t){this.engine.noPinchPan=t}setIsSwipe(t){this.engine.isSwipe=t}ease(t){return pc.get(t)}panStart(t){this.getCanvas(this.ptrToImage.get(t))?.kinetic.stop()}panStop(t){this.getCanvas(this.ptrToImage.get(t))?.kinetic.start()}pinchStart(t){this.getCanvas(this.ptrToImage.get(t))?.camera.pinchStart()}pinch(t,e,i,s,r){this.getCanvas(this.ptrToImage.get(t))?.camera.pinch(e,i,s,r)}pinchStop(t,e){this.getCanvas(this.ptrToImage.get(t))?.camera.pinchStop(e)}setLimited(t,e){const i=this.getCanvas(this.ptrToImage.get(t));i&&(i.limited=e)}set360Orientation(t,e,i){this.engine.direction=t,this.engine.distanceX=e,this.engine.distanceY=i}setCanvasArea(t,e){this.engine.el.areaWidth=t,this.engine.el.areaHeight=e}setImageVideoPlaying(t,e){const i=this.getCanvas(this.ptrToImage.get(t));if(!i)return;const s=i.images;for(let r=0;r<s.length;r++)if(s[r].isVideo){s[r].isVideoPlaying=e;break}}},Dc=new Float32Array([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]),zc=class{constructor(t,e,i){if(this.gl=t,this.program=t.createProgram(),e.webgl.getShader(this.program,t.VERTEX_SHADER,"\nattribute vec2 a_position; // Vertex position (-1 to 1)\nattribute vec2 a_texCoord; // Texture coordinate (0 to 1)\n\nvarying vec2 v_texCoord; // Pass texCoord to fragment shader\n\nvoid main() {\n\tv_texCoord = a_texCoord; // Pass through texture coordinate\n\tgl_Position = vec4(a_position, 0.0, 1.0); // Set clip space position\n}"),e.webgl.getShader(this.program,t.FRAGMENT_SHADER,i),t.linkProgram(this.program),t.getProgramParameter(this.program,t.LINK_STATUS)||console.error("Postprocess shader link error:",t.getProgramInfoLog(this.program)),t.useProgram(this.program),this.ppPositionLoc=t.getAttribLocation(this.program,"a_position"),this.ppTexCoordLoc=t.getAttribLocation(this.program,"a_texCoord"),this.ppTimeLoc=t.getUniformLocation(this.program,"u_time"),this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.gl.drawingBufferWidth,this.gl.drawingBufferHeight,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this.frameBuffer=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,this.frameBuffer),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.texture,0),t.checkFramebufferStatus(t.FRAMEBUFFER)!==t.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer not complete");t.bindFramebuffer(t.FRAMEBUFFER,null),this.quad=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.quad),t.bufferData(t.ARRAY_BUFFER,Dc,t.STATIC_DRAW)}render(){const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,null),t.useProgram(this.program),t.bindBuffer(t.ARRAY_BUFFER,this.quad),t.enableVertexAttribArray(this.ppPositionLoc),t.vertexAttribPointer(this.ppPositionLoc,2,t.FLOAT,!1,4*Float32Array.BYTES_PER_ELEMENT,0),t.enableVertexAttribArray(this.ppTexCoordLoc),t.vertexAttribPointer(this.ppTexCoordLoc,2,t.FLOAT,!1,4*Float32Array.BYTES_PER_ELEMENT,2*Float32Array.BYTES_PER_ELEMENT),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.texture),t.uniform1f(this.ppTimeLoc,performance.now()/1e3),t.drawArrays(t.TRIANGLE_STRIP,0,4)}resize(){const t=this.gl;t.bindTexture(t.TEXTURE_2D,this.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.gl.drawingBufferWidth,this.gl.drawingBufferHeight,0,t.RGBA,t.UNSIGNED_BYTE,null),t.bindTexture(t.TEXTURE_2D,null)}dispose(){const t=this.gl;t.deleteFramebuffer(this.frameBuffer),t.deleteTexture(this.texture),t.deleteBuffer(this.quad),t.deleteProgram(this.program)}},Oc=Jr.firefox,Rc=`\nprecision mediump float; // Use medium precision for fragment calculations\n\nvarying highp vec2 vTextureCoord; // Received texture coordinate from vertex shader\n\nuniform sampler2D uSampler; // The tile texture\nuniform float opacity; // Tile opacity (for fading)\nuniform int noTexture; // Flag indicating if texture is missing/not loaded\n\nvoid main() {\n\tif(noTexture==1) { // If texture is missing\n\t\tgl_FragColor = vec4(.1,.1,.1,.1); // Draw a placeholder color (dark semi-transparent gray)\n\t} else {\n\t${Oc?"\n\t\t// Firefox premultiplied alpha workaround\n\t\tvec4 textureColor = texture2D(uSampler, vTextureCoord);\n\t\t// Manually apply opacity to RGB based on new alpha\n\t\tfloat newAlpha = min(1., textureColor.a * opacity);\n\t\tgl_FragColor = vec4(textureColor.rgb * newAlpha, newAlpha);":"\n\t\t// Standard alpha blending (premultiplied alpha assumed in blendFunc)\n\t\tgl_FragColor = texture2D(uSampler, vTextureCoord) * opacity;"}\n\t\t// Debug: Draw red instead of texture\n\t\t//gl_FragColor = vec4(1.,0.,0.,1.);\n\t}\n}`,Xc=256,Fc=class{constructor(t){this.micrio=t,this.display=self,this.txtAttr=-1,this.wmTexture=null,this.wmUrl=null,this.wmVerts=new Float32Array([-1,-1,0,1,-1,0,-1,1,0,-1,1,0,1,-1,0,1,1,0]),this.wmUvs=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0]),this.wmMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.wmOpacity=.075,this.posAttr=-1,this.was360=!1}init(){const t="WebGL2RenderingContext"in window,e=this.micrio.canvas.element.getContext(t?"webgl2":"webgl",{alpha:!0,preserveDrawingBuffer:this.micrio.hasAttribute("data-preserve-drawing-buffer"),stencil:!1,antialias:!1,depth:!1,desynchronized:!1});if(t?!(e instanceof window.WebGL2RenderingContext):!(e instanceof window.WebGLRenderingContext))throw new Nr("WebGL context creation failed",{code:Ir,displayMessage:"Your browser does not support WebGL, which is required to view this content. Please try a different browser."});this.gl=e;const i=this.micrio.$current?.$settings.postProcessingFragmentShader;i&&(this.postpocessor=new zc(e,this.micrio,i),this.micrio.keepRendering=!0);const s=e.createProgram();if(!(s instanceof WebGLProgram))throw new Nr("Failed to create WebGL program",{code:Lr,displayMessage:"There was a problem initializing the graphics. Please try refreshing the page."});this.program=s,this.getShader(this.program,e.VERTEX_SHADER,"\nuniform mat4 GLMatrix; // Combined ModelViewProjection matrix from Engine\n\nattribute vec3 pos; // Vertex position (from Engine buffer)\nattribute vec2 aTextureCoord; // Texture coordinate (from static buffer)\n\nvarying highp vec2 vTextureCoord; // Pass texture coordinate to fragment shader\n\nvoid main()\n{\n\tgl_Position = GLMatrix * vec4(pos, 1.0); // Calculate clip space position\n\tvTextureCoord = aTextureCoord; // Pass through texture coordinate\n}"),this.getShader(this.program,e.FRAGMENT_SHADER,Rc),e.linkProgram(this.program),e.getProgramParameter(this.program,e.LINK_STATUS)||console.error("Main shader link error:",e.getProgramInfoLog(this.program)),e.useProgram(this.program),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.enable(e.BLEND),e.disable(e.DEPTH_TEST),e.clearColor(0,0,0,0);const r=e.getUniformLocation(this.program,"opacity");if(!r)throw new Nr("Failed to bind WebGL opacity uniform",{code:Lr});this.opaLoc=r;const n=e.getUniformLocation(this.program,"GLMatrix");if(!n)throw new Nr("Failed to bind WebGL matrix uniform",{code:Lr});this.pmLoc=n;const a=e.getUniformLocation(this.program,"noTexture");if(!a)throw new Nr("Failed to bind WebGL texture uniform",{code:Lr});this.noTxtLoc=a,this.txtAttr=e.getAttribLocation(this.program,"aTextureCoord");const o=e.createBuffer();if(!o)throw new Nr("Failed to create WebGL texture buffer",{code:Pr,displayMessage:"Your device is low on memory. Try closing other browser tabs or applications."});this.txtBuffer=o,e.bindBuffer(e.ARRAY_BUFFER,this.txtBuffer),e.bufferData(e.ARRAY_BUFFER,Cc._textureBuffer,e.STATIC_DRAW);const h=e.createBuffer();if(!h)throw new Nr("Failed to create WebGL watermark buffer",{code:Pr,displayMessage:"Your device is low on memory. Try closing other browser tabs or applications."});this.wmTxtBuffer=h;const c=e.createBuffer();if(!c)throw new Nr("Failed to create WebGL geometry buffer",{code:Pr,displayMessage:"Your device is low on memory. Try closing other browser tabs or applications."});this.geomBuffer=c,this.posAttr=e.getAttribLocation(this.program,"pos"),this.linkBuffers(),e.viewport(0,0,this.gl.drawingBufferWidth,this.gl.drawingBufferHeight)}linkBuffers(){const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,this.geomBuffer),t.bufferData(t.ARRAY_BUFFER,this.micrio.engine._vertexBuffer,t.DYNAMIC_DRAW),t.enableVertexAttribArray(this.txtAttr),t.bindBuffer(t.ARRAY_BUFFER,this.txtBuffer),t.vertexAttribPointer(this.txtAttr,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(this.posAttr),t.bindBuffer(t.ARRAY_BUFFER,this.geomBuffer),t.vertexAttribPointer(this.posAttr,3,t.FLOAT,!1,0,0)}dispose(t=!1){const e=this.gl;if(e){if(e.bindBuffer(e.ARRAY_BUFFER,null),e.bindTexture(e.TEXTURE_2D,null),e.deleteBuffer(this.txtBuffer),e.deleteBuffer(this.geomBuffer),e.deleteBuffer(this.wmTxtBuffer),e.deleteProgram(this.program),this.postpocessor?.dispose(),this.wmTexture&&e.deleteTexture(this.wmTexture),t){const t=e.getExtension("WEBGL_lose_context");t instanceof Object&&t.loseContext instanceof Function&&t.loseContext()}this.gl=null}}getShader(t,e,i){const s=this.gl.createShader(e);if(!s)throw new Error(`Could not create WebGL shader (type: ${e})`);if(this.gl.shaderSource(s,i),this.gl.compileShader(s),!this.gl.getShaderParameter(s,this.gl.COMPILE_STATUS))throw console.error("Error compiling shader",this.gl.getShaderInfoLog(s)),this.gl.deleteProgram(t),new Error(`Shader compilation failed: ${this.gl.getShaderInfoLog(s)}`);this.gl.attachShader(t,s),this.gl.deleteShader(s)}getTexture(t,e,i){const s=this.gl,r=e??s.createTexture();if(!r)throw new Error("Could not create WebGL texture");return s.bindTexture(s.TEXTURE_2D,r),t&&s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,t),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,i?s.NEAREST:s.LINEAR),r}updateTexture(t,e){const i=this.gl;i.bindTexture(i.TEXTURE_2D,t),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e),i.bindTexture(i.TEXTURE_2D,null)}drawStart(){const t=this.gl;this.postpocessor&&t.bindFramebuffer(t.FRAMEBUFFER,this.postpocessor.frameBuffer),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}drawEnd(){this.postpocessor&&(this.postpocessor.render(),this.gl.useProgram(this.program),this.linkBuffers()),this.wmTexture&&this.drawWatermark()}drawTile(t,e=1,i=!1){this.gl.uniform1i(this.noTxtLoc,t?0:1),this.gl.uniform1f(this.opaLoc,e),t&&(this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,t));const s=i?1536:6;i!=this.was360&&(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.txtBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,i?Cc._textureBuffer360:Cc._textureBuffer,this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.geomBuffer),this.was360=i),this.gl.bufferData(this.gl.ARRAY_BUFFER,i?this.micrio.engine._vertexBuffer360:this.micrio.engine._vertexBuffer,this.gl.STATIC_DRAW),this.gl.drawArrays(this.gl.TRIANGLES,0,s)}loadWatermark(t,e){if(t===this.wmUrl)return;this.wmUrl=t;const i=new Image;e&&(this.wmOpacity=e),i.crossOrigin="anonymous",i.src=t,i.onload=()=>{const t=document.createElement("canvas");t.width=Xc,t.height=Xc;const e=t.getContext("2d");if(!e)return;const s=Math.min(96/i.width,64/i.height),r=i.width*s,n=i.height*s;e.drawImage(i,(Xc-r)/2,(Xc-n)/2,r,n),this.wmTexture&&this.gl.deleteTexture(this.wmTexture),this.wmTexture=this.getTexture(t);const a=this.gl;a.bindTexture(a.TEXTURE_2D,this.wmTexture),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.REPEAT),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.REPEAT),a.bindTexture(a.TEXTURE_2D,null),this.micrio.engine.render()}}drawWatermark(){const t=this.gl;if(!this.wmTexture)return;t.useProgram(this.program),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.uniformMatrix4fv(this.pmLoc,!1,this.wmMatrix),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.wmTexture),t.uniform1i(this.noTxtLoc,0),t.uniform1f(this.opaLoc,this.wmOpacity);const e=t.drawingBufferWidth/Xc,i=t.drawingBufferHeight/Xc,s=this.wmUvs;s[1]=i,s[2]=e,s[3]=i,s[8]=e,s[9]=i,s[10]=e,t.bindBuffer(t.ARRAY_BUFFER,this.geomBuffer),t.bufferData(t.ARRAY_BUFFER,this.wmVerts,t.DYNAMIC_DRAW),t.vertexAttribPointer(this.posAttr,3,t.FLOAT,!1,0,0),t.bindBuffer(t.ARRAY_BUFFER,this.wmTxtBuffer),t.bufferData(t.ARRAY_BUFFER,this.wmUvs,t.DYNAMIC_DRAW),t.vertexAttribPointer(this.txtAttr,2,t.FLOAT,!1,0,0),t.drawArrays(t.TRIANGLES,0,6),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),this.linkBuffers(),this.was360=!1}},Vc=class{get $isMobile(){return wt(this.isMobile)}constructor(t){this.micrio=t,this.element=document.createElement("canvas"),this.resizing=!1,this.hasPerspective=!1,this.viewport={width:0,height:0,left:0,top:0,ratio:0,scale:0,portrait:!1},this.isMobile=vt(!1),this.getRatio=(t=this.micrio.$current?.$settings??{})=>!Jr.iOS&&!t?.noRetina&&self.devicePixelRatio&&Math.max(1,Math.min(2,self.devicePixelRatio))||1,this.onresize=this.onresize.bind(this),self.ResizeObserver&&(this.resizeObserver=new self.ResizeObserver(this.onresize)),this.element.className="micrio"}place(){if(this.element.parentNode)return;const t=this.micrio.querySelector("img.preview");this.micrio.insertBefore(this.element,t?t.nextSibling:this.micrio.firstChild)}hook(){this.onresize(),this.resizeObserver?this.resizeObserver.observe(this.element):window.addEventListener("resize",this.onresize)}unhook(){this.resizeObserver?this.resizeObserver.unobserve(this.element):window.removeEventListener("resize",this.onresize)}onresize(){const t=this.element.getBoundingClientRect();this.micrio.$current?.is360&&(this.hasPerspective=!0);let e=t.width,i=t.height;if(!e||!i)return;const s=self.getComputedStyle(this.element),r=parseFloat(s.width);isNaN(r)||(i=parseFloat(s.height)*e/Math.max(1,r));const n=this.micrio.hasAttribute("data-static")?1:Math.floor(e)/this.micrio.offsetWidth;e/=n,i/=n;const a=1!=n?1:this.getRatio(),o=this.viewport;o.width==e&&o.height==i&&o.ratio==a&&o.scale==n||(this.hasPerspective&&(this.micrio.style.perspective=i/2+"px"),o.width=e,o.height=i,o.ratio=a,o.scale=n,o.top=t.top,o.left=t.left,o.portrait=window.matchMedia("(orientation: portrait)")?.matches??i>e,this.resizing=!0,this.element.width=e*a,this.element.height=i*a,this.micrio.webgl.gl.viewport(0,0,o.width*o.ratio,o.height*o.ratio),this.micrio.webgl.postpocessor?.resize(),this.micrio.engine.resize(o),this.resizing=!1,this.micrio.events.dispatch("resize",t),this.isMobile.set(/mobile/i.test(navigator.userAgent)))}setMargins(t,e){this.micrio.engine.ready&&this.micrio.engine.setCanvasArea(t,e)}},Yc=["move","marker-open","marker-opened","marker-closed","tour-start","tour-step","tour-stop","tour-event","media-play","media-pause","splitscreen-start","splitscreen-stop"],Nc=class{constructor(t){this.ctx=t,this.handleEvent=this.handleEvent.bind(this),this.dispatch=this.dispatch.bind(this)}hook(){Yc.forEach(t=>this.ctx.micrio.addEventListener(t,this.handleEvent))}unhook(){Yc.forEach(t=>this.ctx.micrio.removeEventListener(t,this.handleEvent))}handleEvent(t){if("move"==t.type&&!this.ctx.isPanning()&&!this.ctx.isPinching()&&!this.ctx.isWheeling())return;const e=this.ctx.vars.updates.stack;e[e.length-1]!=t.type&&e.push(t.type),clearTimeout(this.ctx.vars.updates.to),this.ctx.vars.updates.to<0&&(this.ctx.vars.updates.to=setTimeout(this.dispatch))}dispatch(){const t=this.ctx.vars.updates;clearTimeout(t.to),t.to=-1,t.stack.length&&(this.ctx.dispatch("update",t.stack),t.stack.length=0,t.to=setTimeout(this.dispatch,500))}},Bc=class{get $enabled(){return wt(this.enabled)}constructor(t){this.micrio=t,this.enabled=vt(!1),this.hooked=!1,this.panning=!1,this.pinching=!1,this.clicked=!1,this.wheeling=!1,this.controlZoom=!1,this.twoFingerPan=!1,this.pScale=1,this.hasTouch=Jr.hasTouch&&"ontouchstart"in self,this.hasUsedCtrl=!1,this.vars={drag:{prev:void 0,start:[0,0,0]},dbltap:{lastTapped:0},pinch:{image:void 0,sDst:0,wasPanning:!1},updates:{to:-1,stack:[]}},this.activePointers=new Map,this.el=t.canvas.element,this.dragHandler=new Gc(this),this.pinchHandler=new jc(this,this.dragHandler),this.pointerPinchHandler=new Zc(this,this.dragHandler),this.gestureHandler=new Jc(this),this.wheelHandler=new Kc(this),this.keyboardHandler=new Qc(this),this.doubleTapHandler=new tl(this),this.updateHandler=new Nc(this),this.enabled.subscribe(t=>{t?this.hook():this.unhook()}),t.visible.subscribe(t=>this.visible=t),t.current.subscribe(t=>{t&&!this.settings&&en(t.info).then(e=>{e&&(this.settings=t.$settings,!t.error&&this.settings.hookEvents&&this.enabled.set(!0))})})}isEnabled(){return this.$enabled}isPanning(){return this.panning}isPinching(){return this.pinching}setPanning(t){this.panning=t}setPinching(t){this.pinching=t}isWheeling(){return this.wheeling}setWheeling(t){this.wheeling=t}isControlZoom(){return this.controlZoom}isTwoFingerPan(){return this.twoFingerPan}getVisible(){return this.visible}setCapturedPointerId(t){this.capturedPointerId=t}setPinchFactor(t){this.pinchFactor=t}setPScale(t){this.pScale=t}setHasUsedCtrl(t){this.hasUsedCtrl=t}get isNavigating(){return this.panning||this.pinching||this.wheeling||this.clicked}dispatch(t,e){this.micrio.dispatchEvent(new CustomEvent(t,void 0!==e?{detail:e}:void 0))}getImage(t){if(!this.visible)return;const e=this.micrio.offsetWidth,i=this.micrio.offsetHeight,s=Math.max(0,Math.min(1,t.x/e)),r=Math.max(0,Math.min(1,t.y/i)),n=this.visible?.find(t=>!!t.opts.secondaryTo),a=this.visible.filter(t=>!t.noImage),o=1==a.length?a[0]:a.find(({grid:t,opts:{area:e}})=>(!n||!t)&&(!!e&&(s>=e[0]&&s<=e[2]&&r>=e[1]&&r<=e[3])));return o&&o.opts.secondaryTo&&o.opts.isPassive&&o.opts.area&&(t.x-=o.opts.area[0]*e,t.y-=o.opts.area[1]*i),!o||o.grid||o.opts.secondaryTo&&o.opts.isPassive?this.micrio.$current:o}hook(){if(this.hooked)return;this.hooked=!0;const t=this.settings;t&&(this.twoFingerPan=!!t.twoFingerPan,this.twoFingerPan?this.micrio.setAttribute("data-can-pan",""):this.micrio.removeAttribute("data-can-pan"),t?.hookKeys&&this.hookKeys(),t.hookDrag&&this.hookDrag(),t.noZoom||this.hookZoom(),this.hookUpdate())}unhook(){this.hooked&&(this.hooked=!1,this.activePointers.clear(),this.unhookDrag(),this.unhookZoom(),this.unhookKeys(),this.unhookUpdate())}hookKeys(){this.keyboardHandler.hook()}unhookKeys(){this.keyboardHandler.unhook()}hookZoom(){const t=this.settings;this.controlZoom=!!t?.controlZoom,t&&!t.hookPinch||this.hookPinch(),(!t||t.hookScroll||this.controlZoom)&&this.hookScroll(),this.micrio.canvas.$isMobile?this.doubleTapHandler.hookTap():this.doubleTapHandler.hookClick()}unhookZoom(){this.unhookPinch(),this.unhookScroll(),this.micrio.canvas.$isMobile?this.doubleTapHandler.unhookTap():this.doubleTapHandler.unhookClick()}get scrollHooked(){return this.wheelHandler.hooked}hookScroll(){this.wheelHandler.hook()}unhookScroll(){this.wheelHandler.unhook()}hookPinch(){Jr.iOS&&this.hasTouch?this.pinchHandler.hook():this.pointerPinchHandler.hook(),this.gestureHandler.hook()}unhookPinch(){Jr.iOS&&this.hasTouch?this.pinchHandler.unhook():this.pointerPinchHandler.unhook(),this.gestureHandler.unhook()}hookDrag(){this.dragHandler.hook()}unhookDrag(){this.dragHandler.unhook()}hookUpdate(){this.updateHandler.hook()}unhookUpdate(){this.updateHandler.unhook()}},qc={passive:!0},Wc={passive:!0,capture:!0},Uc={passive:!1};function Hc(t){t.stopPropagation(),t.preventDefault()}var Gc=class{constructor(t){this.ctx=t,this.hooked=!1,this.start=this.start.bind(this),this.move=this.move.bind(this),this.stop=this.stop.bind(this),this.cancel=this.cancel.bind(this)}hook(){this.hooked||(this.hooked=!0,this.ctx.micrio.addEventListener("dragstart",Hc),this.ctx.micrio.addEventListener("pointerdown",this.start,qc),self.addEventListener("pointercancel",this.cancel,qc),this.ctx.micrio.setAttribute("data-hooked",""))}unhook(){this.hooked&&(this.hooked=!1,this.ctx.micrio.removeEventListener("pointerdown",this.start,qc),this.ctx.micrio.removeEventListener("dragstart",Hc),self.removeEventListener("pointercancel",this.cancel,qc),this.ctx.micrio.removeAttribute("data-hooked"))}start(t,e=!1){if(0!=t.button||"touch"==t.pointerType&&this.ctx.isTwoFingerPan())return;if(!(e||t.target==this.ctx.el||t.target instanceof Element&&t.target.closest("[data-scroll-through]")))return;if(this.ctx.micrio.$current?.isOmni&&t.shiftKey)return;if(this.ctx.isPinching())return;if(this.ctx.isPanning())return void(t instanceof TouchEvent&&t.touches.length>1&&this.stop());const i=this.ctx.getImage({x:t.clientX,y:t.clientY});i&&(this.ctx.setPanning(!0),this.ctx.vars.drag.start=[t.clientX,t.clientY,performance.now()],this.ctx.micrio.addEventListener("pointermove",this.move,qc),this.ctx.micrio.addEventListener("pointerup",this.stop,qc),this.ctx.micrio.setAttribute("data-panning",""),this.ctx.micrio.engine.panStart(i.ptr),this.ctx.micrio.engine.render(),this.ctx.dispatch("panstart"))}move(t){const e=t.clientX,i=t.clientY,s=Math.hypot(this.ctx.vars.drag.start[0]-t.clientX,this.ctx.vars.drag.start[1]-t.clientY);!this.ctx.capturedPointerId&&s>10&&(this.ctx.setCapturedPointerId(t.pointerId),this.ctx.micrio.setPointerCapture(t.pointerId)),this.ctx.vars.drag.prev&&this.ctx.getImage({x:e,y:i})?.camera.pan(this.ctx.vars.drag.prev[0]-e,this.ctx.vars.drag.prev[1]-i),this.ctx.vars.drag.prev=[e,i]}stop(t,e=!1,i=!1){if(this.ctx.isPanning()){if(this.ctx.setPanning(!1),this.ctx.vars.drag.prev=void 0,this.ctx.micrio.removeEventListener("pointermove",this.move,qc),this.ctx.micrio.removeEventListener("pointerup",this.stop,qc),this.ctx.capturedPointerId&&this.ctx.micrio.releasePointerCapture(this.ctx.capturedPointerId),this.ctx.setCapturedPointerId(void 0),this.ctx.micrio.removeAttribute("data-panning"),t&&0==e){const e=this.ctx.getImage({x:t.clientX,y:t.clientY});e&&(this.ctx.micrio.engine.panStop(e.ptr),this.ctx.micrio.engine.render())}i||this.ctx.dispatch("panend",t?{duration:performance.now()-this.ctx.vars.drag.start[2],movedX:t.clientX-this.ctx.vars.drag.start[0],movedY:t.clientY-this.ctx.vars.drag.start[1]}:void 0)}}cancel(t){this.ctx.isPanning()&&(void 0!==this.ctx.capturedPointerId&&t.pointerId!==this.ctx.capturedPointerId||this.stop(void 0,!0,!0))}},jc=class{constructor(t,e){this.ctx=t,this.dragHandler=e,this.start=this.start.bind(this),this.move=this.move.bind(this),this.stop=this.stop.bind(this)}hook(){Jr.iOS&&this.ctx.hasTouch&&this.ctx.micrio.addEventListener("touchstart",this.start,qc)}unhook(){Jr.iOS&&this.ctx.hasTouch&&this.ctx.micrio.removeEventListener("touchstart",this.start,qc),self.removeEventListener("touchmove",this.move,Wc),self.removeEventListener("touchend",this.stop,Wc)}start(t){if(!(Jr.hasTouch&&t instanceof TouchEvent))return;if(this.ctx.isTwoFingerPan()&&t.touches.length<2)return;if(this.ctx.isPinching()||2!=t.touches.length)return void this.stop(t);t.stopPropagation(),this.ctx.vars.pinch.wasPanning=this.ctx.isPanning(),this.dragHandler.stop(void 0,!1,!0);const e=t.touches;this.ctx.setPinching(!0),self.addEventListener("touchmove",this.move,Wc),self.addEventListener("touchend",this.stop,Wc),this.ctx.micrio.setAttribute("data-pinching",""),this.ctx.vars.pinch.image=this.ctx.getImage({x:e[0].clientX,y:e[0].clientY}),this.ctx.vars.pinch.sDst=Math.hypot(e[0].clientX-e[1].clientX,e[0].clientY-e[1].clientY),this.ctx.setPinchFactor(void 0),this.ctx.vars.pinch.image&&this.ctx.micrio.engine.pinchStart(this.ctx.vars.pinch.image.ptr),this.ctx.micrio.engine.render(),this.ctx.dispatch("pinchstart"),this.ctx.isTwoFingerPan()&&this.ctx.dispatch("panstart")}move(t){if(!(Jr.hasTouch&&t instanceof TouchEvent))return;const e=t.touches;if(e?.length<2)return;const i={x:e[0].clientX,y:e[0].clientY},s={x:e[1].clientX,y:e[1].clientY},r=this.ctx.vars.pinch,n=r.image;if(n){if(n?.opts.secondaryTo&&n.opts.isPassive&&n.opts.area){const t=n.opts.area[0]*this.ctx.micrio.offsetWidth,e=n.opts.area[1]*this.ctx.micrio.offsetHeight;i.x-=t,s.x-=t,i.y-=e,s.y-=e}this.ctx.setPinchFactor(Math.hypot(e[0].clientX-e[1].clientX,e[0].clientY-e[1].clientY)/r.sDst),this.ctx.micrio.engine.pinch(n.ptr,i.x,i.y,s.x,s.y)}}stop(t){if(!this.ctx.isPinching())return;this.ctx.setPinching(!1),self.removeEventListener("touchmove",this.move,Wc),self.removeEventListener("touchend",this.stop,Wc),this.ctx.micrio.removeAttribute("data-pinching");const e=this.ctx.vars.pinch.image;e&&(this.ctx.micrio.engine.pinchStop(e.ptr,performance.now()),this.ctx.micrio.engine.render()),this.ctx.vars.pinch.image=void 0,this.ctx.setPinchFactor(void 0),this.ctx.dispatch("pinchend"),this.ctx.isTwoFingerPan()&&!this.ctx.vars.pinch.wasPanning&&this.ctx.dispatch("panend"),t instanceof TouchEvent&&1==t.touches.length&&this.dragHandler.start(t,!0)}},Zc=class{constructor(t,e){this.ctx=t,this.dragHandler=e,this.start=this.start.bind(this),this.move=this.move.bind(this),this.end=this.end.bind(this)}hook(){this.ctx.micrio.addEventListener("pointerdown",this.start,qc),self.addEventListener("pointerup",this.end,qc),self.addEventListener("pointercancel",this.end,qc)}unhook(){this.ctx.micrio.removeEventListener("pointerdown",this.start,qc),self.removeEventListener("pointerup",this.end,qc),self.removeEventListener("pointercancel",this.end,qc),self.removeEventListener("pointermove",this.move,Wc),this.ctx.activePointers.clear()}start(t){if("touch"===t.pointerType&&(this.ctx.activePointers.set(t.pointerId,{x:t.clientX,y:t.clientY}),2===this.ctx.activePointers.size&&!this.ctx.isPinching())){this.ctx.vars.pinch.wasPanning=this.ctx.isPanning(),this.dragHandler.stop(void 0,!1,!0),this.ctx.setPinching(!0),self.addEventListener("pointermove",this.move,Wc),this.ctx.micrio.setAttribute("data-pinching","");const t=Array.from(this.ctx.activePointers.values()),e=t[0],i=t[1];this.ctx.vars.pinch.image=this.ctx.getImage({x:e.x,y:e.y}),this.ctx.vars.pinch.sDst=Math.hypot(e.x-i.x,e.y-i.y),this.ctx.setPinchFactor(void 0),this.ctx.vars.pinch.image&&this.ctx.micrio.engine.pinchStart(this.ctx.vars.pinch.image.ptr),this.ctx.micrio.engine.render(),this.ctx.dispatch("pinchstart"),this.ctx.isTwoFingerPan()&&this.ctx.dispatch("panstart")}}move(t){if("touch"!==t.pointerType)return;if(!this.ctx.activePointers.has(t.pointerId))return;if(this.ctx.activePointers.set(t.pointerId,{x:t.clientX,y:t.clientY}),!this.ctx.isPinching()||2!==this.ctx.activePointers.size)return;const e=Array.from(this.ctx.activePointers.values()),i=e[0],s=e[1],r=this.ctx.vars.pinch,n=r.image;if(!n)return;const a={x:i.x,y:i.y},o={x:s.x,y:s.y};if(n?.opts.secondaryTo&&n.opts.isPassive&&n.opts.area){const t=n.opts.area[0]*this.ctx.micrio.offsetWidth,e=n.opts.area[1]*this.ctx.micrio.offsetHeight;a.x-=t,o.x-=t,a.y-=e,o.y-=e}this.ctx.setPinchFactor(Math.hypot(i.x-s.x,i.y-s.y)/r.sDst),this.ctx.micrio.engine.pinch(n.ptr,a.x,a.y,o.x,o.y)}end(t){if("touch"===t.pointerType&&(this.ctx.activePointers.delete(t.pointerId),this.ctx.isPinching()&&this.ctx.activePointers.size<2)){this.ctx.setPinching(!1),self.removeEventListener("pointermove",this.move,Wc),this.ctx.micrio.removeAttribute("data-pinching");const t=this.ctx.vars.pinch.image;if(t&&(this.ctx.micrio.engine.pinchStop(t.ptr,performance.now()),this.ctx.micrio.engine.render()),this.ctx.vars.pinch.image=void 0,this.ctx.setPinchFactor(void 0),this.ctx.dispatch("pinchend"),this.ctx.isTwoFingerPan()&&!this.ctx.vars.pinch.wasPanning&&this.ctx.dispatch("panend"),1===this.ctx.activePointers.size){const t=Array.from(this.ctx.activePointers.entries())[0],e={button:0,pointerType:"touch",target:this.ctx.el,clientX:t[1].x,clientY:t[1].y,pointerId:t[0]};this.dragHandler.start(e,!0)}}}},Jc=class{constructor(t){this.ctx=t,this.handle=this.handle.bind(this)}hook(){Jr.OSX&&(this.ctx.micrio.addEventListener("gesturestart",this.handle,Uc),this.ctx.micrio.addEventListener("gesturechange",this.handle,Uc),this.ctx.micrio.addEventListener("gestureend",this.handle,Uc))}unhook(){Jr.OSX&&(this.ctx.micrio.removeEventListener("gesturestart",this.handle,Uc),this.ctx.micrio.removeEventListener("gesturechange",this.handle,Uc),this.ctx.micrio.removeEventListener("gestureend",this.handle,Uc))}getGestureEvent(t){if("scale"in t&&"number"==typeof t.scale){const e=t;return{scale:e.scale,clientX:e.clientX,clientY:e.clientY}}return null}handle(t){const e=this.getGestureEvent(t);if(!e||1===e.scale)return;const i=this.ctx.pScale-e.scale;this.ctx.setPScale(e.scale),t.stopPropagation(),t.preventDefault(),"gesturechange"==t.type&&this.ctx.getImage({x:e.clientX,y:e.clientY})?.camera.zoom(i*this.ctx.micrio.canvas.viewport.height,0,e.clientX,e.clientY)}},Kc=class{constructor(t){this.ctx=t,this.hooked=!1,this.wheelEndTo=-1,this.handle=this.handle.bind(this),this.end=this.end.bind(this)}hook(){this.hooked||(this.ctx.micrio.addEventListener("wheel",this.handle,Uc),this.hooked=!0)}unhook(){this.ctx.micrio.removeEventListener("wheel",this.handle,Uc),this.hooked=!1}handle(t,e=!1,i=0){if(!(t instanceof WheelEvent))return;if(this.ctx.isControlZoom()&&!t.ctrlKey)return;if(!e&&t.target instanceof Element&&t.target!=this.ctx.el&&!t.target.classList.contains("marker")&&!t.target.closest("[data-scroll-through]"))return;let s=t.deltaY;t.ctrlKey&&this.ctx.setHasUsedCtrl(!0);const r=this.ctx.isControlZoom()&&10*s%1==0,n=this.ctx.hasUsedCtrl&&!r,a=Jr.firefox||t.ctrlKey||!n;if(this.ctx.isTwoFingerPan()&&this.ctx.micrio.$current?.camera.isZoomedOut())return;t.stopPropagation(),t.preventDefault(),(Jr.OSX||n)&&t.ctrlKey&&(s*=10);const o={x:t.clientX,y:t.clientY},h=this.ctx.getImage(o);if(h){if(a){const t=this.ctx.micrio.canvas.viewport;let e=0;const r=this.ctx.micrio.getBoundingClientRect();h.camera.zoom(1*s/Math.sqrt(t.scale),0,o.x-i-r.left,o.y-r.top-e)}else h.camera.pan(t.deltaX,t.deltaY);this.ctx.setWheeling(!0),clearTimeout(this.wheelEndTo),this.wheelEndTo=setTimeout(this.end,50)}}end(){this.ctx.setWheeling(!1)}},Qc=class{constructor(t){this.ctx=t,this.handle=this.handle.bind(this)}hook(){document.addEventListener("keydown",this.handle)}unhook(){document.removeEventListener("keydown",this.handle)}handle(t){if(this.ctx.isPanning()||this.ctx.isPinching()||!this.ctx.micrio.$current?.camera)return;const e=this.ctx.micrio.$current.camera,i=this.ctx.micrio.offsetWidth/2,s=this.ctx.micrio.offsetHeight/2;let r=0,n=0;switch(t.key){case"ArrowUp":n-=s;break;case"ArrowDown":n+=s;break;case"ArrowLeft":r-=i;break;case"ArrowRight":r+=i;break;case"+":case"=":e.zoom(-200,150).catch(()=>{});break;case"-":case"_":e.zoom(200,150).catch(()=>{});break;default:return}t.preventDefault(),t.stopPropagation(),0==r&&0==n||e.pan(r,n,150)}},tl=class{constructor(t){this.ctx=t,this.tap=this.tap.bind(this),this.click=this.click.bind(this)}hookTap(){this.ctx.el.addEventListener("touchstart",this.tap)}unhookTap(){this.ctx.el.removeEventListener("touchstart",this.tap)}hookClick(){this.ctx.el.addEventListener("dblclick",this.click)}unhookClick(){this.ctx.el.removeEventListener("dblclick",this.click)}tap(t){if(!(Jr.hasTouch&&t instanceof TouchEvent))return;const e=performance.now();1==t.touches.length&&e-this.ctx.vars.dbltap.lastTapped<250&&(t.stopPropagation(),t.preventDefault(),this.click(t)),this.ctx.vars.dbltap.lastTapped=e}click(t){const e=t instanceof TouchEvent?t.touches[0]:t;this.ctx.getImage({x:e.clientX,y:e.clientY})?.camera.zoom(-300,500,e.clientX,e.clientY,1,!this.ctx.micrio.$current?.album).catch(()=>{})}},el=class t{static{this.events=["load","tour-start","tour-stop","marker-open","marker-closed","page-open","page-closed","lang-switch"]}constructor(t){this.micrio=t,this.isStatic=!1,this.loaded=!1,this.inited=!1,this.setting=!1,this.writeTitle=!1}hook(){this.isStatic="static"==this.micrio.getAttribute("data-router"),this.read=this.read.bind(this),this.write=this.write.bind(this),this.writeDeferred=this.writeDeferred.bind(this),en(this.micrio.current).then(()=>{this.loaded=!0,this.read()}),t.events.forEach(t=>this.micrio.addEventListener(t,this.write)),location.hostname==`viewer.${pn}`&&(this.writeTitle=!0),window.addEventListener(this.isStatic?"popstate":"hashchange",this.read)}unhook(){t.events.forEach(t=>this.micrio.removeEventListener(t,this.write)),window.removeEventListener(this.isStatic?"popstate":"hashchange",this.read)}findPage(t,e,i){if(e)for(let s=0;s<e.length;s++){let r=Gr((e[s]?.i18n?.[i]??e[s]).title)==t?e[s]:this.findPage(t,e[s].children,i);if(r)return r}}read(){if(!this.loaded||this.setting)return;this.route=(this.isStatic?location.pathname:location.hash).slice(1);const[t,e,i,s,r]=this.route.split("/"),n=this.micrio.$current,a=t&&n?.id!=t?this.micrio.open(t):void 0;n&&Promise.all([en(n.data,{allowUndefined:!0}),a?en(a.data,{allowUndefined:!0}):void 0]).then(t=>{if(!t[0])return this.inited=!0;if(void 0===this.prevLang&&(this.prevLang=this.micrio.lang),!1===a?.$settings.routerMarkerTours)return;if(t[0].pages?.length&&s){const i=this.findPage(s.toLowerCase(),t[0].pages,e);if(i)return void this.micrio.state.popover.set({contentPage:i})}const i=s?r?t.map(t=>t?.markerTours?.find(t=>Gr(t.i18n?.[e]?.slug)==s))[0]:t.map(t=>t?.tours?.find(t=>Gr(t.i18n?.[e]?.slug)==s))[0]:void 0,o=r||!i&&s,h=o?(t[1]??t[0]).markers?.find(t=>(t.i18n?.[e]?.slug??Gr(t.title))==o||i&&"steps"in i&&i.stepInfo?.map(t=>t.marker).find(t=>t.i18n?.[e]?.slug==o)):void 0;h&&i&&"steps"in i?i.initialStep=Math.max(0,i.steps.findIndex(t=>t.startsWith(h.id))):(h||this.micrio.state.popup.set(void 0),(a??n).state.marker.set(h)),this.micrio.state.tour.set(i),this.writeTitle&&this.setTitle(),this.inited=!0})}setTitle(){const t=wt(this.micrio._lang),e=this.micrio.$current;if(!e)return;const i=[e.$data?.i18n?.[t]?.title??e?.$info?.title,this.micrio.state.$tour?.i18n?.[t]?.title,this.micrio.state.$marker?.i18n?.[t]?.title].filter(t=>!!t).reverse();document.title=i.join(" - ")+" | Micrio"}write(t){if(this.micrio.$current&&this.loaded&&this.inited){if("marker-open"===t.type){const t=this.micrio.state.$marker;if(t&&t.data&&t.data.micrioLink)return}clearTimeout(this._to),this._to=setTimeout(()=>this.writeDeferred("load"==t.type),50)}}writeDeferred(t){const e=this.micrio.state.$tour;let i=this.micrio.$current,s=i?.state.$marker;const r=this.micrio.lang;r!=this.prevLang&&(t=!0,this.prevLang=r);const n=i?.$data?.i18n?.[r]?.title??i?.$info?.title??"",a=!1===i?.$settings.routerMarkerTours,o=s&&"string"!=typeof s?s.i18n?.[r]??s:void 0,h=wt(this.micrio.state.popover)?.contentPage,c=h?h.i18n?.[r]??h:void 0;let l=i?.id;if(e&&"steps"in e&&e.steps.length&&e.stepInfo){const t=e.stepInfo.find(t=>t.markerId==e.steps.find(t=>!t.includes(",")));t&&(l=t.micrioId,i=this.micrio.engine.images.find(t=>t.id==l),s||void 0===e.initialStep||(s=e.stepInfo[Math.max(0,e.initialStep)].marker))}const d=[l,r,Gr(n)??"",...a?[]:c?[Gr(c.title)]:[e?.i18n?.[r]?.slug??null,o?.slug??Gr(o?.title)??null]].filter(t=>!!t).join("/");d!=this.route&&(this.setting=!0,this.isStatic?t?history.replaceState(null,"","/"+d+location.search):history.pushState(null,"","/"+d+location.search):location.hash=d,this.route=d,this.writeTitle&&this.setTitle(),setTimeout(()=>this.setting=!1,250))}},il=class t{static{this.events=["load","show","hide","marker-open","marker-opened","marker-closed","tour-start","tour-stop","tour-step","tour-ended"]}constructor(t){this.micrio=t,this.gtag="gtag"in window?window.gtag:void 0,this.hooked=!1,this.tag=this.tag.bind(this)}hook(){!this.hooked&&this.gtag&&(this.hooked=!0,this.tag(new CustomEvent("init")),t.events.forEach(t=>this.micrio.addEventListener(t,this.tag)))}unhook(){this.hooked&&(this.hooked=!1,this.tag(new CustomEvent("hide")),t.events.forEach(t=>this.micrio.removeEventListener(t,this.tag)))}tag(t){if(!this.gtag)return;const e=t.detail,i=this.micrio.$current,s={event_category:"Micrio",event_action:t.type};this.micrio.lang&&(s.culture=this.micrio.lang),"init"==t.type&&(s.micrio_version=mn),"load"==t.type&&i?.$info&&(s.image_version=i.$info.version);const r=null!==e&&"object"==typeof e&&"currentStep"in e?e.currentStep:null;null!=r&&(s.event_value=r);const n=e&&e.title?e.title:i&&i.$info&&i.$info.title;s.event_label=this.micrio.id+(n?" - "+n:""),this.gtag("event",t.type,s)}},sl=t=>Math.round(1e5*t)/1e5,rl=class t{static{this.getString=(t,e)=>[t.id,t.width,t.height,t.isDeepZoom?"d":"",t.isPng?"p":t.isWebP?"w":"",e.view?.map(sl).join("/"),e.area?.map(sl).join("/"),t.settings?.focus?.map(sl).join("-"),e.cultures].join(",").replace(/,+$/,"")+(e.size?`|${e.size.join(",")}`:"")}get $focussed(){return wt(this.focussed)}constructor(e,i){this.micrio=e,this.image=i,this.images=[],this.imageMap=new Map,this.current=[],this._grid=document.createElement("div"),this._buttons=new Map,this.clickable=!1,this.focussed=vt(),this.markersShown=vt([]),this.history=[],this.depth=vt(0),this.aniDurationIn=1.5,this.aniDurationOut=.5,this.transitionDelay=.5,this.isHorizontal=!1,this.cellSizes=new Map,this.nextSize=new Map,this.timingFunction="ease",this.getString=(e,i={})=>t.getString(e,{view:i.view,area:i.area,size:i.size??this.nextSize.get(e.id),cultures:("cultures"in e&&e.cultures?e.cultures:"")?.replace(/,/g,"-")}),this.actionHandlers={[Ao.Grid.GridActionType.focus]:(t,e)=>{const i=t?.split("|").map(t=>t.trim()),s=(i?.[0]??"").split(",").map(t=>this.imageMap.get(t.trim())).filter(t=>void 0!==t);1==s.length?this.focus(s[0],{duration:e}):s.length>0&&this.set(s.map(t=>this.getString(t.$info)).join(";"),{duration:e,horizontal:"h"==i?.[1]})},[Ao.Grid.GridActionType.flyTo]:(t,e)=>{const i=t?.split(",").map(t=>this.current.find(e=>e.id==t?.trim()));i?.length?this.image.camera.flyToView([Math.min(...i.map(t=>t?.opts.area?.[0]??0)),Math.min(...i.map(t=>t?.opts.area?.[1]??0)),Math.max(...i.map(t=>t?.opts.area?.[2]??1)),Math.max(...i.map(t=>t?.opts.area?.[3]??1))],{duration:e?1e3*e:void 0}).catch(()=>{}):console.warn("Given image IDs gave no current displayed images")},[Ao.Grid.GridActionType.focusTagged]:(t,e)=>{this.flyToMarkers(t,e)},[Ao.Grid.GridActionType.focusWithTagged]:(t,e)=>{this.flyToMarkers(t,e,!0)},[Ao.Grid.GridActionType.reset]:(t,e)=>{this.reset(e)},[Ao.Grid.GridActionType.back]:(t,e)=>{this.back(e)},[Ao.Grid.GridActionType.switchToGrid]:()=>{this.switchToGrid()},[Ao.Grid.GridActionType.nextFadeDuration]:t=>{this.nextCrossFadeDuration=Number(t)},[Ao.Grid.GridActionType.filterTourImages]:(t,e)=>{en(this.micrio.state.tour).then(i=>{if(!i)return;if(!("steps"in i)||!i.stepInfo)return;const s=i.stepInfo.map(t=>t.micrioId),r=s.filter((t,e)=>s.indexOf(t)==e).map(t=>this.imageMap.get(t)).filter(t=>!!t).map(t=>this.getString(t.$info)).join(";");r&&this.set(r,{duration:e,horizontal:"h"==t})})}},this.tourEvent=this.tourEvent.bind(this),this.updateGrid=this.updateGrid.bind(this);const s=i.$settings;this.clickable=!!s.gridClickable,void 0!==s.gridTransitionDuration&&(this.aniDurationIn=this.aniDurationOut=s.gridTransitionDuration),void 0!==s.gridTransitionDurationOut&&(this.aniDurationOut=s.gridTransitionDurationOut),this._grid.className="micrio-grid",this.set(i.$info?.grid);const r=()=>Si().then(()=>{this.hook(),e.events.dispatch("grid-load")});i.isV5?r():e._lang.subscribe(t=>{t?Promise.all(this.images.filter(e=>(e.$info&&"cultures"in e.$info&&e.$info?.cultures||"").indexOf(t)>=0).map(t=>en(t.data))).then(r):r()}),e.events.dispatch("grid-init",this)}hook(){if(this.micrio.state.marker.subscribe(t=>{if(t&&"string"!=typeof t){const e=t.data?._meta;if(e?.gridSize){const i="number"==typeof e.gridSize?[e.gridSize,e.gridSize]:e.gridSize.split(",").map(Number),s=this.images.find(e=>e.$data?.markers?.find(e=>e==t))?.id;s&&this.nextSize.set(s,i)}Si().then(()=>{const t=e?.gridAction?.split("|");t?.length&&"string"==typeof t[0]&&this.action(t.shift(),t.join("|"))})}}),this.clickable){this._grid.addEventListener("click",t=>{const e=t.target.dataset.id;e&&this.focus(this.imageMap.get(e))});const t=t=>{t?this.removeGrid():this.placeGrid()};this.micrio.state.tour.subscribe(t),this.micrio.state.marker.subscribe(t),this.focussed.subscribe(t)}this.micrio.addEventListener("tour-event",this.tourEvent),this.micrio.addEventListener("serialtour-pause",()=>this.images.forEach(t=>t.camera.pause())),this.micrio.addEventListener("serialtour-play",()=>this.images.forEach(t=>t.camera.resume()))}clearTimeouts(){clearTimeout(this._to),clearTimeout(this._fadeTo)}trackImage(t){this.images.push(t),this.imageMap.set(t.id,t)}parseInput(t){return"string"!=typeof t&&(t=t.map(t=>t instanceof Ph?{image:t}:t).filter(t=>!!t.image.$info).map(t=>this.getString(t.image.$info,t)).join(";")),t.split(";").filter(t=>!!t).map(t=>this.getImage(t))}setupBehindTransition(t,e,i){const s="behind-delayed"==e.transition,r=!0===e.coverLimit,{engine:n}=this.micrio;e.forceAni=!0,e.coverLimit=r,e.forceAreaAni=!0;const a=s?1/t.length:1;let o=0;this.images.forEach(e=>{e.camera.setCoverLimit(r),t.find(t=>t.id==e.id)&&(e.camera.setArea([0,0,i?.id==e.id?1:a,1],{noDispatch:!0,direct:!0}),e!=i&&e.camera.setView([0,0,1,1]),s&&n.setZIndex(e.ptr,t.length-o++))}),t.forEach(t=>t.view=[0,0,1,1])}savePreviousLayout(){this.depth.set(this.history.push({layout:this.current.map(t=>this.getString(t.$info,{view:t.state.$view,size:this.cellSizes.get(t.id)})).join(";"),horizontal:this.isHorizontal,view:this.image.camera.getView()}))}set(t="",e={}){return this.lastPromise=new Promise((i,s)=>{delete this.image.$info?.settings?.focus,this.lastAction=void 0,!1===e.cover&&e.coverLimit&&(e.coverLimit=!1),e.coverLimit&&null==e.cover&&(e.cover=e.coverLimit);const r=this.parseInput(t),n=this.$focussed,a=e.transition?.endsWith("-delayed"),o="behind-delayed"==e.transition,{engine:h}=this.micrio;"crossfade"==e.transition?e.duration=0:"behind"!=e.transition&&"behind-delayed"!=e.transition||this.setupBehindTransition(r,e,n);const c=this.image.ptr>=0,l=e.duration??(e.noHistory?this.aniDurationOut:this.aniDurationIn),d=this.nextCrossFadeDuration??this.image.$settings.crossfadeDuration??1,u=(l||this.aniDurationIn)/(o?2:1);this.nextCrossFadeDuration=void 0,c&&(h.setGridTransitionDuration(l),h.setCrossfadeDuration(u));const m=!e.noBlur&&n;m&&this.blur(),!e.noHistory&&this.current.length&&this.savePreviousLayout(),this.isHorizontal=!!e.horizontal,this.removeImages(this.images.filter(t=>!r.find(e=>e.id==t.id))),this.printGrid(r,{horizontal:e.horizontal,keepGrid:e.keepGrid,scale:e.scale,columns:e.columns}),this.clearTimeouts();let g=!1;const p=()=>{this.clearTimeouts(),g||s()};c&&!e.noCamAni&&(e.view?this.image.camera.flyToView(e.view,{duration:1e3*l}).catch(p):this.image.camera.flyToFullView({duration:1e3*l}).catch(p)),this.nextSize.clear(),null==e.coverLimit&&(e.coverLimit=!0),e.coverLimit||r.forEach(t=>this.imageMap.get(t.id)?.camera.setCoverLimit(!1));const f="appear-delayed"==e.transition,v=t=>t*this.transitionDelay+(t>0&&f?l:0);this.current=r.map((t,i)=>this.placeImage(t,{duration:!e.forceAni&&m&&t.id!=n?.id?0:l,delay:a?v(i):0,noCamAni:!!(f&&i>0)||!!e.noCamAni,forceAreaAni:!(f&&i>0)&&e.forceAreaAni,cover:e.cover})),f&&this.current.slice(1).forEach(t=>h.fadeTo(t.ptr,.9999,!0));const w=()=>this.current.forEach((t,e)=>Kr(a?1e3*(v(e)+(o?l/2:0)):0).then(()=>h.fadeIn(t.ptr))),y=()=>{this.clearTimeouts(),requestAnimationFrame(()=>h.setCrossfadeDuration(d)),a&&this.images.forEach(t=>h.setZIndex(t.ptr,0)),e.coverLimit&&r.forEach(t=>this.imageMap.get(t.id)?.camera.setCoverLimit(!0)),this.clickable&&this.placeGrid(),this.lastAction=void 0,g=!0,i(this.current)};l||u?(e.noFade||(this._fadeTo=setTimeout(w,Math.max(0,l/2*1e3))),this._to=setTimeout(y,1e3*(Math.max(u,l)+(a?(r.length-1)*this.transitionDelay:0)))):(e.noFade||w(),y())})}hasChanged(){return this.current.length!==this.images.length||this.current.some((t,e)=>t.id!==this.images[e].id)}getImage(t){const e=t.split("|"),i=e[0].split(","),s=e[1]?e[1].split(",").map(Number):[1];let r=0,n=0;return{path:this.image.$info?.path,id:i[0],width:r=Number(i[1])||r,height:n=Number(i[2])||n,isDeepZoom:"d"==i[3],isPng:"p"==i[4],isWebP:"w"==i[4],size:s,view:i[5]?i[5].split("/").map(Number):void 0,area:i[6]?i[6].split("/").map(Number):void 0,settings:Wr(this.image.$settings||{},{focus:i[7]?i[7].split("-").map(Number):void 0}),cultures:i[8]?.replace(/-/g,",")||void 0}}getCols(t,e){let i=Math.ceil(e/Math.ceil(Math.sqrt(e)));if(t==e){const e=Math.floor(Math.sqrt(t)),s=[];for(let r=e;r<i+e;r++)t%r||s.push(r);s.length&&(i=s[Math.floor(s.length/2)])}return i}printGrid(t,e){e.keepGrid||this.removeGrid();const i=t.reduce((t,e)=>t+e.size[0]*(e.size[1]??1),0),s=e.columns??(e.horizontal?t.length:this.getCols(t.length,i));this._grid.style.gridTemplateColumns=`repeat(${s}, auto)`,this._grid.textContent="",this._grid.style.removeProperty("--translate"),this._grid.style.removeProperty("--scale"),t.forEach(t=>{if(!t.id)return;this._buttons.has(t.id)||this._buttons.set(t.id,document.createElement("button"));const e=this._buttons.get(t.id);"1"!=t.size.toString()?(e.style.gridArea=`auto / auto / span ${t.size[1]} / span ${t.size[0]||t.size[1]}`,this.cellSizes.set(t.id,t.size)):(e.style.removeProperty("grid-area"),this.cellSizes.delete(t.id)),e.dataset.id=t.id,this._grid.appendChild(e)}),e.keepGrid&&this._grid.parentNode||this.micrio.insertBefore(this._grid,this.micrio.firstChild?.nextSibling??null),this.micrio.events.dispatch("grid-layout-set",this);const r=this.micrio.offsetWidth,n=this.micrio.offsetHeight,a=Math.max(0,Math.min(1,1-(e.scale??1)));this._grid.style.transform="",this._grid.childNodes.forEach(e=>{if(!e)return;const i=e,s=i.dataset.id,o=i.getBoundingClientRect(),h=t.find(t=>t.id==s),c=[a/2*o.width,a/2*o.height];h&&!h.area&&(h.area=[(o.x+c[0])/r,(o.y+c[1])/n,(o.x+o.width-c[0])/r,(o.y+o.height-c[1])/n])}),e.keepGrid||this._grid.remove()}placeGrid(){!this.clickable||this.micrio.state.$tour||this.micrio.state.$marker||this._grid.parentNode||(this.micrio.insertBefore(this._grid,this.micrio.firstChild?.nextSibling??null),this.viewUnsub=this.image.state.view.subscribe(this.updateGrid))}removeGrid(){this._grid.parentNode&&(this.viewUnsub&&this.viewUnsub(),this._grid.remove())}updateGrid(){const t=this.image.camera.getXY(0,0,!0);this._grid.style.setProperty("--translate",`translate3d(${t[0]}px, ${t[1]}px, 0)`),this._grid.style.setProperty("--scale",this.image.camera.getScale().toString()),this._grid.dispatchEvent(new CustomEvent("update"))}placeImage(t,e){const{engine:i}=this.micrio;let s=this.imageMap.get(t.id);s&&t.area?Kr(1e3*e.delay).then(()=>{s.camera.setArea(t.area,{direct:0==e.duration||!e.forceAreaAni&&!wt(s.visible)}),e.delay&&i.render()}):(t.lang=this.micrio.lang,i.addChild(s=new Ph(i,t,{area:t.area}),this.image),this.trackImage(s));const r={duration:1e3*e.duration,timingFunction:this.timingFunction,limit:!1};if(!e.noCamAni&&!s.camera.aniDone&&s.ptr>0){const i=!!e.cover||s.camera.getCoverLimit();if(t.view||!i)s.camera.flyToView(t.view??[0,0,1,1],r).catch(()=>{});else if(t.area&&t.width&&t.height){const e=(t.area[2]-t.area[0])*this.micrio.offsetWidth/((t.area[3]-t.area[1])*this.micrio.offsetHeight);s.camera.flyToView(e<t.width/t.height?[.5,0,.5,1]:[0,.5,1,.5],r).catch(()=>{})}else s.camera.flyToCoverView(r).catch(()=>{})}return s}removeImages(t){const{engine:e}=this.micrio;t.forEach(t=>{t.ptr>=0&&e.fadeOut(t.ptr),this._buttons.delete(t.id)}),e.render()}insideGrid(){const t=this.micrio.$current;return t==this.image||!!t&&this.imageMap.has(t.id)}async reset(t,e,i){const s=this.history[0];return this.images.forEach(t=>t.camera.stop()),this.image.camera.stop(),this.markersShown.set([]),await Si(),i||e||!this.micrio.camera?.isZoomedOut()||this.micrio.state.$tour||this.$focussed||this.hasChanged()||(t=0),this.set(s?.layout||this.image.$info?.grid,{noHistory:!0,duration:t,noCamAni:e,forceAni:i,horizontal:!!s&&s.horizontal}).then(t=>(this.depth.set(this.history.length=0),this.micrio.current.set(this.image),t))}switchToGrid(){const t=this.$focussed;if(!t)return;const e=t.camera.getView();e&&this.reset(0,!0).then(()=>{t.opts.area&&this.image.camera.setView(t.opts.area,{noLimit:!0}),t.camera.setView(e,{noLimit:!0}),this.micrio.current.set(this.image)})}async flyToMarkers(t,e,i){const s=t?.split("|").map(t=>t.trim()),r=s?.[0]??"",n=r?this.images.filter(t=>!!t.$data?.markers?.find(t=>t.tags?.includes(r))):this.images;return this.set(n.map(t=>{const e=t.$data?.markers?.find(t=>t.tags?.includes(r));return this.getString(t.$info,{view:i?void 0:e?.view})}).join(";"),{duration:e,horizontal:"h"==s?.[1]})}async back(t){const e=this.history.pop();e&&(this.depth.set(this.history.length),this.micrio.current.set(this.image),this.$focussed&&this.blur(),await this.set(e.layout,{duration:t,noHistory:!0,horizontal:e.horizontal,view:e.view}))}setTimingFunction(t){this.micrio.engine.setGridTransitionTimingFunction(Ao.Camera.TimingFunction[this.timingFunction=t])}async focus(t,e={}){if(!t)return this.back();e.coverLimit&&(e.cover=!0);const i=!e.view&&!e.cover,s=this.micrio;wt(s.visible).find(t=>t==this.image)||s.current.set(this.image);const r=this.$focussed;if(r==t)return;e.transition?.startsWith("slide-")||0!=e.duration&&(!r||s.engine.areaAnimating(r.ptr)||this.current.includes(t))||t.camera.setArea([0,0,1,1],{noDispatch:!0,direct:!0}),r&&this.blur(),t.camera.setCoverLimit(!!e.cover),this.setTimingFunction("ease");const n=await this.transition(t,r,this.getString(t.$info,{view:e.view}),e);return s.engine.setZIndex(t.ptr,3),this.focussed.set(t),wt(t.visible)||"crossfade"!=e.transition&&e.transition||(e.duration=0),this.set(n,{noBlur:!0,duration:e.duration,forceAreaAni:"crossfade"!=e.transition,cover:!!e.cover,coverLimit:!!e.coverLimit}).then(()=>{s.events.dispatch("grid-focus",t);const e=t.$info;this.removeGrid(),s.$current!=t&&s.current.set(t);const r=s.offsetWidth/s.offsetHeight,n=(1-e.width/e.height/r)/2;!t.camera.aniDone&&i&&t.camera.flyToFullView({duration:1e3*this.aniDurationIn}).catch(()=>{}),this.image.camera.setLimit([n,0,1-n,1])}).catch(()=>{})}async transition(t,e,i,{duration:s,view:r,transition:n,noViewAni:a,exitView:o,blur:h,cover:c}){if(!n)return i;const{engine:l}=this.micrio;if("crossfade"==n&&(t.camera.setArea([0,0,1,1]),a=!0),r&&a&&t.camera.setView(r,{noRender:!0,noLimit:!0}),!e||"crossfade"==n)return i;const d=n.startsWith("slide")||n.startsWith("swipe"),u=n.startsWith("behind"),m=d?n.endsWith("-up")?0:n.endsWith("-down")?180:n.endsWith("-left")?270:90:void 0;if((d||u)&&l.fadeTo(t.ptr,.9999,!0),n.startsWith("slide"))t.camera.setArea(Po[m],{noDispatch:!0,direct:!0});else if(n.startsWith("swipe"))t.camera.setArea($o[m],{noDispatch:!0,direct:!0}),i=[this.getString(e.$info,{view:o??e.camera.getView(),area:Co[m]}),this.getString(t.$info,{view:r,area:[0,0,1,1]})].join(";");else if(u){t.camera.setArea([0,0,1,1]),t.camera.setView([0,0,1,1]);const i=[this.getString(e.$info,{view:[0,0,1,1]}),this.getString(t.$info,{view:[0,0,1,1]})];"behind-left"==n&&i.reverse(),await this.set(i.join(";"),{noBlur:!0,horizontal:!0,coverLimit:c}).then(()=>Kr(200))}if(h&&!isNaN(h)&&h>0){const t=(s=s??this.nextCrossFadeDuration??this.aniDurationIn)/2,e=this.micrio.canvas.element.style;e.transition=`filter ${t}s ease`,e.filter=`blur(${h}px)`,setTimeout(()=>{e.filter="",setTimeout(()=>e.transform="",1e3*t)},1e3*t)}return i}blur(){const t=this.$focussed;t&&(this.micrio.engine.setZIndex(t.ptr,2),this.micrio.events.dispatch("grid-blur"),this.focussed.set(void 0),this.image.camera.setLimit([0,0,1,1]),this.micrio.current.set(this.image))}tourEvent(t){const e=t.detail;e&&e.action?.startsWith("grid:")&&e.active&&this.action(e.action.slice(5),e.data,e.end-e.start)}action(t,e,i){"string"==typeof t&&(t=Ao.Grid.GridActionType[t]);const s=t+(e??"");if(this.lastAction==s)return;const r=this.actionHandlers[t];r?r(e,i):console.warn("Warning: unknown grid tour event",t),this.lastAction=s}async enlarge(t,e,i=e){return this.set((this.history[this.history.length-1]?.layout||this.image.$info.grid).split(";").map((s,r)=>`${s}|${r==t?`${e},${i}`:1}`).join(";"),{noHistory:!0,keepGrid:!0,duration:500})}getRelativeView(t,e){const i=t.opts.area??[0,0,1,1],s=i[2]-i[0],r=i[3]-i[1];return[i[0]+s*e[0],i[1]+r*e[1],i[0]+s*e[2],i[1]+r*e[3]]}},nl=class t extends HTMLElement{static get observedAttributes(){return["id","muted","data-grid","data-limited","lang"]}static{this.jsonCache=xn}get $current(){return this._current}get camera(){return this._current?.camera}constructor(){super(),this.printed=!1,this.canvases=[],this.current=vt(),this.visible=vt([]),this.canvas=new Vc(this),this.events=new Bc(this),this.state=new Eh.Main(this),this.analytics=new il(this),this._router=new el(this),this.barebone=vt(!1),this.webgl=new Fc(this),this.engine=new Cc(this),this.defaultSettings=this.defaultSettings,this.loading=vt(!0),this.switching=vt(!1),this.isMuted=vt("1"==localStorage.getItem(wn)),this._lang=vt(),this.keepRendering=!1,this.initedFirst=!1,this.loadV5Album=(t,e)=>(t=>"MICRIO_ALBUM"in self?Promise.resolve(self.MICRIO_ALBUM):_n(`${fn}album/${t}.json`))(t).then(t=>{if(!t)return;const i=t.id+"."+t.revision,s=e.path=t.organisation?.baseUrl??"https://r2.micr.io/";return e.organisation=t.organisation,e.settings.album=t,e.settings.gallery={archive:i,sort:t.sort,type:t.type,startId:e.id,isSpreads:t.isSpreads,coverPages:t.coverPages,revisions:t.published},delete e.id,this.loadArchiveBin(s,i).then(()=>this.loadGallery(e,s,!0))},t=>this.printError(t?.message||t)),this.getArchiveIndex=async(t,e=gn)=>Ah.get(`${e}${t}.json`).then(t=>(t.images.forEach(t=>xn.set(`${e}${t.id}/info.json`,t)),t)),this.current.subscribe(t=>this._current=t);let t=!1;en(this.loading,{targetValue:!1}).then(()=>{this.setAttribute("data-loaded",""),this.switching.subscribe(e=>{e?this.setAttribute("data-switching",""):(t||Si().then(()=>this.events.dispatch("show",this)),t=!0,this.removeAttribute("data-switching"))});const e=this.querySelector("img.preview");e&&setTimeout(()=>e.remove(),500)})}attributeChangedCallback(t,e,i){switch(t){case"id":if(!this.isConnected||!i)return;this.printed?this.open(i):this.print();break;case"muted":this.isMuted.set(this.hasAttribute("muted"));break;case"data-grid":this.printed?this.$current?.grid?.set(i):this.print();break;case"data-limited":this.engine?._vertexBuffer&&this.$current?.ptr&&this.engine.setLimited(this.$current.ptr,!!i);break;case"lang":{let t=wt(this._lang);t!=i&&(this._lang.set(i),Jn.set(Zn[i]??Zn.en),i&&(ta.includes(i)?this.setAttribute("dir","rtl"):this.removeAttribute("dir")),t&&this.events.dispatch("lang-switch",i));break}}}connectedCallback(){this.canvas.place(),(this.hasAttribute("data-router")||this.hasAttribute("data-space"))&&"false"!=this.getAttribute("data-router")&&this._router.hook(),!this.id&&!this.hasAttribute("data-gallery")||this.printed||this.print(),"muted"in this||(Object.defineProperty(this,"muted",{get(){return wt(this.isMuted)},set(t){t?this.setAttribute("muted",""):this.removeAttribute("muted")}}),this.isMuted.subscribe(t=>{this.muted=t,t?(localStorage.setItem(wn,"1"),this.events.dispatch("audio-mute")):(localStorage.removeItem(wn),this.events.dispatch("audio-unmute"))}))}addEventListener(t,e,i){super.addEventListener(t,e,i)}removeEventListener(t,e,i){super.removeEventListener(t,e,i)}destroy(){this.current.set(void 0),this._router.unhook(),this.events.enabled.set(!1),this.canvas.unhook(),this.analytics.unhook(),this.engine.unbind(),this._ui&&ds(this._ui),delete this._ui,this.webgl.dispose(!0),this.printed=!1}loadArchiveBin(t,e){return this.printUI(!0,!0),Ah.load(t,"g/"+e,t=>this._ui?.setProps?.({loadingProgress:t}))}async print(){if(this.printed)return;this.printed=!0,await Si();const t=this.getOptions();if(t.settings||(t.settings={}),t.settings.noControls&&this.state.ui.controls.set(!1),t.settings.gallery?.archive){const e=t.settings.gallery?.archive,i=/\.\d+$/.test(e),s=t.path||(An(e.replace(/\.\d+$/,""))?"https://r2.micr.io/":"https://b.micr.io/");i&&await this.loadArchiveBin(s,e),t.settings.gallery.startId=t.id,t.grid?await this.setGrid(t,s):await this.loadGallery(t,s,i),i||delete t.settings.gallery.archive,t.path||(t.path=s),delete t.id}else t.id?.startsWith("album/")?await this.loadV5Album(t.id.replace("album/",""),t):t.id&&An(t.id)&&!this.hasAttribute("width")&&!this.hasAttribute("height")&&await Sn(t.id,t.forceInfoPath?t.path:void 0,t.settings?.forceDataRefresh).then(e=>e?.albumId?this.loadV5Album(e.albumId,t):void 0).catch(()=>{});this.keepRendering=!!t.settings.keepRendering;const e=t.id||t.gallery||t.grid;if(this.events.dispatch("print",t),void 0!==t.settings.lazyload&&"IntersectionObserver"in window){const i=new IntersectionObserver(s=>{s[0]&&s[0].isIntersecting&&(i.unobserve(this),e&&this.open(t))},{rootMargin:100*t.settings.lazyload+"% 0px"});i.observe(this)}else e&&requestAnimationFrame(()=>this.open(t))}printUI(e,i){this._ui?this._ui.setProps?.({noHTML:e,noLogo:i}):this._ui=as(t.Svelte,{target:this,props:{micrio:this,noHTML:e,noLogo:i}})}printError(t){const e=t instanceof Nr?t.displayMessage:(t instanceof Error?t.message:t)??"An unknown error has occurred";console.error("Error:",e+(t instanceof Nr?` (${t.code}: ${t.message})`:"")),this._ui?.setProps?.({error:e})}open(t,e={}){this.printed||this.print();const i="string"==typeof t,s=this.getOptions();let r=i?{...s,id:t}:t;if(r.settings||(r.settings={}),s.settings?.gallery?.archive&&(/\.\d+$/.test(s.settings.gallery.archive)||delete s.settings.gallery.archive),i||Wr(s.settings,r.settings),this.defaultSettings&&Wr(this.defaultSettings,r.settings),this.$current&&r.id==this.$current?.id)return this.$current;e.splitScreen||e.gridView||!this.$current||this.switching.set(!0),r.settings.noGTag||this.analytics.hook(),this.printed=!0,this.printUI(!!r.settings.noUI,!!r.settings.noLogo);let n=this.canvases.find(t=>r.id&&t.id==r.id),a=!1;const o=this.canvases[0]?.grid;if(!n&&o){const t=r.id?o.images.find(t=>t.id==r.id):void 0;a=!!t,n=r.id?t:this.canvases[0],a&&!o.insideGrid()&&this.current.set(this.canvases[0])}if(!n){this.canvases.length&&(r.path=this.canvases[0].dataPath,r.lang=this.lang),this.canvases.push(n=new Ph(this.engine,r,e.splitScreen?{secondaryTo:e.splitTo??this._current,isPassive:e.isPassive}:void 0));const t=this.state.value&&this.state.value.c.find(t=>t[0]==r.id);t&&n.state.set(t)}e.startView&&(n.state.view.set(r.settings.view=e.startView),n.ptr>0&&n.engine.ready&&n.camera.setView(r.settings.view,{noRender:!0})),this.lang||(this.lang="en");const h=()=>{if(n){if(!this.webgl.gl)try{this.webgl.init()}catch(t){return void this.printError(t)}en(n.info).then(t=>{if(t&&n){if(!this.initedFirst){switch(this.canvas.hook(),this._current?.$settings?.theme){case"light":this.setAttribute("data-light-mode","");break;case"os":this.setAttribute("data-auto-scheme","")}this.initedFirst=!0}t.grid&&!n.grid&&(n.grid=new rl(this,n)),Si().then(()=>this.dispatchEvent(new CustomEvent("load",{detail:n}))),e.splitScreen&&Si().then(()=>{n&&(o?.image.camera.aniDoneAdd&&o.image.camera.aniDoneAdd.length>0?o.image.camera.aniDoneAdd.push(()=>n?.splitStart()):n.splitStart())})}}),this.engine.set360Orientation(e.vector?.direction??0,e.vector?.distanceX??0,e.vector?.distanceY??0),this.engine.preventDirectionSet=!e.vector,!a||e.gridView&&o?.current.find(t=>t.id==r.id)?e.splitScreen?this.engine.setCanvas(n):this.current.set(n):o?.focus(n,{view:r.settings?.view}).then(()=>this.current.set(n))}};return this.engine.ready?h():this.engine.load().then(h).catch(t=>this.printError(t)),n.noImage&&this.loading.set(!1),n}close(t){t.opts.secondaryTo?t.splitEnd():this.engine.removeCanvas(t)}getOptions(){const t={gallery:{}},e={settings:t,id:this.id},i=(t,e,i)=>{const s=e.split(".");for(let r=0;r<s.length-1;r++)t=t[s[r]];t[s[s.length-1]]=i};for(const s in bn.STRINGS){const r=bn.STRINGS[s],n=this.getAttribute(s),a=r.f||s.replace("data-","");n&&i(r.r?e:t,a,n)}for(const s in bn.BOOLEANS){const r=bn.BOOLEANS[s],n=this.getAttribute(s),a=r.f||s.replace("data-",""),o=null!=n&&""==n||"true"==n;(o||"false"==n)&&i(r.r?e:t,a,r.n?!o:!!o)}for(const s in bn.NUMBERS){const r=bn.NUMBERS[s],n=r.f||s.replace("data-","");let a=this.getAttribute(s);void 0!==r.dN&&null==a&&(a=r.dN),null==a||isNaN(Number(a))||i(r.r?e:t,n,Number(a))}for(const s in bn.ARRAYS){const r=bn.ARRAYS[s],n=this.getAttribute(s),a=r.f||s.replace("data-","");null!=n&&i(r.r?e:t,a,n.split(",").map(t=>Number(t)))}return t.static&&(t.noUI=t.skipMeta=!0,t.hookEvents=!1),e.settings&&e.grid&&e.grid.indexOf(".")>0&&(e.settings.gallery.archive=e.grid),e}async loadGallery(t,e,i){let s=t.settings?.gallery,r=s?.archive;if(!s||!r)return;const n=t.settings;if(i){const t=await this.getArchiveIndex(r.split(".")[0],e);s.archiveLayerOffset=t.delta,r=t.images.sort("name"==s.sort?(t,e)=>t.title&&e.title?t.title<e.title?-1:t.title>e.title?1:0:0:"-name"==s.sort?(t,e)=>t.title&&e.title?t.title<e.title?1:t.title>e.title?-1:0:0:"-created"==s.sort?(t,e)=>t.created&&e.created?t.created<e.created?1:t.created>e.created?-1:0:0:(t,e)=>t.created&&e.created?t.created<e.created?-1:t.created>e.created?1:0:0).map(t=>`${t.id},${t.width},${t.height},${t.isDeepZoom?"d":""},${t.isPng?"p":t.isWebP?"w":""},${t.tileSize||""}`.replace(/\,+$/,"")).join(";")}const a=r.split(";").map(t=>t.trim());if(!i){const t=a.filter(t=>t.startsWith("http")).map(t=>_n(t));t.length&&await Promise.all(t).then(t=>t.forEach((t,e)=>{t&&(a[e]=`${t["@id"]},${t.width},${t.height}`)}))}const o=a.map(t=>t.split(",").map(t=>isNaN(t)?t:Number(t)));o.forEach((t,e)=>{e>0&&!t[2]&&t.push(...o[e-1].slice(1))}),s.type||(s.type="swipe");const h="switch"==s.type||"swipe-full"==s.type||"omni"==s.type,c=s.isSpreads;if(!h){t.width=this.offsetWidth*this.canvas.getRatio(),t.height=this.offsetHeight*this.canvas.getRatio();const i=Math.max(0,o.findIndex(t=>t[0]==s.startId));return t.gallery=o.map((t,r)=>new Ph(this.engine,{id:t[0],path:e,width:t[1],height:t[2],isDeepZoom:"d"==t[3],isPng:"p"==t[4],isWebP:"w"==t[4],tileSize:t[5]||1024,revision:s?.revisions?.[t[0]],settings:{skipMeta:!0,gallery:s}},{area:[r-i,0,r-i+1,1]})),void(n.view=[0,0,1,1])}t.height=Math.max(...o.map(t=>t[2]));const l=c?s.coverPages??0:0;t.width=Math.max(...o.map(t=>t[1]*(c?2:1))),t.gallery=o.map((t,i)=>new Ph(this.engine,{id:t[0],path:e,width:t[1],height:t[2],isDeepZoom:"d"==t[3],isPng:"p"==t[4],isWebP:"w"==t[4],tileSize:t[5]||1024,revision:s?.revisions?.[t[0]],settings:{skipMeta:!0,gallery:s}},{isEmbed:!0,useParentCamera:!0,area:c?i-l<0||i==o.length-1&&(i-l)%2==0?[.25,0,.75,1]:(i-l)%2==0?[0,0,.5,1]:[.5,0,1,1]:[0,0,1,1]})),n.pinchZoomOutLimit=!0,t.gallery.length&&(n.view=rn.fromLegacy(t.gallery[Math.max(0,t.gallery.findIndex(t=>t.id==s.startId))].opts.area))}async setGrid(t,e){t.settings&&t.grid&&(t.settings.gallery?.archive==t.grid&&(this.gridInfoData=await this.getArchiveIndex(t.grid.split(".")[0],e),t.grid=this.gridInfoData.images.map(t=>rl.getString(t,{cultures:"cultures"in t?t.cultures.join("-"):void 0})).join(";")),t.width=this.offsetWidth*this.canvas.getRatio(),t.height=this.offsetHeight*this.canvas.getRatio(),t.settings.zoomLimit=15,t.settings.minimap=!1,t.settings.initType="cover",this.removeAttribute("data-grid"))}get lang(){return wt(this._lang)}set lang(t){this.setAttribute("lang",t)}};nl.Svelte=function(t,e){et(e,!0);const i=()=>xt(Ei(E),"$settings",l),s=()=>xt(Ei(M),"$info",l),r=()=>xt(Ei(S),"$data",l),n=()=>xt(x,"$tour",l),a=()=>xt($,"$volume",l),o=()=>xt(w,"$visible",l),h=()=>xt(k,"$markerPopup",l),c=()=>xt(_,"$popover",l),[l,d]=kt();let u=br(e,"noHTML",15),m=br(e,"noLogo",23,u),g=br(e,"loadingProgress",7,1),p=br(e,"error",7,void 0);tt("micrio",Li(()=>e.micrio)),tt("markerImages",new Map);const f=Li(()=>"markers"==e.micrio.getAttribute("data-ui"));f&&u(!0);const v=Li(()=>"false"!=e.micrio.getAttribute("data-embeds")),{visible:w,state:y,isMuted:b}=Li(()=>e.micrio),{tour:x,marker:T,popup:k,popover:_}=y;let M=ne(void 0),S=ne(void 0),E=ne(void 0);function I(t,e){if(e)for(let i,s=0;s<e.length;s++)if(e[s].id==t||(i=I(t,e[s].children)))return i??e[s]}let A=ne(!1),L=ne(void 0);const P=[];Li(()=>e.micrio).current.subscribe(t=>{t&&(Tt(oe(M,t.info,!0),"$info",l),Tt(oe(E,void 0),"$settings",l),Ei(M)&&en(Ei(M)).then(e=>{e&&(oe(A,!0),Tt(oe(E,t.settings,!0),"$settings",l),!Ei(L)&&e.organisation?.logo&&oe(L,e.organisation,!0))}),Tt(oe(S,t.data,!0),"$data",l)&&P.indexOf(t.id)<0&&en(Ei(S)).then(async i=>{if(!i)return;if(P.push(t.id),await Si().then(Si),wt(e.micrio.state.popover)||wt(e.micrio.state.marker)||wt(e.micrio.state.tour))return;const s=t.$settings.start;if(s)switch(s.type){case"marker":t.state.marker.set(s.id);break;case"markerTour":const r=i.markerTours?.find(t=>t.id==s.id);r&&e.micrio.state.tour.set(r);break;case"tour":const n=i.tours?.find(t=>t.id==s.id);n&&e.micrio.state.tour.set(n);break;case"page":const a=I(s.id,i.pages);a&&e.micrio.state.popover.set({contentPage:a,showLangSelect:!0})}}))});const $=vt(xt(b,"$isMuted",l)?0:1);tt("volume",$),b.subscribe(t=>$.set(t?0:1)),tt("mediaPaused",vt(!1));let C=ne(!1),D=ne(ue([]));tt("srt",vt()).subscribe(t=>setTimeout(()=>{oe(D,t?[t]:[],!0)},20));const z=jt(()=>i()?._360?.video),O=jt(()=>Ei(z)?.src),R=jt(()=>i()?.omni),X=jt(()=>s()?.gallery),F=jt(()=>r()?.markers?.filter(t=>!!t.positionalAudio)),V=jt(()=>!!r()?.music?.items.length||!!Ei(F)?.length),Y=jt(()=>n()||xt(T,"$marker",l)),N=jt(()=>!u()||f),B=jt(()=>!(m()||s()&&u()||i()?.noLogo)),W=jt(()=>u()||!Ei(B)||i()?.noOrgLogo?void 0:Ei(L)),U=jt(()=>!(u()||Ei(R)||e.micrio.spaceData||n()||s()?.gallery)),H=jt(()=>!!Ei(X)||!!Ei(R)),G=jt(()=>!u()&&!!s()),j=jt(()=>!u()&&!Ei(Y)&&i()?.showInfo),Z=jt(()=>!u()&&Ei(A)&&!i()?.noToolbar);var J={setProps:function(t){"error"in t&&p(t.error),void 0!==t.noHTML&&u(t.noHTML),void 0!==t.noLogo&&m(t.noLogo),void 0!==t.loadingProgress&&g(t.loadingProgress)}},K=Gh(),Q=_e(K),st=t=>{{let e=jt(()=>!!s().is360);Zo(t,{get volume(){return a()},get data(){return r()},get is360(){return Ei(e)}})}};vs(Q,t=>{Ei(V)&&r()&&s()&&t(st)});var rt=Me(Q,2),nt=t=>{so(t,yr({get src(){return Ei(O)},get volume(){return a()},is360:!0,get width(){return s().width},get height(){return s().height}},()=>Ei(z)))};vs(rt,t=>{Ei(O)&&s()&&t(nt)});var at=Me(rt,2),ot=t=>{var e=Hi();bs(_e(e),1,()=>r().embeds,t=>t.uuid,(t,e)=>{zh(t,{get embed(){return Ei(e)}})}),Gi(t,e)};vs(at,t=>{v&&r()&&r().embeds&&t(ot)});var ht=Me(at,2),ct=t=>{Hn(t,{})};vs(ht,t=>{Ei(B)&&t(ct)});var lt=Me(ht,2),dt=t=>{va(t,{})};vs(lt,t=>{Ei(Z)&&t(dt)});var ut=Me(lt,2),mt=t=>{var e=Hi();bs(_e(e),1,o,t=>t.uuid,(t,e)=>{Bh(t,{get image(){return Ei(e)}})}),Gi(t,e)};vs(ut,t=>{Ei(N)&&t(mt)});var gt=Me(ut,2),pt=t=>{var e=Hi();bs(_e(e),1,()=>o().filter(t=>t.$settings.minimap),t=>t.uuid,(t,e)=>{ya(t,{get image(){return Ei(e)}})}),Gi(t,e)};vs(gt,t=>{Ei(U)&&t(pt)});var ft=Me(gt,2),yt=t=>{{let e=jt(()=>Ei(V)||!(!Ei(O)||!Ei(z)||Ei(z).muted));La(t,{get hasAudio(){return Ei(e)}})}};vs(ft,t=>{Ei(G)&&t(yt)});var bt=Me(ft,2),_t=t=>{var e=Wh(),i=_e(e),s=t=>{No(t,{get images(){return Ei(X)},get omni(){return Ei(R)}})};vs(i,t=>{Ei(H)&&t(s)});var r=Me(i,2),n=t=>{jn(t,{get organisation(){return Ei(W)}})};vs(r,t=>{Ei(W)&&t(n)});var a=Me(r,2),o=t=>{ih(t,{get info(){return Ei(M)},get data(){return Ei(S)}})};vs(a,t=>{Ei(j)&&Ei(M)&&Ei(S)&&t(o)}),Gi(t,e)};vs(bt,t=>{(Ei(H)||Ei(W)||Ei(j)&&Ei(M)&&Ei(S))&&t(_t)});var Mt=Me(bt,2),St=t=>{var e=Uh(),i=_e(e),s=t=>{wo(t,{get marker(){return h()}})};vs(i,t=>{h()&&t(s)});var r=Me(i,2),a=t=>{Io(t,{get tour(){return n()},get noHTML(){return u()},onminimize:t=>oe(C,!t)})};vs(r,t=>{n()&&t(a)});var o=Me(r,2),l=t=>{vh(t,{get popover(){return c()}})};vs(o,t=>{c()&&t(l)}),Gi(t,e)};vs(Mt,t=>{(h()||n()||c())&&t(St)});var Et=Me(Mt,2);bs(Et,16,()=>Ei(D),t=>t,(t,e)=>{Va(t,{get src(){return e},get raised(){return Ei(C)}})});var It=Me(Et,2),At=t=>{var e=Hh(),i=_e(e),s=t=>{!function(t,e){var i=sh(),s=ke(i);sa(s,{name:"error"});var r=Me(s);q(i),Ye(()=>ns(r,` ${e.message??""}`)),Gi(t,i)}(t,{get message(){return p()}})};vs(i,t=>{p()&&t(s)});var r=Me(i,2),n=t=>{!function(t,e){const i=2*Math.PI*40,s=jt(()=>i*(1-e.progress));var r=qh();ar(r,"viewBox","0 0 100 100");var n=ke(r);ar(n,"r",40),ar(n,"cx",50),ar(n,"cy",50);var a=Me(n);ar(a,"r",40),ar(a,"cx",50),ar(a,"cy",50),ar(a,"stroke-dasharray","251.32741228718345px"),q(r),Ye(()=>ar(a,"stroke-dashoffset",`${Ei(s)??""}px`)),Ds(1,r,()=>qn,()=>({delay:500})),Ds(2,r,()=>qn),Gi(t,r)}(t,{get progress(){return g()}})};vs(r,t=>{g()<1&&t(n)}),Gi(t,e)};vs(It,t=>{(p()||g()<1)&&t(At)}),Gi(t,K);var Lt=it(J);return d(),Lt},nl.VERSION=mn,customElements.define("micr-io",nl),console.info("%c◈%c Micrio %cv6.0.1 - https://micr.io/","color: #00d4ee","color: #c5ff5b","color: inherit")}();
30
+ !function(){"undefined"!=typeof window&&((window.__svelte??={}).v??=new Set).add("5");var t={},e=Symbol(),i=(Symbol("filename"),"http://www.w3.org/2000/svg"),s=Array.isArray,r=Array.prototype.indexOf,n=Array.prototype.includes,a=Array.from,o=Object.keys,h=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyDescriptors,d=Object.prototype,u=Array.prototype,m=Object.getPrototypeOf,g=Object.isExtensible;function p(t){return"function"==typeof t}var f=()=>{};function v(){var t,e;return{promise:new Promise((i,s)=>{t=i,e=s}),resolve:t,reject:e}}function w(t,e){if(Array.isArray(t))return t;if(void 0===e||!(Symbol.iterator in t))return Array.from(t);const i=[];for(const s of t)if(i.push(s),i.length===e)break;return i}var y=1024,b=2048,x=4096,T=8192,k=32768,_=1<<25,M=65536,S=1<<19,E=1<<25,I=65536,A=1<<21,L=1<<23,P=Symbol("$state"),$=Symbol("legacy props"),C=Symbol(""),D=(Symbol("proxy path"),Symbol("hmr anchor"),new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"}),z=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml");function O(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function R(t,e,i){throw new Error("https://svelte.dev/e/each_key_duplicate")}function X(t){console.warn("https://svelte.dev/e/hydration_mismatch")}var F,V=!1;function Y(t){V=t}function N(e){if(null===e)throw X(),t;return F=e}function B(){return N(Te(F))}function q(e){if(V){if(null!==Te(F))throw X(),t;F=e}}function W(t=1){if(V){for(var e=t,i=F;e--;)i=Te(i);F=i}}function U(t=!0){for(var e=0,i=F;;){if(8===i.nodeType){var s=i.data;if("]"===s){if(0===e)return i;e-=1}else("["===s||"[!"===s||"["===s[0]&&!isNaN(Number(s.slice(1))))&&(e+=1)}var r=Te(i);t&&i.remove(),i=r}}function H(e){if(!e||8!==e.nodeType)throw X(),t;return e.data}function G(t){return t===this.v}function j(t,e){return t!=t?e==e:t!==e||null!==t&&"object"==typeof t||"function"==typeof t}function Z(t){return!j(t,this.v)}var J=null;function K(t){J=t}function Q(t){return st("getContext").get(t)}function tt(t,e){return st("setContext").set(t,e),e}function et(t,e=!1,i){J={p:J,i:!1,c:null,e:null,s:t,x:null,r:hi,l:null}}function it(t){var e=J,i=e.e;if(null!==i)for(var s of(e.e=null,i))Xe(s);return void 0!==t&&(e.x=t),e.i=!0,J=e.p,t??{}}function st(t){return null===J&&O(),J.c??=new Map(function(t){let e=t.p;for(;null!==e;){const t=e.c;if(null!==t)return t;e=e.p}return null}(J)||void 0)}var rt=[];function nt(){var t=rt;rt=[],function(t){for(var e=0;e<t.length;e++)t[e]()}(t)}function at(t){if(0===rt.length&&!It){var e=rt;queueMicrotask(()=>{e===rt&&nt()})}rt.push(t)}function ot(){for(;rt.length>0;)nt()}function ht(t){var e=hi;if(null===e)return ni.f|=L,t;if(!(32768&e.f||4&e.f))throw t;ct(t,e)}function ct(t,e){for(;null!==e;){if(128&e.f){if(!(32768&e.f))throw t;try{return void e.b.error(t)}catch(i){t=i}}e=e.parent}throw t}var lt=-7169;function dt(t,e){t.f=t.f&lt|e}function ut(t){512&t.f||null===t.deps?dt(t,y):dt(t,x)}function mt(t){if(null!==t)for(const e of t)2&e.f&&65536&e.f&&(e.f^=I,mt(e.deps))}function gt(t,e,i){2048&t.f?e.add(t):4096&t.f&&i.add(t),mt(t.deps),dt(t,y)}function pt(t,e,i){if(null==t)return e(void 0),i&&i(void 0),f;const s=Li(()=>t.subscribe(e,i));return s.unsubscribe?()=>s.unsubscribe():s}var ft=[];function vt(t,e=f){let i=null;const s=new Set;function r(e){if(j(t,e)&&(t=e,i)){const e=!ft.length;for(const i of s)i[1](),ft.push(i,t);if(e){for(let t=0;t<ft.length;t+=2)ft[t][0](ft[t+1]);ft.length=0}}}function n(e){r(e(t))}return{set:r,update:n,subscribe:function(a,o=f){const h=[a,o];return s.add(h),1===s.size&&(i=e(r,n)||f),a(t),()=>{s.delete(h),0===s.size&&i&&(i(),i=null)}}}}function wt(t){let e;return pt(t,t=>e=t)(),e}var yt=!1,bt=Symbol();function xt(t,e,i){const s=i[e]??={store:null,source:ae(void 0),unsubscribe:f};if(s.store!==t&&!(bt in i))if(s.unsubscribe(),s.store=t??null,null==t)s.source.v=void 0,s.unsubscribe=f;else{var r=!0;s.unsubscribe=pt(t,t=>{r?s.source.v=t:oe(s.source,t)}),r=!1}return t&&bt in i?wt(t):Ei(s.source)}function Tt(t,e,i){let s=i[e];return s&&s.store!==t&&(s.unsubscribe(),s.unsubscribe=f),t}function kt(){const t={};return[t,function(){Oe(()=>{for(var e in t)t[e].unsubscribe();h(t,bt,{enumerable:!1,value:!0})})}]}var _t=new Set,Mt=null,St=null,Et=null,It=!1,At=!1,Lt=null,Pt=null,$t=0,Ct=1,Dt=class t{id=Ct++;current=new Map;previous=new Map;#t=new Set;#e=new Set;#i=new Set;#s=new Map;#r=new Map;#n=null;#a=[];#o=[];#h=new Set;#c=new Set;#l=new Map;#d=new Set;is_fork=!1;#u=!1;#m=new Set;#g(){return this.is_fork||this.#r.size>0}#p(){for(const i of this.#m)for(const s of i.#r.keys()){for(var t=!1,e=s;null!==e.parent;){if(this.#l.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(t){this.#l.has(t)||this.#l.set(t,{d:[],m:[]}),this.#d.delete(t)}unskip_effect(t,e=t=>this.schedule(t)){var i=this.#l.get(t);if(i){for(var s of(this.#l.delete(t),i.d))dt(s,b),e(s);for(s of i.m)dt(s,x),e(s)}this.#d.add(t)}#f(){if($t++>1e3&&(_t.delete(this),function(){try{!function(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}()}catch(t){0,ct(t,Et)}}()),!this.#g()){for(const t of this.#h)this.#c.delete(t),dt(t,b),this.schedule(t);for(const t of this.#c)dt(t,x),this.schedule(t)}const e=this.#a;this.#a=[],this.apply();var i=Lt=[],s=[],r=Pt=[];for(const t of e)try{this.#v(t,i,s)}catch(o){throw Nt(t),o}if(Mt=null,r.length>0){var n=t.ensure();for(const t of r)n.schedule(t)}if(Lt=null,Pt=null,this.#g()||this.#p()){this.#w(s),this.#w(i);for(const[t,e]of this.#l)Yt(t,e)}else{0===this.#s.size&&_t.delete(this),this.#h.clear(),this.#c.clear();for(const t of this.#t)t(this);this.#t.clear(),Rt(s),Rt(i),this.#n?.resolve()}var a=Mt;if(this.#a.length>0){const t=a??=this;t.#a.push(...this.#a.filter(e=>!t.#a.includes(e)))}null!==a&&(_t.add(a),a.#f())}#v(t,e,i){t.f^=y;for(var s=t.first;null!==s;){var r=s.f,n=!!(96&r);if(!(n&&1024&r||8192&r||this.#l.has(s))&&null!==s.fn){n?s.f^=y:4&r?e.push(s):bi(s)&&(16&r&&this.#c.add(s),Mi(s));var a=s.first;if(null!==a){s=a;continue}}for(;null!==s;){var o=s.next;if(null!==o){s=o;break}s=s.parent}}}#w(t){for(var e=0;e<t.length;e+=1)gt(t[e],this.#h,this.#c)}capture(t,i,s=!1){t.v===e||this.previous.has(t)||this.previous.set(t,t.v),8388608&t.f||(this.current.set(t,[i,s]),St?.set(t,i)),this.is_fork||(t.v=i)}activate(){Mt=this}deactivate(){Mt=null,St=null}flush(){try{At=!0,Mt=this,this.#f()}finally{$t=0,Et=null,Lt=null,Pt=null,At=!1,Mt=null,St=null,ie.clear()}}discard(){for(const t of this.#e)t(this);this.#e.clear(),this.#i.clear(),_t.delete(this)}register_created_effect(t){this.#o.push(t)}#y(){for(const c of _t){var t=c.id<this.id,e=[];for(const[s,[r,n]]of this.current){if(c.current.has(s)){var i=c.current.get(s)[0];if(!t||r===i)continue;c.current.set(s,[r,n])}e.push(s)}var s=[...c.current.keys()].filter(t=>!this.current.has(t));if(0===s.length)t&&c.discard();else if(e.length>0){if(t)for(const t of this.#d)c.unskip_effect(t,t=>{4194320&t.f?c.schedule(t):c.#w([t])});c.activate();var r=new Set,n=new Map;for(var a of e)Xt(a,s,r,n);n=new Map;var o=[...c.current.keys()].filter(t=>!this.current.has(t)||this.current.get(t)[0]!==t);for(const t of this.#o)155648&t.f||!Ft(t,o,n)||(4194320&t.f?(dt(t,b),c.schedule(t)):c.#h.add(t));if(c.#a.length>0){for(var h of(c.apply(),c.#a))c.#v(h,[],[]);c.#a=[]}c.deactivate()}}for(const c of _t)c.#m.has(this)&&(c.#m.delete(this),0!==c.#m.size||c.#g()||(c.activate(),c.#f()))}increment(t,e){let i=this.#s.get(e)??0;if(this.#s.set(e,i+1),t){let t=this.#r.get(e)??0;this.#r.set(e,t+1)}}decrement(t,e,i){let s=this.#s.get(e)??0;if(1===s?this.#s.delete(e):this.#s.set(e,s-1),t){let t=this.#r.get(e)??0;1===t?this.#r.delete(e):this.#r.set(e,t-1)}this.#u||i||(this.#u=!0,at(()=>{this.#u=!1,this.flush()}))}transfer_effects(t,e){for(const i of t)this.#h.add(i);for(const i of e)this.#c.add(i);t.clear(),e.clear()}oncommit(t){this.#t.add(t)}ondiscard(t){this.#e.add(t)}on_fork_commit(t){this.#i.add(t)}run_fork_commit_callbacks(){for(const t of this.#i)t(this);this.#i.clear()}settled(){return(this.#n??=v()).promise}static ensure(){if(null===Mt){const e=Mt=new t;At||(_t.add(Mt),It||at(()=>{Mt===e&&e.flush()}))}return Mt}apply(){St=null}schedule(t){if(Et=t,!(t.b?.is_pending&&16777228&t.f)||32768&t.f){for(var e=t;null!==e.parent;){var i=(e=e.parent).f;if(!(null===Lt||e!==hi||null!==ni&&2&ni.f))return;if(96&i){if(!(1024&i))return;e.f^=y}}this.#a.push(e)}else t.b.defer_effect(t)}};function zt(t){var e=It;It=!0;try{var i;for(t&&(null===Mt||Mt.is_fork||Mt.flush(),i=t());;){if(ot(),null===Mt)return i;Mt.flush()}}finally{It=e}}var Ot=null;function Rt(t){var e=t.length;if(0!==e){for(var i=0;i<e;){var s=t[i++];if(!(24576&s.f)&&bi(s)&&(Ot=new Set,Mi(s),null===s.deps&&null===s.first&&null===s.nodes&&null===s.teardown&&null===s.ac&&je(s),Ot?.size>0)){ie.clear();for(const t of Ot){if(24576&t.f)continue;const e=[t];let i=t.parent;for(;null!==i;)Ot.has(i)&&(Ot.delete(i),e.push(i)),i=i.parent;for(let t=e.length-1;t>=0;t--){const i=e[t];24576&i.f||Mi(i)}}Ot.clear()}}Ot=null}}function Xt(t,e,i,s){if(!i.has(t)&&(i.add(t),null!==t.reactions))for(const r of t.reactions){const t=r.f;2&t?Xt(r,e,i,s):4194320&t&&!(2048&t)&&Ft(r,e,s)&&(dt(r,b),Vt(r))}}function Ft(t,e,i){const s=i.get(t);if(void 0!==s)return s;if(null!==t.deps)for(const r of t.deps){if(n.call(e,r))return!0;if(2&r.f&&Ft(r,e,i))return i.set(r,!0),!0}return i.set(t,!1),!1}function Vt(t){Mt.schedule(t)}function Yt(t,e){if(!(32&t.f&&1024&t.f)){2048&t.f?e.d.push(t):4096&t.f&&e.m.push(t),dt(t,y);for(var i=t.first;null!==i;)Yt(i,e),i=i.next}}function Nt(t){dt(t,y);for(var e=t.first;null!==e;)Nt(e),e=e.next}var Bt=class{parent;is_pending=!1;transform_error;#b;#x=V?F:null;#T;#k;#_;#M=null;#S=null;#E=null;#I=null;#A=0;#L=0;#P=!1;#h=new Set;#c=new Set;#$=null;#C=function(t){let e,i=0,s=re(0);return()=>{ze()&&(Ei(s),Ve(()=>(0===i&&(e=Li(()=>t(()=>le(s)))),i+=1,()=>{at(()=>{i-=1,0===i&&(e?.(),e=void 0,le(s))})})))}}(()=>(this.#$=re(this.#A),()=>{this.#$=null}));constructor(t,e,i,s){this.#b=t,this.#T=e,this.#k=t=>{var e=hi;e.b=this,e.f|=128,i(t)},this.parent=hi.b,this.transform_error=s??this.parent?.transform_error??(t=>t),this.#_=Ne(()=>{if(V){const t=this.#x;B();const e="[!"===t.data;if(t.data.startsWith("[?")){const e=JSON.parse(t.data.slice(2));this.#D(e)}else e?this.#z():this.#O()}else this.#R()},589824),V&&(this.#b=F)}#O(){try{this.#M=qe(()=>this.#k(this.#b))}catch(t){this.error(t)}}#D(t){const e=this.#T.failed;e&&(this.#E=qe(()=>{e(this.#b,()=>t,()=>()=>{})}))}#z(){const t=this.#T.pending;t&&(this.is_pending=!0,this.#S=qe(()=>t(this.#b)),at(()=>{var t=this.#I=document.createDocumentFragment(),e=be();t.append(e),this.#M=this.#X(()=>qe(()=>this.#k(e))),0===this.#L&&(this.#b.before(t),this.#I=null,Ze(this.#S,()=>{this.#S=null}),this.#F(Mt))}))}#R(){try{if(this.is_pending=this.has_pending_snippet(),this.#L=0,this.#A=0,this.#M=qe(()=>{this.#k(this.#b)}),this.#L>0){var t=this.#I=document.createDocumentFragment();ti(this.#M,t);const e=this.#T.pending;this.#S=qe(()=>e(this.#b))}else this.#F(Mt)}catch(e){this.error(e)}}#F(t){this.is_pending=!1,t.transfer_effects(this.#h,this.#c)}defer_effect(t){gt(t,this.#h,this.#c)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#T.pending}#X(t){var e=hi,i=ni,s=J;ci(this.#_),oi(this.#_),K(this.#_.ctx);try{return Dt.ensure(),t()}catch(r){return ht(r),null}finally{ci(e),oi(i),K(s)}}#V(t,e){this.has_pending_snippet()?(this.#L+=t,0===this.#L&&(this.#F(e),this.#S&&Ze(this.#S,()=>{this.#S=null}),this.#I&&(this.#b.before(this.#I),this.#I=null))):this.parent&&this.parent.#V(t,e)}update_pending_count(t,e){this.#V(t,e),this.#A+=t,this.#$&&!this.#P&&(this.#P=!0,at(()=>{this.#P=!1,this.#$&&he(this.#$,this.#A)}))}get_effect_pending(){return this.#C(),Ei(this.#$)}error(t){if(!this.#T.onerror&&!this.#T.failed)throw t;Mt?.is_fork?(this.#M&&Mt.skip_effect(this.#M),this.#S&&Mt.skip_effect(this.#S),this.#E&&Mt.skip_effect(this.#E),Mt.on_fork_commit(()=>{this.#Y(t)})):this.#Y(t)}#Y(t){this.#M&&(He(this.#M),this.#M=null),this.#S&&(He(this.#S),this.#S=null),this.#E&&(He(this.#E),this.#E=null),V&&(N(this.#x),W(),N(U()));var e=this.#T.onerror;let i=this.#T.failed;var s=!1,r=!1;const n=()=>{s?console.warn("https://svelte.dev/e/svelte_boundary_reset_noop"):(s=!0,r&&function(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}(),null!==this.#E&&Ze(this.#E,()=>{this.#E=null}),this.#X(()=>{this.#R()}))},a=s=>{try{r=!0,e?.(s,n),r=!1}catch(t){ct(t,this.#_&&this.#_.parent)}i&&(this.#E=this.#X(()=>{try{return qe(()=>{var t=hi;t.b=this,t.f|=128,i(this.#b,()=>s,()=>n)})}catch(t){return ct(t,this.#_.parent),null}}))};at(()=>{var e;try{e=this.transform_error(t)}catch(i){return void ct(i,this.#_&&this.#_.parent)}null!==e&&"object"==typeof e&&"function"==typeof e.then?e.then(a,t=>ct(t,this.#_&&this.#_.parent)):a(e)})}};function qt(t,e,i,s){const r=Ht;var n=t.filter(t=>!t.settled);if(0!==i.length||0!==n.length){var a=hi,o=function(){var t=hi,e=ni,i=J,s=Mt;return function(r=!0){ci(t),oi(e),K(i),!r||16384&t.f||(s?.activate(),s?.apply())}}(),h=1===n.length?n[0].promise:n.length>1?Promise.all(n.map(t=>t.promise)):null;if(0!==i.length){var c=Ut();h?h.then(()=>{o(),d(),Wt()}):d()}else h.then(()=>l(e.map(r)))}else s(e.map(r));function l(t){o();try{s(t)}catch(e){16384&a.f||ct(e,a)}Wt()}function d(){Promise.all(i.map(t=>Gt(t))).then(t=>l([...e.map(r),...t])).catch(t=>ct(t,a)).finally(()=>c())}}function Wt(t=!0){ci(null),oi(null),K(null),t&&Mt?.deactivate()}function Ut(){var t=hi,e=t.b,i=Mt,s=e.is_rendered();return e.update_pending_count(1,i),i.increment(s,t),(r=!1)=>{e.update_pending_count(-1,i),i.decrement(s,t,r)}}function Ht(t){null!==hi&&(hi.f|=S);const i={ctx:J,deps:null,effects:null,equals:G,f:2050,fn:t,reactions:null,rv:0,v:e,wv:0,parent:hi,ac:null};return i}function Gt(t,i,s){let r=hi;null===r&&function(){throw new Error("https://svelte.dev/e/async_derived_orphan")}();var n=void 0,a=re(e);var o=!ni,h=new Map;return function(t){De(4718592,t)}(()=>{var e=hi;var i=v();n=i.promise;try{Promise.resolve(t()).then(i.resolve,i.reject).finally(Wt)}catch(d){i.reject(d),Wt()}var s=Mt;if(o){if(32768&e.f)var c=Ut();if(r.b.is_rendered())h.get(s)?.reject(D),h.delete(s);else{for(const t of h.values())t.reject(D);h.clear()}h.set(s,i)}const l=(t,i=void 0)=>{if(c&&c(i===D),!(i===D||16384&e.f)){if(s.activate(),i)a.f|=L,he(a,i);else{8388608&a.f&&(a.f^=L),he(a,t);for(const[t,e]of h){if(h.delete(t),t===s)break;e.reject(D)}0}s.deactivate()}};i.promise.then(l,t=>l(null,t||"unknown"))}),Oe(()=>{for(const t of h.values())t.reject(D)}),new Promise(t=>{!function e(i){function s(){i===n?t(a):e(n)}i.then(s,s)}(n)})}function jt(t){const e=Ht(t);return di(e),e}function Zt(t){const e=Ht(t);return e.equals=Z,e}function Jt(t){var e=t.effects;if(null!==e){t.effects=null;for(var i=0;i<e.length;i+=1)He(e[i])}}function Kt(t){var e,i=hi,s=t.parent;if(!si&&null!==s&&24576&s.f)return console.warn("https://svelte.dev/e/derived_inert"),t.v;ci(s);try{t.f&=-65537,Jt(t),e=Ti(t)}finally{ci(i)}return e}function Qt(t){var e=Kt(t);t.equals(e)||(t.wv=yi(),Mt?.is_fork&&null!==t.deps||(null!==Mt?Mt.capture(t,e,!0):t.v=e,null!==t.deps))?si||(null!==St?(ze()||Mt?.is_fork)&&St.set(t,e):ut(t)):dt(t,y)}function te(t){if(null!==t.effects)for(const e of t.effects)e.teardown&&Mi(e)}var ee=new Set,ie=new Map;var se=!1;function re(t,e){var i={f:0,v:t,reactions:null,equals:G,rv:0,wv:0};return i}function ne(t,e){const i=re(t);return di(i),i}function ae(t,e=!1,i=!0){const s=re(t);return e||(s.equals=Z),s}function oe(t,e,i=!1){null!==ni&&(!ai||131072&ni.f)&&4325394&ni.f&&(null===li||!n.call(li,t))&&function(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}();let s=i?ue(e):e;return he(t,s,Pt)}function he(t,e,i=null){if(!t.equals(e)){ie.set(t,si?e:t.v);var s=Dt.ensure();if(s.capture(t,e),2&t.f){const e=t;2048&t.f&&Kt(e),null===St&&ut(e)}t.wv=yi(),de(t,b,i),null!==hi&&1024&hi.f&&!(96&hi.f)&&(null===gi?function(t){gi=t}([t]):gi.push(t)),!s.is_fork&&ee.size>0&&!se&&ce()}return e}function ce(){se=!1;for(const t of ee)1024&t.f&&dt(t,x),bi(t)&&Mi(t);ee.clear()}function le(t){oe(t,t.v+1)}function de(t,e,i){var s=t.reactions;if(null!==s)for(var r=s.length,n=0;n<r;n++){var a=s[n],o=a.f;0;var h=0===(o&b);if(h&&dt(a,e),2&o){var c=a;St?.delete(c),65536&o||(512&o&&(a.f|=I),de(c,x,i))}else if(h){var l=a;16&o&&null!==Ot&&Ot.add(l),null!==i?i.push(l):Vt(l)}}}function ue(t){if("object"!=typeof t||null===t||P in t)return t;const i=m(t);if(i!==d&&i!==u)return t;var r=new Map,n=s(t),a=ne(0),o=vi,h=t=>{if(vi===o)return t();var e=ni,i=vi;oi(null),wi(o);var s=t();return oi(e),wi(i),s};n&&r.set("length",ne(t.length));return new Proxy(t,{defineProperty(t,e,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}();var s=r.get(e);return void 0===s?h(()=>{var t=ne(i.value);return r.set(e,t),t}):oe(s,i.value,!0),!0},deleteProperty(t,i){var s=r.get(i);if(void 0===s){if(i in t){const t=h(()=>ne(e));r.set(i,t),le(a)}}else oe(s,e),le(a);return!0},get(i,s,n){if(s===P)return t;var a=r.get(s),o=s in i;if(void 0!==a||o&&!c(i,s)?.writable||(a=h(()=>{var t=ne(ue(o?i[s]:e));return t}),r.set(s,a)),void 0!==a){var l=Ei(a);return l===e?void 0:l}return Reflect.get(i,s,n)},getOwnPropertyDescriptor(t,i){var s=Reflect.getOwnPropertyDescriptor(t,i);if(s&&"value"in s){var n=r.get(i);n&&(s.value=Ei(n))}else if(void 0===s){var a=r.get(i),o=a?.v;if(void 0!==a&&o!==e)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return s},has(t,i){if(i===P)return!0;var s=r.get(i),n=void 0!==s&&s.v!==e||Reflect.has(t,i);return!((void 0!==s||null!==hi&&(!n||c(t,i)?.writable))&&(void 0===s&&(s=h(()=>{var s=ne(n?ue(t[i]):e);return s}),r.set(i,s)),Ei(s)===e))&&n},set(t,i,s,o){var l=r.get(i),d=i in t;if(n&&"length"===i)for(var u=s;u<l.v;u+=1){var m=r.get(u+"");void 0!==m?oe(m,e):u in t&&(m=h(()=>ne(e)),r.set(u+"",m))}void 0===l?d&&!c(t,i)?.writable||(oe(l=h(()=>ne(void 0)),ue(s)),r.set(i,l)):(d=l.v!==e,oe(l,h(()=>ue(s))));var g=Reflect.getOwnPropertyDescriptor(t,i);if(g?.set&&g.set.call(o,s),!d){if(n&&"string"==typeof i){var p=r.get("length"),f=Number(i);Number.isInteger(f)&&f>=p.v&&oe(p,f+1)}le(a)}return!0},ownKeys(t){Ei(a);var i=Reflect.ownKeys(t).filter(t=>{var i=r.get(t);return void 0===i||i.v!==e});for(var[s,n]of r)n.v===e||s in t||i.push(s);return i},setPrototypeOf(){!function(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}()}})}function me(t){try{if(null!==t&&"object"==typeof t&&P in t)return t[P]}catch{}return t}function ge(t,e){return Object.is(me(t),me(e))}var pe,fe,ve,we;new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function ye(){if(void 0===pe){pe=window,document,fe=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,i=Text.prototype;ve=c(e,"firstChild").get,we=c(e,"nextSibling").get,g(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),g(i)&&(i.__t=void 0)}}function be(t=""){return document.createTextNode(t)}function xe(t){return ve.call(t)}function Te(t){return we.call(t)}function ke(t,e){if(!V)return xe(t);var i=xe(F);if(null===i)i=F.appendChild(be());else if(e&&3!==i.nodeType){var s=be();return i?.before(s),N(s),s}return e&&Ie(i),N(i),i}function _e(t,e=!1){if(!V){var i=xe(t);return i instanceof Comment&&""===i.data?Te(i):i}if(e){if(3!==F?.nodeType){var s=be();return F?.before(s),N(s),s}Ie(F)}return F}function Me(t,e=1,i=!1){let s=V?F:t;for(var r;e--;)r=s,s=Te(s);if(!V)return s;if(i){if(3!==s?.nodeType){var n=be();return null===s?r?.after(n):s.before(n),N(n),n}Ie(s)}return N(s),s}function Se(t){t.textContent=""}function Ee(t,e,i){let s=i?{is:i}:void 0;return document.createElementNS(e??"http://www.w3.org/1999/xhtml",t,s)}function Ie(t){if(t.nodeValue.length<65536)return;let e=t.nextSibling;for(;null!==e&&3===e.nodeType;)e.remove(),t.nodeValue+=e.nodeValue,e=t.nextSibling}function Ae(t,e){if(e){const e=document.body;t.autofocus=!0,at(()=>{document.activeElement===e&&t.focus()})}}var Le=!1;function Pe(t,e,i,s=!0){for(var r of(s&&i(),e))t.addEventListener(r,i);Oe(()=>{for(var s of e)t.removeEventListener(s,i)})}function $e(t){var e=ni,i=hi;oi(null),ci(null);try{return t()}finally{oi(e),ci(i)}}function Ce(t){null===hi&&(null===ni&&function(){throw new Error("https://svelte.dev/e/effect_orphan")}(),function(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}()),si&&function(){throw new Error("https://svelte.dev/e/effect_in_teardown")}()}function De(t,e){var i=hi;null!==i&&8192&i.f&&(t|=T);var s={ctx:J,deps:null,nodes:null,f:t|b|512,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};Mt?.register_created_effect(s);var r=s;if(4&t)null!==Lt?Lt.push(s):Dt.ensure().schedule(s);else if(null!==e){try{Mi(s)}catch(r){throw He(s),r}null!==r.deps||null!==r.teardown||null!==r.nodes||r.first!==r.last||524288&r.f||(r=r.first,16&t&&65536&t&&null!==r&&(r.f|=M))}if(null!==r&&(r.parent=i,null!==i&&function(t,e){var i=e.last;null===i?e.last=e.first=t:(i.next=t,t.prev=i,e.last=t)}(r,i),null!==ni&&2&ni.f&&!(64&t))){var n=ni;(n.effects??=[]).push(r)}return s}function ze(){return null!==ni&&!ai}function Oe(t){const e=De(8,null);return dt(e,y),e.teardown=t,e}function Re(t){Ce();var e=hi.f;if(ni||!(32&e)||32768&e)return Xe(t);var i=J;(i.e??=[]).push(t)}function Xe(t){return De(1048580,t)}function Fe(t){return De(4,t)}function Ve(t,e=0){return De(8|e,t)}function Ye(t,e=[],i=[],s=[]){qt(s,e,i,e=>{De(8,()=>t(...e.map(Ei)))})}function Ne(t,e=0){var i=De(16|e,t);return i}function Be(t,e=0){var i=De(16777216|e,t);return i}function qe(t){return De(524320,t)}function We(t){var e=t.teardown;if(null!==e){const t=si,i=ni;ri(!0),oi(null);try{e.call(null)}finally{ri(t),oi(i)}}}function Ue(t,e=!1){var i=t.first;for(t.first=t.last=null;null!==i;){const t=i.ac;null!==t&&$e(()=>{t.abort(D)});var s=i.next;64&i.f?i.parent=null:He(i,e),i=s}}function He(t,e=!0){var i=!1;(e||262144&t.f)&&null!==t.nodes&&null!==t.nodes.end&&(Ge(t.nodes.start,t.nodes.end),i=!0),dt(t,_),Ue(t,e&&!i),_i(t,0);var s=t.nodes&&t.nodes.t;if(null!==s)for(const n of s)n.stop();We(t),t.f^=_,t.f|=16384;var r=t.parent;null!==r&&null!==r.first&&je(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function Ge(t,e){for(;null!==t;){var i=t===e?null:Te(t);t.remove(),t=i}}function je(t){var e=t.parent,i=t.prev,s=t.next;null!==i&&(i.next=s),null!==s&&(s.prev=i),null!==e&&(e.first===t&&(e.first=s),e.last===t&&(e.last=i))}function Ze(t,e,i=!0){var s=[];Je(t,s,!0);var r=()=>{i&&He(t),e&&e()},n=s.length;if(n>0){var a=()=>--n||r();for(var o of s)o.out(a)}else r()}function Je(t,e,i){if(!(8192&t.f)){t.f^=T;var s=t.nodes&&t.nodes.t;if(null!==s)for(const t of s)(t.is_global||i)&&e.push(t);for(var r=t.first;null!==r;){var n=r.next;if(!(64&r.f))Je(r,e,!!(!!(65536&r.f)||!!(32&r.f)&&!!(16&t.f))&&i);r=n}}}function Ke(t){Qe(t,!0)}function Qe(t,e){if(8192&t.f){t.f^=T,1024&t.f||(dt(t,b),Dt.ensure().schedule(t));for(var i=t.first;null!==i;){var s=i.next;Qe(i,!!(!!(65536&i.f)||!!(32&i.f))&&e),i=s}var r=t.nodes&&t.nodes.t;if(null!==r)for(const t of r)(t.is_global||e)&&t.in()}}function ti(t,e){if(t.nodes)for(var i=t.nodes.start,s=t.nodes.end;null!==i;){var r=i===s?null:Te(i);e.append(i),i=r}}var ei=null,ii=!1,si=!1;function ri(t){si=t}var ni=null,ai=!1;function oi(t){ni=t}var hi=null;function ci(t){hi=t}var li=null;function di(t){null!==ni&&(null===li?li=[t]:li.push(t))}var ui=null,mi=0,gi=null;var pi=1,fi=0,vi=fi;function wi(t){vi=t}function yi(){return++pi}function bi(t){var e=t.f;if(2048&e)return!0;if(2&e&&(t.f&=-65537),4096&e){for(var i=t.deps,s=i.length,r=0;r<s;r++){var n=i[r];if(bi(n)&&Qt(n),n.wv>t.wv)return!0}512&e&&null===St&&dt(t,y)}return!1}function xi(t,e,i=!0){var s=t.reactions;if(null!==s&&(null===li||!n.call(li,t)))for(var r=0;r<s.length;r++){var a=s[r];2&a.f?xi(a,e,!1):e===a&&(i?dt(a,b):1024&a.f&&dt(a,x),Vt(a))}}function Ti(t){var e=ui,i=mi,s=gi,r=ni,n=li,a=J,o=ai,h=vi,c=t.f;ui=null,mi=0,gi=null,ni=96&c?null:t,li=null,K(t.ctx),ai=!1,vi=++fi,null!==t.ac&&($e(()=>{t.ac.abort(D)}),t.ac=null);try{t.f|=A;var l=(0,t.fn)();t.f|=k;var d=t.deps,u=Mt?.is_fork;if(null!==ui){var m;if(u||_i(t,mi),null!==d&&mi>0)for(d.length=mi+ui.length,m=0;m<ui.length;m++)d[mi+m]=ui[m];else t.deps=d=ui;if(ze()&&512&t.f)for(m=mi;m<d.length;m++)(d[m].reactions??=[]).push(t)}else!u&&null!==d&&mi<d.length&&(_i(t,mi),d.length=mi);if(!(null===gi||ai||null===d||6146&t.f))for(m=0;m<gi.length;m++)xi(gi[m],t);if(null!==r&&r!==t){if(fi++,null!==r.deps)for(let t=0;t<i;t+=1)r.deps[t].rv=fi;if(null!==e)for(const t of e)t.rv=fi;null!==gi&&(null===s?s=gi:s.push(...gi))}return 8388608&t.f&&(t.f^=L),l}catch(g){return ht(g)}finally{t.f^=A,ui=e,mi=i,gi=s,ni=r,li=n,K(a),ai=o,vi=h}}function ki(t,i){let s=i.reactions;if(null!==s){var a=r.call(s,t);if(-1!==a){var o=s.length-1;0===o?s=i.reactions=null:(s[a]=s[o],s.pop())}}if(null===s&&2&i.f&&(null===ui||!n.call(ui,i))){var h=i;512&h.f&&(h.f^=512,h.f&=-65537),h.v!==e&&ut(h),function(t){if(null!==t.effects)for(const e of t.effects)(e.teardown||e.ac)&&(e.teardown?.(),e.ac?.abort(D),e.teardown=f,e.ac=null,_i(e,0),Ue(e))}(h),_i(h,0)}}function _i(t,e){var i=t.deps;if(null!==i)for(var s=e;s<i.length;s++)ki(t,i[s])}function Mi(t){var e=t.f;if(!(16384&e)){dt(t,y);var i=hi,s=ii;hi=t,ii=!0;try{16777232&e?function(t){for(var e=t.first;null!==e;){var i=e.next;32&e.f||He(e),e=i}}(t):Ue(t),We(t);var r=Ti(t);t.teardown="function"==typeof r?r:null,t.wv=pi}finally{ii=s,hi=i}}}async function Si(){await Promise.resolve(),zt()}function Ei(t){var e=!!(2&t.f);if(ei?.add(t),null!==ni&&!ai&&!(null!==hi&&16384&hi.f||null!==li&&n.call(li,t))){var i=ni.deps;if(2097152&ni.f)t.rv<fi&&(t.rv=fi,null===ui&&null!==i&&i[mi]===t?mi++:null===ui?ui=[t]:ui.push(t));else{(ni.deps??=[]).push(t);var s=t.reactions;null===s?t.reactions=[ni]:n.call(s,ni)||s.push(ni)}}if(si&&ie.has(t))return ie.get(t);if(e){var r=t;if(si){var a=r.v;return(1024&r.f||null===r.reactions)&&!Ai(r)||(a=Kt(r)),ie.set(r,a),a}var o=!(512&r.f)&&!ai&&null!==ni&&(ii||!!(512&ni.f)),h=0===(r.f&k);bi(r)&&(o&&(r.f|=512),Qt(r)),o&&!h&&(te(r),Ii(r))}if(St?.has(t))return St.get(t);if(8388608&t.f)throw t.v;return t.v}function Ii(t){if(t.f|=512,null!==t.deps)for(const e of t.deps)(e.reactions??=[]).push(t),2&e.f&&!(512&e.f)&&(te(e),Ii(e))}function Ai(t){if(t.v===e)return!0;if(null===t.deps)return!1;for(const e of t.deps){if(ie.has(e))return!0;if(2&e.f&&Ai(e))return!0}return!1}function Li(t){var e=ai;try{return ai=!0,t()}finally{ai=e}}function Pi(t,e=new Set){if(!("object"!=typeof t||null===t||t instanceof EventTarget||e.has(t))){e.add(t),t instanceof Date&&t.getTime();for(let r in t)try{Pi(t[r],e)}catch(i){}const s=m(t);if(s!==Object.prototype&&s!==Array.prototype&&s!==Map.prototype&&s!==Set.prototype&&s!==Date.prototype){const e=l(s);for(let s in e){const r=e[s].get;if(r)try{r.call(t)}catch(i){}}}}}var $i=Symbol("events"),Ci=new Set,Di=new Set;function zi(t,e,i,s={}){function r(t){if(s.capture||Fi.call(e,t),!t.cancelBubble)return $e(()=>i?.call(this,t))}return t.startsWith("pointer")||t.startsWith("touch")||"wheel"===t?at(()=>{e.addEventListener(t,r,s)}):e.addEventListener(t,r,s),r}function Oi(t,e,i,s,r){var n={capture:s,passive:r},a=zi(t,e,i,n);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Oe(()=>{e.removeEventListener(t,a,n)})}function Ri(t,e,i){(e[$i]??={})[t]=i}function Xi(t){for(var e=0;e<t.length;e++)Ci.add(t[e]);for(var i of Di)i(t)}function Fi(t){var e=this,i=e.ownerDocument,s=t.type,r=t.composedPath?.()||[],n=r[0]||t.target,a=0,o=t===t&&t[$i];if(o){var c=r.indexOf(o);if(-1!==c&&(e===document||e===window))return void(t[$i]=e);var l=r.indexOf(e);if(-1===l)return;c<=l&&(a=c)}if((n=r[a]||t.target)!==e){h(t,"currentTarget",{configurable:!0,get:()=>n||i});var d=ni,u=hi;oi(null),ci(null);try{for(var m,g=[];null!==n;){var p=n.assignedSlot||n.parentNode||n.host||null;try{var f=n[$i]?.[s];null==f||n.disabled&&t.target!==n||f.call(n,t)}catch(v){m?g.push(v):m=v}if(t.cancelBubble||p===e||null===p)break;n=p}if(m){for(let t of g)queueMicrotask(()=>{throw t});throw m}}finally{t[$i]=e,delete t.currentTarget,oi(d),ci(u)}}}var Vi=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function Yi(t){var e=Ee("template");return e.innerHTML=function(t){return Vi?.createHTML(t)??t}(t.replaceAll("<!>","\x3c!----\x3e")),e.content}function Ni(t,e){var i=hi;null===i.nodes&&(i.nodes={start:t,end:e,a:null,t:null})}function Bi(t,e){var i,s=!!(1&e),r=!!(2&e),n=!t.startsWith("<!>");return()=>{if(V)return Ni(F,null),F;void 0===i&&(i=Yi(n?t:"<!>"+t),s||(i=xe(i)));var e=r||fe?document.importNode(i,!0):i.cloneNode(!0);s?Ni(xe(e),e.lastChild):Ni(e,e);return e}}function qi(t,e,i="svg"){var s,r=!t.startsWith("<!>"),n=!!(1&e),a=`<${i}>${r?t:"<!>"+t}</${i}>`;return()=>{if(V)return Ni(F,null),F;if(!s){var t=xe(Yi(a));if(n)for(s=document.createDocumentFragment();xe(t);)s.appendChild(xe(t));else s=xe(t)}var e=s.cloneNode(!0);n?Ni(xe(e),e.lastChild):Ni(e,e);return e}}function Wi(t,e){return qi(t,e,"svg")}function Ui(t=""){if(!V){var e=be(t+"");return Ni(e,e),e}var i=F;return 3!==i.nodeType?(i.before(i=be()),N(i)):Ie(i),Ni(i,i),i}function Hi(){if(V)return Ni(F,null),F;var t=document.createDocumentFragment(),e=document.createComment(""),i=be();return t.append(e,i),Ni(e,i),t}function Gi(t,e){if(V){var i=hi;return 32768&i.f&&null!==i.nodes.end||(i.nodes.end=F),void B()}null!==t&&t.before(e)}function ji(t){return t.endsWith("capture")&&"gotpointercapture"!==t&&"lostpointercapture"!==t}var Zi=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Ji(t){return Zi.includes(t)}var Ki={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function Qi(t){return t=t.toLowerCase(),Ki[t]??t}var ts=["touchstart","touchmove"];function es(t){return ts.includes(t)}var is=["textarea","script","style","title"];var ss=!0;function rs(t){ss=t}function ns(t,e){var i=null==e?"":"object"==typeof e?`${e}`:e;i!==(t.__t??=t.nodeValue)&&(t.__t=i,t.nodeValue=`${i}`)}function as(t,e){return cs(t,e)}function os(e,i){ye(),i.intro=i.intro??!1;const s=i.target,r=V,n=F;try{for(var a=xe(s);a&&(8!==a.nodeType||"["!==a.data);)a=Te(a);if(!a)throw t;Y(!0),N(a);const r=cs(e,{...i,anchor:a});return Y(!1),r}catch(o){if(o instanceof Error&&o.message.split("\n").some(t=>t.startsWith("https://svelte.dev/e/")))throw o;return o!==t&&console.warn("Failed to hydrate: ",o),!1===i.recover&&function(){throw new Error("https://svelte.dev/e/hydration_failed")}(),ye(),Se(s),Y(!1),as(e,i)}finally{Y(r),N(n)}}var hs=new Map;function cs(e,{target:i,anchor:s,props:r={},events:n,context:o,intro:h=!0,transformError:c}){ye();var l=void 0,d=function(t){Dt.ensure();const e=De(524352,t);return(t={})=>new Promise(i=>{t.outro?Ze(e,()=>{He(e),i(void 0)}):(He(e),i(void 0))})}(()=>{var d=s??i.appendChild(be());!function(t,e,i,s){new Bt(t,e,i,s)}(d,{pending:()=>{}},i=>{if(et({}),o&&(J.c=o),n&&(r.$$events=n),V&&Ni(i,null),ss=h,l=e(i,r)||{},ss=!0,V&&(hi.nodes.end=F,null===F||8!==F.nodeType||"]"!==F.data))throw X(),t;it()},c);var u=new Set,m=t=>{for(var e=0;e<t.length;e++){var s=t[e];if(!u.has(s)){u.add(s);var r=es(s);for(const t of[i,document]){var n=hs.get(t);void 0===n&&(n=new Map,hs.set(t,n));var a=n.get(s);void 0===a?(t.addEventListener(s,Fi,{passive:r}),n.set(s,1)):n.set(s,a+1)}}}};return m(a(Ci)),Di.add(m),()=>{for(var t of u)for(const s of[i,document]){var e=hs.get(s),r=e.get(t);0==--r?(s.removeEventListener(t,Fi),e.delete(t),0===e.size&&hs.delete(s)):e.set(t,r)}Di.delete(m),d!==s&&d.parentNode?.removeChild(d)}});return ls.set(l,d),l}var ls=new WeakMap;function ds(t,e){const i=ls.get(t);return i?(ls.delete(t),i(e)):Promise.resolve()}var us,ms=class{anchor;#N=new Map;#B=new Map;#q=new Map;#W=new Set;#U=!0;constructor(t,e=!0){this.anchor=t,this.#U=e}#y=t=>{if(this.#N.has(t)){var e=this.#N.get(t),i=this.#B.get(e);if(i)Ke(i),this.#W.delete(e);else{var s=this.#q.get(e);s&&(this.#B.set(e,s.effect),this.#q.delete(e),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),i=s.effect)}for(const[e,i]of this.#N){if(this.#N.delete(e),e===t)break;const s=this.#q.get(i);s&&(He(s.effect),this.#q.delete(i))}for(const[t,s]of this.#B){if(t===e||this.#W.has(t))continue;const r=()=>{if(Array.from(this.#N.values()).includes(t)){var e=document.createDocumentFragment();ti(s,e),e.append(be()),this.#q.set(t,{effect:s,fragment:e})}else He(s);this.#W.delete(t),this.#B.delete(t)};this.#U||!i?(this.#W.add(t),Ze(s,r,!1)):r()}}};#H=t=>{this.#N.delete(t);const e=Array.from(this.#N.values());for(const[i,s]of this.#q)e.includes(i)||(He(s.effect),this.#q.delete(i))};ensure(t,e){var i=Mt;!e||this.#B.has(t)||this.#q.has(t)||this.#B.set(t,qe(()=>e(this.anchor)));this.#N.set(i,t),V&&(this.anchor=F),this.#y(i)}};function gs(t,e,...i){var s=new ms(t);Ne(()=>{const t=e()??null;s.ensure(t,t&&(e=>t(e,...i)))},M)}function ps(t){null===J&&O(),Re(()=>{const e=Li(t);if("function"==typeof e)return e})}function fs(t){null===J&&O(),ps(()=>()=>Li(t))}function vs(t,e,i=!1){var s;V&&(s=F,B());var r=new ms(t);function n(t,e){if(V){var i=H(s);if(t!==parseInt(i.substring(1))){var n=U();return N(n),r.anchor=n,Y(!1),r.ensure(t,e),void Y(!0)}}r.ensure(t,e)}Ne(()=>{var t=!1;e((e,i=0)=>{t=!0,n(i,e)}),t||n(-1,null)},i?M:0)}function ws(t,e){return e}function ys(t,e,i=!0){var s;if(t.pending.size>0){s=new Set;for(const e of t.pending.values())for(const i of e)s.add(t.items.get(i).e)}for(var r=0;r<e.length;r++){var n=e[r];s?.has(n)?(n.f|=E,ti(n,document.createDocumentFragment())):He(e[r],i)}}function bs(t,e,i,r,n,o=null){var h=t,c=new Map;if(4&e){var l=t;h=V?N(xe(l)):l.appendChild(be())}V&&B();var d,u=null,m=Zt(()=>{var t=i();return s(t)?t:null==t?[]:a(t)});var g=new Map,p=!0;function f(t){16384&v.effect.f||(v.pending.delete(t),v.fallback=u,function(t,e,i,s,r){var n,o,h,c,l,d=!!(8&s),u=e.length,m=t.items,g=xs(t.effect.first),p=null,f=[],v=[];if(d)for(l=0;l<u;l+=1)h=r(e[l],l),33554432&(c=m.get(h).e).f||(c.nodes?.a?.measure(),(o??=new Set).add(c));for(l=0;l<u;l+=1){if(h=r(e[l],l),c=m.get(h).e,null!==t.outrogroups)for(const e of t.outrogroups)e.pending.delete(c),e.done.delete(c);if(8192&c.f&&(Ke(c),d&&(c.nodes?.a?.unfix(),(o??=new Set).delete(c))),33554432&c.f){if(c.f^=E,c!==g){var w=p?p.next:g;c===t.effect.last&&(t.effect.last=c.prev),c.prev&&(c.prev.next=c.next),c.next&&(c.next.prev=c.prev),_s(t,p,c),_s(t,c,w),ks(c,w,i),f=[],v=[],g=xs((p=c).next);continue}ks(c,null,i)}if(c!==g){if(void 0!==n&&n.has(c)){if(f.length<v.length){var y,b=v[0];p=b.prev;var x=f[0],T=f[f.length-1];for(y=0;y<f.length;y+=1)ks(f[y],b,i);for(y=0;y<v.length;y+=1)n.delete(v[y]);_s(t,x.prev,T.next),_s(t,p,x),_s(t,T,b),g=b,p=T,l-=1,f=[],v=[]}else n.delete(c),ks(c,g,i),_s(t,c.prev,c.next),_s(t,c,null===p?t.effect.first:p.next),_s(t,p,c),p=c;continue}for(f=[],v=[];null!==g&&g!==c;)(n??=new Set).add(g),v.push(g),g=xs(g.next);if(null===g)continue}33554432&c.f||f.push(c),p=c,g=xs(c.next)}if(null!==t.outrogroups){for(const e of t.outrogroups)0===e.pending.size&&(ys(t,a(e.done)),t.outrogroups?.delete(e));0===t.outrogroups.size&&(t.outrogroups=null)}if(null!==g||void 0!==n){var k=[];if(void 0!==n)for(c of n)8192&c.f||k.push(c);for(;null!==g;)8192&g.f||g===t.fallback||k.push(g),g=xs(g.next);var _=k.length;if(_>0){var M=4&s&&0===u?i:null;if(d){for(l=0;l<_;l+=1)k[l].nodes?.a?.measure();for(l=0;l<_;l+=1)k[l].nodes?.a?.fix()}!function(t,e,i){for(var s,r=e.length,n=e.length,o=0;o<r;o++){let i=e[o];Ze(i,()=>{if(s){if(s.pending.delete(i),s.done.add(i),0===s.pending.size){var e=t.outrogroups;ys(t,a(s.done)),e.delete(s),0===e.size&&(t.outrogroups=null)}}else n-=1},!1)}if(0===n){var h=null!==i;if(h){var c=i,l=c.parentNode;Se(l),l.append(c),t.items.clear()}ys(t,e,!h)}else s={pending:new Set(e),done:new Set},(t.outrogroups??=new Set).add(s)}(t,k,M)}}d&&at(()=>{if(void 0!==o)for(c of o)c.nodes?.a?.apply()})}(v,d,h,e,r),null!==u&&(0===d.length?33554432&u.f?(u.f^=E,ks(u,null,h)):Ke(u):Ze(u,()=>{u=null})))}var v={effect:Ne(()=>{var t=(d=Ei(m)).length;let s=!1;V&&"[!"===H(h)!=(0===t)&&(N(h=U()),Y(!1),s=!0);for(var a=new Set,l=Mt,v=0;v<t;v+=1){V&&8===F.nodeType&&"]"===F.data&&(h=F,s=!0,Y(!1));var w=d[v],y=r(w,v),b=p?null:c.get(y);b?(b.v&&he(b.v,w),b.i&&he(b.i,v)):(b=Ts(c,p?h:us??=be(),w,y,v,n,e,i),p||(b.e.f|=E),c.set(y,b)),a.add(y)}0===t&&o&&!u&&(p?u=qe(()=>o(h)):(u=qe(()=>o(us??=be()))).f|=E),t>a.size&&R(),V&&t>0&&N(U()),p||(g.set(l,a),f(l)),s&&Y(!0),Ei(m)}),flags:e,items:c,pending:g,outrogroups:null,fallback:u};p=!1,V&&(h=F)}function xs(t){for(;null!==t&&!(32&t.f);)t=t.next;return t}function Ts(t,e,i,s,r,n,a,o){var h=1&a?16&a?re(i):ae(i,!1,!1):null,c=2&a?re(r):null;return{v:h,i:c,e:qe(()=>(n(e,h??i,c??r,o),()=>{t.delete(s)}))}}function ks(t,e,i){if(t.nodes)for(var s=t.nodes.start,r=t.nodes.end,n=!e||33554432&e.f?i:e.nodes.start;null!==s;){var a=Te(s);if(n.before(s),s===r)return;s=a}}function _s(t,e,i){null===e?t.effect.first=i:e.next=i,null===i?t.effect.last=e:i.prev=e}function Ms(e,s,r=!1,n=!1,a=!1,o=!1){var h=e,c="";if(r){var l=e;V&&(h=N(xe(l)))}Ye(()=>{var e=hi;if(c!==(c=s()??"")){if(r&&!V)return e.nodes=null,l.innerHTML=c,void(""!==c&&Ni(xe(l),l.lastChild));if(null!==e.nodes&&(Ge(e.nodes.start,e.nodes.end),e.nodes=null),""!==c){if(V){F.data;for(var o=B(),d=o;null!==o&&(8!==o.nodeType||""!==o.data);)d=o,o=Te(o);if(null===o)throw X(),t;return Ni(F,d),void(h=N(o))}var u=Ee(n?"svg":a?"math":"template",n?i:a?"http://www.w3.org/1998/Math/MathML":void 0);u.innerHTML=c;var m=n||a?u:u.content;if(Ni(xe(m),m.lastChild),n||a)for(;xe(m);)h.before(xe(m));else h.before(m)}}else V&&B()})}var Ss=()=>performance.now(),Es={tick:t=>requestAnimationFrame(t),now:()=>Ss(),tasks:new Set};function Is(){const t=Es.now();Es.tasks.forEach(e=>{e.c(t)||(Es.tasks.delete(e),e.f())}),0!==Es.tasks.size&&Es.tick(Is)}function As(t,e){$e(()=>{t.dispatchEvent(new CustomEvent(e))})}function Ls(t){if("float"===t)return"cssFloat";if("offset"===t)return"cssOffset";if(t.startsWith("--"))return t;const e=t.split("-");return 1===e.length?e[0]:e[0]+e.slice(1).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function Ps(t){const e={},i=t.split(";");for(const s of i){const[t,i]=s.split(":");if(!t||void 0===i)break;e[Ls(t.trim())]=i.trim()}return e}var $s=t=>t;function Cs(t){0}function Ds(t,e,i,s){var r,n,a,o=!!(1&t),h=!!(2&t),c=!!(4&t),l=o&&h?"both":o?"in":"out",d=e.inert,u=e.style.overflow;function m(){return $e(()=>r??=i()(e,s?.()??{},{direction:l}))}var g={is_global:c,in(){if(e.inert=d,!o)return a?.abort(),void a?.reset?.();h||n?.abort(),n=zs(e,m(),a,1,()=>{As(e,"introend"),n?.abort(),n=r=void 0,e.style.overflow=u})},out(t){if(!h)return t?.(),void(r=void 0);e.inert=!0,a=zs(e,m(),n,0,()=>{As(e,"outroend"),t?.()})},stop:()=>{n?.abort(),a?.abort()}},p=hi;if((p.nodes.t??=[]).push(g),o&&ss){var f=c;if(!f){for(var v=p.parent;v&&65536&v.f;)for(;(v=v.parent)&&!(16&v.f););f=!v||!!(32768&v.f)}f&&Fe(()=>{Li(()=>g.in())})}}function zs(t,e,i,s,r){var n=1===s;if(p(e)){var a,o=!1;return at(()=>{o||(a=zs(t,e({direction:n?"in":"out"}),i,s,r))}),{abort:()=>{o=!0,a?.abort()},deactivate:()=>a.deactivate(),reset:()=>a.reset(),t:()=>a.t()}}if(i?.deactivate(),!e?.duration&&!e?.delay)return As(t,n?"introstart":"outrostart"),r(),{abort:f,deactivate:f,reset:f,t:()=>s};const{delay:h=0,css:c,tick:l,easing:d=$s}=e;var u=[];if(n&&void 0===i&&(l&&l(0,1),c)){var m=Ps(c(0,1));u.push(m,m)}var g=()=>1-s,v=t.animate(u,{duration:h,fill:"forwards"});return v.onfinish=()=>{v.cancel(),As(t,n?"introstart":"outrostart");var a=i?.t()??1-s;i?.abort();var o=s-a,h=e.duration*Math.abs(o),u=[];if(h>0){var m=!1;if(c)for(var p=Math.ceil(h/(1e3/60)),f=0;f<=p;f+=1){var w=a+o*d(f/p),y=Ps(c(w,1-w));u.push(y),m||="hidden"===y.overflow}m&&(t.style.overflow="hidden"),g=()=>{var t=v.currentTime;return a+o*d(t/h)},l&&function(t){let e;0===Es.tasks.size&&Es.tick(Is),new Promise(i=>{Es.tasks.add(e={c:t,f:i})})}(()=>{if("running"!==v.playState)return!1;var t=g();return l(t,1-t),!0})}(v=t.animate(u,{duration:h,fill:"forwards"})).onfinish=()=>{g=()=>s,l?.(s,1-s),r()}},{abort:()=>{v&&(v.cancel(),v.effect=null,v.onfinish=f)},deactivate:()=>{r=f},reset:()=>{0===s&&l?.(1,0)},t:()=>g()}}function Os(t,e,s,r,n,a){let o=V;V&&B();var h=null;V&&1===F.nodeType&&(h=F,B());var c=V?F:t,l=hi,d=new ms(c,!1);Ne(()=>{const t=e()||null;var a=n?n():s||"svg"===t?i:void 0;return null===t?(d.ensure(null,null),void rs(!0)):(d.ensure(t,e=>{if(t){if(Ni(h=V?h:Ee(t,a),h),r){V&&(s=t,is.includes(s))&&h.append(document.createComment(""));var i=V?xe(h):h.appendChild(be());V&&(null===i?Y(!1):N(i)),Cs(l),r(h,i),Cs(null)}hi.nodes.end=h,e.before(h)}var s;V&&N(e)}),rs(!0),()=>{t&&rs(!1)})},M),Oe(()=>{rs(!0)}),o&&(Y(!0),N(c))}function Rs(t,e,i){Fe(()=>{var s=Li(()=>e(t,i?.())||{});if(i&&s?.update){var r=!1,n={};Ve(()=>{var t=i();!function(t){if("object"==typeof t&&t&&!(t instanceof EventTarget))if(P in t)Pi(t);else if(!Array.isArray(t))for(let e in t){const i=t[e];"object"==typeof i&&i&&P in i&&Pi(i)}}(t),r&&j(n,t)&&(n=t,s.update(t))}),r=!0}if(s?.destroy)return()=>s.destroy()})}function Xs(t,e){var i,s=void 0;Be(()=>{s!==(s=e())&&(i&&(He(i),i=null),s&&(i=qe(()=>{Fe(()=>s(t))})))})}function Fs(t){var e,i,s="";if("string"==typeof t||"number"==typeof t)s+=t;else if("object"==typeof t)if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(i=Fs(t[e]))&&(s&&(s+=" "),s+=i)}else for(i in t)t[i]&&(s&&(s+=" "),s+=i);return s}function Vs(t){return"object"==typeof t?function(){for(var t,e,i=0,s="",r=arguments.length;i<r;i++)(t=arguments[i])&&(e=Fs(t))&&(s&&(s+=" "),s+=e);return s}(t):t??""}var Ys=[..." \t\n\r\f \v\ufeff"];function Ns(t,e=!1){var i=e?" !important;":";",s="";for(var r of Object.keys(t)){var n=t[r];null!=n&&""!==n&&(s+=" "+r+": "+n+i)}return s}function Bs(t){return"-"!==t[0]||"-"!==t[1]?t.toLowerCase():t}function qs(t,e,i,s,r,n){var a=t.__className;if(V||a!==i||void 0===a){var o=function(t,e,i){var s=null==t?"":""+t;if(e&&(s=s?s+" "+e:e),i)for(var r of Object.keys(i))if(i[r])s=s?s+" "+r:r;else if(s.length)for(var n=r.length,a=0;(a=s.indexOf(r,a))>=0;){var o=a+n;0!==a&&!Ys.includes(s[a-1])||o!==s.length&&!Ys.includes(s[o])?a=o:s=(0===a?"":s.substring(0,a))+s.substring(o+1)}return""===s?null:s}(i,s,n);V&&o===t.getAttribute("class")||(null==o?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t.__className=i}else if(n&&r!==n)for(var h in n){var c=!!n[h];null!=r&&c===!!r[h]||t.classList.toggle(h,c)}return n}function Ws(t,e={},i,s){for(var r in i){var n=i[r];e[r]!==n&&(null==i[r]?t.style.removeProperty(r):t.style.setProperty(r,n,s))}}function Us(t,e,i,s){var r=t.__style;if(V||r!==e){var n=function(t,e){if(e){var i,s,r="";if(Array.isArray(e)?(i=e[0],s=e[1]):i=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var n=!1,a=0,o=!1,h=[];i&&h.push(...Object.keys(i).map(Bs)),s&&h.push(...Object.keys(s).map(Bs));var c=0,l=-1;const e=t.length;for(var d=0;d<e;d++){var u=t[d];if(o?"/"===u&&"*"===t[d-1]&&(o=!1):n?n===u&&(n=!1):"/"===u&&"*"===t[d+1]?o=!0:'"'===u||"'"===u?n=u:"("===u?a++:")"===u&&a--,!o&&!1===n&&0===a)if(":"===u&&-1===l)l=d;else if(";"===u||d===e-1){if(-1!==l){var m=Bs(t.substring(c,l).trim());h.includes(m)||(";"!==u&&d++,r+=" "+t.substring(c,d).trim()+";")}c=d+1,l=-1}}}return i&&(r+=Ns(i)),s&&(r+=Ns(s,!0)),""===(r=r.trim())?null:r}return null==t?null:String(t)}(e,s);V&&n===t.getAttribute("style")||(null==n?t.removeAttribute("style"):t.style.cssText=n),t.__style=e}else s&&(Array.isArray(s)?(Ws(t,i?.[0],s[0]),Ws(t,i?.[1],s[1],"important")):Ws(t,i,s));return s}function Hs(t,e,i=!1){if(t.multiple){if(null==e)return;if(!s(e))return void console.warn("https://svelte.dev/e/select_multiple_invalid_value");for(var r of t.options)r.selected=e.includes(Gs(r))}else{for(r of t.options)if(ge(Gs(r),e))return void(r.selected=!0);i&&void 0===e||(t.selectedIndex=-1)}}function Gs(t){return"__value"in t?t.__value:t.value}var js=Symbol("class"),Zs=Symbol("style"),Js=Symbol("is custom element"),Ks=Symbol("is html"),Qs=z?"link":"LINK",tr=z?"input":"INPUT",er=z?"option":"OPTION",ir=z?"select":"SELECT",sr=z?"progress":"PROGRESS";function rr(t){if(V){var e=!1,i=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var i=t.value;ar(t,"value",null),t.value=i}if(t.hasAttribute("checked")){var s=t.checked;ar(t,"checked",null),t.checked=s}}};t.__on_r=i,at(i),Le||(Le=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{if(!t.defaultPrevented)for(const e of t.target.elements)e.__on_r?.()})},{capture:!0}))}}function nr(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function ar(t,e,i,s){var r=cr(t);V&&(r[e]=t.getAttribute(e),"src"===e||"srcset"===e||"href"===e&&t.nodeName===Qs)||r[e]!==(r[e]=i)&&("loading"===e&&(t[C]=i),null==i?t.removeAttribute(e):"string"!=typeof i&&dr(t).includes(e)?t[e]=i:t.setAttribute(e,i))}function or(t,e,i){var s=ni,r=hi;let n=V;V&&Y(!1),oi(null),ci(null);try{"style"!==e&&(lr.has(t.getAttribute("is")||t.nodeName)||!customElements||customElements.get(t.getAttribute("is")||t.nodeName.toLowerCase())?dr(t).includes(e):i&&"object"==typeof i)?t[e]=i:ar(t,e,null==i?i:String(i))}finally{oi(s),ci(r),n&&Y(!0)}}function hr(t,i,s=[],r=[],n=[],a,o=!1,h=!1){qt(n,s,r,s=>{var r=void 0,n={},c=t.nodeName===ir,l=!1;if(Be(()=>{var d=i(...s.map(Ei)),u=function(t,i,s,r,n=!1){if(V&&n&&t.nodeName===tr){var a=t;("checkbox"===a.type?"defaultChecked":"defaultValue")in s||rr(a)}var o=cr(t),h=o[Js],c=!o[Ks];let l=V&&h;l&&Y(!1);var d=i||{},u=t.nodeName===er;for(var m in i)m in s||(s[m]=null);s.class?s.class=Vs(s.class):(r||s[js])&&(s.class=null),s[Zs]&&(s.style??=null);var g=dr(t);for(const x in s){let T=s[x];if(u&&"value"===x&&null==T)t.value=t.__value="",d[x]=T;else if("class"!==x)if("style"!==x){var p=d[x];if(T!==p||void 0===T&&t.hasAttribute(x)){d[x]=T;var f=x[0]+x[1];if("$$"!==f)if("on"===f){const k={},_="$$"+x;let M=x.slice(2);var v=Ji(M);if(ji(M)&&(M=M.slice(0,-7),k.capture=!0),!v&&p){if(null!=T)continue;t.removeEventListener(M,d[_],k),d[_]=null}if(v)Ri(M,t,T),Xi([M]);else if(null!=T){function w(t){d[x].call(this,t)}d[_]=zi(M,t,w,k)}}else if("style"===x)ar(t,x,T);else if("autofocus"===x)Ae(t,Boolean(T));else if(h||"__value"!==x&&("value"!==x||null==T))if("selected"===x&&u)nr(t,T);else{var y=x;c||(y=Qi(y));var b="defaultValue"===y||"defaultChecked"===y;if(null!=T||h||b)b||g.includes(y)&&(h||"string"!=typeof T)?(t[y]=T,y in o&&(o[y]=e)):"function"!=typeof T&&ar(t,y,T);else if(o[x]=null,"value"===y||"checked"===y){let S=t;const E=void 0===i;if("value"===y){let I=S.defaultValue;S.removeAttribute(y),S.defaultValue=I,S.value=S.__value=E?I:null}else{let A=S.defaultChecked;S.removeAttribute(y),S.defaultChecked=A,S.checked=!!E&&A}}else t.removeAttribute(x)}else t.value=t.__value=T}}else Us(t,T,i?.[Zs],s[Zs]),d[x]=T,d[Zs]=s[Zs];else qs(t,"http://www.w3.org/1999/xhtml"===t.namespaceURI,T,r,i?.[js],s[js]),d[x]=T,d[js]=s[js]}return l&&Y(!0),d}(t,r,d,a,o,h);l&&c&&"value"in d&&Hs(t,d.value);for(let t of Object.getOwnPropertySymbols(n))d[t]||He(n[t]);for(let e of Object.getOwnPropertySymbols(d)){var m=d[e];"@attach"!==e.description||r&&m===r[e]||(n[e]&&He(n[e]),n[e]=qe(()=>Xs(t,()=>m))),u[e]=m}r=u}),c){var d=t;Fe(()=>{Hs(d,r.value,!0),function(t){var e=new MutationObserver(()=>{Hs(t,t.__value)});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Oe(()=>{e.disconnect()})}(d)})}l=!0})}function cr(t){return t.__attributes??={[Js]:t.nodeName.includes("-"),[Ks]:"http://www.w3.org/1999/xhtml"===t.namespaceURI}}var lr=new Map;function dr(t){var e,i=t.getAttribute("is")||t.nodeName,s=lr.get(i);if(s)return s;lr.set(i,s=[]);for(var r=t,n=Element.prototype;n!==r;){for(var a in e=l(r))e[a].set&&s.push(a);r=m(r)}return s}function ur(t,e,i=e){var s,r,n=()=>{cancelAnimationFrame(s),t.paused||(s=requestAnimationFrame(n));var e=t.currentTime;r!==e&&i(r=e)};s=requestAnimationFrame(n),t.addEventListener("timeupdate",n),Ve(()=>{var i=Number(e());r===i||isNaN(i)||(t.currentTime=r=i)}),Oe(()=>{cancelAnimationFrame(s),t.removeEventListener("timeupdate",n)})}function mr(t,e){Pe(t,["seeking","seeked"],()=>e(t.seeking))}function gr(t,e,i=e){var s=e();Pe(t,["play","pause","canplay"],()=>{s!==t.paused&&i(s=t.paused)},null==s),Fe(()=>{(s=!!e())!==t.paused&&(s?t.pause():t.play().catch(t=>{throw i(s=!0),t}))})}function pr(t,e){return t===e||t?.[P]===e}function fr(t={},e,i,s){var r=J.r,n=hi;return Fe(()=>{var a,o;return Ve(()=>{a=o,o=s?.()||[],Li(()=>{t!==i(...o)&&(e(t,...o),a&&pr(i(...a),t)&&e(null,...a))})}),()=>{let s=n;for(;s!==r&&null!==s.parent&&33554432&s.parent.f;)s=s.parent;const a=s.teardown;s.teardown=()=>{o&&pr(i(...o),t)&&e(null,...o),a?.()}}}),t}function vr(t,e,i,s,r){var n=()=>{s(i[t])};i.addEventListener(e,n),r?Ve(()=>{i[t]=r()}):n(),i!==document.body&&i!==window&&i!==document||Oe(()=>{i.removeEventListener(e,n)})}var wr={get(t,e){let i=t.props.length;for(;i--;){let s=t.props[i];if(p(s)&&(s=s()),"object"==typeof s&&null!==s&&e in s)return s[e]}},set(t,e,i){let s=t.props.length;for(;s--;){let r=t.props[s];p(r)&&(r=r());const n=c(r,e);if(n&&n.set)return n.set(i),!0}return!1},getOwnPropertyDescriptor(t,e){let i=t.props.length;for(;i--;){let s=t.props[i];if(p(s)&&(s=s()),"object"==typeof s&&null!==s&&e in s){const t=c(s,e);return t&&!t.configurable&&(t.configurable=!0),t}}},has(t,e){if(e===P||e===$)return!1;for(let i of t.props)if(p(i)&&(i=i()),null!=i&&e in i)return!0;return!1},ownKeys(t){const e=[];for(let i of t.props)if(p(i)&&(i=i()),i){for(const t in i)e.includes(t)||e.push(t);for(const t of Object.getOwnPropertySymbols(i))e.includes(t)||e.push(t)}return e}};function yr(...t){return new Proxy({props:t},wr)}function br(t,e,i,s){var r=!!(8&i),n=!!(16&i),a=s,o=!0,h=()=>(o&&(o=!1,a=n?Li(s):s),a);let l;if(r){var d=P in t||$ in t;l=c(t,e)?.set??(d&&e in t?i=>t[e]=i:void 0)}var u,m,g=!1;if(r?[u,g]=function(t){var e=yt;try{return yt=!1,[t(),yt]}finally{yt=e}}(()=>t[e]):u=t[e],void 0===u&&void 0!==s&&(u=h(),l&&(function(){throw new Error("https://svelte.dev/e/props_invalid_value")}(),l(u))),m=()=>{var i=t[e];return void 0===i?h():(o=!0,i)},!(4&i))return m;if(l){var p=t.$$legacy;return function(t,e){return arguments.length>0?((!e||p||g)&&l(e?m():t),t):m()}}var f=!1,v=(1&i?Ht:Zt)(()=>(f=!1,m()));r&&Ei(v);var w=hi;return function(t,e){if(arguments.length>0){const i=e?Ei(v):r?ue(t):t;return oe(v,i),f=!0,void 0!==a&&(a=i),t}return si&&f||16384&w.f?v.v:Ei(v)}}var xr=class{#G;#j;constructor(t){var e=new Map,i=(t,i)=>{var s=ae(i,!1,!1);return e.set(t,s),s};const s=new Proxy({...t.props||{},$$events:{}},{get:(t,s)=>Ei(e.get(s)??i(s,Reflect.get(t,s))),has:(t,s)=>s===$||(Ei(e.get(s)??i(s,Reflect.get(t,s))),Reflect.has(t,s)),set:(t,s,r)=>(oe(e.get(s)??i(s,r),r),Reflect.set(t,s,r))});this.#j=(t.hydrate?os:as)(t.component,{target:t.target,anchor:t.anchor,props:s,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError}),t?.props?.$$host&&!1!==t.sync||zt(),this.#G=s.$$events;for(const r of Object.keys(this.#j))"$set"!==r&&"$destroy"!==r&&"$on"!==r&&h(this,r,{get(){return this.#j[r]},set(t){this.#j[r]=t},enumerable:!0});this.#j.$set=t=>{Object.assign(s,t)},this.#j.$destroy=()=>{ds(this.#j)}}$set(t){this.#j.$set(t)}$on(t,e){this.#G[t]=this.#G[t]||[];const i=(...t)=>e.call(this,...t);return this.#G[t].push(i),()=>{this.#G[t]=this.#G[t].filter(t=>t!==i)}}$destroy(){this.#j.$destroy()}};function Tr(t,e,i,s){const r=i[t]?.type;if(e="Boolean"===r&&"boolean"!=typeof e?null!=e:e,!s||!i[t])return e;if("toAttribute"===s)switch(r){case"Object":case"Array":return null==e?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return null==e?null:e;default:return e}else switch(r){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":default:return e;case"Number":return null!=e?+e:e}}"function"==typeof HTMLElement&&HTMLElement;var kr="E001",_r="E002",Mr="E003",Sr="E004",Er="E005",Ir="E100",Ar="E101",Lr="E102",Pr="E103",$r="E200",Cr="E201",Dr="E202",zr="E203",Or="E300",Rr="E301",Xr="E302",Fr="E303",Vr="E999",Yr={[kr]:"You appear to be offline. Please check your internet connection and try again.",[_r]:"The connection timed out. Please try again.",[Mr]:"Unable to load content due to security restrictions.",[Sr]:"The requested image or content could not be found.",[Er]:"The server encountered an error. Please try again later.",[Ir]:"Your browser does not support WebGL, which is required to view this content. Please try a different browser.",[Ar]:"The graphics context was lost. The page will attempt to recover.",[Lr]:"There was a problem initializing the graphics. Please try refreshing the page.",[Pr]:"Your device is low on memory. Try closing other browser tabs or applications.",[$r]:"The image data appears to be invalid or corrupted.",[Cr]:"The requested content could not be loaded.",[Dr]:"There was a problem processing the image information.",[zr]:"This image uses an unsupported format version.",[Or]:"Failed to load the image viewer engine. Please try refreshing the page.",[Rr]:"An error occurred in the image viewer. Please try refreshing the page.",[Xr]:"Failed to load the image. Please try again.",[Fr]:"Failed to load the tour. Some features may be unavailable.",[Vr]:"An unexpected error occurred. Please try refreshing the page."},Nr=class t extends Error{constructor(e,i){super(e),this.name="MicrioError",this.code=i?.code??Vr,this.displayMessage=i?.displayMessage??Yr[this.code],this.cause=i?.cause,this.statusCode=i?.statusCode,"captureStackTrace"in Error&&"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t)}static fromResponse(e,i){const s=e.status;let r=Vr;return 404===s?r=Sr:s>=500&&s<600?r=Er:0===s?r=kr:408!==s&&504!==s||(r=_r),new t(`${i?i+": ":""}HTTP ${s}`,{code:r,statusCode:s})}static fromError(e,i){const s=e.message.toLowerCase();let r=Vr;return s.includes("network")||s.includes("internet")||s.includes("offline")?r=kr:s.includes("timeout")?r=_r:s.includes("cors")||s.includes("cross-origin")?r=Mr:s.includes("webgl")||s.includes("webglcontext")?r=Ir:s.includes("memory")||s.includes("out of memory")?r=Pr:(s.includes("wasm")||s.includes("webassembly"))&&(r=Or),new t(`${i?i+": ":""}${e.message}`,{code:r,cause:e})}},Br=(t,e=1)=>(t%e+e)%e,qr=t=>JSON.parse(JSON.stringify(t));function Wr(t,e,i={}){if(!t||"object"!=typeof t)return e;for(const s in t){const r=t[s];if(r&&"object"==typeof r&&Object.getPrototypeOf(r)===Object.prototype){const t=e;t[s]&&"object"==typeof t[s]||(t[s]={}),Wr(r,t[s],i)}else{const t=e;i.mergeArrays&&t[s]instanceof Array&&r instanceof Array?t[s].push(...r):i.noOverwrite&&s in e||(t[s]=r)}}return e}var Ur=()=>Math.floor(65536*(1+Math.random())).toString(16).substring(1),Hr=()=>Ur()+Ur()+"-"+Ur()+"-"+Ur()+"-"+Ur()+"-"+Ur()+Ur()+Ur(),Gr=t=>{if(void 0===t)return t;t=(t=t.replace(/^\s+|\s+$/g,"")).toLowerCase();for(let e=0,i=28;e<i;e++)t=t.replace(new RegExp("àáäâèéëêìíïîòóöôùúüûñç·/_,:;".charAt(e),"g"),"aaaaeeeeiiiioooouuuunc------".charAt(e));return t=t.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")};function jr(t){const e=t<0;e&&(t=-t);const i=Math.ceil(t),s=Math.floor(i/3600),r=Math.floor(i%3600/60),n=i%60,a=t=>t<10?"0"+t:""+t;return(e?"-":"")+(s?s+":"+a(r):""+r)+":"+a(n)}var Zr=navigator.userAgent,Jr={iOS:/ipad|iphone|ipod/i.test(Zr),firefox:/firefox/i.test(Zr),OSX:/macintosh/i.test(Zr)&&/os\ x/i.test(Zr),hasTouch:"TouchEvent"in self,safari:!1};Jr.safari=(Jr.OSX||Jr.iOS)&&(/safari/i.test(Zr)||/instagram/i.test(Zr))&&!/chrome/i.test(Zr),Jr.OSX&&Jr.safari&&"TouchEvent"in self&&(Jr.iOS=!0,Jr.OSX=!1);var Kr=t=>new Promise(e=>t?setTimeout(e,t):e()),Qr=[],tn=(t,e,i)=>new Promise((s,r)=>{if(i||Qr.includes(t))return s();const n=document.createElement("script"),a=()=>{Qr.push(t),s()};e?self[e]=a:n.onload=a,n.onerror=()=>r&&r(),n.async=!0,n.defer=!0,self.crossOriginIsolated&&(n.crossOrigin="anonymous"),n.src=t,document.head.appendChild(n)}),en=(t,e={})=>new Promise(i=>{let s,r=!0;s=t.subscribe(t=>{r&&e.allowUndefined&&void 0===t||(r=!1,(void 0!==e.targetValue?t===e.targetValue:e.allowUndefined||void 0!==t)&&(s?s():Si().then(()=>s()),i(t)))})}),sn=new WeakSet,rn={fromLegacy:t=>{if(!t)return;if(sn.has(t))return t;const e=[t[0],t[1],t[2]-t[0],t[3]-t[1]];return sn.add(t),e},toCenterJSON:t=>({centerX:t[0]+t[2]/2,centerY:t[1]+t[3]/2,width:t[2],height:t[3]}),rectToCenterJSON:t=>rn.toCenterJSON([t[0],t[1],t[2]-t[0],t[3]-t[1]])},nn={"micrio-cdn.azureedge.net":"micrio.vangoghmuseum.nl/micrio","micrio-cdn.vangoghmuseum.nl":"micrio.vangoghmuseum.nl/micrio","rijks-micrio.azureedge.net":"micrio.rijksmuseum.nl"},an=t=>{if(t instanceof Object&&"fileUrl"in t&&!t.src&&(t.src=t.fileUrl),t?.src)for(let e in nn)t.src.includes(e)&&(t.src=t.src.replace(e,nn[e]))},on=t=>!t.viewsWH,hn=new WeakMap,cn=t=>{an(t.image),t.children?.forEach(cn)},ln=new WeakSet,dn=(t,e,i,s)=>{if(ln.has(t))return;ln.add(t),t.data||(t.data={}),t.id||(t.id=Hr()),t.tags||(t.tags=[]),"type"in t||(t.type="default"),t.popupType||(t.popupType="popup"),"string"==typeof t.data.icon&&(t.data.icon={title:"",size:0,uploaded:0,width:-1,height:-1,src:t.data.icon}),t.images?.forEach(an),an(t.positionalAudio),an(t.data?.icon),Object.values(t.i18n??{}).forEach(t=>an(t.audio));const r="embedImages"in t?t.embedImages:void 0;r&&r.forEach(t=>an(t));const n=t.data?._meta?.secondary;n&&(t.data.micrioSplitLink=n),i&&"class"in t&&(t.tags??=[]).push(...t.class.split(" ").map(t=>t.trim()).filter(e=>!!e&&!t.tags.includes(e))),t.tags?.includes("default")&&(t.type="default"),s&&(t.view=rn.fromLegacy(t.view),un(t.videoTour))};function un(t){if(!t||!("i18n"in t)&&!("timeline"in t))return;const e="i18n"in t?t.i18n:{en:t};for(const i in e)e[i]?.timeline.forEach(t=>t.rect=rn.fromLegacy(t.rect))}var mn="6.0.2",gn="https://b.micr.io/";var pn=function(){try{const t=location.hostname;if(t.endsWith("micrio.dev"))return"micrio.dev";if(t.endsWith("micrio.net"))return"micrio.net"}catch{}return"micr.io"}(),fn=`https://viewer.${pn}/`,vn=["ttBWO","IicaE","KLTce","xjQrB","pfhXT","rNIPa","rdFIY","mvRXc"],wn="micrio-muted",yn={id:"",version:mn,path:gn,width:0,height:0,tileSize:1024,lang:"en",settings:{camspeed:1,view:[0,0,1,1],restrict:[0,0,1,1],focus:[.5,.5],zoomLimit:1,fullscreen:!0,hookEvents:!0,hookScroll:!0,hookPinch:!0,hookDrag:!0,minimap:!0,doTourJumps:!0,audio:!0,startVolume:1,mutedVolume:0,_markers:{showTitles:!1,popupAnimation:{duration:200,x:-50},zoomOutAfterClose:!0},ui:{controls:{cultureSwitch:!0}},_360:{},_meta:{}}},bn={STRINGS:{id:{r:!0},lang:{r:!0},"data-thumb":{f:"thumbSrc"},"data-title":{r:!0},"data-format":{r:!0},"data-extension":{r:!0,f:"tileExtension"},"data-tiles":{r:!0,f:"tilesId"},"data-path":{r:!0},"data-inittype":{f:"initType"},"data-start":{f:"gallery.startId"},"data-gallery":{f:"gallery.archive"},"data-gallery-sort":{f:"gallery.sort"},"data-iiif":{r:!0,f:"iiifManifest"},"data-grid":{r:!0},"data-gallery-type":{f:"gallery.type"}},BOOLEANS:{"data-static":{},muted:{f:"audio",n:!0},"data-png":{r:!0,f:"isPng"},"data-webp":{r:!0,f:"isWebP"},"data-dz":{r:!0,f:"isDeepZoom"},"data-is360":{r:!0},"data-no-externals":{f:"noExternals"},"data-skipmeta":{f:"skipMeta"},"data-force-data-refresh":{f:"forceDataRefresh"},"data-keeprendering":{f:"keepRendering"},"data-coverlimit":{f:"limitToCoverScale"},"data-events":{f:"hookEvents"},"data-keys":{f:"hookKeys"},"data-zooming":{f:"noZoom",n:!0},"data-scroll-zoom":{f:"hookScroll"},"data-pinch-zoom":{f:"hookPinch"},"data-dragging":{f:"hookDrag"},"data-two-finger-pan":{f:"twoFingerPan"},"data-control-zoom":{f:"controlZoom"},"data-ui":{f:"noUI",n:!0},"data-gtag":{f:"noGTag",n:!0},"data-controls":{f:"noControls",n:!0},"data-logo":{f:"noLogo",n:!0},"data-logo-org":{f:"noOrgLogo",n:!0},"data-toolbar":{f:"noToolbar",n:!0},"data-show-info":{f:"showInfo"},"data-social":{},"data-fullscreen":{},"data-minimap":{},"data-minimap-hide":{f:"alwaysShowMinimap",n:!0},"data-normalize-dpr":{f:"zoomLimitDPRFix"},"data-grid-clickable":{f:"gridClickable"},"data-gallery-spreads":{f:"gallery.isSpreads"},"data-freemove":{f:"freeMove"},"data-force-path":{f:"forceInfoPath",r:!0}},NUMBERS:{"data-version":{r:!0},height:{r:!0},width:{r:!0},volume:{f:"startVolume"},"data-tilesize":{r:!0,f:"tileSize"},"data-camspeed":{},"data-zoomlimit":{f:"zoomLimit"},"data-minimap-height":{f:"minimapHeight"},"data-minimap-width":{f:"minimapWidth"},"data-mutedvolume":{f:"mutedVolume"},"data-width-cm":{f:"cmWidth"},"data-height-cm":{f:"cmHeight"},"data-gallery-cover-pages":{f:"gallery.coverPages"},lazyload:{dN:0},"data-elasticity":{f:"dragElasticity"},"data-skip-base-levels":{f:"skipBaseLevels"},"data-watermark-opacity":{f:"watermarkOpacity"}},ARRAYS:{"data-focus":{},"data-view":{}}},xn=new Map,Tn=new Map,kn=new Map,_n=async(t,e)=>{if(!e&&xn.has(t))return qr(xn.get(t));if(Tn.has(t))return Tn.get(t);if(kn.has(t))throw kn.get(t)[1];const i=fetch(t+(e?(t.includes("?")?"&":"?")+Math.random():"")).then(async e=>{if(200==e.status)return e.json();{const i=Nr.fromResponse(e,`fetchJson(${t})`);throw kn.set(t,[e.status,i.message]),i}}).then(i=>(e||xn.set(t,i),Tn.delete(t),qr(i))).catch(e=>{throw Tn.delete(t),e});return Tn.set(t,i),i},Mn=t=>"MICRIO_DATA"in self?(self?.MICRIO_DATA).find(e=>e[0]==t):void 0,Sn=(t,e,i)=>{const s=Mn(t)?.[1];return s?Promise.resolve(s):_n(`${e??fn}${t}/info.json`,i).then(t=>{var e;return t&&("Height"in t&&(t.height=t.Height,t.version=1,t.tileSize=512),"Width"in t&&(t.width=t.Width)),(e=t)&&(hn.has(e)||(an(e.organisation?.logo),an(e.settings?._markers?.markerIcon),e.settings?._markers?.customIcons?.forEach(an),an(e.settings?._360?.video),e?.settings&&on(e)&&(e.settings.view=rn.fromLegacy(e.settings.view),e.settings.restrict=rn.fromLegacy(e.settings.restrict)),hn.set(e,!0))),t})};async function En(t,e,i,s){if(!("steps"in e)||e.stepInfo)return;const r=[...new Set(e.steps.map(t=>t.split(",")[1]).filter(e=>!!e&&e!=t.id))],[n,a]=await Promise.all([Promise.all(r.map(e=>_n((e=>t.dataPath+(t.isV5?e+"/data/pub.json":e+"/data."+i+".json"))(e)))),Promise.all(r.map(t=>Sn(t)))]);n.forEach((e,s)=>{const r=on(a[s]);e?.markers?.forEach(e=>dn(e,i,!t.isV5,r))}),an(e.image);let o=-1;const h=[];e.stepInfo=e.steps.map((e,a)=>{const[c,l]=e.split(","),d=n[r.indexOf(l)]??s,u=d?.markers?.find(t=>t.id==c),m=u?.i18n?.[i]??u;m?.title&&(o=a);const g=u?.videoTour?"timeline"in u.videoTour?u.videoTour:u.videoTour.i18n?.[i]??void 0:void 0;return an(g?.audio),an(g?.subtitle),u?(an(m?.audio),u.videoTour&&m?.audio&&(u.videoTour.audio=m.audio),{markerId:c,marker:u,micrioId:l||t.id,duration:Number(g?.duration||m?.audio?.duration||0),startView:g?.timeline?.length?g.timeline[0].rect:u?.view,imageHasOtherMarkers:!!l&&!!d?.markers?.find(t=>t.id!=c&&!t.noMarker),gridView:!(!u.data?._meta?.gridView&&!u.data?._meta?.gridAction),chapter:o,hasSubtitle:!!g?.subtitle}):(console.warn(`[Micrio] Warning: tour step ${a+1} with id [${c}] not found! Removing it from the tour`),void h.push(a))}).filter(t=>void 0!==t),h.reverse().forEach(t=>e.steps.splice(t,1)),e.initialStep=0,e.duration=e.stepInfo.reduce((t,e)=>t+(e.duration||0),0)}var In=t=>{let e=t.charCodeAt(0),i=e<91;return(e-=i?65:97)-(e>7?1:0)+(i?24:e>10?-1:0)},An=t=>6==t.length||7==t.length;function Ln(t,e){const i=t.$current;if(!i)return;const s=t.spaceData?.images.find(t=>t.id==i.id),r=t.spaceData?.images.find(t=>t.id==e);if(!s||!r)return;const n=[(r.x??.5)-(s.x??.5),(s.y??.5)-(r.y??.5),(r.z??.5)-(s.z??.5)];let a=n[0]*n[0]+n[1]*n[1]+n[2]*n[2];a>0&&(a=1/Math.sqrt(a));const o=[n[0]*a,n[1]*a,n[2]*a],h=Br(Math.atan2(-o[0],o[2])/Math.PI/2);return{v:n,vN:o,directionX:h,vector:{direction:h%1,distanceX:Math.max(0,Math.min(.4,Math.sqrt(o[0]*o[0]+o[2]*o[2]))),distanceY:-n[1]}}}function Pn([t,e,i=0,s=0],[r,n,a=0,o=0],h){const c=Math.max(s/2,h),l=Math.max(o/2,h);return!(t+i+h<r-h||t-h>r+a+h||e+c<n-l||e-c>n+l)}var $n,Cn=function(t){return t[t.None=0]="None",t[t.IFrame=1]="IFrame",t[t.Video=2]="Video",t[t.Audio=3]="Audio",t[t.VideoTour=4]="VideoTour",t[t.Micrio=5]="Micrio",t}({}),Dn=function(t){return t[t.YouTube=1]="YouTube",t[t.Vimeo=2]="Vimeo",t}({}),zn=/((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be|youtube-nocookie\.com))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)?/,On=/vimeo\.com/,Rn=/^.*t=(\d+).*$/,Xn="https://www.youtube-nocookie.com";function Fn(t){if(t)return"fileUrl"in t?t.fileUrl:t.src}function Vn(t,e){return t.i18n?.[e]??t}var Yn=t=>t;function Nn(t){const e=t-1;return e*e*e+1}function Bn(t){const e="string"==typeof t&&t.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[t,"px"]}function qn(t,{delay:e=0,duration:i=400,easing:s=Yn}={}){const r=+getComputedStyle(t).opacity;return{delay:e,duration:i,easing:s,css:t=>"opacity: "+t*r}}function Wn(t,{delay:e=0,duration:i=400,easing:s=Nn,x:r=0,y:n=0,opacity:a=0}={}){const o=getComputedStyle(t),h=+o.opacity,c="none"===o.transform?"":o.transform,l=h*(1-a),[d,u]=Bn(r),[m,g]=Bn(n);return{delay:e,duration:i,easing:s,css:(t,e)=>`\n\t\t\ttransform: ${c} translate(${(1-t)*d}${u}, ${(1-t)*m}${g});\n\t\t\topacity: ${h-l*e}`}}var Un=Bi('<a rel="noopener" href="https://micr.io/" title="Powered by Micrio" aria-label="Micrio homepage"></a>');function Hn(t,e){et(e,!0);const[i,s]=kt(),r=Q("micrio"),{tour:n,marker:a}=r.state,o=/micr\.io/.test(location.origin)&&self.parent==self?void 0:"_blank";let h,c=ne(!1);ps(()=>r.loading.subscribe(t=>{clearTimeout(h),t?Ei(c)||(h=setTimeout(()=>oe(c,!0),750)):oe(c,!1)}));const l=jt(()=>!!xt(n,"$tour",i)||!!xt(a,"$marker",i));var d=Hi(),u=_e(d),m=t=>{var e=Un();let i;Ye(()=>{ar(e,"target",o),i=qs(e,1,"micrio-logo",null,i,{loading:Ei(c)})}),Ds(3,e,()=>qn,()=>({duration:200})),Gi(t,e)};vs(u,t=>{Ei(l)||t(m)}),Gi(t,d),it(),s()}var Gn=Bi('<a rel="noopener" target="_blank" class="micrio-logo-org"><img alt="Logo" class="micrio-logo-org"/></a>');function jn(t,e){et(e,!0);const[i,s]=kt(),{tour:r,marker:n,popover:a}=Q("micrio").state;const o=jt(()=>!!xt(r,"$tour",i)||!!xt(n,"$marker",i)||!!xt(a,"$popover",i));var h=Hi(),c=_e(h),l=t=>{var i=Gn(),s=ke(i);q(i),Ye(t=>{ar(i,"href",e.organisation.href??"#"),ar(i,"title",e.organisation.name),ar(i,"aria-label",`${e.organisation.name??""} homepage`),ar(s,"src",t)},[()=>function(t){if("string"==typeof t)return t;let e=0,i=Math.max(t.width,t.height);for(;i>1024;)e++,i/=2;return t.micrioId&&t.width>1024?"https://r2.micr.io/"+t.micrioId+"/"+e+"/0-0."+(t.isPng?"png":t.isWebP?"webp":"jpg"):t.src}(e.organisation.logo)]),Ds(3,i,()=>qn,()=>({duration:200})),Gi(t,i)};vs(c,t=>{!Ei(o)&&e.organisation.logo&&t(l)}),Gi(t,h),it(),s()}var Zn={en:{close:"Close",zoomIn:"Zoom in",zoomOut:"Zoom out",fullscreenToggle:"Toggle fullscreen",switchLanguage:"Switch language",share:"Share",audioMute:"Mute audio",audioUnmute:"Unmute audio",closeMarker:"Close this marker",tourStepNext:"Next step",tourStepPrev:"Previous step",tourStop:"Stop this tour",minimize:"Minimize",play:"Play",pause:"Pause",stop:"Stop",subtitlesToggle:"Toggle subtitles",galleryPrev:"Previous image",galleryNext:"Next image",menuToggle:"Toggle menu",waypointFollow:"Go this way"},nl:{close:"Sluit",zoomIn:"Zoom in",zoomOut:"Zoom uit",fullscreenToggle:"Volledig scherm aan / uit",switchLanguage:"Kies taal",share:"Deel",audioMute:"Geluid uit",audioUnmute:"Geluid aan",closeMarker:"Sluit deze marker",tourStepNext:"Volgende stap",tourStepPrev:"Vorige stap",tourStop:"Stop deze tour",minimize:"Minimaliseer",play:"Start",pause:"Pauzeer",stop:"Stop",subtitlesToggle:"Ondertitels aan / uit",galleryPrev:"Vorige afbeelding",galleryNext:"Volgende afbeelding",menuToggle:"Menu openen / sluiten",waypointFollow:"Ga deze richting"}},Jn=vt(Zn.en),Kn=navigator?.language??"en-EN",Qn="Intl"in self&&Intl.DisplayNames?new Intl.DisplayNames([Kn],{type:"language"}):void 0,ta=["ar","ar-AE","ar-BH","ar-DJ","ar-DZ","ar-EG","ar-IQ","ar-JO","ar-KW","ar-LB","ar-LY","ar-MA","ar-OM","ar-QA","ar-SA","ar-SD","ar-SY","ar-TN","ar-YE","dv","dv-MV","fa","fa-AF","fa-IR","he","he-IL","iw","iw-PS","kd","ku","ku-IQ","ku-IR","ku-SY","ku-TR","pk-PK","ps","ps-AF","sd","sd-PK","syr-SY","ug","ug-CN","ur","ur-IN","ur-PK","yi","yi-IL","yi-US"],ea={arrowDown:[384,512,"M169.4 502.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 402.7 224 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 370.7-105.4-105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z"],arrowLeft:[512,512,"M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 288 480 288c17.7 0 32-14.3 32-32s-14.3-32-32-32l-370.7 0 105.4-105.4c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"],arrowRight:[512,512,"M502.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l370.7 0-105.4 105.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z"],arrowUp:[384,512,"M214.6 9.4c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 109.3 160 480c0 17.7 14.3 32 32 32s32-14.3 32-32l0-370.7 105.4 105.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-160-160z"],bars:[448,512,"M0 96C0 78.3 14.3 64 32 64l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32L32 448c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"],chevronDown:[448,512,"M201.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 338.7 54.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"],circleExclamation:[512,512,"M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zm0-192a32 32 0 1 0 0 64 32 32 0 1 0 0-64zm0-192c-18.2 0-32.7 15.5-31.4 33.7l7.4 104c.9 12.6 11.4 22.3 23.9 22.3 12.6 0 23-9.7 23.9-22.3l7.4-104c1.3-18.2-13.1-33.7-31.4-33.7z"],closedCaptioning:[512,512,"M0 128C0 92.7 28.7 64 64 64l384 0c35.3 0 64 28.7 64 64l0 256c0 35.3-28.7 64-64 64L64 448c-35.3 0-64-28.7-64-64L0 128zm152 80l32 0c4.4 0 8 3.6 8 8 0 13.3 10.7 24 24 24s24-10.7 24-24c0-30.9-25.1-56-56-56l-32 0c-30.9 0-56 25.1-56 56l0 80c0 30.9 25.1 56 56 56l32 0c30.9 0 56-25.1 56-56 0-13.3-10.7-24-24-24s-24 10.7-24 24c0 4.4-3.6 8-8 8l-32 0c-4.4 0-8-3.6-8-8l0-80c0-4.4 3.6-8 8-8zm168 8c0-4.4 3.6-8 8-8l32 0c4.4 0 8 3.6 8 8 0 13.3 10.7 24 24 24s24-10.7 24-24c0-30.9-25.1-56-56-56l-32 0c-30.9 0-56 25.1-56 56l0 80c0 30.9 25.1 56 56 56l32 0c30.9 0 56-25.1 56-56 0-13.3-10.7-24-24-24s-24 10.7-24 24c0 4.4-3.6 8-8 8l-32 0c-4.4 0-8-3.6-8-8l0-80z"],compress:[448,512,"M160 64c0-17.7-14.3-32-32-32S96 46.3 96 64l0 64-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32l0-96zM32 320c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 0 64c0 17.7 14.3 32 32 32s32-14.3 32-32l0-96c0-17.7-14.3-32-32-32l-96 0zM352 64c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 96c0 17.7 14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64 0 0-64zM320 320c-17.7 0-32 14.3-32 32l0 96c0 17.7 14.3 32 32 32s32-14.3 32-32l0-64 64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-96 0z"],ellipsisVertical:[128,512,"M64 144a56 56 0 1 1 0-112 56 56 0 1 1 0 112zm0 224c30.9 0 56 25.1 56 56s-25.1 56-56 56-56-25.1-56-56 25.1-56 56-56zm56-112c0 30.9-25.1 56-56 56s-56-25.1-56-56 25.1-56 56-56 56 25.1 56 56z"],expand:[448,512,"M32 32C14.3 32 0 46.3 0 64l0 96c0 17.7 14.3 32 32 32s32-14.3 32-32l0-64 64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 32zM64 352c0-17.7-14.3-32-32-32S0 334.3 0 352l0 96c0 17.7 14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64 0 0-64zM320 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 0 64c0 17.7 14.3 32 32 32s32-14.3 32-32l0-96c0-17.7-14.3-32-32-32l-96 0zM448 352c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 64-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32l0-96z"],externalLink:[512,512,"M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l82.7 0-201.4 201.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3 448 192c0 17.7 14.3 32 32 32s32-14.3 32-32l0-160c0-17.7-14.3-32-32-32L320 0zM80 96C35.8 96 0 131.8 0 176L0 432c0 44.2 35.8 80 80 80l256 0c44.2 0 80-35.8 80-80l0-80c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 80c0 8.8-7.2 16-16 16L80 448c-8.8 0-16-7.2-16-16l0-256c0-8.8 7.2-16 16-16l80 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L80 96z"],globe:[512,512,"M351.9 280l-190.9 0c2.9 64.5 17.2 123.9 37.5 167.4 11.4 24.5 23.7 41.8 35.1 52.4 11.2 10.5 18.9 12.2 22.9 12.2s11.7-1.7 22.9-12.2c11.4-10.6 23.7-28 35.1-52.4 20.3-43.5 34.6-102.9 37.5-167.4zM160.9 232l190.9 0C349 167.5 334.7 108.1 314.4 64.6 303 40.2 290.7 22.8 279.3 12.2 268.1 1.7 260.4 0 256.4 0s-11.7 1.7-22.9 12.2c-11.4 10.6-23.7 28-35.1 52.4-20.3 43.5-34.6 102.9-37.5 167.4zm-48 0C116.4 146.4 138.5 66.9 170.8 14.7 78.7 47.3 10.9 131.2 1.5 232l111.4 0zM1.5 280c9.4 100.8 77.2 184.7 169.3 217.3-32.3-52.2-54.4-131.7-57.9-217.3L1.5 280zm398.4 0c-3.5 85.6-25.6 165.1-57.9 217.3 92.1-32.7 159.9-116.5 169.3-217.3l-111.4 0zm111.4-48C501.9 131.2 434.1 47.3 342 14.7 374.3 66.9 396.4 146.4 399.9 232l111.4 0z"],image:[448,512,"M64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32zm64 80a48 48 0 1 1 0 96 48 48 0 1 1 0-96zM272 224c8.4 0 16.1 4.4 20.5 11.5l88 144c4.5 7.4 4.7 16.7 .5 24.3S368.7 416 360 416L88 416c-8.9 0-17.2-5-21.3-12.9s-3.5-17.5 1.6-24.8l56-80c4.5-6.4 11.8-10.2 19.7-10.2s15.2 3.8 19.7 10.2l26.4 37.8 61.4-100.5c4.4-7.1 12.1-11.5 20.5-11.5z"],layerGroup:[512,512,"M232.5 5.2c14.9-6.9 32.1-6.9 47 0l218.6 101c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L13.9 149.8C5.4 145.8 0 137.3 0 128s5.4-17.9 13.9-21.8L232.5 5.2zM48.1 218.4l164.3 75.9c27.7 12.8 59.6 12.8 87.3 0l164.3-75.9 34.1 15.8c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L13.9 277.8C5.4 273.8 0 265.3 0 256s5.4-17.9 13.9-21.8l34.1-15.8zM13.9 362.2l34.1-15.8 164.3 75.9c27.7 12.8 59.6 12.8 87.3 0l164.3-75.9 34.1 15.8c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L13.9 405.8C5.4 401.8 0 393.3 0 384s5.4-17.9 13.9-21.8z"],link:[576,512,"M419.5 96c-16.6 0-32.7 4.5-46.8 12.7-15.8-16-34.2-29.4-54.5-39.5 28.2-24 64.1-37.2 101.3-37.2 86.4 0 156.5 70 156.5 156.5 0 41.5-16.5 81.3-45.8 110.6l-71.1 71.1c-29.3 29.3-69.1 45.8-110.6 45.8-86.4 0-156.5-70-156.5-156.5 0-1.5 0-3 .1-4.5 .5-17.7 15.2-31.6 32.9-31.1s31.6 15.2 31.1 32.9c0 .9 0 1.8 0 2.6 0 51.1 41.4 92.5 92.5 92.5 24.5 0 48-9.7 65.4-27.1l71.1-71.1c17.3-17.3 27.1-40.9 27.1-65.4 0-51.1-41.4-92.5-92.5-92.5zM275.2 173.3c-1.9-.8-3.8-1.9-5.5-3.1-12.6-6.5-27-10.2-42.1-10.2-24.5 0-48 9.7-65.4 27.1L91.1 258.2c-17.3 17.3-27.1 40.9-27.1 65.4 0 51.1 41.4 92.5 92.5 92.5 16.5 0 32.6-4.4 46.7-12.6 15.8 16 34.2 29.4 54.6 39.5-28.2 23.9-64 37.2-101.3 37.2-86.4 0-156.5-70-156.5-156.5 0-41.5 16.5-81.3 45.8-110.6l71.1-71.1c29.3-29.3 69.1-45.8 110.6-45.8 86.6 0 156.5 70.6 156.5 156.9 0 1.3 0 2.6 0 3.9-.4 17.7-15.1 31.6-32.8 31.2s-31.6-15.1-31.2-32.8c0-.8 0-1.5 0-2.3 0-33.7-18-63.3-44.8-79.6z"],minus:[448,512,"M0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32z"],pause:[384,512,"M48 32C21.5 32 0 53.5 0 80L0 432c0 26.5 21.5 48 48 48l64 0c26.5 0 48-21.5 48-48l0-352c0-26.5-21.5-48-48-48L48 32zm224 0c-26.5 0-48 21.5-48 48l0 352c0 26.5 21.5 48 48 48l64 0c26.5 0 48-21.5 48-48l0-352c0-26.5-21.5-48-48-48l-64 0z"],play:[448,512,"M91.2 36.9c-12.4-6.8-27.4-6.5-39.6 .7S32 57.9 32 72l0 368c0 14.1 7.5 27.2 19.6 34.4s27.2 7.5 39.6 .7l336-184c12.8-7 20.8-20.5 20.8-35.1s-8-28.1-20.8-35.1l-336-184z"],playCircle:[512,512,"M0 256a256 256 0 1 1 512 0 256 256 0 1 1 -512 0zM188.3 147.1c-7.6 4.2-12.3 12.3-12.3 20.9l0 176c0 8.7 4.7 16.7 12.3 20.9s16.8 4.1 24.3-.5l144-88c7.1-4.4 11.5-12.1 11.5-20.5s-4.4-16.1-11.5-20.5l-144-88c-7.4-4.5-16.7-4.7-24.3-.5z"],plus:[448,512,"M256 64c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 160-160 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l160 0 0 160c0 17.7 14.3 32 32 32s32-14.3 32-32l0-160 160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-160 0 0-160z"],share:[512,512,"M307.8 18.4c-12 5-19.8 16.6-19.8 29.6l0 80-112 0c-97.2 0-176 78.8-176 176 0 113.3 81.5 163.9 100.2 174.1 2.5 1.4 5.3 1.9 8.1 1.9 10.9 0 19.7-8.9 19.7-19.7 0-7.5-4.3-14.4-9.8-19.5-9.4-8.8-22.2-26.4-22.2-56.7 0-53 43-96 96-96l96 0 0 80c0 12.9 7.8 24.6 19.8 29.6s25.7 2.2 34.9-6.9l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-9.2-9.2-22.9-11.9-34.9-6.9z"],video:[576,512,"M96 64c-35.3 0-64 28.7-64 64l0 256c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-256c0-35.3-28.7-64-64-64L96 64zM464 336l73.5 58.8c4.2 3.4 9.4 5.2 14.8 5.2 13.1 0 23.7-10.6 23.7-23.7l0-240.6c0-13.1-10.6-23.7-23.7-23.7-5.4 0-10.6 1.8-14.8 5.2L464 176 464 336z"],volumeHigh:[640,512,"M533.6 32.5c-10.3-8.4-25.4-6.8-33.8 3.5s-6.8 25.4 3.5 33.8C557.5 113.8 592 180.8 592 256s-34.5 142.2-88.7 186.3c-10.3 8.4-11.8 23.5-3.5 33.8s23.5 11.8 33.8 3.5C598.5 426.7 640 346.2 640 256S598.5 85.2 533.6 32.5zM473.1 107c-10.3-8.4-25.4-6.8-33.8 3.5s-6.8 25.4 3.5 33.8C475.3 170.7 496 210.9 496 256s-20.7 85.3-53.2 111.8c-10.3 8.4-11.8 23.5-3.5 33.8s23.5 11.8 33.8 3.5c43.2-35.2 70.9-88.9 70.9-149s-27.7-113.8-70.9-149zm-60.5 74.5c-10.3-8.4-25.4-6.8-33.8 3.5s-6.8 25.4 3.5 33.8C393.1 227.6 400 241 400 256s-6.9 28.4-17.7 37.3c-10.3 8.4-11.8 23.5-3.5 33.8s23.5 11.8 33.8 3.5C434.1 312.9 448 286.1 448 256s-13.9-56.9-35.4-74.5zM80 352l48 0 134.1 119.2c6.4 5.7 14.6 8.8 23.1 8.8 19.2 0 34.8-15.6 34.8-34.8l0-378.4c0-19.2-15.6-34.8-34.8-34.8-8.5 0-16.7 3.1-23.1 8.8L128 160 80 160c-26.5 0-48 21.5-48 48l0 96c0 26.5 21.5 48 48 48z"],volumeXmark:[576,512,"M48 352l48 0 134.1 119.2c6.4 5.7 14.6 8.8 23.1 8.8 19.2 0 34.8-15.6 34.8-34.8l0-378.4c0-19.2-15.6-34.8-34.8-34.8-8.5 0-16.7 3.1-23.1 8.8L96 160 48 160c-26.5 0-48 21.5-48 48l0 96c0 26.5 21.5 48 48 48zM367 175c-9.4 9.4-9.4 24.6 0 33.9l47 47-47 47c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l47-47 47 47c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-47-47 47-47c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-47 47-47-47c-9.4-9.4-24.6-9.4-33.9 0z"],xmark:[384,512,"M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]},ia=Wi('<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path></path></svg>');function sa(t,e){et(e,!0);let i=br(e,"style",3,void 0);const s=Q("micrio"),r=jt(()=>"chevron-down"==e.name||"link-ext"==e.name),n=s.defaultSettings?.ui?.icons,a=jt(()=>n&&("zoom-in"==e.name?n.zoomIn:"zoom-out"==e.name?n.zoomOut:"maximize"==e.name?n.fullscreenEnter:"minimize"==e.name?n.fullscreenLeave:"close"==e.name?n.close:"arrow-right"==e.name?n.next:"arrow-left"==e.name?n.prev:"arrow-up"==e.name?n.up:"arrow-down"==e.name?n.down:"play"==e.name?n.play:"pause"==e.name?n.pause:"subtitles"==e.name?n.subtitles:"subtitles-off"==e.name?n.subtitlesOff:"volume-off"==e.name?n.muted:"volume-up"==e.name?n.unmuted:null)),o={play:ea.play,pause:ea.pause,close:ea.xmark,"play-filled":ea.playCircle,a11y:ea.globe,menu:ea.bars,"zoom-in":ea.plus,"zoom-out":ea.minus,maximize:ea.expand,minimize:ea.compress,"volume-off":ea.volumeXmark,"volume-up":ea.volumeHigh,subtitles:ea.closedCaptioning,"subtitles-off":ea.closedCaptioning,"arrow-left":ea.arrowLeft,"arrow-up":ea.arrowUp,"arrow-right":ea.arrowRight,"arrow-down":ea.arrowDown,video:ea.video,audio:ea.volumeHigh,image:ea.image,share:ea.share,error:ea.circleExclamation,"chevron-down":ea.chevronDown,link:ea.link,"link-ext":ea.externalLink,"ellipsis-vertical":ea.ellipsisVertical},h=jt(()=>o[e.name]);var c=Hi(),l=_e(c),d=t=>{var e=Hi();Ms(_e(e),()=>Ei(a),void 0,!0),Gi(t,e)},u=t=>{var e=ia();let s;var n=ke(e);q(e),Ye(()=>{ar(e,"viewBox",`0 0 ${Ei(h)[0]??""} ${Ei(h)[1]??""}`),s=qs(e,0,"svelte-fa micrio-icon",null,s,{small:Ei(r)}),Us(e,i()),ar(n,"d",Ei(h)[2])}),Gi(t,e)};vs(l,t=>{Ei(a)?t(d):Ei(h)&&t(u,1)}),Gi(t,c),it()}var ra=vt(void 0),na=()=>ra.set(void 0),aa=!1;ra.subscribe(t=>{t?aa||window.addEventListener("click",na):aa&&window.removeEventListener("click",na),aa=!!t});var oa=Bi('<a class="micrio-menu-action micrio-menu"><strong class="micrio-menu"> <!></strong></a>'),ha=Wi('<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="svelte-fa" style="height:1em;vertical-align:-.125em;margin-right:10px;"><path></path></svg>'),ca=Bi('<button class="micrio-menu-action micrio-menu" type="button"><!> <strong class="micrio-menu"> <!></strong></button>'),la=Bi('<div class="items micrio-menu"></div>'),da=Bi("<menu><!> <!></menu>");function ua(t,e){et(e,!0);const i=()=>xt(ra,"$opened",s),[s,r]=kt();let n=br(e,"menu",15),a=br(e,"originalId",3,null);const o=Q("micrio"),{events:h,state:c,_lang:l}=o;let d=ne(void 0);const u=jt(()=>{return t=n(),e=xt(l,"$_lang",s),t.i18n?.[e]??t;var t,e});function m(t){n().link||t.preventDefault(),n().action&&n().action();const i=!!(Ei(p)||n().action||n().link);ra.set(i?void 0:n()),i&&e.onclose?.()}ps(()=>{Ei(u)?.title||1!=n().children?.length||n(n().children[0]),n().action||(n().markerId?n(n().action=()=>{a()&&o.$current?.id!=a()&&o.open(a()),o.$current?.state.marker.set(n().markerId)},!0):(Ei(u)?.content||Ei(u)?.embed||n().image)&&n(n().action=()=>{h.dispatch("page-open",n()),c.popover.set({contentPage:n()})},!0)),n(n()._button=Ei(d),!0)});const g=t=>t==i()||!!t.children?.some(g),p=jt(()=>i()&&g(n()));var f=da();let v;var w=ke(f),y=t=>{var e=oa(),i=ke(e),s=ke(i),r=Me(s);{let t=jt(()=>n().linkTargetBlank?"link-ext":"link");sa(r,{style:"opacity:.75",get name(){return Ei(t)}})}q(i),q(e),Ye(()=>{ar(e,"href",n().link),ar(e,"target",n().linkTargetBlank?"_blank":void 0),ns(s,`${Ei(u)?.title??"(Unknown)"??""} `)}),Ri("click",e,m),Gi(t,e)},b=t=>{var e=ca(),i=ke(e),s=t=>{var e=ha(),i=ke(e);q(e),Ye(()=>{ar(e,"viewBox",`0 0 ${n().icon[0]??""} ${n().icon[1]??""}`),ar(i,"d",n().icon[2])}),Gi(t,e)};vs(i,t=>{n().icon&&t(s)});var r=Me(i,2),a=ke(r),o=Me(a),h=t=>{sa(t,{name:"chevron-down"})};vs(o,t=>{n().children&&n().children.length&&t(h)}),q(r),q(e),fr(e,t=>oe(d,t),()=>Ei(d)),Ye(()=>ns(a,`${Ei(u)?.title??"(Unknown)"??""} `)),Ri("click",e,m),Gi(t,e)};vs(w,t=>{n().link?t(y):t(b,-1)});var x=Me(w,2),T=t=>{var e=la();bs(e,23,()=>n().children,(t,e)=>e+t.id,(t,e)=>{ua(t,{get menu(){return Ei(e)},get originalId(){return a()},onclose:na})}),q(e),Gi(t,e)};vs(x,t=>{n().children&&n().children.length&&t(T)}),q(f),Ye(t=>{ar(f,"data-title",t),v=qs(f,1,"micrio-menu",null,v,{opened:Ei(p)})},[()=>Ei(u)?.title?.toLowerCase()]),Gi(t,f),it(),r()}Xi(["click"]);var ma=Bi('<img alt="Icon" class="micrio-button"/>'),ga=Bi("<!><!>",1);function pa(t,e){et(e,!0);let i=br(e,"type",3,void 0),s=br(e,"icon",3,void 0),r=br(e,"title",3,null),n=br(e,"disabled",3,!1),a=br(e,"active",3,!1),o=br(e,"className",3,""),h=br(e,"href",3,void 0),c=br(e,"blankTarget",3,!1),l=br(e,"noClick",3,!1);var d=Hi();Os(_e(d),()=>h()?"a":"button",!1,(t,d)=>{var u=t=>e.onclick?.(t),m=t=>e.onfocus?.(t),g=t=>e.onpointerdown?.(t);hr(t,()=>({href:h(),target:c()?"_blank":void 0,disabled:!!n()||void 0,title:r(),"aria-label":r(),role:h()?void 0:"button",tabindex:h()?void 0:0,class:`micrio-button ${i()??""??""} ${o()??""}`,onclick:u,onfocus:m,onpointerdown:g,[js]:{active:a(),"no-click":l()}}),void 0,void 0,void 0,"micrio-button");var p=ga(),v=_e(p),w=t=>{sa(t,{get name(){return i()}})},y=t=>{var e=ma();Ye(()=>ar(e,"src",s().src)),Gi(t,e)};vs(v,t=>{i()?t(w):s()&&t(y,1)}),gs(Me(v),()=>e.children??f),Gi(d,p)}),Gi(t,d),it()}var fa=Bi("<menu><!> <!> <!></menu> <!>",1);function va(t,e){et(e,!0);const i=()=>xt(c,"$current",r),s=()=>xt(l,"$_lang",r),[r,n]=kt();let a=ne(void 0);const o=Q("micrio"),{state:h,current:c,_lang:l,spaceData:d}=o,{tour:u,marker:m,popover:g}=h;let p=ne(!1),f=ne(!1);const v=i().id;let w=ne(void 0),y=ne(window.innerWidth<=500);const b=()=>oe(y,window.innerWidth<=500),x=()=>{Ei(y)&&oe(p,!1)},T=jt(()=>!!xt(u,"$tour",r)||!!xt(m,"$marker",r)||!!xt(g,"$popover",r)),k=jt(()=>(Ei(a)?.markerTours??[]).concat(d?.markerTours??[])),_=jt(()=>Ei(k)?.length>0),M=jt(()=>Ei(a)?.tours&&Ei(a)?.tours?.length>0),S=jt(()=>Ei(_)&&Ei(M)),E=jt(()=>!(Ei(w)?.length||Ei(_)||Ei(M))),I=[],A=(t,e)=>("title"in t?t.title:t.i18n?.[e]?.title)??"(Untitled)";ps(()=>{const t=o.current.subscribe(t=>{if(t){for(;I.length;)I.shift()?.();en(t.info).then(()=>oe(f,!t.$settings.noLogo)),I.push(t.data.subscribe(t=>{oe(a,t,!0),Si().then(()=>{if(!t?.pages)return;Ei(w)||oe(w,t.pages?.filter(t=>!t.id?.startsWith("_")),!0);const e=t.pages?.filter(t=>t.id?.startsWith("_"));e.length&&oe(w,[...Ei(w)?.filter(t=>!t.id?.startsWith("_"))??[],...e],!0)})}))}});return window.addEventListener("resize",b),()=>{for(window.removeEventListener("resize",b);I.length;)I.shift()?.();t()}});var L=Hi(),P=_e(L),$=t=>{var e=fa(),n=_e(e);let h;var c=ke(n),l=t=>{var e=Hi();bs(_e(e),17,()=>Ei(w),t=>t.id,(t,e)=>{ua(t,{get menu(){return Ei(e)},get originalId(){return v},onclose:x})}),Gi(t,e)};vs(c,t=>{Ei(w)&&t(l)});var d=Me(c,2),m=t=>{{let e=jt(()=>({id:Hr(),i18n:{[s()]:{title:Ei(S)?"Marker tours":"Tours"}},children:Ei(k).map(t=>({id:Hr(),i18n:{[s()]:{title:A(t,s())}},action:()=>{t.initialStep=0,u.set(t)}}))}));ua(t,{onclose:x,get menu(){return Ei(e)}})}};vs(d,t=>{Ei(_)&&t(m)});var g=Me(d,2),b=t=>{{let e=jt(()=>({id:Hr(),i18n:{[s()]:{title:Ei(S)?"Video tours":"Tours"}},children:Ei(a)&&Ei(a).tours?Ei(a).tours.map(t=>({id:Hr(),i18n:{[s()]:{title:A(t,s())}},action:()=>{i()&&i().id!=v&&o.open(v),u.set(t)}})):[]}));ua(t,{onclose:x,get menu(){return Ei(e)}})}};vs(g,t=>{Ei(M)&&t(b)}),q(n);var E=Me(n,2),I=t=>{{let e=jt(()=>Ei(p)?"close":"ellipsis-vertical"),i=jt(()=>"toggle transparent"+(Ei(f)?" indent":""));pa(t,{get title(){return xt(Jn,"$i18n",r).menuToggle},get type(){return Ei(e)},get className(){return Ei(i)},onclick:()=>oe(p,!Ei(p))})}};vs(E,t=>{Ei(y)&&t(I)}),Ye(()=>h=qs(n,1,"micrio-toolbar micrio-toolbar",null,h,{shown:!Ei(T)&&Ei(p),indent:Ei(f)})),Ds(3,n,()=>qn,()=>({duration:200})),Gi(t,e)};vs(P,t=>{Ei(E)||Ei(T)||t($)}),Gi(t,L),it(),n()}var wa=Bi("<canvas></canvas>");function ya(t,e){et(e,!0);const[i,s]=kt(),r=Q("micrio"),{current:n}=r,a=Li(()=>e.image).$info,o=Li(()=>e.image).camera,h=Li(()=>e.image).$settings,c=h.minimapWidth??200,l=h.minimapHeight??160,d=!h.alwaysShowMinimap,u=!!h.noControls,m=a.width/a.height,g=c/m>l?Math.round(l*m):c,p=c/m<=l?Math.round(c/m):l;let f,v=ne(void 0),w=ne(!1),y=ne(ue(!a.is360&&o.isZoomedOut()));function b(t){if(!t||!f)return;I();const i=rn.toCenterJSON(t);if(f.clearRect(0,0,g,p),e.image.thumbSrc?(f.globalCompositeOperation="source-over",f.fillStyle="rgba(0,0,0,.5)",f.fillRect(0,0,g,p),f.globalAlpha=1,f.globalCompositeOperation="destination-out"):(f.fillStyle="rgba(0,0,0,.5)",f.fillRect(0,0,g,p)),f.beginPath(),f.fillStyle="white",a.is360){const e=function(t){const e=[];let{centerX:i,centerY:s,width:r,height:n}=rn.toCenterJSON(t);i=(i%1+1)%1;let a=i-r/2,o=i+r/2;const h=Math.max(0,s-n/2),c=Math.min(1,s+n/2);return a<0?(e.push({x:a+1,y:h,width:1-(a+1),height:c-h}),e.push({x:0,y:h,width:o,height:c-h})):o>1?(e.push({x:a,y:h,width:1-a,height:c-h}),e.push({x:0,y:h,width:o-1,height:c-h})):e.push({x:a,y:h,width:o-a,height:c-h}),e}(t);for(const t of e)f.rect(Math.floor(t.x*g),Math.floor(t.y*p),Math.ceil(t.width*g),Math.ceil(t.height*p))}else oe(y,o.isZoomedOut(),!0),f.rect(Math.floor((i.centerX-i.width/2)*g),Math.floor((i.centerY-i.height/2)*p),Math.ceil(i.width*g),Math.ceil(i.height*p));e.image.thumbSrc&&(f.fill(),f.globalCompositeOperation="source-over"),f.stroke()}const x=-1!=navigator.userAgent.indexOf("Firefox");let T,k=ne(!1);let _,M=ne(void 0);function S(t){if(T){const e=Math.max(0,Math.min(1,(t.clientX-T.left)/T.width)),i=Math.max(0,Math.min(1,(t.clientY-T.top)/T.height));if(Ei(M)){const t=[e-Ei(M).width/2,i-Ei(M).height/2,Ei(M).width,Ei(M).height];o.setView(t)}else o.setCoo(e,i)}}function E(){window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",E),oe(k,!1),oe(M,void 0)}function I(){oe(w,!1),clearTimeout(_),_=setTimeout(()=>oe(w,!0),2500)}const A=-Li(()=>e.image).camera.rotationY/(2*Math.PI),L=self.crossOriginIsolated;let P=ne(ue(L?void 0:Li(()=>e.image).thumbSrc));const $={passive:!0};let C=ne(!1);ps(()=>{let t;f=Ei(v).getContext("2d"),f&&(f.lineWidth=1,f.strokeStyle="white"),L&&e.image.thumbSrc&&fetch(e.image.thumbSrc).then(t=>t.blob()).then(e=>oe(P,t=URL.createObjectURL(e),!0)),r.canvas.element.addEventListener("mousemove",I,$);const i=e.image.state.view.subscribe(b);return setTimeout(()=>oe(C,!0),10),()=>{t&&URL.revokeObjectURL(t),r.canvas.element.removeEventListener("mousemove",I,$),E(),i()}});const D=jt(()=>Ei(P)?`background-image: url('${Ei(P)}')`+(0!=A?`;background-position-x:${g*A}px`:""):null);var z=wa();let O;fr(z,t=>oe(v,t),()=>Ei(v)),Ye(()=>{ar(z,"width",g),ar(z,"height",p),Us(z,Ei(D)),O=qs(z,1,"micrio-minimap",null,O,{hidden:!Ei(C)||xt(n,"$current",i)!=e.image||d&&(Ei(y)||Ei(w)),dragging:Ei(k),controls:!u})}),Oi("wheel",z,function(t){o.zoom(t.deltaY*(x?50:1))}),Ri("mousedown",z,function(t){if(0!=t.button)return;window.addEventListener("mousemove",S),window.addEventListener("mouseup",E),T=Ei(v).getClientRects()[0];const e=o.getView();e&&oe(M,{width:e[2],height:e[3]},!0),S(t),oe(k,!0)}),Gi(t,z),it(),s()}Xi(["mousedown"]);var ba=Bi("<div><!></div>");function xa(t,e){let i=br(e,"className",3,"");var s=ba();gs(ke(s),()=>e.children??f),q(s),Ye(()=>qs(s,1,Vs(i()),"micrio-button-group")),Gi(t,s)}function Ta(t,e){et(e,!0);const[i,s]=kt(),r="requestFullscreen"in Li(()=>e.el),n="webkitRequestFullscreen"in Li(()=>e.el),a=Q("micrio"),o=()=>r?document.fullscreenElement:document.webkitFullscreenElement??null;let h=ne(o()===Li(()=>e.el));const c=r||n&&!o(),l=()=>new Promise(t=>setTimeout(t,500));let d;function u(){Ei(h)?async function(){r?(await document.exitFullscreen().then(l),d&&d instanceof HTMLElement&&d.requestFullscreen(),d=void 0):"webkitExitFullscreen"in document&&document.webkitExitFullscreen()}():async function(){r?(d=o(),Jr.safari&&d&&await document.exitFullscreen().then(l),e.el.requestFullscreen()):"webkitRequestFullscreen"in e.el&&e.el.webkitRequestFullscreen()}()}const m=Li(()=>e.el)==a&&!a.events.scrollHooked,g=()=>{oe(h,o()===e.el),m&&(Ei(h)?a.events.hookScroll():a.events.unhookScroll())};c&&ps(()=>{const t=r?"fullscreenchange":"webkitfullscreenchange";return document.addEventListener(t,g),()=>document.removeEventListener(t,g)});var p=Hi(),f=_e(p),v=t=>{{let e=jt(()=>Ei(h)?"minimize":"maximize");pa(t,{get type(){return Ei(e)},get title(){return xt(Jn,"$i18n",i).fullscreenToggle},onclick:u})}};vs(f,t=>{c&&t(v)}),Gi(t,p),it(),s()}var ka=Bi("<!> <!>",1);function _a(t,e){et(e,!0);const i=()=>xt(Jn,"$i18n",s),[s,r]=kt();let n=br(e,"image",15,void 0);const a=Q("micrio");let o=ne(!1),h=ne(!1),c=ne(!1),l=ne(!1);const d=()=>{a.events.clicked=!0},u=()=>{d(),n()?.camera.zoomIn().then(()=>a.events.clicked=!1)},m=()=>{d(),n()?.camera.zoomOut().then(()=>a.events.clicked=!1)};function g(){oe(o,n()?.camera.isZoomedIn()??!0,!0),oe(h,n()?.camera.isZoomedOut(!0)??!0,!0);const t=n()?.camera.getMinScale()??0;oe(c,t>1&&t>(n()?.$settings.zoomLimit??1),!0)}let p,f,v;const w=t=>{p&&(p(),p=void 0),n(t),t?p=t.state.view.subscribe(g):g()};ps(()=>(n()?p=n().state.view.subscribe(g):f=a.current.subscribe(t=>{if(v&&(v(),v=void 0),p&&(p(),p=void 0),oe(l,!0),!t)return n(void 0),void oe(l,!1);en(t.info).then(()=>Si()).then(()=>{t.album?.currentImage?v=t.album.currentImage.subscribe(w):w(t),oe(l,!1)})}),()=>{f&&f(),v&&v(),p&&p()}));var y=Hi(),b=_e(y),x=t=>{var e=ka(),s=_e(e);{let t=jt(()=>Ei(l)||Ei(o));pa(s,{type:"zoom-in",get title(){return i().zoomIn},get disabled(){return Ei(t)},onclick:u})}var r=Me(s,2);{let t=jt(()=>Ei(l)||Ei(h));pa(r,{type:"zoom-out",get title(){return i().zoomOut},get disabled(){return Ei(t)},onclick:m})}Gi(t,e)};vs(b,t=>{Ei(c)||Ei(o)&&Ei(h)||t(x)}),Gi(t,y),it(),r()}var Ma=Bi('<menu class="popout micrio-controls"><!> <!></menu>'),Sa=Bi("<!> <!> <!>",1),Ea=Bi("<!> <!>",1),Ia=Bi("<aside><!></aside>"),Aa=Bi("<aside><!> <!></aside> <!>",1);function La(t,e){et(e,!0);const i=()=>xt(m,"$current",c),s=()=>xt(Ei(k),"$info",c),r=()=>xt(f,"$_lang",c),n=()=>xt(v,"$tour",c),a=()=>xt(b,"$zoom",c),o=()=>xt(p,"$isMuted",c),h=()=>xt(Jn,"$i18n",c),[c,l]=kt();let d=br(e,"hasAudio",3,!1);const u=ue(Q("micrio")),{current:m,state:g,isMuted:p,_lang:f}=u,{tour:v,popup:w}=g,{controls:y,zoom:b,hidden:x,hover:T}=u.state.ui,k=jt(()=>i()?.info),_=jt(()=>s()&&i()?i().isV5?Object.keys(s().revision??{[r()]:0}):("cultures"in s()?s().cultures:"")?.split(",")??[]:[]),M=jt(()=>n()&&"steps"in n()&&n().isSerialTour);function S(){if(navigator.share&&i()?.$info){const t=i().$data?i().$data?.i18n?i().$data.i18n[r()]:i().$data:void 0;navigator.share({title:i().$info?.title,text:t?.description||`${i().$info.width} x ${i().$info.height} | Micrio`,url:location.href})}}let E=ne(null),I=ne(!1);function A(t){const e=t.detail;oe(I,u.canvas.viewport.portrait,!0),e.opts.isPassive||oe(E,e,!0)}function L(){oe(E,null)}let P=ne(!1),$=ne(!1),C=ne(!1);function D(t){b.set(!t.noZoom),y.set(!t.noControls),oe(P,!!t.ui?.controls?.cultureSwitch),oe($,!!t.social),oe(C,!!t.fullscreen)}i()&&D(i().$settings),ps(()=>{let t;u.addEventListener("splitscreen-start",A),u.addEventListener("splitscreen-stop",L);const e=u.current.subscribe(e=>{e&&en(e.info).then(i=>{!i||n()&&"steps"in n()||(t?.(),t=e.settings.subscribe(D))})});return()=>{u.removeEventListener("splitscreen-start",A),u.removeEventListener("splitscreen-stop",L),t?.(),e()}});const z=jt(()=>"micrioAudioContext"in window||d()),O=jt(()=>Ei(P)&&Ei(_).length>1),R=jt(()=>Ei($)&&"share"in navigator),X=jt(()=>Ei(C)&&!Ei(M)),F=jt(()=>xt(y,"$controls",c)&&(Ei(z)||Ei(O)||Ei(R)||a()||Ei(X))),V=jt(()=>xt(w,"$popup",c)&&u.canvas.$isMobile);var Y=Hi(),N=_e(Y),B=t=>{var e=Aa(),i=_e(e);let s;var n=ke(i),l=t=>{var e=Sa(),i=_e(e),s=t=>{{let e=jt(()=>o()?"volume-off":"volume-up"),i=jt(()=>o()?h().audioUnmute:h().audioMute);pa(t,{get type(){return Ei(e)},get title(){return Ei(i)},onclick:()=>p.set(!o())})}};vs(i,t=>{Ei(z)&&t(s)});var n=Me(i,2),a=t=>{var e=Ma(),i=ke(e);pa(i,{get title(){return h().switchLanguage},type:"a11y"}),bs(Me(i,2),17,()=>Ei(_),ws,(t,e)=>{{let i=jt(()=>Qn?.of(Ei(e))??Ei(e)),s=jt(()=>Ei(e)==r());pa(t,{onclick:()=>u.lang=Ei(e),get title(){return Ei(i)},get active(){return Ei(s)},children:(t,i)=>{W();var s=Ui();Ye(t=>ns(s,t),[()=>Ei(e).toUpperCase()]),Gi(t,s)},$$slots:{default:!0}})}}),q(e),Gi(t,e)};vs(n,t=>{Ei(O)&&t(a)});var c=Me(n,2),l=t=>{pa(t,{type:"share",get title(){return h().share},onclick:S})};vs(c,t=>{Ei(R)&&t(l)}),Gi(t,e)};vs(n,t=>{Ei(V)||t(l)}),xa(Me(n,2),{children:(t,e)=>{var i=Ea(),s=_e(i),r=t=>{var e=Hi(),i=_e(e),s=t=>{_a(t,{get image(){return Ei(E)}})},r=t=>{_a(t,{})};vs(i,t=>{Ei(E)?t(s):t(r,-1)}),Gi(t,e)};vs(s,t=>{a()&&!Ei(V)&&t(r)});var n=Me(s,2),o=t=>{Ta(t,{get el(){return u}})};vs(n,t=>{Ei(X)&&t(o)}),Gi(t,i)},$$slots:{default:!0}}),q(i);var d=Me(i,2),m=t=>{var e=Ia();let i;xa(ke(e),{children:(t,e)=>{_a(t,{})},$$slots:{default:!0}}),q(e),Ye(()=>i=qs(e,1,"primary micrio-controls",null,i,{portrait:Ei(I)})),Ds(3,e,()=>qn),Gi(t,e)};vs(d,t=>{a()&&Ei(E)&&t(m)}),Ye(()=>s=qs(i,1,"micrio-controls",null,s,{hidden:xt(x,"$hidden",c)&&!xt(T,"$hover",c)})),Ri("pointerover",i,()=>T.set(!0)),Ri("pointerout",i,t=>{t.currentTarget.contains(t.relatedTarget)||T.set(!1)}),Ri("focusin",i,()=>T.set(!0)),Ri("focusout",i,t=>{t.currentTarget.contains(t.relatedTarget)||T.set(!1)}),Gi(t,e)};vs(N,t=>{Ei(F)&&t(B)}),Gi(t,Y),it(),l()}Xi(["pointerover","pointerout","focusin","focusout"]);var Pa=class{constructor(t,e){this.image=t,this.data=e,this.timeline=[],this._paused=!0,this.playing=!1,this.wasPaused=!1,this.unhookEvents=!1,this.micrio=t.engine.micrio;const i="timeline"in e?e:e.i18n?.[wt(this.micrio._lang)]??void 0;if(!i)throw new Error("No valid content for video tour!");this.content=i,this.unhookEvents=!e.keepInteraction&&this.micrio.events.$enabled,e.instance=this,this.read(),this.micrio.events.dispatch("videotour-start",this.data)}destroy(){this.unhookEvents&&this.micrio.events.enabled.set(!0),this.playing&&(this.image.camera.stop(),this.micrio.removeAttribute("data-videotour-playing"),this.micrio.events.dispatch("videotour-stop",this.data),this.playing=!1,delete this.startedAt,delete this.data.instance,this.startAt=void 0,clearTimeout(this._to))}read(){const t=this.data.i18n?1:this.content.duration,e=this.content.timeline;this.timeline.length=0;for(let i=0;i<e.length;i++){const s=e[i],r=e[i-1],n=r?r.end*t:0;this.timeline.push({view:this.data.isLegacy?rn.fromLegacy(s.rect):s.rect,start:1e3*n,duration:1e3*(s.start*t-n),pauseDuration:(s.end-s.start)*t*1e3})}this.startedAt&&!this.playing&&(this.progress=this.currentTime)}get duration(){return Number(this.content.duration)}set duration(t){this.content.duration=t}get paused(){return this._paused}get ended(){return this.currentTime>=this.duration}get currentTime(){return(this.pausedAt?this.pausedAt:this.startedAt?Date.now()-this.startedAt:0)/1e3}set currentTime(t){this.setProgress(t/this.content.duration)}get progress(){return this.currentTime/this.content.duration}set progress(t){this.setProgress(t)}play(){this.startedPlaying(),this.wasPaused=!1,this.pausedAt?(this.startedAt=Date.now()-this.pausedAt,this._paused=!1,this.gotoTime(this.pausedAt),this.pausedAt=void 0):this.playing||(this.startedAt=Date.now(),void 0===this.startAt?this.gotoStep(0,0):this.gotoTime(this.duration*this.startAt*1e3),this.startAt=void 0),this._paused=!1,this.playing=!0}pause(){this._paused||null==this.currentIndex||null==this.startedAt||(this._paused=!0,this.stoppedPlaying(),clearTimeout(this._to),this.currentIndex>=0&&this.image.camera.stop(),this.ended?this.reset():this.pausedAt=Date.now()-this.startedAt)}reset(){this.stoppedPlaying(),this.pausedAt=void 0,this.playing=!1,this.read()}gotoStep(t,e){if(null==this.startedAt)return;if(clearTimeout(this._to),!this.timeline[t]){if(!this.paused||!this.wasPaused){const t=Math.max(0,Math.round(1e3*this.duration-(Date.now()-this.startedAt)));this._to=setTimeout(()=>this.pause(),t)}return}const i=this.timeline[t],s=Math.round(i.start-(Date.now()-this.startedAt));this.currentIndex=t,this.image.camera.stop(),s>0?this._paused||(this._to=setTimeout(()=>this.startAni(e),s)):this.startAni(e)}nextStep(){null!=this.currentIndex&&this.gotoStep(this.currentIndex+1)}getView(t){return this.timeline[t]?.view}startAni(t=0){if(null==this.currentIndex||isNaN(t))return;const e=this.timeline[this.currentIndex];if(null==e)return;const i=rn.toCenterJSON(e.view),s=this.getView(this.currentIndex-1),r=s?rn.toCenterJSON(s):void 0,n=this.image.opts?.area;if(this.wasPaused&&r){const e=this.micrio.engine.ease(t),s={centerX:r.centerX*(1-e)+i.centerX*e,centerY:r.centerY*(1-e)+i.centerY*e,width:r.width*(1-e)+i.width*e,height:r.height*(1-e)+i.height*e};this.image.camera.setView([s.centerX-s.width/2,s.centerY-s.height/2,s.width,s.height],{noLimit:!0,area:n}),this.nextStep()}else this.image.camera.flyToView(e.view,{duration:e.duration,progress:t,prevView:r?[r.centerX-r.width/2,r.centerY-r.height/2,r.width,r.height]:void 0,area:n}).then(()=>{null!=this.currentIndex&&e==this.timeline[this.currentIndex]&&this.nextStep()}).catch(()=>{})}startedPlaying(){this.micrio.setAttribute("data-videotour-playing",""),this.micrio.events.dispatch("videotour-play"),this.unhookEvents&&this.micrio.events.enabled.set(!1)}stoppedPlaying(){this.micrio.removeAttribute("data-videotour-playing"),this.micrio.events.dispatch("videotour-pause"),this.unhookEvents&&this.micrio.events.enabled.set(!0)}setProgress(t){t=Math.max(0,Math.min(1,t)),this.wasPaused=!!this.paused||!this.playing,this.pause(),this.wasPaused||(this._paused=!1,this.startedPlaying());const e=this.duration*t*1e3;this.pausedAt=e,this.gotoTime(e),this.wasPaused?this.pause():(this.pausedAt=void 0,this._paused=!1)}gotoTime(t){let e=null,i=0;for(;i<this.timeline.length&&!(this.timeline[i].start>t);i++)e=this.timeline[i];if(i--,e||!(i>0))if(e){this.image.camera.stop();const s=e.duration>0?(t-e.start)/e.duration:0;this.startedAt=Date.now()-e.start-e.duration*s,isNaN(this.startedAt)&&(this.startedAt=Date.now()-t),s>1?(this.gotoStep(i+1),null!=e.view&&this.image.camera.setView(e.view,{noLimit:!0})):(i>0&&this.image.camera.setView(this.timeline[i-1].view,{noLimit:!0}),this.gotoStep(i,s))}else this.timeline.length&&this.image.camera.stop(),this.paused||this.gotoStep(0)}};window.MicrioVideoTour=Pa;var $a={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5},Ca=class{constructor(t,e,i={}){this.frame=t,this.config=e,this.callbacks=i,this.requiresTimeTick=!0,this.destroyed=!1}async initialize(){if("YT"in window||await tn("https://r2.micr.io/youtube.js","onYouTubeIframeAPIReady"),!("YT"in window))throw new Error("Failed to load YouTube API");return new Promise((t,e)=>{this.player=new window.YT.Player(this.frame,{host:Xn,width:this.config.width.toString(),height:this.config.height.toString(),playerVars:{controls:0},events:{onError:()=>{this.callbacks.onError?.(new Error("YouTube player error")),e(new Error("YouTube player error"))},onReady:()=>{this.destroyed?e(new Error("Player destroyed during initialization")):(this.callbacks.onReady?.(),this.callbacks.onDurationChange?.(this.player.getDuration()),t())},onStateChange:t=>this.handleStateChange(t.data)}})})}handleStateChange(t){switch(t){case $a.UNSTARTED:this.callbacks.onBlocked?.(),this.callbacks.onPause?.();break;case $a.ENDED:this.callbacks.onEnded?.();break;case $a.PLAYING:this.callbacks.onPlay?.(),this.callbacks.onSeeked?.();break;case $a.PAUSED:this.callbacks.onPause?.();break;case $a.BUFFERING:this.callbacks.onBuffering?.(),this.callbacks.onSeeking?.()}}async play(){this.player?.playVideo()}pause(){this.destroyed||this.player?.pauseVideo?.()}async getCurrentTime(){return this.player?.getCurrentTime?.()??0}setCurrentTime(t){this.callbacks.onSeeking?.(),this.player?.seekTo?.(t)}async getDuration(){return this.player?.getDuration?.()??0}async isPaused(){if(!this.player)return!0;const t=this.player.getPlayerState?.();return void 0===t||[$a.UNSTARTED,$a.ENDED,$a.PAUSED].includes(t)}setMuted(t){t?this.player?.mute?.():this.player?.unMute?.()}setVolume(t){}destroy(){this.destroyed=!0,this.player?.destroy?.(),this.player=void 0}},Da=class{constructor(t,e,i={}){this.frame=t,this.config=e,this.callbacks=i,this.requiresTimeTick=!1,this.destroyed=!1}async initialize(){if("Vimeo"in window||await tn("https://r2.micr.io/vimeo.min.js"),!("Vimeo"in window))throw new Error("Failed to load Vimeo API");return new Promise((t,e)=>{this.player=new window.Vimeo.Player(this.frame,{width:this.config.width.toString(),height:this.config.height.toString(),title:!1,autoplay:!1});const i=this.player;i.on("error",()=>{this.callbacks.onError?.(new Error("Vimeo player error")),e(new Error("Vimeo player error"))}),i.on("loaded",()=>{this.destroyed?e(new Error("Player destroyed during initialization")):i.getVolume().then(()=>{this.callbacks.onReady?.(),t()})}),i.on("play",()=>{this.callbacks.onPlay?.(),this.callbacks.onSeeked?.()}),i.on("bufferstart",()=>{this.callbacks.onBuffering?.(),this.callbacks.onSeeking?.()}),i.on("seeked",()=>{this.callbacks.onSeeked?.()}),i.on("pause",()=>{this.callbacks.onPause?.()}),i.on("timeupdate",t=>{t&&(this.callbacks.onDurationChange?.(t.duration),this.callbacks.onTimeUpdate?.(t.seconds))}),i.on("ended",()=>{this.callbacks.onEnded?.()})})}async play(){this.player?.play()}pause(){this.player?.pause()}async getCurrentTime(){return await(this.player?.getCurrentTime?.())??0}setCurrentTime(t){this.player?.setCurrentTime?.(t)}async getDuration(){return await(this.player?.getDuration?.())??0}async isPaused(){return await(this.player?.getPaused?.())??!0}setMuted(t){this.player?.setVolume?.(t?0:1)}setVolume(t){this.player?.setVolume?.(Math.max(0,Math.min(1,t)))}destroy(){if(this.destroyed=!0,this.player){for(const t of["error","loaded","play","bufferstart","seeked","pause","volumechange","timeupdate","ended"])this.player.off(t);this.player.destroy(),this.player=void 0}}},za=class{constructor(t,e={}){this.element=t,this.callbacks=e,this.requiresTimeTick=!1,this.attachEventListeners()}attachEventListeners(){const t=this.element,e=this.callbacks;e.onPlay&&t.addEventListener("play",e.onPlay),e.onPause&&t.addEventListener("pause",e.onPause),e.onEnded&&t.addEventListener("ended",e.onEnded),e.onSeeking&&t.addEventListener("seeking",e.onSeeking),e.onSeeked&&t.addEventListener("seeked",e.onSeeked),e.onTimeUpdate&&t.addEventListener("timeupdate",()=>e.onTimeUpdate?.(t.currentTime)),e.onDurationChange&&t.addEventListener("durationchange",()=>e.onDurationChange?.(t.duration)),e.onError&&t.addEventListener("error",()=>e.onError?.(new Error("Media playback error"))),e.onReady&&t.addEventListener("canplay",e.onReady)}async play(){try{await this.element.play()}catch(t){throw t instanceof Error&&!/pause\(\)/.test(t.message)&&this.callbacks.onBlocked?.(),t}}pause(){this.element.pause()}async getCurrentTime(){return this.element.currentTime}setCurrentTime(t){this.element.currentTime=t}async getDuration(){return this.element.duration}async isPaused(){return this.element.paused}setMuted(t){this.element.muted=t}setVolume(t){this.element.volume=Math.max(0,Math.min(1,t))}destroy(){const t=this.element,e=this.callbacks;e.onPlay&&t.removeEventListener("play",e.onPlay),e.onPause&&t.removeEventListener("pause",e.onPause),e.onEnded&&t.removeEventListener("ended",e.onEnded),e.onSeeking&&t.removeEventListener("seeking",e.onSeeking),e.onSeeked&&t.removeEventListener("seeked",e.onSeeked)}},Oa=class{constructor(t,e,i={}){this.element=t,this.hlsSrc=e,this.callbacks=i,this.requiresTimeTick=!1,this.destroyed=!1}async initialize(){if("Hls"in window||await tn("https://r2.micr.io/hls-1.6.15.min.js",void 0,"Hls"in window?{}:void 0),!("Hls"in window))throw new Error("Failed to load HLS.js");if(this.destroyed)throw new Error("Adapter destroyed during initialization");const t=new window.Hls({abrEwmaDefaultEstimate:1e7,abrEwmaDefaultEstimateMax:5e7});this.hls=t,t.loadSource(this.hlsSrc),t.attachMedia(this.element),this.html5Adapter=new za(this.element,this.callbacks),this.callbacks.onReady?.()}async play(){return this.html5Adapter?.play()}pause(){this.html5Adapter?.pause()}async getCurrentTime(){return this.html5Adapter?.getCurrentTime()??Promise.resolve(0)}setCurrentTime(t){this.html5Adapter?.setCurrentTime(t)}async getDuration(){return this.html5Adapter?.getDuration()??Promise.resolve(0)}async isPaused(){return this.html5Adapter?.isPaused()??Promise.resolve(!0)}setMuted(t){this.html5Adapter?.setMuted(t)}setVolume(t){this.html5Adapter?.setVolume(t)}destroy(){this.destroyed=!0,this.html5Adapter?.destroy(),this.hls?.destroy(),this.hls=void 0,this.html5Adapter=void 0}},Ra="micrio-captions-disable",Xa=vt("1"!=localStorage.getItem(Ra));Xa.subscribe(t=>{t?localStorage.removeItem(Ra):localStorage.setItem(Ra,"1")});var Fa=Bi('<div><p class="micrio-subtitles"> </p></div>');function Va(t,e){et(e,!0);const[i,s]=kt();let r=br(e,"raised",3,!1);const n=ue([]);fetch(Li(()=>e.src)).then(t=>t.text()).then(t=>{const e=t.split("\n");for(let i=0;i<e.length;i++)if(/-->/.test(e[i])){let t=i+1;const s=[];for(;!e[t]&&t<e.length;)t++;for(;e[t]&&e[t].trim();)s.push(e[t++]);const[r,a]=e[i].split(" --\x3e ").map(t=>t.trim().replace(",",".").split(":").map(Number)).map(t=>3===t.length?3600*t[0]+60*t[1]+t[2]:2===t.length?60*t[0]+t[1]:0);n.push({start:r,end:a,data:s.join("\n")}),i+=s.length+1}}).catch(t=>console.error("Subtitles: fetch error:",t));const a=Q("micrio");let o=ne(0);const h=t=>oe(o,t.detail,!0);ps(()=>(a.addEventListener("timeupdate",h),()=>a.removeEventListener("timeupdate",h)));const c=jt(()=>n.filter(t=>t.start<=Ei(o)&&t.end>=Ei(o)));var l=Hi(),d=_e(l),u=t=>{var e=Hi();bs(_e(e),16,()=>Ei(c),t=>t,(t,e)=>{var i=Fa();let s;var n=ke(i),a=ke(n,!0);q(n),q(i),Ye(()=>{s=qs(i,1,"micrio-subtitles",null,s,{raised:r()}),ns(a,e.data)}),Ds(3,i,()=>qn),Gi(t,i)}),Gi(t,e)};vs(d,t=>{xt(Xa,"$captionsEnabled",i)&&t(u)}),Gi(t,l),it(),s()}var Ya=Bi('<div class="container micrio-progress-bar"><div class="bars micrio-progress-bar"><!></div> <div class="time micrio-progress-bar"> </div></div>');function Na(t,e){et(e,!0);let i=br(e,"ended",11,!1);var s=Ya(),r=ke(s);gs(ke(r),()=>e.children??f),q(r);var n=Me(r,2),a=ke(n,!0);q(n),q(s),Ye((t,e)=>{Us(s,t),ns(a,e)},[()=>`--progress: ${Math.round((e.currentTime??0)/e.duration*1e4)/100}%;--time: '${jr(e.currentTime??0)}';`,()=>jr(i()||!e.currentTime||e.currentTime<=0?e.duration:(e.currentTime??0)-e.duration)]),Ri("click",s,t=>t.stopPropagation()),Ri("keydown",s,t=>t.stopPropagation()),Gi(t,s),it()}Xi(["click","keydown"]);var Ba=Wi('<svg height="42" width="42" class="micrio-media-controls"><circle r="19" cx="21" cy="21" class="micrio-media-controls"></circle></svg>'),qa=Bi("<!> <!> <!>",1),Wa=Bi('<div class="bar active"></div>'),Ua=Bi('<aside class="micrio-media-controls"><!> <!></aside> <!>',1);Xi(["click","keydown","mousedown"]);var Ha=Bi("<iframe></iframe>"),Ga=Bi('<source type="video/mp4;codecs=hvc1"/>'),ja=Bi("<!> <source/>",1),Za=Bi('<video playsinline="" class="micrio-media"><!></video>',2),Ja=Bi("<audio></audio>"),Ka=Bi("<micr-io></micr-io>",2),Qa=Bi("<aside><!></aside>"),to=Bi('<figcaption class="micrio-media"></figcaption>'),eo=Bi('<div class="show-play micrio-media" role="button"><!></div>'),io=Bi('<figure><div role="button"><!> <!> <!></div> <!></figure> <!>',1);function so(t,e){et(e,!0);const i=()=>xt(R,"$_lang",s),[s,r]=kt(),n=Q("micrio");let a=br(e,"src",11,void 0),o=br(e,"volume",15,1),h=br(e,"width",3,640),c=br(e,"height",3,380),l=br(e,"frameScale",3,1),d=br(e,"autoplay",15,!1),u=br(e,"loop",3,!1),m=br(e,"loopDelay",3,void 0),g=br(e,"controls",15,!1),p=br(e,"title",3,void 0),f=br(e,"figcaption",3,null),v=br(e,"paused",15,!0),w=br(e,"forcePause",3,void 0),y=br(e,"seeking",15,!0),b=br(e,"duration",31,()=>-1),x=br(e,"currentTime",15),T=br(e,"is360",3,!1),k=br(e,"tour",3,null),_=br(e,"secondary",3,!1),M=br(e,"fullscreen",3,void 0),S=br(e,"className",3,null),E=br(e,"hasTransparentH265",3,!1),I=br(e,"noPlayOverlay",3,!1),A=br(e,"uuid",15,""),L=br(e,"image",19,()=>wt(n.current)),P=br(e,"destroying",3,void 0),$=br(e,"_media",15,void 0),C=ne(!1);A(A()+(a()??Li(()=>k())?.id));const D=Li(()=>L()).$info,{events:z,state:O,_lang:R}=n,X=Q("volume"),F=0==xt(X,"$mainVolume",s),Y=Q("srt"),N=Q("mediaPaused"),B=n.hasAttribute("data-native-frame"),W=function(t,e,i=!1,s=0){t=function(t){if(t)return/<iframe /.test(t)&&(t=t.replace(/^.* src="([^"]+)".*$/,"$1")),t.startsWith("video://")&&(t=t.replace("video:","https:")),t}(t);const r=t?.toLowerCase(),n={type:Cn.None,originalSrc:t,isCloudflare:!1};if(!t&&e)return n.type=Cn.VideoTour,n;if(!t||!r)return n;if(t.startsWith("cfvid://"))return n.isCloudflare=!0,n.cloudflareId=t.slice(8),n.hlsSrc=`https://videodelivery.net/${n.cloudflareId}/manifest/video.m3u8`,n.type=Cn.Video,n;if(r.endsWith(".mp3"))return n.type=Cn.Audio,n.src=t,n;if(r.endsWith(".mp4")||r.endsWith(".webm"))return n.type=Cn.Video,n.src=t,n;if(r.startsWith("micrio://"))return n.type=Cn.Micrio,n.micrioEmbed=t.slice(9).split(","),n;if(!i){const e=zn.exec(t);if(e?.[5]){if("playlist"!==e[5]){n.type=Cn.IFrame,n.frameType=Dn.YouTube,n.youtubeId=e[5];const i=Rn.test(t)?Number(t.replace(Rn,"$1")):s;return n.startTime=Math.round(i),n.src=`${Xn}/embed/${e[5]}?autoplay=0&enablejsapi=1&controls=0&start=${n.startTime}`,n}{const e=/list=([^&]+)/.exec(t);if(e?.[1])return n.type=Cn.IFrame,n.src=`${Xn}/embed/videoseries?list=${e[1]}`,n}}if(On.test(t)){const e=t.match(/\/(\d+)/);if(e?.[1]){n.type=Cn.IFrame,n.frameType=Dn.Vimeo,n.vimeoId=e[1],n.vimeoToken=t.slice(t.indexOf(e[1])+e[1].length+1).replace(/\?.*$/,"")||void 0;const i=Math.round(s);return n.src=`https://player.vimeo.com/video/${e[1]}?${n.vimeoToken?`h=${n.vimeoToken}&`:""}title=0&portrait=0&sidedock=0&byline=0&controls=0#t=${i}s`,n}}}return r.startsWith("http")?(n.type=Cn.IFrame,n.src=t,n):n}(a(),Li(()=>k()),B,x()??0),{type:U,frameType:H,isCloudflare:G,micrioEmbed:j,hlsSrc:Z}=W;let J,K=ne(ue(W.src??a()));U==Cn.Micrio&&v(!1),(U==Cn.Micrio||U==Cn.IFrame&&!H)&&g(!1);let tt=-1,st=ne(ue(H==Dn.YouTube||H==Dn.Vimeo));const rt=U==Cn.Audio&&Jr.iOS;let nt,at=ne(void 0);const ot=O.mediaState.get(A());ot&&(x(ot.currentTime),d(!v(ot.paused))),O.mediaState.set(A(),{get currentTime(){return x()??0},set currentTime(t){Et(t)},get paused(){return v()},set paused(t){t?yt():vt()}});let ht=ne(void 0);{const t=Li(()=>k());if(t){const e=new Pa(Li(()=>L()),t);null!=x()&&x()>0&&(e.currentTime=x()),U==Cn.VideoTour&&(b("duration"in t?Number(t.duration):t.i18n?.[i()]?.duration??0),o(NaN)),oe(ht,e,!0)}}const ct=Li(()=>k()&&!("steps"in k())?"subtitle"in k()?k().subtitle:k().i18n?.[n.lang]?.subtitle:void 0),lt=ct&&("fileUrl"in ct?ct.fileUrl:ct.src);let dt,ut=ne(!1),mt=ne(!1),gt=!1,pt=ne(!1);function ft(t){t&&"button"in t&&0!=t.button||(v()?vt():yt())}async function vt(t){if(!(t instanceof PointerEvent&&0!=t.button)&&(!gt||await async function(){return $()?$().paused:Ei(ht)?v():!!J&&J.isPaused()}())){switch(oe(mt,!1),b()>0&&null!=x()&&x()>=b()&&x(0),!_()&&lt&&Y.set(lt),U){case Cn.VideoTour:v(y(!1)),Ei(ht)?.play(),Lt();break;case Cn.Audio:case Cn.Video:$()?.addEventListener("play",()=>{$()&&(isNaN($().duration)?$().addEventListener("durationchange",bt,{once:!0}):bt())},{once:!0}),$()?.play().catch(t=>{I()?v(!0):/pause\(\)/.test(t.toString())||(oe(ut,!0),n.events.dispatch("media-blocked"),e.onblocked?.())});break;case Cn.IFrame:J?.play();break;default:return}gt=!0,z.dispatch("media-play"),N.set(!1),e.onplay?.(),T()||F||Ei(ht)&&!$()||X.set(L().$settings.mutedVolume||0)}}function yt(){z.dispatch("media-pause"),N.set(!0),$()?($().pause(),rt&&v(!0)):Ei(ht)?(Ei(ht).pause(),v(!0),Pt()):J&&!Ei(Ot)&&J.pause()}function bt(){oe(ut,!1),v(!1),Ei(ht)&&$()&&($().duration>Ei(ht).duration&&(Ei(ht).duration=$().duration),Ei(ht).currentTime=$().currentTime,Ei(ht).play())}function Tt(){y(!1),T()&&L()&&!L()._video&&L().video.set($())}function _t(){Ei(mt)||(Ei(ht)?yt():(v(!0),Pt()),oe(mt,!0),z.dispatch("media-ended"),e.onended?.(),zt())}function Mt(t){$()?$($().muted=t,!0):J&&J.setMuted(t)}function St(){oe(C,!Ei(C)),Mt(Ei(C)),F||X.set(Ei(C)?1:L().$settings.mutedVolume||0)}function Et(t){y(!0),$()?$($().currentTime=t,!0):Ei(ht)?(x(Ei(ht).currentTime=t),y(!1)):J&&J.setCurrentTime(t)}function It(){Ei(ht)?(x(Ei(ht).currentTime),Ei(ht).ended&&_t()):J&&J.getCurrentTime().then(t=>{x(t)}),At()}function At(){_()||z.dispatch("timeupdate",x())}function Lt(){tt>=0||(tt=setInterval(It,250),It())}function Pt(){clearInterval(tt),tt=-1}async function $t(){if(G&&Z&&("MediaSource"in window||"ManagedMediaSource"in window)){const t=new Oa($(),Z,{onReady:()=>y(!1),onEnded:_t});return await t.initialize(),void(J=t)}if(U==Cn.IFrame&&Ei(at)){if(H==Dn.YouTube){const t=new Ca(Ei(at),{width:Ei(qt),height:Ei(Wt)},{onReady:()=>y(!1),onDurationChange:t=>b(t),onPlay:()=>{Lt(),oe(pt,v(y(!1)),!0)},onPause:()=>{v(!0),Pt()},onEnded:_t,onBlocked:()=>{oe(pt,v(!0),!0),Pt()},onSeeking:()=>{It(),y(!0),Pt()}});return y(!0),await t.initialize(),void(J=t)}if(H==Dn.Vimeo){const t=new Da(Ei(at),{width:Ei(qt),height:Ei(Wt)},{onReady:()=>y(!1),onPlay:()=>v(y(!1)),onPause:()=>v(!0),onSeeking:()=>y(!0),onSeeked:()=>y(!1),onTimeUpdate:t=>x(t),onDurationChange:t=>b(t),onEnded:_t});return y(!0),await t.initialize(),void(J=t)}}$()&&(G&&Z&&oe(K,Z,!0),function(){if(!$())return;$($().ontimeupdate=At,!0),Ei(ht)&&($($().onpause=()=>{Dt=!!$()?.ended,$()?.ended||Ei(ht).pause()},!0),$($().onseeked=()=>{!$()||$().ended||Dt||(Ei(ht).currentTime=$().currentTime,Ct&&($().pause(),Ct=!1))},!0));null!=x()&&x()>0&&($().duration>0?$($().currentTime=x(),!0):$($().oncanplay=()=>{$()&&($($().oncanplay=null,!0),d()||($().play(),Ct=!0),$($().currentTime=nt,!0))},!0));const t=u()&&void 0!==m()?m():-1;$($().onended=t>=0?()=>{clearTimeout(dt),dt=setTimeout(()=>{w()||$()?.play()},1e3*t)}:_t,!0)}())}let Ct=!1,Dt=!1;function zt(){F||X.set(1)}let Ot=ne(!1);const Rt=Li(()=>P()&&P().subscribe(t=>{t&&Ft()})),Xt=()=>x($()?.currentTime??0);function Ft(){Ei(Ot)||(oe(Ot,!0),Rt&&Rt(),T()&&L()&&L().video.set(void 0),O.mediaState.delete(A()),Pt(),yt(),zt(),lt&&Y.set(void 0),$()&&($($().onended=null,!0),rt&&($($().onloadedmetadata=$($().onplay=$($().onseeking=$($().onseeked=null,!0),!0),!0),!0),$().removeEventListener("timeupdate",Xt)),$($().ontimeupdate=$($().onpause=$($().onseeked=$($().oncanplay=null,!0),!0),!0),!0)),Ei(ht)&&Ei(ht).destroy(),J&&(J.destroy(),J=void 0))}const Vt=U==Cn.Video;let Yt=ne(ue(Li(()=>Vt&&G&&1!=l()&&Jr.iOS)));const Nt=D.is360?Math.PI/2:1,Bt=jt(()=>Vt?l()*Nt:U==Cn.IFrame?Math.max(l(),Math.min(h()/512,c()/512)):1),qt=jt(()=>Vt?h():Math.round(h()/Ei(Bt)*Nt)),Wt=jt(()=>Vt?c():Math.round(c()/Ei(Bt)*Nt));let Ut=ne(void 0),Ht=ne(void 0);const Gt=jt(()=>Ei(ht)&&k()?"events"in k()?k().events:k().i18n?.[i()]?.events??void 0:void 0);ps(()=>{e.onid?.(A()),a()&&rt&&($(($n||($n=new Audio),$n)),$($().controls=!1,!0),$($().onloadedmetadata=()=>b($()?.duration??0),!0),$($().src=a(),!0),$($().oncanplay=Tt,!0),$($().onended=_t,!0),$().addEventListener("timeupdate",Xt),$($().onseeking=()=>y(!0),!0),$($().onseeked=()=>y(!1),!0)),nt=x()||0,oe(st,H==Dn.YouTube||H==Dn.Vimeo,!0),$t().then(()=>{d()&&vt()}).catch(()=>{}),Ei(Yt)&&$()?.addEventListener("playing",()=>oe(Yt,!1),{once:!0});let t=!1;const i=n.isMuted.subscribe(e=>{t?(oe(C,e,!0),Mt(e)):t=!0});return()=>{Ft(),i(),rt&&$(void 0),J?.destroy()}}),Re(()=>{void 0!==w()&&v(w())}),Re(()=>{u()&&void 0!==m()&&clearTimeout(dt)});var Zt=Hi(),Jt=_e(Zt),Kt=t=>{var e=io(),i=_e(e);let r;Us(i,null);var n=ke(i);let a;ar(n,"tabindex",-1);var l=ke(n),w=t=>{var e=Ha();hr(e,t=>({...t,title:p(),src:Ei(K),width:Ei(qt),height:Ei(Wt),frameborder:"0",allow:"fullscreen *;autoplay *;encrypted-media *",[js]:{hooked:Ei(st)&&!Ei(pt)}}),[()=>({credentialless:!0})],void 0,void 0,"micrio-media"),fr(e,t=>oe(at,t),()=>Ei(at)),function(t){if(!V)return;t.removeAttribute("onload"),t.removeAttribute("onerror");const e=t.__e;void 0!==e&&(t.__e=void 0,queueMicrotask(()=>{t.isConnected&&t.dispatchEvent(e)}))}(e),Gi(t,e)},k=t=>{var e=Za();e.controls=!1;var i=ke(e),s=t=>{var e=ja(),i=_e(e),s=t=>{var e=Ga();Ye(t=>ar(e,"src",t),[()=>Ei(K).replace(".webm",".mp4")]),Gi(t,e)},r=jt(()=>E()&&Ei(K).endsWith(".webm"));vs(i,t=>{Ei(r)&&t(s)});var n=Me(i,2);Ye(()=>{ar(n,"src",Ei(K)),ar(n,"type",G?"application/x-mpegURL":void 0)}),Gi(t,e)};vs(i,t=>{Ei(K)&&t(s)}),q(e),fr(e,t=>$(t),()=>$()),Ye(()=>{e.loop=u()&&(null==m()||m()<=0),ar(e,"width",h()),ar(e,"height",c()),Us(e,Ei(Yt)?"opacity: 0":void 0),e.muted=Ei(C),e.autoplay=!!d()}),Oi("canplay",e,Tt),Oi("ended",e,_t),vr("duration","durationchange",e,b),ur(e,x),mr(e,y),gr(e,v),Gi(t,e)},_=t=>{var e=Ja();e.controls=!1,fr(e,t=>$(t),()=>$()),Ye(()=>{ar(e,"src",Ei(K)),e.muted=Ei(C)}),Oi("canplay",e,()=>y(!1)),Oi("ended",e,_t),vr("duration","durationchange",e,b),ur(e,x),mr(e,y),gr(e,v),Gi(t,e)},I=t=>{var e=Ka();or(e,"data-logo","false"),Ye(()=>or(e,"id",j[0])),Ye(()=>or(e,"width",j[1])),Ye(()=>or(e,"height",j[2])),Ye(()=>or(e,"lang",j[3])),Ye(()=>or(e,"data-path",D.path)),Gi(t,e)};vs(l,t=>{U==Cn.IFrame?t(w):U==Cn.Video?t(k,1):U!=Cn.Audio||rt?U==Cn.Micrio&&j&&t(I,3):t(_,2)});var A=Me(l,2),L=t=>{!function(t,e){et(e,!0);let i=br(e,"currentTime",11,0);const s=Q("micrio");e.events.forEach(t=>{t.start=Number(t.start||0),t.end=Math.min(Number(t.end||0),e.duration)});const r=t=>e.events.forEach(e=>{const i=e.start<=t&&e.end>=t;i!=!!e.active&&(e.active=i,s.events.dispatch("tour-event",{...e}))});Re(()=>{r(i())}),fs(()=>r(1/0)),it()}(0,{get events(){return Ei(Gt)},get currentTime(){return x()},set currentTime(t){x(t)},get duration(){return b()},set duration(t){b(t)}})};vs(A,t=>{Ei(Gt)?.length&&b()>0&&!Ei(Ot)&&t(L)});var P=Me(A,2),z=t=>{var e=Qa();let i;var s=ke(e);{let t=jt(()=>!!lt),e=jt(()=>!isNaN(o())),i=jt(()=>T()||U!=Cn.IFrame&&U!=Cn.Video?M():Ei(Ut));!function(t,e){et(e,!0);const i=()=>xt(Jn,"$i18n",r),s=()=>xt(Xa,"$captionsEnabled",r),[r,n]=kt();let a=br(e,"currentTime",15),o=br(e,"duration",11,0),h=br(e,"seeking",11,!0),c=br(e,"minimal",3,!1),l=br(e,"ended",15),d=br(e,"fullscreen",3,void 0),u=br(e,"subtitles",3,!1),m=br(e,"hasAudio",3,!0),g=br(e,"muted",3,!1),p=ne(void 0);function f(t){0==t.button&&(window.addEventListener("mousemove",v),window.addEventListener("mouseup",w),v(t))}function v(t){const i=Ei(p).getClientRects()[0],s=Math.min(1,Math.max(0,(t.clientX-i.left)/i.width));e.onseek?.(s*o())}function w(){window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",w)}var y=Ua(),b=_e(y),x=ke(b);{let t=jt(()=>e.paused?"play":"pause"),s=jt(()=>e.paused?i().play:i().pause);pa(x,{get type(){return Ei(t)},get title(){return Ei(s)},get onclick(){return e.onplaypause},children:(t,e)=>{var i=Hi(),s=_e(i),r=t=>{var e=Ba(),i=ke(e);q(e),Ye(()=>ar(i,"stroke-dashoffset",119.4*(1-a()/o()))),Gi(t,e)};vs(s,t=>{c()&&void 0!==a()&&a()>0&&t(r)}),Gi(t,i)},$$slots:{default:!0}})}var T=Me(x,2),k=t=>{var r=qa(),n=_e(r),a=t=>{{let s=jt(()=>g()?"volume-off":"volume-up"),r=jt(()=>g()?i().audioUnmute:i().audioMute);pa(t,{get disabled(){return h()},get type(){return Ei(s)},get title(){return Ei(r)},get onclick(){return e.onmute}})}};vs(n,t=>{m()&&t(a)});var o=Me(n,2),c=t=>{{let e=jt(()=>s()?"subtitles":"subtitles-off");pa(t,{get type(){return Ei(e)},get active(){return s()},get title(){return i().subtitlesToggle},onclick:()=>Xa.set(!s())})}};vs(o,t=>{u()&&t(c)});var l=Me(o,2),p=t=>{Ta(t,{get el(){return d()}})};vs(l,t=>{d()&&t(p)}),Gi(t,r)};vs(T,t=>{c()||t(k)}),q(b);var _=Me(b,2),M=t=>{Na(t,{get duration(){return o()},get currentTime(){return a()},set currentTime(t){a(t)},get ended(){return l()},set ended(t){l(t)},children:(t,e)=>{var i=Wa();fr(i,t=>oe(p,t),()=>Ei(p)),Ye(()=>Us(i,`--progress:${(a()??0)/o()*100}%;`)),Ri("mousedown",i,f),Gi(t,i)},$$slots:{default:!0}})};vs(_,t=>{c()||t(M)}),Ri("click",b,t=>t.stopPropagation()),Ri("keydown",b,t=>t.stopPropagation()),Gi(t,y),it(),n()}(s,{get subtitles(){return Ei(t)},get hasAudio(){return Ei(e)},get muted(){return Ei(C)},get fullscreen(){return Ei(i)},onplaypause:ft,onmute:St,onseek:t=>Et(t),get paused(){return v()},set paused(t){v(t)},get seeking(){return y()},set seeking(t){y(t)},get duration(){return b()},set duration(t){b(t)},get currentTime(){return x()},set currentTime(t){x(t)},get ended(){return Ei(mt)},set ended(t){oe(mt,t,!0)}})}q(e),Ye(()=>i=qs(e,1,"micrio-media",null,i,{inside:"inside"==g()})),Gi(t,e)};vs(P,t=>{g()&&t(z)}),q(n),fr(n,t=>oe(Ht,t),()=>Ei(Ht));var O=Me(n,2),R=t=>{var e=to();Ms(e,f,!0),q(e),Gi(t,e)};vs(O,t=>{f()&&t(R)}),q(i),fr(i,t=>oe(Ut,t),()=>Ei(Ut));var X=Me(i,2),F=t=>{var e=eo();ar(e,"tabindex",-1),pa(ke(e),{get title(){return xt(Jn,"$i18n",s).play},type:"play"}),q(e),Ri("pointerup",e,vt),Gi(t,e)};vs(X,t=>{Ei(ut)&&t(F)}),Ye(()=>{r=qs(i,1,Vs(S()),"micrio-media",r,{paused:v(),is360:T(),"media-video":U==Cn.IFrame||U==Cn.Video,"media-micrio":U==Cn.Micrio}),Us(n,1==Ei(Bt)||U!=Cn.Video&&D.is360?"":`transform:scale(${Ei(Bt)})`),a=qs(n,1,"micrio-media",null,a,{videotour:!!Ei(ht)})}),Ri("pointerup",n,t=>{t.target==Ei(Ht)&&ft(t)}),Gi(t,e)};vs(Jt,t=>{L().$settings.noUI||t(Kt)}),Gi(t,Zt),it(),r()}Xi(["pointerup"]);var ro=Bi("<article><!></article>");function no(t,e){et(e,!0);let i=br(e,"cn",3,null);function s(t){t.target&&t.target instanceof HTMLAnchorElement&&!t.target.getAttribute("href")?.startsWith("#")&&(t.target.target="_blank")}var r=ro();gs(ke(r),()=>e.children??f),q(r),Ye(()=>qs(r,1,Vs(i()),"micrio-article")),Ri("click",r,t=>t.stopPropagation()),Ri("keydown",r,s),Ri("pointerdown",r,s),Gi(t,r),it()}Xi(["click","keydown","pointerdown"]);var ao=Bi('<h1 class="micrio-marker-content"> </h1>'),oo=Bi('<figcaption class="micrio-marker-content"> </figcaption>'),ho=Bi('<button class="micrio-marker-content"><figure class="micrio-marker-content"><img class="micrio-marker-content"/> <!></figure></button>'),co=Bi('<section class="micrio-marker-content"></section>'),lo=Bi("<!> <!>",1),uo=Bi("<main><!> <!> <!> <!> <!> <!> <!></main>");function mo(t,e){et(e,!0);const i=()=>xt(m,"$tour",r),s=()=>xt(u,"$lang",r),[r,n]=kt();let a=br(e,"noEmbed",3,!1),o=br(e,"noImages",3,!1),h=br(e,"noGallery",3,!1),c=br(e,"_content",15),l=br(e,"_title",15);const d=Q("micrio"),u=d._lang,m=d.state.tour,g=i()&&"steps"in i()&&i().isSerialTour,p=Q("markerImages").get(Li(()=>e.marker).id),f=p.$settings._markers??{},v=!f.preventAutoPlay,w=Li(()=>!e.marker.data?.preventImageOpen&&!h()),y=Li(()=>1==e.marker.images?.length),b=jt(()=>Vn(e.marker,s())),x=jt(()=>!(Ei(b)?.title||Ei(b)?.audio||e.marker.images&&e.marker.images.length||Ei(b)?.embedUrl||e.marker.videoTour||Ei(b)?.body||Ei(b)?.bodySecondary)),T=()=>{i()&&"steps"in i()&&(i().isSerialTour||f.tourAutoProgress)&&e.onclose?.()};const k=jt(()=>!v||!e.marker?.audioAutoPlay),_=jt(()=>!1===e.marker?.embedAutoPlay||!v||!(!Ei(b)?.audio||!e.marker?.audioAutoPlay)),M=p.tileBase?.includes("micrio.dev"),S=t=>t.i18n?.[s()]?.title,E=jt(()=>e.marker.videoTour?.i18n?.[s()]?.audio??Ei(b)?.audio),I=jt(()=>Fn(Ei(E))),A=jt(()=>y&&e.marker.images?.[0]?.i18n?.[s()]?.description);var L=Hi(),P=_e(L),$=t=>{var i=uo();let s;var r=ke(i),n=t=>{var e=ao(),i=ke(e,!0);q(e),fr(e,t=>l(t),()=>l()),Ye(()=>ns(i,Ei(b).title)),Gi(t,e)};vs(r,t=>{Ei(b).title&&t(n)});var h=Me(r,2),u=t=>{no(t,{children:(t,e)=>{var i=Hi();Ms(_e(i),()=>Ei(b).body),Gi(t,i)},$$slots:{default:!0}})};vs(h,t=>{Ei(b).body&&f.primaryBodyFirst&&t(u)});var m=Me(h,2),E=t=>{{let i=jt(()=>e.marker.audioAutoPlay||!Ei(b).audio&&!!e.marker.videoTour),s=jt(()=>!e.marker.videoTour||!Ei(b)||!Ei(b).embedUrl);so(t,{get src(){return Ei(I)},noPlayOverlay:!0,get image(){return p},get uuid(){return e.marker.id},get tour(){return e.marker.videoTour},get autoplay(){return Ei(i)},get controls(){return Ei(s)},onended:T,get paused(){return Ei(k)}})}};vs(m,t=>{!g&&((!Ei(b)||!Ei(b).embedUrl)&&e.marker.videoTour||Ei(b)&&Ei(b).audio)&&t(E)});var L=Me(m,2),P=t=>{var i=co();bs(i,21,()=>e.marker.images,t=>t.id??t.src,(t,i)=>{var s=ho(),r=ke(s),n=ke(r),a=Me(n,2),o=t=>{var e=oo(),i=ke(e,!0);q(e),Ye(()=>ns(i,Ei(A))),Gi(t,e)};vs(a,t=>{Ei(A)&&t(o)}),q(r),q(s),Ye((t,e,i)=>{ar(s,"title",t),s.disabled=!w,ar(n,"alt",e),ar(n,"src",i)},[()=>S(Ei(i)),()=>S(Ei(i)),()=>Ei(i).micrioId?`https://iiif.${M?"micrio.dev":"micr.io"}/${Ei(i).micrioId}/full/${y?"^"+Math.min(Ei(i).width,640)+",":"^,320"}/0/default.webp`:Ei(i).src]),Ri("click",s,function(...t){(w?()=>{return t=Ei(i).micrioId,void(w&&d.state.popover.set({gallery:e.marker.images,galleryStart:t,image:p}));var t}:void 0)?.apply(this,t)}),Gi(t,s)}),q(i),Gi(t,i)};vs(L,t=>{!o()&&e.marker.images?.length&&t(P)});var $=Me(L,2),C=t=>{var i=lo(),s=_e(i),r=t=>{so(t,{get image(){return p},className:"hidden",get uuid(){return e.marker.id},get tour(){return e.marker.videoTour},get autoplay(){return v},secondary:!0})};vs(s,t=>{!Ei(b).audio&&e.marker.videoTour&&t(r)});var n=Me(s,2);{let t=jt(()=>!Ei(_));so(n,{get image(){return p},get src(){return Ei(b).embedUrl},get uuid(){return e.marker.id},width:400,height:240,controls:!0,get title(){return Ei(b).embedTitle},get figcaption(){return Ei(b).embedDescription},get autoplay(){return Ei(t)},onended:T,get paused(){return Ei(_)}})}Gi(t,i)};vs($,t=>{Ei(b).embedUrl&&!a()&&t(C)});var D=Me($,2),z=t=>{no(t,{children:(t,e)=>{var i=Hi();Ms(_e(i),()=>Ei(b).body),Gi(t,i)},$$slots:{default:!0}})};vs(D,t=>{Ei(b).body&&!f.primaryBodyFirst&&t(z)});var O=Me(D,2),R=t=>{no(t,{cn:"secondary",children:(t,e)=>{var i=Hi();Ms(_e(i),()=>Ei(b).bodySecondary),Gi(t,i)},$$slots:{default:!0}})};vs(O,t=>{Ei(b).bodySecondary&&t(R)}),q(i),fr(i,t=>c(t),()=>c()),Ye(()=>s=qs(i,1,"micrio-marker-content",null,s,{empty:Ei(x)})),Gi(t,i)};vs(P,t=>{Ei(b)&&t($)}),Gi(t,L),it(),n()}Xi(["click"]);var go=Bi('<button class="micrio-button tour-step micrio-marker-popup" disabled=""> </button>'),po=Bi("<!> <!> <!>",1),fo=Bi('<progress class="progress micrio-marker-popup"></progress> <!>',1),vo=Bi('<div><aside class="micrio-marker-popup"><!> <!> <!></aside> <!></div>');function wo(t,e){et(e,!0);const i=()=>xt(c,"$tour",n),s=()=>xt(h,"$current",n),r=()=>xt(Jn,"$i18n",n),[n,a]=kt(),o=Q("micrio"),{current:h}=o,c=o.state.tour,l=Q("markerImages").get(Li(()=>e.marker).id),d=l.$settings._markers??{},u=jt(()=>i()&&"steps"in i()?o.canvases.find(t=>t.$data?.markerTours?.find(t=>t.id===i().id)):void 0),m=Li(()=>e.marker.data||{}),g=d.canMinimizePopup;let p=ne(void 0);function f(t){i()&&Ei(w)&&"steps"in i()?t instanceof Event&&Ei(T)?c.set(void 0):i().next?.():s()&&!l.opts.secondaryTo&&s().id!=l.id&&m.micrioLink?.id==s().id?(o.open(l.id),l.state.marker.set(void 0),o.state.popup.set(void 0)):l.state.marker.set(void 0)}const v=jt(()=>i()&&"steps"in i()?i():void 0),w=jt(()=>Ei(v)&&Ei(v)?.steps.findIndex(t=>t.startsWith(e.marker.id))>=0),y=jt(()=>Ei(w)&&!Ei(v)?.isSerialTour&&(Ei(u)?.$settings._markers?.tourControlsInPopup??d.tourControlsInPopup)),b=jt(()=>Ei(w)&&!Ei(v)?.isSerialTour&&(Ei(u)?.$settings._markers?.tourStepCounterInPopup??d.tourStepCounterInPopup)),x=jt(()=>Ei(v)?.currentStep??-1),T=jt(()=>Ei(y)||(Ei(v)?Ei(v).currentStep==Ei(v).steps.length-1:void 0));let k=ne(!1);const _=(t=!1)=>{Ei(v)&&(t?Ei(v).prev?.():Ei(v).next?.(),oe(k,!0),setTimeout(()=>oe(k,!1),200))};let M=ne(!1),S=ne(void 0),E=ne(void 0);const I=new WeakMap,A=()=>{if(oe(M,!Ei(M)),Ei(S))for(let t=0;t<Ei(S).children.length;t++){const e=Ei(S).children[t];e instanceof HTMLElement&&e!=Ei(E)&&(I.has(e)||(I.set(e,e.offsetHeight),e.style.height=e.offsetHeight+"px"),setTimeout(()=>{e.style.height=Ei(M)?"0px":I.get(e)+"px"},100))}};let L=ne(!1);ps(()=>{e.marker.tags?.forEach(t=>Ei(p)?.classList.add(t)),setTimeout(()=>Ei(p)?.querySelector("button")?.focus(),500);const t="embedImages"in e.marker?e.marker.embedImages:void 0;t&&o.$current?.data.update(e=>(e||(e={embeds:[]}),e.embeds=[...e.embeds??[],...t],e));const i=o.state.popup.subscribe(t=>oe(L,!t||t!=e.marker,!0));return()=>{i(),t&&o.$current?.data.update(e=>e?.embeds?(e.embeds=e.embeds.filter(e=>!t.find(t=>t.id==e.id)),e):e)}});var P=vo();let $;var C=ke(P),D=ke(C),z=t=>{{let e=jt(()=>!Ei(w)||Ei(T)?"close":"arrow-right"),i=jt(()=>!Ei(w)||Ei(T)?r().closeMarker:r().tourStepNext);pa(t,{get type(){return Ei(e)},get title(){return Ei(i)},get disabled(){return Ei(k)},onclick:f})}};vs(D,t=>{m.alwaysOpen||t(z)});var O=Me(D,2),R=t=>{{let e=jt(()=>Ei(M)?"arrow-up":"arrow-down");pa(t,{get type(){return Ei(e)},get title(){return r().minimize},onclick:A})}};vs(O,t=>{g&&t(R)});var X=Me(O,2),F=t=>{var e=fo(),s=_e(e);ar(s,"aria-hidden",!0),xa(Me(s,2),{className:"micrio-tour-controls",children:(t,e)=>{var s=po(),n=_e(s);{let t=jt(()=>Ei(k)||0==Ei(x));pa(n,{type:"arrow-left",get disabled(){return Ei(t)},get title(){return r().tourStepPrev},onclick:()=>_(!0)})}var a=Me(n,2),o=t=>{var e=go(),s=ke(e);q(e),Ye(()=>ns(s,`${Ei(x)+1} / ${i().steps.length??""}`)),Gi(t,e)};vs(a,t=>{Ei(b)&&t(o)});var h=Me(a,2);{let t=jt(()=>Ei(k)||Ei(x)+1==i().steps.length);pa(h,{type:"arrow-right",get disabled(){return Ei(t)},get title(){return r().tourStepNext},onclick:()=>_()})}Gi(t,s)},$$slots:{default:!0}}),Ye(()=>function(t,e){var i=cr(t);i.value!==(i.value=e??void 0)&&(t.value!==e||0===e&&t.nodeName===sr)&&(t.value=e??"")}(s,(Ei(x)+1)/i().steps.length)),Gi(t,e)};vs(X,t=>{Ei(y)&&i()&&"steps"in i()&&t(F)}),q(C),mo(Me(C,2),{get marker(){return e.marker},onclose:f,get _content(){return Ei(S)},set _content(t){oe(S,t,!0)},get _title(){return Ei(E)},set _title(t){oe(E,t,!0)}}),q(P),fr(P,t=>oe(p,t),()=>Ei(p)),Ye(()=>$=qs(P,1,"micrio-marker-popup",null,$,{destroying:Ei(L),minimized:Ei(M)})),Ds(3,P,()=>Wn,()=>d.popupAnimation),Gi(t,P),it(),a()}var yo=Bi('<li><button class="micrio-serial-tour"> </button></li>'),bo=Bi('<ol class="micrio-serial-tour"></ol>'),xo=Bi("<!> <!> <!> <!>",1),To=Bi('<div role="progressbar"></div>'),ko=Bi('<!> <aside class="micrio-media-controls micrio-serial-tour"><!> <!></aside> <!>',1);function _o(t,e){et(e,!0);const i=()=>xt(c,"$lang",n),s=()=>xt(Jn,"$i18n",n),r=()=>xt(Xa,"$captionsEnabled",n),[n,a]=kt(),o=Li(()=>e.tour).stepInfo,h=Q("micrio"),c=h._lang,l=h.$current,d=h.state.marker,u=!!l.$settings?.ui?.controls?.serialTourNoTimeScrub,m=o.reduce((t,e)=>t+e.duration,0)??0,g=Li(()=>"controls"in e.tour?!1!==e.tour.controls:!e.tour.noControls);let p=ne(!1),f=ne(!1),v=ne(!1);Re(()=>h.isMuted.subscribe(t=>{oe(v,t,!0)}));let w=ne(void 0),y=ne(void 0),b=ne(0),x=ne("");function T(){const t=h.state.mediaState.get(Ei(x));t&&(t.paused=oe(p,!t.paused)),Ei(p)?(h.events.dispatch("serialtour-pause",e.tour),h.events.enabled.set(!0)):(h.events.dispatch("serialtour-play",e.tour),h.events.enabled.set(!1))}function k(t,i){if(!e.tour.goto)return;const s=t==e.tour.currentStep;if(u&&s)return;s||e.tour.goto(t);const r=!u&&i?i.offsetX/i.target.offsetWidth:0;o.forEach((e,s)=>e.ended=!i&&s<t),S();const n=o[t];n.currentTime=r*n.duration,s&&Ei(w)?.instance&&(Ei(w).instance.currentTime=n.currentTime),I(t)}function _(){h.isMuted.update(t=>!t)}function M(){const t=Ei(y);t&&(t.ended=!0),null!=e.tour.currentStep&&e.tour.currentStep<e.tour.steps.length-1&&e.tour.next?e.tour.next():(oe(p,oe(f,!0),!0),e.onended?.()),Si().then(()=>{S(),t&&(t.ended=!1)})}function S(){e.tour.stepInfo?.forEach(t=>t.currentTime=0)}const E=vt([]);function I(t=e.tour.currentStep??0){const i=o.map((e,i)=>i<t||e.ended||Ei(f)?100:i==t?Math.round((e.currentTime||0)/e.duration*1e4)/100:0);oe(b,i.reduce((t,e,i)=>t+e/100*o[i].duration,0),!0),E.set(i)}function A(t){const i=t&&!!e.tour.steps.find(e=>e.startsWith(t.id));oe(w,void 0),i&&t.videoTour&&setTimeout(()=>{const i=o[e.tour.currentStep??0];i.markerId==t.id&&(i.ended=!1,oe(y,i,!0),oe(w,t.videoTour,!0),I())},10)}const L=t=>t.i18n?t.i18n[i()]?.title:t.title;ps(()=>{const t=()=>I();h.addEventListener("timeupdate",t);const e=d.subscribe(A);return()=>{e(),h.removeEventListener("timeupdate",t),S()}});const P=jt(()=>Ei(w)?"audio"in Ei(w)?Ei(w).audio:Ei(w).i18n?.[i()]?.audio:void 0),$=jt(()=>Fn(Ei(P))),C=jt(()=>!!Ei(y)?.hasSubtitle),D=jt(()=>o.some(t=>t.hasSubtitle));var z=ko(),O=_e(z),R=t=>{var e=bo();bs(e,21,()=>o,ws,(t,e,i)=>{var s=Hi(),r=_e(s),n=t=>{var s=yo();let r;var n=ke(s),a=ke(n,!0);q(n),q(s),Ye(t=>{r=qs(s,1,"micrio-serial-tour",null,r,{active:Ei(y)&&Ei(y).chapter==i,enriched:Ei(e).imageHasOtherMarkers}),ns(a,t)},[()=>L(Ei(e).marker)]),Ri("click",n,()=>k(i)),Gi(t,s)},a=jt(()=>L(Ei(e).marker));vs(r,t=>{Ei(a)&&t(n)}),Gi(t,s)}),q(e),Gi(t,e)};vs(O,t=>{e.tour.printChapters&&t(R)});var X=Me(O,2),F=ke(X),V=t=>{{let e=jt(()=>!Ei(p));so(t,{get tour(){return Ei(w)},get src(){return Ei($)},get autoplay(){return Ei(e)},onid:t=>oe(x,t,!0),onended:M,onplay:()=>oe(p,!1),onblocked:()=>oe(p,!0),get currentTime(){return Ei(y).currentTime},set currentTime(t){Ei(y).currentTime=t}})}};vs(F,t=>{Ei(w)&&Ei(y)&&t(V)});var Y=Me(F,2),N=t=>{var e=xo(),i=_e(e);{let t=jt(()=>Ei(p)?"play":"pause"),e=jt(()=>Ei(p)?s().play:s().pause);pa(i,{get type(){return Ei(t)},get title(){return Ei(e)},onclick:T})}var n=Me(i,2);{let t=jt(()=>Ei(v)?"volume-off":"volume-up"),e=jt(()=>Ei(v)?s().audioUnmute:s().audioMute);pa(n,{get type(){return Ei(t)},get title(){return Ei(e)},onclick:_})}var a=Me(n,2),o=t=>{{let e=jt(()=>!Ei(C)),i=jt(()=>r()?"subtitles":"subtitles-off");pa(t,{get disabled(){return Ei(e)},get type(){return Ei(i)},get active(){return r()},get title(){return s().subtitlesToggle},onclick:()=>Xa.set(!r())})}};vs(a,t=>{Ei(D)&&t(o)}),Ta(Me(a,2),{get el(){return h}}),Gi(t,e)};vs(Y,t=>{g&&t(N)}),q(X);var B=Me(X,2),W=t=>{Na(t,{get duration(){return m},get currentTime(){return Ei(b)},set currentTime(t){oe(b,t,!0)},get ended(){return Ei(f)},set ended(t){oe(f,t,!0)},children:(t,i)=>{var s=Hi();bs(_e(s),17,()=>o,ws,(t,i,s)=>{var r=Hi(),a=_e(r),o=t=>{var r=To();let a;Ye(t=>{a=qs(r,1,"bar",null,a,{active:s==e.tour.currentStep}),ar(r,"title",t),Us(r,`width:${Ei(i).duration/m*100}%; --progress: ${xt(E,"$times",n)[s]||0}%`)},[()=>L(Ei(i).marker)]),Ri("click",r,t=>k(s,t)),Oi("keypress",r,t=>{"Enter"===t.key&&k(s)}),Gi(t,r)};vs(a,t=>{Ei(i).duration>0&&t(o)}),Gi(t,r)}),Gi(t,s)},$$slots:{default:!0}})};vs(B,t=>{g&&t(W)}),Gi(t,z),it(),a()}Xi(["click"]);var Mo=Bi('<article class="scroll-tour micrio-tour"></article> <!>',1),So=Bi("<!> <!> <!>",1),Eo=Bi("<div><!> <!></div>");function Io(t,e){et(e,!0);const i=()=>xt(l,"$_lang",r),s=()=>xt(Jn,"$i18n",r),[r,n]=kt();let a=br(e,"noHTML",3,!1);const o=Q("micrio"),{events:h,state:c,_lang:l}=o,d=c.$tour,u=o.$current,m=u.$data,g=u.$settings,p=o.canvases[0].grid,f=u.state.marker,v="steps"in e.tour&&e.tour.isSerialTour,w=!("steps"in e.tour),y="scrollable"in e.tour&&e.tour.scrollable,b="steps"in e.tour&&("controls"in e.tour?!1!==e.tour.controls:!!e.tour.noControls),x=!(!v&&"steps"in e.tour&&g._markers?.tourControlsInPopup),T=x&&(w||v),k=!!g._markers?.keepPopupsDuringTourTransitions,_=()=>I(Ei(C)-1),M=()=>I(Ei(C)+1),S=()=>h.enabled.set(!0);let E;function I(t){if(!("steps"in e.tour)||!e.tour.stepInfo)return;const i=e.tour.stepInfo[t];if(i&&i.markerId==o.state.$marker?.id)return A(i);const s=e.tour.stepInfo[Ei(C)]?.micrioImage?.state;s&&s.marker.set(void 0),o.$current?.state.marker.set(void 0),k||o.state.popup.set(void 0),o.removeEventListener("marker-opened",S),f.set(void 0),i&&(E=setTimeout(L,200,i))}async function A(t){let i=u,s=!1;if(p&&!t.gridView&&p.images.find(e=>e.id==t.micrioId)){const r=!!("steps"in e.tour&&e.tour.stepInfo&&t)&&e.tour.stepInfo?.indexOf(t)<Ei(C),n=t.marker.data?.gridTourTransition??t.marker.data?._meta?.gridTourTransition,a=n?.startsWith("slide")?"slide":"swipe";await Si().then(()=>{const e=p.focus(i=p.images.find(e=>e.id==t.micrioId),{view:t.startView,transition:n==a||n==`${a}-horiz`?r?`${a}-left`:`${a}-right`:n==`${a}-vert`?r?`${a}-up`:`${a}-down`:"behind"==n?r?"behind-left":"behind-right":n}).catch(()=>s=!0);return o.events.enabled.set(!1),e})}else if(o.$current?.id!=t.micrioId){if(t.gridView&&t.marker.data?._meta?.gridAction&&p){t.micrioImage||(t.micrioImage=p.images.find(e=>e.id==t.micrioId)),i=t.micrioImage;const e=t.marker.data._meta.gridAction.split("|");p.action(e.shift(),e.join("|"))}else"steps"in e.tour&&e.tour.stepInfo&&oe(C,e.tour.stepInfo.indexOf(t),!0),i=o.open(t.micrioId,{gridView:t.gridView,startView:t.startView});await Si()}else i=o.$current;return[i,s]}async function L(t){let i=u,s=!1;t.micrioId&&([i,s]=await A(t)),s||(t.micrioImage||(t.micrioImage=i),h.enabled.set(!1),i.state.marker.set(t.markerId),o.addEventListener("marker-opened",S,{once:!0}),await Si(),h.dispatch("tour-step",e.tour))}function P(){c.tour.set(void 0)}function $(){h.dispatch("tour-ended",e.tour),(e.tour.closeOnFinish||!e.tour.cannotClose&&b)&&P()}let C=ne(-1),D=ne(!1);const z=u.camera.getView(),O=g._markers;if("steps"in e.tour){const t=d;t.prev=_,t.next=M,t.goto=I,Re(()=>{t.currentStep=Ei(C)})}const R=vt(!1);let X;function F(){R.set(!1),clearTimeout(X),X=setTimeout(()=>R.set(!0),5e3)}R.subscribe(t=>h.dispatch("tour-minimize",t));let V,Y=ne(void 0);function N(t){if(!("steps"in e.tour)||!Ei(Y))return;const i=e.tour.steps,s=t.filter(t=>t.isIntersecting).map(t=>t.target)[0];if(s)for(let e=0;e<Ei(Y).children.length;e++)if(Ei(Y).children[e]==s){const t=m.markers?.find(t=>t.id==i[e].split(",")[0]);return void(t&&o.$current?.camera.flyToView(t.view).catch(()=>{}))}}let B=[];ps(()=>("steps"in e.tour&&En(u,e.tour,i(),u.$data).then(()=>function(t){if(y||o.$current?.state.$marker||void 0!==t.initialStep&&I(t.initialStep),y&&Ei(Y)){V=new IntersectionObserver(N,{root:Ei(Y),threshold:1});for(let t=0;t<Ei(Y).children.length;t++)V.observe(Ei(Y).children[t])}B.push(o.state.marker.subscribe(e=>{if(!e)return void oe(D,!1);const i="string"==typeof e?e:e.id,s=t.steps.findIndex(t=>t.startsWith(i));if(s>=0&&t.stepInfo){const e=t.stepInfo[oe(C,s,!0)];e&&!e.micrioImage&&(e.micrioImage=o.canvases.find(t=>t.id==e.micrioId)??p?.images.find(t=>t.id==e.micrioId)??o.$current)}oe(D,s<0)}))}(e.tour)),b||B.push(R.subscribe(t=>e.onminimize?.(t))),a()||"steps"in e.tour&&!v||!1===e.tour.minimize||(o.addEventListener("pointermove",F),o.addEventListener("touchstart",F),F()),T&&o.setAttribute("data-tour-active",""),()=>{for(clearTimeout(X),clearTimeout(E);B.length;)B.shift()?.();o.removeEventListener("pointermove",F),o.removeEventListener("touchstart",F),o.removeEventListener("marker-opened",S),T&&o.removeAttribute("data-tour-active"),S(),V&&V.disconnect();const t=o.state.$marker;if("steps"in d&&d.stepInfo&&null!=d.currentStep){const e=d.stepInfo[d.currentStep];delete d.goto,delete d.next,delete d.prev,t&&e?.markerId==t.id&&(e.micrioImage?.state.marker.set(void 0),o.state.marker.set(void 0))}u.camera.aniDone=void 0,p||"steps"in d&&d.keepLastStep||o.$current==u||o.open(u.id),Si().then(()=>{h.dispatch("tour-stop",d),"steps"in d&&delete d.currentStep,!("steps"in d)&&O?.zoomOutAfterClose&&!t&&z&&u.camera.flyToView(z,{speed:O?.zoomOutAfterCloseSpeed})})})),h.dispatch("tour-start",e.tour);let U=ne(0),H=ne(!1);const G=jt(()=>"steps"in e.tour?void 0:e.tour),j=jt(()=>Ei(G)?"audio"in e.tour?e.tour.audio:Ei(G).i18n?.[i()]?.audio:void 0),Z=jt(()=>Fn(Ei(j)));var J=Hi(),K=_e(J),tt=t=>{var i=Hi(),n=_e(i),a=t=>{var i=Mo(),r=_e(i);bs(r,21,()=>e.tour.steps.map(t=>m.markers&&m.markers.find(e=>e.id==t.split(",")[0])),ws,(t,e)=>{var i=Hi(),s=_e(i),r=t=>{wo(t,{get marker(){return Ei(e)}})};vs(s,t=>{Ei(e)&&t(r)}),Gi(t,i)}),q(r),fr(r,t=>oe(Y,t),()=>Ei(Y));var n=Me(r,2),a=t=>{pa(t,{type:"close",get title(){return s().tourStop},className:"scroll-tour-end",onclick:P})};vs(n,t=>{e.tour.cannotClose||t(a)}),Gi(t,i)},h=t=>{var i=Eo();let n;var a=ke(i),h=t=>{var i=Hi(),r=_e(i),n=t=>{_o(t,{get tour(){return e.tour},onended:$})},a=t=>{var i=So(),r=_e(i);{let t=jt(()=>0==Ei(C));pa(r,{type:"arrow-left",get title(){return s().tourStepPrev},get disabled(){return Ei(t)},onclick:_})}var n=Me(r,2);pa(n,{noClick:!0,children:(t,i)=>{W();var s=Ui();Ye(()=>ns(s,`${Ei(C)+1} / ${e.tour.steps.length??""}`)),Gi(t,s)},$$slots:{default:!0}});var a=Me(n,2);{let t=jt(()=>Ei(C)==e.tour.steps.length-1);pa(a,{type:"arrow-right",get title(){return s().tourStepNext},get disabled(){return Ei(t)},onclick:M})}Gi(t,i)};vs(r,t=>{v?t(n):t(a,-1)}),Gi(t,i)},c=t=>{so(t,{get tour(){return e.tour},get src(){return Ei(Z)},get fullscreen(){return o},controls:!0,autoplay:!0,onended:$,get paused(){return Ei(H)},set paused(t){oe(H,t,!0)},get currentTime(){return Ei(U)},set currentTime(t){oe(U,t,!0)}})};vs(a,t=>{"steps"in e.tour?t(h):t(c,-1)});var l=Me(a,2),d=t=>{pa(t,{type:"close",get title(){return s().close},onclick:P})};vs(l,t=>{e.tour.cannotClose||t(d)}),q(i),Ye(()=>n=qs(i,1,"micrio-tour",null,n,{left:v,"serial-tour":v,"video-tour":w,"no-controls":b,minimized:!Ei(H)&&(xt(R,"$minimized",r)||Ei(D))})),Ds(1,i,()=>qn,()=>({duration:200})),Gi(t,i)},c=t=>{so(t,{get tour(){return Ei(G)},get src(){return Ei(Z)},autoplay:!0,onended:$,get currentTime(){return Ei(U)},set currentTime(t){oe(U,t,!0)}})};vs(n,t=>{y&&"steps"in e.tour?t(a):x?t(h,1):Ei(G)&&t(c,2)}),Gi(t,i)},st=t=>{so(t,{get tour(){return Ei(G)},get src(){return Ei(Z)},autoplay:!0,onended:$,get currentTime(){return Ei(U)},set currentTime(t){oe(U,t,!0)}})};vs(K,t=>{a()?Ei(G)&&t(st,1):t(tt)}),Gi(t,J),it(),n()}var Ao,Lo=class{get currentIndex(){return this.micrio.engine.getActiveImageIdx(this.image.ptr)}constructor(t,e,i,s={}){this.micrio=t,this.length=e,this.goto=i,this.opts=s,this.hitTresh=!1,this.snapTo=[],this.pointers=new Map,this.isFullWidth=!1,this.startedWithShift=!1,this.isDragging=()=>2==this.pointers.size||(this.isFullWidth||this.startedWithShift)&&1==this.pointers.size,s.sensitivity||(s.sensitivity=Number(t.getAttribute("data-swipe-sensitivity")??1));const r=t.getAttribute("data-swipe-snap");r&&(this.snapTo=r.split(",").map(Number)),this.micrio.setAttribute("data-hooked",""),this.dStart=this.dStart.bind(this),this.dMove=this.dMove.bind(this),this.dStop=this.dStop.bind(this),this.mouseleave=this.mouseleave.bind(this),this.image=t.$current,this.image.state.view.subscribe(t=>this.isFullWidth=s.coverLimit?this.image.camera.isZoomedOut():!t||Math.round(1e3*t[3])/1e3>=1),t.engine.setNoPinchPan(!0),t.engine.setIsSwipe(!0),this.micrio.canvas.element.addEventListener("pointerdown",this.dStart)}destroy(){this.micrio.canvas.element.removeEventListener("pointerdown",this.dStart),this.mouseleave()}dStart(t){this.startedWithShift=t.shiftKey;const e=!this.isDragging();this.pointers.set(t.pointerId,!0),this.pointers.size>2&&this.mouseleave(),e&&(this.hitTresh=!1,this.micrio.setAttribute("data-panning",""),this.startIndex=this.currentIndex,this.startX=t.clientX,this.firstTouchId=t.pointerId,this.micrio.addEventListener("pointermove",this.dMove),this.micrio.addEventListener("pointerup",this.dStop),this.micrio.setPointerCapture(t.pointerId))}dMove(t){if(!this.isDragging()||t.pointerId!=this.firstTouchId||void 0===this.startX||void 0===this.startIndex)return;if(!this.hitTresh&&void 0!==this.startX&&(this.hitTresh=2!=this.pointers.size||Math.abs(t.clientX-this.startX)>(this.micrio.events.pinchFactor&&this.micrio.events.pinchFactor>1.25?.3:.15)*this.micrio.offsetWidth)&&(this.startX=t.clientX),!this.hitTresh)return;const e=this.micrio.$current.camera,i=this.opts.continuous?Math.max(.1,(e.getXY(1,.5)[0]-e.getXY(0,.5)[0])/this.micrio.offsetWidth):1,s=Math.round((t.clientX-this.startX)/(this.micrio.offsetWidth*i)*this.length*(this.opts.sensitivity??1));let r=this.startIndex-s;if(this.opts.continuous){for(;r<0;)r+=this.length;for(;r>this.length-1;)r-=this.length}r=Math.max(0,Math.min(this.length-1,r)),r!=this.currentIndex&&this.goto(r)}dStop(t){this.pointers.delete(t.pointerId),t.pointerId==this.firstTouchId&&(this.micrio.releasePointerCapture(this.firstTouchId),this.firstTouchId=void 0),this.pointers.size||this.swipeEnd()}mouseleave(){this.pointers.clear(),this.swipeEnd()}swipeEnd(){if(this.micrio.removeAttribute("data-panning"),this.micrio.removeEventListener("pointermove",this.dMove),this.micrio.removeEventListener("pointerup",this.dStop),this.hitTresh=!1,this.snapTo.length){const t=this.snapTo[this.snapTo.map((t,e)=>[e,Math.abs(t-this.currentIndex)]).sort((t,e)=>t[1]>e[1]?1:t[1]<e[1]?-1:0)[0][0]];t!=this.currentIndex&&this.animateTo(t)}}animateTo(t){this.raf&&cancelAnimationFrame(this.raf);const e=performance.now(),i=this.currentIndex,s=i-t,r=t=>{const n=Math.min(1,(t-e)/250);n<1&&(this.raf=requestAnimationFrame(r));const a=i-Math.round(this.micrio.engine.ease(n)*s);a!=this.currentIndex&&this.goto(a)};this.raf=requestAnimationFrame(r)}},Po={0:[0,-.5,1,0],90:[1,0,1.5,1],180:[0,1,1,1.5],270:[-.5,0,0,1]},$o={0:[0,-1,1,0],90:[1,0,2,1],180:[0,1,1,2],270:[-1,0,0,1]},Co={0:[0,1,1,2],90:[-1,0,0,1],180:[0,-1,1,0],270:[1,0,2,1]},Do=t=>[t,0,t+1,1];!function(t){let e;let i;(e||(e=t.Grid||(t.Grid={}))).GridActionType=function(t){return t[t.focus=0]="focus",t[t.flyTo=1]="flyTo",t[t.focusWithTagged=2]="focusWithTagged",t[t.focusTagged=3]="focusTagged",t[t.reset=4]="reset",t[t.back=5]="back",t[t.switchToGrid=6]="switchToGrid",t[t.filterTourImages=7]="filterTourImages",t[t.nextFadeDuration=8]="nextFadeDuration",t}({}),(i||(i=t.Camera||(t.Camera={}))).TimingFunction=function(t){return t[t.ease=0]="ease",t[t["ease-in"]=1]="ease-in",t[t["ease-out"]=2]="ease-out",t[t.linear=3]="linear",t}({})}(Ao||(Ao={}));var zo=Bi('<span class="micrio-dial"> </span>'),Oo=Bi('<div data-scroll-through="" class="micrio-dial"><!></div>');var Ro,Xo=Bi("<button>&#10021;</button>"),Fo=Bi("<span></span>"),Vo=Bi('<span class="hover-label micrio-gallery"> </span>'),Yo=Bi('<div><!> <ul><span class="track micrio-gallery"><span class="track-fill micrio-gallery"></span></span> <span class="ticks micrio-gallery"></span> <!> <button aria-label="Gallery position" role="slider" tabindex="0"></button> <span> </span></ul> <!></div>');function No(t,e){et(e,!0);const i=()=>xt(y,"$settings",n),s=()=>xt(w,"$layer",n),r=()=>xt(Jn,"$i18n",n),[n,a]=kt();let o=br(e,"images",19,()=>[]),h=br(e,"omni",3,null);const c=Li(()=>o()),l=Li(()=>h()),d=Q("micrio"),{engine:u,current:m,events:g,_lang:p}=d,f=xt(m,"$current",n),v=f.$info,w=f.state.layer,y=f.settings,b=f.camera;if(l)for(let q=0;q<l.frames;q++)c.push({id:v.id+"/"+q,image:f,visible:vt(!1),frame:q,opts:{area:[0,0,1,1]},ptr:-1,baseTileIdx:-1,thumbSrc:f.getTileSrc(f.levels,0,0,q)});const x=i().gallery,T="omni"==x.type,k=T||"swipe-full"==x.type,_=k||"switch"==x.type,M=!_&&!("frame"in(c[0]??{})),S=T,E=!!x.isSpreads,I=x.coverPages??0,A=i().omni,L=T&&!!A?.twoAxes,P=x.startId||d.getAttribute("data-gallery-start-id"),$=x.archive,C=!!i().limitToCoverScale,D=!!i().noUI,z=A?.frontIndex??0,O=A?.layers?.length??1,R=d.hasAttribute("data-gallery-start")?Number(d.getAttribute("data-gallery-start")):i()?.omni?.startIndex;let X=null==R||isNaN(R)?P?c.findIndex(t=>t.id==P):0:R;X<0&&(X=0);const F=[],V=[];if(M)for(let q=0;q<c.length;q++)F.push([0,0,1,1]),V.push([q]);else if(c)for(let q=0;q<c.length;q++){let t=c[q].opts?.area;if(!t)continue;const e=t.slice(0);if(V.push([q]),E&&q-I>=0&&(q-I)%2==0&&c[q+1]){if(t=c[++q].opts?.area,!t)continue;V[V.length-1].push(q),e[2]=t[2],e[3]=t[3]}F.push(e)}const Y=F.length/O,N=A?.layers?.map(t=>({i18n:Object.fromEntries(Object.entries(t.i18n).map(([t,e],i)=>[t,{title:e??"Layer "+(i+1)}]))}))??[];Object.keys(v.revision??{[(()=>xt(p,"$_lang",n))()]:0}).forEach(t=>N.forEach((e,i)=>{e.i18n[t]||(e.i18n[t]={title:"Layer "+(i+1)})}));let B=ne(-1),W=_,U=ne(!0),H=ne(!1),G=ne(!0),j=!1,Z=ne(0);function J(t,e=!1,i=150,s=!1){if(S){for(;t<0;)t+=Y;t%=Y}const r=t=Math.round(Math.max(0,Math.min(Y-1,t))),n=s||r!=Ei(B);if(oe(B,r,!0),n&&tt(),M)!function(t,e,i,s){if(!c[t])return;const r=0===i?0:e?K/2:K,n=c[Ei(B)>-1&&Ei(B)!=t?Ei(B):-1],a=s&&r>0&&n?.camera&&!n.camera.isZoomedOut(),o=()=>{u.setGridTransitionDuration(r);for(let e=0;e<c.length;e++){const i=c[e];if(!i?.camera)continue;const s=i.opts.area??[0,0,1,1],n=s[0],a=n>=-1&&n<=1,o=e-t,h=Do(o),l=Math.abs(o)<=1,d=Math.abs(s[0]-h[0])>1e-4||Math.abs(s[2]-h[2])>1e-4,u=r>0&&d&&(a||l);i.camera.setArea(h,{direct:!u,noDispatch:!0})}u.render()};a?n.camera.flyToCoverView({duration:1e3*r*.6,speed:2}).then(o).catch(o):o()}(Ei(B),e,i,n);else if(_){if(n)if(u.setActiveImage(f.ptr,V[Ei(B)][0],V[Ei(B)].length-1),T)u.render();else{const t=F[Ei(B)];b.flyToView([t[0],t[1],t[2]-t[0],t[3]-t[1]],{duration:i,speed:2}).then(()=>ot(F[Ei(B)],!0)).catch(()=>{}),ee()}}else{const s=b.getViewLegacy(),r=F[t],a=rn.fromLegacy(r),o=j&&(W&&!Ei(H)||n||s[0]<r[0]!=s[2]>r[2]);oe(H,!1),o?b.flyToView(a,{duration:i,speed:1,progress:e?.5:0}).then(()=>ot(r,!0)).catch(()=>{}):(a&&0==i&&b.setView(a),ot(r,!0))}f.album.hooked=j=!0}const K=.35;function tt(t){if(Kt&&t){if(Kt.currentIndex==Ei(B))return;oe(B,Kt.currentIndex,!0)}at(Ei(B)),g.dispatch("gallery-show",Ei(B)),T&&oe(Z,(Ei(B)-z)/Y*360),M&&f.album?.currentImage?.set(c[Ei(B)])}const st="requestIdleCallback"in self?T?Math.max(36,2*Math.floor(c.length/8)):100:50,rt=new Map,nt=self.requestIdleCallback??self.requestAnimationFrame;function at(t){const e=[];N.length&&(t+=s()*Math.floor(o().length/N.length)),E&&t>=I&&(t=2*t-I);const i=Math.floor(t/qt);for(let s=-st;s<=st;s++)if(s){let r=t+s;if(L){const t=Math.floor(r/qt);t<i&&(r+=qt),t>i&&(r-=qt)}if(S){for(;r<0;)r+=o().length;for(;r>=o().length;)r-=o().length}e.push(r)}if(L)for(let s=-st;s<=st;s++)s&&e.push(t+s*qt);e.filter((t,i)=>t>=0&&t<o().length&&e.indexOf(t)==i).map(t=>o()[t]).filter(t=>!!t&&!rt.has(t.id)).forEach(t=>rt.set(t.id,nt(()=>u.getTexture(t.baseTileIdx,t.thumbSrc,!1,{force:!!$}))))}function ot(t,e){W=b.isZoomedOut(),b.setLimit(!e&&W?[-1,t[1],2,t[3]]:t)}const ht=16;function ct(t){if(!Ei(ut))return 0;const e=Ei(ut).clientWidth;return ht+t/Math.max(1,Y-1)*(e-32)}function lt(t){const e=V[t];return e?.length?1===e.length?String(e[0]+1):`${e[0]+1}–${e[e.length-1]+1}`:String(t+1)}let dt,ut=ne(void 0),mt=ne(0);const gt=jt(()=>!Ei(ut)||Ei(U)?Ei(mt):ct(Ei(B)));let pt=!1;function ft(t){t.preventDefault(),t.stopPropagation(),Ei(U)||(pt="button"in t)&&0!=t.button||!Ei(ut)||(dt=Ei(ut).getClientRects()[0],d.keepRendering=oe(U,!0),oe(Mt,-1),window.addEventListener(pt?"pointermove":"touchmove",yt),window.addEventListener(pt?"pointerup":"touchend",Et),yt(t))}function wt(t){const e=dt??Ei(ut).getClientRects()[0],i="button"in t?t.clientX:t.touches[0].clientX,s=Math.min(1,Math.max(0,(i-e.left-ht)/(e.width-32)));return[s,Math.max(0,Math.min(Y-1,Math.round(s*Math.max(1,Y-1))))]}function yt(t){const[e,i]=wt(t);oe(mt,ht+e*(dt.width-32)),i!=Ei(B)&&J(i,!0)}let bt,Tt,_t,Mt=ne(-1);function St(t){Ei(U)||oe(Mt,wt(t)[1],!0)}function Et(){window.removeEventListener(pt?"pointermove":"touchmove",yt),window.removeEventListener(pt?"pointerup":"touchend",Et),oe(U,d.keepRendering=!1,!0),J(Ei(B))}function It(){W&&(Tt=bt=Ei(B),oe(H,W,!0),ot(F[Ei(B)],!1))}function At(t){const e=t.detail;"panend"!=t.type||e?J(Tt!=Ei(B)?Tt:Ei(B)+(bt==Ei(B)&&Ei(H)&&e?Math.round(Math.min(1,Math.max(-1,-e.movedX/e.duration))):0)):oe(H,!1)}function Lt(t){if(!t)return;const e=rn.toCenterJSON(t),i=e.centerX,s=F.map((t,s)=>(1-Math.min(Math.abs(i-t[0]),Math.abs(i-t[2])))*Math.max(0,(Math.min(i+e.width/2,t[2])-Math.max(i-e.width/2,t[0]))/(t[2]-t[0]))*(1-.1*Math.abs(Ei(B)-s)));u.setFocus(f.ptr,F[Tt=s.every(t=>!t)?Ei(B):s.indexOf(Math.max(...s))],Ei(H)),W=b.isZoomedOut()}let Pt=0,$t=0,Ct=0,Dt=0,zt=!1,Ot=!1,Rt=0;function Xt(t){c[Ei(B)]?.camera?.isZoomedOut()&&0==t.button&&void 0===_t&&(_t=t.pointerId,Pt=$t=t.clientX,Rt=t.clientY,Ct=t.timeStamp,Dt=0,zt=!1,Ot=!1,window.addEventListener("pointermove",Ft),window.addEventListener("pointerup",Vt),window.addEventListener("pointercancel",Vt))}function Ft(t){if(t.pointerId!==_t)return;const e=t.clientX-Pt,i=t.clientY-Rt;if(!zt){if(Math.abs(e)<6&&Math.abs(i)<6)return;if(Ot=Math.abs(e)>Math.abs(i),!Ot)return void Vt(t);zt=!0,d.setAttribute("data-panning",""),d.keepRendering=!0,d.canvas.element.setPointerCapture(t.pointerId)}const s=Math.max(1,t.timeStamp-Ct);Dt=(t.clientX-$t)/s,$t=t.clientX,Ct=t.timeStamp,function(t){const e=0==Ei(B)&&t>0,i=Ei(B)==c.length-1&&t<0,s=e||i?Math.sign(t)*Math.sqrt(Math.abs(t))*.3:t;c[Ei(B)]?.camera?.setArea(Do(s),{direct:!0,noDispatch:!0}),s<0&&Ei(B)<c.length-1?c[Ei(B)+1]?.camera?.setArea(Do(1+s),{direct:!0,noDispatch:!0}):s>0&&Ei(B)>0&&c[Ei(B)-1]?.camera?.setArea(Do(-1+s),{direct:!0,noDispatch:!0});u.render()}(e/(d.offsetWidth||1))}function Vt(t){if(t.pointerId!==_t)return;window.removeEventListener("pointermove",Ft),window.removeEventListener("pointerup",Vt),window.removeEventListener("pointercancel",Vt);const e=zt;if(_t=void 0,zt=!1,d.removeAttribute("data-panning"),d.keepRendering=!1,!e)return;try{d.canvas.element.releasePointerCapture(t.pointerId)}catch(n){}const i=d.offsetWidth||1,s=(t.clientX-Pt)/i;let r=Ei(B);s<-.3||Dt<-.5?r=Math.min(c.length-1,Ei(B)+1):(s>.3||Dt>.5)&&(r=Math.max(0,Ei(B)-1)),J(r)}let Yt=0,Nt=[0,0,0,0];function Bt(t){t.stopPropagation(),t.preventDefault(),0==t.button&&(oe(U,!0),Nt=[t.clientX,t.clientY,Ei(B),Yt],window.addEventListener("pointermove",Ut),window.addEventListener("pointerup",Ht))}const qt=c.length,Wt=1;function Ut(t){Yt=Math.max(0,Math.min(Wt-1,Nt[3]+Math.round((Nt[1]-t.clientY)/360*Wt)));let e=(Nt[2]+Math.round((Nt[0]-t.clientX)/360*qt))%qt;for(;e<0;)e+=qt;J(Yt*qt+e)}function Ht(){removeEventListener("pointermove",Ut),removeEventListener("pointerup",Ht),oe(U,!1)}let Gt=-1;const Zt=()=>{N.length&&f.data.update(t=>{t||(t={}),t.pages||(t.pages=[]);const e={id:"_omni-layers",i18n:N[s()].i18n,icon:ea.layerGroup,children:N.map((t,e)=>({id:"omni-layer-"+e,i18n:t.i18n,action:()=>{w.set(e),at(Ei(B))}})).filter(t=>t.id!="omni-layer-"+s())};return Gt>=0&&Gt<t.pages.length?t.pages.splice(Gt,1,e):t.pages.push(e),Gt=t.pages.length-1,t})};let Jt,Kt,Qt=d.state.ui.hidden,te=d.state.ui.hover;function ee(){Qt.set(!1),clearTimeout(Jt),Jt=setTimeout(()=>Qt.set(!0),2e3)}f.album={numPages:F.length,get currentIndex(){return Ei(B)},info:f.$settings.album,prev:()=>J(Ei(B)-1),next:()=>J(Ei(B)+1),goto:J,...M?{currentImage:vt(c[X])}:{}},ps(()=>{(M?Promise.all(c.map(t=>u.addChild(t,f))):Promise.all(o().map(t=>("state"in t&&!("image"in t)&&(t.camera=f.camera),u.addEmbed(t,f,{opacity:0,asImage:"camera"in t}))))).then(()=>{if(M){u.setGridTransitionTimingFunction(Ao.Camera.TimingFunction["ease-out"]);for(let t=0;t<c.length;t++){const e=c[t];e.camera&&(e.camera.setCoverLimit(!1),e.camera.setArea(Do(t-X),{direct:!0,noDispatch:!0}),e.camera.setView([0,0,1,1],{noRender:!0}))}for(const t of c)t.visible.set(!0);oe(B,X,!0),tt(),f.album.hooked=j=!0,u.render()}else u.setActiveImage(f.ptr,X),J(X,!1,0);oe(U,!1)}),T&&O>1&&Zt(),oe(G,!1),d.goto=J;const t=[],e=[];if(T&&t.push(f.state.layer.subscribe(Zt)),k&&(Kt=f.swiper=new Lo(d,Y,J,{continuous:S,coverLimit:C})),e.push(()=>{d.canvas.element.removeEventListener("pointermove",ee),d.canvas.element.removeEventListener("pointerdown",ee)}),T||L||k||(d.canvas.element.addEventListener("pointermove",ee),d.canvas.element.addEventListener("pointerdown",ee),ee()),_&&t.push(f.state.view.subscribe(()=>{W=b.isZoomedOut()})),!(_||k||o().length<=1))if(L||oe(mt,ct(X),!0),M){const t=Xt;d.canvas.element.addEventListener("pointerdown",t),e.push(()=>d.canvas.element.removeEventListener("pointerdown",t))}else t.push(f.state.view.subscribe(Lt)),d.addEventListener("panstart",It),d.addEventListener("panend",At),d.addEventListener("pinchend",At),e.push(()=>{d.removeEventListener("panstart",It),d.removeEventListener("panend",At),d.removeEventListener("pinchend",At)});return T&&d.addEventListener("move",tt),()=>{for(Kt&&Kt.destroy();t.length;)t.shift()?.();for(;e.length;)e.shift()?.();T&&d.removeEventListener("move",tt),te.set(!1)}});var ie=Hi();Oi("keydown",pe,function(t){if(!i().omni?.noKeys){switch(t.key){case"PageUp":case"ArrowLeft":J(Ei(B)-(T?-1:1),!0);break;case"PageDown":case"ArrowRight":J(Ei(B)+(T?-1:1),!0);break;case"ArrowUp":L&&J(Ei(B)+qt);break;case"ArrowDown":L&&J(Ei(B)-qt);break;case"Home":J(0);break;case"End":J(Y);break;default:return}ee()}});var se=_e(ie),re=t=>{var e=Hi(),s=_e(e),a=t=>{var e=Xo();let i;Ye(()=>i=qs(e,1,"angular micrio-gallery",null,i,{dragging:Ei(U)})),Oi("pointerdown",e,Bt,!0),Gi(t,e)},h=t=>{{let e=jt(()=>i().omni?.showDegrees);!function(t,e){et(e,!0);const i=Q("micrio"),s=i.$current.camera;let r,n=ne(void 0),a=0,o=0;function h(t){const r=Math.max(1,(s.getXY(1,.5)[0]-s.getXY(0,.5)[0])/i.offsetWidth),h=(o/360+(a-t.clientX)/(Ei(n).offsetWidth*r))*e.frames;e.onturn?.(h)}function c(){r&&i.releasePointerCapture(r),i.removeAttribute("data-panning"),i.removeEventListener("pointermove",h),i.removeEventListener("pointerup",c)}const l=jt(()=>-e.currentRotation/360*(Ei(n)?.offsetWidth??0));var d=Oo(),u=ke(d),m=t=>{var i=zo(),s=ke(i);q(i),Ye(t=>ns(s,`${t??""}º`),[()=>Math.round(10*e.currentRotation)/10]),Gi(t,i)};vs(u,t=>{e.degrees&&t(m)}),q(d),fr(d,t=>oe(n,t),()=>Ei(n)),Ye(()=>Us(d,`--micrio-dial-offset:${Ei(l)??""}px;`)),Oi("pointerdown",d,function(t){t.stopPropagation(),t.preventDefault(),0==t.button&&(i.addEventListener("pointermove",h),i.addEventListener("pointerup",c),i.setAttribute("data-panning",""),i.setPointerCapture(r=t.pointerId),o=e.currentRotation,a=t.clientX)},!0),Gi(t,d),it()}(t,{get currentRotation(){return Ei(Z)},get frames(){return Y},get degrees(){return Ei(e)},onturn:t=>J(t)})}},l=t=>{const e=jt(()=>Y),i=jt(()=>c.length),s=jt(()=>Ei(e)>24),a=jt(()=>Ei(s)?Math.max(1,Math.ceil(Ei(e)/24)):1),o=jt(()=>Ei(e)>1?Ei(B)/(Ei(e)-1)*100:0);var h=Yo();let l;var d=ke(h);{let t=jt(()=>0==Ei(B));pa(d,{type:"arrow-left",get title(){return r().galleryPrev},className:"gallery-btn",onpointerdown:t=>0===t.button&&J(Ei(B)-1),get disabled(){return Ei(t)}})}var u=Me(d,2);let m;var g=ke(u),p=ke(g);q(g);var f=Me(g,2);bs(f,21,()=>F,ws,(t,i,r)=>{var n=Hi(),o=_e(n),h=t=>{var i=Fo();let n;Ye(()=>{n=qs(i,1,"tick micrio-gallery",null,n,{major:Ei(s)&&r%(5*Ei(a))==0,active:r===Ei(B),hover:r===Ei(Mt)}),Us(i,`left:${Ei(e)>1?r/(Ei(e)-1)*100:50}%`)}),Gi(t,i)};vs(o,t=>{Ei(s)&&r%Ei(a)!==0&&r!==Ei(e)-1&&r!==Ei(B)||t(h)}),Gi(t,n)}),q(f);var v=Me(f,2),w=t=>{var i=Vo(),s=ke(i,!0);q(i),Ye(t=>{Us(i,`left:${Ei(e)>1?Ei(Mt)/(Ei(e)-1)*100:50}%`),ns(s,t)},[()=>lt(Ei(Mt))]),Gi(t,i)};vs(v,t=>{Ei(Mt)>=0&&Ei(Mt)!==Ei(B)&&!Ei(U)&&t(w)});var y=Me(v,2);let b;ar(y,"aria-valuemin",1);var x=Me(y,2);let T;var k=ke(x);q(x),q(u),fr(u,t=>oe(ut,t),()=>Ei(ut));var _=Me(u,2);{let t=jt(()=>Ei(B)>=Ei(e)-1);pa(_,{type:"arrow-right",get title(){return r().galleryNext},className:"gallery-btn",onpointerdown:t=>0===t.button&&J(Ei(B)+1),get disabled(){return Ei(t)}})}q(h),Ye(t=>{l=qs(h,1,"micrio-gallery",null,l,{hidden:Ei(G)||xt(Qt,"$hidden",n)&&!xt(te,"$hover",n)&&!Ei(U)&&!Ei(H)}),m=qs(u,1,"micrio-gallery",null,m,{dense:Ei(s)}),Us(p,`width:${Ei(o)}%`),b=qs(y,1,"handle micrio-gallery",null,b,{dragging:Ei(U)}),Us(y,`left: ${Ei(gt)}px`),ar(y,"aria-valuemax",Ei(i)),ar(y,"aria-valuenow",(V[Ei(B)]?.[0]??Ei(B))+1),T=qs(x,1,"handle-label micrio-gallery",null,T,{dragging:Ei(U)}),Us(x,`left: ${Ei(gt)}px`),ns(k,`${t??""}${Ei(s)?` / ${Ei(i)}`:""}`)},[()=>lt(Ei(B))]),Ri("pointerover",h,()=>te.set(!0)),Ri("pointerout",h,t=>{t.currentTarget.contains(t.relatedTarget)||te.set(!1)}),Ri("focusin",h,()=>te.set(!0)),Ri("focusout",h,t=>{t.currentTarget.contains(t.relatedTarget)||te.set(!1)}),Oi("pointerdown",u,ft,!0),Oi("touchstart",u,ft,!0,!0),Ri("pointermove",u,St),Oi("pointerleave",u,()=>oe(Mt,-1)),Gi(t,h)};vs(s,t=>{L?t(a):A&&!A.noDial&&T?t(h,1):!k&&o().length>1&&t(l,2)}),Gi(t,e)};vs(se,t=>{D||t(re)}),Gi(t,ie),it(),a()}Xi(["pointerover","pointerout","focusin","focusout","pointermove"]);var Bo,qo,Wo={},Uo=vt(),Ho=vt(!1);function Go(t,e,i){qo&&(qo.setPosition?qo.setPosition(t,e,i):"positionX"in qo&&(qo.positionX.value=t,qo.positionY.value=e,qo.positionZ.value=i))}function jo(t,e,i){qo&&(qo.setOrientation?qo.setOrientation(t,e,i,0,1,0):"forwardX"in qo&&(qo.forwardX.value=t,qo.forwardY.value=e,qo.forwardZ.value=i))}function Zo(t,e){et(e,!0);const[i,s]=kt();let r=br(e,"volume",3,1);const{events:n,current:a}=Q("micrio"),o=xt(a,"$current",i),h=o.$info,c=h.height/h.width,l="AudioContext"in window||"webkitAudioContext"in window;const d=()=>Ho.set(!0),u=new Audio("data:audio/mpeg;base64,/+MYxAAAAANIAUAAAASEEB/jwOFM/0MM/90b/+RhST//w4NFwOjf///PZu////9lns5GFDv//l9GlUIEEIAAAgIg8Ir/JGq3/+MYxDsLIj5QMYcoAP0dv9HIjUcH//yYSg+CIbkGP//8w0bLVjUP///3Z0x5QCAv/yLjwtGKTEFNRTMuOTeqqqqqqqqqqqqq/+MYxEkNmdJkUYc4AKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq");u.volume=Jr.iOS?0:1e-4,l&&ps(()=>{let t,i;return i=Ho.subscribe(s=>{s&&(Bo||(!function(t){if(!Ro){if(Bo||(Bo="micrioAudioContext"in window?window.micrioAudioContext:"AudioContext"in window?new window.AudioContext:"webkitAudioContext"in window?new window.webkitAudioContext:null),!Bo)return console.warn("[Micrio] Your browser does not support the Web Audio API");(Ro=Bo.createGain()).connect(Bo.destination),Ro.gain.value=t,Uo.set(Bo),"upX"in(qo=Bo.listener)&&(qo.upX.value=0,qo.upY.value=1,qo.upZ.value=0)}}(r()),n.dispatch("audio-init")),Bo&&e.data.markers?.filter(t=>!!t.positionalAudio).length&&(t=o.state.view.subscribe(t=>{if(!t)return;const i=Math.max(0,1.05-o.camera.getScale());!function(t,i,s){if(e.is360){t*=2*-Math.PI,i-=.5,i*=-Math.PI;const e=10*(1-s),r=Math.cos(i)*Math.sin(t)*e,n=Math.sin(i)*e,a=Math.cos(i)*Math.cos(t)*e;Go(r,n,a);let o=r*r+n*n+a*a;o>0&&(o=1/Math.sqrt(o)),jo(r*o,n*o,a*o)}else Go(2*(t-.5),2*(.5-i)*c,s),jo(0,0,-1)}(t[0]+t[2]/2,t[1]+t[3]/2,i*(e.is360?1:1.5))})),i&&(i(),i=null))}),Bo||u.play().then(d).catch(()=>{n.dispatch("autoplay-blocked"),addEventListener("pointerup",d,{once:!0})}),()=>{t&&t(),i&&i(),removeEventListener("pointerup",d)}}),Re(()=>{Ro&&(Ro.gain.value=r())});var m=Hi(),g=_e(m),p=t=>{{let t=jt(()=>r()*(e.data.music.volume??1));!function(t,e){et(e,!0);let i=br(e,"loop",3,!0),s=br(e,"volume",3,1);const r=ue(new Audio);r.preload="none",r.loop=!1,r.onended=a;let n=-1;function a(){if(!i()&&n+1==e.list.length)return;const t=e.list[++n%e.list.length];r.src=Fn(t)??"",r.play()}ps(()=>(a(),()=>r.pause())),Re(()=>{r.volume=s()}),it()}(0,{get list(){return e.data.music.items},get loop(){return e.data.music.loop},get volume(){return Ei(t)}})}};vs(g,t=>{xt(Ho,"$interacted",i)&&xt(Uo,"$ctx",i)&&e.data.music?.items.length&&t(p)}),Gi(t,m),it(),s()}var Jo=Bi('<cite class="micrio-details"> </cite>'),Ko=Bi('<small class="micrio-details"> </small>'),Qo=Bi('<summary class="micrio-details"><!> <!></summary>'),th=Bi('<p class="micrio-details"><a rel="noopener noreferrer" target="_blank"> </a></p>'),eh=Bi("<details><!> <!> <!> <!></details>");function ih(t,e){et(e,!0);const i=()=>xt(o,"$current",r),s=()=>xt(e.data,"$data",r),[r,n]=kt(),{_lang:a,current:o}=Q("micrio");let h=ne(!1);function c(t){let e="cm";return t>=1e5?(e="km",t/=1e5):t>=100?(e="m",t/=100):t<1e-6?(e="nm",t*=1e7):t<.001?(e="µm",t*=1e4):t<1&&(e="mm",t*=10),t.toFixed(2)+" "+e}const l=jt(()=>i()?.$settings.cmWidth),d=jt(()=>i()?.$settings.cmHeight),u=jt(()=>s()?s()?.i18n?s().i18n[xt(a,"$_lang",r)]:s():void 0),m=jt(()=>Ei(u)?.title??xt(e.info,"$info",r)?.title??""),g=jt(()=>Ei(u)?.description),p=jt(()=>Ei(u)?.sourceUrl),f=jt(()=>Ei(u)?.copyright),v=jt(()=>Ei(l)&&Ei(d)?c(Ei(l))+" x "+c(Ei(d)):null);let w=ne(void 0);ps(()=>{Ei(w).ontoggle=()=>{oe(h,Ei(w).open,!0)}});var y=Hi(),b=_e(y),x=t=>{var e=eh();let i;var s=ke(e),n=t=>{var e=Qo(),i=ke(e),s=t=>{var e=Jo(),i=ke(e,!0);q(e),Ye(()=>ns(i,Ei(m))),Gi(t,e)};vs(i,t=>{Ei(m)&&t(s)});var r=Me(i,2),n=t=>{var e=Ko(),i=ke(e,!0);q(e),Ye(()=>ns(i,Ei(v))),Gi(t,e)};vs(r,t=>{Ei(v)&&t(n)}),q(e),Gi(t,e)};vs(s,t=>{(Ei(m)||Ei(v))&&t(n)});var a=Me(s,2),o=t=>{var e=Hi();Ms(_e(e),()=>Ei(g)),Gi(t,e)};vs(a,t=>{Ei(g)&&t(o)});var c=Me(a,2),l=t=>{var e=th(),i=ke(e),s=ke(i,!0);q(i),q(e),Ye(()=>{ar(i,"href",Ei(p)),ns(s,Ei(f)||Ei(p))}),Gi(t,e)};vs(c,t=>{Ei(p)&&t(l)});var d=Me(c,2),u=t=>{pa(t,{type:"close",get title(){return xt(Jn,"$i18n",r).close},onclick:()=>Ei(w).open=!1})};vs(d,t=>{Ei(h)&&t(u)}),q(e),fr(e,t=>oe(w,t),()=>Ei(w)),Ye(()=>i=qs(e,1,"micrio-details",null,i,{opened:Ei(h)})),Ds(3,e,()=>qn,()=>({duration:200})),Gi(t,e)};vs(b,t=>{(Ei(m)||Ei(g)||Ei(p))&&t(x)}),Gi(t,y),it(),n()}var sh=Bi('<div class="micrio-error"><!> </div>');var rh=Bi('<figcaption class="micrio-micrio-gallery"></figcaption>'),nh=Bi('<figure class="micrio-micrio-gallery"><micr-io></micr-io> <!></figure>',2);function ah(t,e){et(e,!0);const i=()=>xt(o,"$current",s),[s,r]=kt();let n=br(e,"startId",3,void 0);const{_lang:a,current:o}=Q("micrio");let h=ne(void 0),c=ne(0);const l=jt(()=>e.gallery[Ei(c)]),d=jt(()=>Ei(l)?.i18n?.[xt(a,"$_lang",s)]?.description??void 0);fs(()=>Ei(h)?.destroy());var u=nh(),m=ke(u);Ye(()=>or(m,"data-gallery",e.gallery.map(t=>`${t.micrioId},${t.width},${t.height},${t.isDeepZoom?"d":""}${t.isWebP?",w":t.isPng||!i()?.isV5&&t.src?.endsWith(".png")?",p":""}`).join(";"))),Ye(()=>or(m,"data-start",n())),Ye(()=>or(m,"data-path",i()&&i().$info&&i().$info.path)),or(m,"data-logo","false"),qs(m,1,"micrio-micrio-gallery"),fr(m,t=>oe(h,t),()=>Ei(h));var g=Me(m,2),p=t=>{var e=rh();Ms(e,()=>Ei(d),!0),q(e),Gi(t,e)};vs(g,t=>{Ei(d)&&t(p)}),q(u),Oi("gallery-show",m,t=>{oe(c,t.detail,!0)}),Gi(t,u),it(),r()}var oh=Bi("<!> <!>",1),hh=Bi("<aside><!> <!></aside>"),ch=Bi("<!> <!>",1),lh=Bi('<menu class="micrio-popover"></menu>'),dh=Bi('<h2 class="micrio-popover"> </h2>'),uh=Bi('<img alt=""/>'),mh=Bi("<!> <!> <!> <!>",1),gh=Bi('<menu class="right micrio-popover"></menu>'),ph=Bi("<!> <!> <!>",1),fh=Bi("<dialog><!> <!></dialog>");function vh(t,e){et(e,!0);const i=()=>xt(l,"$current",n),s=()=>xt(d,"$_lang",n),r=()=>xt(Jn,"$i18n",n),[n,a]=kt(),o=ue(Q("micrio")),{events:h,state:c,current:l,_lang:d}=o,u=i()?.$data,m=Object.keys(u?.revision??{[s()]:0});function g(){Ei(w)?.close()}const p=vt(!1);let f=ne(!0),v=s(),w=ne(void 0);ps(()=>{Ei(w).showModal(),Si().then(()=>{(Ei(w).querySelector("button.active")??Ei(w).querySelector("button"))?.focus()});const t=d.subscribe(t=>{t&&t!=v&&(oe(f,!1),v=t,setTimeout(()=>oe(f,!0),200))});return()=>{t()}});const y=jt(()=>e.popover.marker),b=jt(()=>Ei(y)?Vn(Ei(y),s()):void 0),x=jt(()=>e.popover.markerTour),T=jt(()=>e.popover.contentPage),k=jt(()=>{return Ei(T)?(t=Ei(T),e=s(),t.i18n?.[e]??t):void 0;var t,e}),_=jt(()=>Ei(T)&&Ei(k)&&!Ei(T)?.buttons?.length?!(!Ei(k).embed||Ei(k).content&&!(Ei(k).content.length<250)||Ei(T).image):void 0),M=jt(()=>Ei(T)?.image?"string"==typeof Ei(T).image?Ei(T).image:Ei(T).image.src:void 0),S=jt(()=>!!Ei(k)?.embed||!!Ei(M)),E=jt(()=>!!Ei(T)?.buttons?.find(t=>"close"==t.type)),I=jt(()=>!!e.popover.marker?.images&&e.popover.marker.images.length>0),A=jt(()=>!(!Ei(b)||!Ei(b).body)||Ei(I)),L=jt(()=>Ei(b)&&Ei(b).body||Ei(I)&&Ei(k)?.embed),P=jt(()=>!Ei(E)||Ei(x)&&null!=Ei(x).currentStep);var $=fh();let C;var D=ke($),z=t=>{var e=hh();let i;var s=ke(e),n=t=>{pa(t,{type:"close",get title(){return r().close},className:"close-popover",onclick:g})};vs(s,t=>{Ei(E)||t(n)});var a=Me(s,2),o=t=>{var e=oh(),i=_e(e),s=t=>{pa(t,{type:"arrow-left",get title(){return r().tourStepPrev},className:"prev-tour-step",onclick:()=>Ei(x)&&Ei(x).prev&&Ei(x).prev()})};vs(i,t=>{Ei(x).currentStep>0&&t(s)});var n=Me(i,2),a=t=>{pa(t,{type:"arrow-right",get title(){return r().tourStepNext},className:"next-tour-step",onclick:()=>Ei(x)&&Ei(x).next&&Ei(x).next()})};vs(n,t=>{Ei(x).currentStep<Ei(x).steps.length-1&&t(a)}),Gi(t,e)};vs(a,t=>{Ei(x)&&null!=Ei(x).currentStep&&t(o)}),q(e),Ye(()=>i=qs(e,1,"micrio-popover",null,i,{inside:Ei(T)?!Ei(_):!Ei(A)&&!Ei(b)?.embedUrl})),Gi(t,e)};vs(D,t=>{Ei(P)&&t(z)});var O=Me(D,2),R=t=>{var e=ch(),i=_e(e),s=t=>{so(t,{get src(){return Ei(b).embedUrl},get uuid(){return Ei(y).id},get figcaption(){return Ei(b).embedDescription},controls:!0,get autoplay(){return Ei(y).embedAutoPlay}})},r=t=>{ah(t,{get gallery(){return Ei(y).images}})};vs(i,t=>{Ei(b)&&Ei(b).embedUrl?t(s):Ei(y).images&&Ei(y).images.length&&t(r,1)});var n=Me(i,2),a=t=>{{let e=jt(()=>!Ei(b)||!Ei(b).embedUrl);mo(t,{get marker(){return Ei(y)},noEmbed:!0,noGallery:!0,get noImages(){return Ei(e)},onclose:g})}};vs(n,t=>{Ei(L)&&t(a)}),Gi(t,e)},X=t=>{ah(t,{get gallery(){return e.popover.gallery},get startId(){return e.popover.galleryStart}})},F=t=>{var e=ph(),r=_e(e),n=t=>{var e=lh();bs(e,21,()=>m,ws,(t,e)=>{{let i=jt(()=>Qn?.of(Ei(e))??Ei(e)),r=jt(()=>Ei(e)==s());pa(t,{onclick:()=>o.lang=Ei(e),get title(){return Ei(i)},get active(){return Ei(r)},children:(t,i)=>{W();var s=Ui();Ye(t=>ns(s,t),[()=>Ei(e).toUpperCase()]),Gi(t,s)},$$slots:{default:!0}})}}),q(e),Gi(t,e)};vs(r,t=>{m.length>1&&t(n)});var a=Me(r,2),h=t=>{var e=Hi(),i=_e(e),s=t=>{so(t,{get src(){return Ei(k).embed},get figcaption(){return Ei(k).content},controls:!0,autoplay:!0})};vs(i,t=>{Ei(f)&&t(s)}),Gi(t,e)},c=t=>{no(t,{children:(t,e)=>{var i=mh(),s=_e(i),r=t=>{var e=dh(),i=ke(e,!0);q(e),Ye(()=>ns(i,Ei(k).title)),Gi(t,e)};vs(s,t=>{Ei(k).title&&t(r)});var n=Me(s,2),a=t=>{so(t,{get src(){return Ei(k).embed},controls:!0})};vs(n,t=>{Ei(k).embed&&Ei(f)&&t(a)});var o=Me(n,2),h=t=>{var e=uh();Ye(()=>ar(e,"src",Ei(M))),Gi(t,e)};vs(o,t=>{Ei(M)&&t(h)});var c=Me(o,2),l=t=>{var e=Hi();Ms(_e(e),()=>Ei(k).content),Gi(t,e)};vs(c,t=>{Ei(k).content&&t(l)}),Gi(t,i)},$$slots:{default:!0}})};vs(a,t=>{Ei(_)?t(h):t(c,-1)});var l=Me(a,2),d=t=>{var e=gh();bs(e,21,()=>Ei(T).buttons,ws,(t,e)=>{{let r=jt(()=>"link"==Ei(e).type?Ei(e).action:void 0);pa(t,{get href(){return Ei(r)},get blankTarget(){return Ei(e).blankTarget},onclick:()=>function(t){g(),"close"!=t.type&&setTimeout(()=>{switch(t.type){case"marker":i()?.state.marker.set(t.action);break;case"mtour":o.state.tour.set(u?.markerTours?.find(e=>e.id==t.action));break;case"vtour":o.state.tour.set(u?.tours?.find(e=>e.id==t.action))}},200)}(Ei(e)),children:(t,i)=>{W();var r=Ui();Ye(()=>ns(r,Ei(e).i18nTitle[s()])),Gi(t,r)},$$slots:{default:!0}})}}),q(e),Gi(t,e)};vs(l,t=>{Ei(T).buttons&&Ei(T).buttons.length&&t(d)}),Gi(t,e)};vs(O,t=>{Ei(y)?t(R):e.popover.gallery?t(X,1):Ei(T)&&Ei(k)&&t(F,2)}),q($),fr($,t=>oe(w,t),()=>Ei(w)),Ye(()=>C=qs($,1,"micrio-popover",null,C,{page:!!Ei(T),article:!!Ei(T)&&!Ei(_),"has-media":Ei(S),gallery:!!e.popover.gallery})),Oi("close",$,function(){e.popover.contentPage?h.dispatch("page-closed"):Ei(x)?c.tour.set(void 0):e.popover.marker&&e.popover.image?.state.marker.set(void 0),c.popover.set(void 0)}),Oi("outrostart",$,()=>p.set(!0)),Gi(t,$),it(),a()}function wh(t,e){et(e,!0);const i=jt(()=>e.marker.positionalAudio),s=Li(()=>e.ctx).createGain();s.connect(Ro);const r=Q("micrio"),n=r.$current.$info,a=n.width,o=n.height,h=Li(()=>e.ctx).createPanner();h.panningModel="equalpower",h.rolloffFactor=1,h.coneOuterGain=0;function c(){if(s.gain.value=Ei(i).volume??1,e.is360){h.refDistance=2.75*Ei(i).radius,h.maxDistance=Ei(i).radius*(11/3);const t=e.marker.x*-Math.PI*2,s=(e.marker.y-.5)*-Math.PI,r=Math.cos(s)*Math.sin(t)*11,n=11*Math.sin(s),a=Math.cos(s)*Math.cos(t)*11;h.positionX.value=r,h.positionY.value=n,h.positionZ.value=a;let o=r*r+n*n+a*a;o>0&&(o=1/Math.sqrt(o)),h.orientationX.value=r*o,h.orientationY.value=n*o,h.orientationZ.value=a*o}else h.distanceModel="linear",h.positionX.value=2*(e.marker.x-.5),h.positionY.value=2*(.5-e.marker.y)*(o/a),h.positionZ.value=-.2,h.rolloffFactor=2,h.refDistance=Ei(i).radius*Ei(i).radius*10,h.maxDistance=5*Ei(i).radius}let l,d;function u(){l&&l.disconnect(),l=e.ctx.createBufferSource(),Ei(i).loop&&(Ei(i).repeatAfter>0?l.onended=()=>{d=setTimeout(u,1e3*Ei(i).repeatAfter)}:l.loop=!0),s.gain.value=Ei(i).volume??1,l.buffer=Wo[Ei(i).src],l.connect(h),l.start()}let m=ne(ue(JSON.stringify(Li(()=>e.marker.positionalAudio))));Re(()=>{const t=JSON.stringify(Ei(i));Ei(m)!=t&&oe(m,t,!0)&&c()}),ps(()=>(c(),h.connect(s),async function(){Ei(i).src&&(Wo[Ei(i).src]||(Wo[Ei(i).src]=await fetch(Ei(i).src).then(t=>t.arrayBuffer()).then(t=>e.ctx.decodeAudioData(t))),Ei(i).alwaysPlay&&Ei(i).repeatAfter>0?d=setTimeout(u,1e3*Ei(i).repeatAfter):u())}(),r.addEventListener("audio-update",c),()=>{r.removeEventListener("audio-update",c),l&&l.disconnect(),clearTimeout(d),h.disconnect(),s.disconnect()})),it()}var yh=Bi('<img alt="" class="micrio-marker"/>'),bh=Bi('<label data-scroll-through=""> </label>'),xh=Bi('<button data-scroll-through="" class="micrio-marker"><!> <!></button>'),Th=Bi("<div><!></div>"),kh=Bi("<!> <!>",1);function _h(t,e){et(e,!0);const i=()=>xt(d,"$current",h),s=()=>xt(T,"$tour",h),r=()=>xt(x,"$currentPopup",h),n=()=>xt(g,"$_lang",h),a=()=>xt(f,"$isMobile",h),o=()=>xt(Uo,"$ctx",h),[h,c]=kt(),l=Q("micrio"),{current:d,events:u,state:m,_lang:g,spaceData:p}=l,f=l.canvas.isMobile,v=m.markerHoverId,y=Q("inView"),b=Q("markerImages"),x=l.state.popup,T=m.tour;let k=br(e,"marker",15),_=br(e,"image",31,()=>ue(i())),M=br(e,"forceHidden",3,!1),S=br(e,"coords",3,void 0),E=br(e,"overlapped",3,!1);k().tags||k(k().tags=[],!0);const I=b.has(k().id);!I&&_()&&b.set(k().id,_());const A=!(!_().isOmni||!_().$settings.omni?.sideLabels||_().$settings._markers?.noTitles),L=t=>t.steps.findIndex(t=>t.startsWith(k().id))>=0,P=k().data??{},$=P._meta||{},C=_().$settings.omni;k().imageLayer&&k().imageLayer>(C?.layers?.length??1)-1&&delete k().imageLayer,i()?.$data?.markers?.find(t=>t.data?._micrioSplitLink?.markerId==k().id&&"none"!=t.popupType)&&(k(k().popupType="none",!0),k(k().noMarker=!0,!0)),"embedUrl"in k()&&k().embedUrl&&"embedInPopover"in k()&&k().embedInPopover&&k(k().popupType="popover",!0);const D=_().$settings._markers??{},z=!!_().$settings.doTourJumps,O=k().tags.join(" "),R="cluster"==k().type,X=!1===k().data?.showTitle||!!D.noTitles||!!C?.sideLabels,F=!!P.scales||!!_().$settings.markersScale,V=F&&!!D.titlesNoScale,Y=P._micrioSplitLink,N=!!D.keepPopupsDuringTourTransitions,B=/[?&]micrioNoTooltips/.test(location.search)||!!C?.sideLabels,W=$.gridAction,U=_().$settings?._markers?.autoStartTour?l.engine.images.map(t=>"camera"in t?t.$data?.markerTours?.find(L):void 0).filter(t=>!!t)[0]??p?.markerTours?.find(L):void 0,H=U?.steps.findIndex(t=>t.startsWith(k().id)),G=!!_().$settings?._markers?.autoStartTourAtBeginning;let j=!I&&(!!P.alwaysOpen||m.$marker==k())||m.$tour?.id==U?.id&&U?.currentStep==(H??0);let Z,J,K,tt=ne(ue(I&&_().state.$marker==k())),st=ne(!1),rt=ne(""),nt=ne(0),at=ne(0),ot=ne(1),ht=!1;function ct(){if(dt(),k().onclick)return k().onclick(k());if(!D.noMarkerActions)if("cluster"==k().type){if(k().view&&i()?.$info){const t=i().camera.getScale();_().camera.flyToView(k().view,{area:_().opts?.area,limitZoom:!0,margin:[20/i().$info.width*t,20/i().$info.height*t]})}}else _().state.marker.set(k())}function lt(){D.noMarkerActions||(Ei(Mt)?.parentNode?.scrollTo(0,0),dt(),K=setTimeout(()=>{const t=_().camera.getXY(k().x,k().y);!Ei(tt)&&(t[0]<0||t[0]>=l.offsetWidth||t[1]<0||t[1]>=l.offsetHeight||_().is360&&t[3]>4)&&_().camera.flyToCoo([k().x,k().y],{speed:2,limit:!0}).catch(()=>{})},150))}function dt(){clearTimeout(K)}const ut=()=>v.set(k().id),mt=()=>v.set(void 0);let gt;async function pt(){if(R)return;if(_().state.$marker!=k())return _().state.marker.set(k());if(D.noMarkerActions)return;if(U&&U.id!=s()?.id&&!s()){U.initialStep=G?0:H;const t=U.stepInfo?.[0];if(G&&t&&t.micrioId!=_().id){const e=l.canvases[0]?.grid;e?.images.find(e=>e.id==t.micrioId)?l.current.set(e.image):l.open(t.micrioId)}if(T.set(U),setTimeout(()=>$.gridAction=W,100),G&&null!=H&&H>0)return void _().state.marker.set(void 0);await Si()}var t;j=!1,u.dispatch("marker-opened",k()),s()&&"steps"in s()&&s().isSerialTour&&s().printChapters&&s().steps.findIndex(t=>t.startsWith(k().id))>=0&&k().videoTour||(Ei(Pt)?"popover"==k().popupType?(await Si(),l.state.popover.set({marker:k(),image:_(),markerTour:s()&&"steps"in s()?s():void 0})):k().videoTour&&!s()&&(T.set(k().videoTour),(t=T,new Promise(e=>{let i;i=t.subscribe(t=>{null==t&&(i?i():Si().then(()=>i()),e(t))})})).then(()=>_().state.marker.set(void 0))):Si().then(()=>x.set(k())));const e=P.micrioLink?.id;if(e&&Si().then(()=>{_().camera.stop();const t=Ln(l,e);t&&(_(_().openedView=void 0,!0),_().state.marker.set(void 0)),l.open(e,{vector:t?.vector})}),Y&&!ht&&!_().opts.secondaryTo){const t=l.canvases[0]?.grid;t?.lastPromise&&await t.lastPromise,gt=setTimeout(()=>{Y&&(J=l.open(Y.micrioId,{splitScreen:!0,splitTo:_(),isPassive:!(!Y.follows||l.state.$tour),startView:Y.view}),ht=!0)},200)}}let ft,vt,yt=ne(!1);function bt(){if(_().is360&&F)oe(rt,_().camera.getMatrix(k().x,k().y,1,1,0,0,0).join(","),!0);else{let i=Ei(nt),s=Ei(at);if(t=_().camera.getXYDirect(k().x,k().y,{radius:k().radius,rotation:k().rotation}),e=w(t,4),oe(nt,e[0],!0),oe(at,e[1],!0),oe(ot,e[2],!0),Z=e[3],_().is360)oe(st,Z>0);else if(_().isOmni&&C){if(null!=Ei(Ct)[0]&&null!=Ei(Ct)[1]&&null!=k().rotation){const t=C.frames/(C.layers?.length??1);let e=(_().swiper?.currentIndex??0)-(Ei($t)??0);e>t/2&&(e-=t),e<-t/2&&(e+=t),oe(st,e<=Ei(Ct)[0]||e>=Ei(Ct)[1],!0)}else C.distance&&oe(st,Z<0);C.sideLabels&&!D.noTitles&&Ei(It)?.title&&y&&(i!=Ei(nt)||s!=Ei(at))&&function(t,e){const i=l.canvas.element.offsetWidth,s=l.canvas.element.offsetHeight,r=!(t<0||t>i||e<0||e>s||Ei(st));(r||Ei(yt))&&y.update(s=>{const n=s.findIndex(([t])=>t==k());return r?n>=0?s[n]=[k(),t/i,e]:s.push([k(),t/i,e]):n>=0&&s.splice(n,1),oe(yt,r,!0),s})}(Ei(nt),Ei(at))}_().$settings.clusterMarkers&&S()&&S().set(k().id,[Ei(nt),Ei(at),E()?ft:ft=Ei(St)?.offsetWidth,E()?vt:vt=Ei(St)?.offsetHeight])}var t,e}function Tt(t){const e=t.detail;k(k().x=e.x,!0),k(k().y=e.y,!0),bt()}let _t=ne(void 0),Mt=ne(void 0),St=ne(void 0);const Et=Q("mediaPaused");ps(()=>{if(k().videoTour){const t="timeline"in k().videoTour?k().videoTour.timeline:k().videoTour.i18n?.[n()]?.timeline;t?.length&&k(k().view=t[0].rect,!0)}const t=[_().state.marker.subscribe(t=>{"string"==typeof t&&t==k().id?_().state.marker.set(k()):t==k()?async function(){if(Ei(tt))return;if(oe(tt,!0),dt(),D.noMarkerActions)return;u.dispatch("marker-open",k()),!s()||"steps"in s()&&(L(s())||s().cannotClose)||(T.set(void 0),await Si());const t=s()&&"steps"in s();Ei(Pt)||t&&N||(x.set(void 0),l.state.popover.set(void 0)),mt(),Y?.markerId&&(J||(J=l.canvases.find(t=>t.id==Y.micrioId)),J&&(ht=wt(J.visible),ht&&Y?.view&&J.camera.flyToView(Y.view,{isJump:!0}).catch(()=>{}))),void 0!==k().imageLayer&&_().state.layer.set(k().imageLayer);const e=U&&G&&U!=s()&&null!=H&&H>0;e&&delete $.gridAction;const i=k().view;e||!i||P.noAnimate||k().videoTour||$.gridView?pt():j?(_().camera.setView(k().view,{area:_().opts?.area}),pt()):_().camera.flyToView(k().view,{omniIndex:Ei($t),area:_().opts?.area,isJump:!!P.doJump||z&&!!m.$tour}).then(pt).catch(()=>{s()||_().state.marker.set(void 0)})}():P.alwaysOpen||(Ei(tt)&&function(){clearTimeout(gt),u.dispatch("marker-closed",k());const t=s()&&"steps"in s();if(s()||_().state.$marker||(k().videoTour||_().openedView?setTimeout(()=>_().camera.aniDoneAdd.push(()=>{wt(T)||_().state.$marker||Ei(_t)?.focus()}),10):Ei(_t)?.focus()),l.state.popover.set(void 0),!Ei(Pt)){r()!=k()||t&&N||x.set(void 0);const e=l.canvases.find(t=>t!=_()&&t.state.$marker);e&&Si().then(()=>{const t=e.state.$marker;t&&"popup"==t.popupType&&x.set(t)})}Y&&J&&setTimeout(()=>{const t=wt(l.state.marker);J&&Y.micrioId!=t?.data?._micrioSplitLink?.micrioId&&l.close(J)},210)}(),oe(tt,!1))})];return Ei(Lt)||(t.push(_().camera.image.state.view.subscribe(bt)),bt()),M()||Si().then(()=>{Ei(tt)&&!k().noMarker&&r()&&r()!=k()&&!s()?_().state.marker.set(void 0):(j||P.alwaysOpen)&&pt()}),k().htmlElement&&Ei(Mt)&&Ei(Mt).appendChild(k().htmlElement),()=>{for(clearTimeout(gt);t.length;)t.shift()?.()}});const It=jt(()=>Vn(k(),n())),At=jt(()=>!(Ei(It)?.title||Ei(It)?.body||Ei(It)?.bodySecondary||Ei(It)?.embedUrl||k().images&&k().images.length)),Lt=jt(()=>M()||k().noMarker),Pt=jt(()=>"popup"!=k().popupType||Ei(At)),$t=jt(()=>_().camera.getOmniFrame((k().rotation??0)+(k().backside?Math.PI:0))),Ct=jt(()=>k().visibleArc?[_().camera.getOmniFrame(k().visibleArc[0]),_().camera.getOmniFrame(k().visibleArc[1])]:[]),Dt=jt(()=>s()&&(!("steps"in s())&&!s().keepMarkers||D.hideMarkersDuringTour&&!xt(Et,"$tourPaused",h))&&!Ei(tt));Re(()=>{Ei(Dt)&&Ei(yt)&&y.update(t=>{const e=t.findIndex(t=>t[0]==k());return e>=0&&t.splice(e,1),t})});const zt=jt(()=>"default"==k().type?void 0:"link"==k().type?"link":"media"==k().type?"play":"cluster"==k().type?void 0:k().type??void 0),Ot=jt(()=>(null!=k().data?.customIconIdx?_().$settings._markers?.customIcons?.[k().data?.customIconIdx]:void 0)??k().data?.icon??D.markerIcon??void 0),Rt=jt(()=>!!Ei(zt)||!!Ei(Ot)),Xt=jt(()=>!("class"in k()&&""===k().class||!Ei(Rt)&&"default"!=k().type)),Ft=jt(()=>Ei(It)&&(!X||a()&&A)&&(Ei(It).label||Ei(It).title));var Vt=kh(),Yt=_e(Vt),Nt=t=>{var e=Th();let i;var s=ke(e),r=t=>{var e=xh(),i=ke(e),s=t=>{var e=yh();Ye(()=>ar(e,"src","string"==typeof Ei(Ot)?Ei(Ot):Ei(Ot).src)),Gi(t,e)},r=t=>{sa(t,{get name(){return Ei(zt)}})};vs(i,t=>{Ei(Ot)?t(s):Ei(zt)&&t(r,1)});var n=Me(i,2),a=t=>{var e=bh();let i;var s=ke(e,!0);q(e),fr(e,t=>oe(St,t),()=>Ei(St)),Ye(()=>{ar(e,"for",k().id),i=qs(e,1,"micrio-marker",null,i,{static:V}),ns(s,Ei(It)?.label||Ei(It)?.title)}),Gi(t,e)};vs(n,t=>{Ei(Ft)&&t(a)}),q(e),fr(e,t=>oe(_t,t),()=>Ei(_t)),Ye(()=>{ar(e,"title",B||R?null:Ei(It)?Ei(It).label||Ei(It).title:null),ar(e,"id",k().id)}),Ri("click",e,ct),Oi("focus",e,lt),Oi("blur",e,dt),Oi("mouseenter",e,ut),Oi("mouseleave",e,mt),Gi(t,e)};vs(s,t=>{k().htmlElement||t(r)}),q(e),fr(e,t=>oe(Mt,t),()=>Ei(Mt)),Rs(e,(t,e)=>{return s=e,(i=t).addEventListener("change",s),{destroy:()=>i.removeEventListener("change",s)};var i,s},()=>Tt),Ye(()=>{ar(e,"id",`m-${k().id}`),i=qs(e,1,Vs(O),"micrio-marker",i,{overlapped:E()&&!Ei(tt),cluster:R,behind:Ei(st),hovered:xt(v,"$hovered",h)==k().id,default:Ei(Xt),mat3d:!!Ei(rt),opened:Ei(tt),"micrio-link":!!P.micrioLink,"has-icon":Ei(Rt),"has-custom-icon":!!Ei(Ot)}),Us(e,Ei(rt)?`--mat:matrix3d(${Ei(rt)})`:Ei(nt)?`--x:${Ei(nt)}px;--y:${Ei(at)}px${F?`;--scale:${Ei(ot)}`:""}`:null)}),Gi(t,e)};vs(Yt,t=>{Ei(Lt)||!_()||Ei(Dt)||t(Nt)});var Bt=Me(Yt,2),qt=t=>{wh(0,{get marker(){return k()},get ctx(){return o()},get is360(){return _().is360}})};vs(Bt,t=>{k().positionalAudio&&o()&&(!k().positionalAudio.noMobile||a())&&(k().positionalAudio.alwaysPlay||Ei(tt))&&t(qt)}),Gi(t,Vt),it(),c()}Xi(["click"]);var Mh=Bi("<div><!></div>");function Sh(t,e){et(e,!0);const i=()=>xt(h,"$_lang",s),[s,r]=kt();let n=br(e,"settings",31,()=>ue({i18n:{}})),a=br(e,"image",15);const o=Q("micrio"),{_lang:h,spaceData:c}=o,l=a().$info,d=a().$settings,u=Mn(Li(()=>e.targetId))?.[2],m=Ln(o,Li(()=>e.targetId));m||console.error(`[Micrio Waypoint] Could not calculate vector for target ${Li(()=>e.targetId)}`);const{directionX:g,v:p,vN:f,vector:v}=m;let w=ne(void 0);const y=Math.abs(f[1])<.3,b=y?.65:.5+f[1]/10,x={x:g,y:b,baseScale:l.width/1024,scale:1,rotX:(1+(y?-(1-b):f[1]))*Math.PI/2,rotY:0,rotZ:0},T=n()?.coords??qr(x);let k,_=T.custom,M=_?T:x;function S(){d._markers?.noMarkerActions||(Ei(w).parentNode.scrollTo(0,0),clearTimeout(k),k=setTimeout(()=>{const t=a().camera.getXY(M.x,M.y);!Ei(L)&&(t[0]<0||t[0]>=o.offsetWidth||t[1]<0||t[1]>=o.offsetHeight||a().is360&&t[3]>4)&&a().camera.flyToCoo([M.x,M.y],{speed:2,limit:!0}).catch(()=>{})},150))}let E=ne(""),I=n().customIconIdx;const A=()=>{C.deleted?oe($,!0):(I!=C.settings.customIconIdx&&(n(n().customIconIdx=C.settings.customIconIdx,!0),I=n().customIconIdx),T.custom!=_&&(_=T.custom,M=_?T:x),oe(E,a().camera.getMatrix(M.x,M.y,M.baseScale*M.scale,1,M.rotX,M.rotY,M.rotZ,0,1,1,!0).join(","),!0))};let L=ne(!1);function P(){d._markers?.noMarkerActions||(oe(L,!0),a(a().openedView=void 0,!0),a().state.marker.set(void 0),o.open(e.targetId,{vector:v}))}let $=ne(!1);const C={coords:T,settings:n()};A(),ps(()=>{C.el=Ei(w),Ei(w)._iface=C,o.dispatchEvent(new CustomEvent("wp-print",{detail:C}));const t=a().state.view.subscribe(A);return()=>t()});const D=jt(()=>n().i18n?.[i()]?.title||u?.i18n?.[i()]?.title),z=jt(()=>c?.icons?.[n().customIconIdx??-1]);var O=Hi(),R=_e(O),X=t=>{var i=Mh();let r;var n=ke(i);{let t=jt(()=>Ei(z)?void 0:"arrow-up"),e=jt(()=>Ei(D)??xt(Jn,"$i18n",s).waypointFollow);pa(n,{get type(){return Ei(t)},get icon(){return Ei(z)},onclick:P,onfocus:S,get title(){return Ei(e)}})}q(i),fr(i,t=>oe(w,t),()=>Ei(w)),Ye(()=>{Us(i,`--matrix: matrix3d(${Ei(E)??""})`),ar(i,"id",`w-${e.targetId}`),r=qs(i,1,"micrio-waypoint",null,r,{clicked:Ei(L),active:Ei(L),"direction-up":p[1]<0,"direction-down":p[1]>0})}),Ds(3,i,()=>qn),Gi(t,i)};vs(R,t=>{Ei($)||t(X)}),Gi(t,O),it(),r()}var Eh,Ih=class{constructor(t){if(this.image=t,this.center=[0,0,1],this.view=[0,0,1,1],this.rotationY=0,this.aniDoneAdd=[],this.cooToArea=(t,e,i)=>({x:i[0]+t*(i[2]-i[0]),y:i[1]+e*(i[3]-i[1])}),this.getView=()=>this.view,this.getViewRaw=()=>this._view,this.getViewLegacy=()=>{if(this._engineCanvas)return[this._view[0]-this._view[2]/2,this._view[1]-this._view[3]/2,this._view[0]+this._view[2]/2,this._view[1]+this._view[3]/2]},this.getCoo=(t,e,i=!1,s=!1)=>this.getCooDirect(t,e,i,s).slice(0).map(t=>Math.round(1e6*t)/1e6),this.getXY=(t,e,i=!1,s,r,n)=>this.getXYDirect(t,e,{abs:i,radius:s,rotation:r,noTrueNorth:n}).slice(0),this.getScale=()=>this.center[2]??1,this.setScale=t=>this.setCoo(this.center[0],this.center[1],t),this.getCoverScale=()=>this._engineCanvas?.camera.coverScale??1,this.getMinScale=()=>this._engineCanvas?.camera.minScale??.1,this.isZoomedIn=()=>!!this._engineCanvas?.isZoomedIn(),this.isZoomedOut=(t=!1)=>!!this._engineCanvas?.isZoomedOut(t),this.getCoverLimit=()=>!!this._engineCanvas?.coverLimit,this.flyToView=(t,e={})=>new Promise((i,s)=>{if(!this._engineCanvas)return s(new Error("engine not ready"));let{centerX:r,centerY:n,width:a,height:o}=rn.toCenterJSON(t);if(2==e.margin?.length&&(r+=e.margin[0],n+=e.margin[1],a-=2*e.margin[0],o-=2*e.margin[1]),e.area){const t=this.cooToArea(r,n,e.area);r=t.x,n=t.y,a*=e.area[2]-e.area[0],o*=e.area[3]-e.area[1]}if(e.prevView){const t=rn.toCenterJSON(e.prevView);this._c.ani.setStartView(t.centerX,t.centerY,t.width,t.height,!1)}if(this.image.$settings.omni?.frames){const i=this.image.$settings.omni.layers?.length??1,s=this.image.$settings.omni.frames/i;if(null==e.omniIndex){const i=t[4]?t[4]:Array.isArray(t)&&void 0!==t[5]?t[5]:void 0;void 0!==i&&(e.omniIndex=Math.round(Br(i/(2*Math.PI))*s))}null!=e.omniIndex&&(e.omniIndex=Br(e.omniIndex,s))}const h=this._c.camera.flyTo(r,n,a,o,e.duration??-1,e.speed??-1,e.progress??0,!!e.isJump,!!e.limit,!!e.limitZoom,e.omniIndex??0,Ao.Camera.TimingFunction[e.timingFunction??"ease"],performance.now());this.image.engine.render(),0==h?i():this.setAniPromises(i,s)}),this.flyToFullView=(t={})=>this.flyToCoo([.5,.5,this.getMinScale()],t),this.flyToCoverView=(t={})=>{const e=this.image.$settings.focus??[.5,.5];return e[2]=this.getCoverScale(),this.flyToCoo(e,t)},this.flyToCoo=(t,e={})=>new Promise((i,s)=>{if(!this._engineCanvas)return s(new Error("engine not ready"));const r=Ao.Camera.TimingFunction[e.timingFunction??"ease"];e.duration=this._c.camera.setCoo(t[0],t[1],t[2]||this.center[2],e.duration??-1,e.speed??-1,e.limit??!1,r,performance.now()),this.image.engine.render(),0==e.duration?i():this.setAniPromises(i,s)}),this.zoom=(t,e=0,i=void 0,s=void 0,r=1,n=!1)=>new Promise((r,a)=>{if(!this._engineCanvas)return a(new Error("engine not ready"));const o=this.getXY(this.center[0],this.center[1]);if(null==i&&(i=o[0]),null==s&&(s=o[1]),this.image.album&&!this.image.album.hooked)return r();e=this._c.camera.zoom(t,i,s,e,n,performance.now()),this.image.engine.render(),0==e?r():this.setAniPromises(r,a)}),this.zoomIn=(t=1,e=250,i=1)=>this.zoom(200*-t,e,void 0,void 0,i).catch(()=>{}),this.zoomOut=(t=1,e=250,i=1)=>{const s=this.image.engine.micrio.canvas.viewport,r=s.width/s.height,n=this.image.$info.width/this.image.$info.height;return this.zoom(t*(400/Math.max(1,r/n/2)),e,void 0,void 0,i).catch(()=>{})},this.getDirection=()=>this._engineCanvas?this._c.webgl.yaw:0,this.getPitch=()=>this._engineCanvas?this._c.webgl.pitch:0,!t.is360){const e=t.state.$view;e&&t.$info?.width&&Si().then(()=>this.setView(e))}}bindEngineCanvas(t){this._engineCanvas=t}assign(t,e,i,s){this._view=t,this._xy=e,this._coo=i,this._mat=s}get _c(){return this._engineCanvas}_getXY(t,e,i,s,r){const n=this._c;n.is360?n.webgl.getXYZ(t,e):void 0===r||isNaN(r)?n.camera.getXY(t,e,!!i):n.camera.getXYOmni(t,e,s??0,r,!!i)}_getCoo(t,e,i,s){const r=this._c;r.is360?r.webgl.getCoo(t,e):r.camera.getCoo(t,e,!!i,!!s)}_setMinScale(t){const e=this._c;e.camera.minScale=t,e.camera.correctMinMax(),e.camera.setView(),e.webgl.update()}viewChanged(){const t=this._view,e=this.center.join(","),i=this.getCoo(0,0);this.view[0]=t[0]-t[2]/2,this.view[1]=t[1]-t[3]/2,this.view[2]=t[2],this.view[3]=t[3],this.center[0]=t[0],this.center[1]=t[1],this.center[2]=i[2],this.image.is360&&(this.center[3]=i[3],this.center[4]=i[4]),this.image.isOmni&&(this.center[5]=this.image.swiper?.currentIndex),(this.center.join(",")!=e||this.image.engine.micrio.canvas.resizing||this._engineCanvas?.areaAnimating())&&this.image.state.view.set(this.view)}getXYDirect(t,e,i={}){const s=this.image.is360&&!i.noTrueNorth?-this.rotationY/(2*Math.PI):0;return this._getXY(t-s,e,!0===i.abs,i.radius,i.rotation),this._xy}getCooDirect(t,e,i=!1,s=!1){if(i){const i=this.image.engine.micrio.getBoundingClientRect();t-=i.left,e-=i.top}return this._getCoo(t,e,!0===i,!0===s),this._coo}setView(t,e={}){if(!this._engineCanvas)return;let{centerX:i,centerY:s,width:r,height:n}=rn.toCenterJSON(t);if(e.area){const t=this.cooToArea(i,s,e.area);i=t.x,s=t.y,r*=e.area[2]-e.area[0],n*=e.area[3]-e.area[1]}this._c.setView(i,s,r,n,!!e.noLimit,!1,e.correctNorth),e.noRender||this.image.engine.render()}setCoo(t,e,i=this.center[2]??1){this._engineCanvas&&(this._c.camera.setCoo(t,e,i,0,0,!1,0,performance.now()),this.image.engine.render())}getMatrix(t,e,i,s,r,n,a,o,h,c,l){return this._engineCanvas?(this._c.getMatrix(t,e,i??1,s??10,r||0,n||0,a||0,o||0,h??1,c??1,!!l),this._mat):new Float32Array(16)}setMinScale(t){this._engineCanvas&&this._setMinScale(t)}setMinScreenSize(t){!this.image.album&&this._engineCanvas&&(this._c.camera.minSize=Math.max(0,Math.min(1,t??1)))}setLimit(t){if(!this._engineCanvas)return;const e=rn.rectToCenterJSON(t);this._c.view.setLimit(e.centerX,e.centerY,e.width,e.height),this.image.engine.render()}setCoverLimit(t){this._engineCanvas&&(this._c.coverLimit=!!t,this._c.camera.correctMinMax())}stop(){this._engineCanvas?.aniStop()}pause(){this._engineCanvas?.aniPause(performance.now())}resume(){this._engineCanvas?.aniResume(performance.now()),this.image.engine.render()}set360RangeLimit(t=0,e=0){this._engineCanvas&&(this._c.webgl.setLimits(t,e),this.image.engine.render())}aniIsKinetic(){return!!this._engineCanvas?.kinetic.started}setAniPromises(t,e){this.aniDone=t,this.aniAbort=e}pan(t,e,i=0,s={}){this._engineCanvas&&(this._c.camera.pan(t,e,i,!!s.noLimit,performance.now()),(i>0||s.render)&&this.image.engine.render())}setDirection(t,e){this._engineCanvas&&(this._c.setDirection(t,e??this._c.webgl.pitch,!1),this.image.engine.render())}setArea(t,e={}){if(this._engineCanvas){if(this.image.opts.isEmbed){if(this.image.ptr>0){this.image.opts.area=t;for(const e of this._c.images)if(e.localIdx>0)return void e.setArea(t[0],t[1],t[2],t[3])}}else this.image.opts.area=t,this._c.setArea(t[0],t[1],t[2],t[3],!!e.direct,!!e.noDispatch);e.noRender||this.image.engine.render()}}setRotation(t=0,e=0,i=0){if(this.image.opts.isEmbed&&this._engineCanvas&&this.image.engine.ready){for(const s of this._c.images)if(s.localIdx>0){s.rotX=t,s.rotY=e,s.rotZ=i;break}this.image.engine.render()}}getOmniRotation(){const t=this.image.$settings.omni;return t&&this._engineCanvas?(this.image.swiper?.currentIndex??0)/((t?.frames??1)/(t?.layers?.length??1))*Math.PI*2:0}getOmniFrame(t){const e=this.image.$settings.omni;if(!e||null==t)return;const i=e.frames/(e.layers?.length??1);return Math.floor(t/(2*Math.PI)*i)}getOmniXY(t,e,i){return this._engineCanvas?(this._c.camera.getXYOmniCoo(t,e,i,0,!1),this._xy):new Float64Array(5)}setOmniSettings(){const t=this.image.$settings.omni;if(!t||!this._engineCanvas)return;const e=this._c;e.omniDistance=-t.distance||0,e.omniFieldOfView=t.fieldOfView??0,e.omniVerticalAngle=t.verticalAngle??0,e.omniOffsetX=t.offsetX??0,this.image.state.view.set(this.view)}};!function(t){t.Main=class{get $tour(){return this._tour}get $marker(){return this._marker}constructor(t){this.micrio=t,this.tour=vt(),this.marker=vt(),this.markerHoverId=vt(),this.popup=vt(),this.popover=vt(),this.ui={controls:vt(!0),zoom:vt(!0),hidden:vt(!1),hover:vt(!1)},this.mediaState=new Map,this.tour.subscribe(t=>{"string"!=typeof t&&(this._tour=t)}),this.marker.subscribe(t=>{"string"!=typeof t&&(this._marker=t)})}get(){if(this.micrio.$current)return this.value={id:this.micrio.$current.id,c:this.micrio.canvases.map(t=>t.state.get())},this._tour&&(this.value.t=[this._tour.id],"instance"in this._tour&&this._tour.instance?this.value.t.push(this._tour.instance.currentTime,this._tour.instance.paused?"p":void 0):"steps"in this._tour&&void 0!==this._tour.currentStep&&this.value.t.push(this._tour.currentStep)),this.value}async set(t){if(this.value=t){if(void 0!==t.t?.[1]){const e=t.t[0],i=this.mediaState.get(e);i?(i.currentTime=t.t[1],i.paused="p"==t.t[2]):this.mediaState.set(e,{currentTime:t.t[1],paused:"p"==t.t[2]})}if(t.c?.forEach(t=>{if(void 0!==t[6]&&void 0!==t[7]){const e=t[6],i=this.mediaState.get(e);i?(i.currentTime=t[7],i.paused="p"==t[8]):this.mediaState.set(e,{currentTime:t[7],paused:"p"==t[8]})}}),t.t&&await this.setTour(t.t[0]),this.micrio.$current?.id!=t.id&&(this.micrio.open(t.id),this.micrio.$current&&await en(this.micrio.$current.data,{allowUndefined:!0})),this.micrio.canvases.forEach(e=>{e.state.set(t.c.find(t=>t[0]==e.id))}),t.t)return this.setTour(t.t[0],t.t[1]);{const e=t.c.find(e=>e[0]==t.id);e&&!e[5]&&this.micrio.$current&&this.micrio.$current.camera.flyToView(e.slice(1,5),{speed:2}).catch(()=>{})}}}async setTour(t,e){if(!this.micrio.$current)return;const i=await en(this.micrio.$current.data,{allowUndefined:!0});if(i){const s=i.markerTours?.find(e=>e.id==t)||i.tours?.find(e=>e.id==t);s&&"steps"in s&&void 0!==e&&(s.initialStep=e),this._tour?.id!=t&&this.tour.set(s)}}};t.Image=class{get $view(){return this._view}get $marker(){return this._marker}constructor(t){this.image=t,this.view=vt(void 0),this.marker=vt(void 0),this.layer=vt(0);const e=t.engine.micrio;let i,s,r;this.view.subscribe(n=>{this._view=n;const a=n?.toString();if(n&&a&&i!=a){const o={image:t,view:n};i=a;const h=n[2],c=n[3];(!s||!r||Math.abs(h-s+(c-r))>1e-5)&&(e.events.dispatch("zoom",o),s=h,r=c),e.events.dispatch("move",o)}}),this.marker.subscribe(t=>{const i=this._marker;this._marker=t&&"string"!=typeof t?t:void 0,this._marker?e.state.marker.set(this._marker):t||e.state.$marker!=i||e.state.marker.set(void 0)})}hookOmni(){const t=this.image;this.layer.subscribe(e=>{t.ptr<0||!t.engine.ready||(t.engine.setActiveLayer(t.ptr,e),t.engine.render())})}get(){const t=this._marker,e=t?Array.from(this.image.engine.micrio.state.mediaState).reverse().find(e=>e[0].startsWith(t.id)):null;return[this.image.id,...this._view?this._view.slice(0,4):[0,0,1,1],...t?[t.id,...e?[e[0],e[1].currentTime,e[1].paused?"p":void 0]:[]]:[void 0]].filter(t=>void 0!==t)}set(t){t?.length&&(this.view.set(t.slice(1,4)),t[5]?this._marker?.id!=t[5]&&this.marker.set(t[5]):this._marker&&this.marker.set(void 0))}}}(Eh||(Eh={}));var Ah=new class{constructor(){this.data=new Map,this.db=new Map,this.images=[],this.get=t=>new Promise((e,i)=>{const s=this.db.get(t);if(!s||!this.data.has(s[0]))return i(new Error("Could not get blob: "+t));const r=new FileReader;r.onload=()=>e(JSON.parse(r.result)),r.readAsText(new Blob([new Uint8Array(this.data.get(s[0]),s[1],s[2])]))}),this.getImage=async t=>new Promise((e,i)=>{const s=this.db.get(t);if(!s||!this.data.has(s[0]))return i(new Error("Could not get blob: "+t));const r=new Blob([new Uint8Array(this.data.get(s[0]),s[1],s[2])]);if("createImageBitmap"in self)e(self.createImageBitmap(r));else{let t=this.images.find(t=>!t.src);t||this.images.push(t=new Image),t.onload=()=>{t&&(e(t),requestAnimationFrame(()=>{t&&(URL.revokeObjectURL(t.src),t.src="")}))},t.src=URL.createObjectURL(r)}})}async load(t,e,i){if(this.data.has(e))return;const s=e.replace(/^.*\//,"").split(".")[0],r=/\/base$/.test(e),n=r||An(s),a=new XMLHttpRequest,o=await new Promise((s,r)=>{let o=0;a.responseType="arraybuffer",a.onprogress=t=>{o||(o=Number(a.getResponseHeader("Content-Length"))),i?.(Math.min(1,t.loaded/o))},a.onload=()=>{4===a.readyState&&200===a.status?(i?.(1),s(a.response)):r()},a.onerror=r,a.open("GET",t+e+(n?".bin":".mdp")),a.send()});if(!o)return;this.data.set(e,o);const h=r?e.split("/")[0]+"/":"";let c=0;for(;c<o.byteLength&&!(c+32>o.byteLength);){const i=this.parseHeader(new Uint8Array(o,c,32));if(i.name&&i.size>0)this.db.set(t+h+i.name.replace("./",""),[e,c+32,i.size]);else if(0===i.size&&!i.name)break;c+=32+i.size}}parseHeader(t){const e=(new TextDecoder).decode(t),i=t=>e.slice(s,s+=t).replace(/\x00/g,"").trim();let s=0;return{name:i(20),size:parseInt(i(12),8)}}},Lh=[],Ph=class t{get $info(){return this.__info}get $settings(){return wt(this.settings)}get $data(){return wt(this.data)}constructor(t,e,i={}){if(this.engine=t,this.attr=e,this.opts=i,this.uuid=Hr(),this.__info=qr(yn),this.settings=vt({}),this.data=vt(void 0),this.video=vt(void 0),this.visible=vt(!1),this.ptr=-1,this.baseTileIdx=-1,this.is360=!1,this.isVideo=!1,this.isOmni=!1,this.levels=1,this.dzLevels=0,this.noImage=!1,this.opacity=1,this.viewport=vt(),this.embeds=[],this.isV5=!1,this._loadedData=!1,this.embedElements=new Map,this.state=new Eh.Image(this),i.useParentCamera||(this.camera=new Ih(this)),this.id=(e.id??"").replace(fn,""),this.id.startsWith("external/")){const t=this.id.indexOf("/",this.id.indexOf("/")+1);-1!==t&&(this.id=this.id.substring(0,t+1)+encodeURIComponent(this.id.substring(t+1)))}this.isV5=An(this.id.split("/")[0]),this.infoBasePath=e.path&&e.forceInfoPath?e.path:void 0,this.dataPath=e.path||this.__info.path,this.isV5&&!e.path&&(this.dataPath="https://r2.micr.io/"),i.secondaryTo?(this.opacity=0,i.area=this.engine.micrio.canvas.viewport.portrait?[0,1,1,1]:[1,0,1,1],void 0===i.isPassive&&(i.isPassive=!0)):i.area||(i.area=[0,0,1,1]),this.preset=Mn(this.id);let s=!1;var r;this.info=(r=t=>{s?t(this.__info):this.load().then(t),s=!0},{subscribe:vt(void 0,r).subscribe});const n=this.engine.micrio,a=!!this.attr.revision;let o,h=wt(this.visible);i.isEmbed&&!a||this.visible.subscribe(t=>{t!=h&&(h=t,t&&!this._loadedData&&(!a&&this.isV5?(this._loadedData=!0,this.data.set(void 0)):this.loadData()),i.secondaryTo&&(i.isPassive&&(o?(o(),o=null):t&&(o=i.secondaryTo.state.view.subscribe(t=>{t&&!this.camera.aniDone&&this.camera.setView(t,{noLimit:!0})}))),t?n.events.dispatch("splitscreen-start",this):n.events.dispatch("splitscreen-stop",this)),n.visible.update(e=>(t?e.push(this):e.splice(e.indexOf(this),1),e)),t&&n.$current==this&&n.switching.set(!1))}),this.video.subscribe(t=>this._video=t),this.data.subscribe(t=>{t&&((t,e,i,s)=>{t&&(t.revision&&(t.revision=Object.fromEntries(Object.entries(t.revision??{}).filter(t=>Number(t[1])>0))),t.embeds?.forEach(t=>{t.uuid||(t.uuid=t.id??t.micrioId),an(t.video),an(t),s&&(t.area=rn.fromLegacy(t.area))}),t.markers?.forEach(t=>dn(t,e,i,s)),s&&t.tours?.forEach(un),t.music?.items?.forEach(an),t.pages?.forEach(cn))})(t,n.lang,this.isV5,on(this.__info))})}setError(t,e){const i=t instanceof Nr?t.displayMessage:e??(t instanceof Error?t.message:t)??"An unknown error has occurred";throw this.error=i,this.engine.micrio.printError(t instanceof Nr?t:i),this.engine.micrio.loading.set(!1),t instanceof Error?t:new Error(i)}async load(){let t=this.__info;const e=this.attr,i=this.engine.micrio;e.id&&e.width&&(e.settings&&Wr(yn.settings,e.settings,{noOverwrite:!0}),this.__info=t=e);let s=t.iiifManifest||e.iiifManifest;t.isIIIF=this.id.startsWith("http")||"iiif"==t.format;const r=!!e.settings?.forceDataRefresh;let n;if(!this.id||e.width&&e.height&&!s)this.preset?.[1]&&Wr(this.preset[1],t);else{const e=t=>this.setError(t,"string"==typeof t?t:'Image with id "'+this.id+'" not found, published, or embeddable.');Wr(this.preset?.[1]||await(t.isIIIF?_n(this.id):Sn(this.id,this.infoBasePath,r).then(e=>(e?.id&&!t.isIIIF&&this.id.split("/").length>=3&&this.id.startsWith("external/")&&(n=e.id.split("/").reverse()[0],(this.isV5=An(n))&&(this.dataPath=e.path||"https://r2.micr.io/")),e))).catch(e),t),!s&&t.iiifManifest&&(s=t.iiifManifest),t.isIIIF||(t.isIIIF=!!s),s&&Wr(await _n(s).catch(e),t),t.settings?._meta?.noLogo&&(t.settings.noLogo=!0),t.settings?._meta?.noSmoothing&&(t.settings.noSmoothing=!0)}if(t.id.startsWith("https://iiif.micr.io/")&&(t.id=t.id.slice(21)),7==this.id?.length){const e=In(this.id[1+In(this.id)%6]);t.is360=!!(e>>4&1)||t.is360,t.isWebP=!(3&e),t.isPng=2==(3&e),e>>3&1&&An(t.tilesId??this.id)&&(t.format="dz"),t.path||(t.path=`https://${e>>2&1?"eu":"r2"}.micr.io/`)}const a=this.isV5&&this.id.startsWith("i")&&!this.id.includes("/");a&&!t.tilesId&&(t.tilesId=this.id.slice(1));const o=vn.includes(t.id)||t.tilesId&&vn.includes(t.tilesId);if(Wr(e,t),n&&(this.id=t.id=n),this.tileBase=a&&!t.tileBasePath?.includes("micr.io")?t.tileBasePath??"https://b.micr.io/":o||a?gn:t.tileBasePath??t.path??(this.isV5?"https://r2.micr.io/":"https://b.micr.io/"),t.organisation?.baseUrl&&!e.path?(this.dataPath=t.path=t.organisation.baseUrl,a&&!o||(this.tileBase=this.dataPath)):"https://eu.micr.io/"==t.path&&(this.dataPath=t.path),t.settings?.omni&&(this.isOmni=!0,parseFloat(t.version)>=5&&(await Ah.load(this.tileBase??this.dataPath,(t.tilesId??t.id)+"/base",t=>i._ui?.setProps?.({loadingProgress:t})).catch(t=>this.setError(t,"Could not find object base package.")),t.settings.gallery||(t.settings.gallery={}),t.settings.gallery.type="omni",t.settings.gallery.archive=t.id)),!t.organisation?.branding||t.settings&&t.settings.noUI||this.loadStyle(this.dataPath+"style/"+t.organisation.slug+".css").then(()=>{const t=getComputedStyle(this.engine.micrio).getPropertyValue("--micrio-font-family")?.replace(/^'([^']+)'.*$/,"$1");t&&document.fonts.ready.then(()=>{document.fonts.check("16px "+t)||this.loadStyle(`https://fonts.googleapis.com/css2?family=${t}:ital,wght@0,300;0,400;0,500;0,600;0,800;1,300;1,400;1,500;1,600;1,800&display=swap`)})}),t.isIIIF)if(t.sequences&&t.sequences.length)this.parseIIIFSequenceV2(t,!!s);else if("Manifest"==t.type)this.parseIIIFSequenceV3(t);else{const e=(s||("@id"in t?t["@id"]:t.id)).replace("/info.json","");t.path=e.replace(/\/[^/]*$/,""),t.id=e.replace(/^.*\/([^/]*)$/,"$1")}if(t.spacesId&&!i.spaceData&&(i.spaceData="MICRIO_SPACE_DATA"in self?self.MICRIO_SPACE_DATA:await _n((this.infoBasePath??fn)+"spaces/"+t.spacesId+".json"),1==i.spaceData?.images.length&&delete i.spaceData),t.is360&&this.camera){const e=i.spaceData?.images.find(t=>t.id==this.id)?.rotationY;null!=e?this.camera.rotationY=e:null!=t.settings?._360?.trueNorth&&(this.camera.rotationY=(t.settings._360.trueNorth-.5)*Math.PI*2)}this.noImage=this.noImage||this.isOmni||!t.id&&!t.tilesId,this.extension=t.tileExtension||t.isPng&&"png"||t.isWebP&&"webp"||"jpg","dz"==t.format&&(t.isDeepZoom=!0),this.is360=!!t.is360,this.isVideo=!!t.isVideo;let h=this.isV5?wt(i._lang):("cultures"in t?void 0:e.lang)??void 0;if(this.isV5){if(t.revision){const e=Object.keys(t.revision);e.length&&!e.includes(h)&&(i.lang=e[0])}}else if(!t.settings?.skipMeta&&"cultures"in t){const e=(t.cultures||"").split(","),s=this.opts.isEmbed||!!this.opts.area,r=t.settings?.onlyPreferredLang||s;h=t.lang&&e.includes(t.lang)?t.lang:r?void 0:e[0],h&&!s&&(i.lang=h)}const c=t.settings;c&&!c?.noExternals&&await Promise.all([c.css?this.loadStyle(c.css.href):null,c.js?this.loadScript(c.js.href,h):null].filter(t=>!!t));for(let d=t.tileSize;d<Math.max(t.width,t.height);d*=2,this.levels++);let l=Math.max(t.width,t.height);do{this.dzLevels++}while((l/=2)>1);return c?.gallery?.archive&&(this.levels-=1-(c.gallery.archiveLayerOffset??0)),this.noImage||(this.thumbSrc=this.getTileSrc(this.levels,0,0)),i.events.dispatch("pre-info",t),this.isV5&&null!=t.revision&&!this.opts.isEmbed?await this.loadData():t.settings?.skipMeta||this.opts.isEmbed||this.isV5||i._lang.subscribe(t=>{!t||!this.id||"cultures"in this.__info&&(this.__info.cultures||"").split(",").includes(t)||(t=void 0),this.data.set(void 0),!t&&this.preset?.[2]&&(t="preset"),t&&this.id&&(this.isV5||(i.state.tour.set(void 0),this.state.marker.set(void 0)),this.preset?.[2]?this.enrichData(this.preset[2]).then(t=>{this.data.set(t),this.preset?.[2]&&(this.preset[2]=void 0)}):_n(this.dataPath+this.id+"/data."+t+".json").catch(()=>{}).then(t=>t&&this.enrichData(t).then(t=>this.data.update(e=>(Wr(t,e||(e={}),{mergeArrays:!0}),e)))))}),t.settings?.micrioSplitLink&&!this.opts.secondaryTo&&i.open({id:t.settings.micrioSplitLink,settings:{hookEvents:!1!==t.settings.secondaryInteractive}},{splitScreen:!0,isPassive:!t.settings.noFollow}),t.settings&&this.settings.set(t.settings),t.watermark&&this.engine.micrio.webgl.loadWatermark(t.watermark,t.settings?.watermarkOpacity),delete t.settings,this.isOmni&&this.state.hookOmni(),t}async loadData(){const t=this.$settings?.skipMeta||this.__info.settings?.skipMeta;if(this._loadedData||t)return Promise.resolve();this._loadedData=!0;const e=this.preset?.[2]??(this.isV5&&await _n(this.dataPath+this.id+"/data/pub.json",this.__info.settings?.forceDataRefresh).catch(()=>{}));e&&this.enrichData(e).then(t=>this.data.set(t))}getTileSrc(t,e,i,s){const r=this.__info;if(r){if(r.isDeepZoom&&(t=this.dzLevels-t),r.isIIIF){const s=r.tileSize,n=Math.pow(2,t)*s,a=Math.min(r.width,e*n),o=Math.min(r.height,i*n),h=Math.min(r.width-a,n),c=Math.min(r.height-o,n),l=Math.round(Math.min(s,h/n*s)),d=Math.round(Math.min(s,c/n*s));return`${r.path}/${r.id}/${[a,o,h,c].join(",")}/${[l,d].join(",")}/0/default.jpg`}if(r.settings?._360?.video?.src)throw"Video thumb";return`${this.tileBase}${r.tilesId||r.id}/${void 0!==s?s+"/":""}${t}/${e}${r.isDeepZoom?"_":"-"}${i}.${this.extension}`}}loadScript(t,e=""){return new Promise(i=>{if(Lh.includes(t)||document.querySelector('script[src="'+t+'"]'))i();else{Lh.push(t);const s=document.createElement("script");s.type="text/javascript",s.async=!0,s.defer=!0,s.micrioElement=this.engine.micrio,s.src=t.replace("$lang",e),s.onload=i,document.head.appendChild(s)}})}loadStyle(t){return new Promise(e=>{if(Lh.includes(t)||document.head.querySelector('link[href="'+t+'"]'))e();else{Lh.push(t);const i=document.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",t),i.onload=e,document.head.appendChild(i)}})}async enrichData(e){if(!e)return e;"error"in e&&(this.__info.error="403"==e.status?"Could not load image data. Are you logged in and do you have the right credentials?":e.error);const i=this.engine.micrio.lang,s=[];e.markers?.forEach(t=>{if(dn(t,i,!this.isV5,on(this.__info)),t.data?.micrioSplitLink){const e=t.data.micrioSplitLink.split(",").map(t=>t.trim()),i=t.data._micrioSplitLink={micrioId:e[0],markerId:e[1],follows:!!e[2]&&"false"!=e[2]};i.markerId&&s.push(i.micrioId)}}),e.markerTours?.length&&s.push(...e.markerTours.flatMap(t=>t.steps).map(t=>t.split(",")[1]).filter(t=>!!t&&t!=this.id));const r=t=>"autostart"in t&&t.autostart,n=e.markerTours?.find(r)||e.tours?.find(r);n&&(this.$settings.start={type:"steps"in n?"markerTour":"tour",id:n.id});const a=s.filter((t,e)=>s.indexOf(t)==e),o=t=>this.dataPath+(this.isV5?t+"/data/pub.json":t+"/data."+i+".json"),[h,c]=await Promise.all([Promise.all(a.map(t=>_n(o(t)))),Promise.all(a.map(t=>Sn(t,this.infoBasePath)))]);h.forEach((t,e)=>{const s=on(c[e]);t?.markers?.forEach(t=>dn(t,i,5==a[e].length,s))});const l=this.engine.micrio.spaceData;return e.markerTours&&(await Promise.all(e.markerTours.map(t=>En(this,t,i,e))),l&&(e.markerTours=e.markerTours.filter(t=>!t.steps.find(t=>t.includes(","))))),l?.markerTours&&await Promise.all(l.markerTours.filter(t=>!t.stepInfo).map(t=>En(this,t,i,e))),e.markers?.forEach(t=>{if(!t.data?._micrioSplitLink)return;const e=t.data?._micrioSplitLink?.markerId;if(e)for(let i=0;i<h.length;i++){const s=h[i]?.markers?.find(t=>t.id==e);if(s)return void(t.data._micrioSplitLink.view=s.view)}}),this.engine.micrio.events.dispatch("pre-data",{[this.id]:e,...Object.fromEntries(a.map((t,e)=>[t,h[e]]))}),h.forEach((e,i)=>{if(e){const r=this.engine.images.find(t=>t.id==a[i]);r&&r instanceof t&&!r.$data&&(s=o(r.id),!xn.has(s)&&!Tn.has(s))&&r.data.set(e)}var s}),e}setupIIIFGalleryContainer(t,e){this.noImage=!0;const i=this.engine.micrio,s=i.canvas.getRatio();t.width=Math.max(1,i.offsetWidth*s),t.height=Math.max(1,i.offsetHeight*s),t.settings||(t.settings={}),t.settings.gallery||(t.settings.gallery={}),t.settings.view=[0,0,1,1],t.gallery=[];const r=t.settings.gallery.startId,n=r?e.findIndex(t=>t==r):-1;return n<0?0:n}parseIIIFSequenceV2(e,i=!1){const s=e.sequences?.[0];if(!s)return;const r=s.canvases.map(t=>t.images[0]).map(t=>t.resource);if(i&&r.length>10){const i=this.setupIIIFGalleryContainer(e,r.map(t=>t.service["@id"]));return void r.forEach((s,r)=>e.gallery.push(new t(this.engine,{id:s.service["@id"],width:s.width,height:s.height,isPng:"image/png"==s.format,settings:{}},{area:[r-i,0,r-i+1,1]})))}const n="top-to-bottom"==s.viewingDirection;this.noImage=!0,e.width=n?Math.max(...r.map(t=>t.width)):r.reduce((t,e)=>t+e.width,0),e.height=n?r.reduce((t,e)=>t+e.height,0):Math.max(...r.map(t=>t.height)),e.settings||(e.settings={});let a=0;r.forEach(i=>{const s=[(1-i.width/e.width)/2,(1-i.height/e.height)/2];this.embeds.push(new t(this.engine,{id:i.service["@id"],width:i.width,height:i.height,isPng:"image/png"==i.format,settings:{}},{area:n?[s[0],a/e.height,1-s[0],(a+i.height)/e.height]:[a/e.width,s[1],(a+i.width)/e.width,1-s[1]]})),a+=n?i.height:i.width})}parseIIIFSequenceV3(e){const i=e.items?.flatMap(t=>t.items?.[0]?.items?.[0]?.body).filter(t=>!!t?.service?.[0]?.id).filter(t=>!!t);if(!i?.length)return;const s=this.setupIIIFGalleryContainer(e,i.map(t=>t.service[0].id));i.forEach((i,r)=>e.gallery.push(new t(this.engine,{id:i.service[0].id,width:i.width,height:i.height,isPng:"image/png"==i.format,tileSize:e.tileSize,settings:{}},{area:[r-s,0,r-s+1,1]})))}addEmbed(e,i,s={}){const r=i.slice(0),n=new t(this.engine,e,{area:r,isEmbed:!0,useParentCamera:s.asImage});return n.camera||(n.camera=this.camera),this.embeds.push(n),void 0===s.opacity&&(s.opacity=1),en(n.info).then(t=>{if(t){if("cover"==s.fit||"contain"==s.fit){const e=this.is360?2:1,i="cover"==s.fit,n=r[2]-r[0],a=r[3]-r[1],o=r[0]+n/2,h=r[1]+a/2,c=n/a*e,l=t.width/t.height;if(i&&l<c||!i&&l>=c){const t=n/l*e;r[1]=h-t/2,r[3]=h+t/2}else{const t=a*l/e;r[0]=o-t/2,r[2]=o+t/2}}this.engine.addEmbed(n,this,s),this.engine.render()}}),n}setEmbedMediaElement(t,e){e?this.embedElements.set(t,e):this.embedElements.delete(t)}getEmbedMediaElement(t){return this.embedElements.get(t)}splitStart(){const t=this.engine.micrio.canvas.viewport.portrait;this.opts.secondaryTo?.camera.setArea(t?[0,0,1,.5]:[0,0,.5,1],{noRender:!0}),this.camera.setArea(t?[0,.5,1,1]:[.5,0,1,1],{noRender:!0}),this.camera.setView(this.__info?.settings?.view??[0,0,1,1]),this.engine.render()}splitEnd(){const t=this.opts.area;if(!t)return;const e=t[2]-t[0],i=t[3]-t[1];if(Math.round(1e3*e)/1e3==0||Math.round(1e3*i)/1e3==0)return;const s=e>i;this.camera.setArea(s?[0,1,1,1]:[1,0,1,1],{noRender:!0}),this.opts.secondaryTo?.grid&&this.opts.secondaryTo.camera.aniDone||this.opts.secondaryTo?.camera.setArea([0,0,1,1],{noRender:!0}),this.engine.render()}fadeIn(t=!1){this.engine.fadeImage(this.ptr,1,t),this.engine.render()}fadeOut(t=!1){this.engine.fadeImage(this.ptr,0,t),this.engine.render()}},$h=class{constructor(t,e,i,s,r){this.engine=t,this.image=e,this.embed=i,this.paused=s,this.moved=r,this.ism3u=!1,this.hlsPlayer=void 0,this.usVid=void 0,this.vidRepeatTo=void 0,this.placeTo=void 0,this.autoplay=!0,this._vid=void 0,this.isMounted=!0,this.events={play:()=>this.setPlaying(!0),pause:()=>this.setPlaying(!1),playing:()=>{!this.image._video&&this._vid&&("requestVideoFrameCallback"in this._vid?this._vid.requestVideoFrameCallback(()=>{this._vid&&this.isMounted&&(this.image.video.set(this._vid),this.engine.render())}):this.image.video.set(this._vid))},canplayEvt:Jr.iOS?"loadedmetadata":"canplay",canplay:()=>{this._vid&&this.isMounted&&(this.autoplay&&!this.paused?(this._vid.play().catch(t=>console.warn("WebGL Embed video play() failed on canplay:",t)),this.moved()):this.embed.hideWhenPaused||(this.setPlaying(!0),Si().then(()=>{this.setPlaying(!1),setTimeout(()=>this._vid?.remove(),50)})))}},this.ism3u=!!i.video?.streamId&&!i.video?.transparent,this._vid=e._video,this.autoplay=i.video?.autoplay??!0;let n=!0;this.usVid=this.image.visible.subscribe(t=>{clearTimeout(this.placeTo),this.placeTo=t?setTimeout(()=>{this.isMounted&&(this._vid?(this.hook(),this.autoplay&&!this.paused&&this._vid.play().catch(t=>console.warn("WebGL Embed video play() failed",t))):this.load())},n?0:100):setTimeout(()=>this._vid?.pause(),0),n=!1})}unmount(){this.isMounted=!1,clearTimeout(this.placeTo),clearTimeout(this.vidRepeatTo),this._vid?.pause(),this.unhook(),this.usVid?.()}setPlaying(t){this._vid&&(this.paused=!t,t?this._vid.dataset.playing="1":delete this._vid.dataset.playing,this.engine.setImageVideoPlaying(this.image.ptr,t),this.embed.hideWhenPaused&&this.engine.fadeImage(this.image.ptr,t?1:0),t&&this.engine.render())}load(){if(!this.embed.video||this._vid)return;const t=this.ism3u?`https://videodelivery.net/${this.embed.video.streamId}/manifest/video.m3u8`:this.embed.video.src;t?(this._vid=document.createElement("video"),this._vid.crossOrigin="anonymous",this._vid.playsInline=!0,this._vid.width=this.embed.width,this._vid.height=this.embed.height,this._vid.muted=this.embed.video.muted,this.hook(),this.ism3u&&("MediaSource"in window||"ManagedMediaSource"in window)?tn("https://r2.micr.io/hls-1.6.15.min.js",void 0,"Hls"in window?{}:void 0).then(()=>{this.hlsPlayer=new window.Hls({abrEwmaDefaultEstimate:1e7,abrEwmaDefaultEstimateMax:5e7}),this.hlsPlayer.loadSource(t),this._vid&&this.hlsPlayer.attachMedia(this._vid)}).catch(t=>console.error("[Micrio GL Embed] Failed to load HLS.js:",t)):this._vid.src=t):console.error("[Micrio GL Embed] No video source found for embed:",this.embed.id)}hook(){if(!this.embed.video||!this._vid)return;const t=this.embed.video.loopAfter;this.embed.video.loop&&t?(this._vid.loop=!1,this._vid.onended=()=>{this.setPlaying(!1),this.vidRepeatTo=setTimeout(()=>this._vid?.play().catch(t=>console.warn("WebGL Embed video loop play() failed:",t)),1e3*t)},this._vid.onplay=()=>this.setPlaying(!0)):(this._vid.loop=this.embed.video.loop,this._vid.onended=null,this._vid.onplay=null),this._vid.parentNode||this.autoplay||this.ism3u||(this._vid.setAttribute("style","opacity:0;position:absolute;top:0;left:0;transform-origin:left top;transform:scale(0.1);pointer-events:none;"),document.body.appendChild(this._vid)),this._vid.addEventListener("play",this.events.play),this._vid.addEventListener("pause",this.events.pause),this._vid.addEventListener("playing",this.events.playing,{once:!0}),this._vid.addEventListener(this.events.canplayEvt,this.events.canplay,{once:!0})}unhook(){this._vid&&(this._vid.removeEventListener("play",this.events.play),this._vid.removeEventListener("pause",this.events.pause),this._vid.removeEventListener("playing",this.events.playing),this._vid.removeEventListener(this.events.canplayEvt,this.events.canplay),this._vid.onended=null,this._vid.onplay=null)}},Ch=Bi('<img alt="Embed" data-scroll-through="" class="micrio-embed"/>'),Dh=Bi('<button data-scroll-through="" aria-label="embed-button" class="micrio-embed"></button>');function zh(t,e){et(e,!0);const i=()=>xt(a,"$current",s),[s,r]=kt(),n=Q("micrio"),{current:a,engine:o,canvas:h,_lang:c}=n;let l=br(e,"embed",15);l().src?.startsWith("/r2")&&l(l().src="http://localhost:6100"+l().src,!0);const d=i(),u=d.$info;l().uuid||l(l().uuid=Hr(),!0);const m=l().uuid,g=d.is360,p=l().video?.autoplay??!0;let f=d.embeds.find(t=>t.uuid==m||t.$info?.title==m);const v=window.matchMedia("(dynamic-range: high)").matches||Jr.OSX,y=l().area,b=l().src?.toLowerCase().endsWith(".svg"),x=!(!l().width||!l().height)&&l().width*l().height<Math.pow(1024,2),T=/iPhone OS 14_/i.test(navigator.userAgent),k="data-embeds-inside-gl",_=n.getAttribute(k),M=!(b||T||!v&&!n.hasAttribute(k)&&l().video||"false"==_||(!l().micrioId||x&&l().src)&&(!l().video||l().video.controls||l().video.transparent)),S=!l().clickAction&&!l().frameSrc&&!Li(()=>e.marker),E="href"==l().clickAction?l().clickTarget:void 0,I=E&&l().clickTargetBlank;let A=ne(ue(y[2])),L=ne(ue(y[3])),P=ne(y[0]+y[2]/2),$=ne(y[1]+y[3]/2),C=ne(ue(l().scale||1)),D=ne(ue(l().rotX??0)),z=ne(ue(l().rotY??0)),O=ne(ue(l().rotZ??0)),R=ne(ue(l().scaleX??1)),X=ne(ue(l().scaleY??1)),F=ne(""),V=ne(0);function Y(){const t=l().area;oe(A,t[2],!0),oe(L,t[3],!0),oe(P,t[0]+Ei(A)/2),oe($,t[1]+Ei(L)/2),oe(C,l().scale||1,!0),oe(D,l().rotX??0,!0),oe(z,l().rotY??0,!0),oe(O,l().rotZ??0,!0),oe(R,l().scaleX??1,!0),oe(X,l().scaleY??1,!0);const e=M&&l().micrioId&&l().width,i=e?10:1;let s=Ei(A)*u.width/(l().width??100)/(M?l().width?Ei(A):1:Ei(C))*(g?Math.PI/2:1);const r=[];e&&l().width&&(s=Ei(A)/(l().width/u.width)*i*(g?Math.PI/2:1),r.push(`width:${l().width/i}px`)),r.push(`--ratio:${Ei(A)/Ei(L)*u.width/u.height};--scale:${s}`),b&&oe(F,Ei(F)+`height:${l().height}px`),oe(F,r.join(";"),!0),l().video&&(l().video.width>l().video.height?oe(V,Math.min(l().video.width,Ei(A)*u.width,2048),!0):oe(V,Math.min(l().video.height,Ei(L)*u.height,2048)/(l().video.height/l().video.width)))}Y();const N=jt(()=>Math.round(Ei(A)*u.width)),B=jt(()=>Math.round(Ei(L)*u.height));let q,W=ne(!1),U=ne(0),H=ne(0),G=ne(""),j=ne(!1),Z=ne("");function J(){if(!d.engine.ready)return;const t=d.camera.getXYDirect(Ei(P),Ei($));if((t=>{var e=w(t,3);oe(U,e[0],!0),oe(H,e[1],!0),q=e[2]})(t),g&&(oe(G,d.camera.getMatrix(Ei(P),Ei($),Ei(C),1,Ei(D),Ei(z),Ei(O),void 0,Ei(R),Ei(X)).join(","),!0),oe(j,t[3]>2)),oe(Z,(g?`transform:matrix3d(${Ei(G)});`:`--x:${Ei(U)}px;--y:${Ei(H)}px;--s:${q};`)+(void 0!==l().opacity&&1!==l().opacity?`--opacity:${l().opacity};`:"")),(l().video?.pauseWhenSmallerThan||l().video?.pauseWhenLargerThan)&&Ei(N)){const t=Ei(W);oe(W,function(){if(!l().video?.pauseWhenSmallerThan&&!l().video?.pauseWhenLargerThan)return!p;const t=q?Math.max(Ei(N)*q/h.viewport.width,Ei(B)*q/h.viewport.height):0;return!!(l().video.pauseWhenSmallerThan&&t<l().video.pauseWhenSmallerThan||l().video.pauseWhenLargerThan&&t>l().video.pauseWhenLargerThan)}(),!0),Ei(nt)?._vid&&Ei(W)!=t&&(Ei(W)?Ei(nt)._vid.pause():(d?.$settings?.embedRestartWhenShown&&(Ei(nt)._vid.currentTime=0),Ei(nt)._vid.play()))}}function K(){const t="markerId"==l().clickAction?l().clickTarget:e.marker?.id;t&&i()&&!E&&i().state.marker.set(t)}function tt(t){if(t&&"detail"in t){const e=t.detail;for(const t in e)l(l()[t]=e[t],!0)}Y(),J()}const st=vt(!1);l().video&&(l().video.controls||l(l().video.muted=!0,!0));const rt=M&&!!l().video;let nt=ne(void 0);const at=!M||!!l().clickAction;let ot=ne(void 0);Re(()=>{l().video&&l().id&&i()&&i().setEmbedMediaElement(l().id,Ei(ot)??Ei(nt)?._vid)});const ht=jt(()=>l().video||M?Ei(V):Ei(N)),ct=jt(()=>l().video?Ei(V)/(l().video.width/l().video.height):Ei(B)),lt=jt(()=>Ei(N)/Ei(ht));ps(()=>{const t=[];return M&&function(){const t=l().hideWhenPaused?.01:l().opacity??1,e=[l().area[0],l().area[1],l().area[0]+l().area[2],l().area[1]+l().area[3]];f&&f.ptr>=0?(f.camera.setArea(e),f.camera.setRotation(l().rotX,l().rotY,l().rotZ),o.fadeImage(f.ptr,t)):f=d.addEmbed({id:l().video?l().id:l().micrioId,title:m,width:l().width,height:l().height,isPng:l().isPng,isWebP:l().isWebP,isDeepZoom:l().isDeepZoom,path:u.tileBasePath??u.path,isSingle:!!l().video,isVideo:!!l().video,settings:{_360:{rotX:Ei(D),rotY:Ei(z),rotZ:Ei(O)}}},e,{opacity:t,asImage:!1}),rt&&en(f.visible,{targetValue:!0}).then(()=>{oe(nt,new $h(o,f,l(),Ei(W),J),!0)}),o.render()}(),(at||l().video?.pauseWhenSmallerThan||l().video?.pauseWhenLargerThan)&&t.push(d.state.view.subscribe(J)),()=>{for(Ei(nt)?.unmount(),f&&f.ptr>=0&&(o.fadeImage(f.ptr,0),o.render()),l().video&&l().id&&i()&&i().setEmbedMediaElement(l().id);t.length;)t.shift()?.()}});var dt=Hi(),ut=_e(dt),mt=t=>{var i=Hi();Os(_e(i),()=>E?"a":"div",!1,(t,i)=>{Rs(t,(t,e)=>{return s=e,(i=t).addEventListener("change",s),{destroy:()=>i.removeEventListener("change",s)};var i,s},()=>tt),hr(t,()=>({id:l().id?"e-"+l().id:void 0,style:Ei(Z),role:E?void 0:"figure",onclick:K,onkeypress:K,href:E,target:E&&I?"_blank":null,class:"",[js]:{"embed-container":!0,embed3d:g,"no-events":S,behind:g&&Ei(j)}}),void 0,void 0,void 0,"micrio-embed");var r=Hi(),n=_e(r),a=t=>{{let e=jt(()=>l().video.streamId&&!l().video.transparent?"cfvid://"+l().video.streamId:l().video.src),i=jt(()=>l().video.muted?0:1),s=jt(()=>!Ei(W)&&l().video.autoplay),r=jt(()=>l().video.transparent&&l().video.hasH265);so(t,{get forcePause(){return Ei(W)},get src(){return Ei(e)},get width(){return Ei(ht)},get height(){return Ei(ct)},get frameScale(){return Ei(lt)},get controls(){return l().video.controls},get destroying(){return st},get loop(){return l().video.loop},get loopDelay(){return l().video.loopAfter},get volume(){return Ei(i)},get autoplay(){return Ei(s)},get hasTransparentH265(){return Ei(r)},get _media(){return Ei(ot)},set _media(t){oe(ot,t,!0)}})}},o=t=>{so(t,{get src(){return l().frameSrc},get width(){return Ei(N)},get height(){return Ei(B)},get frameScale(){return l().scale},get autoplay(){return l().autoplayFrame},get destroying(){return st}})},h=t=>{var e=Ch();Ye(()=>{ar(e,"src",l().src),Us(e,Ei(F)),ar(e,"width",b?l().width:void 0),ar(e,"height",b?l().height:void 0)}),Gi(t,e)},d=t=>{var i=Dh();Ye(()=>{Us(i,Ei(F)),ar(i,"title",l().title||e.marker?.i18n?.[xt(c,"$_lang",s)]?.title)}),Gi(t,i)};vs(n,t=>{l().video&&!M?t(a):l().frameSrc?t(o,1):!M&&l().src?t(h,2):t(d,-1)}),Gi(i,r)}),Gi(t,i)};vs(ut,t=>{at&&(Ei(G)||Ei(U)||Ei(H))&&t(mt)}),Gi(t,dt),it(),r()}var Oh=Wi("<line></line>"),Rh=Bi('<article class="micrio-markers"><label> </label></article>'),Xh=Bi('<article class="micrio-markers"><label> </label></article>'),Fh=Bi('<svg class="micrio-markers"></svg> <aside class="micrio-markers"><section class="micrio-markers"></section> <section class="micrio-markers"></section></aside>',1),Vh=Bi("<!> <!>",1),Yh=Bi("<div><!> <!></div>"),Nh=Bi("<!> <!> <!> <!>",1);function Bh(t,e){et(e,!0);const i=()=>xt(m,"$settings",h),s=()=>xt(M,"$inView",h),r=()=>xt(_,"$hoveredId",h),n=()=>xt(f,"$switching",h),a=()=>xt(d,"$data",h),o=()=>xt(v,"$_lang",h),[h,c]=kt();let l=br(e,"image",15);const{data:d,info:u,settings:m}=l(),g=l().state.marker,p=l().engine.micrio,{switching:f,_lang:v,state:w}=p,y=p.canvas.isMobile,b=p.canvases[0]?.grid,x=b?.focussed,T=b?.markersShown,k=i().clusterMarkerRadius??16,_=w.markerHoverId,M=vt([]);tt("inView",M);const S=i()._markers??{},E=i().omni,I=!(S.noTitles||E?.sideLabels||!S.showTitles&&5!=l().id.length);let A=!1;function L(t){t?"string"==typeof t||l().openedView||t.noMarker||!t.view||(l(l().openedView=p.state.$tour&&!("steps"in p.state.$tour)?void 0:qr(l().state.$view),!0),A=!!t.videoTour):l().openedView&&!p.state.$tour&&setTimeout(()=>{Ei(j)||l().camera.aniDone||!l().openedView||l().camera.flyToView((t=>{const e=Math.min(1,t[2]),i=Math.min(1,t[3]),s=e/2,r=i/2;return[Math.max(s,Math.min(1-s,t[0]+t[2]/2))-s,Math.max(r,Math.min(1-r,t[1]+t[3]/2))-r,e,i]})(l().openedView),{speed:i()._markers?.zoomOutAfterCloseSpeed}).catch(()=>{}),l(l().openedView=void 0,!0),A=!1},A?250:10)}let P=!1;w.tour.subscribe(t=>{t&&"steps"in t?(P=!0,t.keepLastStep&&l(l().openedView=void 0,!0)):(t||l().openedView||!P||l().camera.stop(),P=!1)});const $=[];let C=ne(""),D=ne(!1),z=ne(!1);const O=t=>(t=t?.map(t=>Math.round(100*t)/100))&&oe(C,[...$,t[0]?`left: ${t[0]}px`:null,t[1]?`top: ${t[1]}px`:null,`width: ${t[2]}px`,`height: ${t[3]}px`].filter(t=>!!t).join(";")+";");let R=ne(ue([])),X=k,F=ne(ue([]));const V=new Map,Y=()=>{const t=function(t,e,i,s){if(!t)return{overlapped:[],clusterMarkers:[]};const r=t,n=[],a=r.length,o=[];for(let h=0;h<a;h++)for(let t=h+1;t<a;t++){if(r[t].tags?.includes("no-cluster"))continue;const s=e.get(r[h].id),a=e.get(r[t].id);if(s&&a&&Pn(s,a,i)){o.push(h,t);const e=n.find(e=>e.findIndex(e=>e==h||e==t)>-1);e?e.push(h,t):n.push([h,t])}}return{overlapped:o,clusterMarkers:n.map(t=>t.filter((e,i)=>t.indexOf(e)===i)).map(t=>{let e,i,n,a,o,h;if(s){o=t.reduce((t,e)=>t+r[e].x,0)/t.length,h=t.reduce((t,e)=>t+r[e].y,0)/t.length;const s=.3;e=Math.max(0,o-s/2),n=Math.max(0,h-s/2),i=Math.min(1,o+s/2),a=Math.min(1,h+s/2)}else e=Math.min(...t.map(t=>r[t].view?r[t].view[0]:r[t].x)),i=Math.max(...t.map(t=>r[t].view?r[t].view[0]+r[t].view[2]:r[t].x)),n=Math.min(...t.map(t=>r[t].view?r[t].view[1]:r[t].y)),a=Math.max(...t.map(t=>r[t].view?r[t].view[1]+r[t].view[3]:r[t].y)),o=(e+i)/2,h=(n+a)/2;const c=s?t.reduce((t,e)=>t+(r[e].rotation??0),0)/t.length:void 0,l=s?t.reduce((t,e)=>t+(r[e].radius??1),0)/t.length:void 0;return{title:t.length+"",type:"cluster",view:[e,n,Math.max(.1,i-e),Math.max(.1,a-n)],x:o,y:h,rotation:c,radius:l,id:t.sort((t,e)=>t-e).join(","),data:{},popupType:"none",tags:[]}})}}(Ei(J),V,X,l().isOmni);oe(R,t.overlapped,!0),oe(F,t.clusterMarkers,!0)},N=[];ps(()=>{const t=[];return en(u).then(e=>{if(!e)return;oe(D,!!e.is360);const s=i()._markers;if(!s)return;const r=parseFloat(e.version)>=4.2;s.markerIcon&&$.push(`--micrio-marker-icon: url("${s.markerIcon}")`),s.markerColor&&s.markerColor!=(r?"#ffffff":"#ffbb00")&&$.push("--micrio-marker-color: "+s.markerColor),s.markerSize&&s.markerSize!=(r?"16":"25")&&$.push("--micrio-marker-size: "+(X=Number(s.markerSize))+"px"),t.push(l().viewport.subscribe(O)),i().clusterMarkers&&(t.push(l().state.view.subscribe(Y)),t.push(l().data.subscribe(()=>Si().then(Y)))),!l().grid&&i()._markers?.zoomOutAfterClose&&t.push(l().state.marker.subscribe(L)),l().isOmni&&i().omni?.sideLabels&&!i()._markers?.noTitles&&t.push(y.subscribe(t=>{t&&Ei(z)?function(){for(;N.length;)N.shift()?.()}():t||Ei(z)||(N.push(l().state.view.subscribe(H)),N.push(_.subscribe(H)),N.push(g.subscribe(H))),oe(z,!t)}))}),()=>{for(;t.length;)t.shift()?.()}});const B=t=>!t.noMarker;let W=ne(void 0),U=ne(ue([]));function H(){Si().then(()=>{if(!Ei(W))return;const t=p.canvas,e=t.element.offsetWidth,i=[];s().forEach(([s,n,a])=>{const o=Ei(W).querySelector('label[for="'+s.id+'"]')?.getBoundingClientRect();o?.width&&o.width>0&&i.push([n*e,a,(n>=.5?o.left:o.right)-t.viewport.left,o.top+o.height/2-t.viewport.top,r()==s.id])}),oe(U,i,!0)})}const G=(t,e)=>t.i18n?t.i18n[e]?.title:t.title,j=jt(()=>b&&xt(x,"$focussed",h)!=l()&&T&&wt(T).indexOf(l())<0),Z=jt(()=>!n()&&p.spaceData?p.spaceData.links.filter(t=>t[0]==l().id||t[1]==l().id).map(t=>({targetId:t[0]==l().id?t[1]:t[0],settings:t[2]?.[l().id]})):void 0),J=jt(()=>Ei(j)?[]:a()?.markers?.filter(B)),K=jt(()=>Ei(j)?a()?.markers:a()?.markers?.filter(t=>!B(t))),Q=jt(()=>Ei(j)?[]:a()?.markers?.filter(t=>t.clickableArea)),st=jt(()=>!(!Ei(J)?.length&&!Ei(Z)?.length)),rt=jt(()=>[...s()].sort(([,,t],[,,e])=>t>e?1:t<e?-1:0));var nt=Nh(),at=_e(nt),ot=t=>{var e=Fh(),i=_e(e);bs(i,21,()=>Ei(U),ws,(t,e)=>{var i=Oh();let s;Ye(()=>{ar(i,"x1",Ei(e)[0]),ar(i,"y1",Ei(e)[1]),ar(i,"x2",Ei(e)[2]),ar(i,"y2",Ei(e)[3]),s=qs(i,0,"micrio-markers",null,s,{hovered:Ei(e)[4]})}),Gi(t,i)}),q(i);var s=Me(i,2),n=ke(s);bs(n,21,()=>Ei(rt).filter(([,t])=>t<.5),t=>t[0].id,(t,e)=>{var i=Rh(),s=ke(i);let n;var a=ke(s,!0);q(s),q(i),Ye(t=>{ar(s,"for",Ei(e)[0].id),n=qs(s,1,"micrio-markers",null,n,{hover:r()==Ei(e)[0].id}),ns(a,t)},[()=>G(Ei(e)[0],o())]),Oi("mouseenter",s,()=>_.set(Ei(e)[0].id)),Oi("mouseleave",s,()=>_.set(void 0)),Gi(t,i)}),q(n);var a=Me(n,2);bs(a,21,()=>Ei(rt).filter(([,t])=>t>=.5),t=>t[0].id,(t,e)=>{var i=Xh(),s=ke(i);let n;var a=ke(s,!0);q(s),q(i),Ye(t=>{ar(s,"for",Ei(e)[0].id),n=qs(s,1,"micrio-markers",null,n,{hover:r()==Ei(e)[0].id}),ns(a,t)},[()=>G(Ei(e)[0],o())]),Oi("mouseenter",s,()=>_.set(Ei(e)[0].id)),Oi("mouseleave",s,()=>_.set(void 0)),Gi(t,i)}),q(a),q(s),fr(s,t=>oe(W,t),()=>Ei(W)),Gi(t,e)};vs(at,t=>{Ei(z)&&Ei(rt).length&&!xt(g,"$currentMarker",h)&&t(ot)});var ht=Me(at,2),ct=t=>{var e=Hi();bs(_e(e),17,()=>Ei(Q),t=>t.id,(t,e)=>{var i=Hi(),s=_e(i),r=t=>{zh(t,{get embed(){return Ei(e).clickableArea},get marker(){return Ei(e)}})};vs(s,t=>{Ei(e).clickableArea&&t(r)}),Gi(t,i)}),Gi(t,e)};vs(ht,t=>{Ei(Q)&&t(ct)});var lt=Me(ht,2),dt=t=>{var e=Yh();let i;var s=ke(e),r=t=>{var e=Hi();bs(_e(e),17,()=>Ei(Z),t=>t.targetId,(t,e)=>{Sh(t,yr({get image(){return l()}},()=>Ei(e)))}),Gi(t,e)};vs(s,t=>{Ei(Z)&&Ei(Z).length&&t(r)});var a=Me(s,2),o=t=>{var e=Vh(),i=_e(e);bs(i,19,()=>Ei(J),t=>t.id,(t,e,i)=>{{let s=jt(()=>Ei(R).includes(Ei(i)));_h(t,{get marker(){return Ei(e)},get image(){return l()},get coords(){return V},get overlapped(){return Ei(s)}})}}),bs(Me(i,2),17,()=>Ei(F),t=>t.id,(t,e)=>{_h(t,{get marker(){return Ei(e)},get image(){return l()}})}),Gi(t,e)};vs(a,t=>{Ei(J)&&t(o)}),q(e),Ye(()=>{Us(e,Ei(st)?Ei(C):null),i=qs(e,1,"micrio-markers",null,i,{"show-titles":I,is360:Ei(D),inactive:Ei(j)||Ei(D)&&n()})}),Gi(t,e)};vs(lt,t=>{Ei(st)&&t(dt)});var ut=Me(lt,2),mt=t=>{var e=Hi();bs(_e(e),17,()=>Ei(K),t=>t.id,(t,e)=>{_h(t,{get marker(){return Ei(e)},get image(){return l()},forceHidden:!0})}),Gi(t,e)};vs(ut,t=>{Ei(K)&&t(mt)}),Gi(t,nt),it(),c()}var qh=Wi('<svg width="100" height="100" class="micrio-progress-circle"><circle fill="transparent" stroke="#e0e0e0" stroke-width="8px" class="micrio-progress-circle"></circle><circle fill="transparent" stroke="#00d4ee" stroke-width="8px" class="micrio-progress-circle"></circle></svg>');var Wh=Bi("<!> <!> <!>",1),Uh=Bi("<!> <!> <!>",1),Hh=Bi("<!> <!>",1),Gh=Bi("<!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!>",1);var jh=!self.createImageBitmap,Zh=URL.createObjectURL(new Blob(["let controller = null, prevUri = null;\nself.addEventListener('message', e => {\n\t// Handle abort message\n\tif(e.data == 'abort') return controller && controller.abort();\n\t// Create new AbortController for this fetch\n\tcontroller = new AbortController();\n\t// Fetch the image blob\n\tfetch(e.data.src, { signal: controller.signal })\n\t\t.then(r => r.blob())"+(jh?"\n\t\t// Fallback for older Safari: create Object URL\n\t\t.then(blob => {\n\t\t\t// Revoke previous Object URL to free memory\n\t\t\tURL.revokeObjectURL(prevUri);\n\t\t\t// Post Object URL back\n\t\t\tself.postMessage({src: (prevUri = URL.createObjectURL(blob, {type: e.data.type}))})\n\t\t})":"\n\t\t// If createImageBitmap is supported, use it (preferred)\n\t\t.then(blob => self.createImageBitmap(blob))\n\t\t// Post ImageBitmap back, transferring ownership\n\t\t.then(data => self.postMessage({data:data, src:e.data.src}, [data]))")+"\n\t\t// Handle fetch errors (including abort)\n\t\t.catch(err => self.postMessage({error: e.data.src+': '+err.message, type: err.name}))\n})"],{type:"text/javascript"})),Jh=Math.max(2,Math.min(6,(navigator.hardwareConcurrency||2)-1)),Kh=[],Qh=new Map,tc=new Map,ec=[],ic=new Map;for(let al=0;al<Jh;al++){const t=new Worker(Zh);t.onmessage=t=>rc(al,t.data.src,t.data.data,t.data.error,t.data.type),Qh.set(al,t),jh&&tc.set(al,new Image)}var sc=t=>new Promise((e,i)=>{ec.push([t,e,i]),function(){if(!ec.length)return;let t=0;for(;t<Jh&&Kh.includes(t);t++);if(t>=Jh)return;Kh.push(t);const e=ec.shift();if(!e)return void Kh.splice(Kh.indexOf(t),1);ic.set(t,e);const i=Qh.get(t);if(!i)return console.error(`[Micrio Texture] Worker ${t} not found!`),e[2]("Internal error: Worker not found"),void Kh.splice(Kh.indexOf(t),1);i.postMessage({src:e[0],type:"image/"+e[0].split(".").pop()})}()});function rc(t,e,i,s,r){const n=ic.get(t);if(null!=n)if(ic.delete(t),setTimeout(()=>{Kh.splice(Kh.indexOf(t),1)},50),s)n[2](s),"AbortError"!=r&&console.error(`[Micrio Texture] Error loading ${n[0]}: ${r} - ${s}`);else if(i)n[1](i);else if(e&&jh){const i=tc.get(t);if(!i)return void n[2]("Internal error: Image element fallback not found");i.onload=()=>{n[1](i)},i.onerror=()=>{n[2](`Failed to load image from Object URL: ${e}`)},i.src=e}else n[2](`Worker ${t} sent invalid message.`),console.error(`[Micrio Texture] Worker ${t} sent invalid message for ${n[0]}`);else console.warn(`[Micrio Texture] Received message from worker ${t} but no matching promise found.`)}function nc(){return Kh.length}function ac(t){const e=[...ic.entries()].find(e=>e[1][0]==t);if(null==e)return;const i=Qh.get(e[0]);i&&i.postMessage("abort")}var oc=Math.PI,hc=oc/2,cc=2*oc;function lc(t){return 1<<t}var dc=t=>function(t,e=1){return(t%e+e)%e}(t,1);function uc(t){return(t%cc+cc)%cc}function mc(t,e){const i=dc(t),s=dc(e)-i,r=s>0?s-1:s+1;return Math.abs(s)<=Math.abs(r)?s:r}var gc=class{constructor(t,e,i,s){this.isLinear=t===e&&i===s&&0===t&&1===i;const r=3*t,n=3*(i-t)-r;this.Cx=r,this.Bx=n,this.Ax=1-r-n;const a=3*e,o=3*(s-e)-a;this.Cy=a,this.By=o,this.Ay=1-a-o}bezier_x(t){return t*(this.Cx+t*(this.Bx+t*this.Ax))}bezier_y(t){return t*(this.Cy+t*(this.By+t*this.Ay))}bezier_x_der(t){return this.Cx+t*(2*this.Bx+3*this.Ax*t)}find_x_for(t){let e=t,i=0,s=0,r=0;for(;i<5&&(s=this.bezier_x(e)-t,r=this.bezier_x_der(e),0!==r);)e-=s/r,i++;return e}get(t){return this.isLinear?t:this.bezier_y(this.find_x_for(t))}},pc=new gc(.42,0,.58,1),fc=new gc(.42,0,1,1),vc=new gc(0,0,.58,1),wc=new gc(0,0,1,1),yc=class{constructor(t=0,e=0,i=0,s=0,r=0,n=0,a=0){this.x0=t,this.y0=e,this.x1=i,this.y1=s,this.layer=r,this.x=n,this.y=a}},bc=class{constructor(t,e=.5,i=.5,s=1,r=1,n=.5,a=.5,o=1,h=1){this.canvas=t,this.centerX=e,this.centerY=i,this.width=s,this.height=r,this.lCenterX=n,this.lCenterY=a,this.lWidth=o,this.lHeight=h,this.arr=new Float64Array(4),this.changed=!1,this.limitChanged=!1,this.toArray()}get x0(){let t=this.centerX;return this.canvas.is360&&(t=dc(t)),this.canvas.is360?dc(t-this.width/2):t-this.width/2}get y0(){return this.centerY-this.height/2}get x1(){let t=this.centerX;return this.canvas.is360&&(t=dc(t)),this.canvas.is360?dc(t+this.width/2):t+this.width/2}get y1(){return this.centerY+this.height/2}get lX0(){return this.lCenterX-this.lWidth/2}get lY0(){return this.lCenterY-this.lHeight/2}get lX1(){return this.lCenterX+this.lWidth/2}get lY1(){return this.lCenterY+this.lHeight/2}get yaw(){return(this.centerX-.5)*oc*2}get pitch(){return(this.centerY-.5)*oc}get aspect(){return this.width/this.height}get size(){return Math.sqrt(this.width*this.width+this.height*this.height)*(1/Math.sqrt(2))}set(t,e,i,s,r=!1){if(r){const t=Math.min(1,this.width)/Math.min(1,this.height);i/s>1.5*t&&i<this.width&&(s=i/t)}this.centerX=t,this.centerY=e,this.width=i,this.height=s,this.toArray(),this.changed=!0}setArea(t,e,i,s){this.centerX=(t+i)/2,this.centerY=(e+s)/2,this.width=i-t,this.height=s-e,this.toArray()}setLimit(t,e,i,s){this.lCenterX=t,this.lCenterY=e,this.lWidth=i,this.lHeight=s,this.changed=!0,this.limitChanged=!0}copy(t,e=!1){this.centerX=t.centerX,this.centerY=t.centerY,this.width=t.width,this.height=t.height,e||(this.lCenterX=t.lCenterX,this.lCenterY=t.lCenterY,this.lWidth=t.lWidth,this.lHeight=t.lHeight),this.changed=!0,this.toArray()}getPerspective(){const t=this.canvas,e=t.webgl;return e.maxPerspective-.5/(this.height*t.height/t.el.height)*oc/e.scaleY}getScale(){const t=this.canvas;return 1/Math.max(this.width*t.width/t.el.width,this.height*t.height/t.el.height)}getDistance(t,e){e&&this.canvas.currentArea.isFull()&&(t.correctAspectRatio(),this.correctAspectRatio());return(Math.abs(this.centerX-t.centerX)+Math.abs(this.centerY-t.centerY)+Math.abs(this.width-t.width)+Math.abs(this.height-t.height))/4}limit(t,e=!1,i=!1){const s=this.canvas,r=s.camera.minSize,n=this.getScale();if(r<1&&n<s.camera.minScale&&!e){const t=1/r,e=Math.min(t,this.width),i=Math.min(t,this.height);return this.centerX=.5,this.centerY=.5,this.width=e,this.height=i,void this.toArray()}const a=t?Math.max(1,n/Math.max(s.camera.minScale,s.maxScale/s.el.scale)):1,o=this.lWidth,h=this.lHeight,c=Math.min(o,this.width*a),l=Math.min(h,this.height*a);if(t&&(a>1||e&&n<s.camera.minScale)&&(this.width=c,this.height=l),(o<1||h<1)&&(this.width=Math.min(this.width,o),this.height=Math.min(this.height,h)),e)return void this.toArray();const d=Math.min(1,this.width)/2,u=this.lWidth/2;this.canvas.is360?this.centerX=dc(this.centerX):i||(this.centerX=Math.max(this.lCenterX-u+d,Math.min(this.centerX,this.lCenterX+u-d)));const m=Math.min(1,this.height)/2,g=this.lHeight/2;i||(this.centerY=Math.max(this.lCenterY-g+m,Math.min(this.centerY,this.lCenterY+g-m))),this.toArray()}correctAspectRatio(){const t=this.canvas;if(t.is360)return;const e=t.camera.cpw/t.camera.cph;this.width/this.height>e?this.height=this.width/e:this.width=this.height*e,this.toArray()}toArray(){return this.arr[0]=this.centerX,this.arr[1]=this.centerY,this.arr[2]=this.width,this.arr[3]=this.height,this.arr}equals(t,e,i,s){return this.centerX===t&&this.centerY===e&&this.width===i&&this.height===s}isFull(){return 1===this.width&&1===this.height&&.5===this.centerX&&.5===this.centerY}},xc=class{constructor(t=.5,e=.5,i=1,s=0,r=0){this.x=t,this.y=e,this.scale=i,this.w=s,this.direction=r,this.arr=new Float64Array(5)}inView(t){return this.w<-1||this.w<3&&!(this.x<0||this.x>t.width||this.y<0||this.y>t.height)}toArray(){return this.arr[0]=this.x,this.arr[1]=this.y,this.arr[2]=this.scale,this.arr[3]=this.w,this.arr[4]=this.direction,this.arr}},Tc=class{constructor(t=0,e=0,i=0,s=0,r=0,n=0,a=1,o=1,h=!1){this.width=t,this.height=e,this.left=i,this.top=s,this.areaWidth=r,this.areaHeight=n,this.ratio=a,this.scale=o,this.isPortrait=h,this.arr=new Int32Array(4)}get centerX(){return this.left+this.width/2}get centerY(){return this.top+this.height/2}get aspect(){return 0===this.width||0===this.height?1:this.width/this.height}toArray(){return this.arr[0]=this.width,this.arr[1]=this.height,this.arr[2]=this.left,this.arr[3]=this.top,this.arr}set(t,e,i,s,r,n,a){return(this.width!==t*r||this.height!==e*r||this.left!==i||this.top!==s||this.ratio!==r||this.scale!==n||this.isPortrait!==a)&&(this.width=t*r,this.height=e*r,this.left=i*r,this.top=s*r,this.ratio=r,this.scale=n,this.isPortrait=a,!0)}copy(t){this.width=t.width,this.height=t.height,this.left=t.left,this.top=t.top,this.ratio=t.ratio,this.scale=t.scale,this.isPortrait=t.isPortrait}},kc=class{constructor(t){this.canvas=t,this.dX=0,this.dY=0,this.startTime=0,this.prevTime=0,this.endTime=0,this.lastInteraction=0,this.velocityX=0,this.velocityY=0,this.started=!1}addStep(t,e,i){if(this.endTime)return;0===this.startTime&&(this.startTime=i);const s=this.prevTime>0?16.67/(i-this.prevTime):1;Math.sqrt(t*t+e*e)*s>20&&(this.lastInteraction=i);const r=this.canvas.main.dragElasticity;this.dX+=t*r,this.dY+=e*r,this.prevTime=i}start(){this.canvas.camera.isUnderZoom()||(this.started=!0)}stop(){this.started=!1,this.endTime=0,this.startTime=0,this.prevTime=0,this.lastInteraction=0,this.dX=0,this.dY=0,this.velocityX=0,this.velocityY=0}step(t){const e=this.canvas.webgl,i=this.canvas.camera;if(!this.started||0===this.startTime)return 1;if(0===this.endTime){this.endTime=t;const e=1-Math.min(1,(this.endTime-this.lastInteraction)/250),i=this.endTime-this.startTime;this.velocityX=this.dX/(i/4)*e,this.velocityY=this.dY/(i/4)*e}else this.velocityX*=.94,this.velocityY*=.94;let s=Math.sqrt(this.velocityX*this.velocityX+this.velocityY*this.velocityY);return this.canvas.is360?e.rotate(this.velocityX,this.velocityY,0,t):i.pan(this.velocityX,this.velocityY,0,!1,t,!1,!0),s<=.01&&(s=0,this.stop()),1-s}},_c=class{constructor(t){this.canvas=t,this.isView=!1,this.isZoom=!1,this.isJump=!1,this.zFrom=0,this.zTo=0,this.zNoLimit=!1,this.fn=pc,this.started=0,this.duration=0,this.isRunning=!1,this.limit=!0,this.zoomingOut=!1,this.flying=!1,this.correcting=!1,this.pausedAt=0,this.fL=0,this.fT=0,this.fR=0,this.fB=0,this.mI=0,this.mO=0,this.omniStartIdx=-1,this.omniDelta=0,this.vFrom=new bc(t),this.vTo=new bc(t),this.lastView=new bc(t)}pause(t){this.pausedAt>0||(this.isRunning=!1,this.pausedAt=t)}resume(t){0!==this.pausedAt&&0!==this.started&&(this.started+=t-this.pausedAt,this.pausedAt=0,this.isRunning=!0)}stop(){this.isRunning&&this.canvas.aniAbort(),this.started=0,this.limit=!0,this.flying=!1,this.isRunning=!1,this.isView=!1,this.isZoom=!1,this.correcting=!1,this.pausedAt=0}isStarted(){return this.isRunning&&this.isView}toView(t,e,i,s,r,n,a,o,h,c,l,d,u=!1){if(u&&this.correcting)return this.updateTarget(t,e,i,s,!0),r;this.lastView.set(t,e,i,s),this.vTo.set(t,e,i,s);const m=this.canvas,g=m.view,p=this.vTo,f=this.vFrom;this.isJump=o,this.fn=3===l?wc:2===l?vc:1===l?fc:pc;const v=m.main.el;if(0!==v.areaHeight){const t=s/(1-v.areaHeight/v.height);t>0?s+=t:s-=t,v.areaHeight=0}if(0!==v.areaWidth){const t=i*(v.areaWidth/v.width);t>0?i+=t:i-=t,v.areaWidth=0}const w=g.centerX,y=g.centerY,b=g.width,x=g.height;f.set(w,y,b,x),m.is360&&(t=w+mc(w,t),p.set(t,e,i,s)),h&&(p.correctAspectRatio(),p.limit(!1)),this.fL=0,this.fR=0,this.fT=0,this.fB=0;let T=1;if(this.isJump){if(!m.is360){const t=p.centerX,e=p.centerY;if(p.aspect>f.aspect){const i=p.width/f.aspect;p.set(t,e,p.width,i)}else{const i=p.height*f.aspect;p.set(t,e,i,p.height)}}const r=f.centerX-f.width/2,n=f.centerX+f.width/2,a=f.centerY-f.height/2,o=f.centerY+f.height/2,h=p.centerX-p.width/2,c=p.centerX+p.width/2,l=p.centerY-p.height/2,d=p.centerY+p.height/2,u=h<r,g=l<a,v=c>n,w=d>o;!(u||g||v||w)||u&&g&&v&&w?p.set(t,e,i,s):(this.fL=u?1:h>r?2:0,this.fR=v?1:c<n?2:0,this.fT=g?1:l>a?2:0,this.fB=w?1:d<o?2:0,T=1.5)}u&&p.limit(!0,!h);const k=Math.max(1e4,Math.min(15e3,Math.sqrt(m.width*m.width+m.height*m.height)/2));let _=Math.abs(w-t);m.is360&&(_=Math.min(_,1-_));const M=i<b&&s<x?.125:.25,S=(_+Math.abs(y-e)+Math.abs(b-i)*M+Math.abs(x-s)*M)/3;this.mI=Math.max(.5,.8-S*(m.is360?1:2)),this.mO=Math.max(.05,Math.min(.9,S-(m.is360?.2:.1))),this.duration=r<0?S*k/m.camSpeed*T/(n<=0?1:n):r;const E=this.canvas.images.length/this.canvas.omniNumLayers;return this.omniStartIdx=this.canvas.activeImageIdx,this.omniDelta=0,!isNaN(c)&&c>0&&c!==this.omniStartIdx&&(this.omniDelta=c-this.omniStartIdx,this.omniDelta<-E/2&&(this.omniDelta+=E),this.omniDelta>E/2&&(this.omniDelta-=E),this.duration+=Math.abs(this.omniDelta)/this.canvas.images.length*6e3),0===this.duration?(m.setView(p.centerX,p.centerY,p.width,p.height,!1,!0),this.canvas.aniDone(),this.stop(),this.duration):(this.stop(),this.isView=!0,this.limit=!1,this.flying=!0,this.isZoom=!1,u&&(this.correcting=!0),this.started=d-a*this.duration,this.isRunning=!0,this.duration*(1-a))}updateTarget(t,e,i,s,r=!1){this.vTo.set(t,e,i,s),r&&this.vTo.limit(!0)}zoom(t,e,i,s,r){this.stop(),this.isView=!1,this.flying=!1,this.isZoom=!0,this.zNoLimit=s;const n=this.canvas,a=n.webgl;return this.zFrom=a.perspective,this.zTo=this.zFrom+t/(a.scale*Math.sqrt(n.width*n.width+n.height*n.height)/20),s||(this.zTo=Math.min(a.maxPerspective,Math.max(a.minPerspective,this.zTo))),this.started=r,this.isRunning=!0,this.duration=e>=0?e:1e3*Math.abs(this.zFrom-this.zTo)/i,e}setStartView(t,e,i,s,r){this.vFrom.set(t,e,i,s,r),this.vTo.set(t,e,i,s,r)}step(t){const e=0===this.started?1:Math.min(1,Math.max(0,(t-this.started)/this.duration)),i=this.fn.get(e),s=this.canvas.getScale();if(this.isRunning){if(this.isView){const t=this.vFrom,s=this.vTo,r=this.mO,n=this.fn.get(Math.min(1,e/this.mI)),a=this.fn.get(Math.max(0,(e-r)/(1-r)));let o=0,h=t.centerX+(s.centerX-t.centerX)*((o=this.fL||this.fR)?1===o?n:a:i),c=t.centerY+(s.centerY-t.centerY)*((o=this.fT||this.fB)?1===o?n:a:i);const l=t.width+(s.width-t.width)*i,d=t.height+(s.height-t.height)*i;if(this.canvas.is360){const e=mc(t.centerX,s.centerX);h=t.centerX+e*i}if(this.canvas.setView(h,c,l,d,!1,!0),this.omniDelta){let t=this.omniStartIdx+Math.trunc(this.omniDelta*this.fn.get(Math.min(1,1.5*e)));const i=this.canvas.images.length/this.canvas.omniNumLayers;t<0&&(t+=i),t>=i&&(t-=i),this.canvas.setActiveImage(t,0)}}this.isZoom&&this.canvas.webgl.setPerspective(this.zFrom*(1-i)+this.zTo*i,this.zNoLimit),e>=1&&(this.lastView.copy(this.canvas.view),this.canvas.aniDone(),this.stop())}return this.zoomingOut=this.isRunning&&this.canvas.getScale()<s,e}},Mc=class{constructor(t){this.canvas=t,this.scale=1,this.minScale=1,this.minSize=1,this.maxScale=1,this.fullScale=1,this.coverScale=1,this.xy=new xc,this.coo=new xc,this.startCoo=new xc,this.pinching=!1,this.inited=!1,this.hasStartCoo=!1,this.cpw=-1,this.cph=-1,this.wasCoverLimit=!0,this.prevSize=-1,this.prevCenterX=-1,this.prevCenterY=-1,t.is360&&(this.inited=!0)}getCoo(t,e,i,s){const r=this.canvas;(r.noImage||r.freeMove)&&(s=!0);const n=r.el,a=r.hasParent?r.parent.el.ratio:n.ratio;i&&(t-=n.left,e-=n.top);const o=t/this.scale*a/r.width+r.view.x0,h=e/this.scale*a/r.height+r.view.y0;return this.coo.x=s?o:Math.max(r.view.lX0,Math.min(r.view.lX1,o)),this.coo.y=s?h:Math.max(r.view.lY0,Math.min(r.view.lY1,h)),this.coo.scale=this.scale,this.coo.toArray(),this.coo}getXY(t,e,i){const s=this.canvas,r=s.el,n=s.hasParent?s.parent.el.ratio:r.ratio;return this.xy.x=(t-s.view.x0)*s.width*this.scale/n+(i?r.left:0),this.xy.y=(e-s.view.y0)*s.height*this.scale/n+(i?r.top:0),this.xy.scale=this.scale/n,this.xy.toArray(),this.xy}getXYOmni(t,e,i,s,r){return this.getXYOmniCoo(t-.5,e-.5,i,s,r)}getXYOmniCoo(t,e,i,s,r){const n=this.canvas,a=n.el,o=n.webgl.pMatrix,h=n.webgl.vec4,c=n.hasParent?n.parent.el.ratio:a.ratio;h.x=t,h.y=e,h.z=i,h.w=1,o.identity(),!r&&n.omniFieldOfView&&o.perspective(n.omniFieldOfView,n.aspect,1e-4,100),n.omniDistance&&o.translate(0,0,n.omniDistance),n.omniOffsetX&&o.translate(n.omniOffsetX,0,0),!r&&n.omniVerticalAngle&&o.rotateX(n.omniVerticalAngle);const l=n.images.length/n.omniNumLayers,d=n.layer*l,u=n.images.length>0?-(n.activeImageIdx+1-d)/l*2*oc:0;return o.rotateY(s+u),h.transformMat4(o),this.xy.x=(.5+h.x-n.view.x0)*n.width*this.scale/c+(r?a.left:0),this.xy.y=(.5+h.y-n.view.y0)*n.height*this.scale/c+(r?a.top:0),this.xy.w=-h.w-n.omniDistance,this.xy.toArray(),this.xy}setCanvas(){const t=this.canvas,e=t.el,i=e.width/t.width,s=e.height/t.height;if(!t.view.limitChanged&&this.cpw===i&&this.cph===s)return void(t.coverLimit!==this.wasCoverLimit&&this.correctMinMax());this.cpw=i,this.cph=s,this.fullScale=Math.min(i,s),this.coverScale=Math.max(i,s);const r=t.view.lWidth/t.view.lHeight;if(t.view.limitChanged=!1,t.view.lWidth<1||t.view.lHeight<1){const e=i/s;this.coverScale/=r<e?t.view.lWidth/e:t.view.lHeight*e}if(this.correctMinMax(),e.width&&e.height&&!this.canvas.ani.isStarted()&&(t.view.copy(t.ani.lastView,!0),!t.is360)){const e=t.ani.limit;t.ani.limit=!1,this.setView(),t.ani.limit=e}}correctMinMax(t=!1){const e=this.canvas;if(this.minScale=e.coverLimit?this.coverScale:this.fullScale,!t&&!e.main.isSwipe&&(0===e.activeImageIdx&&!e.coverLimit||e.activeImageIdx>0)){const t=e.focus.width*e.width,i=e.focus.height*e.height,s=e.el.width,r=e.el.height;this.minScale=s/r>t/i?r/i:s/t}this.maxScale=this.minScale>1&&e.maxScale<this.minScale?this.minScale:Math.max(this.minScale,e.maxScale*e.scaleMultiplier/e.el.scale),this.wasCoverLimit=e.coverLimit}isUnderZoom(){return this.minSize<1&&this.scale<this.minScale}isZoomedOut(t=!1){return Math.trunc(1e6*(this.scale-this.minScale*(t?this.minSize:1)))/1e6<=0}isZoomedIn(){return this.scale/this.maxScale>=1}setView(){if(-1===this.cpw)return!1;const t=this.canvas,e=this.canvas.view,i=!t.freeMove&&t.ani.limit;!t.ani.correcting&&(i||!t.ani.flying&&t.coverLimit)&&e.limit(!1);const s=e.width,r=e.height,n=this.cpw,a=this.cph;this.scale=Math.min(n/s,a/r),i&&!this.pinching&&this.isZoomedIn()&&t.ani.flying&&(this.scale=this.maxScale),(!t.ani.correcting&&!this.pinching||t.coverLimit)&&(this.scale=Math.max(this.minScale*this.minSize,this.scale)),!this.inited&&t.coverStart&&(this.scale=this.coverScale);const o=n/this.scale-s,h=a/this.scale-r;return e.set(e.centerX,e.centerY,e.width+o,e.height+h),!this.inited&&t.coverStart&&this.canvas.ani.lastView.copy(e),!t.ani.correcting&&t.coverLimit&&e.limit(!1),this.inited=this.cpw>0,e.toArray(),!this.hasStartCoo||(this.hasStartCoo=!1,this.setCoo(this.startCoo.x,this.startCoo.y,this.startCoo.scale,0,0,!1,0,0),!1)}isOutsideLimit(){const t=this.canvas.view;return!this.canvas.freeMove&&(Math.trunc(1e6*(t.x0-t.lX0))/1e6<0!=Math.trunc(1e6*(t.x1-t.lX1))/1e6>0||Math.trunc(1e6*(t.y0-t.lY0))/1e6<0!=Math.trunc(1e6*(t.y1-t.lY1))/1e6>0||Math.trunc(1e6*(this.scale-this.maxScale))/1e6>0)}pan(t,e,i,s,r,n=!1,a=!1){const o=this.canvas;if(o.is360)return void o.webgl.rotate(t,e,i,r);if((this.isUnderZoom()||this.pinching)&&!n)return;this.canvas.freeMove&&(s=!0);const h=o.hasParent?o.parent.el.ratio:o.el.ratio,c=o.view,l=t/o.width/this.scale*h,d=e/o.height/this.scale*h,u=c.centerX+l,m=c.centerY+d,g=c.width,p=c.height;this.pinching?(o.view.set(u,m,g,p),o.setView(u,m,g,p,s,!1,!1,!1)):n||!this.isOutsideLimit()||a?(o.ani.stop(),0===i?(a||o.kinetic.addStep(4*t,4*e,r),o.view.set(u,m,g,p),s||o.view.limit(!1,!1,o.freeMove),o.setView(u,m,g,p,s,!1,!1,a),o.view.changed=!0):o.ani.toView(u,m,g,p,i,0,0,!1,!1,-1,0,r)):o.ani.toView(u,m,g,p,i||150,0,0,!1,!1,-1,0,r,!s)}zoom(t,e,i,s,r,n){const a=this.canvas;if(a.is360)return a.webgl.zoom(t,s,0,r,n,e,i);if(!this.pinching&&this.isZoomedIn()&&t<0)return 0;if(this.canvas.freeMove&&(r=!0),t>0&&this.isZoomedOut()&&this.minSize>=1&&(!this.pinching||a.coverLimit))return 0;const o=a.el,h=a.view,c=this.cpw/this.cph;let l=t*(o.width/512)/a.width/this.scale,d=l/c;t<0&&l<-1&&(l=-.9999),t<0&&d<-1&&(d=-.9999);const u=!r&&!a.freeMove&&a.ani.limit&&0===s,m=a.hasParent?a.parent.el.ratio:o.ratio;e-=o.left,i-=o.top;const g=this.isUnderZoom(),p=e>0&&!g?e/o.width*m:.5,f=i>0&&!g?i/o.height*m:.5,v=h.centerX+l*(.5-p),w=h.centerY+d*(.5-f),y=h.width+l,b=h.height+d;return a.ani.limit=u,s=a.ani.toView(v,w,y,b,s,0,0,!1,!r&&!this.pinching,-1,0,n,u),a.ani.lastView.copy(a.view),a.ani.limit=!r,s}pinch(t,e,i,s){const r=this.canvas,n=r.main.el,a=(Math.min(t,i)-n.left)/n.scale,o=(Math.min(e,s)-n.top)/n.scale,h=(Math.max(t,i)-n.left)/n.scale,c=(Math.max(e,s)-n.top)/n.scale,l=a+(h-a)/2,d=o+(c-o)/2,u=Math.max(h-a,c-o),m=this.prevSize-u;if(r.kinetic.stop(),this.prevCenterX>0){const t=this.prevCenterX-l,e=this.prevCenterY-d;r.is360?(r.webgl.zoom(2*m,0,0,!1,1),r.webgl.rotate(t,e,0,0)):(!this.canvas.main.noPinchPan&&this.scale>this.minScale&&this.pan(t,e,0,!1,0,!0),this.zoom(2*m*n.scale,l,d,0,!this.canvas.pinchZoomOutLimit,0),r.ani.limit=!!this.canvas.pinchZoomOutLimit)}else r.ani.stop();this.prevCenterX=l,this.prevCenterY=d,this.prevSize=u}pinchStart(){this.pinching=!0}pinchStop(t){this.canvas.is360||this.snapToBounds(t),this.prevSize=-1,this.prevCenterX=-1,this.prevCenterY=-1,this.pinching=!1}snapToBounds(t){if(this.canvas.freeMove)return;const e=this.canvas.view,i=this.scale>this.maxScale,s=i?this.cpw/this.maxScale:e.width,r=i?this.cph/this.maxScale:e.height,n=s/2,a=r/2,o=e.lWidth/2,h=e.lHeight/2,c=n>=o?e.lCenterX:Math.max(e.lX0+n,Math.min(e.centerX,e.lX1-n)),l=a>=h?e.lCenterY:Math.max(e.lY0+a,Math.min(e.centerY,e.lY1-a));this.canvas.ani.toView(c,l,s,r,150,0,0,!1,!1,-1,0,t,!0)}flyTo(t,e,i,s,r,n,a,o,h,c,l,d,u){const m=this.canvas,g=m.ani;m.kinetic.stop();let p=t;if(m.is360){const e=m.view.centerX;p=e+mc(e,t)}return g.limit=!1,r=g.toView(p,e,i,s,r,n,a,o,h,l,d,u,c),g.limit=!1,g.flying=!0,r}setCoo(t,e,i,s,r,n,a,o){if(!this.inited)return this.hasStartCoo=!0,this.startCoo.x=t,this.startCoo.y=e,this.startCoo.scale=i,this.setView(),0;const h=this.canvas,c=h.is360;(0===i||!c&&isNaN(i))&&(i=h.getScale()),c||(i=Math.max(this.minScale,i)),h.kinetic.stop();const l=isNaN(i)&&c?h.view.width:1/i*this.cpw,d=isNaN(i)&&c?h.view.height:1/i*this.cph;return 0!==s||c||(t+l/2>1&&(t=1-l/2),t-l/2<0&&(t=l/2),e+d/2>1&&(e=1-d/2),e-d/2<0&&(e=d/2)),s=h.ani.toView(t,e,l,d,s,r,0,!1,!1,-1,a,o),h.ani.limit=0===s||n,h.ani.flying=s>0,s}},Sc=class{constructor(t=1,e=0,i=0,s=0,r=0,n=1,a=0,o=0,h=0,c=0,l=1,d=0,u=0,m=0,g=0,p=1){this.a0=t,this.a1=e,this.a2=i,this.a3=s,this.a4=r,this.a5=n,this.a6=a,this.a7=o,this.a8=h,this.a9=c,this.a10=l,this.a11=d,this.a12=u,this.a13=m,this.a14=g,this.a15=p,this.arr=new Float32Array(16)}toArray(){return this.arr[0]=this.a0,this.arr[1]=this.a1,this.arr[2]=this.a2,this.arr[3]=this.a3,this.arr[4]=this.a4,this.arr[5]=this.a5,this.arr[6]=this.a6,this.arr[7]=this.a7,this.arr[8]=this.a8,this.arr[9]=this.a9,this.arr[10]=this.a10,this.arr[11]=this.a11,this.arr[12]=this.a12,this.arr[13]=this.a13,this.arr[14]=this.a14,this.arr[15]=this.a15,this.arr}identity(){this.a0=1,this.a1=0,this.a2=0,this.a3=0,this.a4=0,this.a5=1,this.a6=0,this.a7=0,this.a8=0,this.a9=0,this.a10=1,this.a11=0,this.a12=0,this.a13=0,this.a14=0,this.a15=1}copy(t){this.a0=t.a0,this.a1=t.a1,this.a2=t.a2,this.a3=t.a3,this.a4=t.a4,this.a5=t.a5,this.a6=t.a6,this.a7=t.a7,this.a8=t.a8,this.a9=t.a9,this.a10=t.a10,this.a11=t.a11,this.a12=t.a12,this.a13=t.a13,this.a14=t.a14,this.a15=t.a15}rotateX(t){const e=Math.sin(t),i=Math.cos(t),s=this.a4,r=this.a5,n=this.a6,a=this.a7,o=this.a8,h=this.a9,c=this.a10,l=this.a11;this.a4=s*i+o*e,this.a5=r*i+h*e,this.a6=n*i+c*e,this.a7=a*i+l*e,this.a8=o*i-s*e,this.a9=h*i-r*e,this.a10=c*i-n*e,this.a11=l*i-a*e}rotateY(t){const e=Math.sin(t),i=Math.cos(t),s=this.a0,r=this.a1,n=this.a2,a=this.a3,o=this.a8,h=this.a9,c=this.a10,l=this.a11;this.a0=s*i-o*e,this.a1=r*i-h*e,this.a2=n*i-c*e,this.a3=a*i-l*e,this.a8=s*e+o*i,this.a9=r*e+h*i,this.a10=n*e+c*i,this.a11=a*e+l*i}rotateZ(t){const e=Math.sin(t),i=Math.cos(t),s=this.a0,r=this.a1,n=this.a2,a=this.a3,o=this.a4,h=this.a5,c=this.a6,l=this.a7;this.a0=s*i+o*e,this.a1=r*i+h*e,this.a2=n*i+c*e,this.a3=a*i+l*e,this.a4=o*i-s*e,this.a5=h*i-r*e,this.a6=c*i-n*e,this.a7=l*i-a*e}scaleFlat(t){this.a0*=t,this.a1*=t,this.a2*=t,this.a3*=t,this.a4*=t,this.a5*=t,this.a6*=t,this.a7*=t}translate(t,e,i){this.a12+=this.a0*t+this.a4*e+this.a8*i,this.a13+=this.a1*t+this.a5*e+this.a9*i,this.a14+=this.a2*t+this.a6*e+this.a10*i,this.a15+=this.a3*t+this.a7*e+this.a11*i}perspective(t,e,i,s){this.identity();const r=1/Math.tan(t/2),n=1/(i-s);this.a0=r/e,this.a5=r,this.a10=(s+i)*n,this.a11=-1,this.a14=2*s*i*n,this.a15=0}perspectiveCss(t){this.identity();const e=1/Math.tan(t/2);this.a0=e,this.a5=e}invert(){const t=this.a0,e=this.a1,i=this.a2,s=this.a3,r=this.a4,n=this.a5,a=this.a6,o=this.a7,h=this.a8,c=this.a9,l=this.a10,d=this.a11,u=this.a12,m=this.a13,g=this.a14,p=this.a15,f=t*n-e*r,v=t*a-i*r,w=t*o-s*r,y=e*a-i*n,b=e*o-s*n,x=i*o-s*a,T=h*m-c*u,k=h*g-l*u,_=h*p-d*u,M=c*g-l*m,S=c*p-d*m,E=l*p-d*g;let I=f*E-v*S+w*M+y*_-b*k+x*T;I&&(I=1/I,this.a0=(n*E-a*S+o*M)*I,this.a1=(i*S-e*E-s*M)*I,this.a2=(m*x-g*b+p*y)*I,this.a3=(l*b-c*x-d*y)*I,this.a4=(a*_-r*E-o*k)*I,this.a5=(t*E-i*_+s*k)*I,this.a6=(g*w-u*x-p*v)*I,this.a7=(h*x-l*w+d*v)*I,this.a8=(r*S-n*_+o*T)*I,this.a9=(e*_-t*S-s*T)*I,this.a10=(u*b-m*w+p*f)*I,this.a11=(c*w-h*b-d*f)*I,this.a12=(n*k-r*M-a*T)*I,this.a13=(t*M-e*k+i*T)*I,this.a14=(m*v-u*y-g*f)*I,this.a15=(h*y-c*v+l*f)*I)}multiply(t){let e=this.a0,i=this.a1,s=this.a2,r=this.a3;this.a0=e*t.a0+i*t.a4+s*t.a8+r*t.a12,this.a1=e*t.a1+i*t.a5+s*t.a9+r*t.a13,this.a2=e*t.a2+i*t.a6+s*t.a10+r*t.a14,this.a3=e*t.a3+i*t.a7+s*t.a11+r*t.a15,e=this.a4,i=this.a5,s=this.a6,r=this.a7,this.a4=e*t.a0+i*t.a4+s*t.a8+r*t.a12,this.a5=e*t.a1+i*t.a5+s*t.a9+r*t.a13,this.a6=e*t.a2+i*t.a6+s*t.a10+r*t.a14,this.a7=e*t.a3+i*t.a7+s*t.a11+r*t.a15,e=this.a8,i=this.a9,s=this.a10,r=this.a11,this.a8=e*t.a0+i*t.a4+s*t.a8+r*t.a12,this.a9=e*t.a1+i*t.a5+s*t.a9+r*t.a13,this.a10=e*t.a2+i*t.a6+s*t.a10+r*t.a14,this.a11=e*t.a3+i*t.a7+s*t.a11+r*t.a15,e=this.a12,i=this.a13,s=this.a14,r=this.a15,this.a12=e*t.a0+i*t.a4+s*t.a8+r*t.a12,this.a13=e*t.a1+i*t.a5+s*t.a9+r*t.a13,this.a14=e*t.a2+i*t.a6+s*t.a10+r*t.a14,this.a15=e*t.a3+i*t.a7+s*t.a11+r*t.a15}scaleXY(t,e,i=1){this.a0*=t,this.a1*=t,this.a2*=t,this.a3*=t,this.a4*=e,this.a5*=e,this.a6*=e,this.a7*=e,this.a8*=i,this.a9*=i,this.a10*=i,this.a11*=i}},Ec=class{constructor(t=0,e=0,i=0,s=1){this.x=t,this.y=e,this.z=i,this.w=s}copy(t){this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w}transformMat4(t){const e=this.x,i=this.y,s=this.z,r=t.a3*e+t.a7*i+t.a11*s+t.a15||1;this.x=(t.a0*e+t.a4*i+t.a8*s+t.a12)/r,this.y=(t.a1*e+t.a5*i+t.a9*s+t.a13)/r,this.z=(t.a2*e+t.a6*i+t.a10*s+t.a14)/r,this.w=r}normalize(){let t=this.x*this.x+this.y*this.y+this.z*this.z;t>0&&(t=1/Math.sqrt(t)),this.x*=t,this.y*=t,this.z*=t}},Ic=class{constructor(t,e,i,s,r,n,a){this.image=t,this.index=e,this.start=i,this.end=s,this.tileSize=r,this.cols=n,this.rows=a,this.tileWidth=r/t.width,this.tileHeight=r/t.height}getTileRect(t,e){const i=t-this.start,s=i%this.cols,r=Math.floor(i/this.cols),n=this.image;return e.x0=n.x0+s*this.tileSize/n.width*n.rWidth,e.y0=n.y0+r*this.tileSize/n.height*n.rHeight,e.x1=n.x0+Math.min((s+1)*this.tileSize/n.width,1)*n.rWidth,e.y1=n.y0+Math.min((r+1)*this.tileSize/n.height,1)*n.rHeight,e.image=n,e.layer=this.index,e.x=s,e.y=r,e}},Ac=class t{static{this.toDraw=[]}static{this.toDrawSeen=new Uint8Array(0)}static{this.toDrawSeenBase=0}static{this.sampledXs=new Float64Array(200)}static{this.sampledYs=new Float64Array(200)}static{this.uniqueXs=new Float64Array(200)}static{this.sampledLength=0}static{this.uniqueLength=0}constructor(t,e,i,s,r,n,a,o,h,c,l,d,u,m,g,p){this.canvas=t,this.index=e,this.localIdx=i,this.width=s,this.height=r,this.tileSize=n,this.isSingle=a,this.isVideo=o,this.startOffset=h,this.opacity=c,this.tOpacity=l,this.rotX=d,this.rotY=u,this.rotZ=m,this.scale=g,this.fromScale=p,this.vec=new Ec,this.mat=new Sc,this.rScale=0,this.layers=[],this.numLayers=0,this.targetLayer=0,this.x0=0,this.y0=0,this.x1=1,this.y1=1,this.rWidth=1,this.rHeight=1,this.areaCenterX=.5,this.areaCenterY=.5,this.areaWidth=1,this.areaHeight=1,this.sphere3DX=0,this.sphere3DY=0,this.sphere3DZ=-1,this.angularWidth=0,this.angularHeight=0,this.gotBase=0,this.aspect=0,this.doneTotal=0,this.doRender=!1,this.is360Embed=!1,this.isVideoPlaying=!1;const f=s>r?s:r;this.is360Embed=this.canvas.is360&&this.localIdx>0,this.numLayers=2;for(let w=n;w<f*t.main.underzoomLevels;w*=2)this.numLayers++;(t.main.hasArchive||this.fromScale>0)&&(this.numLayers-=3-t.main.archiveLayerOffset),this.fromScale>0&&this.numLayers--,this.numLayers=Math.max(1,this.numLayers);let v=h;for(let w=0;w<this.numLayers;w++){const t=lc(w)*this.tileSize,e=Math.ceil(s/t),i=Math.ceil(r/t);this.layers.push(new Ic(this,this.layers.length,v,this.endOffset=v+=e*i,t,e,i))}}setArea(t,e,i,s){this.x0=t,this.y0=e,this.x1=i,this.y1=s,this.areaWidth=i+(i<t?1:0)-t,this.areaHeight=s-e,this.areaCenterX=t+this.areaWidth/2,this.areaCenterY=e+this.areaHeight/2,this.canvas.is360&&(this.areaCenterX=dc(this.areaCenterX)),this.rWidth=this.areaWidth,this.rHeight=this.areaHeight,this.aspect=this.width/this.height,this.rScale=this.aspect>this.canvas.aspect?this.canvas.width/this.width*this.rWidth:this.canvas.height/this.height*this.rHeight,this.canvas.is360&&this.calculate3DSpherePosition()}calculate3DSpherePosition(){let t=2*(this.areaCenterX-.5)*oc;const e=(this.areaCenterY-.5)*oc;t+=this.canvas.webgl.baseYaw,this.sphere3DX=Math.cos(e)*Math.sin(t),this.sphere3DY=Math.sin(e),this.sphere3DZ=Math.cos(e)*Math.cos(t),this.angularWidth=2*this.areaWidth*oc,this.angularHeight=this.areaHeight*oc}sphere3DOverlap(){if(!this.canvas.is360)return!1;const t=this.sphere3DX*this.canvas.webgl.cameraForwardX+this.sphere3DY*this.canvas.webgl.cameraForwardY+this.sphere3DZ*this.canvas.webgl.cameraForwardZ,e=Math.acos(Math.max(-1,Math.min(1,t))),i=Math.max(this.angularWidth,this.angularHeight)/2;return e<this.canvas.webgl.fieldOfView+i}outsideView(){if(this.is360Embed)return!this.sphere3DOverlap();{const t=this.canvas.view;return this.x1<=t.x0||this.x0>=t.x1||this.y1<=t.y0||this.y0>=t.y1}}shouldRender(){return!(this.fromScale>0&&this.fromScale>this.canvas.camera.scale)&&((!(this.isVideo||this.localIdx>0)||0!==this.opacity||0!==this.tOpacity)&&(!!(this.index===this.canvas.activeImageIdx||this.canvas.is360&&0===this.localIdx)||!this.outsideView()))}opacityTick(t){const e=this.tOpacity;if(this.opacity===e)return!1;const i=1/(this.canvas.main.frameTime*this.canvas.main.embedFadeDuration);return this.opacity=Math.min(1,Math.max(0,t?e:e>this.opacity?Math.min(e,this.opacity+i):Math.max(e,this.opacity-i))),this.opacity!==e}getTiles(e){if(this.opacity<=0)return 0;if(this.doneTotal=0,this.is360Embed){if(e=this.getEmbeddedScale(e),!(this.doRender=e>0))return 0}else{const t=this.canvas.camera;e=Math.max(e,t.minScale)*this.rScale}const i=this.endOffset-this.startOffset;if(t.toDrawSeen.length<i)t.toDrawSeen=new Uint8Array(i);else for(let a=0;a<i;a++)t.toDrawSeen[a]=0;t.toDrawSeenBase=this.startOffset,0===this.gotBase?(t.toDraw.push(this.endOffset-1),t.toDrawSeen[this.endOffset-1-this.startOffset]=1,this.canvas.main.setTileOpacity(this.endOffset-1,!0,1)):this.is360Embed&&(t.toDraw.push(this.endOffset-1),t.toDrawSeen[this.endOffset-1-this.startOffset]=1,this.doneTotal++);const s=this.getTargetLayer(e),r=this.canvas,n=r.view;0===this.localIdx&&r.is360?this.get360Tiles(this.layers[s]):(this.is360Embed?this.getTilesViewport(s):r.is360?this.getTilesRect(s,n.x0,n.y0,n.x1,n.y1):r.visible.x0<r.visible.x1&&r.visible.y0<r.visible.y1&&this.getTilesRect(s,Math.max(r.visible.x0,n.x0),Math.max(r.visible.y0,n.y0),Math.min(r.visible.x1,n.x1),Math.min(r.visible.y1,n.y1)),this.is360Embed&&this.doneTotal++),t.toDraw.sort((t,e)=>t>e?-1:t<e?1:0);for(let a=0;a<t.toDraw.length;a++)r.toDraw.push(t.toDraw[a]);return t.toDraw.length=0,this.doneTotal}getTargetLayer(t){let e=this.isSingle||this.canvas.limited?this.numLayers:1+this.canvas.main.skipBaseLevels;if(!this.isSingle&&!this.canvas.limited)for(;e<this.numLayers&&!(lc(e)*t>=1);e++);return this.targetLayer=e-1}getTilesRect(t,e,i,s,r){if(this.outsideView())return;const n=this.layers[t],a=n.tileWidth,o=n.tileHeight,h=this.rWidth,c=this.rHeight,l=Math.min(n.cols-1,Math.floor(Math.max(0,s-this.x0)/h/a)),d=Math.floor(Math.max(0,r-this.y0)/c/o),u=Math.floor(Math.max(0,e-this.x0)/h/a);let m=Math.floor(Math.max(0,i-this.y0)/c/o);for(;m<=d;m++)if(!(m>=n.rows))for(let t=u;t<=l;t++)this.setToDraw(n,t,m)}getTilesViewport(t){if(this.outsideView())return;const e=this.layers[t],i=this.canvas,s=dc(i.view.centerX+i.webgl.offX),r=i.view.centerY,n=i.view.width+.1,a=i.view.height+.1,o=this.areaCenterX,h=this.areaCenterY,c=this.areaWidth,l=this.areaHeight,d=r-a/2,u=r+a/2,m=h-l/2,g=h+l/2,p=Math.max(d,m),f=Math.min(u,g);if(p>=f)return;let v=0,w=0,y=!1;if(i.is360){const t=dc(s-n/2),e=dc(s+n/2),i=dc(o-c/2),r=dc(o+c/2);e>t&&r>i?(v=Math.max(t,i),w=Math.min(e,r),y=v<w):e<t&&r>i?(i<=e||r>=t)&&(v=i,w=r,y=!0):e>t&&r<i?(t<=r||e>=i)&&(v=t,w=e,y=!0):e<t&&r<i&&(v=Math.max(t,i),w=Math.min(e,r),y=!0)}else{const t=s-n/2,e=s+n/2,i=o-c/2,r=o+c/2;v=Math.max(t,i),w=Math.min(e,r),y=v<w}if(!y)return;let b=o-c/2,x=o+c/2;i.is360&&(x>1?(v<b&&(v+=1),w<b&&(w+=1)):v>o+.5?v-=1:w>o+.5&&(w-=1));const T=(v-b)/c,k=(w-b)/c,_=(p-(h-l/2))/l,M=(f-(h-l/2))/l,S=e.tileWidth,E=e.tileHeight,I=Math.floor(Math.max(0,Math.min(1,T))/S),A=Math.min(e.cols-1,Math.floor(Math.max(0,Math.min(1,k))/S)),L=Math.floor(Math.max(0,Math.min(1,_))/E),P=Math.min(e.rows-1,Math.floor(Math.max(0,Math.min(1,M))/E));for(let $=L;$<=P;$++)for(let t=I;t<=A;t++)this.setToDraw(e,t,$)}setToDraw(e,i,s){const r=Math.min(this.endOffset-1,e.start+s*e.cols+i),n=r-t.toDrawSeenBase;if(!(n<t.toDrawSeen.length&&t.toDrawSeen[n]))if(n<t.toDrawSeen.length&&(t.toDrawSeen[n]=1),t.toDraw.push(r),this.canvas.main.setTileOpacity(r,r===this.endOffset-1,this.canvas.opacity)>=1)this.doneTotal++;else if(!this.isSingle&&!this.canvas.limited&&e.index<this.numLayers-1){const t=this.layers[e.index+1],r=i>>1,n=s>>1;this.setToDraw(t,r,n)}}setDrawRect(t){const e=this.canvas.main.vertexBuffer,i=this.canvas.webgl.radius,s=2*oc*i,r=this.vec,n=this.mat,a=this.x0+this.rWidth/2,o=this.y0+this.rHeight/2,h=this.canvas.webgl.getVec3(a-this.canvas.webgl.offX,o,!0,5);n.identity(),n.translate(h.x,h.y,h.z),n.rotateY(Math.atan2(h.x,h.z)+oc+this.rotY),n.rotateX(-Math.sin((o-.5)*oc)-this.rotX),n.rotateZ(-this.rotZ),n.scaleFlat(.5*this.scale);let c=(t.x0-a)*s,l=.5*-(t.y0-o)*s;r.x=0,r.y=0,r.z=0,n.translate(c,l,0),r.transformMat4(n),n.translate(-c,-l,0),e[0]=r.x,e[1]=r.y,e[2]=r.z,r.x=0,r.y=0,r.z=0,n.translate(c=(t.x0-a)*s,l=.5*-(t.y1-o)*s,0),r.transformMat4(n),n.translate(-c,-l,0),e[3]=e[9]=r.x,e[4]=e[10]=r.y,e[5]=e[11]=r.z,r.x=0,r.y=0,r.z=0,n.translate(c=(t.x1-a)*s,l=.5*-(t.y0-o)*s,0),r.transformMat4(n),n.translate(-c,-l,0),e[6]=e[15]=r.x,e[7]=e[16]=r.y,e[8]=e[17]=r.z,r.x=0,r.y=0,r.z=0,n.translate(c=(t.x1-a)*s,l=.5*-(t.y1-o)*s,0),r.transformMat4(n),n.translate(-c,-l,0),e[12]=r.x,e[13]=r.y,e[14]=r.z}getEmbeddedScale(t){if(this.is360Embed){return t*Math.max(2*this.areaWidth,this.areaHeight)*(this.canvas.width/this.width)}const e=this.areaWidth,i=this.areaHeight,s=this.areaCenterX-e/2,r=this.areaCenterX+e/2,n=this.areaCenterY,a=i/2.5,o=this.canvas.el,h=this.canvas.webgl,c=this.canvas.el.width;let l=h.getXYZ(s,n-a),d=l.w>0||l.x<0?0:Math.min(c,l.x),u=0;l.inView(o)&&u++,h.getXYZ(r,n-a).inView(o)&&u++;const m=(l.w>0||l.x>c?c:Math.max(0,l.x))-d;if(h.getXYZ(s,n+a).inView(o)&&u++,d=l.w>0||l.x<0?0:Math.min(c,l.x),h.getXYZ(r,n+a).inView(o)&&u++,0===u)return 0;const g=(l.w>0||l.x>c?c:Math.max(0,l.x))-d;return Math.min(1,Math.max(g,m)/this.width)}get360Tiles(e){const i=this.canvas,s=i.el,r=s.width,n=s.height;t.sampledLength=0,t.uniqueLength=0;const a=i.webgl.fieldOfView>oc/2?20:12;for(let v=0;v<=a;v++){const e=v/a;let s=i.webgl.getCoo(e*r,0);t.sampledXs[t.sampledLength]=s.x,t.sampledYs[t.sampledLength]=s.y,t.sampledLength++,s=i.webgl.getCoo((1-e)*r,n),t.sampledXs[t.sampledLength]=s.x,t.sampledYs[t.sampledLength]=s.y,t.sampledLength++,s=i.webgl.getCoo(r,e*n),t.sampledXs[t.sampledLength]=s.x,t.sampledYs[t.sampledLength]=s.y,t.sampledLength++,s=i.webgl.getCoo(0,(1-e)*n),t.sampledXs[t.sampledLength]=s.x,t.sampledYs[t.sampledLength]=s.y,t.sampledLength++}let o;for(let v=1;v<=3;v++){const e=n*v/4;for(let s=1;s<=3;s++)o=i.webgl.getCoo(r*s/4,e),t.sampledXs[t.sampledLength]=o.x,t.sampledYs[t.sampledLength]=o.y,t.sampledLength++;o=i.webgl.getCoo(r*v/4,n-1),t.sampledXs[t.sampledLength]=o.x,t.sampledYs[t.sampledLength]=o.y,t.sampledLength++}let h=1/0,c=-1/0;for(let v=0;v<t.sampledLength;v++){const e=t.sampledYs[v];e<h&&(h=e),e>c&&(c=e)}h=Math.max(0,h),c=Math.min(1,c),h-=.001,c+=.05,h=Math.max(0,h),c=Math.min(1,c);const l=i.webgl.offX;for(let v=0;v<t.sampledLength;v++)t.sampledXs[v]=dc(t.sampledXs[v]-l);t.uniqueLength=0;for(let v=0;v<t.sampledLength;v++){const e=t.sampledXs[v];let i=!1;for(let s=0;s<t.uniqueLength;s++)if(Math.abs(t.uniqueXs[s]-e)<1e-8){i=!0;break}i||(t.uniqueXs[t.uniqueLength]=e,t.uniqueLength++)}for(let v=1;v<t.uniqueLength;v++){const e=t.uniqueXs[v];let i=v-1;for(;i>=0&&t.uniqueXs[i]>e;)t.uniqueXs[i+1]=t.uniqueXs[i],i--;t.uniqueXs[i+1]=e}const d=t.uniqueLength;if(d<2)h=0,c=1,t.uniqueLength=0,t.uniqueXs[0]=0,t.uniqueXs[1]=1,t.uniqueLength=2;else{let e=0,i=-1;for(let h=0;h<d-1;h++){const s=t.uniqueXs[h+1]-t.uniqueXs[h];s>e&&(e=s,i=h)}const s=t.uniqueXs[0]+1-t.uniqueXs[d-1];let r=s>e;r&&(e=s,i=d-1);const n=1-e;let a=0,o=0;r?(a=t.uniqueXs[0],o=t.uniqueXs[d-1]):(a=t.uniqueXs[(i+1)%d],o=t.uniqueXs[i]+1),n>=.999999&&(a=0,o=1),t.uniqueLength=0,t.uniqueXs[0]=a,t.uniqueXs[1]=o,t.uniqueLength=2}let u=t.uniqueXs[1]-t.uniqueXs[0]>=.999999;(h<.05||c>.95)&&(u=!0);let m=Math.max(0,Math.max(0,Math.floor((h-.001)/e.tileHeight))),g=Math.min(e.rows-1,Math.max(0,Math.floor((c+e.tileHeight-1e-10)/e.tileHeight)));h<1e-5&&(m=0),c>.99999&&(g=e.rows-1);const p=e.tileWidth,f=t.uniqueXs[1]>1;for(let v=m;v<=g;v++)if(u)for(let t=0;t<e.cols;t++)this.setToDraw(e,t,v);else if(f){for(let s=Math.max(0,Math.max(0,Math.floor((t.uniqueXs[0]-.001)/p)-1));s<e.cols;s++)this.setToDraw(e,s,v);const i=Math.min(e.cols-1,Math.ceil(dc(t.uniqueXs[1]+.001)/p));for(let t=0;t<=i;t++)this.setToDraw(e,t,v)}else{const i=Math.max(0,Math.max(0,Math.floor((t.uniqueXs[0]-.001)/p)-1)),s=Math.min(e.cols-1,Math.ceil((t.uniqueXs[1]+.001)/p));for(let t=i;t<=s;t++)this.setToDraw(e,t,v)}}},Lc=class{constructor(t){this.canvas=t,this.pMatrix=new Sc,this.iMatrix=new Sc,this.cachedInverse=new Sc,this.inverseDirty=!0,this.rMatrix=new Sc,this.position=new Ec,this.radius=10,this.scale=0,this.scaleY=1,this.offY=0,this.dofY=1,this.limitX=0,this.limitY=0,this.baseYaw=0,this.yaw=0,this.pitch=0,this.defaultPerspective=hc,this.perspective=hc,this.maxPerspective=hc,this.minPerspective=hc,this.cameraForwardX=0,this.cameraForwardY=0,this.cameraForwardZ=-1,this.cameraUpX=0,this.cameraUpY=1,this.cameraUpZ=0,this.cameraRightX=1,this.cameraRightY=0,this.cameraRightZ=0,this.fieldOfView=0,this.aspectRatio=1,this.vec4=new Ec,this.coo=new xc,this.offX=0,this.baseYaw=-this.canvas.rotationY,this.offX=this.baseYaw/cc,this.canvas.is360&&(this.scaleY=this.canvas.height/(this.canvas.width/2),this.offY=(1-this.scaleY)/4),this.yaw=this.baseYaw,this.update()}setLimits(t,e){this.limitX=t,this.limitY=e,this.maxPerspective=hc,e>0&&(this.maxPerspective=Math.min(this.maxPerspective,this.maxPerspective*e*1.5)),this.setPerspective(this.perspective,!0)}update(t=!1){const e=this.canvas,i=e.el;if(t||this.pMatrix.perspective(this.perspective,i.aspect,1e-4,e.is360?20:100),this.inverseDirty=!0,e.is360){const t=this.pMatrix;this.pitch=Math.min(oc/2,Math.max(-oc/2,this.pitch)),t.rotateX(this.pitch),t.rotateY(this.yaw),t.translate(this.position.x,this.position.y,this.position.z);const e=this.rMatrix;e.perspectiveCss(this.perspective),e.translate(0,0,i.height/i.ratio/2),e.rotateX(-this.pitch),e.rotateY(this.yaw),this.coo.direction=this.yaw/oc*180%360}else{const t=e.view;this.pMatrix.translate(-(t.centerX-.5)*e.aspect,t.centerY-.5,-t.height/2)}this.pMatrix.toArray()}rotate(t,e,i,s){const r=this.canvas,n=r.el;this.yaw+=t*n.ratio/n.width*this.perspective*n.aspect,this.pitch+=e*n.ratio/n.height*this.perspective*this.scaleY,this.yaw=uc(this.yaw),(r.coverLimit||this.limitY>0)&&this.limitPitch(),this.limitX>0&&this.limitYaw(),0===i&&r.kinetic.addStep(2*t,2*e,s),this.update(),this.calculate3DFrustum(),this.syncLogicalView()}limitPitch(){const t=this.perspective/2,e=oc*this.scaleY/2*(this.limitY>0?this.limitY:1);this.pitch=this.pitch>0?Math.min(e,this.pitch+t)-t:Math.max(-e,this.pitch-t)+t}limitYaw(){const t=this.perspective/2*this.canvas.el.aspect,e=oc*(this.limitX>0?this.limitX:1);let i=this.yaw;for(;i>=oc;)i-=2*oc;for(;i<-oc;)i+=2*oc;this.yaw=uc(Math.min(Math.max(e,t)-t,Math.max(Math.min(-e,-t)+t,i)))}zoom(t,e,i,s,r,n=0,a=0){const o=this.canvas;if(t/=2,0!==e)e=o.ani.zoom(t,e,i,s,r);else{t/=this.scale*Math.sqrt(o.width*o.width+o.height*o.height)/20;const e=n>0&&a>0;let i=0,r=0;if(e){const t=this.getCoo(n,a);i=t.x,r=t.y}if(this.setPerspective(this.perspective+t,s),e){const t=this.getCoo(n,a);let e=i-t.x;e>.5&&(e-=1),e<-.5&&(e+=1);const s=r-t.y;this.yaw+=e*oc*2,this.pitch+=s*oc*this.scaleY,this.yaw=uc(this.yaw),(o.coverLimit||this.limitY>0)&&this.limitPitch(),this.limitX>0&&this.limitYaw(),this.update(),this.readScale(),this.calculate3DFrustum(),this.syncLogicalView()}}return e}setPerspective(t,e){const i=this.canvas;this.perspective=t,e&&!i.is360||(this.perspective=Math.min(this.maxPerspective,Math.max(this.minPerspective,this.perspective))),(i.coverLimit||this.limitY>0)&&this.limitPitch(),this.limitX>0&&this.limitYaw(),this.pMatrix.perspective(this.perspective,i.el.aspect,1e-4,i.is360?20:100),this.readScale(),this.update(!0),this.calculate3DFrustum(),this.syncLogicalView()}readScale(){const t=this.canvas.el,e=t.width/2,i=t.height/2,s=this.getCoo(e,i).x,r=this.getCoo(e+1,i+1).x;this.scale=1/(r+(r<s?1:0)-s)/this.canvas.width}setDirection(t,e,i){this.yaw=uc(t-this.baseYaw),this.pitch=e,0!==i?this.setPerspective(i,!1):this.update(),this.calculate3DFrustum(),this.syncLogicalView()}setView(t,e,i,s,r=!1,n=!1){this.yaw=((n?t+this.offX:t)-.5)*oc*2,this.pitch=(e-.5)*oc*this.scaleY,this.setPerspective(Math.min(this.maxPerspective,s*oc*this.scaleY),r),this.calculate3DFrustum(),this.syncLogicalView()}syncLogicalView(){const t=this.canvas;if(!t.is360)return;const e=dc(this.yaw/(2*oc)+.5),i=this.pitch/this.scaleY/oc+.5,s=this.perspective/oc/this.scaleY,r=s*(0===t.el.width?1:.5*Math.sqrt(t.el.aspect))/(t.aspect/2);t.view.set(e,i,r,s),t.view.changed=!0}calculate3DFrustum(){if(!this.canvas.is360)return;const t=this.yaw,e=this.pitch;this.cameraForwardX=Math.cos(e)*Math.sin(t),this.cameraForwardY=Math.sin(e),this.cameraForwardZ=Math.cos(e)*Math.cos(t),this.cameraUpX=-Math.sin(e)*Math.sin(t),this.cameraUpY=Math.cos(e),this.cameraUpZ=-Math.sin(e)*Math.cos(t),this.cameraRightX=Math.cos(t),this.cameraRightY=0,this.cameraRightZ=-Math.sin(t);const i=2*Math.atan(1/this.perspective);this.aspectRatio=this.canvas.el.width/this.canvas.el.height;const s=i/2;this.fieldOfView=2*Math.atan(Math.tan(s)*this.aspectRatio)}moveTo(t,e,i,s){const r=i*oc*2+s;this.position.x=-t*Math.sin(r),this.position.y=e,this.position.z=t*Math.cos(r),this.canvas.view.changed=!0,this.update()}resize(){const t=this.canvas,e=t.el;t.camera.setCanvas(),this.minPerspective=Math.min(.5,e.height/t.height)/t.maxScale*this.scaleY*oc/e.ratio*e.scale,this.setPerspective(this.perspective,!0)}ensureInverse(){this.inverseDirty&&(this.cachedInverse.copy(this.pMatrix),this.cachedInverse.invert(),this.inverseDirty=!1)}getCoo(t,e){const i=this.canvas.el;return this.vec4.x=t*i.ratio/i.width*2-1,this.vec4.y=-(e*i.ratio/i.height*2-1),this.vec4.z=1,this.vec4.w=1,this.ensureInverse(),this.vec4.transformMat4(this.cachedInverse),this.vec4.normalize(),this.coo.x=Math.atan2(this.vec4.x,-this.vec4.z)/oc/2+.5,this.coo.y=.5-Math.asin(this.vec4.y)/oc/this.scaleY,this.coo.scale=this.scale,this.coo.w=this.position.x+this.position.z,this.coo.direction=this.yaw+this.baseYaw,this.coo.toArray(),this.coo}getXYZ(t,e){const i=this.canvas.el;return this.getVec3(t+this.offX,e),this.coo.x=(this.vec4.x+1)/2*i.width/i.ratio,this.coo.y=(1-this.vec4.y)/2*i.height/i.ratio,this.coo.scale=this.scale,this.coo.w=-this.vec4.w,this.coo.toArray(),this.coo}getVec3(t,e,i=!1,s=this.radius){t*=2*-oc,e-=.5,e*=-oc,e*=this.scaleY;const r=Math.cos(e);return this.vec4.x=r*Math.sin(t)*s,this.vec4.y=Math.sin(e)*s,this.vec4.z=r*Math.cos(t)*s,this.vec4.w=1,i||this.vec4.transformMat4(this.pMatrix),this.vec4}getMatrix(t,e,i,s,r,n,a,o,h=1,c=1,l=!1){isNaN(s)&&(s=this.radius),this.iMatrix.identity(),s*=this.radius*(100/cc),t*=2*-oc,e-=.5,e*=oc*this.scaleY;const d=Math.cos(e);return this.vec4.x=d*Math.sin(t),this.vec4.y=Math.sin(e),this.vec4.z=d*Math.cos(t),this.iMatrix.translate(this.position.x*s/this.radius,-this.position.y*s/this.radius+o*this.radius,this.position.z*s/this.radius),this.iMatrix.translate(this.vec4.x*s,this.vec4.y*s,this.vec4.z*s),this.iMatrix.rotateY(Math.atan2(this.vec4.x,this.vec4.z)+oc+n),this.iMatrix.rotateX(this.vec4.y+r),this.iMatrix.rotateZ(a),this.iMatrix.scaleXY(h,c),this.iMatrix.scaleFlat(i/oc/this.radius),this.iMatrix.multiply(this.rMatrix),this.iMatrix}setTile360(t,e,i,s){e*=this.scaleY,e/=2,e-=.25,e+=this.offY,s*=this.scaleY,s/=2;const r=this.canvas.main.vertexBuffer360,n=this.radius,a=i/16,o=s/16,h=2*oc;for(let c=0;c<16;c++)for(let i=0;i<16;i++){const s=6*(16*c+i)*3,l=-dc(t+a*i+this.offX)*h,d=-(e+o*c)*h,u=-dc(t+a*(i+1)+this.offX)*h,m=-(e+o*(c+1))*h;let g=Math.cos(l)*n;isNaN(g)&&(g=0);let p=Math.sin(l)*n;isNaN(p)&&(p=0);let f=Math.cos(u)*n;isNaN(f)&&(f=0);let v=Math.sin(u)*n;isNaN(v)&&(v=0);const w=Math.cos(d),y=Math.cos(m),b=Math.sin(d)*n,x=Math.sin(m)*n;r[s+0]=w*p,r[s+1]=b,r[s+2]=w*g,r[s+3]=r[s+9]=y*p,r[s+4]=r[s+10]=x,r[s+5]=r[s+11]=y*g,r[s+6]=r[s+15]=w*v,r[s+7]=r[s+16]=b,r[s+8]=r[s+17]=w*f,r[s+12]=y*v,r[s+13]=x,r[s+14]=y*f}}},Pc=class t{get zIndex(){return this._zIndex}set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.parent&&(this.parent.childrenDirty=!0))}constructor(t,e,i,s,r,n,a=!1){this.main=t,this.width=e,this.height=i,this.targetOpacity=s,this.coverLimit=r,this.hasParent=a,this.rect=new yc,this.el=new Tc,this.images=[],this.children=[],this.areaAniPerc=1,this.areaAniPaused=!1,this._zIndex=0,this.childrenDirty=!1,this.toDraw=[],this.index=0,this.isVisible=!1,this.opacity=0,this.bOpacity=0,this.isReady=!1,this.activeImageIdx=-1,this.omniFieldOfView=0,this.omniVerticalAngle=0,this.omniDistance=0,this.omniOffsetX=0,this.limited=!1,this.layer=0,this.tileSize=n.tileSize,this.is360=n.is360,this.noImage=n.noImage,this.isSingle=n.isSingle,this.freeMove=n.freeMove,this.coverStart=!!r||n.coverStart,this.maxScale=n.maxScale,this.scaleMultiplier=n.scaleMultiplier,this.camSpeed=n.camSpeed,this.rotationY=n.rotationY,this.isGallerySwitch=n.isGallerySwitch,this.pagesHaveBackground=n.pagesHaveBackground,this.isOmni=n.isOmni,this.pinchZoomOutLimit=n.pinchZoomOutLimit,this.omniNumLayers=n.omniNumLayers,this.omniStartLayer=n.omniStartLayer,this.index=t.canvases.length,a||t.canvases.push(this),this.aspect=e/i,this.view=new bc(this),this.focus=new bc(this),this.ani=new _c(this),this.kinetic=new kc(this),this.camera=new Mc(this),this.webgl=new Lc(this),this.area=new bc(this),this.currentArea=new bc(this),this.targetArea=new bc(this),this.visible=new bc(this),this.full=new bc(this),n.is360&&this.view.set(.5,.5,1,.5),a||(this.el.copy(t.el),this.setView(this.view.centerX,this.view.centerY,this.view.width,this.view.height,!1,!1),this.resize()),n.noImage?(this.main.numImages++,this.bOpacity=1,this.opacity=1,this.isReady=!0,n.omniStartLayer>0&&this.setActiveLayer(n.omniStartLayer)):this.addImage(0,0,1,1,e,i,n.tileSize,n.isSingle,!1,s,0,0,0,1,0)}setParent(t){this.parent=t,this.index+=t.children.length}addImage(t,e,i,s,r,n,a,o,h,c,l,d,u,m,g){const p=new Ac(this,this.main.numImages++,this.images.length,r,n,a,o,h,this.main.numTiles,c,c,l,d,u,m,g);return p.setArea(t,e,i,s),this.images.push(p),this.main.numTiles=p.endOffset,1===this.images.length&&this.setActiveImage(0,0),p}addChild(e,i,s,r,n,a,o={}){const h=o.coverLimit??!0,c=o.coverStart??!0,l=new t(this.main,n,a,1,h,{tileSize:this.tileSize,is360:!1,noImage:!1,isSingle:!1,freeMove:!1,coverStart:c,maxScale:1,scaleMultiplier:1,camSpeed:this.camSpeed,rotationY:0,isGallerySwitch:!1,pagesHaveBackground:!1,isOmni:!1,pinchZoomOutLimit:this.pinchZoomOutLimit,omniNumLayers:1,omniStartLayer:0},!0);return l.setParent(this),l.setArea(e,i,s,r,!0,!0),this.children.push(l),l}stepOpacity(){const t=1/(0!==this.main.distanceX||0!==this.main.distanceY?this.main.spacesTransitionDuration:1===this.main.canvases.length?.25:this.main.crossfadeDuration)/this.main.frameTime,e=this.targetOpacity>0&&this.targetOpacity>=this.opacity;if(this.opacity=e?Math.min(1,this.opacity+t):Math.max(0,this.opacity-t),this.bOpacity=pc.get(this.opacity),0!==this.main.distanceX||0!==this.main.distanceY){const t=0===this.opacity?0:pc.get(1-this.opacity)*(e?1:-1);this.webgl.moveTo(this.main.distanceX*t*8,this.main.distanceY*t*8,this.main.direction,0)}}setCanvasVisible(t){this.main.setCanvasVisible(this,t),this.isVisible=t}fadeOut(){this.targetOpacity=0,this.zIndex=0}fadeIn(){if(this.isReady=!0,!this.hasParent&&1===this.currentArea.width&&1===this.currentArea.height)for(let t=0;t<this.main.canvases.length;t++)this.main.canvases[t]!==this&&this.main.canvases[t].fadeOut();this.targetOpacity=1}areaAnimating(){return!this.areaAniPaused&&this.areaAniPerc<1}isHidden(){return 0===this.targetOpacity&&0===this.opacity||0===this.currentArea.width||0===this.currentArea.height}shouldDraw(){if(!this.areaAnimating()&&this.isHidden())return void(this.isVisible&&this.setCanvasVisible(!1));!this.isVisible&&this.opacity>=1&&this.setCanvasVisible(!0);let t=this.ani.step(this.main.now)<1||this.kinetic.step(this.main.now)<1||!this.isReady;if(this.toDraw.length=0,this.partialView(!1)&&(t=!0),!this.is360&&(this.visible.width<=0||this.visible.height<=0))return;this.webgl.calculate3DFrustum(),this.isReady&&this.opacity!==this.targetOpacity&&(this.stepOpacity(),t=!0);const e=(this.is360?this.webgl.scale:this.camera.scale)*this.el.scale;for(let i=0;i<this.images.length;i++){const s=this.images[i];s.shouldRender()?(i>0&&!s.doRender&&this.main.setImageVisible(s,s.doRender=!0),s.isVideo&&s.isVideoPlaying&&(t=!0),s.opacityTick(this.isGallerySwitch||this.opacity<1)&&(t=!0),s.opacity>0&&(this.main.doneTotal+=s.getTiles(e))):s.doRender&&this.main.setImageVisible(s,s.doRender=!1)}this.main.toDrawTotal+=this.toDraw.length,this.main.progress=0===this.main.toDrawTotal?1:this.main.doneTotal/this.main.toDrawTotal,this.view.toArray();for(let i=0;i<this.children.length;i++)this.children[i].shouldDraw();t&&(this.main.animating=!0)}draw(){if(0===this.targetOpacity&&0===this.opacity)return;const t=this.ani.isStarted();if(this.main.setViewport(this.el.left,this.main.el.height-this.el.height-this.el.top,this.el.width,this.el.height),this.main.setMatrix(this.webgl.pMatrix.arr),this.pagesHaveBackground)for(let i=0;i<this.images.length;i++){const t=this.images[i];t.x1<=this.view.x0||t.x0>=this.view.x1||t.y1<=this.view.y0||t.y0>=this.view.y1||(this.setTile(t.endOffset-1),this.main.drawQuad(t.tOpacity))}const e=this.rect;for(let i=0;i<this.toDraw.length;i++){const s=this.toDraw[i];this.setTile(s);const r=e.layer===e.image.targetLayer-1||!this.main.bareBone&&e.layer===e.image.targetLayer,n=s===e.image.endOffset-1,a=this.main.getTileOpacity(s);(r||1===a||n)&&this.main.drawTile(e.image.index,s,e.layer,e.x,e.y,a*this.bOpacity*e.image.opacity,t,e.layer===e.image.targetLayer-1)&&n&&(e.image.gotBase=this.main.now,this.isReady||this.fadeIn())}this.childrenDirty&&(this.children.sort((t,e)=>t.zIndex>e.zIndex?1:t.zIndex<e.zIndex?-1:0),this.childrenDirty=!1);for(let i=0;i<this.children.length;i++)this.children[i].draw();this.view.changed&&this.main.viewSet(this),this.view.changed=!1}partialView(t){const e=this.main.el,i=this.hasParent,s=i?this.parent.getScale():1/e.ratio,r=i?this.parent.width:e.width,n=i?this.parent.height:e.height,a=i?this.parent.view:this.full,o=this.view,h=this.currentArea,c=this.area,l=this.targetArea,d=this.areaAnimating();if(d){const t=1/this.main.gridTransitionDuration/this.main.frameTime;this.areaAniPerc=Math.min(1,this.areaAniPerc+t);const e=this.main.gridTransitionTimingFunction.get(this.areaAniPerc),i=c.centerX+(l.centerX-c.centerX)*e,s=c.centerY+(l.centerY-c.centerY)*e,r=c.width+(l.width-c.width)*e,n=c.height+(l.height-c.height)*e;h.set(i,s,r,n),1===this.areaAniPerc&&(1===this.zIndex&&(this.zIndex=0),c.copy(l)),this.view.changed=!0}let u=Math.max(o.x0,o.x0+(a.x0-h.x0)/h.width*o.width),m=Math.min(o.x1,o.x0+(1-(h.x1-Math.min(h.x1,a.x1))/h.width)*o.width);this.is360||(u=Math.max(0,u),m=Math.min(1,m));let g=Math.max(Math.max(0,o.y0),o.y0+(a.y0-h.y0)/h.height*o.height),p=Math.min(Math.min(1,o.y1),o.y0+(1-(h.y1-Math.min(h.y1,a.y1))/h.height)*o.height);g=Math.max(g,0),p=Math.min(p,1);const f=(u+m)/2,v=(g+p)/2,w=m-u,y=p-g;this.visible.set(f,v,w,y);const b=i?1:e.ratio;return this.targetOpacity<this.opacity||!this.el.set(h.width*s*r,h.height*s*n,(h.x0-a.x0)*r*s,(h.y0-a.y0)*n*s,b,i?1:e.scale,!i&&e.isPortrait)||(t||this.sendViewport(),this.view.changed=!0,this.resize(),this.camera.setCanvas(),this.webgl.update()),d}setArea(t,e,i,s,r,n){this.areaAniPaused=!1,r?(this.area.setArea(t,e,i,s),this.currentArea.setArea(t,e,i,s)):(this.area.copy(this.currentArea),this.areaAniPerc=0,0===this.zIndex&&(this.zIndex=1),this.ani.limit=!1),this.targetArea.setArea(t,e,i,s),this.partialView(n)}setTile(t){const e=this.rect;if(this.findTileRect(t),this.is360)0===e.image.localIdx?this.webgl.setTile360(e.x0,e.y0,e.x1-e.x0,e.y1-e.y0):e.image.setDrawRect(e);else{const t=this.main.vertexBuffer,i=this.aspect;t[0]=t[3]=t[9]=(e.x0-.5)*i,t[1]=t[7]=t[16]=.5-e.y0,t[4]=t[10]=t[13]=.5-e.y1,t[6]=t[12]=t[15]=(e.x1-.5)*i,t[2]=t[5]=t[8]=t[11]=t[14]=t[17]=0}}sendViewport(){const t=this.main.el;this.main.viewportSet(this,this.el.left/t.ratio,this.el.top/t.ratio,this.el.width/t.ratio,this.el.height/t.ratio)}findTileRect(t){let e=0;for(;t>=this.images[e].endOffset;)e++;const i=this.images[e];let s=0;for(;t>=i.layers[s].end;)s++;i.layers[s].getTileRect(t,this.rect)}resize(){if(this.children.length){const t=this.main.el;this.width=t.width,this.height=t.height}this.hasParent||(this.is360?this.webgl.resize():(this.camera.setCanvas(),this.webgl.update()))}reset(){if(this.kinetic.stop(),this.ani.stop(),this.images.length>0){const t=this.images[0];t.gotBase=0,t.opacity=0}}remove(){this.setCanvasVisible(!1),this.main.remove(this)}replace(){this.main.canvases.push(this)}setActiveLayer(t){this.layer=t,this.setActiveImage(this.activeImageIdx,0),this.view.changed=!0}setActiveImage(t,e){const i=this.layer*(this.images.length/this.omniNumLayers);for(let s=0;s<this.images.length;s++){const r=this.images[s],n=s-i-t;0!==n?r.tOpacity=n>=0&&n<=e?1:0:(r.tOpacity=1,this.activeImageIdx=t,this.view.changed=!0)}this.camera.correctMinMax()}setFocus(t,e,i,s,r){const n=(t+i)/2,a=(e+s)/2,o=i-t,h=s-e;if(!this.focus.equals(n,a,o,h)){this.activeImageIdx=-1;for(let r=0;r<this.images.length;r++){const n=this.images[r];n.x1<=t||n.x0>=i||n.y1<=e||n.y0>=s?n.tOpacity=0:(n.tOpacity=1,this.activeImageIdx=r)}this.focus.set(n,a,o,h),this.camera.correctMinMax(),r||(this.camera.setView(),this.webgl.update())}}getCoo(t,e,i,s){return(this.is360?this.webgl.getCoo(t,e):this.camera.getCoo(t,e,i,s)).toArray()}getXY(t,e,i,s,r){return(this.is360?this.webgl.getXYZ(t,e):isNaN(s)?this.camera.getXY(t,e,i):this.camera.getXYOmni(t,e,s,isNaN(r)?0:r,i)).toArray()}getView(){return this.view.arr}setView(t,e,i,s,r,n,a=!1,o=!1){const h=this.main.el;h.areaHeight>0&&(s+=s/(1-h.areaHeight/h.height),this.ani.limit=!1,h.areaHeight=0),h.areaWidth>0&&(i+=i*(h.areaWidth/h.width),this.ani.limit=!1,h.areaWidth=0),r&&(this.ani.limit=!1),this.view.set(t,e,i,s),o&&!r&&this.view.limit(!1,!1,this.freeMove),n||this.ani.lastView.copy(this.view),this.width>0&&(this.is360?(this.webgl.setView(t,e,i,s,r,a),this.view.set(t,e,i,s)):this.camera.setView()&&this.webgl.update())}getScale(){return this.is360?this.webgl.scale:this.camera.scale}isZoomedIn(){return this.is360?this.webgl.perspective<=this.webgl.minPerspective:this.camera.isZoomedIn()}isZoomedOut(t=!1){return this.is360?this.webgl.perspective>=this.webgl.maxPerspective:this.camera.isZoomedOut(t)}setDirection(t,e,i){isNaN(e)&&(e=this.webgl.pitch),this.webgl.setDirection(t,e,i?this.webgl.defaultPerspective:0)}getMatrix(t,e,i,s,r,n,a,o,h=1,c=1,l=!1){const d=2e4/this.width;return this.webgl.getMatrix(t,e,i*d,s,r,n,a,o,h,c,l).toArray()}aniPause(t){this.areaAniPaused=!0,this.ani.pause(t)}aniResume(t){this.areaAniPaused=!1,this.ani.resume(t)}aniStop(){this.ani.stop();for(let t=0;t<this.children.length;t++)this.children[t].aniStop()}aniDone(){this.main.aniDone(this)}aniAbort(){this.main.aniAbort(this)}},$c=class{constructor(t){this.el=new Tc,this.vertexBuffer=new Float32Array(18),this.vertexBuffer360=new Float32Array(4608),this.canvases=[],this.numTiles=0,this.numImages=0,this.now=0,this.animating=!1,this.progress=0,this.toDrawTotal=0,this.doneTotal=0,this.crossfadeDuration=.25,this.gridTransitionDuration=.5,this.gridTransitionTimingFunction=pc,this.spacesTransitionDuration=.5,this.embedFadeDuration=.5,this.dragElasticity=1,this.hasArchive=!1,this.archiveLayerOffset=0,this.underzoomLevels=4,this.skipBaseLevels=0,this.bareBone=!1,this.isSwipe=!1,this.noPinchPan=!1,this.direction=0,this.distanceX=0,this.distanceY=0,this.frameTime=1/60,this._host=t}get drawTile(){return this._host.drawTile}get drawQuad(){return this._host.drawQuad}get getTileOpacity(){return this._host.getTileOpacity}get setTileOpacity(){return this._host.setTileOpacity}get setMatrix(){return this._host.setMatrix}get setViewport(){return this._host.setViewport}get aniDone(){return this._host.aniDone}get aniAbort(){return this._host.aniAbort}get viewSet(){return this._host.viewSet}get viewportSet(){return this._host.viewportSet}get setCanvasVisible(){return this._host.setCanvasVisible}get setImageVisible(){return this._host.setImageVisible}shouldDraw(t){this.frameTime=1e3/Math.min(33,t-this.now),this.now=t,this.doneTotal=0,this.toDrawTotal=0,this.animating=!1;for(let e=0;e<this.canvases.length;e++)this.canvases[e].shouldDraw();return this.animating||this.progress<1}draw(){for(let t=0;t<this.canvases.length;t++)this.canvases[t].draw()}reset(){for(let t=0;t<this.canvases.length;t++)this.canvases[t].reset()}aniStop(){for(let t=0;t<this.canvases.length;t++)this.canvases[t].aniStop()}resize(t,e,i,s,r,n,a){this.el.set(t,e,i,s,r,n,a);for(let o=0;o<this.canvases.length;o++)this.canvases[o].resize()}remove(t){for(let e=0;e<this.canvases.length;e++)if(this.canvases[e]===t)return void this.canvases.splice(e,1)}},Cc=class t{static{this._textureBuffer=t.getTextureBuffer(1,1)}getCanvas(t){return this.canvasById.get(t.ptr)?.canvas}setEntry(t,e){this.canvasById.set(t,e),this.canvasToEntry.has(e.canvas)||this.canvasToEntry.set(e.canvas,e)}constructor(t){this.micrio=t,this.ready=!1,this.images=[],this.bareBone=!1,this.baseTiles=[],this.drawnSet=new Set,this.prevDrawnSet=new Set,this.tiles=new Map,this.requests=new Map,this.unsubscribe=[],this.cameras=new Map,this.ptrToImage=new Map,this.engImageToMicrio=new Map,this.preventDirectionSet=!1,this.isGallery=!1,this.now=-1,this.raf=-1,this.drawing=!1,this.activeCanvasEntry=null,this.canvasById=new Map,this.canvasToEntry=new Map,this.nextPtr=1,this.addImage=async(t,e,i=!1,s=1)=>en(t.info).then(r=>{if(!r)return;this.images.push(t);const n=t.opts.area??[0,0,1,1],a=t.$settings._360??{},o=this.canvasById.get(e.ptr);if(!o)return;let h;if(i){const e=o.canvas.addImage(n[0],n[1],n[2],n[3],r.width,r.height,r.tileSize||1024,r.isSingle??!1,r.isVideo??!1,s,a.rotX??0,a.rotY??0,a.rotZ??0,a.scale??1,0);this.engImageToMicrio.set(e,t);const i=this.nextPtr++;return t.ptr=i,this.setEntry(i,{canvas:o.canvas,micrioImage:t}),this.ptrToImage.set(i,t),t.baseTileIdx=this.engine.numTiles-1,this.getTileEntry(t.baseTileIdx).opacity=1,void this.baseTiles.push(t.baseTileIdx)}{const e=!(!t.$settings.gallery?.archive&&!t.$settings.gallery?.type);h=o.canvas.addChild(n[0],n[1],n[2],n[3],r.width,r.height,e?{coverLimit:!1,coverStart:!1}:{})}const c=this.nextPtr++;if(t.ptr=c,this.setEntry(c,{canvas:h,micrioImage:t}),this.ptrToImage.set(c,t),!i){this.bindCamera(t),t.$settings.focus&&h.camera.setCoo(t.$settings.focus[0],t.$settings.focus[1],0,0,0,!1,0,performance.now());const e=t.$info.view;e&&"0,0,1,1"!=e.toString()&&h.setView(e[0],e[1],e[2],e[3],!1,!1,!1,!1),h.sendViewport()}t.baseTileIdx=this.engine.numTiles-1,this.getTileEntry(t.baseTileIdx).opacity=1,this.baseTiles.push(t.baseTileIdx)}),this.addChild=(t,e)=>this.addImage(t,e),this.deleteAfterSeconds=Jr.iOS?5:wt(this.micrio.canvas.isMobile)?30:90,this.render=this.render.bind(this),this.draw=this.draw.bind(this),this.unsubscribe.push(t.current.subscribe(this.setCanvas.bind(this)))}static getTextureBuffer(t,e){const i=new Float32Array(12*t*e),s=1/t,r=1/e;for(let n=0,a=0;a<e;a++)for(let e=0;e<t;e++,n+=12)i[n+3]=i[n+7]=i[n+9]=(i[n+1]=i[n+5]=i[n+11]=a*r)+r,i[n+4]=i[n+8]=i[n+10]=(i[n+0]=i[n+2]=i[n+6]=e*s)+s;return i}async load(){if(this.engine)return;const e=new $c({drawTile:this.drawTile.bind(this),drawQuad:this._hostDrawQuad.bind(this),getTileOpacity:this._hostGetTileOpacity.bind(this),setTileOpacity:this._hostSetTileOpacity.bind(this),setMatrix:this._hostSetMatrix.bind(this),setViewport:this._hostSetViewport.bind(this),aniDone:this._hostAniDone.bind(this),aniAbort:this._hostAniAbort.bind(this),viewSet:this._hostViewSet.bind(this),viewportSet:this._hostViewportSet.bind(this),setCanvasVisible:this._hostSetCanvasVisible.bind(this),setImageVisible:this._hostSetImageVisible.bind(this)});this._vertexBuffer=e.vertexBuffer,this._vertexBuffer360=e.vertexBuffer360,t._textureBuffer360=t.getTextureBuffer(16,16),this.engine=e,this.unsubscribe.push(this.micrio.barebone.subscribe(t=>{this.bareBone=t,this.engine.bareBone=t}))}findCamera(t){const e=this.canvasToEntry.get(t);return e?this.cameras.get(e.micrioImage.ptr):void 0}findEntry(t){if(t instanceof Pc)return this.canvasToEntry.get(t)}_hostDrawQuad(t){this.micrio.webgl.drawTile(void 0,t)}_hostGetTileOpacity(t){return this.tiles.get(t)?.opacity||0}_hostSetTileOpacity(t,e=!1,i=1){const s=this.tiles.get(t);return s?(s.opacity<1&&(s.opacity=e?1:s.loadedAt&&s.loadedAt>0?Math.min(1,(this.now-s.loadedAt)/250)*i:0),s.opacity):0}_hostSetMatrix(t){this.micrio.webgl.gl.uniformMatrix4fv(this.micrio.webgl.pmLoc,!1,t)}_hostSetViewport(t,e,i,s){this.micrio.webgl.gl.viewport(Math.floor(t),Math.floor(e),Math.ceil(i),Math.ceil(s))}_hostAniDone(t){const e=this.findCamera(t);if(e){for(e.aniDone&&e.aniDone();e.aniDoneAdd.length;)e.aniDoneAdd.shift()?.();e.aniAbort=e.aniDone=void 0}}_hostAniAbort(t){const e=this.findCamera(t);e&&(e.aniAbort&&e.aniAbort(),e.aniDoneAdd.length=0,e.aniAbort=e.aniDone=void 0)}_hostViewSet(t){this.findCamera(t)?.viewChanged()}_hostViewportSet(t,e,i,s,r){const n=this.findEntry(t);n&&"viewport"in n.micrioImage&&n.micrioImage.viewport.set([e,i,s,r])}_hostSetCanvasVisible(t,e){this.findEntry(t)?.micrioImage?.visible?.set(e)}_hostSetImageVisible(t,e){const i=this.engImageToMicrio.get(t);i&&"visible"in i&&i.visible.set(e)}unbind(){for(this.stop();this.unsubscribe.length;)this.unsubscribe.shift()?.();this.requests.forEach(t=>ac(t)),this.requests.clear();for(const[t,e]of this.tiles.entries())e.timeoutId&&clearTimeout(e.timeoutId),this.deleteTile(t);this.tiles.clear(),this.engine&&this.engine.reset()}addCanvas(t){const e=t.$info;if(!e)return;if(t.error)return void this.micrio.loading.set(!1);if(!(t.noImage||e.width&&e.height))throw"Invalid Micrio image size";const i=t.$settings;this.isGallery=!!e.gallery||t.isOmni,i.gallery?.archive&&(this.engine.hasArchive=!0,this.engine.archiveLayerOffset=i.gallery.archiveLayerOffset??0),e.version&&parseFloat(e.version)<=3.1&&(this.engine.underzoomLevels=8),e.is360&&(i.limitToCoverScale=!1);const s=!!i.limitToCoverScale,r=s||"cover"==i.initType;t.noImage&&this.micrio.loading.set(!1);const n=[.5,.5],a=i.focus,o=!!e.spacesId;a&&(isNaN(a[0])||null===a[0]||(n[0]=a[0]),isNaN(a[1])||null===a[1]||(n[1]=a[1]));const h=i._360?.video,c=e.is360&&h&&(h.src||"video"in h&&h.video),l=!!this.isGallery&&("switch"==i.gallery?.type||"omni"==i.gallery?.type||"swipe-full"==i.gallery?.type),d=i.omni?.layers?.length??1;i.omni&&(i.omni.layerStartIndex=Math.min(d-1,i.omni?.layerStartIndex??0));const u=new Pc(this.engine,e.width,e.height,t.opacity,s,{tileSize:e.tileSize??1024,is360:e.is360??!1,noImage:t.noImage,isSingle:!(!e.isSingle&&!c),freeMove:i.freeMove??!1,coverStart:r,maxScale:i.zoomLimit||1,scaleMultiplier:!1!==i.zoomLimitDPRFix?this.micrio.canvas.getRatio(t.$settings):1,camSpeed:i.camspeed??1,rotationY:t.camera.rotationY,isGallerySwitch:l,pagesHaveBackground:!!i.gallery?.isSpreads&&"swipe"==i.gallery.type,isOmni:t.isOmni,pinchZoomOutLimit:i.pinchZoomOutLimit??!1,omniNumLayers:d,omniStartLayer:i.omni?.layerStartIndex??0},!1),m=this.nextPtr++;t.ptr=m,this.setEntry(m,{canvas:u,micrioImage:t}),this.images.push(t),this.ptrToImage.set(t.ptr,t),this.cameras.set(t.ptr,t.camera),this.bindCamera(t),t.opts.area&&t.camera.setArea(t.opts.area,{direct:!0,noDispatch:!0,noRender:!0}),i?.restrict&&t.camera.setLimit(i.restrict),i?.crossfadeDuration&&this.setCrossfadeDuration(i.crossfadeDuration),i?.embedFadeDuration&&(this.engine.embedFadeDuration=i.embedFadeDuration),void 0!==i?.dragElasticity&&(this.engine.dragElasticity=i.dragElasticity),i?.skipBaseLevels&&(this.engine.skipBaseLevels=i.skipBaseLevels),i?.omni&&t.camera.setOmniSettings(),this.micrio.hasAttribute("data-limited")&&this.setLimited(t.ptr,!0),u.sendViewport();const g=this.engine.numTiles;if(g>0){const t=g-1;this.getTileEntry(t).opacity=1,this.baseTiles.push(t)}const p=wt(t.state.view)||i.view;!p||0==p[0]&&0==p[1]&&1==p[2]&&1==p[3]?!o&&e.is360||!n||"0.5,0.5"==n.toString()||(u.camera.setCoo(n[0],n[1],0,0,0,!1,0,performance.now()),i.focus=void 0):u.setView(p[0]+p[2]/2,p[1]+p[3]/2,p[2],p[3],!1,!1,!1,!1),t.video.subscribe(t=>t&&t.addEventListener("play",this.render)),t.noImage&&t.visible.set(!0),this.setCanvas(t)}bindCamera(t){const e=this.canvasById.get(t.ptr).canvas;this.cameras.set(t.ptr,t.camera),t.camera.bindEngineCanvas(e),e.is360?t.camera.assign(e.view.arr,e.webgl.coo.arr,e.webgl.coo.arr,e.webgl.iMatrix.arr):t.camera.assign(e.view.arr,e.camera.xy.arr,e.camera.coo.arr,e.webgl.pMatrix.arr)}setCanvas(t){if(t&&!(t.ptr>0&&t.ptr===this.activeCanvasEntry?.micrioImage.ptr))if(t.ptr<0)en(t.info).then(e=>{e&&this.micrio.$current&&(e.isIIIF||t.opts.secondaryTo||e.id==this.micrio.$current.id)&&(this.addCanvas(t),t.embeds.length&&t.embeds.forEach(e=>this.addEmbed(e,t)))});else if(t.ptr!==this.activeCanvasEntry?.micrioImage.ptr){const e=this.canvasById.get(t.ptr);if(!e)return;const i=t.is360&&this.activeCanvasEntry?this.activeCanvasEntry.canvas.webgl.pitch:0;if(this.activeCanvasEntry=e,t.is360&&!this.preventDirectionSet){const s=(this.engine.direction+.5)%1*Math.PI*2;e.canvas.setDirection(s-t.camera.rotationY,i,!0)}0===e.canvas.targetOpacity&&e.canvas.fadeIn(),t.$settings.omni?.layerStartIndex&&t.state.layer.set(t.$settings.omni.layerStartIndex),this.preventDirectionSet=!1,this.ready=!0,this.render()}}removeCanvas(t){if(t.ptr<0)throw"Canvas is not placed yet";const e=this.canvasById.get(t.ptr);e&&(e.canvas.remove(),this.canvasById.delete(t.ptr),this.render())}render(){this.raf<0&&(this.raf=this.micrio.webgl.display.requestAnimationFrame(this.draw))}draw(t=performance.now()){this.micrio.isConnected&&this.micrio.$current&&(this.raf=-1,this.drawing=!1,this.now=t,(this.engine.shouldDraw(t)||this.micrio.keepRendering||this.micrio.events.isNavigating||!1===this.micrio._current?._video?.paused)&&this.render(),this.isGallery&&this.drawStart(),this.drawnSet.clear(),this.engine.draw(),this.micrio.events.dispatch("draw"),this.cleanup(),this.micrio.webgl.drawEnd())}stop(){this.raf<0||(this.micrio.webgl.display.cancelAnimationFrame(this.raf),this.raf=-1)}getTileEntry(t){let e=this.tiles.get(t);return e||(e={loadState:0,opacity:0},this.tiles.set(t,e)),e}drawTile(t,e,i,s,r,n,a,o){this.drawnSet.add(e);const h=this.getTileEntry(e);h.deleteAt=void 0;const c=nc(),l=this.images[t],d="camera"in l&&l.isVideo,u="camera"in l&&l.is360,m="camera"in l?l:l.image,g="frame"in l?l.frame:void 0;if(0===h.loadState&&c<Jh){if(this.bareBone?c>2&&a:o&&a&&c>0)return!1;if(d&&!u)h.loadState=2,h.texture=this.micrio.webgl.getTexture();else{h.loadState=1;const t=m.getTileSrc(i,s,r,g);if(!t)return h.loadState=0,!1;this.getTexture(e,t,a,{noSmoothing:"$info"in l&&l.$settings.noSmoothing})}}else if(h.loadState>=2){if(this.drawing||this.drawStart(),h.texture){if(d){if(!m._video||!m._video.dataset.playing)return!1;this.micrio.webgl.updateTexture(h.texture,m._video)}this.micrio.webgl.drawTile(h.texture,n,u)}return 2===h.loadState&&(h.loadState=3,h.loadedAt=this.now),!0}return!1}drawStart(){this.drawing||(this.micrio.webgl.drawStart(),this.drawing=!0)}getTexture(t,e,i,s={}){if(this.tiles.get(t)?.texture||this.requests.has(t)||!s.force&&nc()>=Jh)return;const r=Ah.db.has(e);r||this.micrio.loading.set(!0),this.requests.set(t,e),(r?Ah.getImage(e):sc(e)).then(e=>this.gotTexture(t,e,i,s.noSmoothing)).catch(()=>this.deleteRequest(t))}gotTexture(t,e,i,s){const r=this.getTileEntry(t);r.texture=this.micrio.webgl.getTexture(e,r.texture,s),void 0!==self.ImageBitmap&&e instanceof ImageBitmap&&e.close instanceof Function&&e.close(),r.loadState=2,r.timeoutId=setTimeout(()=>{this.deleteRequest(t)},i?150:50)}deleteRequest(t){this.requests.delete(t);const e=this.tiles.get(t);e?.timeoutId&&(clearTimeout(e.timeoutId),e.timeoutId=void 0),this.requests.size||this.micrio.loading.set(!1)}deleteTile(t){const e=this.tiles.get(t);e&&(e.texture&&this.micrio.webgl.gl.deleteTexture(e.texture),e.timeoutId&&clearTimeout(e.timeoutId),this.tiles.delete(t))}cleanup(){const t=performance.now();for(const e of this.prevDrawnSet){if(this.drawnSet.has(e))continue;if(this.baseTiles.includes(e))continue;const i=this.tiles.get(e);if(i&&0!==i.loadState)switch(i.opacity=0,i.loadState){case 1:const s=this.requests.get(e);s&&ac(s),i.loadState=0;break;case 2:this.requests.has(e)&&this.deleteRequest(e),this.deleteTile(e);break;case 3:i.deleteAt||(i.deleteAt=t)}}this.prevDrawnSet=new Set(this.drawnSet);for(const[e,i]of this.tiles.entries())i.deleteAt&&(t-i.deleteAt)/1e3>this.deleteAfterSeconds&&this.deleteTile(e)}resize(t){this.engine.resize(t.width,t.height,t.left,t.top,t.ratio,t.scale,t.portrait),this.ready&&(this.stop(),this.draw())}addEmbed(t,e,i={}){if("camera"in t&&i.asImage)return this.addImage(t,e,!0,i.opacity??1);{const s="$info"in t?t.$info:e.$info;if(!s)return;this.images.push(t);const r=t.opts.area??[0,0,1,1],n=t instanceof Ph?t.$settings._360??{}:{},a=this.canvasById.get(e.ptr);if(!a)return;const o=a.canvas.addImage(r[0],r[1],r[2],r[3],s.width,s.height,s.tileSize||1024,s.isSingle??!1,s.isVideo??!1,i.opacity??1,n.rotX??0,n.rotY??0,n.rotZ??0,n.scale??1,i.fromScale??0);this.engImageToMicrio.set(o,t);const h=this.nextPtr++;t.ptr=h,this.setEntry(h,{canvas:a.canvas,micrioImage:t}),this.ptrToImage.set(h,t),t.baseTileIdx=this.engine.numTiles-1,this.getTileEntry(t.baseTileIdx).opacity=1,this.baseTiles.push(t.baseTileIdx)}}setActiveImage(t,e,i){this.getCanvas(this.ptrToImage.get(t))?.setActiveImage(e,i??0)}setActiveLayer(t,e){this.getCanvas(this.ptrToImage.get(t))?.setActiveLayer(e)}fadeImage(t,e,i=!1){const s=this.getCanvas(this.ptrToImage.get(t));if(s){if(this.cameras.has(t))s.targetOpacity=e;else{const t=s.images;for(let s=0;s<t.length;s++){const r=t[s];r.localIdx>0&&(r.tOpacity=e,i&&(r.opacity=e))}}this.render()}}setFocus(t,e,i=!1){this.getCanvas(this.ptrToImage.get(t))?.setFocus(e[0],e[1],e[2],e[3],i)}setZIndex(t,e){const i=this.getCanvas(this.ptrToImage.get(t));i&&(i.zIndex=e)}setGridTransitionDuration(t){this.engine.gridTransitionDuration=t}setGridTransitionTimingFunction(t){this.engine.gridTransitionTimingFunction=0===t?pc:1===t?fc:2===t?vc:3===t?wc:pc}setCrossfadeDuration(t){this.engine.crossfadeDuration=t}fadeTo(t,e,i){const s=this.getCanvas(this.ptrToImage.get(t));s&&(s.targetOpacity=e,i&&(s.opacity=e))}fadeIn(t){this.getCanvas(this.ptrToImage.get(t))?.fadeIn()}fadeOut(t){this.getCanvas(this.ptrToImage.get(t))?.fadeOut()}areaAnimating(t){return this.getCanvas(this.ptrToImage.get(t))?.areaAnimating()??!1}getActiveImageIdx(t){return this.getCanvas(this.ptrToImage.get(t))?.activeImageIdx??-1}setNoPinchPan(t){this.engine.noPinchPan=t}setIsSwipe(t){this.engine.isSwipe=t}ease(t){return pc.get(t)}panStart(t){this.getCanvas(this.ptrToImage.get(t))?.kinetic.stop()}panStop(t){this.getCanvas(this.ptrToImage.get(t))?.kinetic.start()}pinchStart(t){this.getCanvas(this.ptrToImage.get(t))?.camera.pinchStart()}pinch(t,e,i,s,r){this.getCanvas(this.ptrToImage.get(t))?.camera.pinch(e,i,s,r)}pinchStop(t,e){this.getCanvas(this.ptrToImage.get(t))?.camera.pinchStop(e)}setLimited(t,e){const i=this.getCanvas(this.ptrToImage.get(t));i&&(i.limited=e)}set360Orientation(t,e,i){this.engine.direction=t,this.engine.distanceX=e,this.engine.distanceY=i}setCanvasArea(t,e){this.engine.el.areaWidth=t,this.engine.el.areaHeight=e}setImageVideoPlaying(t,e){const i=this.getCanvas(this.ptrToImage.get(t));if(!i)return;const s=i.images;for(let r=0;r<s.length;r++)if(s[r].isVideo){s[r].isVideoPlaying=e;break}}},Dc=new Float32Array([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]),zc=class{constructor(t,e,i){if(this.gl=t,this.program=t.createProgram(),e.webgl.getShader(this.program,t.VERTEX_SHADER,"\nattribute vec2 a_position; // Vertex position (-1 to 1)\nattribute vec2 a_texCoord; // Texture coordinate (0 to 1)\n\nvarying vec2 v_texCoord; // Pass texCoord to fragment shader\n\nvoid main() {\n\tv_texCoord = a_texCoord; // Pass through texture coordinate\n\tgl_Position = vec4(a_position, 0.0, 1.0); // Set clip space position\n}"),e.webgl.getShader(this.program,t.FRAGMENT_SHADER,i),t.linkProgram(this.program),t.getProgramParameter(this.program,t.LINK_STATUS)||console.error("Postprocess shader link error:",t.getProgramInfoLog(this.program)),t.useProgram(this.program),this.ppPositionLoc=t.getAttribLocation(this.program,"a_position"),this.ppTexCoordLoc=t.getAttribLocation(this.program,"a_texCoord"),this.ppTimeLoc=t.getUniformLocation(this.program,"u_time"),this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.gl.drawingBufferWidth,this.gl.drawingBufferHeight,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this.frameBuffer=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,this.frameBuffer),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.texture,0),t.checkFramebufferStatus(t.FRAMEBUFFER)!==t.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer not complete");t.bindFramebuffer(t.FRAMEBUFFER,null),this.quad=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.quad),t.bufferData(t.ARRAY_BUFFER,Dc,t.STATIC_DRAW)}render(){const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,null),t.useProgram(this.program),t.bindBuffer(t.ARRAY_BUFFER,this.quad),t.enableVertexAttribArray(this.ppPositionLoc),t.vertexAttribPointer(this.ppPositionLoc,2,t.FLOAT,!1,4*Float32Array.BYTES_PER_ELEMENT,0),t.enableVertexAttribArray(this.ppTexCoordLoc),t.vertexAttribPointer(this.ppTexCoordLoc,2,t.FLOAT,!1,4*Float32Array.BYTES_PER_ELEMENT,2*Float32Array.BYTES_PER_ELEMENT),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.texture),t.uniform1f(this.ppTimeLoc,performance.now()/1e3),t.drawArrays(t.TRIANGLE_STRIP,0,4)}resize(){const t=this.gl;t.bindTexture(t.TEXTURE_2D,this.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.gl.drawingBufferWidth,this.gl.drawingBufferHeight,0,t.RGBA,t.UNSIGNED_BYTE,null),t.bindTexture(t.TEXTURE_2D,null)}dispose(){const t=this.gl;t.deleteFramebuffer(this.frameBuffer),t.deleteTexture(this.texture),t.deleteBuffer(this.quad),t.deleteProgram(this.program)}},Oc=Jr.firefox,Rc=`\nprecision mediump float; // Use medium precision for fragment calculations\n\nvarying highp vec2 vTextureCoord; // Received texture coordinate from vertex shader\n\nuniform sampler2D uSampler; // The tile texture\nuniform float opacity; // Tile opacity (for fading)\nuniform int noTexture; // Flag indicating if texture is missing/not loaded\n\nvoid main() {\n\tif(noTexture==1) { // If texture is missing\n\t\tgl_FragColor = vec4(.1,.1,.1,.1); // Draw a placeholder color (dark semi-transparent gray)\n\t} else {\n\t${Oc?"\n\t\t// Firefox premultiplied alpha workaround\n\t\tvec4 textureColor = texture2D(uSampler, vTextureCoord);\n\t\t// Manually apply opacity to RGB based on new alpha\n\t\tfloat newAlpha = min(1., textureColor.a * opacity);\n\t\tgl_FragColor = vec4(textureColor.rgb * newAlpha, newAlpha);":"\n\t\t// Standard alpha blending (premultiplied alpha assumed in blendFunc)\n\t\tgl_FragColor = texture2D(uSampler, vTextureCoord) * opacity;"}\n\t\t// Debug: Draw red instead of texture\n\t\t//gl_FragColor = vec4(1.,0.,0.,1.);\n\t}\n}`,Xc=256,Fc=class{constructor(t){this.micrio=t,this.display=self,this.txtAttr=-1,this.wmTexture=null,this.wmUrl=null,this.wmVerts=new Float32Array([-1,-1,0,1,-1,0,-1,1,0,-1,1,0,1,-1,0,1,1,0]),this.wmUvs=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0]),this.wmMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.wmOpacity=.075,this.posAttr=-1,this.was360=!1}init(){const t="WebGL2RenderingContext"in window,e=this.micrio.canvas.element.getContext(t?"webgl2":"webgl",{alpha:!0,preserveDrawingBuffer:this.micrio.hasAttribute("data-preserve-drawing-buffer"),stencil:!1,antialias:!1,depth:!1,desynchronized:!1});if(t?!(e instanceof window.WebGL2RenderingContext):!(e instanceof window.WebGLRenderingContext))throw new Nr("WebGL context creation failed",{code:Ir,displayMessage:"Your browser does not support WebGL, which is required to view this content. Please try a different browser."});this.gl=e;const i=this.micrio.$current?.$settings.postProcessingFragmentShader;i&&(this.postpocessor=new zc(e,this.micrio,i),this.micrio.keepRendering=!0);const s=e.createProgram();if(!(s instanceof WebGLProgram))throw new Nr("Failed to create WebGL program",{code:Lr,displayMessage:"There was a problem initializing the graphics. Please try refreshing the page."});this.program=s,this.getShader(this.program,e.VERTEX_SHADER,"\nuniform mat4 GLMatrix; // Combined ModelViewProjection matrix from Engine\n\nattribute vec3 pos; // Vertex position (from Engine buffer)\nattribute vec2 aTextureCoord; // Texture coordinate (from static buffer)\n\nvarying highp vec2 vTextureCoord; // Pass texture coordinate to fragment shader\n\nvoid main()\n{\n\tgl_Position = GLMatrix * vec4(pos, 1.0); // Calculate clip space position\n\tvTextureCoord = aTextureCoord; // Pass through texture coordinate\n}"),this.getShader(this.program,e.FRAGMENT_SHADER,Rc),e.linkProgram(this.program),e.getProgramParameter(this.program,e.LINK_STATUS)||console.error("Main shader link error:",e.getProgramInfoLog(this.program)),e.useProgram(this.program),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.enable(e.BLEND),e.disable(e.DEPTH_TEST),e.clearColor(0,0,0,0);const r=e.getUniformLocation(this.program,"opacity");if(!r)throw new Nr("Failed to bind WebGL opacity uniform",{code:Lr});this.opaLoc=r;const n=e.getUniformLocation(this.program,"GLMatrix");if(!n)throw new Nr("Failed to bind WebGL matrix uniform",{code:Lr});this.pmLoc=n;const a=e.getUniformLocation(this.program,"noTexture");if(!a)throw new Nr("Failed to bind WebGL texture uniform",{code:Lr});this.noTxtLoc=a,this.txtAttr=e.getAttribLocation(this.program,"aTextureCoord");const o=e.createBuffer();if(!o)throw new Nr("Failed to create WebGL texture buffer",{code:Pr,displayMessage:"Your device is low on memory. Try closing other browser tabs or applications."});this.txtBuffer=o,e.bindBuffer(e.ARRAY_BUFFER,this.txtBuffer),e.bufferData(e.ARRAY_BUFFER,Cc._textureBuffer,e.STATIC_DRAW);const h=e.createBuffer();if(!h)throw new Nr("Failed to create WebGL watermark buffer",{code:Pr,displayMessage:"Your device is low on memory. Try closing other browser tabs or applications."});this.wmTxtBuffer=h;const c=e.createBuffer();if(!c)throw new Nr("Failed to create WebGL geometry buffer",{code:Pr,displayMessage:"Your device is low on memory. Try closing other browser tabs or applications."});this.geomBuffer=c,this.posAttr=e.getAttribLocation(this.program,"pos"),this.linkBuffers(),e.viewport(0,0,this.gl.drawingBufferWidth,this.gl.drawingBufferHeight)}linkBuffers(){const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,this.geomBuffer),t.bufferData(t.ARRAY_BUFFER,this.micrio.engine._vertexBuffer,t.DYNAMIC_DRAW),t.enableVertexAttribArray(this.txtAttr),t.bindBuffer(t.ARRAY_BUFFER,this.txtBuffer),t.vertexAttribPointer(this.txtAttr,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(this.posAttr),t.bindBuffer(t.ARRAY_BUFFER,this.geomBuffer),t.vertexAttribPointer(this.posAttr,3,t.FLOAT,!1,0,0)}dispose(t=!1){const e=this.gl;if(e){if(e.bindBuffer(e.ARRAY_BUFFER,null),e.bindTexture(e.TEXTURE_2D,null),e.deleteBuffer(this.txtBuffer),e.deleteBuffer(this.geomBuffer),e.deleteBuffer(this.wmTxtBuffer),e.deleteProgram(this.program),this.postpocessor?.dispose(),this.wmTexture&&e.deleteTexture(this.wmTexture),t){const t=e.getExtension("WEBGL_lose_context");t instanceof Object&&t.loseContext instanceof Function&&t.loseContext()}this.gl=null}}getShader(t,e,i){const s=this.gl.createShader(e);if(!s)throw new Error(`Could not create WebGL shader (type: ${e})`);if(this.gl.shaderSource(s,i),this.gl.compileShader(s),!this.gl.getShaderParameter(s,this.gl.COMPILE_STATUS))throw console.error("Error compiling shader",this.gl.getShaderInfoLog(s)),this.gl.deleteProgram(t),new Error(`Shader compilation failed: ${this.gl.getShaderInfoLog(s)}`);this.gl.attachShader(t,s),this.gl.deleteShader(s)}getTexture(t,e,i){const s=this.gl,r=e??s.createTexture();if(!r)throw new Error("Could not create WebGL texture");return s.bindTexture(s.TEXTURE_2D,r),t&&s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,t),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,i?s.NEAREST:s.LINEAR),r}updateTexture(t,e){const i=this.gl;i.bindTexture(i.TEXTURE_2D,t),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e),i.bindTexture(i.TEXTURE_2D,null)}drawStart(){const t=this.gl;this.postpocessor&&t.bindFramebuffer(t.FRAMEBUFFER,this.postpocessor.frameBuffer),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}drawEnd(){this.postpocessor&&(this.postpocessor.render(),this.gl.useProgram(this.program),this.linkBuffers()),this.wmTexture&&this.drawWatermark()}drawTile(t,e=1,i=!1){this.gl.uniform1i(this.noTxtLoc,t?0:1),this.gl.uniform1f(this.opaLoc,e),t&&(this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,t));const s=i?1536:6;i!=this.was360&&(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.txtBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,i?Cc._textureBuffer360:Cc._textureBuffer,this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.geomBuffer),this.was360=i),this.gl.bufferData(this.gl.ARRAY_BUFFER,i?this.micrio.engine._vertexBuffer360:this.micrio.engine._vertexBuffer,this.gl.STATIC_DRAW),this.gl.drawArrays(this.gl.TRIANGLES,0,s)}loadWatermark(t,e){if(t===this.wmUrl)return;this.wmUrl=t;const i=new Image;e&&(this.wmOpacity=e),i.crossOrigin="anonymous",i.src=t,i.onload=()=>{const t=document.createElement("canvas");t.width=Xc,t.height=Xc;const e=t.getContext("2d");if(!e)return;const s=Math.min(96/i.width,64/i.height),r=i.width*s,n=i.height*s;e.drawImage(i,(Xc-r)/2,(Xc-n)/2,r,n),this.wmTexture&&this.gl.deleteTexture(this.wmTexture),this.wmTexture=this.getTexture(t);const a=this.gl;a.bindTexture(a.TEXTURE_2D,this.wmTexture),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.REPEAT),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.REPEAT),a.bindTexture(a.TEXTURE_2D,null),this.micrio.engine.render()}}drawWatermark(){const t=this.gl;if(!this.wmTexture)return;t.useProgram(this.program),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.uniformMatrix4fv(this.pmLoc,!1,this.wmMatrix),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.wmTexture),t.uniform1i(this.noTxtLoc,0),t.uniform1f(this.opaLoc,this.wmOpacity);const e=t.drawingBufferWidth/Xc,i=t.drawingBufferHeight/Xc,s=this.wmUvs;s[1]=i,s[2]=e,s[3]=i,s[8]=e,s[9]=i,s[10]=e,t.bindBuffer(t.ARRAY_BUFFER,this.geomBuffer),t.bufferData(t.ARRAY_BUFFER,this.wmVerts,t.DYNAMIC_DRAW),t.vertexAttribPointer(this.posAttr,3,t.FLOAT,!1,0,0),t.bindBuffer(t.ARRAY_BUFFER,this.wmTxtBuffer),t.bufferData(t.ARRAY_BUFFER,this.wmUvs,t.DYNAMIC_DRAW),t.vertexAttribPointer(this.txtAttr,2,t.FLOAT,!1,0,0),t.drawArrays(t.TRIANGLES,0,6),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),this.linkBuffers(),this.was360=!1}},Vc=class{get $isMobile(){return wt(this.isMobile)}constructor(t){this.micrio=t,this.element=document.createElement("canvas"),this.resizing=!1,this.hasPerspective=!1,this.viewport={width:0,height:0,left:0,top:0,ratio:0,scale:0,portrait:!1},this.isMobile=vt(!1),this.getRatio=(t=this.micrio.$current?.$settings??{})=>!Jr.iOS&&!t?.noRetina&&self.devicePixelRatio&&Math.max(1,Math.min(2,self.devicePixelRatio))||1,this.onresize=this.onresize.bind(this),self.ResizeObserver&&(this.resizeObserver=new self.ResizeObserver(this.onresize)),this.element.className="micrio"}place(){if(this.element.parentNode)return;const t=this.micrio.querySelector("img.preview");this.micrio.insertBefore(this.element,t?t.nextSibling:this.micrio.firstChild)}hook(){this.onresize(),this.resizeObserver?this.resizeObserver.observe(this.element):window.addEventListener("resize",this.onresize)}unhook(){this.resizeObserver?this.resizeObserver.unobserve(this.element):window.removeEventListener("resize",this.onresize)}onresize(){const t=this.element.getBoundingClientRect();this.micrio.$current?.is360&&(this.hasPerspective=!0);let e=t.width,i=t.height;if(!e||!i)return;const s=self.getComputedStyle(this.element),r=parseFloat(s.width);isNaN(r)||(i=parseFloat(s.height)*e/Math.max(1,r));const n=this.micrio.hasAttribute("data-static")?1:Math.floor(e)/this.micrio.offsetWidth;e/=n,i/=n;const a=1!=n?1:this.getRatio(),o=this.viewport;o.width==e&&o.height==i&&o.ratio==a&&o.scale==n||(this.hasPerspective&&(this.micrio.style.perspective=i/2+"px"),o.width=e,o.height=i,o.ratio=a,o.scale=n,o.top=t.top,o.left=t.left,o.portrait=window.matchMedia("(orientation: portrait)")?.matches??i>e,this.resizing=!0,this.element.width=e*a,this.element.height=i*a,this.micrio.webgl.gl.viewport(0,0,o.width*o.ratio,o.height*o.ratio),this.micrio.webgl.postpocessor?.resize(),this.micrio.engine.resize(o),this.resizing=!1,this.micrio.events.dispatch("resize",t),this.isMobile.set(/mobile/i.test(navigator.userAgent)))}setMargins(t,e){this.micrio.engine.ready&&this.micrio.engine.setCanvasArea(t,e)}},Yc=["move","marker-open","marker-opened","marker-closed","tour-start","tour-step","tour-stop","tour-event","media-play","media-pause","splitscreen-start","splitscreen-stop"],Nc=class{constructor(t){this.ctx=t,this.handleEvent=this.handleEvent.bind(this),this.dispatch=this.dispatch.bind(this)}hook(){Yc.forEach(t=>this.ctx.micrio.addEventListener(t,this.handleEvent))}unhook(){Yc.forEach(t=>this.ctx.micrio.removeEventListener(t,this.handleEvent))}handleEvent(t){if("move"==t.type&&!this.ctx.isPanning()&&!this.ctx.isPinching()&&!this.ctx.isWheeling())return;const e=this.ctx.vars.updates.stack;e[e.length-1]!=t.type&&e.push(t.type),clearTimeout(this.ctx.vars.updates.to),this.ctx.vars.updates.to<0&&(this.ctx.vars.updates.to=setTimeout(this.dispatch))}dispatch(){const t=this.ctx.vars.updates;clearTimeout(t.to),t.to=-1,t.stack.length&&(this.ctx.dispatch("update",t.stack),t.stack.length=0,t.to=setTimeout(this.dispatch,500))}},Bc=class{get $enabled(){return wt(this.enabled)}constructor(t){this.micrio=t,this.enabled=vt(!1),this.hooked=!1,this.panning=!1,this.pinching=!1,this.clicked=!1,this.wheeling=!1,this.controlZoom=!1,this.twoFingerPan=!1,this.pScale=1,this.hasTouch=Jr.hasTouch&&"ontouchstart"in self,this.hasUsedCtrl=!1,this.vars={drag:{prev:void 0,start:[0,0,0]},dbltap:{lastTapped:0},pinch:{image:void 0,sDst:0,wasPanning:!1},updates:{to:-1,stack:[]}},this.activePointers=new Map,this.el=t.canvas.element,this.dragHandler=new Gc(this),this.pinchHandler=new jc(this,this.dragHandler),this.pointerPinchHandler=new Zc(this,this.dragHandler),this.gestureHandler=new Jc(this),this.wheelHandler=new Kc(this),this.keyboardHandler=new Qc(this),this.doubleTapHandler=new tl(this),this.updateHandler=new Nc(this),this.enabled.subscribe(t=>{t?this.hook():this.unhook()}),t.visible.subscribe(t=>this.visible=t),t.current.subscribe(t=>{t&&!this.settings&&en(t.info).then(e=>{e&&(this.settings=t.$settings,!t.error&&this.settings.hookEvents&&this.enabled.set(!0))})})}isEnabled(){return this.$enabled}isPanning(){return this.panning}isPinching(){return this.pinching}setPanning(t){this.panning=t}setPinching(t){this.pinching=t}isWheeling(){return this.wheeling}setWheeling(t){this.wheeling=t}isControlZoom(){return this.controlZoom}isTwoFingerPan(){return this.twoFingerPan}getVisible(){return this.visible}setCapturedPointerId(t){this.capturedPointerId=t}setPinchFactor(t){this.pinchFactor=t}setPScale(t){this.pScale=t}setHasUsedCtrl(t){this.hasUsedCtrl=t}get isNavigating(){return this.panning||this.pinching||this.wheeling||this.clicked}dispatch(t,e){this.micrio.dispatchEvent(new CustomEvent(t,void 0!==e?{detail:e}:void 0))}getImage(t){if(!this.visible)return;const e=this.micrio.offsetWidth,i=this.micrio.offsetHeight,s=Math.max(0,Math.min(1,t.x/e)),r=Math.max(0,Math.min(1,t.y/i)),n=this.visible?.find(t=>!!t.opts.secondaryTo),a=this.visible.filter(t=>!t.noImage),o=1==a.length?a[0]:a.find(({grid:t,opts:{area:e}})=>(!n||!t)&&(!!e&&(s>=e[0]&&s<=e[2]&&r>=e[1]&&r<=e[3])));return o&&o.opts.secondaryTo&&o.opts.isPassive&&o.opts.area&&(t.x-=o.opts.area[0]*e,t.y-=o.opts.area[1]*i),!o||o.grid||o.opts.secondaryTo&&o.opts.isPassive?this.micrio.$current:o}hook(){if(this.hooked)return;this.hooked=!0;const t=this.settings;t&&(this.twoFingerPan=!!t.twoFingerPan,this.twoFingerPan?this.micrio.setAttribute("data-can-pan",""):this.micrio.removeAttribute("data-can-pan"),t?.hookKeys&&this.hookKeys(),t.hookDrag&&this.hookDrag(),t.noZoom||this.hookZoom(),this.hookUpdate())}unhook(){this.hooked&&(this.hooked=!1,this.activePointers.clear(),this.unhookDrag(),this.unhookZoom(),this.unhookKeys(),this.unhookUpdate())}hookKeys(){this.keyboardHandler.hook()}unhookKeys(){this.keyboardHandler.unhook()}hookZoom(){const t=this.settings;this.controlZoom=!!t?.controlZoom,t&&!t.hookPinch||this.hookPinch(),(!t||t.hookScroll||this.controlZoom)&&this.hookScroll(),this.micrio.canvas.$isMobile?this.doubleTapHandler.hookTap():this.doubleTapHandler.hookClick()}unhookZoom(){this.unhookPinch(),this.unhookScroll(),this.micrio.canvas.$isMobile?this.doubleTapHandler.unhookTap():this.doubleTapHandler.unhookClick()}get scrollHooked(){return this.wheelHandler.hooked}hookScroll(){this.wheelHandler.hook()}unhookScroll(){this.wheelHandler.unhook()}hookPinch(){Jr.iOS&&this.hasTouch?this.pinchHandler.hook():this.pointerPinchHandler.hook(),this.gestureHandler.hook()}unhookPinch(){Jr.iOS&&this.hasTouch?this.pinchHandler.unhook():this.pointerPinchHandler.unhook(),this.gestureHandler.unhook()}hookDrag(){this.dragHandler.hook()}unhookDrag(){this.dragHandler.unhook()}hookUpdate(){this.updateHandler.hook()}unhookUpdate(){this.updateHandler.unhook()}},qc={passive:!0},Wc={passive:!0,capture:!0},Uc={passive:!1};function Hc(t){t.stopPropagation(),t.preventDefault()}var Gc=class{constructor(t){this.ctx=t,this.hooked=!1,this.start=this.start.bind(this),this.move=this.move.bind(this),this.stop=this.stop.bind(this),this.cancel=this.cancel.bind(this)}hook(){this.hooked||(this.hooked=!0,this.ctx.micrio.addEventListener("dragstart",Hc),this.ctx.micrio.addEventListener("pointerdown",this.start,qc),self.addEventListener("pointercancel",this.cancel,qc),this.ctx.micrio.setAttribute("data-hooked",""))}unhook(){this.hooked&&(this.hooked=!1,this.ctx.micrio.removeEventListener("pointerdown",this.start,qc),this.ctx.micrio.removeEventListener("dragstart",Hc),self.removeEventListener("pointercancel",this.cancel,qc),this.ctx.micrio.removeAttribute("data-hooked"))}start(t,e=!1){if(0!=t.button||"touch"==t.pointerType&&this.ctx.isTwoFingerPan())return;if(!(e||t.target==this.ctx.el||t.target instanceof Element&&t.target.closest("[data-scroll-through]")))return;if(this.ctx.micrio.$current?.isOmni&&t.shiftKey)return;if(this.ctx.isPinching())return;if(this.ctx.isPanning())return void(t instanceof TouchEvent&&t.touches.length>1&&this.stop());const i=this.ctx.getImage({x:t.clientX,y:t.clientY});i&&(this.ctx.setPanning(!0),this.ctx.vars.drag.start=[t.clientX,t.clientY,performance.now()],this.ctx.micrio.addEventListener("pointermove",this.move,qc),this.ctx.micrio.addEventListener("pointerup",this.stop,qc),this.ctx.micrio.setAttribute("data-panning",""),this.ctx.micrio.engine.panStart(i.ptr),this.ctx.micrio.engine.render(),this.ctx.dispatch("panstart"))}move(t){const e=t.clientX,i=t.clientY,s=Math.hypot(this.ctx.vars.drag.start[0]-t.clientX,this.ctx.vars.drag.start[1]-t.clientY);!this.ctx.capturedPointerId&&s>10&&(this.ctx.setCapturedPointerId(t.pointerId),this.ctx.micrio.setPointerCapture(t.pointerId)),this.ctx.vars.drag.prev&&this.ctx.getImage({x:e,y:i})?.camera.pan(this.ctx.vars.drag.prev[0]-e,this.ctx.vars.drag.prev[1]-i),this.ctx.vars.drag.prev=[e,i]}stop(t,e=!1,i=!1){if(this.ctx.isPanning()){if(this.ctx.setPanning(!1),this.ctx.vars.drag.prev=void 0,this.ctx.micrio.removeEventListener("pointermove",this.move,qc),this.ctx.micrio.removeEventListener("pointerup",this.stop,qc),this.ctx.capturedPointerId&&this.ctx.micrio.releasePointerCapture(this.ctx.capturedPointerId),this.ctx.setCapturedPointerId(void 0),this.ctx.micrio.removeAttribute("data-panning"),t&&0==e){const e=this.ctx.getImage({x:t.clientX,y:t.clientY});e&&(this.ctx.micrio.engine.panStop(e.ptr),this.ctx.micrio.engine.render())}i||this.ctx.dispatch("panend",t?{duration:performance.now()-this.ctx.vars.drag.start[2],movedX:t.clientX-this.ctx.vars.drag.start[0],movedY:t.clientY-this.ctx.vars.drag.start[1]}:void 0)}}cancel(t){this.ctx.isPanning()&&(void 0!==this.ctx.capturedPointerId&&t.pointerId!==this.ctx.capturedPointerId||this.stop(void 0,!0,!0))}},jc=class{constructor(t,e){this.ctx=t,this.dragHandler=e,this.start=this.start.bind(this),this.move=this.move.bind(this),this.stop=this.stop.bind(this)}hook(){Jr.iOS&&this.ctx.hasTouch&&this.ctx.micrio.addEventListener("touchstart",this.start,qc)}unhook(){Jr.iOS&&this.ctx.hasTouch&&this.ctx.micrio.removeEventListener("touchstart",this.start,qc),self.removeEventListener("touchmove",this.move,Wc),self.removeEventListener("touchend",this.stop,Wc)}start(t){if(!(Jr.hasTouch&&t instanceof TouchEvent))return;if(this.ctx.isTwoFingerPan()&&t.touches.length<2)return;if(this.ctx.isPinching()||2!=t.touches.length)return void this.stop(t);t.stopPropagation(),this.ctx.vars.pinch.wasPanning=this.ctx.isPanning(),this.dragHandler.stop(void 0,!1,!0);const e=t.touches;this.ctx.setPinching(!0),self.addEventListener("touchmove",this.move,Wc),self.addEventListener("touchend",this.stop,Wc),this.ctx.micrio.setAttribute("data-pinching",""),this.ctx.vars.pinch.image=this.ctx.getImage({x:e[0].clientX,y:e[0].clientY}),this.ctx.vars.pinch.sDst=Math.hypot(e[0].clientX-e[1].clientX,e[0].clientY-e[1].clientY),this.ctx.setPinchFactor(void 0),this.ctx.vars.pinch.image&&this.ctx.micrio.engine.pinchStart(this.ctx.vars.pinch.image.ptr),this.ctx.micrio.engine.render(),this.ctx.dispatch("pinchstart"),this.ctx.isTwoFingerPan()&&this.ctx.dispatch("panstart")}move(t){if(!(Jr.hasTouch&&t instanceof TouchEvent))return;const e=t.touches;if(e?.length<2)return;const i={x:e[0].clientX,y:e[0].clientY},s={x:e[1].clientX,y:e[1].clientY},r=this.ctx.vars.pinch,n=r.image;if(n){if(n?.opts.secondaryTo&&n.opts.isPassive&&n.opts.area){const t=n.opts.area[0]*this.ctx.micrio.offsetWidth,e=n.opts.area[1]*this.ctx.micrio.offsetHeight;i.x-=t,s.x-=t,i.y-=e,s.y-=e}this.ctx.setPinchFactor(Math.hypot(e[0].clientX-e[1].clientX,e[0].clientY-e[1].clientY)/r.sDst),this.ctx.micrio.engine.pinch(n.ptr,i.x,i.y,s.x,s.y)}}stop(t){if(!this.ctx.isPinching())return;this.ctx.setPinching(!1),self.removeEventListener("touchmove",this.move,Wc),self.removeEventListener("touchend",this.stop,Wc),this.ctx.micrio.removeAttribute("data-pinching");const e=this.ctx.vars.pinch.image;e&&(this.ctx.micrio.engine.pinchStop(e.ptr,performance.now()),this.ctx.micrio.engine.render()),this.ctx.vars.pinch.image=void 0,this.ctx.setPinchFactor(void 0),this.ctx.dispatch("pinchend"),this.ctx.isTwoFingerPan()&&!this.ctx.vars.pinch.wasPanning&&this.ctx.dispatch("panend"),t instanceof TouchEvent&&1==t.touches.length&&this.dragHandler.start(t,!0)}},Zc=class{constructor(t,e){this.ctx=t,this.dragHandler=e,this.start=this.start.bind(this),this.move=this.move.bind(this),this.end=this.end.bind(this)}hook(){this.ctx.micrio.addEventListener("pointerdown",this.start,qc),self.addEventListener("pointerup",this.end,qc),self.addEventListener("pointercancel",this.end,qc)}unhook(){this.ctx.micrio.removeEventListener("pointerdown",this.start,qc),self.removeEventListener("pointerup",this.end,qc),self.removeEventListener("pointercancel",this.end,qc),self.removeEventListener("pointermove",this.move,Wc),this.ctx.activePointers.clear()}start(t){if("touch"===t.pointerType&&(this.ctx.activePointers.set(t.pointerId,{x:t.clientX,y:t.clientY}),2===this.ctx.activePointers.size&&!this.ctx.isPinching())){this.ctx.vars.pinch.wasPanning=this.ctx.isPanning(),this.dragHandler.stop(void 0,!1,!0),this.ctx.setPinching(!0),self.addEventListener("pointermove",this.move,Wc),this.ctx.micrio.setAttribute("data-pinching","");const t=Array.from(this.ctx.activePointers.values()),e=t[0],i=t[1];this.ctx.vars.pinch.image=this.ctx.getImage({x:e.x,y:e.y}),this.ctx.vars.pinch.sDst=Math.hypot(e.x-i.x,e.y-i.y),this.ctx.setPinchFactor(void 0),this.ctx.vars.pinch.image&&this.ctx.micrio.engine.pinchStart(this.ctx.vars.pinch.image.ptr),this.ctx.micrio.engine.render(),this.ctx.dispatch("pinchstart"),this.ctx.isTwoFingerPan()&&this.ctx.dispatch("panstart")}}move(t){if("touch"!==t.pointerType)return;if(!this.ctx.activePointers.has(t.pointerId))return;if(this.ctx.activePointers.set(t.pointerId,{x:t.clientX,y:t.clientY}),!this.ctx.isPinching()||2!==this.ctx.activePointers.size)return;const e=Array.from(this.ctx.activePointers.values()),i=e[0],s=e[1],r=this.ctx.vars.pinch,n=r.image;if(!n)return;const a={x:i.x,y:i.y},o={x:s.x,y:s.y};if(n?.opts.secondaryTo&&n.opts.isPassive&&n.opts.area){const t=n.opts.area[0]*this.ctx.micrio.offsetWidth,e=n.opts.area[1]*this.ctx.micrio.offsetHeight;a.x-=t,o.x-=t,a.y-=e,o.y-=e}this.ctx.setPinchFactor(Math.hypot(i.x-s.x,i.y-s.y)/r.sDst),this.ctx.micrio.engine.pinch(n.ptr,a.x,a.y,o.x,o.y)}end(t){if("touch"===t.pointerType&&(this.ctx.activePointers.delete(t.pointerId),this.ctx.isPinching()&&this.ctx.activePointers.size<2)){this.ctx.setPinching(!1),self.removeEventListener("pointermove",this.move,Wc),this.ctx.micrio.removeAttribute("data-pinching");const t=this.ctx.vars.pinch.image;if(t&&(this.ctx.micrio.engine.pinchStop(t.ptr,performance.now()),this.ctx.micrio.engine.render()),this.ctx.vars.pinch.image=void 0,this.ctx.setPinchFactor(void 0),this.ctx.dispatch("pinchend"),this.ctx.isTwoFingerPan()&&!this.ctx.vars.pinch.wasPanning&&this.ctx.dispatch("panend"),1===this.ctx.activePointers.size){const t=Array.from(this.ctx.activePointers.entries())[0],e={button:0,pointerType:"touch",target:this.ctx.el,clientX:t[1].x,clientY:t[1].y,pointerId:t[0]};this.dragHandler.start(e,!0)}}}},Jc=class{constructor(t){this.ctx=t,this.handle=this.handle.bind(this)}hook(){Jr.OSX&&(this.ctx.micrio.addEventListener("gesturestart",this.handle,Uc),this.ctx.micrio.addEventListener("gesturechange",this.handle,Uc),this.ctx.micrio.addEventListener("gestureend",this.handle,Uc))}unhook(){Jr.OSX&&(this.ctx.micrio.removeEventListener("gesturestart",this.handle,Uc),this.ctx.micrio.removeEventListener("gesturechange",this.handle,Uc),this.ctx.micrio.removeEventListener("gestureend",this.handle,Uc))}getGestureEvent(t){if("scale"in t&&"number"==typeof t.scale){const e=t;return{scale:e.scale,clientX:e.clientX,clientY:e.clientY}}return null}handle(t){const e=this.getGestureEvent(t);if(!e||1===e.scale)return;const i=this.ctx.pScale-e.scale;this.ctx.setPScale(e.scale),t.stopPropagation(),t.preventDefault(),"gesturechange"==t.type&&this.ctx.getImage({x:e.clientX,y:e.clientY})?.camera.zoom(i*this.ctx.micrio.canvas.viewport.height,0,e.clientX,e.clientY)}},Kc=class{constructor(t){this.ctx=t,this.hooked=!1,this.wheelEndTo=-1,this.handle=this.handle.bind(this),this.end=this.end.bind(this)}hook(){this.hooked||(this.ctx.micrio.addEventListener("wheel",this.handle,Uc),this.hooked=!0)}unhook(){this.ctx.micrio.removeEventListener("wheel",this.handle,Uc),this.hooked=!1}handle(t,e=!1,i=0){if(!(t instanceof WheelEvent))return;if(this.ctx.isControlZoom()&&!t.ctrlKey)return;if(!e&&t.target instanceof Element&&t.target!=this.ctx.el&&!t.target.classList.contains("marker")&&!t.target.closest("[data-scroll-through]"))return;let s=t.deltaY;t.ctrlKey&&this.ctx.setHasUsedCtrl(!0);const r=this.ctx.isControlZoom()&&10*s%1==0,n=this.ctx.hasUsedCtrl&&!r,a=Jr.firefox||t.ctrlKey||!n;if(this.ctx.isTwoFingerPan()&&this.ctx.micrio.$current?.camera.isZoomedOut())return;t.stopPropagation(),t.preventDefault(),(Jr.OSX||n)&&t.ctrlKey&&(s*=10);const o={x:t.clientX,y:t.clientY},h=this.ctx.getImage(o);if(h){if(a){const t=this.ctx.micrio.canvas.viewport;let e=0;const r=this.ctx.micrio.getBoundingClientRect();h.camera.zoom(1*s/Math.sqrt(t.scale),0,o.x-i-r.left,o.y-r.top-e)}else h.camera.pan(t.deltaX,t.deltaY);this.ctx.setWheeling(!0),clearTimeout(this.wheelEndTo),this.wheelEndTo=setTimeout(this.end,50)}}end(){this.ctx.setWheeling(!1)}},Qc=class{constructor(t){this.ctx=t,this.handle=this.handle.bind(this)}hook(){document.addEventListener("keydown",this.handle)}unhook(){document.removeEventListener("keydown",this.handle)}handle(t){if(this.ctx.isPanning()||this.ctx.isPinching()||!this.ctx.micrio.$current?.camera)return;const e=this.ctx.micrio.$current.camera,i=this.ctx.micrio.offsetWidth/2,s=this.ctx.micrio.offsetHeight/2;let r=0,n=0;switch(t.key){case"ArrowUp":n-=s;break;case"ArrowDown":n+=s;break;case"ArrowLeft":r-=i;break;case"ArrowRight":r+=i;break;case"+":case"=":e.zoom(-200,150).catch(()=>{});break;case"-":case"_":e.zoom(200,150).catch(()=>{});break;default:return}t.preventDefault(),t.stopPropagation(),0==r&&0==n||e.pan(r,n,150)}},tl=class{constructor(t){this.ctx=t,this.tap=this.tap.bind(this),this.click=this.click.bind(this)}hookTap(){this.ctx.el.addEventListener("touchstart",this.tap)}unhookTap(){this.ctx.el.removeEventListener("touchstart",this.tap)}hookClick(){this.ctx.el.addEventListener("dblclick",this.click)}unhookClick(){this.ctx.el.removeEventListener("dblclick",this.click)}tap(t){if(!(Jr.hasTouch&&t instanceof TouchEvent))return;const e=performance.now();1==t.touches.length&&e-this.ctx.vars.dbltap.lastTapped<250&&(t.stopPropagation(),t.preventDefault(),this.click(t)),this.ctx.vars.dbltap.lastTapped=e}click(t){const e=t instanceof TouchEvent?t.touches[0]:t;this.ctx.getImage({x:e.clientX,y:e.clientY})?.camera.zoom(-300,500,e.clientX,e.clientY,1,!this.ctx.micrio.$current?.album).catch(()=>{})}},el=class t{static{this.events=["load","tour-start","tour-stop","marker-open","marker-closed","page-open","page-closed","lang-switch"]}constructor(t){this.micrio=t,this.isStatic=!1,this.loaded=!1,this.inited=!1,this.setting=!1,this.writeTitle=!1}hook(){this.isStatic="static"==this.micrio.getAttribute("data-router"),this.read=this.read.bind(this),this.write=this.write.bind(this),this.writeDeferred=this.writeDeferred.bind(this),en(this.micrio.current).then(()=>{this.loaded=!0,this.read()}),t.events.forEach(t=>this.micrio.addEventListener(t,this.write)),location.hostname==`viewer.${pn}`&&(this.writeTitle=!0),window.addEventListener(this.isStatic?"popstate":"hashchange",this.read)}unhook(){t.events.forEach(t=>this.micrio.removeEventListener(t,this.write)),window.removeEventListener(this.isStatic?"popstate":"hashchange",this.read)}findPage(t,e,i){if(e)for(let s=0;s<e.length;s++){let r=Gr((e[s]?.i18n?.[i]??e[s]).title)==t?e[s]:this.findPage(t,e[s].children,i);if(r)return r}}read(){if(!this.loaded||this.setting)return;this.route=(this.isStatic?location.pathname:location.hash).slice(1);const[t,e,i,s,r]=this.route.split("/"),n=this.micrio.$current,a=t&&n?.id!=t?this.micrio.open(t):void 0;n&&Promise.all([en(n.data,{allowUndefined:!0}),a?en(a.data,{allowUndefined:!0}):void 0]).then(t=>{if(!t[0])return this.inited=!0;if(void 0===this.prevLang&&(this.prevLang=this.micrio.lang),!1===a?.$settings.routerMarkerTours)return;if(t[0].pages?.length&&s){const i=this.findPage(s.toLowerCase(),t[0].pages,e);if(i)return void this.micrio.state.popover.set({contentPage:i})}const i=s?r?t.map(t=>t?.markerTours?.find(t=>Gr(t.i18n?.[e]?.slug)==s))[0]:t.map(t=>t?.tours?.find(t=>Gr(t.i18n?.[e]?.slug)==s))[0]:void 0,o=r||!i&&s,h=o?(t[1]??t[0]).markers?.find(t=>(t.i18n?.[e]?.slug??Gr(t.title))==o||i&&"steps"in i&&i.stepInfo?.map(t=>t.marker).find(t=>t.i18n?.[e]?.slug==o)):void 0;h&&i&&"steps"in i?i.initialStep=Math.max(0,i.steps.findIndex(t=>t.startsWith(h.id))):(h||this.micrio.state.popup.set(void 0),(a??n).state.marker.set(h)),this.micrio.state.tour.set(i),this.writeTitle&&this.setTitle(),this.inited=!0})}setTitle(){const t=wt(this.micrio._lang),e=this.micrio.$current;if(!e)return;const i=[e.$data?.i18n?.[t]?.title??e?.$info?.title,this.micrio.state.$tour?.i18n?.[t]?.title,this.micrio.state.$marker?.i18n?.[t]?.title].filter(t=>!!t).reverse();document.title=i.join(" - ")+" | Micrio"}write(t){if(this.micrio.$current&&this.loaded&&this.inited){if("marker-open"===t.type){const t=this.micrio.state.$marker;if(t&&t.data&&t.data.micrioLink)return}clearTimeout(this._to),this._to=setTimeout(()=>this.writeDeferred("load"==t.type),50)}}writeDeferred(t){const e=this.micrio.state.$tour;let i=this.micrio.$current,s=i?.state.$marker;const r=this.micrio.lang;r!=this.prevLang&&(t=!0,this.prevLang=r);const n=i?.$data?.i18n?.[r]?.title??i?.$info?.title??"",a=!1===i?.$settings.routerMarkerTours,o=s&&"string"!=typeof s?s.i18n?.[r]??s:void 0,h=wt(this.micrio.state.popover)?.contentPage,c=h?h.i18n?.[r]??h:void 0;let l=i?.id;if(e&&"steps"in e&&e.steps.length&&e.stepInfo){const t=e.stepInfo.find(t=>t.markerId==e.steps.find(t=>!t.includes(",")));t&&(l=t.micrioId,i=this.micrio.engine.images.find(t=>t.id==l),s||void 0===e.initialStep||(s=e.stepInfo[Math.max(0,e.initialStep)].marker))}const d=[l,r,Gr(n)??"",...a?[]:c?[Gr(c.title)]:[e?.i18n?.[r]?.slug??null,o?.slug??Gr(o?.title)??null]].filter(t=>!!t).join("/");d!=this.route&&(this.setting=!0,this.isStatic?t?history.replaceState(null,"","/"+d+location.search):history.pushState(null,"","/"+d+location.search):location.hash=d,this.route=d,this.writeTitle&&this.setTitle(),setTimeout(()=>this.setting=!1,250))}},il=class t{static{this.events=["load","show","hide","marker-open","marker-opened","marker-closed","tour-start","tour-stop","tour-step","tour-ended"]}constructor(t){this.micrio=t,this.gtag="gtag"in window?window.gtag:void 0,this.hooked=!1,this.tag=this.tag.bind(this)}hook(){!this.hooked&&this.gtag&&(this.hooked=!0,this.tag(new CustomEvent("init")),t.events.forEach(t=>this.micrio.addEventListener(t,this.tag)))}unhook(){this.hooked&&(this.hooked=!1,this.tag(new CustomEvent("hide")),t.events.forEach(t=>this.micrio.removeEventListener(t,this.tag)))}tag(t){if(!this.gtag)return;const e=t.detail,i=this.micrio.$current,s={event_category:"Micrio",event_action:t.type};this.micrio.lang&&(s.culture=this.micrio.lang),"init"==t.type&&(s.micrio_version=mn),"load"==t.type&&i?.$info&&(s.image_version=i.$info.version);const r=null!==e&&"object"==typeof e&&"currentStep"in e?e.currentStep:null;null!=r&&(s.event_value=r);const n=e&&e.title?e.title:i&&i.$info&&i.$info.title;s.event_label=this.micrio.id+(n?" - "+n:""),this.gtag("event",t.type,s)}},sl=t=>Math.round(1e5*t)/1e5,rl=class t{static{this.getString=(t,e)=>[t.id,t.width,t.height,t.isDeepZoom?"d":"",t.isPng?"p":t.isWebP?"w":"",e.view?.map(sl).join("/"),e.area?.map(sl).join("/"),t.settings?.focus?.map(sl).join("-"),e.cultures].join(",").replace(/,+$/,"")+(e.size?`|${e.size.join(",")}`:"")}get $focussed(){return wt(this.focussed)}constructor(e,i){this.micrio=e,this.image=i,this.images=[],this.imageMap=new Map,this.current=[],this._grid=document.createElement("div"),this._buttons=new Map,this.clickable=!1,this.focussed=vt(),this.markersShown=vt([]),this.history=[],this.depth=vt(0),this.aniDurationIn=1.5,this.aniDurationOut=.5,this.transitionDelay=.5,this.isHorizontal=!1,this.cellSizes=new Map,this.nextSize=new Map,this.timingFunction="ease",this.getString=(e,i={})=>t.getString(e,{view:i.view,area:i.area,size:i.size??this.nextSize.get(e.id),cultures:("cultures"in e&&e.cultures?e.cultures:"")?.replace(/,/g,"-")}),this.actionHandlers={[Ao.Grid.GridActionType.focus]:(t,e)=>{const i=t?.split("|").map(t=>t.trim()),s=(i?.[0]??"").split(",").map(t=>this.imageMap.get(t.trim())).filter(t=>void 0!==t);1==s.length?this.focus(s[0],{duration:e}):s.length>0&&this.set(s.map(t=>this.getString(t.$info)).join(";"),{duration:e,horizontal:"h"==i?.[1]})},[Ao.Grid.GridActionType.flyTo]:(t,e)=>{const i=t?.split(",").map(t=>this.current.find(e=>e.id==t?.trim()));i?.length?this.image.camera.flyToView([Math.min(...i.map(t=>t?.opts.area?.[0]??0)),Math.min(...i.map(t=>t?.opts.area?.[1]??0)),Math.max(...i.map(t=>t?.opts.area?.[2]??1)),Math.max(...i.map(t=>t?.opts.area?.[3]??1))],{duration:e?1e3*e:void 0}).catch(()=>{}):console.warn("Given image IDs gave no current displayed images")},[Ao.Grid.GridActionType.focusTagged]:(t,e)=>{this.flyToMarkers(t,e)},[Ao.Grid.GridActionType.focusWithTagged]:(t,e)=>{this.flyToMarkers(t,e,!0)},[Ao.Grid.GridActionType.reset]:(t,e)=>{this.reset(e)},[Ao.Grid.GridActionType.back]:(t,e)=>{this.back(e)},[Ao.Grid.GridActionType.switchToGrid]:()=>{this.switchToGrid()},[Ao.Grid.GridActionType.nextFadeDuration]:t=>{this.nextCrossFadeDuration=Number(t)},[Ao.Grid.GridActionType.filterTourImages]:(t,e)=>{en(this.micrio.state.tour).then(i=>{if(!i)return;if(!("steps"in i)||!i.stepInfo)return;const s=i.stepInfo.map(t=>t.micrioId),r=s.filter((t,e)=>s.indexOf(t)==e).map(t=>this.imageMap.get(t)).filter(t=>!!t).map(t=>this.getString(t.$info)).join(";");r&&this.set(r,{duration:e,horizontal:"h"==t})})}},this.tourEvent=this.tourEvent.bind(this),this.updateGrid=this.updateGrid.bind(this);const s=i.$settings;this.clickable=!!s.gridClickable,void 0!==s.gridTransitionDuration&&(this.aniDurationIn=this.aniDurationOut=s.gridTransitionDuration),void 0!==s.gridTransitionDurationOut&&(this.aniDurationOut=s.gridTransitionDurationOut),this._grid.className="micrio-grid",this.set(i.$info?.grid);const r=()=>Si().then(()=>{this.hook(),e.events.dispatch("grid-load")});i.isV5?r():e._lang.subscribe(t=>{t?Promise.all(this.images.filter(e=>(e.$info&&"cultures"in e.$info&&e.$info?.cultures||"").indexOf(t)>=0).map(t=>en(t.data))).then(r):r()}),e.events.dispatch("grid-init",this)}hook(){if(this.micrio.state.marker.subscribe(t=>{if(t&&"string"!=typeof t){const e=t.data?._meta;if(e?.gridSize){const i="number"==typeof e.gridSize?[e.gridSize,e.gridSize]:e.gridSize.split(",").map(Number),s=this.images.find(e=>e.$data?.markers?.find(e=>e==t))?.id;s&&this.nextSize.set(s,i)}Si().then(()=>{const t=e?.gridAction?.split("|");t?.length&&"string"==typeof t[0]&&this.action(t.shift(),t.join("|"))})}}),this.clickable){this._grid.addEventListener("click",t=>{const e=t.target.dataset.id;e&&this.focus(this.imageMap.get(e))});const t=t=>{t?this.removeGrid():this.placeGrid()};this.micrio.state.tour.subscribe(t),this.micrio.state.marker.subscribe(t),this.focussed.subscribe(t)}this.micrio.addEventListener("tour-event",this.tourEvent),this.micrio.addEventListener("serialtour-pause",()=>this.images.forEach(t=>t.camera.pause())),this.micrio.addEventListener("serialtour-play",()=>this.images.forEach(t=>t.camera.resume()))}clearTimeouts(){clearTimeout(this._to),clearTimeout(this._fadeTo)}trackImage(t){this.images.push(t),this.imageMap.set(t.id,t)}parseInput(t){return"string"!=typeof t&&(t=t.map(t=>t instanceof Ph?{image:t}:t).filter(t=>!!t.image.$info).map(t=>this.getString(t.image.$info,t)).join(";")),t.split(";").filter(t=>!!t).map(t=>this.getImage(t))}setupBehindTransition(t,e,i){const s="behind-delayed"==e.transition,r=!0===e.coverLimit,{engine:n}=this.micrio;e.forceAni=!0,e.coverLimit=r,e.forceAreaAni=!0;const a=s?1/t.length:1;let o=0;this.images.forEach(e=>{e.camera.setCoverLimit(r),t.find(t=>t.id==e.id)&&(e.camera.setArea([0,0,i?.id==e.id?1:a,1],{noDispatch:!0,direct:!0}),e!=i&&e.camera.setView([0,0,1,1]),s&&n.setZIndex(e.ptr,t.length-o++))}),t.forEach(t=>t.view=[0,0,1,1])}savePreviousLayout(){this.depth.set(this.history.push({layout:this.current.map(t=>this.getString(t.$info,{view:t.state.$view,size:this.cellSizes.get(t.id)})).join(";"),horizontal:this.isHorizontal,view:this.image.camera.getView()}))}set(t="",e={}){return this.lastPromise=new Promise((i,s)=>{delete this.image.$info?.settings?.focus,this.lastAction=void 0,!1===e.cover&&e.coverLimit&&(e.coverLimit=!1),e.coverLimit&&null==e.cover&&(e.cover=e.coverLimit);const r=this.parseInput(t),n=this.$focussed,a=e.transition?.endsWith("-delayed"),o="behind-delayed"==e.transition,{engine:h}=this.micrio;"crossfade"==e.transition?e.duration=0:"behind"!=e.transition&&"behind-delayed"!=e.transition||this.setupBehindTransition(r,e,n);const c=this.image.ptr>=0,l=e.duration??(e.noHistory?this.aniDurationOut:this.aniDurationIn),d=this.nextCrossFadeDuration??this.image.$settings.crossfadeDuration??1,u=(l||this.aniDurationIn)/(o?2:1);this.nextCrossFadeDuration=void 0,c&&(h.setGridTransitionDuration(l),h.setCrossfadeDuration(u));const m=!e.noBlur&&n;m&&this.blur(),!e.noHistory&&this.current.length&&this.savePreviousLayout(),this.isHorizontal=!!e.horizontal,this.removeImages(this.images.filter(t=>!r.find(e=>e.id==t.id))),this.printGrid(r,{horizontal:e.horizontal,keepGrid:e.keepGrid,scale:e.scale,columns:e.columns}),this.clearTimeouts();let g=!1;const p=()=>{this.clearTimeouts(),g||s()};c&&!e.noCamAni&&(e.view?this.image.camera.flyToView(e.view,{duration:1e3*l}).catch(p):this.image.camera.flyToFullView({duration:1e3*l}).catch(p)),this.nextSize.clear(),null==e.coverLimit&&(e.coverLimit=!0),e.coverLimit||r.forEach(t=>this.imageMap.get(t.id)?.camera.setCoverLimit(!1));const f="appear-delayed"==e.transition,v=t=>t*this.transitionDelay+(t>0&&f?l:0);this.current=r.map((t,i)=>this.placeImage(t,{duration:!e.forceAni&&m&&t.id!=n?.id?0:l,delay:a?v(i):0,noCamAni:!!(f&&i>0)||!!e.noCamAni,forceAreaAni:!(f&&i>0)&&e.forceAreaAni,cover:e.cover})),f&&this.current.slice(1).forEach(t=>h.fadeTo(t.ptr,.9999,!0));const w=()=>this.current.forEach((t,e)=>Kr(a?1e3*(v(e)+(o?l/2:0)):0).then(()=>h.fadeIn(t.ptr))),y=()=>{this.clearTimeouts(),requestAnimationFrame(()=>h.setCrossfadeDuration(d)),a&&this.images.forEach(t=>h.setZIndex(t.ptr,0)),e.coverLimit&&r.forEach(t=>this.imageMap.get(t.id)?.camera.setCoverLimit(!0)),this.clickable&&this.placeGrid(),this.lastAction=void 0,g=!0,i(this.current)};l||u?(e.noFade||(this._fadeTo=setTimeout(w,Math.max(0,l/2*1e3))),this._to=setTimeout(y,1e3*(Math.max(u,l)+(a?(r.length-1)*this.transitionDelay:0)))):(e.noFade||w(),y())})}hasChanged(){return this.current.length!==this.images.length||this.current.some((t,e)=>t.id!==this.images[e].id)}getImage(t){const e=t.split("|"),i=e[0].split(","),s=e[1]?e[1].split(",").map(Number):[1];let r=0,n=0;return{path:this.image.$info?.path,id:i[0],width:r=Number(i[1])||r,height:n=Number(i[2])||n,isDeepZoom:"d"==i[3],isPng:"p"==i[4],isWebP:"w"==i[4],size:s,view:i[5]?i[5].split("/").map(Number):void 0,area:i[6]?i[6].split("/").map(Number):void 0,settings:Wr(this.image.$settings||{},{focus:i[7]?i[7].split("-").map(Number):void 0}),cultures:i[8]?.replace(/-/g,",")||void 0}}getCols(t,e){let i=Math.ceil(e/Math.ceil(Math.sqrt(e)));if(t==e){const e=Math.floor(Math.sqrt(t)),s=[];for(let r=e;r<i+e;r++)t%r||s.push(r);s.length&&(i=s[Math.floor(s.length/2)])}return i}printGrid(t,e){e.keepGrid||this.removeGrid();const i=t.reduce((t,e)=>t+e.size[0]*(e.size[1]??1),0),s=e.columns??(e.horizontal?t.length:this.getCols(t.length,i));this._grid.style.gridTemplateColumns=`repeat(${s}, auto)`,this._grid.textContent="",this._grid.style.removeProperty("--translate"),this._grid.style.removeProperty("--scale"),t.forEach(t=>{if(!t.id)return;this._buttons.has(t.id)||this._buttons.set(t.id,document.createElement("button"));const e=this._buttons.get(t.id);"1"!=t.size.toString()?(e.style.gridArea=`auto / auto / span ${t.size[1]} / span ${t.size[0]||t.size[1]}`,this.cellSizes.set(t.id,t.size)):(e.style.removeProperty("grid-area"),this.cellSizes.delete(t.id)),e.dataset.id=t.id,this._grid.appendChild(e)}),e.keepGrid&&this._grid.parentNode||this.micrio.insertBefore(this._grid,this.micrio.firstChild?.nextSibling??null),this.micrio.events.dispatch("grid-layout-set",this);const r=this.micrio.offsetWidth,n=this.micrio.offsetHeight,a=Math.max(0,Math.min(1,1-(e.scale??1)));this._grid.style.transform="",this._grid.childNodes.forEach(e=>{if(!e)return;const i=e,s=i.dataset.id,o=i.getBoundingClientRect(),h=t.find(t=>t.id==s),c=[a/2*o.width,a/2*o.height];h&&!h.area&&(h.area=[(o.x+c[0])/r,(o.y+c[1])/n,(o.x+o.width-c[0])/r,(o.y+o.height-c[1])/n])}),e.keepGrid||this._grid.remove()}placeGrid(){!this.clickable||this.micrio.state.$tour||this.micrio.state.$marker||this._grid.parentNode||(this.micrio.insertBefore(this._grid,this.micrio.firstChild?.nextSibling??null),this.viewUnsub=this.image.state.view.subscribe(this.updateGrid))}removeGrid(){this._grid.parentNode&&(this.viewUnsub&&this.viewUnsub(),this._grid.remove())}updateGrid(){const t=this.image.camera.getXY(0,0,!0);this._grid.style.setProperty("--translate",`translate3d(${t[0]}px, ${t[1]}px, 0)`),this._grid.style.setProperty("--scale",this.image.camera.getScale().toString()),this._grid.dispatchEvent(new CustomEvent("update"))}placeImage(t,e){const{engine:i}=this.micrio;let s=this.imageMap.get(t.id);s&&t.area?Kr(1e3*e.delay).then(()=>{s.camera.setArea(t.area,{direct:0==e.duration||!e.forceAreaAni&&!wt(s.visible)}),e.delay&&i.render()}):(t.lang=this.micrio.lang,i.addChild(s=new Ph(i,t,{area:t.area}),this.image),this.trackImage(s));const r={duration:1e3*e.duration,timingFunction:this.timingFunction,limit:!1};if(!e.noCamAni&&!s.camera.aniDone&&s.ptr>0){const i=!!e.cover||s.camera.getCoverLimit();if(t.view||!i)s.camera.flyToView(t.view??[0,0,1,1],r).catch(()=>{});else if(t.area&&t.width&&t.height){const e=(t.area[2]-t.area[0])*this.micrio.offsetWidth/((t.area[3]-t.area[1])*this.micrio.offsetHeight);s.camera.flyToView(e<t.width/t.height?[.5,0,.5,1]:[0,.5,1,.5],r).catch(()=>{})}else s.camera.flyToCoverView(r).catch(()=>{})}return s}removeImages(t){const{engine:e}=this.micrio;t.forEach(t=>{t.ptr>=0&&e.fadeOut(t.ptr),this._buttons.delete(t.id)}),e.render()}insideGrid(){const t=this.micrio.$current;return t==this.image||!!t&&this.imageMap.has(t.id)}async reset(t,e,i){const s=this.history[0];return this.images.forEach(t=>t.camera.stop()),this.image.camera.stop(),this.markersShown.set([]),await Si(),i||e||!this.micrio.camera?.isZoomedOut()||this.micrio.state.$tour||this.$focussed||this.hasChanged()||(t=0),this.set(s?.layout||this.image.$info?.grid,{noHistory:!0,duration:t,noCamAni:e,forceAni:i,horizontal:!!s&&s.horizontal}).then(t=>(this.depth.set(this.history.length=0),this.micrio.current.set(this.image),t))}switchToGrid(){const t=this.$focussed;if(!t)return;const e=t.camera.getView();e&&this.reset(0,!0).then(()=>{t.opts.area&&this.image.camera.setView(t.opts.area,{noLimit:!0}),t.camera.setView(e,{noLimit:!0}),this.micrio.current.set(this.image)})}async flyToMarkers(t,e,i){const s=t?.split("|").map(t=>t.trim()),r=s?.[0]??"",n=r?this.images.filter(t=>!!t.$data?.markers?.find(t=>t.tags?.includes(r))):this.images;return this.set(n.map(t=>{const e=t.$data?.markers?.find(t=>t.tags?.includes(r));return this.getString(t.$info,{view:i?void 0:e?.view})}).join(";"),{duration:e,horizontal:"h"==s?.[1]})}async back(t){const e=this.history.pop();e&&(this.depth.set(this.history.length),this.micrio.current.set(this.image),this.$focussed&&this.blur(),await this.set(e.layout,{duration:t,noHistory:!0,horizontal:e.horizontal,view:e.view}))}setTimingFunction(t){this.micrio.engine.setGridTransitionTimingFunction(Ao.Camera.TimingFunction[this.timingFunction=t])}async focus(t,e={}){if(!t)return this.back();e.coverLimit&&(e.cover=!0);const i=!e.view&&!e.cover,s=this.micrio;wt(s.visible).find(t=>t==this.image)||s.current.set(this.image);const r=this.$focussed;if(r==t)return;e.transition?.startsWith("slide-")||0!=e.duration&&(!r||s.engine.areaAnimating(r.ptr)||this.current.includes(t))||t.camera.setArea([0,0,1,1],{noDispatch:!0,direct:!0}),r&&this.blur(),t.camera.setCoverLimit(!!e.cover),this.setTimingFunction("ease");const n=await this.transition(t,r,this.getString(t.$info,{view:e.view}),e);return s.engine.setZIndex(t.ptr,3),this.focussed.set(t),wt(t.visible)||"crossfade"!=e.transition&&e.transition||(e.duration=0),this.set(n,{noBlur:!0,duration:e.duration,forceAreaAni:"crossfade"!=e.transition,cover:!!e.cover,coverLimit:!!e.coverLimit}).then(()=>{s.events.dispatch("grid-focus",t);const e=t.$info;this.removeGrid(),s.$current!=t&&s.current.set(t);const r=s.offsetWidth/s.offsetHeight,n=(1-e.width/e.height/r)/2;!t.camera.aniDone&&i&&t.camera.flyToFullView({duration:1e3*this.aniDurationIn}).catch(()=>{}),this.image.camera.setLimit([n,0,1-n,1])}).catch(()=>{})}async transition(t,e,i,{duration:s,view:r,transition:n,noViewAni:a,exitView:o,blur:h,cover:c}){if(!n)return i;const{engine:l}=this.micrio;if("crossfade"==n&&(t.camera.setArea([0,0,1,1]),a=!0),r&&a&&t.camera.setView(r,{noRender:!0,noLimit:!0}),!e||"crossfade"==n)return i;const d=n.startsWith("slide")||n.startsWith("swipe"),u=n.startsWith("behind"),m=d?n.endsWith("-up")?0:n.endsWith("-down")?180:n.endsWith("-left")?270:90:void 0;if((d||u)&&l.fadeTo(t.ptr,.9999,!0),n.startsWith("slide"))t.camera.setArea(Po[m],{noDispatch:!0,direct:!0});else if(n.startsWith("swipe"))t.camera.setArea($o[m],{noDispatch:!0,direct:!0}),i=[this.getString(e.$info,{view:o??e.camera.getView(),area:Co[m]}),this.getString(t.$info,{view:r,area:[0,0,1,1]})].join(";");else if(u){t.camera.setArea([0,0,1,1]),t.camera.setView([0,0,1,1]);const i=[this.getString(e.$info,{view:[0,0,1,1]}),this.getString(t.$info,{view:[0,0,1,1]})];"behind-left"==n&&i.reverse(),await this.set(i.join(";"),{noBlur:!0,horizontal:!0,coverLimit:c}).then(()=>Kr(200))}if(h&&!isNaN(h)&&h>0){const t=(s=s??this.nextCrossFadeDuration??this.aniDurationIn)/2,e=this.micrio.canvas.element.style;e.transition=`filter ${t}s ease`,e.filter=`blur(${h}px)`,setTimeout(()=>{e.filter="",setTimeout(()=>e.transform="",1e3*t)},1e3*t)}return i}blur(){const t=this.$focussed;t&&(this.micrio.engine.setZIndex(t.ptr,2),this.micrio.events.dispatch("grid-blur"),this.focussed.set(void 0),this.image.camera.setLimit([0,0,1,1]),this.micrio.current.set(this.image))}tourEvent(t){const e=t.detail;e&&e.action?.startsWith("grid:")&&e.active&&this.action(e.action.slice(5),e.data,e.end-e.start)}action(t,e,i){"string"==typeof t&&(t=Ao.Grid.GridActionType[t]);const s=t+(e??"");if(this.lastAction==s)return;const r=this.actionHandlers[t];r?r(e,i):console.warn("Warning: unknown grid tour event",t),this.lastAction=s}async enlarge(t,e,i=e){return this.set((this.history[this.history.length-1]?.layout||this.image.$info.grid).split(";").map((s,r)=>`${s}|${r==t?`${e},${i}`:1}`).join(";"),{noHistory:!0,keepGrid:!0,duration:500})}getRelativeView(t,e){const i=t.opts.area??[0,0,1,1],s=i[2]-i[0],r=i[3]-i[1];return[i[0]+s*e[0],i[1]+r*e[1],i[0]+s*e[2],i[1]+r*e[3]]}},nl=class t extends HTMLElement{static get observedAttributes(){return["id","muted","data-grid","data-limited","lang"]}static{this.jsonCache=xn}get $current(){return this._current}get camera(){return this._current?.camera}constructor(){super(),this.printed=!1,this.canvases=[],this.current=vt(),this.visible=vt([]),this.canvas=new Vc(this),this.events=new Bc(this),this.state=new Eh.Main(this),this.analytics=new il(this),this._router=new el(this),this.barebone=vt(!1),this.webgl=new Fc(this),this.engine=new Cc(this),this.defaultSettings=this.defaultSettings,this.loading=vt(!0),this.switching=vt(!1),this.isMuted=vt("1"==localStorage.getItem(wn)),this._lang=vt(),this.keepRendering=!1,this.initedFirst=!1,this.loadV5Album=(t,e)=>(t=>"MICRIO_ALBUM"in self?Promise.resolve(self.MICRIO_ALBUM):_n(`${fn}album/${t}.json`))(t).then(t=>{if(!t)return;const i=t.id+"."+t.revision,s=e.path=t.organisation?.baseUrl??"https://r2.micr.io/";return e.organisation=t.organisation,e.settings.album=t,e.settings.gallery={archive:i,sort:t.sort,type:t.type,startId:e.id,isSpreads:t.isSpreads,coverPages:t.coverPages,revisions:t.published},delete e.id,this.loadArchiveBin(s,i).then(()=>this.loadGallery(e,s,!0))},t=>this.printError(t?.message||t)),this.getArchiveIndex=async(t,e=gn)=>Ah.get(`${e}${t}.json`).then(t=>(t.images.forEach(t=>xn.set(`${e}${t.id}/info.json`,t)),t)),this.current.subscribe(t=>this._current=t);let t=!1;en(this.loading,{targetValue:!1}).then(()=>{this.setAttribute("data-loaded",""),this.switching.subscribe(e=>{e?this.setAttribute("data-switching",""):(t||Si().then(()=>this.events.dispatch("show",this)),t=!0,this.removeAttribute("data-switching"))});const e=this.querySelector("img.preview");e&&setTimeout(()=>e.remove(),500)})}attributeChangedCallback(t,e,i){switch(t){case"id":if(!this.isConnected||!i)return;this.printed?this.open(i):this.print();break;case"muted":this.isMuted.set(this.hasAttribute("muted"));break;case"data-grid":this.printed?this.$current?.grid?.set(i):this.print();break;case"data-limited":this.engine?._vertexBuffer&&this.$current?.ptr&&this.engine.setLimited(this.$current.ptr,!!i);break;case"lang":{let t=wt(this._lang);t!=i&&(this._lang.set(i),Jn.set(Zn[i]??Zn.en),i&&(ta.includes(i)?this.setAttribute("dir","rtl"):this.removeAttribute("dir")),t&&this.events.dispatch("lang-switch",i));break}}}connectedCallback(){this.canvas.place(),(this.hasAttribute("data-router")||this.hasAttribute("data-space"))&&"false"!=this.getAttribute("data-router")&&this._router.hook(),!this.id&&!this.hasAttribute("data-gallery")||this.printed||this.print(),"muted"in this||(Object.defineProperty(this,"muted",{get(){return wt(this.isMuted)},set(t){t?this.setAttribute("muted",""):this.removeAttribute("muted")}}),this.isMuted.subscribe(t=>{this.muted=t,t?(localStorage.setItem(wn,"1"),this.events.dispatch("audio-mute")):(localStorage.removeItem(wn),this.events.dispatch("audio-unmute"))}))}addEventListener(t,e,i){super.addEventListener(t,e,i)}removeEventListener(t,e,i){super.removeEventListener(t,e,i)}destroy(){this.current.set(void 0),this._router.unhook(),this.events.enabled.set(!1),this.canvas.unhook(),this.analytics.unhook(),this.engine.unbind(),this._ui&&ds(this._ui),delete this._ui,this.webgl.dispose(!0),this.printed=!1}loadArchiveBin(t,e){return this.printUI(!0,!0),Ah.load(t,"g/"+e,t=>this._ui?.setProps?.({loadingProgress:t}))}async print(){if(this.printed)return;this.printed=!0,await Si();const t=this.getOptions();if(t.settings||(t.settings={}),t.settings.noControls&&this.state.ui.controls.set(!1),t.settings.gallery?.archive){const e=t.settings.gallery?.archive,i=/\.\d+$/.test(e),s=t.path||(An(e.replace(/\.\d+$/,""))?"https://r2.micr.io/":"https://b.micr.io/");i&&await this.loadArchiveBin(s,e),t.settings.gallery.startId=t.id,t.grid?await this.setGrid(t,s):await this.loadGallery(t,s,i),i||delete t.settings.gallery.archive,t.path||(t.path=s),delete t.id}else t.id?.startsWith("album/")?await this.loadV5Album(t.id.replace("album/",""),t):t.id&&An(t.id)&&!this.hasAttribute("width")&&!this.hasAttribute("height")&&await Sn(t.id,t.forceInfoPath?t.path:void 0,t.settings?.forceDataRefresh).then(e=>e?.albumId?this.loadV5Album(e.albumId,t):void 0).catch(()=>{});this.keepRendering=!!t.settings.keepRendering;const e=t.id||t.gallery||t.grid;if(this.events.dispatch("print",t),void 0!==t.settings.lazyload&&"IntersectionObserver"in window){const i=new IntersectionObserver(s=>{s[0]&&s[0].isIntersecting&&(i.unobserve(this),e&&this.open(t))},{rootMargin:100*t.settings.lazyload+"% 0px"});i.observe(this)}else e&&requestAnimationFrame(()=>this.open(t))}printUI(e,i){this._ui?this._ui.setProps?.({noHTML:e,noLogo:i}):this._ui=as(t.Svelte,{target:this,props:{micrio:this,noHTML:e,noLogo:i}})}printError(t){const e=t instanceof Nr?t.displayMessage:(t instanceof Error?t.message:t)??"An unknown error has occurred";console.error("Error:",e+(t instanceof Nr?` (${t.code}: ${t.message})`:"")),this._ui?.setProps?.({error:e})}open(t,e={}){this.printed||this.print();const i="string"==typeof t,s=this.getOptions();let r=i?{...s,id:t}:t;if(r.settings||(r.settings={}),s.settings?.gallery?.archive&&(/\.\d+$/.test(s.settings.gallery.archive)||delete s.settings.gallery.archive),i||Wr(s.settings,r.settings),this.defaultSettings&&Wr(this.defaultSettings,r.settings),this.$current&&r.id==this.$current?.id)return this.$current;e.splitScreen||e.gridView||!this.$current||this.switching.set(!0),r.settings.noGTag||this.analytics.hook(),this.printed=!0,this.printUI(!!r.settings.noUI,!!r.settings.noLogo);let n=this.canvases.find(t=>r.id&&t.id==r.id),a=!1;const o=this.canvases[0]?.grid;if(!n&&o){const t=r.id?o.images.find(t=>t.id==r.id):void 0;a=!!t,n=r.id?t:this.canvases[0],a&&!o.insideGrid()&&this.current.set(this.canvases[0])}if(!n){this.canvases.length&&(r.path=this.canvases[0].dataPath,r.lang=this.lang),this.canvases.push(n=new Ph(this.engine,r,e.splitScreen?{secondaryTo:e.splitTo??this._current,isPassive:e.isPassive}:void 0));const t=this.state.value&&this.state.value.c.find(t=>t[0]==r.id);t&&n.state.set(t)}e.startView&&(n.state.view.set(r.settings.view=e.startView),n.ptr>0&&n.engine.ready&&n.camera.setView(r.settings.view,{noRender:!0})),this.lang||(this.lang="en");const h=()=>{if(n){if(!this.webgl.gl)try{this.webgl.init()}catch(t){return void this.printError(t)}en(n.info).then(t=>{if(t&&n){if(!this.initedFirst){switch(this.canvas.hook(),this._current?.$settings?.theme){case"light":this.setAttribute("data-light-mode","");break;case"os":this.setAttribute("data-auto-scheme","")}this.initedFirst=!0}t.grid&&!n.grid&&(n.grid=new rl(this,n)),Si().then(()=>this.dispatchEvent(new CustomEvent("load",{detail:n}))),e.splitScreen&&Si().then(()=>{n&&(o?.image.camera.aniDoneAdd&&o.image.camera.aniDoneAdd.length>0?o.image.camera.aniDoneAdd.push(()=>n?.splitStart()):n.splitStart())})}}),this.engine.set360Orientation(e.vector?.direction??0,e.vector?.distanceX??0,e.vector?.distanceY??0),this.engine.preventDirectionSet=!e.vector,!a||e.gridView&&o?.current.find(t=>t.id==r.id)?e.splitScreen?this.engine.setCanvas(n):this.current.set(n):o?.focus(n,{view:r.settings?.view}).then(()=>this.current.set(n))}};return this.engine.ready?h():this.engine.load().then(h).catch(t=>this.printError(t)),n.noImage&&this.loading.set(!1),n}close(t){t.opts.secondaryTo?t.splitEnd():this.engine.removeCanvas(t)}getOptions(){const t={gallery:{}},e={settings:t,id:this.id},i=(t,e,i)=>{const s=e.split(".");for(let r=0;r<s.length-1;r++)t=t[s[r]];t[s[s.length-1]]=i};for(const s in bn.STRINGS){const r=bn.STRINGS[s],n=this.getAttribute(s),a=r.f||s.replace("data-","");n&&i(r.r?e:t,a,n)}for(const s in bn.BOOLEANS){const r=bn.BOOLEANS[s],n=this.getAttribute(s),a=r.f||s.replace("data-",""),o=null!=n&&""==n||"true"==n;(o||"false"==n)&&i(r.r?e:t,a,r.n?!o:!!o)}for(const s in bn.NUMBERS){const r=bn.NUMBERS[s],n=r.f||s.replace("data-","");let a=this.getAttribute(s);void 0!==r.dN&&null==a&&(a=r.dN),null==a||isNaN(Number(a))||i(r.r?e:t,n,Number(a))}for(const s in bn.ARRAYS){const r=bn.ARRAYS[s],n=this.getAttribute(s),a=r.f||s.replace("data-","");null!=n&&i(r.r?e:t,a,n.split(",").map(t=>Number(t)))}return t.static&&(t.noUI=t.skipMeta=!0,t.hookEvents=!1),e.settings&&e.grid&&e.grid.indexOf(".")>0&&(e.settings.gallery.archive=e.grid),e}async loadGallery(t,e,i){let s=t.settings?.gallery,r=s?.archive;if(!s||!r)return;const n=t.settings;if(i){const t=await this.getArchiveIndex(r.split(".")[0],e);s.archiveLayerOffset=t.delta,r=t.images.sort("name"==s.sort?(t,e)=>t.title&&e.title?t.title<e.title?-1:t.title>e.title?1:0:0:"-name"==s.sort?(t,e)=>t.title&&e.title?t.title<e.title?1:t.title>e.title?-1:0:0:"-created"==s.sort?(t,e)=>t.created&&e.created?t.created<e.created?1:t.created>e.created?-1:0:0:(t,e)=>t.created&&e.created?t.created<e.created?-1:t.created>e.created?1:0:0).map(t=>`${t.id},${t.width},${t.height},${t.isDeepZoom?"d":""},${t.isPng?"p":t.isWebP?"w":""},${t.tileSize||""}`.replace(/\,+$/,"")).join(";")}const a=r.split(";").map(t=>t.trim());if(!i){const t=a.filter(t=>t.startsWith("http")).map(t=>_n(t));t.length&&await Promise.all(t).then(t=>t.forEach((t,e)=>{t&&(a[e]=`${t["@id"]},${t.width},${t.height}`)}))}const o=a.map(t=>t.split(",").map(t=>isNaN(t)?t:Number(t)));o.forEach((t,e)=>{e>0&&!t[2]&&t.push(...o[e-1].slice(1))}),s.type||(s.type="swipe");const h="switch"==s.type||"swipe-full"==s.type||"omni"==s.type,c=s.isSpreads;if(!h){t.width=this.offsetWidth*this.canvas.getRatio(),t.height=this.offsetHeight*this.canvas.getRatio();const i=Math.max(0,o.findIndex(t=>t[0]==s.startId));return t.gallery=o.map((t,r)=>new Ph(this.engine,{id:t[0],path:e,width:t[1],height:t[2],isDeepZoom:"d"==t[3],isPng:"p"==t[4],isWebP:"w"==t[4],tileSize:t[5]||1024,revision:s?.revisions?.[t[0]],settings:{skipMeta:!0,gallery:s}},{area:[r-i,0,r-i+1,1]})),void(n.view=[0,0,1,1])}t.height=Math.max(...o.map(t=>t[2]));const l=c?s.coverPages??0:0;t.width=Math.max(...o.map(t=>t[1]*(c?2:1))),t.gallery=o.map((t,i)=>new Ph(this.engine,{id:t[0],path:e,width:t[1],height:t[2],isDeepZoom:"d"==t[3],isPng:"p"==t[4],isWebP:"w"==t[4],tileSize:t[5]||1024,revision:s?.revisions?.[t[0]],settings:{skipMeta:!0,gallery:s}},{isEmbed:!0,useParentCamera:!0,area:c?i-l<0||i==o.length-1&&(i-l)%2==0?[.25,0,.75,1]:(i-l)%2==0?[0,0,.5,1]:[.5,0,1,1]:[0,0,1,1]})),n.pinchZoomOutLimit=!0,t.gallery.length&&(n.view=rn.fromLegacy(t.gallery[Math.max(0,t.gallery.findIndex(t=>t.id==s.startId))].opts.area))}async setGrid(t,e){t.settings&&t.grid&&(t.settings.gallery?.archive==t.grid&&(this.gridInfoData=await this.getArchiveIndex(t.grid.split(".")[0],e),t.grid=this.gridInfoData.images.map(t=>rl.getString(t,{cultures:"cultures"in t?t.cultures.join("-"):void 0})).join(";")),t.width=this.offsetWidth*this.canvas.getRatio(),t.height=this.offsetHeight*this.canvas.getRatio(),t.settings.zoomLimit=15,t.settings.minimap=!1,t.settings.initType="cover",this.removeAttribute("data-grid"))}get lang(){return wt(this._lang)}set lang(t){this.setAttribute("lang",t)}};nl.Svelte=function(t,e){et(e,!0);const i=()=>xt(Ei(E),"$settings",l),s=()=>xt(Ei(M),"$info",l),r=()=>xt(Ei(S),"$data",l),n=()=>xt(x,"$tour",l),a=()=>xt($,"$volume",l),o=()=>xt(w,"$visible",l),h=()=>xt(k,"$markerPopup",l),c=()=>xt(_,"$popover",l),[l,d]=kt();let u=br(e,"noHTML",15),m=br(e,"noLogo",23,u),g=br(e,"loadingProgress",7,1),p=br(e,"error",7,void 0);tt("micrio",Li(()=>e.micrio)),tt("markerImages",new Map);const f=Li(()=>"markers"==e.micrio.getAttribute("data-ui"));f&&u(!0);const v=Li(()=>"false"!=e.micrio.getAttribute("data-embeds")),{visible:w,state:y,isMuted:b}=Li(()=>e.micrio),{tour:x,marker:T,popup:k,popover:_}=y;let M=ne(void 0),S=ne(void 0),E=ne(void 0);function I(t,e){if(e)for(let i,s=0;s<e.length;s++)if(e[s].id==t||(i=I(t,e[s].children)))return i??e[s]}let A=ne(!1),L=ne(void 0);const P=[];Li(()=>e.micrio).current.subscribe(t=>{t&&(Tt(oe(M,t.info,!0),"$info",l),Tt(oe(E,void 0),"$settings",l),Ei(M)&&en(Ei(M)).then(e=>{e&&(oe(A,!0),Tt(oe(E,t.settings,!0),"$settings",l),!Ei(L)&&e.organisation?.logo&&oe(L,e.organisation,!0))}),Tt(oe(S,t.data,!0),"$data",l)&&P.indexOf(t.id)<0&&en(Ei(S)).then(async i=>{if(!i)return;if(P.push(t.id),await Si().then(Si),wt(e.micrio.state.popover)||wt(e.micrio.state.marker)||wt(e.micrio.state.tour))return;const s=t.$settings.start;if(s)switch(s.type){case"marker":t.state.marker.set(s.id);break;case"markerTour":const r=i.markerTours?.find(t=>t.id==s.id);r&&e.micrio.state.tour.set(r);break;case"tour":const n=i.tours?.find(t=>t.id==s.id);n&&e.micrio.state.tour.set(n);break;case"page":const a=I(s.id,i.pages);a&&e.micrio.state.popover.set({contentPage:a,showLangSelect:!0})}}))});const $=vt(xt(b,"$isMuted",l)?0:1);tt("volume",$),b.subscribe(t=>$.set(t?0:1)),tt("mediaPaused",vt(!1));let C=ne(!1),D=ne(ue([]));tt("srt",vt()).subscribe(t=>setTimeout(()=>{oe(D,t?[t]:[],!0)},20));const z=jt(()=>i()?._360?.video),O=jt(()=>Ei(z)?.src),R=jt(()=>i()?.omni),X=jt(()=>s()?.gallery),F=jt(()=>r()?.markers?.filter(t=>!!t.positionalAudio)),V=jt(()=>!!r()?.music?.items.length||!!Ei(F)?.length),Y=jt(()=>n()||xt(T,"$marker",l)),N=jt(()=>!u()||f),B=jt(()=>!(m()||s()&&u()||i()?.noLogo)),W=jt(()=>u()||!Ei(B)||i()?.noOrgLogo?void 0:Ei(L)),U=jt(()=>!(u()||Ei(R)||e.micrio.spaceData||n()||s()?.gallery)),H=jt(()=>!!Ei(X)||!!Ei(R)),G=jt(()=>!u()&&!!s()),j=jt(()=>!u()&&!Ei(Y)&&i()?.showInfo),Z=jt(()=>!u()&&Ei(A)&&!i()?.noToolbar);var J={setProps:function(t){"error"in t&&p(t.error),void 0!==t.noHTML&&u(t.noHTML),void 0!==t.noLogo&&m(t.noLogo),void 0!==t.loadingProgress&&g(t.loadingProgress)}},K=Gh(),Q=_e(K),st=t=>{{let e=jt(()=>!!s().is360);Zo(t,{get volume(){return a()},get data(){return r()},get is360(){return Ei(e)}})}};vs(Q,t=>{Ei(V)&&r()&&s()&&t(st)});var rt=Me(Q,2),nt=t=>{so(t,yr({get src(){return Ei(O)},get volume(){return a()},is360:!0,get width(){return s().width},get height(){return s().height}},()=>Ei(z)))};vs(rt,t=>{Ei(O)&&s()&&t(nt)});var at=Me(rt,2),ot=t=>{var e=Hi();bs(_e(e),1,()=>r().embeds,t=>t.uuid,(t,e)=>{zh(t,{get embed(){return Ei(e)}})}),Gi(t,e)};vs(at,t=>{v&&r()&&r().embeds&&t(ot)});var ht=Me(at,2),ct=t=>{Hn(t,{})};vs(ht,t=>{Ei(B)&&t(ct)});var lt=Me(ht,2),dt=t=>{va(t,{})};vs(lt,t=>{Ei(Z)&&t(dt)});var ut=Me(lt,2),mt=t=>{var e=Hi();bs(_e(e),1,o,t=>t.uuid,(t,e)=>{Bh(t,{get image(){return Ei(e)}})}),Gi(t,e)};vs(ut,t=>{Ei(N)&&t(mt)});var gt=Me(ut,2),pt=t=>{var e=Hi();bs(_e(e),1,()=>o().filter(t=>t.$settings.minimap),t=>t.uuid,(t,e)=>{ya(t,{get image(){return Ei(e)}})}),Gi(t,e)};vs(gt,t=>{Ei(U)&&t(pt)});var ft=Me(gt,2),yt=t=>{{let e=jt(()=>Ei(V)||!(!Ei(O)||!Ei(z)||Ei(z).muted));La(t,{get hasAudio(){return Ei(e)}})}};vs(ft,t=>{Ei(G)&&t(yt)});var bt=Me(ft,2),_t=t=>{var e=Wh(),i=_e(e),s=t=>{No(t,{get images(){return Ei(X)},get omni(){return Ei(R)}})};vs(i,t=>{Ei(H)&&t(s)});var r=Me(i,2),n=t=>{jn(t,{get organisation(){return Ei(W)}})};vs(r,t=>{Ei(W)&&t(n)});var a=Me(r,2),o=t=>{ih(t,{get info(){return Ei(M)},get data(){return Ei(S)}})};vs(a,t=>{Ei(j)&&Ei(M)&&Ei(S)&&t(o)}),Gi(t,e)};vs(bt,t=>{(Ei(H)||Ei(W)||Ei(j)&&Ei(M)&&Ei(S))&&t(_t)});var Mt=Me(bt,2),St=t=>{var e=Uh(),i=_e(e),s=t=>{wo(t,{get marker(){return h()}})};vs(i,t=>{h()&&t(s)});var r=Me(i,2),a=t=>{Io(t,{get tour(){return n()},get noHTML(){return u()},onminimize:t=>oe(C,!t)})};vs(r,t=>{n()&&t(a)});var o=Me(r,2),l=t=>{vh(t,{get popover(){return c()}})};vs(o,t=>{c()&&t(l)}),Gi(t,e)};vs(Mt,t=>{(h()||n()||c())&&t(St)});var Et=Me(Mt,2);bs(Et,16,()=>Ei(D),t=>t,(t,e)=>{Va(t,{get src(){return e},get raised(){return Ei(C)}})});var It=Me(Et,2),At=t=>{var e=Hh(),i=_e(e),s=t=>{!function(t,e){var i=sh(),s=ke(i);sa(s,{name:"error"});var r=Me(s);q(i),Ye(()=>ns(r,` ${e.message??""}`)),Gi(t,i)}(t,{get message(){return p()}})};vs(i,t=>{p()&&t(s)});var r=Me(i,2),n=t=>{!function(t,e){const i=2*Math.PI*40,s=jt(()=>i*(1-e.progress));var r=qh();ar(r,"viewBox","0 0 100 100");var n=ke(r);ar(n,"r",40),ar(n,"cx",50),ar(n,"cy",50);var a=Me(n);ar(a,"r",40),ar(a,"cx",50),ar(a,"cy",50),ar(a,"stroke-dasharray","251.32741228718345px"),q(r),Ye(()=>ar(a,"stroke-dashoffset",`${Ei(s)??""}px`)),Ds(1,r,()=>qn,()=>({delay:500})),Ds(2,r,()=>qn),Gi(t,r)}(t,{get progress(){return g()}})};vs(r,t=>{g()<1&&t(n)}),Gi(t,e)};vs(It,t=>{(p()||g()<1)&&t(At)}),Gi(t,K);var Lt=it(J);return d(),Lt},nl.VERSION=mn,customElements.define("micr-io",nl),console.info("%c◈%c Micrio %cv6.0.2 - https://micr.io/","color: #00d4ee","color: #c5ff5b","color: inherit")}();