@micrio/client 6.1.14 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/micrio.min.d.ts +2145 -3226
- package/micrio.min.js +4 -7
- package/package.json +1 -1
- package/micrio.min.b.js +0 -381
- package/micrio.min.tar.bz2 +0 -0
package/micrio.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* Micrio Client
|
|
2
|
-
* Copyright (C) 2015 -
|
|
1
|
+
/* Micrio Client 7.0.0
|
|
2
|
+
* Copyright (C) 2015 - present Q42 Internet B.V., Micrio <https://micr.io>
|
|
3
3
|
*
|
|
4
4
|
* GitHub: https://github.com/Q42/Micrio.Client
|
|
5
5
|
* npm: https://www.npmjs.com/package/@micrio/client
|
|
@@ -23,8 +23,5 @@
|
|
|
23
23
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
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:fixed;top:0;left:0}micr-io>.micrio-grid>button{cursor:pointer;pointer-events:auto;pointer-events:auto;background:0 0;border:none;grid-area:auto/auto/span 1/span 1;margin:0;padding:0}micr-io>.micrio-grid>button.focussed,micr-io>.micrio-grid.grid-pan-zoom,micr-io>.micrio-grid.grid-pan-zoom>button{pointer-events:none}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}aside.grid-close.micrio-controls{top:var(--micrio-border-margin);bottom:auto}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.force-hidden.micrio-gallery>ul,div.force-hidden.micrio-gallery>button.gallery-btn{opacity:0;pointer-events:none}div.force-hidden.micrio-gallery>ul{transform:translate(-50%, calc(100% + var(--micrio-border-margin)))}div.force-hidden.micrio-gallery>button.gallery-btn.arrow-left{transform:translate(calc(-100% - var(--micrio-border-margin)), -50%)}div.force-hidden.micrio-gallery>button.gallery-btn.arrow-right{transform:translate(calc(100% + var(--micrio-border-margin)), -50%)}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:#0000}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}.embed-container.hide-when-paused.micrio-embed:has(figure.paused){opacity:0}.embed-container.inactive.micrio-embed{opacity:0;pointer-events: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
|
-
/*$vite$:1*/`;
|
|
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,M=1<<25,_=65536,S=1<<19,E=1<<25,A=65536,I=1<<21,L=1<<23,P=Symbol("$state"),C=Symbol("legacy props"),$=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,Y=!1;function V(t){Y=t}function N(e){if(null===e)throw X(),t;return F=e}function B(){return N(Te(F))}function q(e){if(Y){if(null!==Te(F))throw X(),t;F=e}}function W(t=1){if(Y){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 Z(t,e){return t!=t?e==e:t!==e||null!==t&&"object"==typeof t||"function"==typeof t}function j(t){return!Z(t,this.v)}var K=null;function J(t){K=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){K={p:K,i:!1,c:null,e:null,s:t,x:null,r:hi,l:null}}function it(t){var e=K,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,K=e.p,t??{}}function st(t){return null===K&&O(),K.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}(K)||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&&!At){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<|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^=A,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(Z(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 Mt=new Set,_t=null,St=null,Et=null,At=!1,It=!1,Lt=null,Pt=null,Ct=0,$t=1,Dt=class t{id=$t++;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(Ct++>1e3&&(Mt.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(_t=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)Vt(t,e)}else{0===this.#s.size&&Mt.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=_t;if(this.#a.length>0){const t=a??=this;t.#a.push(...this.#a.filter(e=>!t.#a.includes(e)))}null!==a&&(Mt.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),_i(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(){_t=this}deactivate(){_t=null,St=null}flush(){try{It=!0,_t=this,this.#f()}finally{Ct=0,Et=null,Lt=null,Pt=null,It=!1,_t=null,St=null,ie.clear()}}discard(){for(const t of this.#e)t(this);this.#e.clear(),this.#i.clear(),Mt.delete(this)}register_created_effect(t){this.#o.push(t)}#y(){for(const c of Mt){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 Mt)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===_t){const e=_t=new t;It||(Mt.add(_t),At||at(()=>{_t===e&&e.flush()}))}return _t}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=At;At=!0;try{var i;for(t&&(null===_t||_t.is_fork||_t.flush(),i=t());;){if(ot(),null===_t)return i;_t.flush()}}finally{At=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,_i(s),null===s.deps&&null===s.first&&null===s.nodes&&null===s.teardown&&null===s.ac&&Ze(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||_i(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),Yt(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 Yt(t){_t.schedule(t)}function Vt(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;)Vt(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=Y?F:null;#T;#k;#M;#_=null;#S=null;#E=null;#A=null;#I=0;#L=0;#P=!1;#h=new Set;#c=new Set;#C=null;#$=function(t){let e,i=0,s=re(0);return()=>{ze()&&(Ei(s),Ye(()=>(0===i&&(e=Li(()=>t(()=>le(s)))),i+=1,()=>{at(()=>{i-=1,0===i&&(e?.(),e=void 0,le(s))})})))}}(()=>(this.#C=re(this.#I),()=>{this.#C=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.#M=Ne(()=>{if(Y){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),Y&&(this.#b=F)}#O(){try{this.#_=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.#A=document.createDocumentFragment(),e=be();t.append(e),this.#_=this.#X(()=>qe(()=>this.#k(e))),0===this.#L&&(this.#b.before(t),this.#A=null,je(this.#S,()=>{this.#S=null}),this.#F(_t))}))}#R(){try{if(this.is_pending=this.has_pending_snippet(),this.#L=0,this.#I=0,this.#_=qe(()=>{this.#k(this.#b)}),this.#L>0){var t=this.#A=document.createDocumentFragment();ti(this.#_,t);const e=this.#T.pending;this.#S=qe(()=>e(this.#b))}else this.#F(_t)}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=K;ci(this.#M),oi(this.#M),J(this.#M.ctx);try{return Dt.ensure(),t()}catch(r){return ht(r),null}finally{ci(e),oi(i),J(s)}}#Y(t,e){this.has_pending_snippet()?(this.#L+=t,0===this.#L&&(this.#F(e),this.#S&&je(this.#S,()=>{this.#S=null}),this.#A&&(this.#b.before(this.#A),this.#A=null))):this.parent&&this.parent.#Y(t,e)}update_pending_count(t,e){this.#Y(t,e),this.#I+=t,this.#C&&!this.#P&&(this.#P=!0,at(()=>{this.#P=!1,this.#C&&he(this.#C,this.#I)}))}get_effect_pending(){return this.#$(),Ei(this.#C)}error(t){if(!this.#T.onerror&&!this.#T.failed)throw t;_t?.is_fork?(this.#_&&_t.skip_effect(this.#_),this.#S&&_t.skip_effect(this.#S),this.#E&&_t.skip_effect(this.#E),_t.on_fork_commit(()=>{this.#V(t)})):this.#V(t)}#V(t){this.#_&&(He(this.#_),this.#_=null),this.#S&&(He(this.#S),this.#S=null),this.#E&&(He(this.#E),this.#E=null),Y&&(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&&je(this.#E,()=>{this.#E=null}),this.#X(()=>{this.#R()}))},a=s=>{try{r=!0,e?.(s,n),r=!1}catch(t){ct(t,this.#M&&this.#M.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.#M.parent),null}}))};at(()=>{var e;try{e=this.transform_error(t)}catch(i){return void ct(i,this.#M&&this.#M.parent)}null!==e&&"object"==typeof e&&"function"==typeof e.then?e.then(a,t=>ct(t,this.#M&&this.#M.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=K,s=_t;return function(r=!0){ci(t),oi(e),J(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),J(null),t&&_t?.deactivate()}function Ut(){var t=hi,e=t.b,i=_t,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:K,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=_t;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 Zt(t){const e=Ht(t);return di(e),e}function jt(t){const e=Ht(t);return e.equals=j,e}function Kt(t){var e=t.effects;if(null!==e){t.effects=null;for(var i=0;i<e.length;i+=1)He(e[i])}}function Jt(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,Kt(t),e=Ti(t)}finally{ci(i)}return e}function Qt(t){var e=Jt(t);t.equals(e)||(t.wv=yi(),_t?.is_fork&&null!==t.deps||(null!==_t?_t.capture(t,e,!0):t.v=e,null!==t.deps))?si||(null!==St?(ze()||_t?.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&&_i(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=j),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&&Jt(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)&&_i(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|=A),de(c,x,i))}else if(h){var l=a;16&o&&null!==Ot&&Ot.add(l),null!==i?i.push(l):Yt(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(!Y)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&&Ae(i),N(i),i}function Me(t,e=!1){if(!Y){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}Ae(F)}return F}function _e(t,e=1,i=!1){let s=Y?F:t;for(var r;e--;)r=s,s=Te(s);if(!Y)return s;if(i){if(3!==s?.nodeType){var n=be();return null===s?r?.after(n):s.before(n),N(n),n}Ae(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 Ae(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 Ie(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 Ce(t){var e=ni,i=hi;oi(null),ci(null);try{return t()}finally{oi(e),ci(i)}}function $e(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:K,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};_t?.register_created_effect(s);var r=s;if(4&t)null!==Lt?Lt.push(s):Dt.ensure().schedule(s);else if(null!==e){try{_i(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|=_))}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){$e();var e=hi.f;if(ni||!(32&e)||32768&e)return Xe(t);var i=K;(i.e??=[]).push(t)}function Xe(t){return De(1048580,t)}function Fe(t){return De(4,t)}function Ye(t,e=0){return De(8|e,t)}function Ve(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&&Ce(()=>{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,M),Ue(t,e&&!i),Mi(t,0);var s=t.nodes&&t.nodes.t;if(null!==s)for(const n of s)n.stop();We(t),t.f^=M,t.f|=16384;var r=t.parent;null!==r&&null!==r.first&&Ze(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 Ze(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 je(t,e,i=!0){var s=[];Ke(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 Ke(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))Ke(r,e,!!(!!(65536&r.f)||!!(32&r.f)&&!!(16&t.f))&&i);r=n}}}function Je(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),Yt(a))}}function Ti(t){var e=ui,i=mi,s=gi,r=ni,n=li,a=K,o=ai,h=vi,c=t.f;ui=null,mi=0,gi=null,ni=96&c?null:t,li=null,J(t.ctx),ai=!1,vi=++fi,null!==t.ac&&(Ce(()=>{t.ac.abort(D)}),t.ac=null);try{t.f|=I;var l=(0,t.fn)();t.f|=k;var d=t.deps,u=_t?.is_fork;if(null!==ui){var m;if(u||Mi(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&&(Mi(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^=I,ui=e,mi=i,gi=s,ni=r,li=n,J(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,Mi(e,0),Ue(e))}(h),Mi(h,0)}}function Mi(t,e){var i=t.deps;if(null!==i)for(var s=e;s<i.length;s++)ki(t,i[s])}function _i(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)&&!Ii(r)||(a=Jt(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),Ai(r))}if(St?.has(t))return St.get(t);if(8388608&t.f)throw t.v;return t.v}function Ai(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),Ai(e))}function Ii(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&&Ii(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 Ci=Symbol("events"),$i=new Set,Di=new Set;function zi(t,e,i,s={}){function r(t){if(s.capture||Fi.call(e,t),!t.cancelBubble)return Ce(()=>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[Ci]??={})[t]=i}function Xi(t){for(var e=0;e<t.length;e++)$i.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[Ci];if(o){var c=r.indexOf(o);if(-1!==c&&(e===document||e===window))return void(t[Ci]=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[Ci]?.[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[Ci]=e,delete t.currentTarget,oi(d),ci(u)}}}var Yi=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function Vi(t){var e=Ee("template");return e.innerHTML=function(t){return Yi?.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(Y)return Ni(F,null),F;void 0===i&&(i=Vi(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(Y)return Ni(F,null),F;if(!s){var t=xe(Vi(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(!Y){var e=be(t+"");return Ni(e,e),e}var i=F;return 3!==i.nodeType?(i.before(i=be()),N(i)):Ae(i),Ni(i,i),i}function Hi(){if(Y)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(Y){var i=hi;return 32768&i.f&&null!==i.nodes.end||(i.nodes.end=F),void B()}null!==t&&t.before(e)}function Zi(t){return t.endsWith("capture")&&"gotpointercapture"!==t&&"lostpointercapture"!==t}var ji=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Ki(t){return ji.includes(t)}var Ji={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(),Ji[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=Y,n=F;try{for(var a=xe(s);a&&(8!==a.nodeType||"["!==a.data);)a=Te(a);if(!a)throw t;V(!0),N(a);const r=cs(e,{...i,anchor:a});return V(!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),V(!1),as(e,i)}finally{V(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?je(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&&(K.c=o),n&&(r.$$events=n),Y&&Ni(i,null),ss=h,l=e(i,r)||{},ss=!0,Y&&(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($i)),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)Je(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),je(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=_t;!e||this.#B.has(t)||this.#q.has(t)||this.#B.set(t,qe(()=>e(this.anchor)));this.#N.set(i,t),Y&&(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)))},_)}function ps(t){null===K&&O(),Re(()=>{const e=Li(t);if("function"==typeof e)return e})}function fs(t){null===K&&O(),ps(()=>()=>Li(t))}function vs(t,e,i=!1){var s;Y&&(s=F,B());var r=new ms(t);function n(t,e){if(Y){var i=H(s);if(t!==parseInt(i.substring(1))){var n=U();return N(n),r.anchor=n,V(!1),r.ensure(t,e),void V(!0)}}r.ensure(t,e)}Ne(()=>{var t=!1;e((e,i=0)=>{t=!0,n(i,e)}),t||n(-1,null)},i?_: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=Y?N(xe(l)):l.appendChild(be())}Y&&B();var d,u=null,m=jt(()=>{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&&(Je(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),Ms(t,p,c),Ms(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]);Ms(t,x.prev,T.next),Ms(t,p,x),Ms(t,T,b),g=b,p=T,l-=1,f=[],v=[]}else n.delete(c),ks(c,g,i),Ms(t,c.prev,c.next),Ms(t,c,null===p?t.effect.first:p.next),Ms(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 M=k.length;if(M>0){var _=4&s&&0===u?i:null;if(d){for(l=0;l<M;l+=1)k[l].nodes?.a?.measure();for(l=0;l<M;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];je(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,_)}}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)):Je(u):je(u,()=>{u=null})))}var v={effect:Ne(()=>{var t=(d=Ei(m)).length;let s=!1;Y&&"[!"===H(h)!=(0===t)&&(N(h=U()),V(!1),s=!0);for(var a=new Set,l=_t,v=0;v<t;v+=1){Y&&8===F.nodeType&&"]"===F.data&&(h=F,s=!0,V(!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(),Y&&t>0&&N(U()),p||(g.set(l,a),f(l)),s&&V(!0),Ei(m)}),flags:e,items:c,pending:g,outrogroups:null,fallback:u};p=!1,Y&&(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 Ms(t,e,i){null===e?t.effect.first=i:e.next=i,null===i?t.effect.last=e:i.prev=e}function _s(e,s,r=!1,n=!1,a=!1,o=!1){var h=e,c="";if(r){var l=e;Y&&(h=N(xe(l)))}Ve(()=>{var e=hi;if(c!==(c=s()??"")){if(r&&!Y)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(Y){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 Y&&B()})}var Ss=()=>performance.now(),Es={tick:t=>requestAnimationFrame(t),now:()=>Ss(),tasks:new Set};function As(){const t=Es.now();Es.tasks.forEach(e=>{e.c(t)||(Es.tasks.delete(e),e.f())}),0!==Es.tasks.size&&Es.tick(As)}function Is(t,e){Ce(()=>{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 Cs=t=>t;function $s(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 Ce(()=>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,()=>{Is(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,()=>{Is(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 Is(t,n?"introstart":"outrostart"),r(),{abort:f,deactivate:f,reset:f,t:()=>s};const{delay:h=0,css:c,tick:l,easing:d=Cs}=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(),Is(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(As),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=Y;Y&&B();var h=null;Y&&1===F.nodeType&&(h=F,B());var c=Y?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=Y?h:Ee(t,a),h),r){Y&&(s=t,is.includes(s))&&h.append(document.createComment(""));var i=Y?xe(h):h.appendChild(be());Y&&(null===i?V(!1):N(i)),$s(l),r(h,i),$s(null)}hi.nodes.end=h,e.before(h)}var s;Y&&N(e)}),rs(!0),()=>{t&&rs(!1)})},_),Oe(()=>{rs(!0)}),o&&(V(!0),N(c))}function Rs(t,e,i){Fe(()=>{var s=Li(()=>e(t,i?.())||{});if(i&&s?.update){var r=!1,n={};Ye(()=>{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&&Z(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 Ys(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 Vs=[..." \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(Y||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&&!Vs.includes(s[a-1])||o!==s.length&&!Vs.includes(s[o])?a=o:s=(0===a?"":s.substring(0,a))+s.substring(o+1)}return""===s?null:s}(i,s,n);Y&&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(Y||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);Y&&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 Zs=Symbol("class"),js=Symbol("style"),Ks=Symbol("is custom element"),Js=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(Y){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);Y&&(r[e]=t.getAttribute(e),"src"===e||"srcset"===e||"href"===e&&t.nodeName===Qs)||r[e]!==(r[e]=i)&&("loading"===e&&(t[$]=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=Y;Y&&V(!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&&V(!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(Y&&n&&t.nodeName===tr){var a=t;("checkbox"===a.type?"defaultChecked":"defaultValue")in s||rr(a)}var o=cr(t),h=o[Ks],c=!o[Js];let l=Y&&h;l&&V(!1);var d=i||{},u=t.nodeName===er;for(var m in i)m in s||(s[m]=null);s.class?s.class=Ys(s.class):(r||s[Zs])&&(s.class=null),s[js]&&(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={},M="$$"+x;let _=x.slice(2);var v=Ki(_);if(Zi(_)&&(_=_.slice(0,-7),k.capture=!0),!v&&p){if(null!=T)continue;t.removeEventListener(_,d[M],k),d[M]=null}if(v)Ri(_,t,T),Xi([_]);else if(null!=T){function w(t){d[x].call(this,t)}d[M]=zi(_,t,w,k)}}else if("style"===x)ar(t,x,T);else if("autofocus"===x)Ie(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 A=S.defaultValue;S.removeAttribute(y),S.defaultValue=A,S.value=S.__value=E?A:null}else{let I=S.defaultChecked;S.removeAttribute(y),S.defaultChecked=I,S.checked=!!E&&I}}else t.removeAttribute(x)}else t.value=t.__value=T}}else Us(t,T,i?.[js],s[js]),d[x]=T,d[js]=s[js];else qs(t,"http://www.w3.org/1999/xhtml"===t.namespaceURI,T,r,i?.[Zs],s[Zs]),d[x]=T,d[Zs]=s[Zs]}return l&&V(!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??={[Ks]:t.nodeName.includes("-"),[Js]:"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),Ye(()=>{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=K.r,n=hi;return Fe(()=>{var a,o;return Ye(()=>{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?Ye(()=>{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===C)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||C 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:jt)(()=>(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;#Z;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===C||(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.#Z=(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.#Z))"$set"!==r&&"$destroy"!==r&&"$on"!==r&&h(this,r,{get(){return this.#Z[r]},set(t){this.#Z[r]=t},enumerable:!0});this.#Z.$set=t=>{Object.assign(s,t)},this.#Z.$destroy=()=>{ds(this.#Z)}}$set(t){this.#Z.$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.#Z.$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=(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)))})}),Mr="6.1.14",_r="https://b.micr.io/";var Sr=`https://viewer.${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"}()}/`,Er="micrio-muted",Ar={id:"",version:Mr,path:_r,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:{}}},Ir={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-sort":{f:"gallery.sort"},"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-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-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":{}}},Lr=t=>JSON.parse(JSON.stringify(t));function Pr(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]={}),Pr(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 Cr,$r="E001",Dr="E002",zr="E003",Or="E004",Rr="E005",Xr="E100",Fr="E101",Yr="E102",Vr="E103",Nr="E200",Br="E201",qr="E202",Wr="E203",Ur="E300",Hr="E301",Gr="E302",Zr="E303",jr="E999",Kr={[$r]:"You appear to be offline. Please check your internet connection and try again.",[Dr]:"The connection timed out. Please try again.",[zr]:"Unable to load content due to security restrictions.",[Or]:"The requested image or content could not be found.",[Rr]:"The server encountered an error. Please try again later.",[Xr]:"Your browser does not support WebGL, which is required to view this content. Please try a different browser.",[Fr]:"The graphics context was lost. The page will attempt to recover.",[Yr]:"There was a problem initializing the graphics. Please try refreshing the page.",[Vr]:"Your device is low on memory. Try closing other browser tabs or applications.",[Nr]:"The image data appears to be invalid or corrupted.",[Br]:"The requested content could not be loaded.",[qr]:"There was a problem processing the image information.",[Wr]:"This image uses an unsupported format version.",[Ur]:"Failed to load the image viewer engine. Please try refreshing the page.",[Hr]:"An error occurred in the image viewer. Please try refreshing the page.",[Gr]:"Failed to load the image. Please try again.",[Zr]:"Failed to load the tour. Some features may be unavailable.",[jr]:"An unexpected error occurred. Please try refreshing the page."},Jr=class t extends Error{constructor(e,i){super(e),this.name="MicrioError",this.code=i?.code??jr,this.displayMessage=i?.displayMessage??Kr[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=jr;return 404===s?r=Or:s>=500&&s<600?r=Rr:0===s?r=$r:408!==s&&504!==s||(r=Dr),new t(`${i?i+": ":""}HTTP ${s}`,{code:r,statusCode:s})}static fromError(e,i){const s=e.message.toLowerCase();let r=jr;return s.includes("network")||s.includes("internet")||s.includes("offline")?r=$r:s.includes("timeout")?r=Dr:s.includes("cors")||s.includes("cross-origin")?r=zr:s.includes("webgl")||s.includes("webglcontext")?r=Xr:s.includes("memory")||s.includes("out of memory")?r=Vr:(s.includes("wasm")||s.includes("webassembly"))&&(r=Ur),new t(`${i?i+": ":""}${e.message}`,{code:r,cause:e})}},Qr=new Map,tn=new Map,en=new Map,sn=async(t,e)=>{if(!e&&Qr.has(t))return Lr(Qr.get(t));if(tn.has(t))return tn.get(t);if(en.has(t))throw en.get(t)[1];const i=fetch(t+(e?(t.includes("?")?"&":"?")+Math.random():"")).then(async e=>{if(200==e.status)return e.json();{const i=Jr.fromResponse(e,`fetchJson(${t})`);throw en.set(t,[e.status,i.message]),i}}).then(i=>(e||Qr.set(t,i),tn.delete(t),Lr(i))).catch(e=>{throw tn.delete(t),e});return tn.set(t,i),i},rn=new Map,nn=new Map,an=new Map,on=new Map;async function hn(t){if(!t||t.startsWith("http")||rn.has(t))return;if(on.has(t))return on.get(t);const e=async function(t){const e=await sn(`${Sr}${t}/bundle.json`);if(e?.images){for(const t of e.images)t?.id&&(t.settings&&(t.info.settings=t.settings,delete t.settings),rn.set(t.id,t));t.startsWith("external/")&&e.images[0]?.id&&rn.set(t,e.images[0])}e?.organisation&&(Cr=e.organisation);if(e?.spaces)for(const i of e.spaces)i?.id&&i?.data&&nn.set(i.id,i.data);e?.album&&an.set(e.album.id,e.album)}(t);on.set(t,e);try{await e}finally{on.delete(t)}}var cn={async getInfo(t){return(await this.getBundleImage(t))?.info},async getData(t){return(await this.getBundleImage(t))?.data},getDataSync:t=>rn.get(t)?.data,getBundleImageSync:t=>rn.get(t),getStepMarker(t){return this.getDataSync(t.micrioId)?.markers?.find(e=>e.id===t.markerId)},getSpaceData:t=>nn.get(t),getOrganisation:()=>Cr,getAlbum:t=>an.get(t),async getBundleImage(t){if(t)return await hn(t),rn.get(t)}},ln=t=>t;function dn(t){const e=t-1;return e*e*e+1}function un(t){const e="string"==typeof t&&t.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[t,"px"]}function mn(t,{delay:e=0,duration:i=400,easing:s=ln}={}){const r=+getComputedStyle(t).opacity;return{delay:e,duration:i,easing:s,css:t=>"opacity: "+t*r}}function gn(t,{delay:e=0,duration:i=400,easing:s=dn,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]=un(r),[m,g]=un(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 pn=Bi('<a rel="noopener" href="https://micr.io/" title="Powered by Micrio" aria-label="Micrio homepage"></a>');function fn(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=Zt(()=>!!xt(n,"$tour",i)||!!xt(a,"$marker",i));var d=Hi(),u=Me(d),m=t=>{var e=pn();let i;Ve(()=>{ar(e,"target",o),i=qs(e,1,"micrio-logo",null,i,{loading:Ei(c)})}),Ds(3,e,()=>mn,()=>({duration:200})),Gi(t,e)};vs(u,t=>{Ei(l)||t(m)}),Gi(t,d),it(),s()}var vn=Bi('<a rel="noopener" target="_blank" class="micrio-logo-org"><img alt="Logo" class="micrio-logo-org"/></a>');function wn(t,e){et(e,!0);const[i,s]=kt(),{tour:r,marker:n,popover:a}=Q("micrio").state;const o=Zt(()=>!!xt(r,"$tour",i)||!!xt(n,"$marker",i)||!!xt(a,"$popover",i));var h=Hi(),c=Me(h),l=t=>{var i=vn(),s=ke(i);q(i),Ve(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,()=>mn,()=>({duration:200})),Gi(t,i)};vs(c,t=>{!Ei(o)&&e.organisation.logo&&t(l)}),Gi(t,h),it(),s()}var yn={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",tours:"Tours",markerTours:"Marker tours",videoTours:"Video tours"},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",tours:"Tours",markerTours:"Marker tours",videoTours:"Video tours"},de:{close:"Schließen",zoomIn:"Vergrößern",zoomOut:"Verkleinern",fullscreenToggle:"Vollbild umschalten",switchLanguage:"Sprache wechseln",share:"Teilen",audioMute:"Ton stummschalten",audioUnmute:"Ton einschalten",closeMarker:"Diesen Marker schließen",tourStepNext:"Nächster Schritt",tourStepPrev:"Vorheriger Schritt",tourStop:"Tour beenden",minimize:"Minimieren",play:"Abspielen",pause:"Pause",stop:"Stopp",subtitlesToggle:"Untertitel umschalten",galleryPrev:"Vorheriges Bild",galleryNext:"Nächstes Bild",menuToggle:"Menü umschalten",waypointFollow:"Diesen Weg gehen",tours:"Touren",markerTours:"Marker-Touren",videoTours:"Video-Touren"}},bn=vt(yn.en),xn={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"]},Tn=Wi('<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path></path></svg>');function kn(t,e){et(e,!0);let i=br(e,"style",3,void 0);const s=Q("micrio"),r=Zt(()=>"chevron-down"==e.name||"link-ext"==e.name),n=s.defaultSettings?.ui?.icons,a=Zt(()=>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:xn.play,pause:xn.pause,close:xn.xmark,"play-filled":xn.playCircle,a11y:xn.globe,menu:xn.bars,"zoom-in":xn.plus,"zoom-out":xn.minus,maximize:xn.expand,minimize:xn.compress,"volume-off":xn.volumeXmark,"volume-up":xn.volumeHigh,subtitles:xn.closedCaptioning,"subtitles-off":xn.closedCaptioning,"arrow-left":xn.arrowLeft,"arrow-up":xn.arrowUp,"arrow-right":xn.arrowRight,"arrow-down":xn.arrowDown,video:xn.video,audio:xn.volumeHigh,image:xn.image,share:xn.share,error:xn.circleExclamation,"chevron-down":xn.chevronDown,link:xn.link,"link-ext":xn.externalLink,"ellipsis-vertical":xn.ellipsisVertical},h=Zt(()=>o[e.name]);var c=Hi(),l=Me(c),d=t=>{var e=Hi();_s(Me(e),()=>Ei(a),void 0,!0),Gi(t,e)},u=t=>{var e=Tn();let s;var n=ke(e);q(e),Ve(()=>{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 Mn=vt(void 0),_n=()=>Mn.set(void 0),Sn=!1;Mn.subscribe(t=>{t?Sn||window.addEventListener("click",_n):Sn&&window.removeEventListener("click",_n),Sn=!!t});var En=Bi('<a class="micrio-menu-action micrio-menu"><strong class="micrio-menu"> <!></strong></a>'),An=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>'),In=Bi('<button class="micrio-menu-action micrio-menu" type="button"><!> <strong class="micrio-menu"> <!></strong></button>'),Ln=Bi('<div class="items micrio-menu"></div>'),Pn=Bi("<menu><!> <!></menu>");function Cn(t,e){et(e,!0);const i=()=>xt(Mn,"$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(ue(n().action));const u=Zt(()=>{return t=n(),e=xt(l,"$_lang",s),t.i18n?.[e]??t;var t,e});function m(t){n().link||t.preventDefault(),Ei(d)?.();const i=!!(Ei(p)||Ei(d)||n().link);Mn.set(i?void 0:n()),i&&e.onclose?.()}ps(()=>{Ei(u)?.title||1!=n().children?.length||n(n().children[0]),Ei(d)||(n().markerId?oe(d,()=>{a()&&o.$current?.id!=a()&&o.open(a()),o.$current?.state.marker.set(n().markerId)}):(Ei(u)?.content||Ei(u)?.embed||n().image)&&oe(d,()=>{h.dispatch("page-open",n()),c.popover.set({contentPage:n()})}))});const g=t=>t==i()||!!t.children?.some(g),p=Zt(()=>i()&&g(n()));var f=Pn();let v;var w=ke(f),y=t=>{var e=En(),i=ke(e),s=ke(i),r=_e(s);{let t=Zt(()=>n().linkTargetBlank?"link-ext":"link");kn(r,{style:"opacity:.75",get name(){return Ei(t)}})}q(i),q(e),Ve(()=>{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=In(),i=ke(e),s=t=>{var e=An(),i=ke(e);q(e),Ve(()=>{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=_e(i,2),a=ke(r),o=_e(a),h=t=>{kn(t,{name:"chevron-down"})};vs(o,t=>{n().children&&n().children.length&&t(h)}),q(r),q(e),Ve(()=>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=_e(w,2),T=t=>{var e=Ln();bs(e,23,()=>n().children,(t,e)=>e+t.id,(t,e)=>{Cn(t,{get menu(){return Ei(e)},get originalId(){return a()},onclose:_n})}),q(e),Gi(t,e)};vs(x,t=>{n().children&&n().children.length&&t(T)}),q(f),Ve(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 $n=Bi('<img alt="Icon" class="micrio-button"/>'),Dn=Bi("<!><!>",1);function zn(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(Me(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,[Zs]:{active:a(),"no-click":l()}}),void 0,void 0,void 0,"micrio-button");var p=Dn(),v=Me(p),w=t=>{kn(t,{get name(){return i()}})},y=t=>{var e=$n();Ve(()=>ar(e,"src",s().src)),Gi(t,e)};vs(v,t=>{i()?t(w):s()&&t(y,1)}),gs(_e(v),()=>e.children??f),Gi(d,p)}),Gi(t,d),it()}var On=Bi("<menu><!> <!> <!></menu> <!>",1);function Rn(t,e){et(e,!0);const i=()=>xt(l,"$current",n),s=()=>xt(d,"$_lang",n),r=()=>xt(bn,"$i18n",n),[n,a]=kt();let o=ne(void 0);const h=Q("micrio"),{state:c,current:l,_lang:d,spaceData:u}=h,{tour:m,marker:g,popover:p}=c;let f=ne(!1),v=ne(!1);const w=i().id;let y=ne(window.innerWidth<=500);const b=()=>oe(y,window.innerWidth<=500),x=()=>{Ei(y)&&oe(f,!1)},T=t=>!!t.i18n?.[s()],k=Zt(()=>!!xt(m,"$tour",n)||!!xt(g,"$marker",n)||!!xt(p,"$popover",n)),M=Zt(()=>(Ei(o)?.markerTours??[]).concat(u?.markerTours??[]).filter(T)),_=Zt(()=>Ei(M)?.length>0),S=Zt(()=>Ei(o)?.tours?.filter(T)??[]),E=Zt(()=>Ei(S)?.length>0),A=Zt(()=>Ei(_)&&Ei(E)),I=Zt(()=>Ei(o)?.pages?Ei(o).pages.filter(t=>!t.id?.startsWith("_")&&(t=>!!t.i18n?.[s()])(t)).concat(Ei(o).pages.filter(t=>t.id?.startsWith("_"))):void 0),L=Zt(()=>!(Ei(I)?.length||Ei(_)||Ei(E))),P=[],C=(t,e)=>t.i18n?.[e]?.title??"(Untitled)";ps(()=>{const t=h.current.subscribe(t=>{if(t){for(;P.length;)P.shift()?.();kr(t.info).then(()=>oe(v,!t.$settings.noLogo)),P.push(t.data.subscribe(t=>{oe(o,t,!0)}))}});return window.addEventListener("resize",b),()=>{for(window.removeEventListener("resize",b);P.length;)P.shift()?.();t()}});var $=Hi(),D=Me($),z=t=>{var e=On(),n=Me(e);let a;var o=ke(n),c=t=>{var e=Hi();bs(Me(e),17,()=>Ei(I),t=>t.id,(t,e)=>{Cn(t,{get menu(){return Ei(e)},get originalId(){return w},onclose:x})}),Gi(t,e)};vs(o,t=>{Ei(I)&&t(c)});var l=_e(o,2),d=t=>{{let e=Zt(()=>({id:crypto.randomUUID(),i18n:{[s()]:{title:Ei(A)?r().markerTours:r().tours}},children:Ei(M).map(t=>({id:crypto.randomUUID(),i18n:{[s()]:{title:C(t,s())}},action:()=>{t.initialStep=0,m.set(t)}}))}));Cn(t,{onclose:x,get menu(){return Ei(e)}})}};vs(l,t=>{Ei(_)&&t(d)});var u=_e(l,2),g=t=>{{let e=Zt(()=>({id:crypto.randomUUID(),i18n:{[s()]:{title:Ei(A)?r().videoTours:r().tours}},children:Ei(S).map(t=>({id:crypto.randomUUID(),i18n:{[s()]:{title:C(t,s())}},action:()=>{i()&&i().id!=w&&h.open(w),m.set(t)}}))}));Cn(t,{onclose:x,get menu(){return Ei(e)}})}};vs(u,t=>{Ei(E)&&t(g)}),q(n);var p=_e(n,2),b=t=>{{let e=Zt(()=>Ei(f)?"close":"ellipsis-vertical"),i=Zt(()=>"toggle transparent"+(Ei(v)?" indent":""));zn(t,{get title(){return r().menuToggle},get type(){return Ei(e)},get className(){return Ei(i)},onclick:()=>oe(f,!Ei(f))})}};vs(p,t=>{Ei(y)&&t(b)}),Ve(()=>a=qs(n,1,"micrio-toolbar micrio-toolbar",null,a,{shown:!Ei(k)&&Ei(f),indent:Ei(v)})),Ds(3,n,()=>mn,()=>({duration:200})),Gi(t,e)};vs(D,t=>{Ei(L)||Ei(k)||t(z)}),Gi(t,$),it(),a()}var Xn=(t,e=1)=>(t%e+e)%e,Fn=t=>({centerX:t[0]+t[2]/2,centerY:t[1]+t[3]/2,width:t[2],height:t[3]}),Yn=Bi("<canvas></canvas>");function Vn(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;A();const i=Fn(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}=Fn(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(_)){const t=[e-Ei(_).width/2,i-Ei(_).height/2,Ei(_).width,Ei(_).height];o.setView(t)}else o.setCoo(e,i)}}function E(){window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",E),oe(k,!1),oe(_,void 0)}function A(){oe(w,!1),clearTimeout(M),M=setTimeout(()=>oe(w,!0),2500)}const I=-Li(()=>e.image).camera.rotationY/(2*Math.PI),L=self.crossOriginIsolated;let P=ne(ue(L?void 0:Li(()=>e.image).thumbSrc));const C={passive:!0};let $=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",A,C);const i=e.image.state.view.subscribe(b);return setTimeout(()=>oe($,!0),10),()=>{t&&URL.revokeObjectURL(t),r.canvas.element.removeEventListener("mousemove",A,C),E(),i()}});const D=Zt(()=>Ei(P)?`background-image: url('${Ei(P)}')`+(0!=I?`;background-position-x:${g*I}px`:""):null);var z=Yn();let O;fr(z,t=>oe(v,t),()=>Ei(v)),Ve(()=>{ar(z,"width",g),ar(z,"height",p),Us(z,Ei(D)),O=qs(z,1,"micrio-minimap",null,O,{hidden:!Ei($)||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(_,{width:e[2],height:e[3]},!0),S(t),oe(k,!0)}),Gi(t,z),it(),s()}Xi(["mousedown"]);var Nn=navigator?.language??"en-EN",Bn="Intl"in self&&Intl.DisplayNames?new Intl.DisplayNames([Nn],{type:"language"}):void 0,qn=["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"],Wn=Bi("<div><!></div>");function Un(t,e){let i=br(e,"className",3,"");var s=Wn();gs(ke(s),()=>e.children??f),q(s),Ve(()=>qs(s,1,Ys(i()),"micrio-button-group")),Gi(t,s)}var Hn=navigator.userAgent,Gn={iOS:/ipad|iphone|ipod/i.test(Hn),firefox:/firefox/i.test(Hn),OSX:/macintosh/i.test(Hn)&&/os\ x/i.test(Hn),hasTouch:"TouchEvent"in self,safari:!1};function Zn(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(),Gn.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=Me(p),v=t=>{{let e=Zt(()=>Ei(h)?"minimize":"maximize");zn(t,{get type(){return Ei(e)},get title(){return xt(bn,"$i18n",i).fullscreenToggle},onclick:u})}};vs(f,t=>{c&&t(v)}),Gi(t,p),it(),s()}Gn.safari=(Gn.OSX||Gn.iOS)&&(/safari/i.test(Hn)||/instagram/i.test(Hn))&&!/chrome/i.test(Hn),Gn.OSX&&Gn.safari&&"TouchEvent"in self&&(Gn.iOS=!0,Gn.OSX=!1);var jn=Bi("<!> <!>",1);function Kn(t,e){et(e,!0);const i=()=>xt(bn,"$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);kr(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=Me(y),x=t=>{var e=jn(),s=Me(e);{let t=Zt(()=>Ei(l)||Ei(o));zn(s,{type:"zoom-in",get title(){return i().zoomIn},get disabled(){return Ei(t)},onclick:u})}var r=_e(s,2);{let t=Zt(()=>Ei(l)||Ei(h));zn(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 Jn=Bi('<menu class="popout micrio-controls"><!> <!></menu>'),Qn=Bi("<!> <!> <!>",1),ta=Bi("<!> <!>",1),ea=Bi("<aside><!></aside>"),ia=Bi('<aside class="grid-close micrio-controls"><!></aside>'),sa=Bi("<aside><!> <!></aside> <!> <!>",1);function ra(t,e){et(e,!0);const i=()=>xt(g,"$current",l),s=()=>xt(Ei(M),"$info",l),r=()=>xt(w,"$tour",l),n=()=>xt(v,"$_lang",l),a=()=>xt(x,"$zoom",l),o=()=>xt(y,"$popup",l),h=()=>xt(f,"$isMuted",l),c=()=>xt(bn,"$i18n",l),[l,d]=kt();let u=br(e,"hasAudio",3,!1);const m=ue(Q("micrio")),{current:g,state:p,isMuted:f,_lang:v}=m,{tour:w,popup:y}=p,{controls:b,zoom:x,hidden:T,hover:k}=m.state.ui,M=Zt(()=>i()?.info),_=Zt(()=>s()?.revision?Object.keys(s().revision):[]),S=Zt(()=>r()&&"steps"in r()&&r().isSerialTour);function E(){if(navigator.share&&i()?.$info){const t=i().$data?.i18n?.[n()];navigator.share({title:i().$info?.title,text:t?.description||`${i().$info.width} x ${i().$info.height} | Micrio`,url:location.href})}}let A=ne(null),I=ne(!1);function L(t){const e=t.detail;oe(I,m.canvas.viewport.portrait,!0),e.opts.isPassive||oe(A,e,!0)}function P(){oe(A,null)}let C=ne(!1),$=ne(!1),D=ne(!1),z=ne(void 0),O=ne(void 0),R=ne(!1);function X(t){x.set(!t.noZoom),b.set(!t.noControls),oe(C,!!t.ui?.controls?.cultureSwitch),oe($,!!t.social),oe(D,!!t.fullscreen)}i()&&X(i().$settings),ps(()=>{let t,e;m.addEventListener("splitscreen-start",L),m.addEventListener("splitscreen-stop",P);const i=m.current.subscribe(i=>{i&&kr(i.info).then(e=>{!e||r()&&"steps"in r()||(t?.(),t=i.settings.subscribe(X))});const s=m.canvases[0]?.grid;s!==Ei(z)&&(e?.(),oe(z,s,!0),Ei(z)&&(oe(R,Ei(z).clickable,!0),e=Ei(z).focussed.subscribe(t=>oe(O,t,!0))))});return()=>{m.removeEventListener("splitscreen-start",L),m.removeEventListener("splitscreen-stop",P),t?.(),i(),e?.()}});const F=Zt(()=>"micrioAudioContext"in window||u()),Y=Zt(()=>Ei(C)&&Ei(_).length>1),V=Zt(()=>Ei($)&&"share"in navigator),N=Zt(()=>Ei(D)&&!Ei(S)),B=Zt(()=>xt(b,"$controls",l)&&(Ei(F)||Ei(Y)||Ei(V)||a()||Ei(N))),U=Zt(()=>o()&&m.canvas.$isMobile),H=Zt(()=>!!i()?.grid&&"cells"==i().grid.panZoom);var G=Hi(),Z=Me(G),j=t=>{var e=sa(),i=Me(e);let s;var d=ke(i),u=t=>{var e=Qn(),i=Me(e),s=t=>{{let e=Zt(()=>h()?"volume-off":"volume-up"),i=Zt(()=>h()?c().audioUnmute:c().audioMute);zn(t,{get type(){return Ei(e)},get title(){return Ei(i)},onclick:()=>f.set(!h())})}};vs(i,t=>{Ei(F)&&t(s)});var r=_e(i,2),a=t=>{var e=Jn(),i=ke(e);zn(i,{get title(){return c().switchLanguage},type:"a11y"}),bs(_e(i,2),17,()=>Ei(_),ws,(t,e)=>{{let i=Zt(()=>Bn?.of(Ei(e))??Ei(e)),s=Zt(()=>Ei(e)==n());zn(t,{onclick:()=>m.lang=Ei(e),get title(){return Ei(i)},get active(){return Ei(s)},children:(t,i)=>{W();var s=Ui();Ve(t=>ns(s,t),[()=>Ei(e).toUpperCase()]),Gi(t,s)},$$slots:{default:!0}})}}),q(e),Gi(t,e)};vs(r,t=>{Ei(Y)&&t(a)});var o=_e(r,2),l=t=>{zn(t,{type:"share",get title(){return c().share},onclick:E})};vs(o,t=>{Ei(V)&&t(l)}),Gi(t,e)};vs(d,t=>{Ei(U)||t(u)}),Un(_e(d,2),{children:(t,e)=>{var i=ta(),s=Me(i),r=t=>{var e=Hi(),i=Me(e),s=t=>{Kn(t,{get image(){return Ei(A)}})},r=t=>{Kn(t,{})};vs(i,t=>{Ei(A)?t(s):t(r,-1)}),Gi(t,e)};vs(s,t=>{!a()||Ei(U)||Ei(H)||t(r)});var n=_e(s,2),o=t=>{Zn(t,{get el(){return m}})};vs(n,t=>{Ei(N)&&t(o)}),Gi(t,i)},$$slots:{default:!0}}),q(i);var g=_e(i,2),p=t=>{var e=ea();let i;Un(ke(e),{children:(t,e)=>{Kn(t,{})},$$slots:{default:!0}}),q(e),Ve(()=>i=qs(e,1,"primary micrio-controls",null,i,{portrait:Ei(I)})),Ds(3,e,()=>mn),Gi(t,e)};vs(g,t=>{a()&&Ei(A)&&t(p)});var v=_e(g,2),w=t=>{var e=ia();zn(ke(e),{type:"close",get title(){return c().close},onclick:()=>Ei(z)?.back()}),q(e),Gi(t,e)};vs(v,t=>{!Ei(O)||"focus"!=Ei(R)||o()||r()||t(w)}),Ve(()=>s=qs(i,1,"micrio-controls",null,s,{hidden:xt(T,"$hidden",l)&&!xt(k,"$hover",l)})),Ri("pointerover",i,()=>k.set(!0)),Ri("pointerout",i,t=>{t.currentTarget.contains(t.relatedTarget)||k.set(!1)}),Ri("focusin",i,()=>k.set(!0)),Ri("focusout",i,t=>{t.currentTarget.contains(t.relatedTarget)||k.set(!1)}),Gi(t,e)};vs(Z,t=>{Ei(B)&&t(j)}),Gi(t,G),it(),d()}Xi(["pointerover","pointerout","focusin","focusout"]);var na=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=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.content.timeline;this.timeline.length=0;for(let e=0;e<t.length;e++){const i=t[e],s=t[e-1],r=s?1*s.end:0;this.timeline.push({view:i.rect,start:1e3*r,duration:1e3*(1*i.start-r),pauseDuration:1*(i.end-i.start)*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=Fn(e.view),s=this.getView(this.currentIndex-1),r=s?Fn(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=na;var aa=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}({}),oa=function(t){return t[t.YouTube=1]="YouTube",t[t.Vimeo=2]="Vimeo",t}({}),ha=[],ca=(t,e,i)=>new Promise((s,r)=>{if(i||ha.includes(t))return s();const n=document.createElement("script"),a=()=>{ha.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)}),la={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5},da=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 ca("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:"https://www.youtube-nocookie.com",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 la.UNSTARTED:this.callbacks.onBlocked?.(),this.callbacks.onPause?.();break;case la.ENDED:this.callbacks.onEnded?.();break;case la.PLAYING:this.callbacks.onPlay?.(),this.callbacks.onSeeked?.();break;case la.PAUSED:this.callbacks.onPause?.();break;case la.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||[la.UNSTARTED,la.ENDED,la.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}},ua=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 ca("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}}},ma=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)}},ga=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 ca("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 ma(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}},pa="micrio-captions-disable",fa=vt("1"!=localStorage.getItem(pa));fa.subscribe(t=>{t?localStorage.removeItem(pa):localStorage.setItem(pa,"1")});var va=Bi('<div><p class="micrio-subtitles"> </p></div>');function wa(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=Zt(()=>n.filter(t=>t.start<=Ei(o)&&t.end>=Ei(o)));var l=Hi(),d=Me(l),u=t=>{var e=Hi();bs(Me(e),16,()=>Ei(c),t=>t,(t,e)=>{var i=va();let s;var n=ke(i),a=ke(n,!0);q(n),q(i),Ve(()=>{s=qs(i,1,"micrio-subtitles",null,s,{raised:r()}),ns(a,e.data)}),Ds(3,i,()=>mn),Gi(t,i)}),Gi(t,e)};vs(d,t=>{xt(fa,"$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 ba(t,e){et(e,!0);let i=br(e,"ended",11,!1);function s(t){if(isNaN(t))return"0:00";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 r=ya(),n=ke(r);gs(ke(n),()=>e.children??f),q(n);var a=_e(n,2),o=ke(a,!0);q(a),q(r),Ve((t,e)=>{Us(r,t),ns(o,e)},[()=>`--progress: ${Math.round((e.currentTime??0)/e.duration*1e4)/100}%;--time: '${s(e.currentTime??0)}';`,()=>s(i()||!e.currentTime||e.currentTime<=0?e.duration:(e.currentTime??0)-e.duration)]),Ri("click",r,t=>t.stopPropagation()),Ri("keydown",r,t=>t.stopPropagation()),Gi(t,r),it()}Xi(["click","keydown"]);var xa=Wi('<svg height="42" width="42" class="micrio-media-controls"><circle r="19" cx="21" cy="21" class="micrio-media-controls"></circle></svg>'),Ta=Bi("<!> <!> <!>",1),ka=Bi('<div class="bar active"></div>'),Ma=Bi('<aside class="micrio-media-controls"><!> <!></aside> <!>',1);Xi(["click","keydown","mousedown"]);var _a=Bi("<iframe></iframe>"),Sa=Bi('<source type="video/mp4;codecs=hvc1"/>'),Ea=Bi("<!> <source/>",1),Aa=Bi('<video playsinline="" class="micrio-media"><!></video>',2),Ia=Bi("<audio></audio>"),La=Bi("<micr-io></micr-io>",2),Pa=Bi("<aside><!></aside>"),Ca=Bi('<figcaption class="micrio-media"></figcaption>'),$a=Bi('<div class="show-play micrio-media" role="button"><!></div>'),Da=Bi('<figure><div role="button"><!> <!> <!></div> <!></figure> <!>',1);function za(t,e){et(e,!0);const i=()=>xt(B,"$_lang",s),[s,r]=kt(),n=/((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be|youtube-nocookie\.com))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)?/,a=/vimeo\.com/,o=/^.*t=(\d+).*$/,h="https://www.youtube-nocookie.com";let c;const l=Q("micrio");let d=br(e,"src",11,void 0),u=br(e,"volume",15,1),m=br(e,"width",3,640),g=br(e,"height",3,380),p=br(e,"frameScale",3,1),f=br(e,"autoplay",15,!1),v=br(e,"loop",3,!1),w=br(e,"loopDelay",3,void 0),y=br(e,"controls",15,!1),b=br(e,"title",3,void 0),x=br(e,"figcaption",3,null),T=br(e,"paused",15,!0),k=br(e,"forcePause",3,void 0),M=br(e,"seeking",15,!0),_=br(e,"duration",31,()=>-1),S=br(e,"currentTime",15),E=br(e,"is360",3,!1),A=br(e,"tour",3,null),I=br(e,"secondary",3,!1),L=br(e,"fullscreen",3,void 0),P=br(e,"className",3,null),C=br(e,"hasTransparentH265",3,!1),$=br(e,"noPlayOverlay",3,!1),D=br(e,"uuid",15,""),z=br(e,"image",19,()=>wt(l.current)),O=br(e,"destroying",3,void 0),R=br(e,"_media",15,void 0),X=ne(!1);D(D()+(d()??Li(()=>A())?.id));const F=Li(()=>z()).$info,{events:V,state:N,_lang:B}=l,W=Q("volume"),U=0==xt(W,"$mainVolume",s),H=Q("srt"),G=Q("mediaPaused"),Z=l.hasAttribute("data-native-frame"),j=function(t,e,i=!1,s=0){const r=t?.toLowerCase(),c={type:aa.None,isCloudflare:!1};if(!t&&e)return c.type=aa.VideoTour,c;if(!t||!r)return c;if(t.startsWith("cfvid://"))return c.isCloudflare=!0,c.cloudflareId=t.slice(8),c.hlsSrc=`https://videodelivery.net/${c.cloudflareId}/manifest/video.m3u8`,c.type=aa.Video,c;if(r.endsWith(".mp3"))return c.type=aa.Audio,c.src=t,c;if(r.endsWith(".mp4")||r.endsWith(".webm"))return c.type=aa.Video,c.src=t,c;if(r.startsWith("micrio://"))return c.type=aa.Micrio,c.micrioEmbed=t.slice(9).split(","),c;if(!i){const e=n.exec(t);if(e?.[5]){if("playlist"!==e[5]){c.type=aa.IFrame,c.frameType=oa.YouTube,c.youtubeId=e[5];const i=o.test(t)?Number(t.replace(o,"$1")):s;return c.startTime=Math.round(i),c.src=`${h}/embed/${e[5]}?autoplay=0&enablejsapi=1&controls=0&start=${c.startTime}`,c}{const e=/list=([^&]+)/.exec(t);if(e?.[1])return c.type=aa.IFrame,c.src=`${h}/embed/videoseries?list=${e[1]}`,c}}if(a.test(t)){const e=t.match(/\/(\d+)/);if(e?.[1]){c.type=aa.IFrame,c.frameType=oa.Vimeo,c.vimeoId=e[1],c.vimeoToken=t.slice(t.indexOf(e[1])+e[1].length+1).replace(/\?.*$/,"")||void 0;const i=Math.round(s);return c.src=`https://player.vimeo.com/video/${e[1]}?${c.vimeoToken?`h=${c.vimeoToken}&`:""}title=0&portrait=0&sidedock=0&byline=0&controls=0#t=${i}s`,c}}}return r.startsWith("http")?(c.type=aa.IFrame,c.src=t,c):c}(d(),Li(()=>A()),Z,S()??0),{type:K,frameType:J,isCloudflare:tt,micrioEmbed:st,hlsSrc:rt}=j;let nt,at=ne(ue(j.src??d()));K==aa.Micrio&&T(!1),(K==aa.Micrio||K==aa.IFrame&&!J)&&y(!1);let ot=-1,ht=ne(ue(J==oa.YouTube||J==oa.Vimeo));const ct=K==aa.Audio&&Gn.iOS;let lt,dt=ne(void 0);const ut=N.mediaState.get(D());ut&&(S(ut.currentTime),f(!T(ut.paused))),N.mediaState.set(D(),{get currentTime(){return S()??0},set currentTime(t){Pt(t)},get paused(){return T()},set paused(t){t?_t():Mt()}});let mt=ne(void 0);{const t=Li(()=>A());if(t){const e=new na(Li(()=>z()),t);null!=S()&&S()>0&&(e.currentTime=S()),K==aa.VideoTour&&(_("duration"in t?Number(t.duration):t.i18n?.[i()]?.duration??0),u(NaN)),oe(mt,e,!0)}}const gt=Li(()=>A()&&!("steps"in A())?A().i18n?.[l.lang]?.subtitle:void 0)?.src;let pt,ft=ne(!1),vt=ne(!1),yt=!1,bt=ne(!1);function Tt(t){t&&"button"in t&&0!=t.button||(T()?Mt():_t())}async function Mt(t){if(!(t instanceof PointerEvent&&0!=t.button)&&(!yt||await async function(){return R()?R().paused:Ei(mt)?T():!!nt&&nt.isPaused()}())){switch(oe(vt,!1),_()>0&&null!=S()&&S()>=_()&&S(0),!I()&>&&H.set(gt),K){case aa.VideoTour:T(M(!1)),Ei(mt)?.play(),Dt();break;case aa.Audio:case aa.Video:R()?.addEventListener("play",()=>{R()&&(isNaN(R().duration)?R().addEventListener("durationchange",St,{once:!0}):St())},{once:!0}),R()?.play().catch(t=>{$()?T(!0):/pause\(\)/.test(t.toString())||(oe(ft,!0),l.events.dispatch("media-blocked"),e.onblocked?.())});break;case aa.IFrame:nt?.play();break;default:return}yt=!0,V.dispatch("media-play"),G.set(!1),e.onplay?.(),E()||U||Ei(mt)&&!R()||W.set(z().$settings.mutedVolume||0)}}function _t(){V.dispatch("media-pause"),G.set(!0),R()?(R().pause(),ct&&T(!0)):Ei(mt)?(Ei(mt).pause(),T(!0),zt()):nt&&!Ei(Yt)&&nt.pause()}function St(){oe(ft,!1),T(!1),Ei(mt)&&R()&&(R().duration>Ei(mt).duration&&(Ei(mt).duration=R().duration),Ei(mt).currentTime=R().currentTime,Ei(mt).play())}function Et(){M(!1),E()&&z()&&!z()._video&&z().video.set(R())}function At(){Ei(vt)||(Ei(mt)?_t():(T(!0),zt()),oe(vt,!0),V.dispatch("media-ended"),e.onended?.(),Ft())}function It(t){R()?R(R().muted=t,!0):nt&&nt.setMuted(t)}function Lt(){oe(X,!Ei(X)),It(Ei(X)),U||W.set(Ei(X)?1:z().$settings.mutedVolume||0)}function Pt(t){M(!0),R()?R(R().currentTime=t,!0):Ei(mt)?(S(Ei(mt).currentTime=t),M(!1)):nt&&nt.setCurrentTime(t)}function Ct(){Ei(mt)?(S(Ei(mt).currentTime),Ei(mt).ended&&At()):nt&&nt.getCurrentTime().then(t=>{S(t)}),$t()}function $t(){I()||V.dispatch("timeupdate",S())}function Dt(){ot>=0||(ot=setInterval(Ct,250),Ct())}function zt(){clearInterval(ot),ot=-1}async function Ot(){if(tt&&rt&&("MediaSource"in window||"ManagedMediaSource"in window)){const t=new ga(R(),rt,{onReady:()=>M(!1),onEnded:At});return await t.initialize(),void(nt=t)}if(K==aa.IFrame&&Ei(dt)){if(J==oa.YouTube){const t=new da(Ei(dt),{width:Ei(Gt),height:Ei(jt)},{onReady:()=>M(!1),onDurationChange:t=>_(t),onPlay:()=>{Dt(),oe(bt,T(M(!1)),!0)},onPause:()=>{T(!0),zt()},onEnded:At,onBlocked:()=>{oe(bt,T(!0),!0),zt()},onSeeking:()=>{Ct(),M(!0),zt()}});return M(!0),await t.initialize(),void(nt=t)}if(J==oa.Vimeo){const t=new ua(Ei(dt),{width:Ei(Gt),height:Ei(jt)},{onReady:()=>M(!1),onPlay:()=>T(M(!1)),onPause:()=>T(!0),onSeeking:()=>M(!0),onSeeked:()=>M(!1),onTimeUpdate:t=>S(t),onDurationChange:t=>_(t),onEnded:At});return M(!0),await t.initialize(),void(nt=t)}}R()&&(tt&&rt&&oe(at,rt,!0),function(){if(!R())return;R(R().ontimeupdate=$t,!0),Ei(mt)&&(R(R().onpause=()=>{Xt=!!R()?.ended,R()?.ended||Ei(mt).pause()},!0),R(R().onseeked=()=>{!R()||R().ended||Xt||(Ei(mt).currentTime=R().currentTime,Rt&&(R().pause(),Rt=!1))},!0));null!=S()&&S()>0&&(R().duration>0?R(R().currentTime=S(),!0):R(R().oncanplay=()=>{R()&&(R(R().oncanplay=null,!0),f()||(R().play(),Rt=!0),R(R().currentTime=lt,!0))},!0));const t=v()&&void 0!==w()?w():-1;R(R().onended=t>=0?()=>{clearTimeout(pt),pt=setTimeout(()=>{k()||R()?.play()},1e3*t)}:At,!0)}())}let Rt=!1,Xt=!1;function Ft(){U||W.set(1)}let Yt=ne(!1);const Vt=Li(()=>O()&&O().subscribe(t=>{t&&Bt()})),Nt=()=>S(R()?.currentTime??0);function Bt(){Ei(Yt)||(oe(Yt,!0),Vt&&Vt(),E()&&z()&&z().video.set(void 0),N.mediaState.delete(D()),zt(),_t(),Ft(),gt&&H.set(void 0),R()&&(R(R().onended=null,!0),ct&&(R(R().onloadedmetadata=R(R().onplay=R(R().onseeking=R(R().onseeked=null,!0),!0),!0),!0),R().removeEventListener("timeupdate",Nt)),R(R().ontimeupdate=R(R().onpause=R(R().onseeked=R(R().oncanplay=null,!0),!0),!0),!0)),Ei(mt)&&Ei(mt).destroy(),nt&&(nt.destroy(),nt=void 0))}const qt=K==aa.Video;let Wt=ne(ue(Li(()=>qt&&tt&&1!=p()&&Gn.iOS)));const Ut=F.is360?Math.PI/2:1,Ht=Zt(()=>qt?p()*Ut:K==aa.IFrame?Math.max(p(),Math.min(m()/512,g()/512)):1),Gt=Zt(()=>qt?m():Math.round(m()/Ei(Ht)*Ut)),jt=Zt(()=>qt?g():Math.round(g()/Ei(Ht)*Ut));let Kt=ne(void 0),Jt=ne(void 0);const Qt=Zt(()=>Ei(mt)&&A()?"events"in A()?A().events:A().i18n?.[i()]?.events??void 0:void 0);ps(()=>{e.onid?.(D()),d()&&ct&&(R((c||(c=new Audio),c)),R(R().controls=!1,!0),R(R().onloadedmetadata=()=>_(R()?.duration??0),!0),R(R().src=d(),!0),R(R().oncanplay=Et,!0),R(R().onended=At,!0),R().addEventListener("timeupdate",Nt),R(R().onseeking=()=>M(!0),!0),R(R().onseeked=()=>M(!1),!0)),lt=S()||0,oe(ht,J==oa.YouTube||J==oa.Vimeo,!0),Ot().then(()=>{f()&&Mt()}).catch(()=>{}),Ei(Wt)&&R()?.addEventListener("playing",()=>oe(Wt,!1),{once:!0});let t=!1;const i=l.isMuted.subscribe(e=>{t?(oe(X,e,!0),It(e)):t=!0});return()=>{Bt(),i(),ct&&R(void 0),nt?.destroy()}}),Re(()=>{void 0!==k()&&T(k())}),Re(()=>{v()&&void 0!==w()&&clearTimeout(pt)});var te=Hi(),ee=Me(te),ie=t=>{var e=Da(),i=Me(e);let r;Us(i,null);var n=ke(i);let a;ar(n,"tabindex",-1);var o=ke(n),h=t=>{var e=_a();hr(e,()=>({credentialless:!0,title:b(),src:Ei(at),width:Ei(Gt),height:Ei(jt),frameborder:"0",allow:"fullscreen *;autoplay *;encrypted-media *",[Zs]:{hooked:Ei(ht)&&!Ei(bt)}}),void 0,void 0,void 0,"micrio-media"),fr(e,t=>oe(dt,t),()=>Ei(dt)),function(t){if(!Y)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)},c=t=>{var e=Aa();e.controls=!1;var i=ke(e),s=t=>{var e=Ea(),i=Me(e),s=t=>{var e=Sa();Ve(t=>ar(e,"src",t),[()=>Ei(at).replace(".webm",".mp4")]),Gi(t,e)},r=Zt(()=>C()&&Ei(at).endsWith(".webm"));vs(i,t=>{Ei(r)&&t(s)});var n=_e(i,2);Ve(()=>{ar(n,"src",Ei(at)),ar(n,"type",tt?"application/x-mpegURL":void 0)}),Gi(t,e)};vs(i,t=>{Ei(at)&&t(s)}),q(e),fr(e,t=>R(t),()=>R()),Ve(()=>{e.loop=v()&&(null==w()||w()<=0),ar(e,"width",m()),ar(e,"height",g()),Us(e,Ei(Wt)?"opacity: 0":void 0),e.muted=Ei(X)||0===u(),e.autoplay=!!f()}),Oi("canplay",e,Et),Oi("ended",e,At),vr("duration","durationchange",e,_),ur(e,S),mr(e,M),gr(e,T),Gi(t,e)},l=t=>{var e=Ia();e.controls=!1,fr(e,t=>R(t),()=>R()),Ve(()=>{ar(e,"src",Ei(at)),e.muted=Ei(X)}),Oi("canplay",e,()=>M(!1)),Oi("ended",e,At),vr("duration","durationchange",e,_),ur(e,S),mr(e,M),gr(e,T),Gi(t,e)},d=t=>{var e=La();or(e,"data-logo","false"),Ve(()=>or(e,"id",st[0])),Ve(()=>or(e,"width",st[1])),Ve(()=>or(e,"height",st[2])),Ve(()=>or(e,"lang",st[3])),Ve(()=>or(e,"data-path",F.path)),Gi(t,e)};vs(o,t=>{K==aa.IFrame?t(h):K==aa.Video?t(c,1):K!=aa.Audio||ct?K==aa.Micrio&&st&&t(d,3):t(l,2)});var p=_e(o,2),k=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(Qt)},get currentTime(){return S()},set currentTime(t){S(t)},get duration(){return _()},set duration(t){_(t)}})};vs(p,t=>{Ei(Qt)?.length&&_()>0&&!Ei(Yt)&&t(k)});var A=_e(p,2),I=t=>{var e=Pa();let i;var s=ke(e);{let t=Zt(()=>!!gt),e=Zt(()=>!isNaN(u())),i=Zt(()=>E()||K!=aa.IFrame&&K!=aa.Video?L():Ei(Kt));!function(t,e){et(e,!0);const i=()=>xt(bn,"$i18n",r),s=()=>xt(fa,"$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=Ma(),b=Me(y),x=ke(b);{let t=Zt(()=>e.paused?"play":"pause"),s=Zt(()=>e.paused?i().play:i().pause);zn(x,{get type(){return Ei(t)},get title(){return Ei(s)},get onclick(){return e.onplaypause},children:(t,e)=>{var i=Hi(),s=Me(i),r=t=>{var e=xa(),i=ke(e);q(e),Ve(()=>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=_e(x,2),k=t=>{var r=Ta(),n=Me(r),a=t=>{{let s=Zt(()=>g()?"volume-off":"volume-up"),r=Zt(()=>g()?i().audioUnmute:i().audioMute);zn(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=_e(n,2),c=t=>{{let e=Zt(()=>s()?"subtitles":"subtitles-off");zn(t,{get type(){return Ei(e)},get active(){return s()},get title(){return i().subtitlesToggle},onclick:()=>fa.set(!s())})}};vs(o,t=>{u()&&t(c)});var l=_e(o,2),p=t=>{Zn(t,{get el(){return d()}})};vs(l,t=>{d()&&t(p)}),Gi(t,r)};vs(T,t=>{c()||t(k)}),q(b);var M=_e(b,2),_=t=>{ba(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=ka();fr(i,t=>oe(p,t),()=>Ei(p)),Ve(()=>Us(i,`--progress:${(a()??0)/o()*100}%;`)),Ri("mousedown",i,f),Gi(t,i)},$$slots:{default:!0}})};vs(M,t=>{c()||t(_)}),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(X)},get fullscreen(){return Ei(i)},onplaypause:Tt,onmute:Lt,onseek:t=>Pt(t),get paused(){return T()},set paused(t){T(t)},get seeking(){return M()},set seeking(t){M(t)},get duration(){return _()},set duration(t){_(t)},get currentTime(){return S()},set currentTime(t){S(t)},get ended(){return Ei(vt)},set ended(t){oe(vt,t,!0)}})}q(e),Ve(()=>i=qs(e,1,"micrio-media",null,i,{inside:"inside"==y()})),Gi(t,e)};vs(A,t=>{y()&&t(I)}),q(n),fr(n,t=>oe(Jt,t),()=>Ei(Jt));var $=_e(n,2),D=t=>{var e=Ca();_s(e,x,!0),q(e),Gi(t,e)};vs($,t=>{x()&&t(D)}),q(i),fr(i,t=>oe(Kt,t),()=>Ei(Kt));var z=_e(i,2),O=t=>{var e=$a();ar(e,"tabindex",-1),zn(ke(e),{get title(){return xt(bn,"$i18n",s).play},type:"play"}),q(e),Ri("pointerup",e,Mt),Gi(t,e)};vs(z,t=>{Ei(ft)&&t(O)}),Ve(()=>{r=qs(i,1,Ys(P()),"micrio-media",r,{paused:T(),is360:E(),"media-video":K==aa.IFrame||K==aa.Video,"media-micrio":K==aa.Micrio}),Us(n,1==Ei(Ht)||K!=aa.Video&&F.is360?"":`transform:scale(${Ei(Ht)})`),a=qs(n,1,"micrio-media",null,a,{videotour:!!Ei(mt)})}),Ri("pointerup",n,t=>{t.target==Ei(Jt)&&Tt(t)}),Gi(t,e)};vs(ee,t=>{z().$settings.noUI||t(ie)}),Gi(t,te),it(),r()}Xi(["pointerup"]);var Oa=Bi("<article><!></article>");function Ra(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=Oa();gs(ke(r),()=>e.children??f),q(r),Ve(()=>qs(r,1,Ys(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 Xa=Bi('<h1 class="micrio-marker-content"> </h1>'),Fa=Bi('<figcaption class="micrio-marker-content"> </figcaption>'),Ya=Bi('<button class="micrio-marker-content"><figure class="micrio-marker-content"><img class="micrio-marker-content"/> <!></figure></button>'),Va=Bi('<section class="micrio-marker-content"></section>'),Na=Bi("<!> <!>",1),Ba=Bi("<main><!> <!> <!> <!> <!> <!> <!></main>");function qa(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=Zt(()=>e.marker.i18n?.[s()]),x=Zt(()=>!(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=Zt(()=>!v||!e.marker?.audioAutoPlay),M=Zt(()=>!1===e.marker?.embedAutoPlay||!v||!(!Ei(b)?.audio||!e.marker?.audioAutoPlay)),_=p.tileBase?.includes("micrio.dev"),S=t=>t.i18n?.[s()]?.title,E=Zt(()=>e.marker.videoTour?.i18n?.[s()]?.audio??Ei(b)?.audio),A=Zt(()=>Ei(E)?.src),I=Zt(()=>y&&e.marker.images?.[0]?.i18n?.[s()]?.description);var L=Hi(),P=Me(L),C=t=>{var i=Ba();let s;var r=ke(i),n=t=>{var e=Xa(),i=ke(e,!0);q(e),fr(e,t=>l(t),()=>l()),Ve(()=>ns(i,Ei(b).title)),Gi(t,e)};vs(r,t=>{Ei(b).title&&t(n)});var h=_e(r,2),u=t=>{Ra(t,{children:(t,e)=>{var i=Hi();_s(Me(i),()=>Ei(b).body),Gi(t,i)},$$slots:{default:!0}})};vs(h,t=>{Ei(b).body&&f.primaryBodyFirst&&t(u)});var m=_e(h,2),E=t=>{{let i=Zt(()=>e.marker.audioAutoPlay||!Ei(b).audio&&!!e.marker.videoTour),s=Zt(()=>!e.marker.videoTour||!Ei(b)||!Ei(b).embedUrl);za(t,{get src(){return Ei(A)},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=_e(m,2),P=t=>{var i=Va();bs(i,21,()=>e.marker.images,t=>t.id??t.src,(t,i)=>{var s=Ya(),r=ke(s),n=ke(r),a=_e(n,2),o=t=>{var e=Fa(),i=ke(e,!0);q(e),Ve(()=>ns(i,Ei(I))),Gi(t,e)};vs(a,t=>{Ei(I)&&t(o)}),q(r),q(s),Ve((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.${_?"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 C=_e(L,2),$=t=>{var i=Na(),s=Me(i),r=t=>{za(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=_e(s,2);{let t=Zt(()=>!Ei(M));za(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(M)}})}Gi(t,i)};vs(C,t=>{Ei(b).embedUrl&&!a()&&t($)});var D=_e(C,2),z=t=>{Ra(t,{children:(t,e)=>{var i=Hi();_s(Me(i),()=>Ei(b).body),Gi(t,i)},$$slots:{default:!0}})};vs(D,t=>{Ei(b).body&&!f.primaryBodyFirst&&t(z)});var O=_e(D,2),R=t=>{Ra(t,{cn:"secondary",children:(t,e)=>{var i=Hi();_s(Me(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()),Ve(()=>s=qs(i,1,"micrio-marker-content",null,s,{empty:Ei(x)})),Gi(t,i)};vs(P,t=>{Ei(b)&&t(C)}),Gi(t,L),it(),n()}Xi(["click"]);var Wa=Bi('<button class="micrio-button tour-step micrio-marker-popup" disabled=""> </button>'),Ua=Bi("<!> <!> <!>",1),Ha=Bi('<progress class="progress micrio-marker-popup"></progress> <!>',1),Ga=Bi('<div><aside class="micrio-marker-popup"><!> <!> <!></aside> <!></div>');function Za(t,e){et(e,!0);const i=()=>xt(c,"$tour",n),s=()=>xt(h,"$current",n),r=()=>xt(bn,"$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=Zt(()=>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=Zt(()=>i()&&"steps"in i()?i():void 0),w=Zt(()=>Ei(v)&&Ei(v)?.steps.findIndex(t=>t.startsWith(e.marker.id))>=0),y=Zt(()=>Ei(w)&&!Ei(v)?.isSerialTour&&(Ei(u)?.$settings._markers?.tourControlsInPopup??d.tourControlsInPopup)),b=Zt(()=>Ei(w)&&!Ei(v)?.isSerialTour&&(Ei(u)?.$settings._markers?.tourStepCounterInPopup??d.tourStepCounterInPopup)),x=Zt(()=>Ei(v)?.currentStep??-1),T=Zt(()=>Ei(y)||(Ei(v)?Ei(v).currentStep==Ei(v).steps.length-1:void 0));let k=ne(!1);const M=(t=!1)=>{Ei(v)&&(t?Ei(v).prev?.():Ei(v).next?.(),oe(k,!0),setTimeout(()=>oe(k,!1),200))};let _=ne(!1),S=ne(void 0),E=ne(void 0);const A=new WeakMap,I=()=>{if(oe(_,!Ei(_)),Ei(S))for(let t=0;t<Ei(S).children.length;t++){const e=Ei(S).children[t];e instanceof HTMLElement&&e!=Ei(E)&&(A.has(e)||(A.set(e,e.offsetHeight),e.style.height=e.offsetHeight+"px"),setTimeout(()=>{e.style.height=Ei(_)?"0px":A.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=o.state.popup.subscribe(t=>oe(L,!t||t!=e.marker,!0));return()=>t()});var P=Ga();let C;var $=ke(P),D=ke($),z=t=>{{let e=Zt(()=>!Ei(w)||Ei(T)?"close":"arrow-right"),i=Zt(()=>!Ei(w)||Ei(T)?r().closeMarker:r().tourStepNext);zn(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=_e(D,2),R=t=>{{let e=Zt(()=>Ei(_)?"arrow-up":"arrow-down");zn(t,{get type(){return Ei(e)},get title(){return r().minimize},onclick:I})}};vs(O,t=>{g&&t(R)});var X=_e(O,2),F=t=>{var e=Ha(),s=Me(e);ar(s,"aria-hidden",!0),Un(_e(s,2),{className:"micrio-tour-controls",children:(t,e)=>{var s=Ua(),n=Me(s);{let t=Zt(()=>Ei(k)||0==Ei(x));zn(n,{type:"arrow-left",get disabled(){return Ei(t)},get title(){return r().tourStepPrev},onclick:()=>M(!0)})}var a=_e(n,2),o=t=>{var e=Wa(),s=ke(e);q(e),Ve(()=>ns(s,`${Ei(x)+1} / ${i().steps.length??""}`)),Gi(t,e)};vs(a,t=>{Ei(b)&&t(o)});var h=_e(a,2);{let t=Zt(()=>Ei(k)||Ei(x)+1==i().steps.length);zn(h,{type:"arrow-right",get disabled(){return Ei(t)},get title(){return r().tourStepNext},onclick:()=>M()})}Gi(t,s)},$$slots:{default:!0}}),Ve(()=>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($),qa(_e($,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)),Ve(()=>C=qs(P,1,"micrio-marker-popup",null,C,{destroying:Ei(L),minimized:Ei(_)})),Ds(3,P,()=>gn,()=>d.popupAnimation),Gi(t,P),it(),a()}var ja=Bi('<li><button class="micrio-serial-tour"> </button></li>'),Ka=Bi('<ol class="micrio-serial-tour"></ol>'),Ja=Bi("<!> <!> <!> <!>",1),Qa=Bi('<div role="progressbar"></div>'),to=Bi('<!> <aside class="micrio-media-controls micrio-serial-tour"><!> <!></aside> <!>',1);function eo(t,e){et(e,!0);const i=()=>xt(c,"$lang",n),s=()=>xt(bn,"$i18n",n),r=()=>xt(fa,"$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(()=>!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),A(t)}function M(){h.isMuted.update(t=>!t)}function _(){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 A(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 I(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),A())},10)}const L=t=>t?t.i18n?t.i18n[i()]?.title:t.title:void 0;ps(()=>{const t=()=>A();h.addEventListener("timeupdate",t);const e=d.subscribe(I);return()=>{e(),h.removeEventListener("timeupdate",t),S()}});const P=Zt(()=>Ei(y)?cn.getStepMarker(Ei(y)):void 0),C=Zt(()=>Ei(w)?Ei(w).i18n?.[i()]?.audio??Ei(P)?.i18n?.[i()]?.audio:void 0),$=Zt(()=>Ei(C)?.src),D=Zt(()=>!!Ei(P)?.videoTour?.i18n?.[i()]?.subtitle),z=Zt(()=>o.some(t=>!!cn.getStepMarker(t)?.videoTour?.i18n?.[i()]?.subtitle));var O=to(),R=Me(O),X=t=>{var e=Ka();bs(e,21,()=>o,ws,(t,e,i)=>{var s=Hi(),r=Me(s),n=t=>{var s=ja();let r;var n=ke(s),a=ke(n,!0);q(n),q(s),Ve(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(cn.getStepMarker(Ei(e)))]),Ri("click",n,()=>k(i)),Gi(t,s)},a=Zt(()=>L(cn.getStepMarker(Ei(e))));vs(r,t=>{Ei(a)&&t(n)}),Gi(t,s)}),q(e),Gi(t,e)};vs(R,t=>{e.tour.printChapters&&t(X)});var F=_e(R,2),Y=ke(F),V=t=>{{let e=Zt(()=>!Ei(p));za(t,{get tour(){return Ei(w)},get src(){return Ei($)},get autoplay(){return Ei(e)},onid:t=>oe(x,t,!0),onended:_,onplay:()=>oe(p,!1),onblocked:()=>oe(p,!0),get currentTime(){return Ei(y).currentTime},set currentTime(t){Ei(y).currentTime=t}})}};vs(Y,t=>{Ei(w)&&Ei(y)&&t(V)});var N=_e(Y,2),B=t=>{var e=Ja(),i=Me(e);{let t=Zt(()=>Ei(p)?"play":"pause"),e=Zt(()=>Ei(p)?s().play:s().pause);zn(i,{get type(){return Ei(t)},get title(){return Ei(e)},onclick:T})}var n=_e(i,2);{let t=Zt(()=>Ei(v)?"volume-off":"volume-up"),e=Zt(()=>Ei(v)?s().audioUnmute:s().audioMute);zn(n,{get type(){return Ei(t)},get title(){return Ei(e)},onclick:M})}var a=_e(n,2),o=t=>{{let e=Zt(()=>!Ei(D)),i=Zt(()=>r()?"subtitles":"subtitles-off");zn(t,{get disabled(){return Ei(e)},get type(){return Ei(i)},get active(){return r()},get title(){return s().subtitlesToggle},onclick:()=>fa.set(!r())})}};vs(a,t=>{Ei(z)&&t(o)}),Zn(_e(a,2),{get el(){return h}}),Gi(t,e)};vs(N,t=>{g&&t(B)}),q(F);var W=_e(F,2),U=t=>{ba(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(Me(s),17,()=>o,ws,(t,i,s)=>{var r=Hi(),a=Me(r),o=t=>{var r=Qa();let a;Ve(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(cn.getStepMarker(Ei(i)))]),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(W,t=>{g&&t(U)}),Gi(t,O),it(),a()}Xi(["click"]);var io=Bi('<article class="scroll-tour micrio-tour"></article> <!>',1),so=Bi("<!> <!> <!>",1),ro=Bi("<div><!> <!></div>");function no(t,e){et(e,!0);const i=()=>xt(l,"$_lang",r),s=()=>xt(bn,"$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,M=()=>A(Ei($)-1),_=()=>A(Ei($)+1),S=()=>h.enabled.set(!0);let E;function A(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 I(i);const s=e.tour.stepInfo[Ei($)]?.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 I(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($),n=cn.getStepMarker(t),a=n?.data?.gridTourTransition??n?.data?._meta?.gridTourTransition,h=a?.startsWith("slide")?"slide":"swipe";await Si().then(()=>{const e=p.focus(i=p.images.find(e=>e.id==t.micrioId),{view:t.startView,transition:a==h||a==`${h}-horiz`?r?`${h}-left`:`${h}-right`:a==`${h}-vert`?r?`${h}-up`:`${h}-down`:"behind"==a?r?"behind-left":"behind-right":a}).catch(()=>s=!0);return o.events.enabled.set(!1),e})}else if(o.$current?.id!=t.micrioId){const s=cn.getStepMarker(t);if(t.gridView&&s?.data?._meta?.gridAction&&p){t.micrioImage||(t.micrioImage=p.images.find(e=>e.id==t.micrioId)),i=t.micrioImage;const e=s.data._meta.gridAction.split("|");p.action(e.shift(),e.join("|"))}else"steps"in e.tour&&e.tour.stepInfo&&oe($,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 I(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 C(){h.dispatch("tour-ended",e.tour),(e.tour.closeOnFinish||!e.tour.cannotClose&&b)&&P()}let $=ne(-1),D=ne(!1);const z=u.camera.getView(),O=g._markers;if("steps"in e.tour){const t=d;t.prev=M,t.next=_,t.goto=A,Re(()=>{t.currentStep=Ei($)})}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 Y,V=ne(void 0);function N(t){if(!("steps"in e.tour)||!Ei(V))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(V).children.length;e++)if(Ei(V).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&&Si().then(()=>function(t){if(y||o.$current?.state.$marker||void 0!==t.initialStep&&A(t.initialStep),y&&Ei(V)){Y=new IntersectionObserver(N,{root:Ei(V),threshold:1});for(let t=0;t<Ei(V).children.length;t++)Y.observe(Ei(V).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($,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(),Y&&Y.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=Zt(()=>"steps"in e.tour?void 0:e.tour),Z=Zt(()=>Ei(G)?Ei(G).i18n?.[i()]?.audio??c.$marker?.i18n?.[i()]?.audio:void 0),j=Zt(()=>Ei(Z)?.src);var K=Hi(),J=Me(K),tt=t=>{var i=Hi(),n=Me(i),a=t=>{var i=io(),r=Me(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=Me(i),r=t=>{Za(t,{get marker(){return Ei(e)}})};vs(s,t=>{Ei(e)&&t(r)}),Gi(t,i)}),q(r),fr(r,t=>oe(V,t),()=>Ei(V));var n=_e(r,2),a=t=>{zn(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=ro();let n;var a=ke(i),h=t=>{var i=Hi(),r=Me(i),n=t=>{eo(t,{get tour(){return e.tour},onended:C})},a=t=>{var i=so(),r=Me(i);{let t=Zt(()=>0==Ei($));zn(r,{type:"arrow-left",get title(){return s().tourStepPrev},get disabled(){return Ei(t)},onclick:M})}var n=_e(r,2);zn(n,{noClick:!0,children:(t,i)=>{W();var s=Ui();Ve(()=>ns(s,`${Ei($)+1} / ${e.tour.steps.length??""}`)),Gi(t,s)},$$slots:{default:!0}});var a=_e(n,2);{let t=Zt(()=>Ei($)==e.tour.steps.length-1);zn(a,{type:"arrow-right",get title(){return s().tourStepNext},get disabled(){return Ei(t)},onclick:_})}Gi(t,i)};vs(r,t=>{v?t(n):t(a,-1)}),Gi(t,i)},c=t=>{za(t,{get tour(){return e.tour},get src(){return Ei(j)},get fullscreen(){return o},controls:!0,autoplay:!0,onended:C,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=_e(a,2),d=t=>{zn(t,{type:"close",get title(){return s().close},onclick:P})};vs(l,t=>{e.tour.cannotClose||t(d)}),q(i),Ve(()=>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,()=>mn,()=>({duration:200})),Gi(t,i)},c=t=>{za(t,{get tour(){return Ei(G)},get src(){return Ei(j)},autoplay:!0,onended:C,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=>{za(t,{get tour(){return Ei(G)},get src(){return Ei(j)},autoplay:!0,onended:C,get currentTime(){return Ei(U)},set currentTime(t){oe(U,t,!0)}})};vs(J,t=>{a()?Ei(G)&&t(st,1):t(tt)}),Gi(t,K),it(),n()}var ao,oo=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)}};!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 ho=Bi('<span class="micrio-dial"> </span>'),co=Bi('<div data-scroll-through="" class="micrio-dial"><!></div>');var lo,uo=Bi("<button>✥</button>"),mo=Bi("<span></span>"),go=Bi('<span class="hover-label micrio-gallery"> </span>'),po=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 fo(t,e){et(e,!0);const i=()=>xt(w,"$settings",n),s=()=>xt(v,"$layer",n),r=()=>xt(bn,"$i18n",n),[n,a]=kt(),o=t=>[t,0,1,1];let h=br(e,"controller",3,null);const c=Li(()=>h()?[...h().images]:[]),l=Q("micrio"),{engine:d,current:u,events:m,_lang:g}=l,p=xt(u,"$current",n),f=p.$info,v=p.state.layer,w=p.settings,y=p.camera;if(i().omni){const t=i().omni;for(let e=0;e<t.frames;e++)c.push({id:f.id+"/"+e,image:p,visible:vt(!1),frame:e,opts:{area:[0,0,1,1]},ptr:-1,baseTileIdx:-1,thumbSrc:p.getTileSrc(p.levels,0,0,e)})}const b=Li(()=>h()?.config??i().gallery),x="switch"==b.type,T=!x&&!("frame"in(c[0]??{})),k=i().omni,M=!!k,_=!!k,S=!!b.isSpreads,E=b.coverPages??0,A=!!k?.twoAxes,I=b.startId,L=b.archive,P=!!i().limitToCoverScale,C=!!i().noUI,$=k?.frontIndex??0,D=k?.layers?.length??1,z=i()?.omni?.startIndex;let O=null==z||isNaN(z)?I?c.findIndex(t=>t.id==I):0:z;O<0&&(O=0);const R=[],X=[];if(T)for(let q=0;q<c.length;q++)R.push([0,0,1,1]),X.push([q]);else if(c)for(let q=0;q<c.length;q++){const t=c[q].opts?.area;if(!t)continue;const e=[t[0],t[1],t[2],t[3]];if(X.push([q]),S&&q-E>=0&&(q-E)%2==0&&c[q+1]){const t=c[++q].opts?.area;if(!t)continue;X[X.length-1].push(q),e[2]=e[2]+t[2],e[3]=Math.max(e[3],t[3])}R.push(e)}const F=R.length/D,Y=k?.layers?.map(t=>({i18n:Object.fromEntries(Object.entries(t.i18n).map(([t,e],i)=>[t,{title:e??"Layer "+(i+1)}]))}))??[];Object.keys(f.revision??{[(()=>xt(g,"$_lang",n))()]:0}).forEach(t=>Y.forEach((e,i)=>{e.i18n[t]||(e.i18n[t]={title:"Layer "+(i+1)})}));let V=ne(-1),N=x,B=ne(!0),W=ne(!0),U=ne(0);function H(t,e=!1,i=150,s=!1){if(_){for(;t<0;)t+=F;t%=F}const r=t=Math.round(Math.max(0,Math.min(F-1,t))),n=s||r!=Ei(V);if(oe(V,r,!0),n&&Z(),T)!function(t,e,i,s){if(!c[t])return;const r=0===i?0:e?G/2:G,n=c[Ei(V)>-1&&Ei(V)!=t?Ei(V):-1],a=s&&r>0&&n?.camera&&!n.camera.isZoomedOut(),h=()=>{d.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,h=e-t,l=o(h),d=Math.abs(h)<=1,u=Math.abs(s[0]-l[0])>1e-4||Math.abs(s[2]-l[2])>1e-4,m=r>0&&u&&(a||d);i.camera.setArea(l,{direct:!m,noDispatch:!0})}d.render()};a?n.camera.flyToCoverView({duration:1e3*r*.6,speed:2}).then(h).catch(h):h()}(Ei(V),e,i,n);else if(n){const t=X[Ei(V)];d.setActiveImage(p.ptr,t[0],t.length-1),M?d.render():(c.forEach((e,i)=>{"state"in e&&e.visible.set(t.includes(i))}),a=R[Ei(V)],h=!0,N=y.isZoomedOut(),y.setLimit(!h&&N?[-1,a[1],3,a[3]]:a),y.setView(R[Ei(V)]),Ut())}var a,h;p.album.hooked=!0}const G=.35;function Z(t){if(Wt&&t){if(Wt.currentIndex==Ei(V))return;oe(V,Wt.currentIndex,!0)}tt(Ei(V)),m.dispatch("gallery-show",Ei(V)),M&&oe(U,(Ei(V)-$)/F*360),T&&p.album?.currentImage?.set(c[Ei(V)])}const j="requestIdleCallback"in self?M?Math.max(36,2*Math.floor(c.length/8)):100:50,K=new Map,J=self.requestIdleCallback??self.requestAnimationFrame;function tt(t){const e=[];Y.length&&(t+=s()*Math.floor(c.length/Y.length)),S&&t>=E&&(t=2*t-E);const i=Math.floor(t/Dt);for(let s=-j;s<=j;s++)if(s){let r=t+s;if(A){const t=Math.floor(r/Dt);t<i&&(r+=Dt),t>i&&(r-=Dt)}if(_){for(;r<0;)r+=c.length;for(;r>=c.length;)r-=c.length}e.push(r)}if(A)for(let s=-j;s<=j;s++)s&&e.push(t+s*Dt);e.filter((t,i)=>t>=0&&t<c.length&&e.indexOf(t)==i).map(t=>c[t]).filter(t=>!!t&&!K.has(t.id)).forEach(t=>K.set(t.id,J(()=>d.getTexture(t.baseTileIdx,t.thumbSrc,!1,{force:!!L}))))}const st=16;function rt(t){if(!Ei(ot))return 0;const e=Ei(ot).clientWidth;return st+t/Math.max(1,F-1)*(e-32)}function nt(t){const e=X[t];return e?.length?1===e.length?String(e[0]+1):`${e[0]+1}–${e[e.length-1]+1}`:String(t+1)}let at,ot=ne(void 0),ht=ne(0);const ct=Zt(()=>!Ei(ot)||Ei(B)?Ei(ht):rt(Ei(V)));let lt=!1;function dt(t){t.preventDefault(),t.stopPropagation(),Ei(B)||(lt="button"in t)&&0!=t.button||!Ei(ot)||(at=Ei(ot).getClientRects()[0],l.keepRendering=oe(B,!0),oe(pt,-1),window.addEventListener(lt?"pointermove":"touchmove",mt),window.addEventListener(lt?"pointerup":"touchend",wt),mt(t))}function ut(t){const e=at??Ei(ot).getClientRects()[0],i="button"in t?t.clientX:t.touches[0].clientX,s=Math.min(1,Math.max(0,(i-e.left-st)/(e.width-32)));return[s,Math.max(0,Math.min(F-1,Math.round(s*Math.max(1,F-1))))]}function mt(t){const[e,i]=ut(t);oe(ht,st+e*(at.width-32)),i!=Ei(V)&&H(i,!0)}let gt,pt=ne(-1);function ft(t){Ei(B)||oe(pt,ut(t)[1],!0)}function wt(){window.removeEventListener(lt?"pointermove":"touchmove",mt),window.removeEventListener(lt?"pointerup":"touchend",wt),oe(B,l.keepRendering=!1,!0),H(Ei(V))}let yt=0,bt=0,Tt=0,Mt=0,_t=!1,St=!1,Et=0;function At(t){c[Ei(V)]?.camera?.isZoomedOut()&&0==t.button&&void 0===gt&&(gt=t.pointerId,yt=bt=t.clientX,Et=t.clientY,Tt=t.timeStamp,Mt=0,_t=!1,St=!1,window.addEventListener("pointermove",It),window.addEventListener("pointerup",Lt),window.addEventListener("pointercancel",Lt))}function It(t){if(t.pointerId!==gt)return;const e=t.clientX-yt,i=t.clientY-Et;if(!_t){if(Math.abs(e)<6&&Math.abs(i)<6)return;if(St=Math.abs(e)>Math.abs(i),!St)return void Lt(t);_t=!0,l.setAttribute("data-panning",""),l.keepRendering=!0,l.canvas.element.setPointerCapture(t.pointerId)}const s=Math.max(1,t.timeStamp-Tt);Mt=(t.clientX-bt)/s,bt=t.clientX,Tt=t.timeStamp,function(t){const e=0==Ei(V)&&t>0,i=Ei(V)==c.length-1&&t<0,s=e||i?Math.sign(t)*Math.sqrt(Math.abs(t))*.3:t;c[Ei(V)]?.camera?.setArea(o(s),{direct:!0,noDispatch:!0}),s<0&&Ei(V)<c.length-1?c[Ei(V)+1]?.camera?.setArea(o(1+s),{direct:!0,noDispatch:!0}):s>0&&Ei(V)>0&&c[Ei(V)-1]?.camera?.setArea(o(-1+s),{direct:!0,noDispatch:!0});d.render()}(e/(l.offsetWidth||1))}function Lt(t){if(t.pointerId!==gt)return;window.removeEventListener("pointermove",It),window.removeEventListener("pointerup",Lt),window.removeEventListener("pointercancel",Lt);const e=_t;if(gt=void 0,_t=!1,l.removeAttribute("data-panning"),l.keepRendering=!1,!e)return;try{l.canvas.element.releasePointerCapture(t.pointerId)}catch(n){}const i=l.offsetWidth||1,s=(t.clientX-yt)/i;let r=Ei(V);s<-.3||Mt<-.5?r=Math.min(c.length-1,Ei(V)+1):(s>.3||Mt>.5)&&(r=Math.max(0,Ei(V)-1)),H(r)}let Pt=0,Ct=[0,0,0,0];function $t(t){t.stopPropagation(),t.preventDefault(),0==t.button&&(oe(B,!0),Ct=[t.clientX,t.clientY,Ei(V),Pt],window.addEventListener("pointermove",Ot),window.addEventListener("pointerup",Rt))}const Dt=c.length,zt=1;function Ot(t){Pt=Math.max(0,Math.min(zt-1,Ct[3]+Math.round((Ct[1]-t.clientY)/360*zt)));let e=(Ct[2]+Math.round((Ct[0]-t.clientX)/360*Dt))%Dt;for(;e<0;)e+=Dt;H(Pt*Dt+e)}function Rt(){removeEventListener("pointermove",Ot),removeEventListener("pointerup",Rt),oe(B,!1)}let Xt=-1;const Ft=()=>{Y.length&&p.data.update(t=>{t||(t={}),t.pages||(t.pages=[]);const e={id:"_omni-layers",i18n:Y[s()].i18n,icon:xn.layerGroup,children:Y.map((t,e)=>({id:"omni-layer-"+e,i18n:t.i18n,action:()=>{v.set(e),tt(Ei(V))}})).filter(t=>t.id!="omni-layer-"+s())};return Xt>=0&&Xt<t.pages.length?t.pages.splice(Xt,1,e):t.pages.push(e),Xt=t.pages.length-1,t})};let Yt=l.state.ui.hidden,Vt=l.state.ui.hover;const{popup:Nt,tour:Bt}=l.state;let qt,Wt;function Ut(){Yt.set(!1),clearTimeout(qt),qt=setTimeout(()=>Yt.set(!0),2e3)}p.album={numPages:R.length,get currentIndex(){return Ei(V)},info:p.$settings.gallery,prev:()=>H(Ei(V)-1),next:()=>H(Ei(V)+1),goto:H,...T?{currentImage:vt(c[O])}:{}},ps(()=>{(T?Promise.all(c.map(t=>d.addChild(t,p))):Promise.all(c.map(t=>("state"in t&&!("image"in t)&&(t.camera=p.camera),d.addEmbed(t,p,{opacity:0,asImage:"camera"in t}))))).then(()=>{if(T){d.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(o(t-O),{direct:!0,noDispatch:!0}),e.camera.setView([0,0,1,1],{noRender:!0}))}c[O]?.visible.set(!0),oe(V,O,!0),Z(),p.album.hooked=!0,d.render()}else d.setActiveImage(p.ptr,O),H(O,!1,0);oe(B,!1)}),M&&D>1&&Ft(),oe(W,!1),l.goto=H;const t=[],e=[];if(M&&t.push(p.state.layer.subscribe(Ft)),M&&(Wt=p.swiper=new oo(l,F,H,{continuous:_,coverLimit:P})),e.push(()=>{l.canvas.element.removeEventListener("pointermove",Ut),l.canvas.element.removeEventListener("pointerdown",Ut)}),M||A||(l.canvas.element.addEventListener("pointermove",Ut),l.canvas.element.addEventListener("pointerdown",Ut),Ut()),x&&t.push(p.state.view.subscribe(()=>{N=y.isZoomedOut()})),!(x||c.length<=1)&&(A||oe(ht,rt(O),!0),T)){const t=At;l.canvas.element.addEventListener("pointerdown",t),e.push(()=>l.canvas.element.removeEventListener("pointerdown",t))}return M&&l.addEventListener("move",Z),()=>{for(Wt&&Wt.destroy();t.length;)t.shift()?.();for(;e.length;)e.shift()?.();M&&l.removeEventListener("move",Z),Vt.set(!1)}});var Ht=Hi();Oi("keydown",pe,function(t){if(!i().omni?.noKeys){switch(t.key){case"PageUp":case"ArrowLeft":H(Ei(V)-(M?-1:1),!0);break;case"PageDown":case"ArrowRight":H(Ei(V)+(M?-1:1),!0);break;case"ArrowUp":A&&H(Ei(V)+Dt);break;case"ArrowDown":A&&H(Ei(V)-Dt);break;case"Home":H(0);break;case"End":H(F);break;default:return}Ut()}});var Gt=Me(Ht),jt=t=>{var e=Hi(),s=Me(e),a=t=>{var e=uo();let i;Ve(()=>i=qs(e,1,"angular micrio-gallery",null,i,{dragging:Ei(B)})),Oi("pointerdown",e,$t,!0),Gi(t,e)},o=t=>{{let e=Zt(()=>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=Zt(()=>-e.currentRotation/360*(Ei(n)?.offsetWidth??0));var d=co(),u=ke(d),m=t=>{var i=ho(),s=ke(i);q(i),Ve(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)),Ve(()=>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(U)},get frames(){return F},get degrees(){return Ei(e)},onturn:t=>H(t)})}},h=t=>{const e=Zt(()=>F),i=Zt(()=>c.length),s=Zt(()=>Ei(e)>24),a=Zt(()=>Ei(s)?Math.max(1,Math.ceil(Ei(e)/24)):1),o=Zt(()=>Ei(e)>1?Ei(V)/(Ei(e)-1)*100:0);var h=po();let l;var d=ke(h);{let t=Zt(()=>0==Ei(V));zn(d,{type:"arrow-left",get title(){return r().galleryPrev},className:"gallery-btn",onpointerdown:t=>0===t.button&&H(Ei(V)-1),get disabled(){return Ei(t)}})}var u=_e(d,2);let m;var g=ke(u),p=ke(g);q(g);var f=_e(g,2);bs(f,21,()=>R,ws,(t,i,r)=>{var n=Hi(),o=Me(n),h=t=>{var i=mo();let n;Ve(()=>{n=qs(i,1,"tick micrio-gallery",null,n,{major:Ei(s)&&r%(5*Ei(a))==0,active:r===Ei(V),hover:r===Ei(pt)}),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(V)||t(h)}),Gi(t,n)}),q(f);var v=_e(f,2),w=t=>{var i=go(),s=ke(i,!0);q(i),Ve(t=>{Us(i,`left:${Ei(e)>1?Ei(pt)/(Ei(e)-1)*100:50}%`),ns(s,t)},[()=>nt(Ei(pt))]),Gi(t,i)};vs(v,t=>{Ei(pt)>=0&&Ei(pt)!==Ei(V)&&!Ei(B)&&t(w)});var y=_e(v,2);let b;ar(y,"aria-valuemin",1);var x=_e(y,2);let T;var k=ke(x);q(x),q(u),fr(u,t=>oe(ot,t),()=>Ei(ot));var M=_e(u,2);{let t=Zt(()=>Ei(V)>=Ei(e)-1);zn(M,{type:"arrow-right",get title(){return r().galleryNext},className:"gallery-btn",onpointerdown:t=>0===t.button&&H(Ei(V)+1),get disabled(){return Ei(t)}})}q(h),Ve(t=>{l=qs(h,1,"micrio-gallery",null,l,{hidden:Ei(W)||xt(Yt,"$hidden",n)&&!xt(Vt,"$hover",n)&&!Ei(B),"force-hidden":xt(Nt,"$popup",n)||xt(Bt,"$tour",n)}),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(B)}),Us(y,`left: ${Ei(ct)}px`),ar(y,"aria-valuemax",Ei(i)),ar(y,"aria-valuenow",(X[Ei(V)]?.[0]??Ei(V))+1),T=qs(x,1,"handle-label micrio-gallery",null,T,{dragging:Ei(B)}),Us(x,`left: ${Ei(ct)}px`),ns(k,`${t??""}${Ei(s)?` / ${Ei(i)}`:""}`)},[()=>nt(Ei(V))]),Ri("pointerover",h,()=>Vt.set(!0)),Ri("pointerout",h,t=>{t.currentTarget.contains(t.relatedTarget)||Vt.set(!1)}),Ri("focusin",h,()=>Vt.set(!0)),Ri("focusout",h,t=>{t.currentTarget.contains(t.relatedTarget)||Vt.set(!1)}),Oi("pointerdown",u,dt,!0),Oi("touchstart",u,dt,!0,!0),Ri("pointermove",u,ft),Oi("pointerleave",u,()=>oe(pt,-1)),Gi(t,h)};vs(s,t=>{A?t(a):k&&!k.noDial&&M?t(o,1):!M&&c.length>1&&t(h,2)}),Gi(t,e)};vs(Gt,t=>{C||t(jt)}),Gi(t,Ht),it(),a()}Xi(["pointerover","pointerout","focusin","focusout","pointermove"]);var vo,wo,yo={},bo=vt(),xo=vt(!1);function To(t,e,i){wo&&(wo.setPosition?wo.setPosition(t,e,i):"positionX"in wo&&(wo.positionX.value=t,wo.positionY.value=e,wo.positionZ.value=i))}function ko(t,e,i){wo&&(wo.setOrientation?wo.setOrientation(t,e,i,0,1,0):"forwardX"in wo&&(wo.forwardX.value=t,wo.forwardY.value=e,wo.forwardZ.value=i))}function Mo(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=()=>xo.set(!0),u=()=>{"suspended"===vo?.state?vo.resume().then(()=>{}).catch(()=>{}):vo||d()},m=new Audio("data:audio/mpeg;base64,/+MYxAAAAANIAUAAAASEEB/jwOFM/0MM/90b/+RhST//w4NFwOjf///PZu////9lns5GFDv//l9GlUIEEIAAAgIg8Ir/JGq3/+MYxDsLIj5QMYcoAP0dv9HIjUcH//yYSg+CIbkGP//8w0bLVjUP///3Z0x5QCAv/yLjwtGKTEFNRTMuOTeqqqqqqqqqqqqq/+MYxEkNmdJkUYc4AKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq");m.volume=Gn.iOS?0:1e-4,document.body.appendChild(m),l&&ps(()=>{let t,i;return i=xo.subscribe(s=>{s&&(vo||(!function(t){if(!lo){if(vo||(vo="micrioAudioContext"in window?window.micrioAudioContext:"AudioContext"in window?new window.AudioContext:"webkitAudioContext"in window?new window.webkitAudioContext:null),!vo)return console.warn("[Micrio] Your browser does not support the Web Audio API");"suspended"===vo.state&&vo.resume().then(()=>{}).catch(()=>{}),(lo=vo.createGain()).connect(vo.destination),lo.gain.value=t,bo.set(vo),"upX"in(wo=vo.listener)&&(wo.upX.value=0,wo.upY.value=1,wo.upZ.value=0)}}(r()),n.dispatch("audio-init")),vo&&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;To(r,n,a);let o=r*r+n*n+a*a;o>0&&(o=1/Math.sqrt(o)),ko(r*o,n*o,a*o)}else To(2*(t-.5),2*(.5-i)*c,s),ko(0,0,-1)}(t[0]+t[2]/2,t[1]+t[3]/2,i*(e.is360?1:1.5))})),i&&(i(),i=null))}),vo||(m.play().then(d).catch(()=>n.dispatch("autoplay-blocked")),addEventListener("pointerup",u,{once:!0})),()=>{t&&t(),i&&i(),removeEventListener("pointerup",u),m.remove()}}),Re(()=>{const t=r();lo&&(lo.gain.value=t)});var g=Hi(),p=Me(g),f=t=>{{let t=Zt(()=>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(){(i()||n+1!=e.list.length)&&(r.src=e.list[++n%e.list.length].src??"",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(p,t=>{xt(xo,"$interacted",i)&&xt(bo,"$ctx",i)&&e.data.music?.items.length&&t(f)}),Gi(t,g),it(),s()}var _o=Bi('<cite class="micrio-details"> </cite>'),So=Bi('<small class="micrio-details"> </small>'),Eo=Bi('<summary class="micrio-details"><!> <!></summary>'),Ao=Bi('<p class="micrio-details"><a rel="noopener noreferrer" target="_blank"> </a></p>'),Io=Bi("<details><!> <!> <!> <!></details>");function Lo(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=Zt(()=>i()?.$settings.cmWidth),d=Zt(()=>i()?.$settings.cmHeight),u=Zt(()=>s()?s()?.i18n?s().i18n[xt(a,"$_lang",r)]:s():void 0),m=Zt(()=>Ei(u)?.title??xt(e.info,"$info",r)?.title??""),g=Zt(()=>Ei(u)?.description),p=Zt(()=>Ei(u)?.sourceUrl),f=Zt(()=>Ei(u)?.copyright),v=Zt(()=>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=Me(y),x=t=>{var e=Io();let i;var s=ke(e),n=t=>{var e=Eo(),i=ke(e),s=t=>{var e=_o(),i=ke(e,!0);q(e),Ve(()=>ns(i,Ei(m))),Gi(t,e)};vs(i,t=>{Ei(m)&&t(s)});var r=_e(i,2),n=t=>{var e=So(),i=ke(e,!0);q(e),Ve(()=>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=_e(s,2),o=t=>{var e=Hi();_s(Me(e),()=>Ei(g)),Gi(t,e)};vs(a,t=>{Ei(g)&&t(o)});var c=_e(a,2),l=t=>{var e=Ao(),i=ke(e),s=ke(i,!0);q(i),q(e),Ve(()=>{ar(i,"href",Ei(p)),ns(s,Ei(f)||Ei(p))}),Gi(t,e)};vs(c,t=>{Ei(p)&&t(l)});var d=_e(c,2),u=t=>{zn(t,{type:"close",get title(){return xt(bn,"$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)),Ve(()=>i=qs(e,1,"micrio-details",null,i,{opened:Ei(h)})),Ds(3,e,()=>mn,()=>({duration:200})),Gi(t,e)};vs(b,t=>{(Ei(m)||Ei(g)||Ei(p))&&t(x)}),Gi(t,y),it(),n()}var Po=Bi('<div class="micrio-error"><!> </div>');var Co=Bi('<figcaption class="micrio-micrio-gallery"></figcaption>'),$o=Bi('<figure class="micrio-micrio-gallery"><micr-io></micr-io> <!></figure>',2);function Do(t,e){et(e,!0);const[i,s]=kt();let r=br(e,"startId",3,void 0);const{_lang:n,current:a}=Q("micrio");let o=ne(void 0),h=ne(0);const c=Zt(()=>e.gallery[Ei(h)]),l=Zt(()=>Ei(c)?.i18n?.[xt(n,"$_lang",i)]?.description??void 0);ps(async()=>{await Si();const t=xt(a,"$current",i)?.$info?.path;Ei(o)?.openGallery(e.gallery,r(),t)}),fs(()=>Ei(o)?.destroy());var d=$o(),u=ke(d);or(u,"data-logo","false"),qs(u,1,"micrio-micrio-gallery"),fr(u,t=>oe(o,t),()=>Ei(o));var m=_e(u,2),g=t=>{var e=Co();_s(e,()=>Ei(l),!0),q(e),Gi(t,e)};vs(m,t=>{Ei(l)&&t(g)}),q(d),Oi("gallery-show",u,t=>{oe(h,t.detail,!0)}),Gi(t,d),it(),s()}var zo=Bi("<!> <!>",1),Oo=Bi("<aside><!> <!></aside>"),Ro=Bi("<!> <!>",1),Xo=Bi('<menu class="micrio-popover"></menu>'),Fo=Bi('<h2 class="micrio-popover"> </h2>'),Yo=Bi('<img alt=""/>'),Vo=Bi("<!> <!> <!> <!>",1),No=Bi('<menu class="right micrio-popover"></menu>'),Bo=Bi("<!> <!> <!>",1),qo=Bi("<dialog><!> <!></dialog>");function Wo(t,e){et(e,!0);const i=()=>xt(l,"$current",n),s=()=>xt(d,"$_lang",n),r=()=>xt(bn,"$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=Zt(()=>e.popover.marker),b=Zt(()=>Ei(y)?.i18n?.[s()]),x=Zt(()=>e.popover.markerTour),T=Zt(()=>e.popover.contentPage),k=Zt(()=>Ei(T)?.i18n?.[s()]),M=Zt(()=>Ei(T)&&Ei(k)&&!Ei(T)?.buttons?.length?!(!Ei(k).embed||Ei(k).content&&!(Ei(k).content.length<250)||Ei(T).image):void 0),_=Zt(()=>Ei(T)?.image?"string"==typeof Ei(T).image?Ei(T).image:Ei(T).image.src:void 0),S=Zt(()=>!!Ei(k)?.embed||!!Ei(_)),E=Zt(()=>!!Ei(T)?.buttons?.find(t=>"close"==t.type)),A=Zt(()=>!!e.popover.marker?.images&&e.popover.marker.images.length>0),I=Zt(()=>!(!Ei(b)||!Ei(b).body)||Ei(A)),L=Zt(()=>Ei(b)&&Ei(b).body||Ei(A)&&Ei(k)?.embed),P=Zt(()=>!Ei(E)||Ei(x)&&null!=Ei(x).currentStep);var C=qo();let $;var D=ke(C),z=t=>{var e=Oo();let i;var s=ke(e),n=t=>{zn(t,{type:"close",get title(){return r().close},className:"close-popover",onclick:g})};vs(s,t=>{Ei(E)||t(n)});var a=_e(s,2),o=t=>{var e=zo(),i=Me(e),s=t=>{zn(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=_e(i,2),a=t=>{zn(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),Ve(()=>i=qs(e,1,"micrio-popover",null,i,{inside:Ei(T)?!Ei(M):!Ei(I)&&!Ei(b)?.embedUrl})),Gi(t,e)};vs(D,t=>{Ei(P)&&t(z)});var O=_e(D,2),R=t=>{var e=Ro(),i=Me(e),s=t=>{za(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=>{Do(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=_e(i,2),a=t=>{{let e=Zt(()=>!Ei(b)||!Ei(b).embedUrl);qa(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=>{Do(t,{get gallery(){return e.popover.gallery},get startId(){return e.popover.galleryStart}})},F=t=>{var e=Bo(),r=Me(e),n=t=>{var e=Xo();bs(e,21,()=>m,ws,(t,e)=>{{let i=Zt(()=>Bn?.of(Ei(e))??Ei(e)),r=Zt(()=>Ei(e)==s());zn(t,{onclick:()=>o.lang=Ei(e),get title(){return Ei(i)},get active(){return Ei(r)},children:(t,i)=>{W();var s=Ui();Ve(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=_e(r,2),h=t=>{var e=Hi(),i=Me(e),s=t=>{za(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=>{Ra(t,{children:(t,e)=>{var i=Vo(),s=Me(i),r=t=>{var e=Fo(),i=ke(e,!0);q(e),Ve(()=>ns(i,Ei(k).title)),Gi(t,e)};vs(s,t=>{Ei(k).title&&t(r)});var n=_e(s,2),a=t=>{za(t,{get src(){return Ei(k).embed},controls:!0})};vs(n,t=>{Ei(k).embed&&Ei(f)&&t(a)});var o=_e(n,2),h=t=>{var e=Yo();Ve(()=>ar(e,"src",Ei(_))),Gi(t,e)};vs(o,t=>{Ei(_)&&t(h)});var c=_e(o,2),l=t=>{var e=Hi();_s(Me(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(M)?t(h):t(c,-1)});var l=_e(a,2),d=t=>{var e=No();bs(e,21,()=>Ei(T).buttons,ws,(t,e)=>{{let r=Zt(()=>"link"==Ei(e).type?Ei(e).action:void 0);zn(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();Ve(()=>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(C),fr(C,t=>oe(w,t),()=>Ei(w)),Ve(()=>$=qs(C,1,"micrio-popover",null,$,{page:!!Ei(T),article:!!Ei(T)&&!Ei(M),"has-media":Ei(S),gallery:!!e.popover.gallery})),Oi("close",C,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",C,()=>p.set(!0)),Gi(t,C),it(),a()}function Uo(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=Xn(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 Ho(t,e){et(e,!0);const i=Zt(()=>e.marker.positionalAudio),s=Li(()=>e.ctx).createGain();lo&&s.connect(lo);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=yo[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&&(yo[Ei(i).src]||(yo[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 Go=Bi('<img alt="" class="micrio-marker"/>'),Zo=Bi('<label data-scroll-through=""> </label>'),jo=Bi('<button data-scroll-through="" class="micrio-marker"><!> <!></button>'),Ko=Bi("<div><!></div>"),Jo=Bi("<!> <!>",1);function Qo(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(bo,"$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),M=br(e,"image",31,()=>ue(i())),_=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 A=b.has(k().id);!A&&M()&&b.set(k().id,M());const I=!(!M().isOmni||!M().$settings.omni?.sideLabels||M().$settings._markers?.noTitles),L=t=>t.steps.findIndex(t=>t.startsWith(k().id))>=0,P=k().data??{},C=P._meta||{},$=M().$settings.omni,D=k().data?.micrioSplitLink?.split(",").map(t=>t.trim()),z=D?{micrioId:D[0],markerId:D[1],follows:!!D[2]&&"false"!=D[2]}:void 0;k().imageLayer&&k().imageLayer>($?.layers?.length??1)-1&&delete k().imageLayer,i()?.$data?.markers?.find(t=>z?.markerId==k().id&&"none"!=t.popupType)&&(k(k().popupType="none",!0),k(k().noMarker=!0,!0));const O=M().$settings._markers??{},R=!!M().$settings.doTourJumps,X=k().tags.join(" "),F="cluster"==k().type,Y=!1===k().data?.showTitle||!!O.noTitles||!!$?.sideLabels,V=!!P.scales||!!M().$settings.markersScale,N=V&&!!O.titlesNoScale,B=!!O.keepPopupsDuringTourTransitions,W=/[?&]micrioNoTooltips/.test(location.search)||!!$?.sideLabels,U=C.gridAction,H=M().$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,G=H?.steps.findIndex(t=>t.startsWith(k().id)),Z=!!M().$settings?._markers?.autoStartTourAtBeginning;let j=!A&&(!!P.alwaysOpen||m.$marker==k())||m.$tour?.id==H?.id&&H?.currentStep==(G??0);let K,J,tt,st=ne(ue(A&&M().state.$marker==k())),rt=ne(!1),nt=ne(""),at=ne(0),ot=ne(0),ht=ne(1),ct=!1;function lt(){if(ut(),k().onclick)return k().onclick(k());if(!O.noMarkerActions)if("cluster"==k().type){if(k().view&&i()?.$info){const t=i().camera.getScale();M().camera.flyToView(k().view,{area:M().opts?.area,limitZoom:!0,margin:[20/i().$info.width*t,20/i().$info.height*t]})}}else M().state.marker.set(k())}function dt(){O.noMarkerActions||(Ei(St)?.parentNode?.scrollTo(0,0),ut(),tt=setTimeout(()=>{const t=M().camera.getXY(k().x,k().y);!Ei(st)&&(t[0]<0||t[0]>=l.offsetWidth||t[1]<0||t[1]>=l.offsetHeight||M().is360&&t[3]>4)&&M().camera.flyToCoo([k().x,k().y],{speed:2,limit:!0}).catch(()=>{})},150))}function ut(){clearTimeout(tt)}const mt=()=>v.set(k().id),gt=()=>v.set(void 0);let pt;async function ft(){if(F)return;if(M().state.$marker!=k())return M().state.marker.set(k());if(O.noMarkerActions)return;if(H&&H.id!=s()?.id&&!s()){H.initialStep=Z?0:G;const t=H.stepInfo?.[0];if(Z&&t&&t.micrioId!=M().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(H),setTimeout(()=>C.gridAction=U,100),Z&&null!=G&&G>0)return void M().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(Ct)?"popover"==k().popupType?(await Si(),l.state.popover.set({marker:k(),image:M(),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(()=>M().state.marker.set(void 0))):Si().then(()=>x.set(k())));const e=P.micrioLink?.id;if(e&&Si().then(()=>{M().camera.stop();const t=Uo(l,e);t&&(M(M().openedView=void 0,!0),M().state.marker.set(void 0)),l.open(e,{vector:t?.vector})}),z&&!ct&&!M().opts.secondaryTo){const t=l.canvases[0]?.grid;t?.lastPromise&&await t.lastPromise,pt=setTimeout(()=>{z&&(J=l.open(z.micrioId,{splitScreen:!0,splitTo:M(),isPassive:!(!z.follows||l.state.$tour),startView:z.view}),ct=!0)},200)}}let vt,yt,bt=ne(!1);function Tt(){if(M().is360&&V)oe(nt,M().camera.getMatrix(k().x,k().y,1,1,0,0,0).join(","),!0);else{let i=Ei(at),s=Ei(ot);if(t=M().camera.getXYDirect(k().x,k().y,{radius:k().radius,rotation:k().rotation}),e=w(t,4),oe(at,e[0],!0),oe(ot,e[1],!0),oe(ht,e[2],!0),K=e[3],M().is360)oe(rt,K>0);else if(M().isOmni&&$){if(null!=Ei(Dt)[0]&&null!=Ei(Dt)[1]&&null!=k().rotation){const t=$.frames/($.layers?.length??1);let e=(M().swiper?.currentIndex??0)-(Ei($t)??0);e>t/2&&(e-=t),e<-t/2&&(e+=t),oe(rt,e<=Ei(Dt)[0]||e>=Ei(Dt)[1],!0)}else $.distance&&oe(rt,K<0);$.sideLabels&&!O.noTitles&&Ei(It)?.title&&y&&(i!=Ei(at)||s!=Ei(ot))&&function(t,e){const i=l.canvas.element.offsetWidth,s=l.canvas.element.offsetHeight,r=!(t<0||t>i||e<0||e>s||Ei(rt));(r||Ei(bt))&&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(bt,r,!0),s})}(Ei(at),Ei(ot))}M().$settings.clusterMarkers&&S()&&S().set(k().id,[Ei(at),Ei(ot),E()?vt:vt=Ei(Et)?.offsetWidth,E()?yt:yt=Ei(Et)?.offsetHeight])}var t,e}function Mt(t){const e=t.detail;k(k().x=e.x,!0),k(k().y=e.y,!0),Tt()}let _t=ne(void 0),St=ne(void 0),Et=ne(void 0);const At=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=[M().state.marker.subscribe(t=>{"string"==typeof t&&t==k().id?M().state.marker.set(k()):t==k()?async function(){if(Ei(st))return;if(oe(st,!0),ut(),O.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(Ct)||t&&B||(x.set(void 0),l.state.popover.set(void 0)),gt(),z?.markerId&&(J||(J=l.canvases.find(t=>t.id==z.micrioId)),J&&(ct=wt(J.visible),ct&&z?.view&&J.camera.flyToView(z.view,{isJump:!0}).catch(()=>{}))),void 0!==k().imageLayer&&M().state.layer.set(k().imageLayer);const e=H&&Z&&H!=s()&&null!=G&&G>0;e&&delete C.gridAction;const i=k().view;e||!i||P.noAnimate||k().videoTour||C.gridView?ft():j?(M().camera.setView(k().view,{area:M().opts?.area}),ft()):M().camera.flyToView(k().view,{omniIndex:Ei($t),area:M().opts?.area,isJump:!!P.doJump||R&&!!m.$tour}).then(ft).catch(()=>{s()||M().state.marker.set(void 0)})}():P.alwaysOpen||(Ei(st)&&function(){clearTimeout(pt),u.dispatch("marker-closed",k());const t=s()&&"steps"in s();if(s()||M().state.$marker||(k().videoTour||M().openedView?setTimeout(()=>M().camera.aniDoneAdd.push(()=>{wt(T)||M().state.$marker||Ei(_t)?.focus()}),10):Ei(_t)?.focus()),l.state.popover.set(void 0),!Ei(Ct)){r()!=k()||t&&B||x.set(void 0);const e=l.canvases.find(t=>t!=M()&&t.state.$marker);e&&Si().then(()=>{const t=e.state.$marker;t&&"popup"==t.popupType&&x.set(t)})}z&&J&&setTimeout(()=>{const t=wt(l.state.marker);J&&z.micrioId!=t?.data?.micrioSplitLink?.split(",")[0]&&l.close(J)},210)}(),oe(st,!1))})];return Ei(Pt)||(t.push(M().camera.image.state.view.subscribe(Tt)),Tt()),_()||Si().then(()=>{Ei(st)&&!k().noMarker&&r()&&r()!=k()&&!s()?M().state.marker.set(void 0):(j||P.alwaysOpen)&&ft()}),k().htmlElement&&Ei(St)&&Ei(St).appendChild(k().htmlElement),()=>{for(clearTimeout(pt);t.length;)t.shift()?.()}});const It=Zt(()=>k().i18n?.[n()]),Lt=Zt(()=>!(Ei(It)?.title||Ei(It)?.body||Ei(It)?.bodySecondary||Ei(It)?.embedUrl||k().images&&k().images.length)),Pt=Zt(()=>_()||k().noMarker),Ct=Zt(()=>"popup"!=k().popupType||Ei(Lt)&&!(k().videoTour&&s()&&"steps"in s()&&!s().isSerialTour)),$t=Zt(()=>M().camera.getOmniFrame((k().rotation??0)+(k().backside?Math.PI:0))),Dt=Zt(()=>k().visibleArc?[M().camera.getOmniFrame(k().visibleArc[0]),M().camera.getOmniFrame(k().visibleArc[1])]:[]),zt=Zt(()=>s()&&(!("steps"in s())&&!s().keepMarkers||O.hideMarkersDuringTour&&!xt(At,"$tourPaused",h))&&!Ei(st));Re(()=>{Ei(zt)&&Ei(bt)&&y.update(t=>{const e=t.findIndex(t=>t[0]==k());return e>=0&&t.splice(e,1),t})});const Ot=Zt(()=>"default"==k().type?void 0:"link"==k().type?"link":"media"==k().type?"play":"cluster"==k().type?void 0:k().type??void 0),Rt=Zt(()=>(null!=k().data?.customIconIdx?M().$settings._markers?.customIcons?.[k().data?.customIconIdx]:void 0)??k().data?.icon??O.markerIcon??void 0),Xt=Zt(()=>!!Ei(Ot)||!!Ei(Rt)),Ft=Zt(()=>!("class"in k()&&""===k().class||!Ei(Xt)&&"default"!=k().type)),Yt=Zt(()=>Ei(It)&&(!Y||a()&&I)&&(Ei(It).label||Ei(It).title));var Vt=Jo(),Nt=Me(Vt),Bt=t=>{var e=Ko();let i;var s=ke(e),r=t=>{var e=jo(),i=ke(e),s=t=>{var e=Go();Ve(()=>ar(e,"src","string"==typeof Ei(Rt)?Ei(Rt):Ei(Rt).src)),Gi(t,e)},r=t=>{kn(t,{get name(){return Ei(Ot)}})};vs(i,t=>{Ei(Rt)?t(s):Ei(Ot)&&t(r,1)});var n=_e(i,2),a=t=>{var e=Zo();let i;var s=ke(e,!0);q(e),fr(e,t=>oe(Et,t),()=>Ei(Et)),Ve(()=>{ar(e,"for",k().id),i=qs(e,1,"micrio-marker",null,i,{static:N}),ns(s,Ei(It)?.label||Ei(It)?.title)}),Gi(t,e)};vs(n,t=>{Ei(Yt)&&t(a)}),q(e),fr(e,t=>oe(_t,t),()=>Ei(_t)),Ve(()=>{ar(e,"title",W||F?null:Ei(It)?Ei(It).label||Ei(It).title:null),ar(e,"id",k().id)}),Ri("click",e,lt),Oi("focus",e,dt),Oi("blur",e,ut),Oi("mouseenter",e,mt),Oi("mouseleave",e,gt),Gi(t,e)};vs(s,t=>{k().htmlElement||t(r)}),q(e),fr(e,t=>oe(St,t),()=>Ei(St)),Rs(e,(t,e)=>{return s=e,(i=t).addEventListener("change",s),{destroy:()=>i.removeEventListener("change",s)};var i,s},()=>Mt),Ve(()=>{ar(e,"id",`m-${k().id}`),i=qs(e,1,Ys(X),"micrio-marker",i,{overlapped:E()&&!Ei(st),cluster:F,behind:Ei(rt),hovered:xt(v,"$hovered",h)==k().id,default:Ei(Ft),mat3d:!!Ei(nt),opened:Ei(st),"micrio-link":!!P.micrioLink,"has-icon":Ei(Xt),"has-custom-icon":!!Ei(Rt)}),Us(e,Ei(nt)?`--mat:matrix3d(${Ei(nt)})`:Ei(at)?`--x:${Ei(at)}px;--y:${Ei(ot)}px${V?`;--scale:${Ei(ht)}`:""}`:null)}),Gi(t,e)};vs(Nt,t=>{Ei(Pt)||!M()||Ei(zt)||t(Bt)});var qt=_e(Nt,2),Wt=t=>{Ho(0,{get marker(){return k()},get ctx(){return o()},get is360(){return M().is360}})};vs(qt,t=>{k().positionalAudio&&o()&&(!k().positionalAudio.noMobile||a())&&(k().positionalAudio.alwaysPlay||Ei(st)||s()&&!("steps"in s())&&s().keepMarkers)&&t(Wt)}),Gi(t,Vt),it(),c()}Xi(["click"]);var th=Bi("<div><!></div>");function eh(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;let u=ne(void 0);const m=Uo(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??Lr(x);let k,M=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(_.x,_.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([_.x,_.y],{speed:2,limit:!0}).catch(()=>{})},150))}let E=ne(""),A=n().customIconIdx;const I=()=>{$.deleted?oe(C,!0):(A!=$.settings.customIconIdx&&(n(n().customIconIdx=$.settings.customIconIdx,!0),A=n().customIconIdx),T.custom!=M&&(M=T.custom,_=M?T:x),oe(E,a().camera.getMatrix(_.x,_.y,_.baseScale*_.scale,1,_.rotX,_.rotY,_.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 C=ne(!1);const $={coords:T,settings:n()};I(),ps(()=>{$.el=Ei(w),Ei(w)._iface=$,cn.getData(Li(()=>e.targetId)).then(t=>{t&&oe(u,t,!0)}),o.dispatchEvent(new CustomEvent("wp-print",{detail:$}));const t=a().state.view.subscribe(I);return()=>t()});const D=Zt(()=>n().i18n?.[i()]?.title||Ei(u)?.i18n?.[i()]?.title),z=Zt(()=>c?.icons?.[n().customIconIdx??-1]);var O=Hi(),R=Me(O),X=t=>{var i=th();let r;var n=ke(i);{let t=Zt(()=>Ei(z)?void 0:"arrow-up"),e=Zt(()=>Ei(D)??xt(bn,"$i18n",s).waypointFollow);zn(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)),Ve(()=>{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,()=>mn),Gi(t,i)};vs(R,t=>{Ei(C)||t(X)}),Gi(t,O),it(),r()}var ih,sh=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],y:i[1]+e*i[3]}),this.getView=()=>this.view,this.getViewRaw=()=>this._view,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}=Fn(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],o*=e.area[3]}if(e.prevView){const t=Fn(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(Xn(i/(2*Math.PI))*s))}null!=e.omniIndex&&(e.omniIndex=Xn(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}=Fn(t);if(e.area){const t=this.cooToArea(i,s,e.area);i=t.x,s=t.y,r*=e.area[2],n*=e.area[3]}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=Fn(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.area=t,this.image.opts.isEmbed){if(this.image.ptr>0)for(const e of this._c.images)if(e.localIdx>0)return void e.setArea(t[0],t[1],t[0]+t[2],t[1]+t[3])}else this._c.setArea(t[0],t[1],t[0]+t[2],t[1]+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)}},rh=t=>{let e=t.charCodeAt(0),i=e<91;return(e-=i?65:97)-(e>7?1:0)+(i?24:e>10?-1:0)},nh=t=>6==t.length||7==t.length;!function(t){t.Main=class{get $tour(){return this._tour}get $marker(){return this._marker}constructor(){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)})}};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())})}}}(ih||(ih={}));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||nh(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)}}},oh=[],hh=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=crypto.randomUUID(),this.__info=Lr(Ar),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.embedElements=new Map,this.state=new ih.Image(this),i.useParentCamera||(this.camera=new sh(this)),this.id=(e.id??"").replace(Sr,""),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.dataPath=e.path||this.__info.path||"https://r2.micr.io/",i.secondaryTo?(this.opacity=0,i.area=this.engine.micrio.canvas.viewport.portrait?[0,1,1,0]:[1,0,0,1],void 0===i.isPassive&&(i.isPassive=!0)):i.area||(i.area=[0,0,1,1]);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;let a,o=wt(this.visible);this.visible.subscribe(t=>{t!=o&&(o=t,i.secondaryTo&&(i.isPassive&&(a?(a(),a=null):t&&(a=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)}setError(t,e){const i=t instanceof Jr?t.displayMessage:e??(t instanceof Error?t.message:t)??"An unknown error has occurred";throw this.error=i,this.engine.micrio.printError(t instanceof Jr?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;let s;if(e.id&&e.width&&(e.settings&&Pr(Ar.settings,e.settings,{noOverwrite:!0}),this.__info=t=e),t.isIIIF=t.isIIIF||this.id.startsWith("http")||"iiif"==t.format,this.id&&(!e.width||!e.height)){const e=t=>this.setError(t,"string"==typeof t?t:'Image with id "'+this.id+'" not found, published, or embeddable.');Pr(await cn.getInfo(this.id).then(e=>(e?.id&&!t.isIIIF&&this.id.split("/").length>=3&&this.id.startsWith("external/")&&(s=e.id.split("/").reverse()[0],this.dataPath=e.path||"https://r2.micr.io/"),e)).catch(e),t)}const{isV5Imported:r}=((t,e)=>{if(t.settings?._meta?.noLogo&&(t.settings.noLogo=!0),t.settings?._meta?.noSmoothing&&(t.settings.noSmoothing=!0),!t.isIIIF&&7==e.length){const i=rh(e[1+rh(e)%6]);t.is360=!!(i>>4&1)||!!t.is360,t.isWebP=!(3&i),t.isPng=2==(3&i),i>>3&1&&nh(t.tilesId??e)&&(t.format="dz"),t.path||(t.path=`https://${i>>2&1?"eu":"r2"}.micr.io/`)}const i=e.startsWith("i")&&!e.includes("/");return i&&!t.tilesId&&(t.tilesId=e.slice(1)),{isV5Imported:i}})(t,this.id);Pr(e,t),s&&(this.id=t.id=s),this.tileBase=r&&!t.tileBasePath?.includes("micr.io")?t.tileBasePath??"https://b.micr.io/":r?_r:t.tileBasePath??t.path??"https://r2.micr.io/";const n=cn.getOrganisation();if(n?.baseUrl&&!e.path?(this.dataPath=t.path=n.baseUrl,r||(this.tileBase=this.dataPath)):("https://eu.micr.io/"==t.path||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."));const e=t.settings.gallery=t.settings.gallery??{};e.type="switch",e.archive=t.id}if(!n?.branding||t.settings&&t.settings.noUI||this.loadStyle(this.dataPath+"style/"+n.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&&t.id.includes("/")&&(t.id=("@id"in t?t["@id"]:t.id).replace(/^.*\//,"")),t.spacesId&&!i.spaceData&&(i.spaceData=cn.getSpaceData(t.spacesId),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 a=wt(i._lang);if(t.revision){const e=Object.keys(t.revision);e.length&&!e.includes(a)&&(i.lang=e[0])}const o=t.settings;o&&!o?.noExternals&&await Promise.all([o.css?this.loadStyle(o.css.href):null,o.js?this.loadScript(o.js.href,a):null].filter(t=>!!t));for(let c=t.tileSize;c<Math.max(t.width,t.height);c*=2,this.levels++);let h=Math.max(t.width,t.height);do{this.dzLevels++}while((h/=2)>1);return o?.gallery?.archive&&(this.levels-=1-(o.gallery.archiveLayerOffset??0)),this.noImage||(this.thumbSrc=this.getTileSrc(this.levels,0,0)),i.events.dispatch("pre-info",t),this.noImage&&!this.isOmni||this.loadBundleData(),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}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(oh.includes(t)||document.querySelector('script[src="'+t+'"]'))i();else{oh.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(oh.includes(t)||document.head.querySelector('link[href="'+t+'"]'))e();else{oh.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)}})}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),kr(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],a=r[3],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]=t}else{const t=a*l/e;r[0]=o-t/2,r[2]=t}}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,.5]:[.5,0,.5,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],i=t[3];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,0]:[1,0,0,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()}loadBundleData(){const t=cn.getBundleImageSync(this.id);t?.data&&(t.info?.revision&&!this.__info.revision&&(this.__info.revision=t.info.revision),this.engine.micrio.events.dispatch("pre-data",{[this.id]:t.data}),this.data.set(t.data))}},ch=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:Gn.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})}cancelTimeout(){clearTimeout(this.placeTo)}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)?ca("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)}},lh=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 uh(t,e){et(e,!0);const[i,s]=kt(),r=Q("micrio"),{engine:n,canvas:a,_lang:o}=r,h=r.canvases[0]?.grid,c=h?.focussed,l=h?.markersShown;let d=br(e,"embed",15);d().src?.startsWith("/r2")&&d(d().src="http://localhost:6100"+d().src,!0);const u=e.image.$info;d().uuid||d(d().uuid=crypto.randomUUID(),!0);const m=d().uuid,g=e.image.is360,p=d().video?.autoplay??!0,f=Zt(()=>h&&xt(c,"$focussed",i)!=e.image&&l&&wt(l).indexOf(e.image)<0);let v=e.image.embeds.find(t=>t.uuid==m||t.$info?.title==m);const y=window.matchMedia("(dynamic-range: high)").matches||Gn.OSX,b=d().area,x=d().src?.toLowerCase().endsWith(".svg"),T=!(!d().width||!d().height)&&d().width*d().height<Math.pow(1024,2),k=/iPhone OS 14_/i.test(navigator.userAgent),M="data-embeds-inside-gl",_=r.getAttribute(M),S=!(x||k||!y&&!r.hasAttribute(M)&&d().video||"false"==_||(!d().micrioId||T&&d().src)&&(!d().video||d().video.controls||d().video.transparent)),E=!d().clickAction&&!d().frameSrc&&!Li(()=>e.marker),A="href"==d().clickAction?d().clickTarget:void 0,I=A&&d().clickTargetBlank;let L=ne(ue(b[2])),P=ne(ue(b[3])),C=ne(b[0]+b[2]/2),$=ne(b[1]+b[3]/2),D=ne(ue(d().scale||1)),z=ne(ue(d().rotX??0)),O=ne(ue(d().rotY??0)),R=ne(ue(d().rotZ??0)),X=ne(ue(d().scaleX??1)),F=ne(ue(d().scaleY??1)),Y=ne(""),V=ne(0);function N(){const t=d().area;oe(L,t[2],!0),oe(P,t[3],!0),oe(C,t[0]+Ei(L)/2),oe($,t[1]+Ei(P)/2),oe(D,d().scale||1,!0),oe(z,d().rotX??0,!0),oe(O,d().rotY??0,!0),oe(R,d().rotZ??0,!0),oe(X,d().scaleX??1,!0),oe(F,d().scaleY??1,!0);const e=S&&d().micrioId&&d().width,i=e?10:1;let s=Ei(L)*u.width/(d().width??100)/(S?d().width?Ei(L):1:Ei(D))*(g?Math.PI/2:1);const r=[];e&&d().width&&(s=Ei(L)/(d().width/u.width)*i*(g?Math.PI/2:1),r.push(`width:${d().width/i}px`)),r.push(`--ratio:${Ei(L)/Ei(P)*u.width/u.height};--scale:${s}`),x&&oe(Y,Ei(Y)+`height:${d().height}px`),oe(Y,r.join(";"),!0),d().video&&(d().video.width>d().video.height?oe(V,Math.min(d().video.width,Ei(L)*u.width,2048),!0):oe(V,Math.min(d().video.height,Ei(P)*u.height,2048)/(d().video.height/d().video.width)))}N();const B=Zt(()=>Math.round(Ei(L)*u.width)),q=Zt(()=>Math.round(Ei(P)*u.height));let W,U,H=ne(!1),G=ne(0),Z=ne(0),j=ne(""),K=ne(!1),J=ne("");function tt(){if(!e.image.engine.ready)return;const t=wt(e.image.viewport),i=e.image.state.$view;var s,r;i&&t?.[2]>0&&t?.[3]>0&&i[2]>0&&i[3]>0?(oe(G,t[0]+(Ei(C)-i[0])/i[2]*t[2]),oe(Z,t[1]+(Ei($)-i[1])/i[3]*t[3]),W=t[2]/(i[2]*u.width)):(s=e.image.camera.getXYDirect(Ei(C),Ei($)),r=w(s,3),oe(G,r[0],!0),oe(Z,r[1],!0),W=r[2]),g&&(oe(j,e.image.camera.getMatrix(Ei(C),Ei($),Ei(D),1,Ei(z),Ei(O),Ei(R),void 0,Ei(X),Ei(F)).join(","),!0),oe(K,!1)),oe(J,(g?`transform:matrix3d(${Ei(j)});`:`--x:${Ei(G)}px;--y:${Ei(Z)}px;--s:${W};`)+(void 0!==d().opacity&&1!==d().opacity?`--opacity:${d().opacity};`:"")),(d().video?.pauseWhenSmallerThan||d().video?.pauseWhenLargerThan)&&Ei(B)&&(oe(H,function(){if(!d().video?.pauseWhenSmallerThan&&!d().video?.pauseWhenLargerThan)return!p;const t=W?Math.max(Ei(B)*W/a.viewport.width,Ei(q)*W/a.viewport.height):0;return!!(d().video.pauseWhenSmallerThan&&t<d().video.pauseWhenSmallerThan||d().video.pauseWhenLargerThan&&t>d().video.pauseWhenLargerThan)}(),!0),Ei(ht)?._vid&&(Ei(H)?Ei(ht)._vid.paused||Ei(ht)._vid.pause():Ei(ht)._vid.paused&&(Ei(ht).cancelTimeout(),e.image?.$settings?.embedRestartWhenShown&&(Ei(ht)._vid.currentTime=0),Ei(ht)._vid.play())))}function st(){void 0===U&&(U=requestAnimationFrame(()=>{U=void 0,tt()}))}function rt(){const t="markerId"==d().clickAction?d().clickTarget:e.marker?.id;t&&e.image&&!A&&e.image.state.marker.set(t)}function nt(t){if(t&&"detail"in t){const e=t.detail;for(const t in e)d(d()[t]=e[t],!0)}N(),st()}const at=vt(!1);d().video&&(d().video.controls||d(d().video.muted=!0,!0));const ot=S&&!!d().video;let ht=ne(void 0);const ct=!S||!!d().clickAction;let lt=ne(void 0);Re(()=>{d().video&&d().id&&e.image&&e.image.setEmbedMediaElement(d().id,Ei(lt)??Ei(ht)?._vid)});const dt=Zt(()=>d().video||S?Ei(V):Ei(B)),ut=Zt(()=>d().video?Ei(V)/(d().video.width/d().video.height):Ei(q)),mt=Zt(()=>Ei(B)/Ei(dt));ps(()=>{const t=[];S&&function(){const t=d().hideWhenPaused?.01:d().opacity??1;v&&(v.ptr>=0||e.image.embeds.includes(v))?(v.camera.setArea(d().area),v.camera.setRotation(d().rotX,d().rotY,d().rotZ),n.fadeImage(v.ptr,t)):v=e.image.addEmbed({id:d().video?d().id:d().micrioId,title:m,width:d().width,height:d().height,isPng:d().isPng,isWebP:d().isWebP,isDeepZoom:d().isDeepZoom,path:u.tileBasePath??u.path,isSingle:!!d().video,isVideo:!!d().video,settings:{_360:{rotX:Ei(z),rotY:Ei(O),rotZ:Ei(R)}}},d().area,{opacity:t,asImage:!1}),ot&&kr(v.visible,{targetValue:!0}).then(()=>{oe(ht,new ch(n,v,d(),Ei(H),st),!0)}),n.render()}();const i=e.image.camera?.image,s=i&&i!==e.image?i:e.image;return(ct||d().video?.pauseWhenSmallerThan||d().video?.pauseWhenLargerThan)&&(t.push(s.state.view.subscribe(st)),t.push(s.viewport.subscribe(st))),()=>{for(Ei(ht)?.unmount(),v&&v.ptr>=0&&(n.fadeImage(v.ptr,0),n.render()),d().video&&d().id&&e.image&&e.image.setEmbedMediaElement(d().id);t.length;)t.shift()?.()}});var gt=Hi(),pt=Me(gt),ft=t=>{var s=Hi();Os(Me(s),()=>A?"a":"div",!1,(t,s)=>{Rs(t,(t,e)=>{return s=e,(i=t).addEventListener("change",s),{destroy:()=>i.removeEventListener("change",s)};var i,s},()=>nt),hr(t,()=>({id:d().id?"e-"+d().id:void 0,style:Ei(J),role:A?void 0:"figure",onclick:rt,onkeypress:rt,href:A,target:A&&I?"_blank":null,class:"",[Zs]:{"embed-container":!0,embed3d:g,"no-events":E,behind:g&&Ei(K),inactive:Ei(f),"hide-when-paused":d().hideWhenPaused&&!S&&d().video}}),void 0,void 0,void 0,"micrio-embed");var r=Hi(),n=Me(r),a=t=>{{let e=Zt(()=>d().video.muted?0:1),i=Zt(()=>!Ei(H)&&d().video.autoplay),s=Zt(()=>d().video.transparent&&d().video.hasH265);za(t,{get forcePause(){return Ei(H)},get src(){return d().video.src},get width(){return Ei(dt)},get height(){return Ei(ut)},get frameScale(){return Ei(mt)},get controls(){return d().video.controls},get destroying(){return at},get loop(){return d().video.loop},get loopDelay(){return d().video.loopAfter},get volume(){return Ei(e)},get autoplay(){return Ei(i)},get hasTransparentH265(){return Ei(s)},get _media(){return Ei(lt)},set _media(t){oe(lt,t,!0)}})}},h=t=>{za(t,{get src(){return d().frameSrc},get width(){return Ei(B)},get height(){return Ei(q)},get frameScale(){return d().scale},get autoplay(){return d().autoplayFrame},get destroying(){return at}})},c=t=>{var e=lh();Ve(()=>{ar(e,"src",d().src),Us(e,Ei(Y)),ar(e,"width",x?d().width:void 0),ar(e,"height",x?d().height:void 0)}),Gi(t,e)},l=t=>{var s=dh();Ve(()=>{Us(s,Ei(Y)),ar(s,"title",d().title||e.marker?.i18n?.[xt(o,"$_lang",i)]?.title)}),Gi(t,s)};vs(n,t=>{d().video&&!S?t(a):d().frameSrc?t(h,1):!S&&d().src?t(c,2):t(l,-1)}),Gi(s,r)}),Gi(t,s)};vs(pt,t=>{ct&&(Ei(j)||Ei(G)||Ei(Z))&&t(ft)}),Gi(t,gt),it(),s()}var mh=Wi("<line></line>"),gh=Bi('<article class="micrio-markers"><label> </label></article>'),ph=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),wh=Bi("<div><!> <!></div>"),yh=Bi("<!> <!> <!> <!>",1);function bh(t,e){et(e,!0);const i=()=>xt(g,"$settings",h),s=()=>xt(w,"$_lang",h),r=()=>xt(S,"$inView",h),n=()=>xt(_,"$hoveredId",h),a=()=>xt(v,"$switching",h),o=()=>xt(u,"$data",h),[h,c]=kt();let l=br(e,"image",15);function d([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)}const{data:u,info:m,settings:g}=l(),p=l().state.marker,f=l().engine.micrio,{switching:v,_lang:w,state:y}=f,b=f.canvas.isMobile,x=f.canvases[0]?.grid,T=x?.focussed,k=x?.markersShown,M=i().clusterMarkerRadius??16,_=y.markerHoverId,S=vt([]);tt("inView",S);const E=i()._markers??{},A=i().omni,I=!(E.noTitles||A?.sideLabels||!E.showTitles&&5!=l().id.length);let L=!1;function P(t){t?"string"==typeof t||l().openedView||t.noMarker||!t.view||(l(l().openedView=f.state.$tour&&!("steps"in f.state.$tour)?void 0:Lr(l().state.$view??l().camera?.getView()),!0),L=!!t.videoTour):l().openedView&&!f.state.$tour&&setTimeout(()=>{Ei(K)||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),L=!1},L?250:10)}let C=!1;y.tour.subscribe(t=>{t&&"steps"in t?(C=!0,t.keepLastStep&&l(l().openedView=void 0,!0)):(t||l().openedView||!C||l().camera.stop(),C=!1)});const $=[];let D=ne(""),z=ne(!1),O=ne(!1);const R=t=>(t=t?.map(t=>Math.round(100*t)/100))&&oe(D,[...$,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 X=ne(ue([])),F=M,Y=ne(ue([]));const V=new Map,N=()=>{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&&d(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(Q),V,F,l().isOmni);oe(X,t.overlapped,!0),oe(Y,t.clusterMarkers,!0)},B=[];ps(()=>{const t=[];return kr(m).then(e=>{if(!e)return;oe(z,!!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: "+(F=Number(s.markerSize))+"px"),t.push(l().viewport.subscribe(R)),i().clusterMarkers&&(t.push(l().state.view.subscribe(N)),t.push(l().data.subscribe(()=>Si().then(N)))),!l().grid&&i()._markers?.zoomOutAfterClose&&t.push(l().state.marker.subscribe(P)),l().isOmni&&i().omni?.sideLabels&&!i()._markers?.noTitles&&t.push(b.subscribe(t=>{t&&Ei(O)?function(){for(;B.length;)B.shift()?.()}():t||Ei(O)||(B.push(l().state.view.subscribe(Z)),B.push(_.subscribe(Z)),B.push(p.subscribe(Z))),oe(O,!t)}))}),()=>{for(;t.length;)t.shift()?.()}});const W=t=>!t.i18n||!!t.i18n[s()],U=t=>!t.noMarker&&W(t);let H=ne(void 0),G=ne(ue([]));function Z(){Si().then(()=>{if(!Ei(H))return;const t=f.canvas,e=t.element.offsetWidth,i=[];r().forEach(([s,r,a])=>{const o=Ei(H).querySelector('label[for="'+s.id+'"]')?.getBoundingClientRect();o?.width&&o.width>0&&i.push([r*e,a,(r>=.5?o.left:o.right)-t.viewport.left,o.top+o.height/2-t.viewport.top,n()==s.id])}),oe(G,i,!0)})}const j=(t,e)=>t.i18n?t.i18n[e]?.title:t.title,K=Zt(()=>x&&xt(T,"$focussed",h)!=l()&&k&&wt(k).indexOf(l())<0),J=Zt(()=>!a()&&f.spaceData?f.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),Q=Zt(()=>Ei(K)?[]:o()?.markers?.filter(U)),st=Zt(()=>Ei(K)?o()?.markers:o()?.markers?.filter(t=>!U(t))),rt=Zt(()=>Ei(K)?[]:o()?.markers?.filter(t=>t.clickableArea&&W(t))),nt=Zt(()=>!(!Ei(Q)?.length&&!Ei(J)?.length)),at=Zt(()=>[...r()].sort(([,,t],[,,e])=>t>e?1:t<e?-1:0));var ot=yh(),ht=Me(ot),ct=t=>{var e=fh(),i=Me(e);bs(i,21,()=>Ei(G),ws,(t,e)=>{var i=mh();let s;Ve(()=>{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 r=_e(i,2),a=ke(r);bs(a,21,()=>Ei(at).filter(([,t])=>t<.5),t=>t[0].id,(t,e)=>{var i=gh(),r=ke(i);let a;var o=ke(r,!0);q(r),q(i),Ve(t=>{ar(r,"for",Ei(e)[0].id),a=qs(r,1,"micrio-markers",null,a,{hover:n()==Ei(e)[0].id}),ns(o,t)},[()=>j(Ei(e)[0],s())]),Oi("mouseenter",r,()=>_.set(Ei(e)[0].id)),Oi("mouseleave",r,()=>_.set(void 0)),Gi(t,i)}),q(a);var o=_e(a,2);bs(o,21,()=>Ei(at).filter(([,t])=>t>=.5),t=>t[0].id,(t,e)=>{var i=ph(),r=ke(i);let a;var o=ke(r,!0);q(r),q(i),Ve(t=>{ar(r,"for",Ei(e)[0].id),a=qs(r,1,"micrio-markers",null,a,{hover:n()==Ei(e)[0].id}),ns(o,t)},[()=>j(Ei(e)[0],s())]),Oi("mouseenter",r,()=>_.set(Ei(e)[0].id)),Oi("mouseleave",r,()=>_.set(void 0)),Gi(t,i)}),q(o),q(r),fr(r,t=>oe(H,t),()=>Ei(H)),Gi(t,e)};vs(ht,t=>{Ei(O)&&Ei(at).length&&!xt(p,"$currentMarker",h)&&t(ct)});var lt=_e(ht,2),dt=t=>{var e=Hi();bs(Me(e),17,()=>Ei(rt),t=>t.id,(t,e)=>{var i=Hi(),s=Me(i),r=t=>{uh(t,{get embed(){return Ei(e).clickableArea},get marker(){return Ei(e)},get image(){return l()}})};vs(s,t=>{Ei(e).clickableArea&&t(r)}),Gi(t,i)}),Gi(t,e)};vs(lt,t=>{Ei(rt)&&t(dt)});var ut=_e(lt,2),mt=t=>{var e=wh();let i;var s=ke(e),r=t=>{var e=Hi();bs(Me(e),17,()=>Ei(J),t=>t.targetId,(t,e)=>{eh(t,yr({get image(){return l()}},()=>Ei(e)))}),Gi(t,e)};vs(s,t=>{Ei(J)&&Ei(J).length&&t(r)});var n=_e(s,2),o=t=>{var e=vh(),i=Me(e);bs(i,19,()=>Ei(Q),t=>t.id,(t,e,i)=>{{let s=Zt(()=>Ei(X).includes(Ei(i)));Qo(t,{get marker(){return Ei(e)},get image(){return l()},get coords(){return V},get overlapped(){return Ei(s)}})}}),bs(_e(i,2),17,()=>Ei(Y),t=>t.id,(t,e)=>{Qo(t,{get marker(){return Ei(e)},get image(){return l()}})}),Gi(t,e)};vs(n,t=>{Ei(Q)&&t(o)}),q(e),Ve(()=>{Us(e,Ei(nt)?Ei(D):null),i=qs(e,1,"micrio-markers",null,i,{"show-titles":I,is360:Ei(z),inactive:Ei(K)||Ei(z)&&a()})}),Gi(t,e)};vs(ut,t=>{Ei(nt)&&t(mt)});var gt=_e(ut,2),pt=t=>{var e=Hi();bs(Me(e),17,()=>Ei(st),t=>t.id,(t,e)=>{Qo(t,{get marker(){return Ei(e)},get image(){return l()},forceHidden:!0})}),Gi(t,e)};vs(gt,t=>{Ei(st)&&t(pt)}),Gi(t,ot),it(),c()}var xh=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 Th=Bi("<!> <!> <!>",1),kh=Bi("<!> <!> <!>",1),Mh=Bi("<!> <!>",1),_h=Bi("<!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!>",1);var Sh=!self.createImageBitmap,Eh=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())"+(Sh?"\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"})),Ah=Math.max(2,Math.min(6,(navigator.hardwareConcurrency||2)-1)),Ih=[],Lh=new Map,Ph=new Map,Ch=[],$h=new Map;for(let Fc=0;Fc<Ah;Fc++){const t=new Worker(Eh);t.onmessage=t=>zh(Fc,t.data.src,t.data.data,t.data.error,t.data.type),Lh.set(Fc,t),Sh&&Ph.set(Fc,new Image)}var Dh=t=>new Promise((e,i)=>{Ch.push([t,e,i]),function(){if(!Ch.length)return;let t=0;for(;t<Ah&&Ih.includes(t);t++);if(t>=Ah)return;Ih.push(t);const e=Ch.shift();if(!e)return void Ih.splice(Ih.indexOf(t),1);$h.set(t,e);const i=Lh.get(t);if(!i)return console.error(`[Micrio Texture] Worker ${t} not found!`),e[2]("Internal error: Worker not found"),void Ih.splice(Ih.indexOf(t),1);i.postMessage({src:e[0],type:"image/"+e[0].split(".").pop()})}()});function zh(t,e,i,s,r){const n=$h.get(t);if(null!=n)if($h.delete(t),setTimeout(()=>{Ih.splice(Ih.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&&Sh){const i=Ph.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 Oh(){return Ih.length}function Rh(t){const e=[...$h.entries()].find(e=>e[1][0]==t);if(null==e)return;const i=Lh.get(e[0]);i&&i.postMessage("abort")}var Xh=Math.PI,Fh=Xh/2,Yh=2*Xh;function Vh(t){return 1<<t}var Nh=t=>function(t,e=1){return(t%e+e)%e}(t,1);function Bh(t){return(t%Yh+Yh)%Yh}function qh(t,e){const i=Nh(t),s=Nh(e)-i,r=s>0?s-1:s+1;return Math.abs(s)<=Math.abs(r)?s:r}var Wh=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))}},Uh=new Wh(.42,0,.58,1),Hh=new Wh(.42,0,1,1),Gh=new Wh(0,0,.58,1),Zh=new Wh(0,0,1,1),jh=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}},Kh=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=Nh(t)),this.canvas.is360?Nh(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=Nh(t)),this.canvas.is360?Nh(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)*Xh*2}get pitch(){return(this.centerY-.5)*Xh}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)*Xh/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=Nh(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}},Jh=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}},Qh=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}},tc=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}},ec=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=Uh,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 Kh(t),this.vTo=new Kh(t),this.lastView=new Kh(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?Zh:2===l?Gh:1===l?Hh:Uh;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+qh(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 M=Math.abs(w-t);m.is360&&(M=Math.min(M,1-M));const _=i<b&&s<x?.125:.25,S=(M+Math.abs(y-e)+Math.abs(b-i)*_+Math.abs(x-s)*_)/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=qh(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}},ic=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 Jh,this.coo=new Jh,this.startCoo=new Jh,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*Xh: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 Math.trunc(1e6*(this.scale-this.maxScale))/1e6>=0}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.scale>=this.maxScale&&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.isStarted()?o.ani.updateTarget(u,m,c.width,c.height,!0):o.ani.toView(u,m,g,p,150,0,0,!1,!s&&!this.pinching,-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(a.kinetic.stop(),!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+qh(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,M=h*p-d*u,_=c*g-l*m,S=c*p-d*m,E=l*p-d*g;let A=f*E-v*S+w*_+y*M-b*k+x*T;A&&(A=1/A,this.a0=(n*E-a*S+o*_)*A,this.a1=(i*S-e*E-s*_)*A,this.a2=(m*x-g*b+p*y)*A,this.a3=(l*b-c*x-d*y)*A,this.a4=(a*M-r*E-o*k)*A,this.a5=(t*E-i*M+s*k)*A,this.a6=(g*w-u*x-p*v)*A,this.a7=(h*x-l*w+d*v)*A,this.a8=(r*S-n*M+o*T)*A,this.a9=(e*M-t*S-s*T)*A,this.a10=(u*b-m*w+p*f)*A,this.a11=(c*w-h*b-d*f)*A,this.a12=(n*k-r*_-a*T)*A,this.a13=(t*_-e*k+i*T)*A,this.a14=(m*v-u*y-g*f)*A,this.a15=(h*y-c*v+l*f)*A)}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}},rc=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}},nc=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,f){this.canvas=t,this.index=e,this.localIdx=i,this.width=s,this.height=r,this.tileSize=n,this.isSingle=a,this.isDeepZoom=o,this.isVideo=h,this.startOffset=c,this.opacity=l,this.tOpacity=d,this.rotX=u,this.rotY=m,this.rotZ=g,this.scale=p,this.fromScale=f,this.vec=new rc,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 v=s>r?s:r;this.is360Embed=this.canvas.is360&&this.localIdx>0,this.numLayers=o&&!a?2:1;for(let y=n;y<v*t.main.underzoomLevels;y*=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 w=c;for(let y=0;y<this.numLayers;y++){const t=Vh(y)*this.tileSize,e=Math.ceil(s/t),i=Math.ceil(r/t);this.layers.push(new nc(this,this.layers.length,w,this.endOffset=w+=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=Nh(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)*Xh;const e=(this.areaCenterY-.5)*Xh;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*Xh,this.angularHeight=this.areaHeight*Xh}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&&!(Vh(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=Nh(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=Nh(s-n/2),e=Nh(s+n/2),i=Nh(o-c/2),r=Nh(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,M=(p-(h-l/2))/l,_=(f-(h-l/2))/l,S=e.tileWidth,E=e.tileHeight,A=Math.floor(Math.max(0,Math.min(1,T))/S),I=Math.min(e.cols-1,Math.floor(Math.max(0,Math.min(1,k))/S)),L=Math.floor(Math.max(0,Math.min(1,M))/E),P=Math.min(e.rows-1,Math.floor(Math.max(0,Math.min(1,_))/E));for(let C=L;C<=P;C++)for(let t=A;t<=I;t++)this.setToDraw(e,t,C)}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*Xh*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)+Xh+this.rotY),n.rotateX(-Math.sin((o-.5)*Xh)-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>Xh/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]=Nh(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(Nh(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)}}},oc=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 rc,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=Fh,this.perspective=Fh,this.maxPerspective=Fh,this.minPerspective=Fh,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 rc,this.coo=new Jh,this.offX=0,this.baseYaw=-this.canvas.rotationY,this.offX=this.baseYaw/Yh,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=Fh,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(Xh/2,Math.max(-Xh/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/Xh*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=Bh(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=Xh*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=Xh*(this.limitX>0?this.limitX:1);let i=this.yaw;for(;i>=Xh;)i-=2*Xh;for(;i<-Xh;)i+=2*Xh;this.yaw=Bh(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*Xh*2,this.pitch+=s*Xh*this.scaleY,this.yaw=Bh(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=Bh(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)*Xh*2,this.pitch=(e-.5)*Xh*this.scaleY,this.setPerspective(Math.min(this.maxPerspective,s*Xh*this.scaleY),r),this.calculate3DFrustum(),this.syncLogicalView()}syncLogicalView(){const t=this.canvas;if(!t.is360)return;const e=Nh(this.yaw/(2*Xh)+.5),i=this.pitch/this.scaleY/Xh+.5,s=this.perspective/Xh/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*Xh*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*Xh/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)/Xh/2+.5,this.coo.y=.5-Math.asin(this.vec4.y)/Xh/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*-Xh,e-=.5,e*=-Xh,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/Yh),t*=2*-Xh,e-=.5,e*=Xh*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)+Xh+n),this.iMatrix.rotateX(this.vec4.y+r),this.iMatrix.rotateZ(a),this.iMatrix.scaleXY(h,c),this.iMatrix.scaleFlat(i/Xh/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*Xh;for(let c=0;c<16;c++)for(let i=0;i<16;i++){const s=6*(16*c+i)*3,l=-Nh(t+a*i+this.offX)*h,d=-(e+o*c)*h,u=-Nh(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}}},hc=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 jh,this.el=new Qh,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.isDeepZoom=n.isDeepZoom,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 Kh(this),this.focus=new Kh(this),this.ani=new ec(this),this.kinetic=new tc(this),this.camera=new ic(this),this.webgl=new oc(this),this.area=new Kh(this),this.currentArea=new Kh(this),this.targetArea=new Kh(this),this.visible=new Kh(this),this.full=new Kh(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,n.isDeepZoom,!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,p){const f=new ac(this,this.main.numImages++,this.images.length,r,n,a,o,h,c,this.main.numTiles,l,l,d,u,m,g,p);return f.setArea(t,e,i,s),this.images.push(f),this.main.numTiles=f.endOffset,1===this.images.length&&this.setActiveImage(0,0),f}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,isDeepZoom:this.main.hasArchive||this.isDeepZoom,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=Uh.get(this.opacity),0!==this.main.distanceX||0!==this.main.distanceY){const t=0===this.opacity?0:Uh.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));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.areaAnimating()&&(this.visible.width<=0||this.visible.height<=0))return void(this.isVisible&&this.setCanvasVisible(!1));!this.isVisible&&this.opacity>=1&&this.setCanvasVisible(!0),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),this.sendViewport()}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)}},cc=class{constructor(t){this.el=new Qh,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=Uh,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)}},lc=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.micrioToEngImage=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)=>kr(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[0]+n[2],n[1]+n[3],r.width,r.height,r.tileSize||1024,r.isSingle??!1,r.isDeepZoom??!1,r.isVideo??!1,s,a.rotX??0,a.rotY??0,a.rotZ??0,a.scale??1,0);this.engImageToMicrio.set(e,t),this.micrioToEngImage.set(t,e);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)}{let e={};e=!(!t.$settings.gallery?.archive&&!t.$settings.gallery?.type)?{coverLimit:!1,coverStart:!1}:{coverLimit:!!t.$settings?.limitToCoverScale,coverStart:!(!t.$settings?.limitToCoverScale&&"cover"!=t.$settings?.initType)},h=o.canvas.addChild(n[0],n[1],n[0]+n[2],n[1]+n[3],r.width,r.height,e)}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.hasParent&&h.setView(h.view.centerX,h.view.centerY,h.view.width,h.view.height,!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=Gn.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}load(){if(this.engine)return;const e=new cc({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 hc)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=>Rh(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=!!wt(this.micrio.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,d=i.omni?.layers?.length??1;i.omni&&(i.omni.layerStartIndex=Math.min(d-1,i.omni?.layerStartIndex??0));const u=new hc(this.engine,e.width,e.height,t.opacity,s,{tileSize:e.tileSize??1024,is360:e.is360??!1,noImage:t.noImage,isSingle:!(!e.isSingle&&!c),isDeepZoom:!!e.isDeepZoom,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)kr(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;if(e.canvas.hasParent)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=Oh(),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<Ah){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&&Oh()>=Ah)return;const r=ah.db.has(e);r||this.micrio.loading.set(!0),this.requests.set(t,e),(r?ah.getImage(e):Dh(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&&Rh(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;if(t.ptr>=0)return;this.images.push(t);const r=t.opts.area??[0,0,1,1],n=t instanceof hh?t.$settings._360??{}:{},a=this.canvasById.get(e.ptr);if(!a)return;const o=a.canvas.addImage(r[0],r[1],r[0]+r[2],r[1]+r[3],s.width,s.height,s.tileSize||1024,s.isSingle??!1,s.isDeepZoom??!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),this.micrioToEngImage.set(t,o);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?Uh:1===t?Hh:2===t?Gh:3===t?Zh:Uh}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 Uh.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.ptrToImage.get(t);if(!i)return;const s=this.micrioToEngImage.get(i);s&&(s.isVideoPlaying=e)}},dc=new Float32Array([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]),uc=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)}},mc=Gn.firefox,gc=`\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${mc?"\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}`,pc=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 Jr("WebGL context creation failed",{code:Xr,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 uc(e,this.micrio,i),this.micrio.keepRendering=!0);const s=e.createProgram();if(!(s instanceof WebGLProgram))throw new Jr("Failed to create WebGL program",{code:Yr,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,gc),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 Jr("Failed to bind WebGL opacity uniform",{code:Yr});this.opaLoc=r;const n=e.getUniformLocation(this.program,"GLMatrix");if(!n)throw new Jr("Failed to bind WebGL matrix uniform",{code:Yr});this.pmLoc=n;const a=e.getUniformLocation(this.program,"noTexture");if(!a)throw new Jr("Failed to bind WebGL texture uniform",{code:Yr});this.noTxtLoc=a,this.txtAttr=e.getAttribLocation(this.program,"aTextureCoord");const o=e.createBuffer();if(!o)throw new Jr("Failed to create WebGL texture buffer",{code:Vr,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,lc._textureBuffer,e.STATIC_DRAW);const h=e.createBuffer();if(!h)throw new Jr("Failed to create WebGL watermark buffer",{code:Vr,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 Jr("Failed to create WebGL geometry buffer",{code:Vr,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?lc._textureBuffer360:lc._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=pc,t.height=pc;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,(pc-r)/2,(pc-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/pc,i=t.drawingBufferHeight/pc,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??{})=>!Gn.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)}},wc={passive:!0},yc={passive:!0,capture:!0},bc={passive:!1};function xc(t){t.stopPropagation(),t.preventDefault()}var Tc=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",xc),this.ctx.micrio.addEventListener("pointerdown",this.start,wc),self.addEventListener("pointercancel",this.cancel,wc),this.ctx.micrio.setAttribute("data-hooked",""))}unhook(){this.hooked&&(this.hooked=!1,this.ctx.micrio.removeEventListener("pointerdown",this.start,wc),this.ctx.micrio.removeEventListener("dragstart",xc),self.removeEventListener("pointercancel",this.cancel,wc),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.vars.drag.image=i,this.ctx.micrio.addEventListener("pointermove",this.move,wc),this.ctx.micrio.addEventListener("pointerup",this.stop,wc),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.vars.drag.image?.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,wc),this.ctx.micrio.removeEventListener("pointerup",this.stop,wc),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.vars.drag.image??this.ctx.getImage({x:t.clientX,y:t.clientY});e&&(this.ctx.micrio.engine.panStop(e.ptr),this.ctx.micrio.engine.render())}this.ctx.vars.drag.image=void 0,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))}},kc=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(){Gn.iOS&&this.ctx.hasTouch&&this.ctx.micrio.addEventListener("touchstart",this.start,wc)}unhook(){Gn.iOS&&this.ctx.hasTouch&&this.ctx.micrio.removeEventListener("touchstart",this.start,wc),self.removeEventListener("touchmove",this.move,yc),self.removeEventListener("touchend",this.stop,yc)}start(t){if(!(Gn.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,yc),self.addEventListener("touchend",this.stop,yc),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(!(Gn.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,yc),self.removeEventListener("touchend",this.stop,yc),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)}},Mc=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,wc),self.addEventListener("pointerup",this.end,wc),self.addEventListener("pointercancel",this.end,wc)}unhook(){this.ctx.micrio.removeEventListener("pointerdown",this.start,wc),self.removeEventListener("pointerup",this.end,wc),self.removeEventListener("pointercancel",this.end,wc),self.removeEventListener("pointermove",this.move,yc),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,yc),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,yc),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)}}}},_c=class{constructor(t){this.ctx=t,this.handle=this.handle.bind(this)}hook(){Gn.OSX&&(this.ctx.micrio.addEventListener("gesturestart",this.handle,bc),this.ctx.micrio.addEventListener("gesturechange",this.handle,bc),this.ctx.micrio.addEventListener("gestureend",this.handle,bc))}unhook(){Gn.OSX&&(this.ctx.micrio.removeEventListener("gesturestart",this.handle,bc),this.ctx.micrio.removeEventListener("gesturechange",this.handle,bc),this.ctx.micrio.removeEventListener("gestureend",this.handle,bc))}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)}},Sc=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,bc),this.hooked=!0)}unhook(){this.ctx.micrio.removeEventListener("wheel",this.handle,bc),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=Gn.firefox||t.ctrlKey||!n;if(this.ctx.isTwoFingerPan()&&this.ctx.micrio.$current?.camera.isZoomedOut())return;t.stopPropagation(),t.preventDefault(),(Gn.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)}},Ec=t=>new Promise(e=>t?setTimeout(e,t):e()),Ac={0:[0,-.5,1,.5],90:[1,0,.5,1],180:[0,1,1,.5],270:[-.5,0,.5,1]},Ic={0:[0,-1,1,1],90:[1,0,1,1],180:[0,1,1,1],270:[-1,0,1,1]},Lc={0:[0,1,1,1],90:[-1,0,1,1],180:[0,-1,1,1],270:[1,0,1,1]},Pc=t=>Math.round(1e5*t)/1e5,Cc=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(Pc).join("/"),e.area?.map(Pc).join("/"),t.settings?.focus?.map(Pc).join("-"),e.cultures].join(",").replace(/,+$/,"")+(e.size?`|${e.size.join(",")}`:"")}get $focussed(){return wt(this.focussed)}static{this.handlingKeys=!1}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.panZoom="grid",this.focussed=vt(),this.markersShown=vt([]),this.history=[],this.depth=vt(0),this.aniDurationIn=1,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()));if(i?.length){const t=i.map(t=>t?.opts.area?.[0]??0),s=i.map(t=>t?.opts.area?.[1]??0),r=Math.max(...i.map(t=>(t?.opts.area?.[0]??0)+(t?.opts.area?.[2]??1))),n=Math.max(...i.map(t=>(t?.opts.area?.[1]??0)+(t?.opts.area?.[3]??1))),a=Math.min(...t),o=Math.min(...s);this.image.camera.flyToView([a,o,r-a,n-o],{duration:e?1e3*e:void 0}).catch(()=>{})}else 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)=>{kr(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?.grid;this.clickable=("focus"==s?.clickable||"zoom"==s?.clickable)&&s.clickable,this.panZoom="cells"==s?.panZoom?"cells":"grid",this.clickable&&i.$settings.hookKeys&&this.hookGridKeys(),void 0!==s?.transitionDuration&&(this.aniDurationIn=this.aniDurationOut=s.transitionDuration),void 0!==s?.transitionDurationOut&&(this.aniDurationOut=s.transitionDurationOut),this._grid.className="micrio-grid",this.set(i.$info?.grid).then(()=>{this.hook(),e.events.dispatch("grid-load")}),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=>{this.clickCell(t.target?.dataset.id)});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()))}hookGridKeys(){t.handlingKeys=!0,document.addEventListener("keydown",this.gridKeyHandler=this.gridKeyHandler.bind(this)),"grid"==this.panZoom&&this.clickable&&(this._clickDown={x:0,y:0},this.micrio.addEventListener("pointerdown",this._clickStart=this._clickStart.bind(this)),this.micrio.addEventListener("pointerup",this._clickEnd=this._clickEnd.bind(this)))}_clickStart(t){this._clickDown={x:t.clientX,y:t.clientY}}_clickEnd(t){if(!this._clickDown)return;const e=Math.hypot(t.clientX-this._clickDown.x,t.clientY-this._clickDown.y);if(this._clickDown=void 0,e>10)return;const i=this.image.camera.getCoo(t.clientX,t.clientY,!0),s=i[0],r=i[1],n=this.current.find(t=>{const e=t.opts.area;return e&&s>=e[0]&&s<=e[0]+e[2]&&r>=e[1]&&r<=e[1]+e[3]});n&&this.clickCell(n)}gridAdjacent(t){const e=this.current.map((t,e)=>({img:t,i:e,cx:t.opts.area[0]+t.opts.area[2]/2,cy:t.opts.area[1]+t.opts.area[3]/2}));if(!e.length)return;let i=e.findIndex(t=>t.img.id==this._grid.querySelector(":focus")?.getAttribute("data-id"));i<0&&(i=0);const s=e[i],r=.05;let n;for(const a of e){if(a.i===i)continue;let e=a.cx-s.cx,o=a.cy-s.cy,h=!1;switch(t){case"left":h=e<0&&Math.abs(o)<r;break;case"right":h=e>0&&Math.abs(o)<r;break;case"up":h=o<0&&Math.abs(e)<r;break;case"down":h=o>0&&Math.abs(e)<r}if(!h)continue;const c=Math.abs(e)+Math.abs(o);(!n||c<n.dist)&&(n={img:a.img,dist:c})}return n?n.img:e["right"==t||"down"==t?0:e.length-1].img}gridKeyHandler(t){if(!this.current.length||!this.clickable)return;if("Escape"==t.key)return this._buttons.forEach(t=>t.classList.remove("focussed")),void(this.$focussed?(this.back(),t.preventDefault(),t.stopPropagation()):this.image.camera.isZoomedOut()||(this.reset(),t.preventDefault(),t.stopPropagation()));if(this.$focussed)return;let e;switch(t.key){case"ArrowLeft":e=this.gridAdjacent("left");break;case"ArrowRight":e=this.gridAdjacent("right");break;case"ArrowUp":e=this.gridAdjacent("up");break;case"ArrowDown":e=this.gridAdjacent("down");break;default:return}if(t.preventDefault(),t.stopPropagation(),e&&(this._buttons.forEach((t,i)=>{i===e.id?t.focus():t.blur()}),"zoom"==this.clickable&&(this._buttons.forEach((t,i)=>t.classList.toggle("focussed",i==e.id)),!this.image.camera.isZoomedOut()))){const t=e.opts.area??[0,0,1,1];this.image.camera.flyToView(t,{duration:1e3*this.aniDurationIn,limit:!1})}}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 hh?{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=!!this.image.$settings.limitToCoverScale),e.coverLimit?r.forEach(t=>this.imageMap.get(t.id)?.camera.setCoverLimit(!0)):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)=>Ec(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:(t=>(delete t.gallery,t))(Pr(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)}),this._grid.classList.toggle("grid-pan-zoom","grid"==this.panZoom),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.width-2*c[0])/r,(o.height-2*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?Ec(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 hh(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]*this.micrio.offsetWidth/(t.area[3]*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])}clickCell(t){const e="string"==typeof t?this.images.find(t=>t.id==this.micrio.id):t;if(this.clickable&&e)if(this._buttons.forEach(t=>t.classList.remove("focussed")),this._buttons.get(e.id)?.classList.add("focussed"),"zoom"==this.clickable){const t=e.opts.area??[0,0,1,1];this.image.camera.flyToView(t,{duration:1e3*this.aniDurationIn,limit:!1})}else this.focus(e)}async focus(t,e={}){if(!t)return this.back();e.coverLimit&&(e.cover=!0);const i=this.micrio;wt(i.visible).find(t=>t==this.image)||i.current.set(this.image);const s=this.$focussed;if(s==t)return;e.transition?.startsWith("slide-")||0!=e.duration&&(!s||i.engine.areaAnimating(s.ptr)||this.current.includes(t))||t.camera.setArea([0,0,1,1],{noDispatch:!0,direct:!0}),s&&this.blur(),t.camera.setCoverLimit(!!e.cover),this.setTimingFunction("ease");const r=await this.transition(t,s,this.getString(t.$info,{view:e.view}),e);return i.engine.setZIndex(t.ptr,3),this.focussed.set(t),wt(t.visible)||"crossfade"!=e.transition&&e.transition||(e.duration=0),this.set(r,{noBlur:!0,duration:e.duration,forceAreaAni:"crossfade"!=e.transition,cover:!!e.cover,coverLimit:!!e.coverLimit}).then(()=>{i.events.dispatch("grid-focus",t),this.removeGrid(),i.$current!=t&&i.current.set(t),this.image.camera.setLimit([0,0,1,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(Ac[m],{noDispatch:!0,direct:!0});else if(n.startsWith("swipe"))t.camera.setArea(Ic[m],{noDispatch:!0,direct:!0}),i=[this.getString(e.$info,{view:o??e.camera.getView(),area:Lc[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(()=>Ec(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})}getImageAt(t,e){const i=this.micrio.$current;if(i&&this.images.some(t=>t===i))return i;if("grid"==this.panZoom)return this.image;const s=this.image.camera.getCoo(t,e,!0),r=s[0],n=s[1];return this.current.find(t=>{const e=t.opts.area;return e&&r>=e[0]&&r<=e[0]+e[2]&&n>=e[1]&&n<=e[1]+e[3]})}getRelativeView(t,e){const i=t.opts.area??[0,0,1,1];return[i[0]+i[2]*e[0],i[1]+i[3]*e[1],i[2]*e[2],i[3]*e[3]]}},$c=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;if(Cc.handlingKeys&&(t.key.startsWith("Arrow")||"Enter"==t.key||" "==t.key||"Escape"==t.key))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)}},Dc=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(!(Gn.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(()=>{})}},zc=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=Gn.hasTouch&&"ontouchstart"in self,this.hasUsedCtrl=!1,this.vars={drag:{prev:void 0,start:[0,0,0],image:void 0},dbltap:{lastTapped:0},pinch:{image:void 0,sDst:0,wasPanning:!1}},this.activePointers=new Map,this.el=t.canvas.element,this.dragHandler=new Tc(this),this.pinchHandler=new kc(this,this.dragHandler),this.pointerPinchHandler=new Mc(this,this.dragHandler),this.gestureHandler=new _c(this),this.wheelHandler=new Sc(this),this.keyboardHandler=new $c(this),this.doubleTapHandler=new Dc(this),this.enabled.subscribe(t=>{t?this.hook():this.unhook()}),t.visible.subscribe(t=>this.visible=t),t.current.subscribe(t=>{t&&!this.settings&&kr(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=this.micrio.canvases.find(t=>t.grid);if(o)return o.grid?.getImageAt(t.x,t.y)??this.micrio.$current;const h=1==a.length?a[0]:a.find(({grid:t,opts:{area:e}})=>(!n||!t)&&(!!e&&(s>=e[0]&&s<=e[0]+e[2]&&r>=e[1]&&r<=e[1]+e[3])));return h&&h.opts.secondaryTo&&h.opts.isPassive&&h.opts.area&&(t.x-=h.opts.area[0]*e,t.y-=h.opts.area[1]*i),!h||h.grid||h.opts.secondaryTo&&h.opts.isPassive?this.micrio.$current:h}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())}unhook(){this.hooked&&(this.hooked=!1,this.activePointers.clear(),this.unhookDrag(),this.unhookZoom(),this.unhookKeys())}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(){Gn.iOS&&this.hasTouch?this.pinchHandler.hook():this.pointerPinchHandler.hook(),this.gestureHandler.hook()}unhookPinch(){Gn.iOS&&this.hasTouch?this.pinchHandler.unhook():this.pointerPinchHandler.unhook(),this.gestureHandler.unhook()}hookDrag(){this.dragHandler.hook()}unhookDrag(){this.dragHandler.unhook()}},Oc=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=Mr),"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)}};var Rc=class t{get type(){return this.config.type}constructor(t,e,i,s){this.parent=null,this.swiper=null,this.grid=null,this.currentIndex=vt(0),this.containerWidth=0,this.containerHeight=0,this.engine=e,this.micrio=i,this.config=s;const r="switch"==s.type,n=s.isSpreads,a=n?s.coverPages??0:0;r&&(this.containerHeight=Math.max(...t.map(t=>t.height)),this.containerWidth=Math.max(...t.map(t=>t.width*(n?2:1)))),this.images=t.map((i,o)=>{const h=s.revisions?.[i.id],c={skipMeta:!0,...s.settings};void 0!==s.archiveLayerOffset&&(c.gallery={...c.gallery||{},archive:!0,archiveLayerOffset:s.archiveLayerOffset});const l={};if(r){let e;l.isEmbed=!0,l.useParentCamera=!0,e=n?o-a<0||o==t.length-1&&(o-a)%2==0?[.25,0,.5,1]:(o-a)%2==0?[0,0,.5,1]:[.5,0,.5,1]:[0,0,1,1];let s=function(t,e,i,s,r){const[n,a,o,h]=t,c=o*e,l=h*i,d=Math.min(c/s,l/r),u=s*d/e,m=r*d/i;return[n+o/2-u/2,a+h/2-m/2,u,m]}(e,this.containerWidth,this.containerHeight,i.width,i.height);n&&(.5===e[0]?s[0]=.5:0===e[0]&&(s[0]=.5-s[2])),l.area=s}else l.area=[o,0,1,1];return new hh(e,{id:i.id,path:i.path,width:i.width,height:i.height,isDeepZoom:i.isDeepZoom,isPng:i.isPng,isWebP:i.isWebP,tileSize:i.tileSize??Ar.tileSize,revision:h,settings:c},l)}),queueMicrotask(()=>this.images.forEach(t=>t.loadBundleData()))}static fromIIIF(e,i,s){if("sc:Manifest"===e["@type"]||e.sequences)throw new Jr("IIIF_V2_UNSUPPORTED",{displayMessage:"Only IIIF Presentation API 3 manifests are supported"});if("Manifest"===e.type){const r=e.items?.flatMap(t=>t.items?.[0]?.items?.[0]?.body)?.filter(t=>t?.service?.[0]?.id)??[];if(!r.length)throw new Jr("NO_CANVASES",{displayMessage:"No valid IIIF canvases found in the manifest"});const n=r.map(t=>({id:t.service[0].id,width:t.width,height:t.height,isPng:"image/png"===t.format,path:t.service[0].id.replace(/\/[^/]*$/,""),tileSize:Ar.tileSize}));return 1===n.length?null:new t(n,i,s,{type:"swipe",settings:{}})}return null}static fromAssets(e,i,s,r){const n=r?.basePath??s.$current?.dataPath??"https://b.micr.io/";return new t(e.map(t=>({id:t.micrioId??t.id,path:n,width:t.width,height:t.height,isDeepZoom:t.isDeepZoom,isPng:t.isPng,isWebP:t.isWebP,tileSize:1024})),i,s,{type:"swipe",startId:r?.startId,settings:{}})}static async fromArchive(e,i,s,r,n){const a={type:"swipe",...n},o=await t.getArchiveIndex(e.split(".")[0],i,s,r);return a.archiveLayerOffset=o.delta,new t(o.images.sort(t.sortArchiveImages(a.sort)).map(t=>({id:t.id,path:i,width:t.width,height:t.height,isDeepZoom:t.isDeepZoom,isPng:t.isPng,isWebP:t.isWebP,tileSize:t.tileSize||1024})),s,r,a)}static async fromGrid(e,i,s,r){const n={type:"grid",...r};n.settings||(n.settings={}),n.settings.zoomLimit=15,n.settings.minimap=!1;const a=r?.path??"https://r2.micr.io/";if(n.archive&&n.archive==e){const r=await t.getArchiveIndex(e.split(".")[0],a,i,s),o=n.sort;o&&r?.images&&r.images.sort(t.sortArchiveImages(o)),e=r.images.map(t=>Cc.getString(t,{cultures:"cultures"in t?t.cultures.join("-"):void 0})).join(";")}const o=new t(e.split(";").map(t=>t.trim()).map(t=>{const e=t.split(",").map(t=>isNaN(t)?t:Number(t));return{id:e[0],width:e[1]??0,height:e[2]??0,path:a}}),i,s,n);return o._gridString=e,o}static async fromAlbum(e,i,s,r){const n=cn.getAlbum(e);if(!n)return null;const a=r?.path??cn.getOrganisation()?.baseUrl??"https://r2.micr.io/";n.archive&&await ah.load(a,"g/"+n.archive,r?.onProgress);const o={...n,startId:r?.startId??n.startId};return n.settings&&(o.settings={...n.settings}),"grid"===n.type?t.fromGrid(n.archive,i,s,{...o,path:a}):t.fromArchive(n.archive,a,i,s,o)}static{this.getArchiveIndex=async(t,e,i,s)=>ah.get(`${e}${t}.json`).then(t=>(t.images.forEach(t=>Qr.set(`${e}${t.id}/info.json`,t)),t))}static sortArchiveImages(t){return"random"==t?()=>Math.random()-.5:"name"==t?(t,e)=>t.title&&e.title?t.title<e.title?-1:t.title>e.title?1:0:0:"-name"==t?(t,e)=>t.title&&e.title?t.title<e.title?1:t.title>e.title?-1:0:0:"-created"==t?(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}getPageLayout(){const t="switch"==this.config.type,e=!!this.config.isSpreads,i=this.config.coverPages??0,s=[],r=[];if(t)for(let n=0;n<this.images.length;n++){const t=this.images[n].opts?.area;if(!t)continue;const a=[t[0],t[1],t[2],t[3]];if(r.push([n]),e&&n-i>=0&&(n-i)%2==0&&this.images[n+1]){const t=this.images[n+1].opts?.area;if(!t)continue;n++,r[r.length-1].push(n),a[2]=a[2]+t[2],a[3]=Math.max(a[3],t[3])}s.push(a)}else for(let n=0;n<this.images.length;n++)s.push([0,0,1,1]),r.push([n]);return{pages:s,pageIdxes:r}}attach(t){this.parent=t,t.__gallery=this}detach(){this.parent&&(delete this.parent.__gallery,this.parent=null)}destroy(){this.detach(),this.swiper&&(this.swiper.destroy(),this.swiper=null),this.grid=null}goto(t){this.currentIndex.set(t),this.parent&&this.engine.micrio.events.dispatch("gallery-show",t)}next(){const t=wt(this.currentIndex);this.goto(Math.min(this.images.length-1,t+1))}prev(){const t=wt(this.currentIndex);this.goto(Math.max(0,t-1))}},Xc=class t extends HTMLElement{static get observedAttributes(){return["id","muted","data-limited","lang"]}static{this.jsonCache=Qr}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 zc(this),this.state=new ih.Main,this.analytics=new Oc(this),this.barebone=vt(!1),this.webgl=new fc(this),this.engine=new lc(this),this.defaultSettings=this.defaultSettings,this.loading=vt(!0),this.switching=vt(!1),this.isMuted=vt("1"==localStorage.getItem(Er)),this._lang=vt(),this.gallery=vt(),this.keepRendering=!1,this.initedFirst=!1,this.current.subscribe(t=>this._current=t);let t=!1;kr(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-limited":this.engine?._vertexBuffer&&this.$current?.ptr&&this.engine.setLimited(this.$current.ptr,!!i);break;case"lang":{let t=wt(this._lang);if(t!=i){this._lang.set(i);let e=i.split("-")[0];bn.set(yn[i]??yn[e]??yn.en),i&&(qn.includes(i)?this.setAttribute("dir","rtl"):this.removeAttribute("dir")),t&&this.events.dispatch("lang-switch",i)}break}}}connectedCallback(){this.canvas.place(),this.id&&!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(Er,"1"),this.events.dispatch("audio-mute")):(localStorage.removeItem(Er),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.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}async print(){if(this.printed)return;this.printed=!0,await Si();const t=this.getOptions();if(t.settings||(t.settings={}),this.defaultSettings&&Pr(this.defaultSettings,t.settings),t.settings.noControls&&this.state.ui.controls.set(!1),t.id&&nh(t.id)&&!this.hasAttribute("width")&&!this.hasAttribute("height")){const e=await cn.getInfo(t.id).catch(()=>{});if(e?.albumId){const i=await Rc.fromAlbum(e.albumId,this.engine,this,{startId:t.id,onProgress:t=>this._ui?.setProps?.({loadingProgress:t})}).catch(()=>null);if(i)return void this._openGalleryFromController(i,t)}}if(t.id&&t.id.startsWith("http")){const e=await sn(t.id).catch(t=>{this.printError(t)});if(!e)return;let s;try{s=Rc.fromIIIF(e,this.engine,this)}catch(i){return void this.printError(i)}if(s)return void this._openGalleryFromController(s,t);const r=e["@id"]||e.id||t.id.replace(/info.json$/,"");t.id=r,t.width=e.width,t.height=e.height,t.isIIIF=!0,t.path=r.replace(/\/[^/]*$/,""),t.tileSize=e.tiles?.[0]?.width??Ar.tileSize}this.keepRendering=!!t.settings.keepRendering;const e=t.id||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 Jr?t.displayMessage:(t instanceof Error?t.message:t)??"An unknown error has occurred";console.error("Error:",e+(t instanceof Jr?` (${t.code}: ${t.message})`:"")),this._ui||this.printUI(!1,!1),this._ui?.setProps?.({error:e}),this.loading.set(!1)}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||Pr(s.settings,r.settings),this.defaultSettings&&Pr(this.defaultSettings,r.settings),r.settings?.gallery?.settings&&Pr(r.settings.gallery.settings,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 hh(this.engine,r,e.splitScreen?{secondaryTo:e.splitTo??this._current,isPassive:e.isPassive}:void 0))),e.gallery&&(e.gallery.attach(n),this.gallery.set(e.gallery)),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"),this.engine.load(),!this.webgl.gl)try{this.webgl.init()}catch(h){return this.printError(h),n}return kr(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 Cc(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)),n.noImage&&this.loading.set(!1),n}close(t){t.opts.secondaryTo?t.splitEnd():this.engine.removeCanvas(t)}openGallery(t,e,i){this.printUI(!1,!0),this.engine.ready||this.engine.load(),this.webgl.gl||this.webgl.init();const s=Rc.fromAssets(t,this.engine,this,{startId:e,basePath:i});this._openGalleryFromController(s,{})}_openGalleryFromController(t,e){const i="switch"==t.type,s={};if(i?(s.width=t.containerWidth,s.height=t.containerHeight):(s.width=this.offsetWidth*this.canvas.getRatio(),s.height=this.offsetHeight*this.canvas.getRatio()),s.settings={view:[0,0,1,1],gallery:{...t.config},pinchZoomOutLimit:!!i||void 0},t.config.settings&&Object.assign(s.settings,t.config.settings),"grid"==t.type)return s.settings.zoomLimit=15,s.settings.minimap=!1,s.settings?.grid?.clickable&&void 0===s.settings?.hookKeys&&(s.settings.hookKeys=!0),s.grid=t._gridString,s.path=cn.getOrganisation()?.baseUrl??"https://r2.micr.io/",void this.open(s,{...e});this.open(s,{...e,gallery: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 Ir.STRINGS){const r=Ir.STRINGS[s],n=this.getAttribute(s),a=r.f||s.replace("data-","");n&&i(r.r?e:t,a,n)}for(const s in Ir.BOOLEANS){const r=Ir.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 Ir.NUMBERS){const r=Ir.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 Ir.ARRAYS){const r=Ir.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}get lang(){return wt(this._lang)}set lang(t){this.setAttribute("lang",t)}};Xc.Svelte=function(t,e){et(e,!0);const i=()=>xt(Ei(E),"$settings",l),s=()=>xt(Ei(S),"$data",l),r=()=>xt(x,"$tour",l),n=()=>xt(Ei(_),"$info",l),a=()=>xt(C,"$volume",l),o=()=>xt(w,"$visible",l),h=()=>xt(k,"$markerPopup",l),c=()=>xt(M,"$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:M}=y;let _=ne(void 0),S=ne(void 0),E=ne(void 0);function A(t,e){if(e)for(let i,s=0;s<e.length;s++)if(e[s].id==t||(i=A(t,e[s].children)))return i??e[s]}let I=ne(!1),L=ne(void 0);const P=[];Li(()=>e.micrio).current.subscribe(t=>{t&&(Tt(oe(_,t.info,!0),"$info",l),Tt(oe(E,void 0),"$settings",l),Ei(_)&&kr(Ei(_)).then(e=>{e&&(oe(I,!0),Tt(oe(E,t.settings,!0),"$settings",l),!Ei(L)&&cn.getOrganisation()?.logo&&oe(L,cn.getOrganisation(),!0))}),Tt(oe(S,t.data,!0),"$data",l)&&P.indexOf(t.id)<0&&kr(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=A(s.id,i.pages);a&&e.micrio.state.popover.set({contentPage:a,showLangSelect:!0})}}))});const C=vt(xt(b,"$isMuted",l)?0:1);tt("volume",C),b.subscribe(t=>C.set(t?0:1)),tt("mediaPaused",vt(!1));let $=ne(!1),D=ne(ue([]));tt("srt",vt()).subscribe(t=>setTimeout(()=>{oe(D,t?[t]:[],!0)},20));const z=Zt(()=>i()?._360?.video),O=Zt(()=>Ei(z)?.src),R=Li(()=>e.micrio.gallery),X=Zt(()=>xt(R,"$galleryStore",l)),F=Zt(()=>s()?.markers?.filter(t=>!!t.positionalAudio)),Y=Zt(()=>!!s()?.music?.items.length||!!Ei(F)?.length),V=Zt(()=>r()||xt(T,"$marker",l)),N=Zt(()=>!u()||f),B=Zt(()=>!(m()||n()&&u()||i()?.noLogo)),W=Zt(()=>u()||!Ei(B)||i()?.noOrgLogo?void 0:Ei(L)),U=Zt(()=>!(u()||i()?.omni||e.micrio.spaceData||r()||Ei(X))),H=Zt(()=>!!i()?.omni||!!Ei(X)),G=Zt(()=>!u()&&!!n()),Z=Zt(()=>!u()&&!Ei(V)&&i()?.showInfo),j=Zt(()=>!u()&&Ei(I)&&!i()?.noToolbar);var K={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)}},J=_h(),Q=Me(J),st=t=>{{let e=Zt(()=>!!n().is360);Mo(t,{get volume(){return a()},get data(){return s()},get is360(){return Ei(e)}})}};vs(Q,t=>{Ei(Y)&&s()&&n()&&t(st)});var rt=_e(Q,2),nt=t=>{za(t,yr({get src(){return Ei(O)},get volume(){return a()},is360:!0,get width(){return n().width},get height(){return n().height}},()=>Ei(z)))};vs(rt,t=>{Ei(O)&&n()&&t(nt)});var at=_e(rt,2),ot=t=>{var e=Hi();bs(Me(e),1,o,t=>t.uuid,(t,e)=>{!function(t,e){et(e,!0);const i=()=>xt(Ei(n),"$data",s),[s,r]=kt(),n=Zt(()=>e.image.data);var a=Hi(),o=Me(a),h=t=>{var s=Hi();bs(Me(s),1,()=>i().embeds,t=>t.uuid,(t,i)=>{uh(t,{get embed(){return Ei(i)},get image(){return e.image}})}),Gi(t,s)};vs(o,t=>{i()?.embeds&&t(h)}),Gi(t,a),it(),r()}(t,{get image(){return Ei(e)}})}),Gi(t,e)};vs(at,t=>{v&&t(ot)});var ht=_e(at,2),ct=t=>{fn(t,{})};vs(ht,t=>{Ei(B)&&t(ct)});var lt=_e(ht,2),dt=t=>{Rn(t,{})};vs(lt,t=>{Ei(j)&&t(dt)});var ut=_e(lt,2),mt=t=>{var e=Hi();bs(Me(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=_e(ut,2),pt=t=>{var e=Hi();bs(Me(e),1,()=>o().filter(t=>t.$settings.minimap&&!t.opts.isEmbed),t=>t.uuid,(t,e)=>{Vn(t,{get image(){return Ei(e)}})}),Gi(t,e)};vs(gt,t=>{Ei(U)&&t(pt)});var ft=_e(gt,2),yt=t=>{{let e=Zt(()=>Ei(Y)||!(!Ei(O)||!Ei(z)||Ei(z).muted));ra(t,{get hasAudio(){return Ei(e)}})}};vs(ft,t=>{Ei(G)&&t(yt)});var bt=_e(ft,2),Mt=t=>{var e=Th(),i=Me(e),s=t=>{fo(t,{get controller(){return Ei(X)}})};vs(i,t=>{Ei(H)&&t(s)});var r=_e(i,2),n=t=>{wn(t,{get organisation(){return Ei(W)}})};vs(r,t=>{Ei(W)&&t(n)});var a=_e(r,2),o=t=>{Lo(t,{get info(){return Ei(_)},get data(){return Ei(S)}})};vs(a,t=>{Ei(Z)&&Ei(_)&&Ei(S)&&t(o)}),Gi(t,e)};vs(bt,t=>{(Ei(H)||Ei(W)||Ei(Z)&&Ei(_)&&Ei(S))&&t(Mt)});var _t=_e(bt,2),St=t=>{var e=kh(),i=Me(e),s=t=>{Za(t,{get marker(){return h()}})};vs(i,t=>{h()&&t(s)});var n=_e(i,2),a=t=>{no(t,{get tour(){return r()},get noHTML(){return u()},onminimize:t=>oe($,!t)})};vs(n,t=>{r()&&t(a)});var o=_e(n,2),l=t=>{Wo(t,{get popover(){return c()}})};vs(o,t=>{c()&&t(l)}),Gi(t,e)};vs(_t,t=>{(h()||r()||c())&&t(St)});var Et=_e(_t,2);bs(Et,16,()=>Ei(D),t=>t,(t,e)=>{wa(t,{get src(){return e},get raised(){return Ei($)}})});var At=_e(Et,2),It=t=>{var e=Mh(),i=Me(e),s=t=>{!function(t,e){var i=Po(),s=ke(i);kn(s,{name:"error"});var r=_e(s);q(i),Ve(()=>ns(r,` ${e.message??""}`)),Gi(t,i)}(t,{get message(){return p()}})};vs(i,t=>{p()&&t(s)});var r=_e(i,2),n=t=>{!function(t,e){const i=2*Math.PI*40,s=Zt(()=>i*(1-e.progress));var r=xh();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=_e(n);ar(a,"r",40),ar(a,"cx",50),ar(a,"cy",50),ar(a,"stroke-dasharray","251.32741228718345px"),q(r),Ve(()=>ar(a,"stroke-dashoffset",`${Ei(s)??""}px`)),Ds(1,r,()=>mn,()=>({delay:500})),Ds(2,r,()=>mn),Gi(t,r)}(t,{get progress(){return g()}})};vs(r,t=>{g()<1&&t(n)}),Gi(t,e)};vs(At,t=>{(p()||g()<1)&&t(It)}),Gi(t,J);var Lt=it(K);return d(),Lt},Xc.VERSION=Mr,customElements.define("micr-io",Xc),console.info("%c◈%c Micrio %cv"+Mr+" - https://micr.io/","color: #00d4ee","color: #c5ff5b","color: inherit")}();
|
|
26
|
+
const _style=document.createElement('style');_style.className='micrio-interface';_style.textContent=`micrio-button>:is(button,a){cursor:pointer;box-sizing:border-box;font:inherit;touch-action:none;color:var(--micrio-color);background:var(--micrio-button-background,var(--micrio-background,none)) center center no-repeat;min-width:var(--micrio-button-size);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;justify-content:center;align-items:center;margin:0;padding:0 8px;font-family:inherit;font-size:90%;text-decoration:none;transition:opacity .25s;display:flex;position:relative}micrio-button>:is(button,a):hover{outline:none}micrio-button>:is(button,a).transparent{-webkit-backdrop-filter:none;backdrop-filter:none;background-color:#0000}micrio-button>:is(button,a)>*{transition:opacity .25s}micrio-button>:is(button,a):disabled{pointer-events:none;cursor:default}micrio-button>:is(button,a):disabled svg{opacity:.4}micrio-button>:is(button,a).no-click{pointer-events:none}micrio-button>:is(button,a) img{pointer-events:none;max-width:100%;max-height:100%}micrio-button>:is(button,a).active{color:var(--micrio-color-hover)}micrio-button>:is(button,a).active svg{fill:var(--micrio-color-hover)}@media (hover:hover){micrio-button>:is(button,a):is(:hover,:focus){background-color:var(--micrio-button-background-hover,var(--micrio-button-background,var(--micrio-background)));color:var(--micrio-color-hover);z-index:1}micrio-button>:is(button,a):is(:hover,:focus) svg{fill:var(--micrio-color-hover);stroke:var(--micrio-color-hover)}micrio-button>:is(button,a):focus{outline:1px solid var(--micrio-color-hover)}}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:fixed;top:0;left:0}micrio-grid>button{cursor:pointer;pointer-events:auto;background:0 0;border:none;grid-area:auto/auto/span 1/span 1;margin:0;padding:0}:is(micrio-grid>button.focussed,micrio-grid.grid-pan-zoom,micrio-grid.grid-pan-zoom>button,micrio-grid.grid-cells-hidden){pointer-events:none}micrio-grid.grid-cells-hidden>button{display:none}micrio-grid .close{top:var(--micrio-border-margin);right:var(--micrio-border-margin);z-index:2;pointer-events:auto;display:block;position:absolute}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;width:100%;height:100%;min-height:200px;font-family:var(--micrio-font-family,inherit);font-size:var(--micrio-font-size,inherit);background-position:50%;background-repeat:no-repeat;background-size:contain;background-color:var(--micrio-background-color,transparent);display:block;position:relative;overflow:hidden;container-type:size}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}:where(micrio-main,micrio-toolbar,micrio-gallery,micrio-swipe-gallery,micrio-controls,micrio-popover,micrio-logo,micrio-logo-org,micrio-audio-controller,micrio-fullscreen,micrio-tour,micrio-serial-tour,micrio-embed,micrio-zoom-buttons,micrio-button,micrio-minimap){display:contents}:is(micrio-markers,micrio-image-embeds,micrio-marker,micrio-button-group):empty{display:none}:is(micrio-media-controls,micrio-marker-content)>*,micrio-tour .controls>micrio-button{--micrio-button-background:none;--micrio-background-filter:none;--micrio-button-shadow:none}:is(micrio-markers,micrio-image-embeds){pointer-events:none;will-change:width,height,top,left,opacity;width:100%;height:100%;perspective:inherit;position:absolute;top:0;left:0;overflow:hidden}:is(micrio-details details,micrio-marker-content,micrio-button-group),micrio-swipe-gallery>figcaption{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)}:is(micrio-media,micrio-media-controls){display:block}micr-io[data-tour-active][data-idle] :is(micrio-logo a,micrio-logo-org a,micrio-tour>aside),micr-io[data-idle] :is(micrio-grid .close,micrio-tour micrio-media figure,micrio-serial-tour :is(micrio-media figure,ol)),micr-io:is([data-switching],[data-tour-active]) micrio-controls aside,micr-io:is([data-idle],[data-switching],[data-tour-active]) micrio-minimap canvas:not(:hover),micr-io:not([data-zoomed]) micrio-minimap canvas:not(.fixed),micr-io:is([data-zoomed],[data-idle]) micrio-gallery :is(ul,micrio-button>button),micr-io[data-zoomed] micrio-details details,micrio-gallery>micrio-button>button:disabled{opacity:0;pointer-events:none;transform:var(--micrio-hide,none)}micrio-icon{display:contents}micrio-icon>svg{height:var(--micrio-icon-size);width:var(--micrio-icon-size);display:inline-block}micrio-icon>svg.small{height:.75em}micrio-button-group{display:block}micrio-button-group micrio-button>:is(button,a){box-shadow:none;--micrio-button-background:transparent;--micrio-background-filter:none;border-radius:0}micrio-button-group>micrio-button:first-child>:is(button,a),micrio-button-group>:first-child>micrio-button:first-child>:is(button,a){border-radius:var(--micrio-border-radius) var(--micrio-border-radius) 0 0}micrio-button-group>micrio-button:last-child>:is(button,a),micrio-button-group>:last-child>micrio-button:last-child>:is(button,a){border-radius:0 0 var(--micrio-border-radius) var(--micrio-border-radius)}@media (width<=500px){micrio-button-group micrio-button>:is(button,a){height:calc(var(--micrio-button-size) - 4px)}}micrio-progress-circle{pointer-events:none;z-index:10;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)rotate(-90deg)}micrio-progress-circle svg{display:block}micrio-progress-circle circle{transition:stroke-dashoffset .25s}micrio-logo a{top:calc(var(--micrio-border-margin) * 2);left:calc(var(--micrio-border-margin) * 2);z-index:2;cursor:pointer;--micrio-hide:translateX(-100%);width:22px;height:22px;transition:transform .25s,opacity .25s;display:block;position:absolute}micrio-logo a:hover{transform:rotate(-90deg)}micrio-logo a:before,micrio-logo a:after{content:"";will-change:transform;box-sizing:unset;display:block;position:absolute;transform:rotate(45deg)}micrio-logo a:before{border:3px solid #00d4ee;width:16px;height:16px}micrio-logo a.loading:before{animation:1s ease-out infinite micrio-logo-spin}micrio-logo a:after{background:#c5ff5b;outline:1px solid #c5ff5b;width:6px;height:6px;top:8px;left:8px}micrio-logo a.loading:after{animation:.5s ease-out infinite micrio-logo-spin}@keyframes micrio-logo-spin{0%{transform:rotate(45deg)}to{transform:rotate(135deg)}}micrio-article a{color:var(--micrio-color)}micrio-article img{max-width:100%}micrio-subtitles{bottom:calc(3 * var(--micrio-border-margin));text-align:center;color:var(--micrio-color);pointer-events:none;z-index:6;width:100vw;transition:bottom .25s;position:fixed;left:50vw;transform:translate(-50%)}micr-io[data-tour-active]:not([data-idle]) micrio-subtitles{bottom:calc(3 * var(--micrio-border-margin) + var(--micrio-button-size))}micrio-subtitles p{background-color:var(--micrio-background);-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;margin:.5em 0;padding:0 14px;display:inline}@media (width<=640px){micrio-subtitles p{white-space:normal;width:95vw;font-size:1.4em}}micrio-details 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;--micrio-hide:translateY(100%);max-width:410px;font-size:.9em;transition:opacity .25s,transform .25s;position:absolute}micrio-details summary{cursor:pointer}micrio-details summary::-webkit-details-marker{display:none}micrio-details small{font-style:italic;font-weight:400;display:block}micrio-details details>*{text-overflow:ellipsis;margin:0;overflow:hidden}micrio-details a{color:var(--micrio-color-hover,inherit)}@media (width<=600px){micrio-details details{max-width:calc(100% - var(--micrio-button-size) - 3 * var(--micrio-border-margin));z-index:5}}micrio-error{z-index:10;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}micrio-error>div{background:var(--micrio-background);color:var(--micrio-color);border:1px solid var(--micrio-color);border-radius:var(--micrio-border-radius);text-align:center;white-space:pre-wrap;-webkit-user-select:text;user-select:text;padding:10px;line-height:24px}micrio-error micrio-icon>svg{vertical-align:middle;width:24px;height:24px;fill:var(--micrio-color);margin-right:10px}@media (width<=520px){micrio-error>div{box-sizing:border-box;width:90%}}micrio-controls aside{right:var(--micrio-border-margin);bottom:var(--micrio-border-margin);z-index:2;--micrio-hide:translateX(100%);direction:rtl;margin:0;padding:0;transition:transform .25s,opacity .25s;position:absolute}micrio-controls menu{width:var(--micrio-button-size);min-height:var(--micrio-button-size);margin:8px 0;padding:0;position:relative}micrio-controls menu>div{background:var(--micrio-background);-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);border-radius:var(--micrio-border-radius);box-shadow:var(--micrio-button-shadow);white-space:nowrap;flex-direction:row;display:none;position:absolute;top:0;right:100%}micrio-controls menu:is(:hover,:focus-within)>div{display:flex}micrio-controls menu>div micrio-button{--micrio-button-shadow:none;--micrio-background-filter:none}micrio-controls menu>div micrio-button>*{padding:0}micrio-controls menu>div micrio-button>*>span{width:var(--micrio-button-size)}micrio-controls menu>div micrio-button>.active{background:var(--micrio-color-hover);color:var(--micrio-button-background,var(--micrio-background))}micrio-zoom-buttons:has(>micrio-button:first-child>button[disabled]):has(>micrio-button:last-child>button[disabled]){display:none}micrio-logo-org a{top:calc(var(--micrio-border-margin) * 2);right:calc(var(--micrio-border-margin) * 2);z-index:1;--micrio-hide:translateX(100%);transition:transform .25s,opacity .25s;display:block;position:absolute}micrio-logo-org img{max-height:64px;display:block}micrio-waypoint{transform-style:preserve-3d;--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%}micrio-waypoint>micrio-button>:is(button,a){--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)}micrio-waypoint>micrio-button>:is(button,a)>svg{pointer-events:none;margin:0 auto}micrio-waypoint:hover>micrio-button>:is(button,a){transition:background-color .25s,opacity .25s,transform .25s;transform:translate(-50%,-50%)scale(.6)}micrio-waypoint.clicked>micrio-button>:is(button,a){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)}}micrio-marker-content{padding:var(--micrio-popup-padding);-webkit-user-select:text;user-select:text;box-sizing:border-box;text-align:var(--micrio-text-align);max-height:calc(100cqh - 2 * var(--micrio-border-margin));min-height:var(--micrio-button-size);padding-bottom:0;display:block;position:relative;overflow-y:auto}micrio-marker-content h1{margin:0 0 1.25em;font-size:1.5em;font-weight:600}micrio-marker-content h1:only-child{margin-bottom:var(--micrio-popup-padding)}micrio-marker-content p{white-space:pre-line}micrio-marker-content micrio-media{margin:calc(-1 * var(--micrio-popup-padding));--micrio-background:transparent;width:auto;margin-bottom:0}micrio-marker-content micrio-media+micrio-media{margin-top:0}micrio-marker-content button{margin:0 calc(-1 * var(--micrio-popup-padding)) var(--micrio-popup-padding) calc(-1 * var(--micrio-popup-padding));padding:0}micrio-marker-content button:disabled{cursor:default}micrio-marker-content figcaption{margin-bottom:var(--micrio-popup-padding);text-align:center;padding:10px;font-size:.9em;font-style:italic}micrio-marker-content section{margin-bottom:var(--micrio-popup-padding);grid-template-columns:repeat(auto-fit,minmax(100px,1fr));justify-items:center;gap:5px;display:grid}micrio-marker-content section button{color:inherit;cursor:pointer;border:none;width:100%;margin:0;display:block}micrio-marker-content section figure{margin:0;padding:0}micrio-marker-content section img{object-fit:cover;width:100%;display:block}micrio-marker-content section button:only-child img{object-fit:contain;max-height:min(50cqh,400px)}@media (width<=500px){micrio-marker-content section{float:right;width:100px;margin-left:var(--micrio-border-margin);display:block}micrio-marker-content section>button:not(:first-child),micrio-marker-content section figcaption{display:none}micrio-marker-content:not(:has(micrio-article)) section{float:none;width:100%;margin-left:0}micrio-marker-content:not(:has(micrio-article)) section button{margin:0}micrio-marker-content:not(:has(micrio-article)) section img{object-fit:contain;max-height:min(50cqh,400px)}}micrio-menu{margin:0;padding:0;transition:background .2s,box-shadow .2s}micrio-menu>:is(a,button){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){micrio-menu{font-size:1em}micrio-menu>:is(a,button){text-align:left;align-items:center;gap:8px;width:100%;margin:0;padding:14px 20px;font-size:1em;display:flex}micrio-menu>:is(a,button) strong{flex:1}micrio-menu>div{display:none}micrio-menu.opened>div{display:block}micrio-menu>div>micrio-menu>:is(a,button){padding-left:40px;font-weight:400}}@media (width>=501px){micrio-menu{float:left;position:relative}micrio-menu:not(:is(:focus-within,:hover))>div{display:none}micrio-menu>:is(a,button){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}micrio-menu>div micrio-menu{float:none}micrio-menu>div :is(a,button){width:100%}micrio-menu>:is(a,button):is(:hover,:focus){text-shadow:none!important;color:var(--micrio-color-hover)!important}micrio-menu>div{max-height:calc(100vh - 160px);overflow:hidden auto}micrio-menu strong micrio-icon{vertical-align:1px;margin-left:10px;line-height:0}}micrio-toolbar>menu{top:calc(var(--micrio-border-margin) - (var(--micrio-button-size) / 2 - 27px));left:var(--micrio-border-margin);color:var(--micrio-color);text-shadow:1px 1px 2px #000;z-index:1;margin:0;padding:0;transition:transform .25s;position:absolute}@media (width<=500px){micrio-toolbar>micrio-button>:is(button,a){top:var(--micrio-border-margin);width:34px;height:34px;box-shadow:none;z-index:2;position:absolute;left:0}micrio-toolbar>micrio-button>:is(button,a).indent{left:35px}micrio-toolbar>menu{background:var(--micrio-background);width:100%;max-height:60vh;-webkit-backdrop-filter:var(--micrio-background-filter);backdrop-filter:var(--micrio-background-filter);z-index:100;color:var(--micrio-color);text-shadow:none;border-radius:16px 16px 0 0;margin:0;padding:16px 0;transition:transform .3s;position:fixed;inset:auto 0 0;overflow:hidden auto;transform:translateY(100%)}micrio-toolbar>menu.shown{transform:translateY(0)}micrio-toolbar>menu:before{content:"";background:#8080804d;border-radius:2px;width:36px;height:4px;margin:-8px auto 12px;display:block}.backdrop{z-index:50;background:#0006;position:fixed;inset:0}}@media (width>=501px){micrio-toolbar>menu.indent{margin-left:calc(var(--micrio-border-margin) * 2 + 25px)}micrio-toolbar>menu>micrio-menu{color:var(--micrio-color);margin-right:var(--micrio-border-margin);border-radius:var(--micrio-border-radius)}micrio-toolbar>menu>micrio-menu:is(:hover,: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)}}micrio-media-controls{display:block}micrio-media-controls>aside{--micrio-background:var(--micrio-background,#000);align-items:center;width:100%;display:flex}micrio-media-controls micrio-button>button{border:none;border-radius:0;margin:0}micrio-media-controls .subtitles button:not(.active){color:var(--micrio-color)!important}micrio-media-controls .subtitles button:not(.active) svg{fill:var(--micrio-color)!important}micrio-media-controls micrio-button:last-child{margin-right:16px}:fullscreen micrio-media-controls{bottom:var(--micrio-border-margin,5px);width:430px;max-width:calc(100vw - 2 * var(--micrio-border-margin,0));max-width:calc(100cqw - 2 * var(--micrio-border-margin,0));border-radius:var(--micrio-border-radius);position:absolute;left:50%;transform:translate(-50%)}micrio-media-controls aside>div{flex:1;align-items:center;gap:8px;padding:0 8px;display:flex}micrio-media-controls [data-part=bars]{background:var(--micrio-progress-bar-background,var(--micrio-color-hover));cursor:pointer;border-radius:2px;flex:1;height:4px;position:relative}micrio-media-controls [data-part=bar]{background:var(--micrio-color);height:100%;position:absolute;top:0;left:0}micrio-media-controls [data-part=bars]>[data-part=bar]:first-child{border-radius:2px 0 0 2px}micrio-media-controls [data-part=bars]>[data-part=bar]:last-child{border-radius:0 2px 2px 0}micrio-media-controls [data-part=bars]>[data-part=bar]:only-child{border-radius:2px}micrio-media-controls aside>div>span{white-space:nowrap;font-variant-numeric:tabular-nums;color:var(--micrio-color);text-align:center;min-width:50px;padding:0;font-size:90%;display:block}micrio-media{display:block}micrio-media figure{margin:0;padding:0;position:relative}micrio-media figure :is(video,audio){width:100%;display:block}micrio-media figure figcaption{opacity:.7;text-align:center;background:var(--micrio-background);padding:5px 10px;font-size:.85em}micrio-media figure iframe{border:none;width:100%;display:block}micrio-media figure:-webkit-any(:fullscreen,:-webkit-full-screen) iframe{height:100%}micrio-media figure:is(:fullscreen,:fullscreen) iframe{height:100%}micrio-media figure:-webkit-any(:fullscreen,:-webkit-full-screen) video{object-fit:contain;height:100%}micrio-media figure:is(:fullscreen,:fullscreen) video{object-fit:contain;height:100%}micrio-media figure:has(video){width:auto}:is(micrio-tour,micrio-serial-tour) micrio-media figure{bottom:var(--micrio-border-margin);width:500px;max-width:calc(100vw - 2 * var(--micrio-border-margin,0));max-width:calc(100cqw - 2 * var(--micrio-border-margin,0));background:var(--micrio-button-background,var(--micrio-background,none));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);z-index:5;--micrio-hide:translate(-50%,100%);flex-direction:column;margin:0;padding:0;transition:transform .25s,opacity .25s;display:flex;position:fixed;left:50%;transform:translate(-50%)}micrio-media figure.hidden{display:none!important}micrio-marker-popup{cursor:auto;top:var(--micrio-border-margin);left:var(--micrio-border-margin);display:block;position:absolute}micrio-marker-popup>aside{padding:0;position:absolute}@keyframes micrio-popup-in{0%{opacity:0;transform:translate(-50px)}to{opacity:1;transform:translate(0)}}@media (width>=501px){micrio-marker-popup{width:440px;min-width:20%;animation:.2s ease-out micrio-popup-in}micrio-marker-popup>aside{left:calc(100% + var(--micrio-border-margin));flex-direction:column-reverse;top:0}micrio-marker-popup.destroying{opacity:0;pointer-events:none;transition:opacity .2s ease-out,transform .2s ease-out;animation:none;transform:translate(-50px)}}@media (width<=500px){micrio-marker-popup>aside{z-index:2;--micrio-button-shadow:none;--micrio-background:none;--micrio-background-filter:none;top:0;right:0}micrio-marker-popup :is(h1,micrio-media:only-child){margin-right:calc(var(--micrio-button-size) - 2 * var(--micrio-border-margin,0))}micrio-marker-popup{width:auto;right:var(--micrio-border-margin);top:auto;top:var(--micrio-border-margin);flex-direction:column;justify-content:space-between;transition:opacity .25s;display:flex}micrio-marker-popup.destroying{opacity:0;pointer-events:none}}micrio-marker{transform:translate3d(var(--x,0),var(--y,0),0) translate(-50%,-50%) scale3d(var(--scale,1),var(--scale,1),1);will-change:transform;display:block;position:absolute;top:0;left:0}micrio-marker:not(.cluster){animation:.25s forwards micrio-marker-fade}micrio-marker.overlapped{display:none}@keyframes micrio-marker-fade{0%{opacity:0}to{opacity:1}}micrio-marker.behind{pointer-events:none;opacity:0!important}micrio-marker.mat3d{transform:var(--mat);transform-style:preserve-3d;top:50%;left:50%}micrio-marker.mat3d button{position:absolute;transform:translate(-50%,-50%)}micrio-marker button{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}micrio-marker label{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%)}micrio-marker:hover{z-index:2}:is(micrio-marker:hover,.show-titles micrio-marker) label{opacity:1}@media (width<=640px){micrio-marker label{font-size:12px}}.show-titles micrio-marker label{pointer-events:all}micrio-marker label.static{transform:translate(-50%,4px) scale3d(calc(1/var(--scale,1)),calc(1/var(--scale,1)),1)}micrio-marker.default button{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)}micrio-marker.default:is(:hover,.opened){z-index:1}micrio-marker.default:is(:hover,.opened) button{background-color:var(--micrio-marker-highlight);width:calc(var(--micrio-marker-size,25px) + var(--micrio-marker-border-size,3px)*2);height:calc(var(--micrio-marker-size,25px) + var(--micrio-marker-border-size,3px)*2);border-width:0}micrio-marker.has-icon{--micrio-marker-icon:none}micrio-marker.has-custom-icon{--micrio-marker-size:32px}micrio-marker.default.has-icon button{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}micrio-marker.default.has-icon:is(.opened,:hover) button svg{color:var(--micrio-marker-highlight)}micrio-marker.default.has-custom-icon button{background-color:#0000}micrio-marker.default.has-custom-icon:is(.opened,:hover) button{background-color:var(--micrio-marker-highlight,var(--micrio-marker-color))}micrio-marker.cluster button{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%}micrio-marker.cluster:hover button{background:var(--micrio-marker-highlight,#fff);border-color:var(--micrio-marker-highlight,#fff)}micrio-marker.cluster label{pointer-events:none;display:none}micrio-marker img{max-width:100%;max-height:100%;margin:auto;display:block}micrio-markers>*{pointer-events:all}micrio-markers.inactive>*{pointer-events:none}micrio-main.is360 micrio-markers{transition:opacity .25s}micrio-main.is360 micrio-markers.inactive{opacity:0}micr-io[data-tour-active] micrio-markers{display:none}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%)}micrio-dial:before,micrio-dial:after{content:"";background-position:var(--micrio-dial-offset,0px);width:100%;display:block;position:absolute}micrio-dial:before{background-image:repeating-linear-gradient(90deg,#8888 0% .5%,#0000 1% 2.5%);height:50%;top:25%}micrio-dial:after{background-image:repeating-linear-gradient(90deg,#fff8 0% .5%,#0000 1% 20%);height:100%}micrio-minimap canvas{bottom:var(--micrio-border-margin);transform-origin:100% 100%;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}micrio-main:has(>micrio-controls)>micrio-minimap>canvas{right:calc(2 * var(--micrio-border-margin) + var(--micrio-button-size))}@media (width<=800px){micrio-minimap canvas{pointer-events:none;transform:scale(.5)!important}}micrio-embed>:is(a,div){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}micrio-embed>:is(a,div).embed3d{top:50%;left:50%}micrio-embed>:is(a,div).no-events{pointer-events:none}micrio-embed>:is(a,div).hide-when-paused{transition:opacity .25s}micrio-embed>:is(a,div).hide-when-paused:has(figure.paused){opacity:0}micrio-embed>:is(a,div).inactive{opacity:0;pointer-events:none}micrio-embed>:is(a,div)>*{transform:translate3d(-50%,-50%,0) scale3d(var(--scale,1),var(--scale,1),1);cursor:pointer;margin:0;position:absolute}micrio-embed>:is(a,div)>:not(button){width:auto!important}micrio-embed>:is(a,div)>img{max-width:none}micrio-embed>:is(a,div)>button{--scale:1;--ratio:1;width:100px;aspect-ratio:var(--ratio);background:0 0;border:none;margin:0;padding:0}micrio-embed>:is(a,div)>:is(button,img){touch-action:none}micrio-image-embeds>*{pointer-events:all}micrio-tour>aside.marker-tour{bottom:var(--micrio-border-margin);max-width:calc(100% - var(--micrio-border-margin) * 2);left:50%;transform:translate(-50%)}aside.marker-tour{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));z-index:5;--micrio-hide:translate(-50%,100%);padding:0;transition:transform .25s,opacity .25s;display:flex;position:absolute}aside.marker-tour>micrio-button{--micrio-button-background:transparent;--micrio-background-filter:none;--micrio-button-shadow:none;--micrio-border-radius:0}aside.marker-tour>span{height:var(--micrio-button-size);line-height:var(--micrio-button-size);text-align:center;cursor:default;color:var(--micrio-color);background:0 0;border:none;align-items:center;padding:0 12px;font-family:inherit;font-size:90%;display:flex}micrio-swipe-gallery>figcaption{top:var(--micrio-border-margin);left:var(--micrio-border-margin);padding:var(--micrio-popup-padding);box-sizing:border-box;max-width:410px;position:absolute}@media (width<=500px){micrio-swipe-gallery>figcaption{max-width:calc(100% - 3*var(--micrio-border-margin) - var(--micrio-button-size))}}dialog::backdrop{color:#fff;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);animation:.2s forwards micrio-popover-bg}@keyframes micrio-popover-bg{0%{background:0 0}to{background:var(--micrio-popover-background)}}dialog{pointer-events:all;background:0 0;border:none;max-width:90vw;max-height:90vh;padding:0;animation:.5s forwards micrio-popover-fade;position:relative;overflow:visible}@keyframes micrio-popover-fade{0%{opacity:0}to{opacity:1}}dialog>aside{--micrio-background-filter:none;z-index:1;position:absolute}dialog:not(.article){display:flex}@media (width>=640px){dialog:not(.article){width:calc(85cqw - 56px);height:47.8125cqw}dialog>aside{margin-left:var(--micrio-border-margin);display:block;top:0;left:100%}dialog>micrio-marker-content{width:25cqw;min-width:unset;max-width:320px}}@media (width<=639px){dialog:not(.article){flex-direction:column;width:100%;height:100%}dialog>aside{top:var(--micrio-border-margin);right:var(--micrio-border-margin);position:fixed}}@media (aspect-ratio>=16/9){dialog:not(.article){width:133.333cqh;height:75cqh}}dialog:not(.article)>micrio-media{flex:1}dialog:not(.article)>micrio-media>figure{height:100%}dialog:not(.article)>micrio-media>figure :is(iframe,video){height:calc(100% - var(--micrio-button-size))}dialog.article{width:540px}dialog.article 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}dialog.article h2{text-align:center}dialog.gallery>aside{left:auto;right:var(--micrio-border-margin);top:var(--micrio-border-margin);margin-left:0}dialog.gallery{width:100%;height:100%;max-width:unset;max-height:unset}micrio-gallery>micrio-button>button{z-index:2;transition:transform .15s,opacity .15s;position:absolute;top:50%;transform:translateY(-50%)}micrio-gallery>micrio-button.prev>button{left:var(--micrio-border-margin);--micrio-hide:translate(-100%,-50%)}micrio-gallery>micrio-button.next>button{right:var(--micrio-border-margin);--micrio-hide:translate(100%,-50%)}micrio-gallery ul{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;--micrio-hide:translate(-50%,100%);width:520px;max-width:calc(100cqw - 50px);margin:0;padding:0 16px;list-style-type:none;transition:transform .15s,opacity .15s;display:block;position:absolute;left:50%;transform:translate(-50%)}@media (width<=500px){micrio-gallery ul{left:var(--micrio-border-margin);right:calc(var(--micrio-button-size) + var(--micrio-border-margin) * 2);--micrio-hide:translateY(100%);width:auto;transform:none}}micrio-gallery ul>:first-child{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%)}micrio-gallery ul>:first-child>span{background:var(--micrio-color);opacity:.85;border-radius:2px;height:100%;transition:width .15s;display:block;position:absolute;top:0;left:0}micrio-gallery ul>:nth-child(2){pointer-events:none;position:absolute;inset:0 16px}micrio-gallery ul>:nth-child(2)>span{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%)}micrio-gallery ul>:nth-child(2)>span[data-active]{opacity:1;background:var(--micrio-color-hover,var(--micrio-color));transform:translate(-50%,-50%)scale(1.6)}@media (hover:hover){micrio-gallery ul>:nth-child(2)>span[data-hover]{opacity:1;transform:translate(-50%,-50%)scale(1.4)}}micrio-gallery ul.dense>:nth-child(2)>span{opacity:.35;border-radius:1px;width:1.5px;height:8px;transform:translate(-50%,-50%)}micrio-gallery ul.dense>:nth-child(2)>span[data-major]{opacity:.6;height:12px}micrio-gallery ul.dense>:nth-child(2)>span[data-active]{opacity:1;background:var(--micrio-color-hover,var(--micrio-color));width:2px;height:14px;transform:translate(-50%,-50%)}@media (hover:hover){micrio-gallery ul.dense>:nth-child(2)>span[data-hover]{opacity:.9;transform:translate(-50%,-50%)}}micrio-gallery [data-part=hover-label]{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%)}micrio-gallery ul>button{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%)}micrio-gallery ul>button:hover{box-shadow:0 2px 8px #0006,0 0 0 4px #ffffff1f}micrio-gallery ul>button.dragging{cursor:grabbing;transition:none;box-shadow:0 2px 12px #00000080,0 0 0 6px #ffffff26}micrio-gallery ul>button+span{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%)}micrio-gallery ul>button+span.dragging{transition:none;transform:translate(-50%)scale(1.05)}micrio-gallery>micrio-button>button:is(:hover,:focus){position:absolute!important}micrio-serial-tour>micrio-media,micrio-serial-tour micrio-media-controls{display:contents}micrio-serial-tour [data-part=bars]{height:var(--micrio-progress-bar-height,6px);background:var(--micrio-progress-bar-background,#8080804d);border-radius:3px;display:flex;position:relative;overflow:hidden}micrio-serial-tour [data-part=bars]>[data-part=bar]{box-sizing:border-box;cursor:pointer;background:0 0;height:100%;display:block;position:relative;overflow:hidden}micrio-serial-tour [data-part=bars]>[data-part=bar]:before{content:" ";background:var(--micrio-color);pointer-events:none;height:100%;width:var(--progress,0%);will-change:width;display:block;position:absolute}micrio-serial-tour [data-part=bars]>[data-part=bar].active:before{background:var(--micrio-active-color,var(--micrio-color))}micrio-serial-tour ol{left:var(--micrio-border-margin);bottom:var(--micrio-border-margin);color:var(--micrio-color);text-shadow:var(--micrio-marker-text-shadow);--micrio-hide:translate3d(-100%,0,0);margin:0;list-style-type:decimal-leading-zero;transition:transform .25s,opacity .25s;position:absolute}micrio-serial-tour ol>li{white-space:pre;padding:.15em;transition:height .25s,opacity .25s .25s}micrio-serial-tour ol>li.active{font-weight:700}micrio-serial-tour ol button{font:inherit;color:inherit;text-shadow:inherit;cursor:pointer;background:0 0;border:none;display:inline}micrio-serial-tour ol button:hover{text-decoration:underline}@media (width<=500px){micrio-serial-tour ol{bottom:calc(var(--micrio-button-size) + 3 * var(--micrio-border-margin))}}micrio-main.is360{perspective:50cqh}`;document.head.insertBefore(_style,document.head.firstChild);
|
|
27
|
+
!function(){function t(i,s,e={}){if(!i||"object"!=typeof i)return s;const h=s;for(const o of Object.keys(i)){const s=i[o];s&&"object"==typeof s&&Object.getPrototypeOf(s)===Object.prototype?(h[o]&&"object"==typeof h[o]||(h[o]={}),t(s,h[o],e)):e.noOverwrite&&o in h||(h[o]=s)}return s}var i,s="E001",e="E002",h="E003",o="E004",n="E005",r="E100",a="E101",c="E102",l="E103",u="E200",d="E201",p="E202",m="E203",f="E300",g="E301",v="E302",w="E303",M="E999",y={[s]:"You appear to be offline. Please check your internet connection and try again.",[e]:"The connection timed out. Please try again.",[h]:"Unable to load content due to security restrictions.",[o]:"The requested image or content could not be found.",[n]:"The server encountered an error. Please try again later.",[r]:"Your browser does not support WebGL, which is required to view this content. Please try a different browser.",[a]:"The graphics context was lost. The page will attempt to recover.",[c]:"There was a problem initializing the graphics. Please try refreshing the page.",[l]:"Your device is low on memory. Try closing other browser tabs or applications.",[u]:"The image data appears to be invalid or corrupted.",[d]:"The requested content could not be loaded.",[p]:"There was a problem processing the image information.",[m]:"This image uses an unsupported format version.",[f]:"Failed to load the image viewer engine. Please try refreshing the page.",[g]:"An error occurred in the image viewer. Please try refreshing the page.",[v]:"Failed to load the image. Please try again.",[w]:"Failed to load the tour. Some features may be unavailable.",[M]:"An unexpected error occurred. Please try refreshing the page."},_=class t extends Error{displayMessage;cause;code;statusCode;constructor(i,s){super(i),this.name="MicrioError",this.code=s?.code??M,this.displayMessage=s?.displayMessage??y[this.code],this.cause=s?.cause,this.statusCode=s?.statusCode,"captureStackTrace"in Error&&"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t)}static fromResponse(i,h){const r=i.status;let a=M;return 404===r?a=o:r>=500&&600>r?a=n:0===r?a=s:408!==r&&504!==r||(a=e),new t(`${h?h+": ":""}HTTP ${r}`,{code:a,statusCode:r})}static fromError(i,o){const n=i.message.toLowerCase();let a=M;return n.includes("network")||n.includes("internet")||n.includes("offline")?a=s:n.includes("timeout")?a=e:n.includes("cors")||n.includes("cross-origin")?a=h:n.includes("webgl")||n.includes("webglcontext")?a=r:n.includes("memory")||n.includes("out of memory")?a=l:(n.includes("wasm")||n.includes("webassembly"))&&(a=f),new t(`${o?o+": ":""}${i.message}`,{code:a,cause:i})}},b=new Map,k=new Map,x=new Map,T=async(t,i)=>{if(!i&&b.has(t))return structuredClone(b.get(t));if(k.has(t))return k.get(t);if(x.has(t))throw x.get(t);const s=fetch(t+(i?(t.includes("?")?"&":"?")+Math.random():"")).then(async i=>{if(200==i.status)return i.json();{const s=_.fromResponse(i,`fetchJson(${t})`);throw x.set(t,s),s}}).then(s=>(i||b.set(t,s),k.delete(t),structuredClone(s))).catch(i=>{throw k.delete(t),i});return k.set(t,s),s},P=t=>{let i=t.charCodeAt(0),s=91>i;return(i-=s?65:97)-(i>7?1:0)+(s?24:i>10?-1:0)},S=t=>6==t.length||7==t.length,E=()=>Math.random().toString(),C=`https://viewer.${(()=>{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"})()}/`,z="micrio-muted",I={camspeed:1,view:[0,0,1,1],restrict:[0,0,1,1],focus:[.5,.5],zoomLimit:1,fullscreen:1,hookEvents:1,hookScroll:1,hookPinch:1,hookDrag:1,minimap:1,doTourJumps:1,audio:1,startVolume:1,mutedVolume:0,t:{showTitles:0,zoomOutAfterClose:1},ui:{controls:{cultureSwitch:1}},l:{}},L={id:{r:1},lang:{r:1},"data-path":{r:1},"data-inittype":{f:"initType"},"data-start":{f:"gallery.startId"},"data-gallery-sort":{f:"gallery.sort"},"data-gallery-type":{f:"gallery.type"}},A={"data-static":{},muted:{f:"audio",n:1},"data-no-externals":{f:"noExternals"},"data-skipmeta":{f:"skipMeta"},"data-keeprendering":{f:"keepRendering"},"data-coverlimit":{f:"limitToCoverScale"},"data-events":{f:"hookEvents"},"data-keys":{f:"hookKeys"},"data-zooming":{f:"noZoom",n:1},"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:1},"data-controls":{f:"noControls",n:1},"data-logo":{f:"noLogo",n:1},"data-logo-org":{f:"noOrgLogo",n:1},"data-toolbar":{f:"noToolbar",n:1},"data-show-info":{f:"showInfo"},"data-social":{},"data-fullscreen":{},"data-minimap":{},"data-minimap-hide":{f:"alwaysShowMinimap",n:1},"data-normalize-dpr":{f:"zoomLimitDPRFix"},"data-freemove":{f:"freeMove"}},$={"data-version":{r:1},height:{r:1},width:{r:1},volume:{f:"startVolume"},"data-camspeed":{},"data-zoomlimit":{f:"zoomLimit"},"data-minimap-height":{f:"minimapHeight"},"data-minimap-width":{f:"minimapWidth"},"data-mutedvolume":{f:"mutedVolume"},lazyload:{dN:0},"data-elasticity":{f:"dragElasticity"},"data-skip-base-levels":{f:"skipBaseLevels"},"data-watermark-opacity":{f:"watermarkOpacity"}},D={"data-focus":{},"data-view":{}},O=new Map,F=new Map,V=new Map,N=new Map,B={async u(t){return(await this.p(t))?.data},m(t){return O.get(t)},M(t){return(O.get(t.micrioId)?.data)?.markers?.find(i=>i.id===t.markerId)},_(t){return F.get(t)},k(){return i},T(t){return V.get(t)},async p(t){if(t)return await(async t=>{if(!t||t.startsWith("http")||O.has(t))return;if(N.has(t))return N.get(t);const s=(async t=>{const s=await T(`${C}${t}/bundle.json`);if(s?.images){for(const t of s.images)t?.id&&O.set(t.id,t);t.startsWith("external/")&&s.images[0]?.id&&O.set(t,s.images[0])}if(s?.organisation&&(i=s.organisation),s?.spaces)for(const i of s.spaces)i?.id&&i?.data&&F.set(i.id,i.data);s?.album&&V.set(s.album.id,s.album)})(t);N.set(t,s);try{await s}catch{}finally{N.delete(t)}})(t),O.get(t)}},G="7.0.0";function Y(t){const i=new Set;return{subscribe(s,e){return i.add(s),s(t),()=>i.delete(s)},set(s){t=s,i.forEach(t=>t(s))},update(i){this.set(i(t))}}}function H(t){let i;return t.subscribe(t=>{i=t})(),i}function R(){return Promise.resolve()}function X(t){let i,s=0;return e=>{i=e,s||(s=1,Promise.resolve().then(()=>{s=0,t(i)}))}}function j(t){let i=1;return s=>{i?i=0:t(s)}}var W=(t,i=1)=>(t%i+i)%i,U=t=>W(t),Z=t=>W(t,2*Math.PI),q=t=>1<<t,J=t=>({centerX:t[0]+t[2]/2,centerY:t[1]+t[3]/2,width:t[2],height:t[3]}),K=(t,i,s)=>!(t<s[0]||t>s[0]+s[2]||i<s[1]||i>s[1]+s[3]),Q=(t,i)=>1e-6>Math.abs(t-i),tt=(t,i,s)=>{let e=t*t+i*i+s*s;return e>0?(e=1/Math.sqrt(e),[t*e,i*e,s*e]):[0,0,0]};function it(t,i){const s=U(t),e=U(i)-s,h=e>0?e-1:e+1;return Math.abs(e)>Math.abs(h)?h:e}var st,et,ht=class{#t;#i;#s;#e;#h;#o;#n;constructor(t,i,s,e){this.#n=t===i&&s===e&&0===t&&1===s;const h=3*t,o=3*(s-t)-h;this.#t=h,this.#i=o,this.#s=1-h-o;const n=3*i,r=3*(e-i)-n;this.#e=n,this.#h=r,this.#o=1-n-r}#r(t){return t*(this.#t+t*(this.#i+t*this.#s))}#a(t){return t*(this.#e+t*(this.#h+t*this.#o))}#c(t){return this.#t+t*(2*this.#i+3*this.#s*t)}#l(t){let i=t,s=0,e=0,h=0;for(;5>s&&(e=this.#r(i)-t,h=this.#c(i),0!==h);)i-=e/h,s++;return i}get(t){return this.#n?t:this.#a(this.#l(t))}},ot=new ht(.42,0,.58,1),nt=new ht(.42,0,1,1),rt=new ht(0,0,.58,1),at=new ht(0,0,1,1),ct={ease:ot,"ease-in":nt,"ease-out":rt,linear:at},lt=t=>ct[t??"ease"]??ot,ut=class{rotationY=0;#u;P;S;C=[];#d;get image(){return this.#d}constructor(t){if(this.#d=t,!t.I){const i=t.state.$view;i&&t.$info?.width&&R().then(()=>this.setView(i))}}L(t){this.#u=t}getView=()=>{const t=this.#u?.view.arr;return t?[t[0]-t[2]/2,t[1]-t[3]/2,t[2],t[3]]:[0,0,1,1]};getViewRaw=()=>this.#u?.view.arr??new Float64Array(4);setView(t,i={}){if(!this.#u)return;let{centerX:s,centerY:e,width:h,height:o}=J(t);if(this.#d.opts.useParentCamera){const t=this.#d.opts.area;t&&(s=t[0]+s*t[2],e=t[1]+e*t[3],h*=t[2],o*=t[3])}this.#u.A(s,e,h,o,!!i.noLimit,0,i.correctNorth),i.noRender||this.#d.engine.render()}getCoo(t,i,s=0,e=0){return this.#p(t,i,s,e).slice(0).map(t=>Math.round(1e6*t)/1e6)}#p(t,i,s=0,e=0){const h=this.#u;if(!h)return new Float64Array(5);if(s){const s=this.#d.engine.micrio.getBoundingClientRect();t-=s.left,i-=s.top}return(h.is360?h.D.$(t,i):h.camera.$(t,i,!!s,!!e)).arr}getXY(t,i,s=0,e,h,o){return this.O(t,i,{abs:s,radius:e,rotation:h,noTrueNorth:o}).slice(0)}O(t,i,s={}){const e=this.#u;if(!e)return new Float64Array(5);const h=this.#d.I&&!s.noTrueNorth?-this.rotationY/(2*Math.PI):0;return e.is360?e.D.F(t-h,i).arr:void 0===s.rotation||isNaN(s.rotation)?e.N.V(t-h,i,!!s.abs).arr:e.N.B(t-h,i,s.radius??0,s.rotation,!!s.abs).arr}setCoo(t,i,s){this.#u&&(this.#u.camera.setCoo(t,i,s??this.getScale()),this.#d.engine.render())}getScale=()=>this.getCoo(0,0)[2]||1;getCoverScale=()=>this.#u?.camera.G??1;getMinScale=()=>this.#u?.camera.Y??.1;setMinScale(t){this.#u?.H(t)}setMinScreenSize(t){!this.#d.album&&this.#u&&(this.#u.camera.R=Math.max(0,Math.min(1,t)))}isZoomedIn=()=>!!this.#u?.X();isZoomedOut=(t=0)=>!!this.#u?.j(t);getDirection=()=>this.#u?.D.W??0;getPitch=()=>this.#u?.D.U??0;setDirection(t,i){this.#u&&(this.#u.Z(t,i??this.#u.D.U),this.#d.engine.render())}setLimit(t){if(!this.#u)return;const i=J(t);this.#u.view.q(i.centerX,i.centerY,i.width,i.height),this.#d.engine.render()}setCoverLimit(t){this.#u&&(this.#u.J=!!t,this.#u.K())}getCoverLimit=()=>!!this.#u?.J;set360RangeLimit(t=0,i=0){this.#u&&(this.#u.D.tt(t,i),this.#d.engine.render())}stop(){this.#u?.it()}pause(){this.#u?.st()}resume(){this.#u?.et(),this.#d.engine.render()}getMatrix(t,i,s,e,h,o,n,r,a,c,l){return this.#u?.ht(t,i,s??1,e??10,h||0,o||0,n||0,r??0,a??1,c??1,!!l)??new Float32Array(16)}setArea(t,i={}){if(this.#u){if(this.#d.opts.area=t,this.#d.opts.isEmbed&&this.#d.ot){for(const i of this.#u.images)if(i.nt>0)return void i.rt(t[0],t[1],t[0]+t[2],t[1]+t[3])}else this.#u.rt(t[0],t[1],t[0]+t[2],t[1]+t[3],!!i.direct,!!i.noDispatch);i.noRender||this.#d.engine.render()}}setRotation(t=0,i=0,s=0){if(this.#d.opts.isEmbed&&this.#u&&this.#d.engine.ready){for(const e of this.#u.images)if(e.nt>0){e.ct=t,e.lt=i,e.ut=s;break}this.#d.engine.render()}}getOmniRotation(){const t=this.#d.$settings.omni;return t&&this.#u?(this.#d.omni?.currentIndex??0)/((t.frames??1)/(t.layers?.length??1))*Math.PI*2:0}dt(t){const i=this.#d.$settings.omni;if(i&&null!=t)return Math.floor(t/(2*Math.PI)*(i.frames/(i.layers?.length??1)))}getOmniXY(t,i,s){return this.#u?.N.ft(t,i,s).arr??new Float64Array(5)}gt(){if(!this.#u)return;const t=this.#u.view.arr;this.#d.state.view.set([t[0]-t[2]/2,t[1]-t[3]/2,t[2],t[3]])}#m(t,i){this.P=t,this.S=i}flyToView(t,i={}){return new Promise((s,e)=>{if(!this.#u)return e(new Error("engine not ready"));let{centerX:h,centerY:o,width:n,height:r}=J(t);if(2==i.margin?.length&&(h+=i.margin[0],o+=i.margin[1],n-=2*i.margin[0],r-=2*i.margin[1]),this.#d.opts.useParentCamera){const t=this.#d.opts.area;t&&(h=t[0]+h*t[2],o=t[1]+o*t[3],n*=t[2],r*=t[3])}if(i.prevView){const t=J(i.prevView);this.#u.wt.vt(t.centerX,t.centerY,t.width,t.height)}const a=this.#d.$settings.omni;if(a?.frames){const s=a.layers?.length??1,e=a.frames/s;if(null==i.omniIndex){const s=t[4]||(Array.isArray(t)&&void 0!==t[5]?t[5]:void 0);void 0!==s&&(i.omniIndex=Math.round(W(s/(2*Math.PI))*e))}null!=i.omniIndex&&(i.omniIndex=W(i.omniIndex,e))}const c=this.#u.camera.Mt(h,o,n,r,i.duration??-1,i.speed??-1,i.progress??0,!!i.isJump,!!i.limit,!!i.limitZoom,i.omniIndex??0,lt(i.timingFunction));this.#d.engine.render(),0==c?s():this.#m(s,e)})}flyToFullView(t={}){return this.flyToCoo([.5,.5,this.getMinScale()],t)}flyToCoverView(t={}){const i=this.#d.$settings.focus??[.5,.5];return i[2]=this.getCoverScale(),this.flyToCoo(i,t)}flyToCoo(t,i={}){return new Promise((s,e)=>{if(!this.#u)return e(new Error("engine not ready"));const h=lt(i.timingFunction);i.duration=this.#u.camera.setCoo(t[0],t[1],t[2]??this.getScale(),i.duration??-1,i.speed??-1,i.limit??0,h),this.#d.engine.render(),0==i.duration?s():this.#m(s,e)})}zoom(t,i=0,s,e,h=1,o=0){return new Promise((h,n)=>{if(!this.#u)return n(new Error("engine not ready"));const r=this.#u.view.arr,a=this.getXY(r[0],r[1]);if(null==s&&(s=a[0]),null==e&&(e=a[1]),this.#d.album&&!this.#d.album.hooked)return h();i=this.#u.camera.yt(t,s,e,i,o),this.#d.engine.render(),0==i?h():this.#m(h,n)})}async zoomIn(t=1,i=250,s=1){return this.zoom(200*-t,i,void 0,void 0,s).catch(()=>{})}async zoomOut(t=1,i=250,s=1){const e=this.#d.engine.micrio.canvas.viewport,h=e.width/e.height,o=this.#d.$info.width/this.#d.$info.height;return this.zoom(t*(400/Math.max(1,h/o/2)),i,void 0,void 0,s).catch(()=>{})}pan(t,i,s=0,e={}){this.#u&&(this.#u.camera._t(t,i,s,!!e.noLimit),(s>0||e.render)&&this.#d.engine.render())}setScale(t){const i=this.#u?.view.arr;i&&this.setCoo(i[0],i[1],t)}};function dt(t,i={}){const s=i.ns?document.createElementNS(i.ns,t):document.createElement(t);if(i.className&&(s instanceof SVGElement?s.setAttribute("class",i.className):s.className=i.className),void 0!==i.textContent&&(s.textContent=i.textContent),void 0!==i.innerHTML&&(s.innerHTML=i.innerHTML),i.id&&(s.id=i.id),i.dataset)for(const[e,h]of Object.entries(i.dataset))s.dataset[e]=h;if(i.attrs)for(const[e,h]of Object.entries(i.attrs))null==h?s.removeAttribute(e):s.setAttribute(e,h);if(i.style&&("string"==typeof i.style?s.style.cssText=i.style:Object.assign(s.style,i.style)),i.props&&Object.assign(s,i.props),i.events)for(const[e,h]of Object.entries(i.events))s.addEventListener(e,h);if(i.children)for(const e of i.children)null!=e&&0!=e&&("string"==typeof e||"number"==typeof e?s.append(String(e)):s.append(e));return i.setProps&&s.bt?.(i.setProps),i.parent&&i.parent.appendChild(s),s}function pt(t,i={}){return dt(t,{...i,ns:"http://www.w3.org/2000/svg"})}(et=st||(st={})).Main=class{tour=Y();#f;get $tour(){return this.#f}marker=Y();markerHoverId=Y();#g;get $marker(){return this.#g}popup=Y();popover=Y();mediaState=new Map;constructor(){this.tour.subscribe(t=>{"string"!=typeof t&&(this.#f=t)}),this.marker.subscribe(t=>{"string"!=typeof t&&(this.#g=t)})}},et.Image=class{view=Y(void 0);#v;get $view(){return this.#v}marker=Y(void 0);#g;get $marker(){return this.#g}layer=Y(0);constructor(t){const i=t.engine.micrio;let s,e,h;this.view.subscribe(o=>{this.#v=o;const n=o?.toString();if(o&&n&&s!=n){const r={image:t,view:o};s=n;const a=o[2],c=o[3];if(!e||!h||Math.abs(a-e+(c-h))>1e-5){for(const t of i.kt)t(r);i.events.xt("zoom",{image:t,view:o}),e=a,h=c}for(const t of i.Tt)t(r)}}),this.marker.subscribe(t=>{const s=this.#g;this.#g=t&&"string"!=typeof t?t:void 0,this.#g?i.state.marker.set(this.#g):t||i.state.$marker!=s||i.state.marker.set(void 0)})}};var mt=t=>new Promise(i=>t?setTimeout(i,t):i()),ft=()=>new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(()=>t()))),gt=new Set;async function vt(t,i,s){if(t in self||await wt(i,s),!(t in self))throw new Error(`Failed to load ${t} API from ${i}`)}var wt=(t,i,s)=>new Promise((e,h)=>{if(s||gt.has(t))return e();const o=document.createElement("script"),n=()=>{gt.add(t),e()};i?self[i]=n:o.onload=n,o.onerror=()=>h?.(),o.async=1,o.defer=1,self.crossOriginIsolated&&(o.crossOrigin="anonymous"),o.src=t,document.head.appendChild(o)}),Mt=[],yt=class t{id;uuid=E();#w;get $info(){return this.#w}Pt=Y({});get $settings(){return H(this.Pt)}data=Y(void 0);get $data(){return H(this.data)}state;camera;video=Y(void 0);visible=Y(0);album;omni;grid;St;Et;Ct;error;ot=0;zt=-1;I=0;It=0;Lt=0;At=1;#M=0;thumbSrc;#y;$t=0;Dt;Ot=1;Ft=Y();Vt=[];Nt;get engine(){return this.#_}get canvas(){return this.#_.Bt(this)}#_;opts;constructor(t,i,s={}){if(this.#_=t,this.opts=s,this.state=new st.Image(this),s.useParentCamera||(this.camera=new ut(this)),this.id=i.id.replace(C,""),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)))}const e=i.info;this.#w=e,this.Ct=e.path||"https://r2.micr.io/",s.area||(s.area=[0,0,1,1]);const h=i.settings,o=this.#_.micrio;if(!e.isIIIF&&7==this.id.length){const t=P(this.id[1+P(this.id)%6]);e.is360=!!(t>>4&1)||!!e.is360,e.isWebP=!(3&t),e.isPng=2==(3&t),t>>3&1&&S(e.tilesId??this.id)&&(e.format="dz"),e.path||(e.path=`https://${t>>2&1?"eu":"r2"}.micr.io/`)}const n=6==this.id.length&&this.id.startsWith("i")&&!this.id.includes("/"),r=n&&!e.tileBasePath?.includes("micr.io");this.Nt=r?e.tileBasePath??"https://b.micr.io/":n?"https://b.micr.io/":e.tileBasePath??e.path??"https://r2.micr.io/";const a=B.k();if(a?.baseUrl&&!e.path.includes(a.baseUrl)?(this.Ct=e.path=a.baseUrl,n||(this.Nt=this.Ct)):("https://eu.micr.io/"==e.path||e.path)&&(this.Ct=e.path),h?.omni&&(this.Lt=1),a?.branding&&!h?.noUI){const t=`https://${0>(a.logo?.src?.indexOf("/eu.")??-1)?"r2":"eu"}.micr.io/`;this.#b(t+"style/"+a.slug+".css").then(()=>{const t=getComputedStyle(this.#_.micrio).getPropertyValue("--micrio-font-family")?.replace(/^'([^']+)'.*$/,"$1");t&&document.fonts.ready.then(()=>{document.fonts.check("16px "+t)||this.#b(`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`)})})}if(e.isIIIF&&e.id.includes("/")&&(e.id=("@id"in e?e["@id"]:e.id).replace(/^.*\//,"")),e.spacesId&&!o.spaceData&&(o.spaceData=B._(e.spacesId),1==o.spaceData?.images.length&&delete o.spaceData),e.is360&&this.camera){const t=o.spaceData?.images.find(t=>t.id==this.id)?.rotationY;null!=t?this.camera.rotationY=t:null!=h?.l?.trueNorth&&(this.camera.rotationY=(h.l.trueNorth-.5)*Math.PI*2)}this.$t=this.$t||this.Lt||!e.id&&!e.tilesId,this.#y=e.tileExtension||e.isPng&&"png"||e.isWebP&&"webp"||"jpg","dz"==e.format&&(e.isDeepZoom=1),this.I=!!e.is360,this.It=!!e.isVideo;let c=H(o.Gt);if(e.revision){const t=Object.keys(e.revision);t.length&&!t.includes(c)&&(o.lang=t.includes("en")?"en":t[0])}if(h&&!h.noExternals&&(h.css&&this.#b(h.css.href),h.js)){const t=h.js.href.replace("$lang",c);wt(t);const i=document.head.querySelector('script[src="'+t+'"]');i&&(i.micrioElement=this.#_.micrio)}for(let p=e.tileSize??1024;p<Math.max(e.width,e.height);p*=2,this.At++);let l=Math.max(e.width,e.height);do{this.#M++}while((l/=2)>1);h?.gallery?.archive&&(this.At-=1-(h.gallery.archiveLayerOffset??0)),this.$t||(this.thumbSrc=this.Yt(this.At,0,0)),o.events.xt("pre-info",e),this.$t&&!this.Lt||h?.skipMeta||!i.data||this.data.set(i.data),h&&this.Pt.set(h),e.watermark&&this.#_.micrio.Rt.Ht(e.watermark,h?.watermarkOpacity),this.Lt&&this.state.layer.subscribe(t=>{this.ot&&this.#_.ready&&(this.canvas?.Xt(t),this.#_.render())});const u=this.#_.micrio;let d=H(this.visible);this.visible.subscribe(t=>{t!=d&&(d=t,u.jt.update(i=>(t?i.push(this):i.splice(i.indexOf(this),1),i)),t&&u.$current==this&&u.Wt.set(0))}),this.video.subscribe(t=>this.Et=t)}Yt(t,i,s,e){const h=this.#w;if(h.isDeepZoom&&(t=this.#M-t),h.isIIIF){const e=h.tileSize??1024,o=Math.pow(2,t)*e,n=Math.min(h.width,i*o),r=Math.min(h.height,s*o),a=Math.min(h.width-n,o),c=Math.min(h.height-r,o),l=Math.round(Math.min(e,a/o*e)),u=Math.round(Math.min(e,c/o*e));return`${h.path}/${h.id}/${[n,r,a,c].join(",")}/${[l,u].join(",")}/0/default.jpg`}if(this.$settings?.l?.video?.src)throw new Error("Video thumb");return`${this.Nt}${h.tilesId||h.id}/${void 0!==e?e+"/":""}${t}/${i}${h.isDeepZoom?"_":"-"}${s}.${this.#y}`}#b(t){return new Promise(i=>{Mt.includes(t)||document.head.querySelector('link[href="'+t+'"]')?i():(Mt.push(t),dt("link",{attrs:{type:"text/css",rel:"stylesheet",href:t},events:{load:i},parent:document.head}))})}addEmbed(i,s,e,h={}){const o=e.slice(0),n=new t(this.#_,{id:i.id??"",info:{...i,id:i.id??""},data:B.m(i.id??"")?.data,settings:s},{area:o,isEmbed:1,useParentCamera:h.asImage});if(n.camera||(n.camera=this.camera),this.Vt.push(n),void 0===h.opacity&&(h.opacity=1),"cover"==h.fit||"contain"==h.fit){const t=n.$info,i=this.I?2:1,s="cover"==h.fit,e=o[2],r=o[3],a=o[0]+e/2,c=o[1]+r/2,l=e/r*i,u=t.width/t.height;if(s&&l>u||!s&&u>=l){const t=e/u*i;o[1]=c-t/2,o[3]=t}else{const t=r*u/i;o[0]=a-t/2,o[2]=t}}return this.#_.Ut(n,this,h),this.#_.render(),n}#k=new Map;Zt(t,i){i?this.#k.set(t,i):this.#k.delete(t)}getEmbedMediaElement(t){return this.#k.get(t)}},_t=new class{#x=new Map;db=new Map;async load(t,i,s){if(this.#x.has(i))return;const e=i.replace(/^.*\//,"").split(".")[0],h=/\/base$/.test(i),o=h||S(e),n=new XMLHttpRequest,r=await new Promise((e,h)=>{let r=0;n.responseType="arraybuffer",n.onprogress=t=>{r||(r=Number(n.getResponseHeader("Content-Length"))),s?.(Math.min(1,t.loaded/r))},n.onload=()=>{4===n.readyState&&200===n.status?(s?.(1),e(n.response)):h()},n.onerror=h,n.open("GET",t+i+(o?".bin":".mdp")),n.send()});if(!r)return;this.#x.set(i,r);const a=h?i.split("/")[0]+"/":"";let c=0;for(;c<r.byteLength&&c+32<=r.byteLength;){const s=this.#T(new Uint8Array(r,c,32));if(s.name&&s.size>0)this.db.set(t+a+s.name.replace("./",""),[i,c+32,s.size]);else if(0===s.size&&!s.name)break;c+=32+s.size}}#T(t){const i=(new TextDecoder).decode(t),s=t=>i.slice(e,e+=t).replace(/\x00/g,"").trim();let e=0;return{name:s(20),size:parseInt(s(12),8)}}get=t=>new Promise((i,s)=>{const e=this.db.get(t);if(!e||!this.#x.has(e[0]))return s(new Error("Could not get blob: "+t));const h=new FileReader;h.onload=()=>i(JSON.parse(h.result)),h.readAsText(new Blob([new Uint8Array(this.#x.get(e[0]),e[1],e[2])]))});getImage=async t=>{const i=this.db.get(t);if(!i||!this.#x.has(i[0]))throw new Error("Could not get blob: "+t);const s=new Blob([new Uint8Array(this.#x.get(i[0]),i[1],i[2])]);return self.createImageBitmap(s)}},bt=navigator.userAgent,kt={iOS:/ipad|iphone|ipod/i.test(bt),firefox:/firefox/i.test(bt),OSX:/macintosh/i.test(bt)&&/os\ x/i.test(bt),hasTouch:"TouchEvent"in self,safari:0};kt.safari=(kt.OSX||kt.iOS)&&(/safari/i.test(bt)||/instagram/i.test(bt))&&!/chrome/i.test(bt),kt.OSX&&kt.safari&&"TouchEvent"in self&&(kt.iOS=1,kt.OSX=0);var xt=URL.createObjectURL(new Blob(["let controller = null;\nself.addEventListener('message', e => {\n\tif(e.data == 'abort') return controller && controller.abort();\n\tcontroller = new AbortController();\n\tfetch(e.data.src, { signal: controller.signal })\n\t\t.then(r => r.blob())\n\t\t.then(blob => self.createImageBitmap(blob))\n\t\t.then(data => self.postMessage({ data, src: e.data.src }, [data]))\n\t\t.catch(err => self.postMessage({ error: e.data.src + ': ' + err.message, type: err.name }))\n})"],{type:"text/javascript"})),Tt=Math.max(2,Math.min(6,(navigator.hardwareConcurrency||2)-1)),Pt=Array(Tt).fill(0),St=0,Et=[],Ct=[],zt=new Map;for(let pe=0;Tt>pe;pe++){const t=new Worker(xt);t.onmessage=t=>Lt(pe,t.data.data,t.data.error,t.data.type),Et.push(t)}function It(){if(!Ct.length)return;const t=Pt.indexOf(0);if(0>t)return;Pt[t]=1,St++;const i=Ct.shift();zt.set(t,i),Et[t].postMessage({src:i[0],type:"image/"+i[0].split(".").pop()})}function Lt(t,i,s,e){const h=zt.get(t);h&&(zt.delete(t),s?(h[2](s),"AbortError"!==e&&console.error(`[Micrio Texture] Error loading ${h[0]}: ${e} - ${s}`)):i?h[1](i):(h[2](`Worker ${t} sent invalid message.`),console.error(`[Micrio Texture] Worker ${t} sent invalid message for ${h[0]}`)),setTimeout(()=>{Pt[t]=0,St--,It()},50))}function At(){return St}function $t(t){let i=-1;for(const[s,e]of zt.entries())if(e[0]===t){i=s;break}0>i||Et[i]?.postMessage("abort")}var Dt=class{x0;y0;x1;y1;layer;x;y;image;constructor(t=0,i=0,s=0,e=0,h=0,o=0,n=0){this.x0=t,this.y0=i,this.x1=s,this.y1=e,this.layer=h,this.x=o,this.y=n}},Ot=class{qt;Jt;width;height;Kt;Qt;ti;ii;#P=new Float64Array([.5,.5,1,1]);#S=0;si=0;ei=0;#u;constructor(t,i=.5,s=.5,e=1,h=1,o=.5,n=.5,r=1,a=1){this.qt=i,this.Jt=s,this.width=e,this.height=h,this.Kt=o,this.Qt=n,this.ti=r,this.ii=a,this.#u=t}get arr(){return this.#S&&(this.#P[0]=this.qt,this.#P[1]=this.Jt,this.#P[2]=this.width,this.#P[3]=this.height,this.#S=0),this.#P}get x0(){let t=this.qt;return this.#u.is360&&(t=U(t)),this.#u.is360?U(t-this.width/2):t-this.width/2}get y0(){return this.Jt-this.height/2}get x1(){let t=this.qt;return this.#u.is360&&(t=U(t)),this.#u.is360?U(t+this.width/2):t+this.width/2}get y1(){return this.Jt+this.height/2}get lX0(){return this.Kt-this.ti/2}get lY0(){return this.Qt-this.ii/2}get lX1(){return this.Kt+this.ti/2}get lY1(){return this.Qt+this.ii/2}get aspect(){return this.width/this.height}set(t,i,s,e,h=0){if(h){const t=Math.min(1,this.width)/Math.min(1,this.height);s/e>1.5*t&&s<this.width&&(e=s/t)}this.qt=t,this.Jt=i,this.width=s,this.height=e,this.#S=1,this.si=1}rt(t,i,s,e){this.qt=(t+s)/2,this.Jt=(i+e)/2,this.width=s-t,this.height=e-i,this.#S=1}q(t,i,s,e){this.Kt=t,this.Qt=i,this.ti=s,this.ii=e,this.si=1,this.ei=1}hi(t,i=0){this.qt=t.qt,this.Jt=t.Jt,this.width=t.width,this.height=t.height,i||(this.Kt=t.Kt,this.Qt=t.Qt,this.ti=t.ti,this.ii=t.ii),this.si=1,this.#S=1}#E(){const t=this.#u;return 1/Math.max(this.width*t.width/t.el.width,this.height*t.height/t.el.height)}oi(t,i=0,s=0){const e=this.#u,h=e.N.R,o=this.#E();if(1>h&&o<e.N.Y&&!i){const t=1/h,i=Math.min(t,this.width),s=Math.min(t,this.height);return this.qt=.5,this.Jt=.5,this.width=i,this.height=s,void(this.#S=1)}const n=t?Math.max(1,o/Math.max(e.N.Y,e.maxScale/e.el.scale)):1,r=this.ti,a=this.ii,c=Math.min(r,this.width*n),l=Math.min(a,this.height*n);if(t&&(n>1||i&&o<e.N.Y)&&(this.width=c,this.height=l),(1>r||1>a)&&(this.width=Math.min(this.width,r),this.height=Math.min(this.height,a)),i)return void(this.#S=1);const u=Math.min(1,this.width)/2,d=this.ti/2;this.#u.is360?this.qt=U(this.qt):s||(this.qt=Math.max(this.Kt-d+u,Math.min(this.qt,this.Kt+d-u)));const p=Math.min(1,this.height)/2,m=this.ii/2;s||(this.Jt=Math.max(this.Qt-m+p,Math.min(this.Jt,this.Qt+m-p))),this.#S=1}ni(){const t=this.#u;if(t.is360)return;const i=t.N.cpw/t.N.cph;this.width/this.height>i?this.height=this.width/i:this.width=this.height*i,this.#S=1}},Ft=class{x;y;scale;w;direction;arr=new Float64Array(5);constructor(t=.5,i=.5,s=1,e=0,h=0){this.x=t,this.y=i,this.scale=s,this.w=e,this.direction=h}ri(t){return-1>this.w||3>this.w&&!(0>this.x||this.x>t.width||0>this.y||this.y>t.height)}ai(){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}},Vt=class{width;height;left;top;ci;li;ratio;scale;di;arr=new Int32Array(4);constructor(t=0,i=0,s=0,e=0,h=0,o=0,n=1,r=1,a=0){this.width=t,this.height=i,this.left=s,this.top=e,this.ci=h,this.li=o,this.ratio=n,this.scale=r,this.di=a}get pi(){return 0===this.width||0===this.height?1:this.width/this.height}set(t,i,s,e,h,o,n){return this.width===t*h&&this.height===i*h&&this.left===s&&this.top===e&&this.ratio===h&&this.scale===o&&this.di===n?0:(this.width=t*h,this.height=i*h,this.left=s*h,this.top=e*h,this.ratio=h,this.scale=o,this.di=n,1)}hi(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.di=t.di}},Nt=class{#C=0;#z=0;#I=0;#L=0;#A=0;#$=0;#D=0;#O=0;started=0;#u;constructor(t){this.#u=t}addStep(t,i){const s=this.#u.main.now;if(this.#A)return;0===this.#I&&(this.#I=s);const e=this.#L>0?16.67/(s-this.#L):1;Math.sqrt(t*t+i*i)*e>20&&(this.#$=s);const h=this.#u.main.mi;this.#C+=t*h,this.#z+=i*h,this.#L=s}start(){this.#u.camera.fi()||(this.started=1)}stop(){this.started=0,this.#A=0,this.#I=0,this.#L=0,this.#$=0,this.#C=0,this.#z=0,this.#D=0,this.#O=0}step(){const t=this.#u.main.now,i=this.#u.D,s=this.#u.camera;if(!this.started||0===this.#I)return 1;if(0===this.#A){this.#A=t;const i=1-Math.min(1,(this.#A-this.#$)/250),s=this.#A-this.#I;this.#D=this.#C/(s/4)*i,this.#O=this.#z/(s/4)*i}else this.#D*=.94,this.#O*=.94;let e=Math.sqrt(this.#D*this.#D+this.#O*this.#O);return this.#u.is360?i.gi(this.#D,this.#O):s._t(this.#D,this.#O,0,0,0,1),e>.01||(e=0,this.stop()),1-e}},Bt=class{#F=0;#V;#N;wi;#B=0;#G=0;#Y=0;#H=0;#R=0;#X=ot;#j=0;#W=0;#U=0;oi=1;Mi=0;yi=0;#Z=0;#q=0;#J=0;#K=0;#Q=0;#tt=0;#it=0;#st=-1;#et=0;#u;constructor(t){this.#u=t,this.#V=new Ot(t),this.#N=new Ot(t),this.wi=new Ot(t)}pause(){this.#Z>0||(this.#U=0,this.#Z=performance.now())}resume(){0!==this.#Z&&0!==this.#j&&(this.#j+=performance.now()-this.#Z,this.#Z=0,this.#U=1)}stop(){this.#U&&this.#u.S(),this.#j=0,this.oi=1,this.Mi=0,this.#U=0,this.#F=0,this.#B=0,this.yi=0,this.#Z=0}_i(){return this.#U&&this.#F}bi(t,i,s,e,h,o,n={}){const{speed:r=0,perc:a=0,isJump:c=0,limitViewport:l=0,omniIdx:u=-1,correct:d=0}=n;if(d&&this.yi)return this.ki(t,i,s,e,1),h;this.wi.set(t,i,s,e),this.#N.set(t,i,s,e);const p=this.#u,m=p.view,f=this.#N,g=this.#V;this.#G=c,this.#X=o;const v=p.main.el;if(0!==v.li){const t=e/(1-v.li/v.height);t>0?e+=t:e-=t,v.li=0}if(0!==v.ci){const t=s*(v.ci/v.width);t>0?s+=t:s-=t,v.ci=0}const w=m.qt,M=m.Jt,y=m.width,_=m.height;g.set(w,M,y,_),p.is360&&(t=w+it(w,t),f.set(t,i,s,e)),l&&(f.ni(),f.oi(0)),this.#q=0,this.#K=0,this.#J=0,this.#Q=0;let b=1;if(this.#G){if(!p.is360){const t=f.qt,i=f.Jt;if(f.aspect>g.aspect){const s=f.width/g.aspect;f.set(t,i,f.width,s)}else{const s=f.height*g.aspect;f.set(t,i,s,f.height)}}const h=g.x0,o=g.x1,n=g.y0,r=g.y1,a=f.x0,c=f.x1,l=f.y0,u=f.y1,d=h>a,m=n>l,v=c>o,w=u>r;!(d||m||v||w)||d&&m&&v&&w?f.set(t,i,s,e):(this.#q=d?1:a>h?2:0,this.#K=v?1:o>c?2:0,this.#J=m?1:l>n?2:0,this.#Q=w?1:r>u?2:0,b=1.5)}d&&f.oi(1,!l);const k=Math.max(1e4,Math.min(15e3,p.xi/2));let x=Math.abs(w-t);p.is360&&(x=Math.min(x,1-x));const T=y>s&&_>e?.125:.25,P=(x+Math.abs(M-i)+Math.abs(y-s)*T+Math.abs(_-e)*T)/3;this.#tt=Math.max(.5,.8-P*(p.is360?1:2)),this.#it=Math.max(.05,Math.min(.9,P-(p.is360?.2:.1))),this.#W=0>h?P*k/p.Ti*b/(r>0?r:1):h;const S=p.images.length/p.Pi;return this.#st=p.Si,this.#et=0,!isNaN(u)&&u>0&&u!==this.#st&&(this.#et=u-this.#st,this.#et<-S/2&&(this.#et+=S),this.#et>S/2&&(this.#et-=S),this.#W+=Math.abs(this.#et)/this.#u.images.length*6e3),this.stop(),0===this.#W?(p.A(f.qt,f.Jt,f.width,f.height,0,1),this.#u.P(),this.#W):(this.#F=1,this.oi=0,this.Mi=1,this.#B=0,d&&(this.yi=1),this.#j=performance.now()-a*this.#W,this.#U=1,this.#W*(1-a))}ki(t,i,s,e,h=0){this.#N.set(t,i,s,e),h&&this.#N.oi(1)}zoom(t,i,s,e){this.stop(),this.#F=0,this.Mi=0,this.#B=1,this.#R=e;const h=this.#u,o=h.D;return this.#Y=o.Ei,this.#H=this.#Y+t/(o.Ci*h.xi/20),e||(this.#H=Math.min(o.zi,Math.max(o.Ii,this.#H))),this.#j=performance.now(),this.#U=1,this.#W=0>i?1e3*Math.abs(this.#Y-this.#H)/s:i,i}vt(t,i,s,e,h=0){this.#V.set(t,i,s,e,h),this.#N.set(t,i,s,e,h)}Li(){const t=0===this.#j?1:Math.min(1,Math.max(0,(this.#u.main.now-this.#j)/this.#W)),i=this.#X.get(t);if(this.#U){if(this.#F){const s=this.#V,e=this.#N,h=this.#it,o=this.#X.get(Math.min(1,t/this.#tt)),n=this.#X.get(Math.max(0,(t-h)/(1-h)));let r=0,a=s.qt+(e.qt-s.qt)*((r=this.#q||this.#K)?1===r?o:n:i),c=s.Jt+(e.Jt-s.Jt)*((r=this.#J||this.#Q)?1===r?o:n:i);const l=s.width+(e.width-s.width)*i,u=s.height+(e.height-s.height)*i;if(this.#u.is360){const t=it(s.qt,e.qt);a=s.qt+t*i}if(this.#u.A(a,c,l,u,0,1),this.#et){let i=this.#st+Math.trunc(this.#et*this.#X.get(Math.min(1,1.5*t)));const s=this.#u.images.length/this.#u.Pi;0>i&&(i+=s),s>i||(i-=s),this.#u.Ai(i,0)}}this.#B&&this.#u.D.$i(this.#Y*(1-i)+this.#H*i,this.#R),1>t||(this.wi.hi(this.#u.view),this.#u.P(),this.stop())}return t}},Gt=class{arr;constructor(t=1,i=0,s=0,e=0,h=0,o=1,n=0,r=0,a=0,c=0,l=1,u=0,d=0,p=0,m=0,f=1){this.arr=new Float32Array([t,i,s,e,h,o,n,r,a,c,l,u,d,p,m,f])}Di(){const t=this.arr;t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}hi(t){this.arr.set(t.arr)}Oi(t){const i=this.arr,s=Math.sin(t),e=Math.cos(t),h=i[4],o=i[5],n=i[6],r=i[7],a=i[8],c=i[9],l=i[10],u=i[11];i[4]=h*e+a*s,i[5]=o*e+c*s,i[6]=n*e+l*s,i[7]=r*e+u*s,i[8]=a*e-h*s,i[9]=c*e-o*s,i[10]=l*e-n*s,i[11]=u*e-r*s}Fi(t){const i=this.arr,s=Math.sin(t),e=Math.cos(t),h=i[0],o=i[1],n=i[2],r=i[3],a=i[8],c=i[9],l=i[10],u=i[11];i[0]=h*e-a*s,i[1]=o*e-c*s,i[2]=n*e-l*s,i[3]=r*e-u*s,i[8]=h*s+a*e,i[9]=o*s+c*e,i[10]=n*s+l*e,i[11]=r*s+u*e}Vi(t){const i=this.arr,s=Math.sin(t),e=Math.cos(t),h=i[0],o=i[1],n=i[2],r=i[3],a=i[4],c=i[5],l=i[6],u=i[7];i[0]=h*e+a*s,i[1]=o*e+c*s,i[2]=n*e+l*s,i[3]=r*e+u*s,i[4]=a*e-h*s,i[5]=c*e-o*s,i[6]=l*e-n*s,i[7]=u*e-r*s}Ni(t){const i=this.arr;i[0]*=t,i[1]*=t,i[2]*=t,i[3]*=t,i[4]*=t,i[5]*=t,i[6]*=t,i[7]*=t}Bi(t,i,s){const e=this.arr;e[12]+=e[0]*t+e[4]*i+e[8]*s,e[13]+=e[1]*t+e[5]*i+e[9]*s,e[14]+=e[2]*t+e[6]*i+e[10]*s,e[15]+=e[3]*t+e[7]*i+e[11]*s}Ei(t,i,s,e){this.Di();const h=this.arr,o=1/Math.tan(t/2),n=1/(s-e);h[0]=o/i,h[5]=o,h[10]=(e+s)*n,h[11]=-1,h[14]=2*e*s*n,h[15]=0}Gi(t){this.Di();const i=this.arr,s=1/Math.tan(t/2);i[0]=s,i[5]=s}Yi(){const t=this.arr,i=t[0],s=t[1],e=t[2],h=t[3],o=t[4],n=t[5],r=t[6],a=t[7],c=t[8],l=t[9],u=t[10],d=t[11],p=t[12],m=t[13],f=t[14],g=t[15],v=i*n-s*o,w=i*r-e*o,M=i*a-h*o,y=s*r-e*n,_=s*a-h*n,b=e*a-h*r,k=c*m-l*p,x=c*f-u*p,T=c*g-d*p,P=l*f-u*m,S=l*g-d*m,E=u*g-d*f;let C=v*E-w*S+M*P+y*T-_*x+b*k;C&&(C=1/C,t[0]=(n*E-r*S+a*P)*C,t[1]=(e*S-s*E-h*P)*C,t[2]=(m*b-f*_+g*y)*C,t[3]=(u*_-l*b-d*y)*C,t[4]=(r*T-o*E-a*x)*C,t[5]=(i*E-e*T+h*x)*C,t[6]=(f*M-p*b-g*w)*C,t[7]=(c*b-u*M+d*w)*C,t[8]=(o*S-n*T+a*k)*C,t[9]=(s*T-i*S-h*k)*C,t[10]=(p*_-m*M+g*v)*C,t[11]=(l*M-c*_-d*v)*C,t[12]=(n*x-o*P-r*k)*C,t[13]=(i*P-s*x+e*k)*C,t[14]=(m*w-p*y-f*v)*C,t[15]=(c*y-l*w+u*v)*C)}Hi(t){const i=this.arr,s=t.arr;let e=i[0],h=i[1],o=i[2],n=i[3];i[0]=e*s[0]+h*s[4]+o*s[8]+n*s[12],i[1]=e*s[1]+h*s[5]+o*s[9]+n*s[13],i[2]=e*s[2]+h*s[6]+o*s[10]+n*s[14],i[3]=e*s[3]+h*s[7]+o*s[11]+n*s[15],e=i[4],h=i[5],o=i[6],n=i[7],i[4]=e*s[0]+h*s[4]+o*s[8]+n*s[12],i[5]=e*s[1]+h*s[5]+o*s[9]+n*s[13],i[6]=e*s[2]+h*s[6]+o*s[10]+n*s[14],i[7]=e*s[3]+h*s[7]+o*s[11]+n*s[15],e=i[8],h=i[9],o=i[10],n=i[11],i[8]=e*s[0]+h*s[4]+o*s[8]+n*s[12],i[9]=e*s[1]+h*s[5]+o*s[9]+n*s[13],i[10]=e*s[2]+h*s[6]+o*s[10]+n*s[14],i[11]=e*s[3]+h*s[7]+o*s[11]+n*s[15],e=i[12],h=i[13],o=i[14],n=i[15],i[12]=e*s[0]+h*s[4]+o*s[8]+n*s[12],i[13]=e*s[1]+h*s[5]+o*s[9]+n*s[13],i[14]=e*s[2]+h*s[6]+o*s[10]+n*s[14],i[15]=e*s[3]+h*s[7]+o*s[11]+n*s[15]}Ci(t,i,s=1){const e=this.arr;e[0]*=t,e[1]*=t,e[2]*=t,e[3]*=t,e[4]*=i,e[5]*=i,e[6]*=i,e[7]*=i,e[8]*=s,e[9]*=s,e[10]*=s,e[11]*=s}},Yt=class{x;y;z;w;constructor(t=0,i=0,s=0,e=1){this.x=t,this.y=i,this.z=s,this.w=e}hi(t){this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w}Ri(t){const i=t.arr,s=this.x,e=this.y,h=this.z,o=i[3]*s+i[7]*e+i[11]*h+i[15]||1;this.x=(i[0]*s+i[4]*e+i[8]*h+i[12])/o,this.y=(i[1]*s+i[5]*e+i[9]*h+i[13])/o,this.z=(i[2]*s+i[6]*e+i[10]*h+i[14])/o,this.w=o}Xi(){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}},Ht=class{canvas;#ht=-1;#ot=-1;#nt=-1;constructor(t){this.canvas=t}ji(t,i,s,e){const h=this.canvas,o=h.main.el,n=(Math.min(t,s)-o.left)/o.scale,r=(Math.min(i,e)-o.top)/o.scale,a=(Math.max(t,s)-o.left)/o.scale,c=(Math.max(i,e)-o.top)/o.scale,l=n+(a-n)/2,u=r+(c-r)/2,d=Math.max(a-n,c-r),p=this.#ht-d;if(h.Wi.stop(),this.#ot>0){const t=this.#ot-l,i=this.#nt-u;this.Ui(p,t,i,l,u,o,h)}else h.wt.stop();this.#ot=l,this.#nt=u,this.#ht=d}Zi(){}qi(){this.#rt()}#rt(){this.#ht=-1,this.#ot=-1,this.#nt=-1}Mt(t,i,s,e,h,o,n,r,a,c,l,u){const d=this.canvas,p=d.wt;d.Wi.stop();const m=this.Ji(t);return p.oi=0,h=p.bi(m,i,s,e,h,u,{speed:o,perc:n,isJump:r,limitViewport:a,omniIdx:l,correct:c}),p.oi=0,p.Mi=1,h}Ji(t){return t}setCoo(t,i,s,e=0,h=0,o=0,n=ot){if(this.Ki(t,i,s))return 0;const r=this.canvas;0===s&&(s=r.Qi()),s=this.ts(s),r.Wi.stop();const{w:a,h:c}=this.ss(s);return this.es(t,i,a,c,e),e=r.wt.bi(t,i,a,c,e,n,{speed:h}),r.wt.oi=0===e||o,r.wt.Mi=e>0,e}Ki(t,i,s){return 0}ts(t){return t}es(t,i,s,e,h){}},Rt=class extends Ht{Ci=1;Y=1;R=1;hs=1;#at=1;G=1;#ct=new Ft;#lt=new Ft;#ut=new Ft;#dt=0;#pt=0;#mt=0;#ft=new Gt;cpw=-1;cph=-1;#gt=1;constructor(t){super(t)}$(t,i,s,e){const h=this.canvas;(h.$t||h.rs)&&(e=1);const o=h.el,n=h.cs?h.parent.el.ratio:o.ratio,r=h.view,a=this.#lt;s&&(t-=o.left,i-=o.top);const c=t/this.Ci*n/h.width+r.x0,l=i/this.Ci*n/h.height+r.y0;return a.x=e?c:Math.max(r.lX0,Math.min(r.lX1,c)),a.y=e?l:Math.max(r.lY0,Math.min(r.lY1,l)),a.scale=this.Ci,a.ai(),this.#lt}V(t,i,s){const e=this.canvas,h=e.el,o=e.cs?e.parent.el.ratio:h.ratio,n=this.#ct;return n.x=(t-e.view.x0)*e.width*this.Ci/o+(s?h.left:0),n.y=(i-e.view.y0)*e.height*this.Ci/o+(s?h.top:0),n.scale=this.Ci/o,n.ai(),n}B(t,i,s,e,h){return this.ft(t-.5,i-.5,s,e,h)}ft(t,i,s,e=0,h=0){const o=this.canvas,n=o.el,r=this.#ft,a=o.D.ls,c=o.cs?o.parent.el.ratio:n.ratio;a.x=t,a.y=i,a.z=s,a.w=1,r.Di(),!h&&o.us&&r.Ei(o.us,o.aspect,1e-4,100),o.ds&&r.Bi(0,0,o.ds),o.ps&&r.Bi(o.ps,0,0),!h&&o.fs&&r.Oi(o.fs);const l=o.images.length/o.Pi,u=o.layer*l,d=o.images.length>0?-(o.Si+1-u)/l*2*Math.PI:0;r.Fi(e+d),a.Ri(r);const p=this.#ct;return p.x=(.5+a.x-o.view.x0)*o.width*this.Ci/c+(h?n.left:0),p.y=(.5+a.y-o.view.y0)*o.height*this.Ci/c+(h?n.top:0),p.w=-a.w-o.ds,p.ai(),p}gs(){const t=this.canvas,i=t.el,s=i.width/t.width,e=i.height/t.height;if(!t.view.ei&&this.cpw===s&&this.cph===e)return void(t.J!==this.#gt&&this.K());this.cpw=s,this.cph=e,this.#at=Math.min(s,e),this.G=Math.max(s,e);const h=t.view.ti/t.view.ii;if(t.view.ei=0,1>t.view.ti||1>t.view.ii){const i=s/e;this.G/=i>h?t.view.ti/i:t.view.ii*i}if(this.K(),i.width&&i.height&&!this.canvas.wt._i()&&(t.view.hi(t.wt.wi,1),!t.is360)){const i=t.wt.oi;t.wt.oi=0,this.vs(),t.wt.oi=i}}K(t=0){const i=this.canvas;if(this.Y=i.J?this.G:this.#at,!t&&!i.main.ws&&(0===i.Si&&!i.J||i.Si>0&&!i.J)){const t=i.focus.width*i.width,s=i.focus.height*i.height,e=i.el.width,h=i.el.height;this.Y=e/h>t/s?h/s:e/t}this.hs=this.Y>1&&i.maxScale<this.Y?this.Y:Math.max(this.Y,i.maxScale*i.Ms/i.el.scale),this.#gt=i.J}fi(){return 1>this.R&&this.Ci<this.Y}j(t=0){return Q(this.Ci,this.Y*(t?this.R:1))||this.Ci<=this.Y*(t?this.R:1)}X(){return Q(this.Ci,this.hs)||this.Ci>=this.hs}vs(){if(-1===this.cpw)return 0;const t=this.canvas,i=this.canvas.view,s=!t.rs&&t.wt.oi;!t.wt.yi&&(s||!t.wt.Mi&&t.J)&&i.oi(0);const e=i.width,h=i.height,o=this.cpw,n=this.cph;this.Ci=Math.min(o/e,n/h),s&&!this.#dt&&this.Ci>=this.hs&&t.wt.Mi&&(this.Ci=this.hs),(!t.wt.yi&&!this.#dt||t.J)&&(this.Ci=Math.max(this.Y*this.R,this.Ci)),!this.#pt&&t.ys&&(this.Ci=this.G);const r=o/this.Ci-e,a=n/this.Ci-h;return i.set(i.qt,i.Jt,i.width+r,i.height+a),!this.#pt&&t.ys&&this.canvas.wt.wi.hi(i),!t.wt.yi&&t.J&&i.oi(0),this.#pt=this.cpw>0,this.#mt?(this.#mt=0,this.setCoo(this.#ut.x,this.#ut.y,this.#ut.scale),0):1}_s(){const t=this.canvas.view;return!this.canvas.rs&&((!Q(t.x0,t.lX0)&&t.x0<t.lX0)!=(!Q(t.x1,t.lX1)&&t.x1>t.lX1)||(!Q(t.y0,t.lY0)&&t.y0<t.lY0)!=(!Q(t.y1,t.lY1)&&t.y1>t.lY1)||!Q(this.Ci,this.hs)&&this.Ci>this.hs)}_t(t,i,s=0,e=0,h=0,o=0){const n=this.canvas;if((this.fi()||this.#dt)&&!h)return;this.canvas.rs&&(e=1);const r=n.cs?n.parent.el.ratio:n.el.ratio,a=n.view,c=t/n.width/this.Ci*r,l=i/n.height/this.Ci*r,u=a.qt+c,d=a.Jt+l,p=a.width,m=a.height;this.#dt?(n.view.set(u,d,p,m),n.A(u,d,p,m,e,0,0,0)):h||!this._s()||o?(n.wt.stop(),0===s?(o||n.Wi.addStep(4*t,4*i),n.view.set(u,d,p,m),e||n.view.oi(0,0,n.rs),n.A(u,d,p,m,e,0,0,o),n.view.si=1):n.wt.bi(u,d,p,m,s,ot)):n.wt._i()?n.wt.ki(u,d,a.width,a.height,1):n.wt.bi(u,d,p,m,150,ot,{limitViewport:!e&&!this.#dt,correct:!e})}yt(t,i,s,e=0,h){const o=this.canvas;if(o.Wi.stop(),!this.#dt&&this.X()&&0>t)return 0;if(this.canvas.rs&&(h=1),t>0&&this.j()&&this.R>=1&&(!this.#dt||o.J))return 0;const n=o.el,r=o.view,a=this.cpw/this.cph;let c=t*(n.width/512)/o.width/this.Ci,l=c/a;0>t&&-1>c&&(c=-.9999),0>t&&-1>l&&(l=-.9999);const u=!h&&!o.rs&&o.wt.oi&&0===e,d=o.cs?o.parent.el.ratio:n.ratio;i-=n.left,s-=n.top;const p=this.fi(),m=i>0&&!p?i/n.width*d:.5,f=s>0&&!p?s/n.height*d:.5,g=r.qt+c*(.5-m),v=r.Jt+l*(.5-f),w=r.width+c,M=r.height+l;return o.wt.oi=u,e=o.wt.bi(g,v,w,M,e,ot,{limitViewport:!h&&!this.#dt,correct:u}),o.wt.wi.hi(o.view),o.wt.oi=!h,e}Ui(t,i,s,e,h,o,n){!this.canvas.main.bs&&this.Ci>this.Y&&this._t(i,s,0,0,1),this.yt(2*t*o.scale,e,h,0,!this.canvas.ks),n.wt.oi=!!this.canvas.ks}Zi(){this.#dt=1}qi(){this.#vt(),this.#dt=0,super.qi()}#vt(){if(this.canvas.rs)return;const t=this.canvas.view,i=this.Ci>this.hs,s=i?this.cpw/this.hs:t.width,e=i?this.cph/this.hs:t.height,h=s/2,o=e/2,n=t.ti/2,r=t.ii/2,a=n>h?Math.max(t.lX0+h,Math.min(t.qt,t.lX1-h)):t.Kt,c=r>o?Math.max(t.lY0+o,Math.min(t.Jt,t.lY1-o)):t.Qt;this.canvas.wt.bi(a,c,s,e,150,ot,{correct:1})}Ki(t,i,s){if(!this.#pt){this.#mt=1;const e=this.#ut;return e.x=t,e.y=i,e.scale=s,this.vs(),1}return 0}ts(t){return Math.max(this.Y,t)}ss(t){return{w:1/t*this.cpw,h:1/t*this.cph}}es(t,i,s,e,h){0===h&&(t+s/2>1&&(t=1-s/2),0>t-s/2&&(t=s/2),i+e/2>1&&(i=1-e/2),0>i-e/2&&(i=e/2))}W=0;U=0;xs(){const t=this.canvas,i=t.view,s=t.D,e=s.Ts;e.Ei(s.Ei,t.el.pi,1e-4,100),e.Bi(-(i.qt-.5)*t.aspect,i.Jt-.5,-i.height/2)}},Xt=class{Ps;Ss;#d;Es;Cs;zs;#wt;Is;Ls;constructor(t,i,s,e,h,o,n){this.#d=t,this.Es=i,this.Cs=s,this.zs=e,this.#wt=h,this.Is=o,this.Ls=n,this.Ps=h/t.width,this.Ss=h/t.height}As(t,i){const s=t-this.Cs,e=s%this.Is,h=Math.floor(s/this.Is),o=this.#d;return i.x0=o.x0+e*this.#wt/o.width*o.$s,i.y0=o.y0+h*this.#wt/o.height*o.Ds,i.x1=o.x0+Math.min((e+1)*this.#wt/o.width,1)*o.$s,i.y1=o.y0+Math.min((h+1)*this.#wt/o.height,1)*o.Ds,i.image=o,i.layer=this.Es,i.x=e,i.y=h,i}},jt=class t{static#Mt=[];static#yt=new Uint8Array(0);static#_t=0;#bt=new Yt;#kt=new Gt;#xt=0;Os=[];#Tt=0;Fs=0;x0=0;y0=0;x1=1;y1=1;$s=1;Ds=1;#Pt=.5;#St=.5;#Et=1;#Ct=1;#zt=0;#It=0;#Lt=-1;#At=0;#$t=0;Vs=0;Ns;#Dt=0;#Ot=0;Bs=0;#Ft=0;Gs=0;static#Vt=new Float64Array(200);static#Nt=new Float64Array(200);static#Bt=new Float64Array(200);static#Gt=0;static#Yt=0;#u;Es;nt;width;height;#wt;#Ht;It;#Rt;opacity;Ys;ct;lt;ut;#Xt;#jt;constructor(t,i,s,e,h,o,n,r,a,c,l,u,d,p,m,f,g){this.#u=t,this.Es=i,this.nt=s,this.width=e,this.height=h,this.#wt=o,this.#Ht=n,this.It=a,this.#Rt=c,this.opacity=l,this.Ys=u,this.ct=d,this.lt=p,this.ut=m,this.#Xt=f,this.#jt=g;const v=e>h?e:h;this.#Ft=this.#u.is360&&this.nt>0,this.#Tt=r&&!n?2:1;for(let M=o;M<v*t.main.Hs;M*=2)this.#Tt++;(t.main.Rs||this.#jt>0)&&(this.#Tt-=3-t.main.Xs),this.#jt>0&&this.#Tt--,this.#Tt=Math.max(1,this.#Tt);let w=c;for(let M=0;M<this.#Tt;M++){const t=q(M)*this.#wt,i=Math.ceil(e/t),s=Math.ceil(h/t);this.Os.push(new Xt(this,this.Os.length,w,this.Ns=w+=i*s,t,i,s))}}rt(t,i,s,e){this.x0=t,this.y0=i,this.x1=s,this.y1=e,this.#Et=s+(t>s?1:0)-t,this.#Ct=e-i,this.#Pt=t+this.#Et/2,this.#St=i+this.#Ct/2,this.#u.is360&&(this.#Pt=U(this.#Pt)),this.$s=this.#Et,this.Ds=this.#Ct,this.#Dt=this.width/this.height,this.#xt=this.#Dt>this.#u.aspect?this.#u.width/this.width*this.$s:this.#u.height/this.height*this.Ds,this.#u.is360&&this.#Wt()}#Wt(){let t=2*(this.#Pt-.5)*Math.PI;const i=(this.#St-.5)*Math.PI;t+=this.#u.D.Ws,this.#zt=Math.cos(i)*Math.sin(t),this.#It=Math.sin(i),this.#Lt=Math.cos(i)*Math.cos(t),this.#At=2*this.#Et*Math.PI,this.#$t=this.#Ct*Math.PI}#Ut(){if(!this.#u.is360)return 0;const t=this.#u.D,i=this.#zt*t.Us+this.#It*t.Zs+this.#Lt*t.qs;return Math.acos(Math.max(-1,Math.min(1,i)))<t.Js+Math.max(this.#At,this.#$t)/2}#Zt(){if(this.#Ft)return!this.#Ut();{const t=this.#u.view;return!(this.x1>t.x0&&this.x0<t.x1&&this.y1>t.y0&&this.y0<t.y1)}}Ks(){return this.#jt>0&&this.#jt>this.#u.camera.Ci||(this.It||this.nt>0)&&0===this.opacity&&0===this.Ys?0:this.Es===this.#u.Si||this.#u.is360&&0===this.nt?1:!this.#Zt()}Qs(t){const i=this.Ys;if(this.opacity===i)return 0;const s=1/(this.#u.main.te*this.#u.main.ie);return this.opacity=Math.min(1,Math.max(0,t?i:i>this.opacity?Math.min(i,this.opacity+s):Math.max(i,this.opacity-s))),this.opacity!==i}se(i){if(0>=this.opacity)return 0;this.#Ot=0;const s=t.#Mt;let e=t.#yt;if(this.#Ft){if(i=this.#qt(i),!(this.Bs=i>0))return 0}else i=Math.max(i,this.#u.camera.Y)*this.#xt;const h=this.Ns-this.#Rt;e.length<h?e=t.#yt=new Uint8Array(h):e.fill(0,0,h),t.#_t=this.#Rt;const o=this.Ns-1,n=o-this.#Rt;0===this.Vs?(s.push(o),e[n]=1,this.#u.main.ee(o,1,1)):this.#Ft&&(s.push(o),e[n]=1,this.#Ot++);const r=this.#Jt(i),a=this.#u;if(0===this.nt&&a.is360)this.#Kt(this.Os[r]);else if(this.#Ft)this.#Qt(r),this.#Ot++;else if(a.visible.x0<a.visible.x1&&a.visible.y0<a.visible.y1){const t=a.view;this.#ti(r,Math.max(a.visible.x0,t.x0),Math.max(a.visible.y0,t.y0),Math.min(a.visible.x1,t.x1),Math.min(a.visible.y1,t.y1))}s.sort((t,i)=>i-t);for(const t of s)a.he.push(t);return s.length=0,this.#Ot}#Jt(t){let i=this.#Ht||this.#u.oe?this.#Tt:1+this.#u.main.ne;if(!this.#Ht&&!this.#u.oe)for(;i<this.#Tt&&1>q(i)*t;i++);return this.Fs=i-1}#ti(t,i,s,e,h){if(this.#Zt())return;const o=this.Os[t],n=o.Ps,r=o.Ss,a=this.$s,c=this.Ds,l=Math.min(o.Is-1,Math.floor(Math.max(0,e-this.x0)/a/n)),u=Math.min(o.Ls-1,Math.floor(Math.max(0,h-this.y0)/c/r)),d=Math.floor(Math.max(0,i-this.x0)/a/n);let p=Math.floor(Math.max(0,s-this.y0)/c/r);for(;u>=p;p++)for(let t=d;l>=t;t++)this.#ii(o,t,p)}#Qt(t){if(this.#Zt())return;const i=this.Os[t],s=this.#u,e=s.view.Jt,h=s.view.width+.1,o=s.view.height+.1,n=this.#Pt,r=this.#St,a=this.#Et,c=this.#Ct,l=Math.max(e-o/2,r-c/2),u=Math.min(e+o/2,r+c/2);if(l>=u)return;const d=s.is360?U(s.view.qt+s.D.re):s.view.qt;let p,m;if(s.is360){const t=U(d-h/2),i=U(d+h/2),s=U(n-a/2),e=U(n+a/2);if(i>t&&e>s){if(p=Math.max(t,s),m=Math.min(i,e),p>=m)return}else if(t>i&&e>s){if(s>i&&t>e)return;p=s,m=e}else if(i>t&&s>e){if(t>e&&s>i)return;p=t,m=i}else p=Math.max(t,s),m=Math.min(i,e);const o=n-a/2;n+a/2>1?(o>p&&(p+=1),o>m&&(m+=1)):p>n+.5?p-=1:m>n+.5&&(m-=1)}else if(p=Math.max(d-h/2,n-a/2),m=Math.min(d+h/2,n+a/2),p>=m)return;const f=n-a/2,g=r-c/2,v=i.Ps,w=i.Ss,M=Math.floor(Math.max(0,Math.min(1,(p-f)/a))/v),y=Math.min(i.Is-1,Math.floor(Math.max(0,Math.min(1,(m-f)/a))/v)),_=Math.floor(Math.max(0,Math.min(1,(l-g)/c))/w),b=Math.min(i.Ls-1,Math.floor(Math.max(0,Math.min(1,(u-g)/c))/w));for(let k=_;b>=k;k++)for(let t=M;y>=t;t++)this.#ii(i,t,k)}#ii(i,s,e){const h=t.#yt,o=t.#_t,n=Math.min(this.Ns-1,i.Cs+e*i.Is+s),r=n-o;if(r<h.length){if(h[r])return;h[r]=1}t.#Mt.push(n),1>this.#u.main.ee(n,n===this.Ns-1,this.#u.Ot)?this.#Ht||this.#u.oe||i.Es>=this.#Tt-1||this.#ii(this.Os[i.Es+1],s>>1,e>>1):this.#Ot++}ae(t){const i=this.#u.main.ce,s=2*Math.PI*this.#u.D.le,e=this.#bt,h=this.#kt,o=this.x0+this.$s/2,n=this.y0+this.Ds/2,r=this.#u.D.ue(o-this.#u.D.re,n,1,5);h.Di(),h.Bi(r.x,r.y,r.z),h.Fi(Math.atan2(r.x,r.z)+Math.PI+this.lt),h.Oi(-Math.sin((n-.5)*Math.PI)-this.ct),h.Vi(-this.ut),h.Ni(.5*this.#Xt);const a=(t.x0-o)*s,c=(t.x1-o)*s,l=.5*-(t.y0-n)*s,u=.5*-(t.y1-n)*s,d=(t,i)=>{e.x=0,e.y=0,e.z=0,h.Bi(t,i,0),e.Ri(h),h.Bi(-t,-i,0)};d(a,l),i[0]=e.x,i[1]=e.y,i[2]=e.z,d(a,u),i[3]=e.x,i[4]=e.y,i[5]=e.z,d(c,l),i[6]=e.x,i[7]=e.y,i[8]=e.z,d(c,u),i[12]=e.x,i[13]=e.y,i[14]=e.z,i[9]=i[3],i[10]=i[4],i[11]=i[5],i[15]=i[6],i[16]=i[7],i[17]=i[8]}#qt(t){if(this.#Ft)return t*Math.max(2*this.#Et,this.#Ct)*(this.#u.width/this.width);const i=this.#Et,s=this.#Ct,e=this.#Pt,h=this.#St,o=this.#u.el,n=this.#u.D,r=o.width,a=s/2.5;let c=0;const l=n.F(e-i/2,h-a);if(l.ri(o)&&c++,n.F(e+i/2,h-a).ri(o)&&c++,n.F(e-i/2,h+a).ri(o)&&c++,n.F(e+i/2,h+a).ri(o)&&c++,0===c)return 0;const u=l.w>0||0>l.x?0:Math.min(r,l.x),d=l.w>0||l.x>r?r:Math.max(0,l.x);return Math.min(1,(d-u)/this.width)}#Kt(i){const s=this.#u,e=s.el.width,h=s.el.height,o=s.D.Js>Math.PI/2?20:12,n=s.D.re;t.#Gt=0;const r=(i,e)=>{const h=s.D.$(i,e),o=t.#Gt++;t.#Vt[o]=h.x,t.#Nt[o]=h.y};for(let t=0;o>=t;t++){const i=t/o;r(i*e,0),r((1-i)*e,h),r(e,i*h),r(0,(1-i)*h)}for(let t=1;3>=t;t++){const i=h*t/4;for(let t=1;3>=t;t++)r(e*t/4,i);r(e*t/4,h-1)}const a=t.#Gt;let c=1/0,l=-1/0;for(let b=0;a>b;b++){const i=t.#Nt[b];c>i&&(c=i),i>l&&(l=i)}c=Math.max(0,c-.001),l=Math.min(1,l+.05);const u=t.#Vt,d=t.#Bt;for(let t=0;a>t;t++)u[t]=U(u[t]-n);t.#Yt=0;for(let b=0;a>b;b++){const i=u[b];let s=0;for(let e=0;e<t.#Yt;e++)if(1e-8>Math.abs(d[e]-i)){s=1;break}s||(d[t.#Yt++]=i)}const p=t.#Yt;for(let t=1;p>t;t++){const i=d[t];let s=t-1;for(;s>=0&&d[s]>i;)d[s+1]=d[s],s--;d[s+1]=i}let m=0,f=1,g=0;if(2>p)g=1,c=0,l=1;else{let t=0,i=-1;for(let h=0;p-1>h;h++){const s=d[h+1]-d[h];s>t&&(t=s,i=h)}const s=d[0]+1-d[p-1],e=s>t;e&&(t=s,i=p-1),.999999>1-t?e?(m=d[0],f=d[p-1]):(m=d[(i+1)%p],f=d[i]+1):g=1}(.05>c||l>.95)&&(g=1);const v=i.Ss,w=i.Ps;let M=Math.max(0,Math.floor((c-.001)/v)),y=Math.min(i.Ls-1,Math.max(0,Math.floor((l+v-1e-10)/v)));1e-5>c&&(M=0),l>.99999&&(y=i.Ls-1);const _=f>1;for(let t=M;y>=t;t++)if(g)for(let s=0;s<i.Is;s++)this.#ii(i,s,t);else{const s=Math.max(0,Math.floor((m-.001)/w)-1);if(_){for(let h=s;h<i.Is;h++)this.#ii(i,h,t);const e=Math.min(i.Is-1,Math.ceil(U(f+.001)/w));for(let s=0;e>=s;s++)this.#ii(i,s,t)}else{const e=Math.min(i.Is-1,Math.ceil((f+.001)/w));for(let h=s;e>=h;h++)this.#ii(i,h,t)}}}},Wt=class extends Ht{Ts=new Gt;#si=new Gt;#ei=new Gt;#hi=1;#oi=new Gt;#ni=new Yt;le=10;Ci=0;#ri=1;#ai=0;re=0;#ci=0;#li=0;Ws=0;W=0;U=0;de=Math.PI/2;Ei=Math.PI/2;zi=Math.PI/2;Ii=Math.PI/2;Us=0;Zs=0;qs=-1;Js=0;ls=new Yt;#lt=new Ft;constructor(t){super(t),this.Ws=-this.canvas.pe,this.re=this.Ws/(2*Math.PI),this.#ri=this.canvas.height/(this.canvas.width/2),this.#ai=(1-this.#ri)/4,this.W=this.Ws,this.me()}tt(t,i){this.#ci=t,this.#li=i,this.zi=Math.PI/2,i>0&&(this.zi=Math.min(this.zi,this.zi*i*1.5)),this.$i(this.Ei,1)}me(t=0){const i=this.canvas.el;t||this.Ts.Ei(this.Ei,i.pi,1e-4,20),this.#hi=1;const s=this.Ts;this.U=Math.min(Math.PI/2,Math.max(-Math.PI/2,this.U)),s.Oi(this.U),s.Fi(this.W),s.Bi(this.#ni.x,this.#ni.y,this.#ni.z);const e=this.#oi;e.Gi(this.Ei),e.Bi(0,0,i.height/i.ratio/2),e.Oi(-this.U),e.Fi(this.W),this.#lt.direction=this.W/Math.PI*180%360}gi(t,i,s=0){const e=this.canvas,h=e.el;this.W+=t*h.ratio/h.width*this.Ei*h.pi,this.U+=i*h.ratio/h.height*this.Ei*this.#ri,this.W=Z(this.W),(e.J||this.#li>0)&&this.#ui(),this.#ci>0&&this.#di(),0===s&&e.Wi.addStep(2*t,2*i),this.me(),this.fe(),this.#pi()}#ui(){const t=this.Ei/2,i=Math.PI*this.#ri/2*(this.#li>0?this.#li:1);this.U=this.U>0?Math.min(i,this.U+t)-t:Math.max(-i,this.U-t)+t}#di(){const t=this.Ei/2*this.canvas.el.pi,i=Math.PI*(this.#ci>0?this.#ci:1);let s=this.W;for(;s>=Math.PI;)s-=2*Math.PI;for(;s<-Math.PI;)s+=2*Math.PI;this.W=Z(Math.min(Math.max(i,t)-t,Math.max(Math.min(-i,-t)+t,s)))}#mi(t,i,s,e=0,h=0,o=0){const n=this.canvas;if(t/=2,0!==i)i=n.wt.zoom(t,i,e,s);else{t/=this.Ci*n.xi/20;const i=h>0&&o>0;let e=0,r=0;if(i){const t=this.$(h,o);e=t.x,r=t.y}if(this.$i(this.Ei+t,s),i){const t=this.$(h,o);let i=e-t.x;i>.5&&(i-=1),-.5>i&&(i+=1);const s=r-t.y;this.W+=i*Math.PI*2,this.U+=s*Math.PI*this.#ri,this.W=Z(this.W),(n.J||this.#li>0)&&this.#ui(),this.#ci>0&&this.#di(),this.me(),this.#fi(),this.fe(),this.#pi()}}return i}$i(t,i){const s=this.canvas;this.Ei=t,i&&!s.is360||(this.Ei=Math.min(this.zi,Math.max(this.Ii,this.Ei))),(s.J||this.#li>0)&&this.#ui(),this.#ci>0&&this.#di(),this.Ts.Ei(this.Ei,s.el.pi,1e-4,20),this.#fi(),this.me(1),this.fe(),this.#pi()}#fi(){const t=this.canvas.el,i=t.width/2,s=t.height/2,e=this.$(i,s).x,h=this.$(i+1,s+1).x;this.Ci=1/(h+(e>h?1:0)-e)/this.canvas.width}Z(t,i,s=0){this.W=Z(t-this.Ws),this.U=i,0!==s?this.$i(s,0):this.me(),this.fe(),this.#pi()}A(t,i,s,e,h){if(null==t||null==i||null==e)return 0;const o=h?.noLimit??0,n=h?.correctNorth?t+this.re:t;return this.W=(n-.5)*Math.PI*2,this.U=(i-.5)*Math.PI*this.#ri,this.$i(Math.min(this.zi,e*Math.PI*this.#ri),o),this.fe(),this.#pi(),1}#pi(){const t=this.canvas,i=U(this.W/(2*Math.PI)+.5),s=this.U/this.#ri/Math.PI+.5,e=this.Ei/Math.PI/this.#ri,h=e*(0===t.el.width?1:.5*Math.sqrt(t.el.pi))/(t.aspect/2);t.view.set(i,s,h,e),t.view.si=1}fe(){const t=this.W,i=this.U;this.Us=Math.cos(i)*Math.sin(t),this.Zs=Math.sin(i),this.qs=Math.cos(i)*Math.cos(t);const s=2*Math.atan(1/this.Ei),e=this.canvas.el.width/this.canvas.el.height,h=s/2,o=Math.atan(Math.tan(h)*e);this.Js=2*o}ge(t,i,s,e=0){const h=this.#ni,o=s*Math.PI*2+e;h.x=-t*Math.sin(o),h.y=i,h.z=t*Math.cos(o),this.canvas.view.si=1,this.me()}ve(){const t=this.canvas,i=t.el;this.Ii=Math.min(.5,i.height/t.height)/t.maxScale*this.#ri*Math.PI/i.ratio*i.scale,this.$i(this.Ei,1)}#gi(){this.#hi&&(this.#ei.hi(this.Ts),this.#ei.Yi(),this.#hi=0)}$(t,i){const s=this.canvas.el,e=this.ls,h=this.#lt;return e.x=t*s.ratio/s.width*2-1,e.y=-(i*s.ratio/s.height*2-1),e.z=1,e.w=1,this.#gi(),e.Ri(this.#ei),e.Xi(),h.x=Math.atan2(e.x,-e.z)/Math.PI/2+.5,h.y=.5-Math.asin(e.y)/Math.PI/this.#ri,h.scale=this.Ci,h.w=this.#ni.x+this.#ni.z,h.direction=this.W+this.Ws,h.ai(),h}F(t,i){const s=this.canvas.el,e=this.ls,h=this.#lt;return this.ue(t+this.re,i),h.x=(e.x+1)/2*s.width/s.ratio,h.y=(1-e.y)/2*s.height/s.ratio,h.scale=this.Ci,h.w=-e.w,h.ai(),h}ue(t,i,s=0,e=this.le){const h=this.ls;t*=2*-Math.PI,i-=.5,i*=-Math.PI,i*=this.#ri;const o=Math.cos(i);return h.x=o*Math.sin(t)*e,h.y=Math.sin(i)*e,h.z=o*Math.cos(t)*e,h.w=1,s||h.Ri(this.Ts),h}ht(t,i,s,e,h,o,n,r=0,a=1,c=1,l=0){isNaN(e)&&(e=this.le);const u=this.#si,d=this.ls,p=this.le,m=this.#ni;u.Di(),e*=this.le*(100/(2*Math.PI)),t*=2*-Math.PI,i-=.5,i*=Math.PI*this.#ri;const f=Math.cos(i);return d.x=f*Math.sin(t),d.y=Math.sin(i),d.z=f*Math.cos(t),u.Bi(m.x*e/p,-m.y*e/p+r*p,m.z*e/p),u.Bi(d.x*e,d.y*e,d.z*e),u.Fi(Math.atan2(d.x,d.z)+Math.PI+o),u.Oi(d.y+h),u.Vi(n),u.Ci(a,c),u.Ni(s/Math.PI/p),u.Hi(this.#oi),u}we(t,i,s,e){i*=this.#ri,i/=2,i-=.25,i+=this.#ai,e*=this.#ri,e/=2;const h=this.canvas.main.Me,o=this.le,n=s/16,r=e/16,a=2*Math.PI;for(let c=0;16>c;c++)for(let s=0;16>s;s++){const e=18*(16*c+s),l=-U(t+n*s+this.re)*a,u=-(i+r*c)*a,d=-U(t+n*(s+1)+this.re)*a,p=-(i+r*(c+1))*a,m=Math.cos(l)*o||0,f=Math.sin(l)*o||0,g=Math.cos(d)*o||0,v=Math.sin(d)*o||0,w=Math.cos(u),M=Math.cos(p),y=Math.sin(u)*o,_=Math.sin(p)*o;h[e+0]=w*f,h[e+1]=y,h[e+2]=w*m,h[e+3]=h[e+9]=M*f,h[e+4]=h[e+10]=_,h[e+5]=h[e+11]=M*m,h[e+6]=h[e+15]=w*v,h[e+7]=h[e+16]=y,h[e+8]=h[e+17]=w*g,h[e+12]=M*v,h[e+13]=_,h[e+14]=M*g}}Y=0;hs=0;G=0;R=1;K(){}_s(){return 0}fi(){return 0}j(t=0){return this.Ei>=this.zi}X(){return this.Ei<=this.Ii}_t(t,i,s=0,e=0,h=0,o=0){this.gi(t,i,s)}yt(t,i,s,e=0,h){return this.#mi(t,e,h,0,i,s)}Ui(t,i,s){this.#mi(2*t,0,0),this.gi(i,s)}Ji(t){const i=this.canvas.view.qt;return i+it(i,t)}ss(t){const i=this.canvas.main.el;return{w:1/t*i.width,h:1/t*i.height}}},Ut=class t{view;focus;wt;Wi;N;D;camera;#vi=new Dt;el=new Vt;images=[];xi=0;#wi=[];#Mi;#yi;#_i;visible;#bi;#ki=1;#xi=0;#Ti=0;#Pi=0;get zIndex(){return this.#Ti}set zIndex(t){this.#Ti!==t&&(this.#Ti=t,this.parent&&(this.parent.#Pi=1))}he=[];aspect;#Si=0;#Ei=0;Ot=0;#Ci=0;#zi=0;Si=-1;us=0;fs=0;ds=0;ps=0;oe=0;layer=0;ye;#wt;is360;$t;#Ii;rs;ys;maxScale;Ms;Ti;pe;#Li;#Ai;isOmni;ks;Pi;main;width;height;_e;J;cs;constructor(t,i,s,e,h,o,n,r,a,c,l,u,d,p,m,f,g,v,w,M,y,_,b=0){this.main=t,this.width=i,this.height=s,this._e=e,this.J=h,this.cs=b,this.#wt=o,this.is360=n,this.$t=r,this.#Ii=a,this.rs=c,this.ys=h?1:l,this.maxScale=u,this.Ms=d,this.Ti=p,this.pe=m,this.#Li=f,this.#Ai=g,this.isOmni=v,this.ks=w,this.Pi=M,this.#Si=t.be.length,b||t.be.push(this),this.aspect=i/s,this.xi=Math.sqrt(i*i+s*s),this.view=new Ot(this),this.focus=new Ot(this),this.wt=new Bt(this),this.Wi=new Nt(this),this.N=new Rt(this),this.D=new Wt(this),this.camera=this.is360?this.D:this.N,this.#Mi=new Ot(this),this.#yi=new Ot(this),this.#_i=new Ot(this),this.visible=new Ot(this),this.#bi=new Ot(this),n&&this.view.set(.5,.5,1,.5),b||(this.el.hi(t.el),this.A(this.view.qt,this.view.Jt,this.view.width,this.view.height,0,0),this.ve()),r?(this.main.ke++,this.#Ci=1,this.Ot=1,this.#zi=1,_>0&&this.Xt(_)):this.xe(0,0,1,1,i,s,o,y,a,0,e)}parent;#$i(t){this.parent=t,this.#Si+=t.#wi.length}xe(t,i,s,e,h,o,n,r,a,c,l,u=0,d=0,p=0,m=1,f=0){const g=new jt(this,this.main.ke++,this.images.length,h,o,n,r,a,c,this.main.Te,l,l,u,d,p,m,f);return g.rt(t,i,s,e),this.images.push(g),this.main.Te=g.Ns,1===this.images.length&&this.Ai(0),g}Pe(i,s,e,h,o,n,r={}){const a=r.coverLimit??1,c=r.coverStart??1,l=new t(this.main,o,n,1,a,this.#wt,0,0,this.main.Rs||this.#Ii,0,c,1,1,this.Ti,0,0,0,0,this.ks,1,0,0,1);return l.#$i(this),l.rt(i,s,e,h,1,1),this.#wi.push(l),l}#Di(){const t=1/(0!==this.main.Se||0!==this.main.Ee?this.main.Ce:1!==this.main.be.length||this.cs?this.main.ze:.25)/this.main.te,i=this._e>0&&this._e>=this.Ot;if(this.Ot=i?Math.min(1,this.Ot+t):Math.max(0,this.Ot-t),this.#Ci=ot.get(this.Ot),0!==this.main.Se||0!==this.main.Ee){const t=0===this.Ot?0:ot.get(1-this.Ot)*(i?1:-1);this.D.ge(this.main.Se*t*8,this.main.Ee*t*8,this.main.Ie)}}#Oi(t){this.ye?.visible?.set(t),this.#Ei=t}Le(){this._e=0,this.zIndex=0}Ae(){if(this.#zi=1,!this.cs&&1===this.#yi.width&&1===this.#yi.height)for(let t=0;t<this.main.be.length;t++)this.main.be[t]!==this&&this.main.be[t].Le();this._e=1}$e(){return!this.#xi&&1>this.#ki}#Fi(){return 0===this._e&&0===this.Ot||0===this.#yi.width||0===this.#yi.height}De(){if(!this.$e()&&this.#Fi())return void(this.#Ei&&this.#Oi(0));let t=1>this.wt.Li()||1>this.Wi.step()||!this.#zi;if(this.he.length=0,this.#Vi(0)&&(t=1),!(this.is360||this.$e()||this.visible.width>0&&this.visible.height>0))return void(this.#Ei&&this.#Oi(0));this.#Ei||1>this.Ot||this.#Oi(1),this.D.fe(),this.#zi&&this.Ot!==this._e&&(this.#Di(),t=1);const i=(this.is360?this.D.Ci:this.N.Ci)*this.el.scale,s=this.main;for(let e=0;e<this.images.length;e++){const h=this.images[e];h.Ks()?(e>0&&!h.Bs&&s.Oe(h,h.Bs=1),h.It&&h.Gs&&(t=1),h.Qs(this.#Li||1>this.Ot)&&(t=1),h.opacity>0&&(s.Fe+=h.se(i))):h.Bs&&s.Oe(h,h.Bs=0)}s.Ve+=this.he.length,s.Ne=0===s.Ve?1:s.Fe/s.Ve;for(let e=0;e<this.#wi.length;e++)this.#wi[e].De();t&&(s.Be=1)}Ge(){if(0===this._e&&0===this.Ot)return;const t=this.main,i=t.micrio.Rt,s=this.el,e=this.view,h=this.wt._i();if(i.gl.viewport(this.el.left,t.el.height-s.height-s.top,s.width,s.height),i.gl.uniformMatrix4fv(i.Ye,0,this.D.Ts.arr),this.#Ai)for(let n=0;n<this.images.length;n++){const t=this.images[n];t.x1>e.x0&&t.x0<e.x1&&t.y1>e.y0&&t.y0<e.y1&&(this.#Ni(t.Ns-1),i.He(void 0,t.Ys))}const o=this.#vi;for(let n=0;n<this.he.length;n++){const i=this.he[n];this.#Ni(i);const s=o.layer===o.image.Fs-1||!t.Re&&o.layer===o.image.Fs,e=i===o.image.Ns-1,r=t.Xe(i);(s||1===r||e)&&t.He(o.image.Es,i,o.layer,o.x,o.y,r*this.#Ci*o.image.opacity,h,o.layer===o.image.Fs-1)&&e&&(o.image.Vs=t.now,this.#zi||this.Ae())}this.#Pi&&(this.#wi.sort((t,i)=>t.zIndex>i.zIndex?1:t.zIndex<i.zIndex?-1:0),this.#Pi=0);for(let n=0;n<this.#wi.length;n++)this.#wi[n].Ge();e.si&&this.ye?.camera?.gt(),e.si=0}#Vi(t){const i=this.main.el,s=this.cs,e=s?this.parent.Qi():1/i.ratio,h=s?this.parent.width:i.width,o=s?this.parent.height:i.height,n=s?this.parent.view:this.#bi,r=this.view,a=this.#yi,c=this.#Mi,l=this.#_i,u=this.$e();if(u){const t=1/this.main.je/this.main.te;this.#ki=Math.min(1,this.#ki+t);const i=this.main.We.get(this.#ki),s=c.qt+(l.qt-c.qt)*i,e=c.Jt+(l.Jt-c.Jt)*i,h=c.width+(l.width-c.width)*i,o=c.height+(l.height-c.height)*i;a.set(s,e,h,o),1===this.#ki&&(1===this.zIndex&&(this.zIndex=0),c.hi(l)),this.view.si=1}let d=Math.max(r.x0,r.x0+(n.x0-a.x0)/a.width*r.width),p=Math.min(r.x1,r.x0+(1-(a.x1-Math.min(a.x1,n.x1))/a.width)*r.width);this.is360||(d=Math.max(0,d),p=Math.min(1,p));let m=Math.max(Math.max(0,r.y0),r.y0+(n.y0-a.y0)/a.height*r.height),f=Math.min(Math.min(1,r.y1),r.y0+(1-(a.y1-Math.min(a.y1,n.y1))/a.height)*r.height);m=Math.max(m,0),f=Math.min(f,1);const g=(d+p)/2,v=(m+f)/2,w=p-d,M=f-m;this.visible.set(g,v,w,M);const y=s?1:i.ratio;return this._e>=this.Ot&&this.el.set(a.width*e*h,a.height*e*o,(a.x0-n.x0)*h*e,(a.y0-n.y0)*o*e,y,s?1:i.scale,s?0:i.di)&&(t||this.Ue(),this.view.si=1,this.ve(),this.is360||(this.N.gs(),this.N.xs())),u}rt(t,i,s,e,h,o){this.#xi=0,h?(this.#Mi.rt(t,i,s,e),this.#yi.rt(t,i,s,e)):(this.#Mi.hi(this.#yi),this.#ki=0,0===this.zIndex&&(this.zIndex=1),this.wt.oi=0),this.#_i.rt(t,i,s,e),this.#Vi(o),this.Ue()}#Ni(t){const i=this.#vi;if(this.#Bi(t),this.is360)0===i.image.nt?this.D.we(i.x0,i.y0,i.x1-i.x0,i.y1-i.y0):i.image.ae(i);else{const t=this.main.ce,s=this.aspect;t[0]=t[3]=t[9]=(i.x0-.5)*s,t[1]=t[7]=t[16]=.5-i.y0,t[4]=t[10]=t[13]=.5-i.y1,t[6]=t[12]=t[15]=(i.x1-.5)*s,t[2]=t[5]=t[8]=t[11]=t[14]=t[17]=0}}Ue(){const t=this.main.el;this.ye?.Ft?.set([this.el.left/t.ratio,this.el.top/t.ratio,this.el.width/t.ratio,this.el.height/t.ratio])}#Bi(t){let i=0;for(;t>=this.images[i].Ns;)i++;const s=this.images[i];let e=0;for(;t>=s.Os[e].zs;)e++;s.Os[e].As(t,this.#vi)}ve(){if(this.#wi.length){const t=this.main.el;this.width=t.width,this.height=t.height,this.xi=Math.sqrt(t.width*t.width+t.height*t.height)}this.cs||(this.is360?this.D.ve():(this.N.gs(),this.N.xs()))}Ze(){if(this.Wi.stop(),this.wt.stop(),this.images.length>0){const t=this.images[0];t.Vs=0,t.opacity=0}}qe(){this.#Oi(0),this.main.qe(this)}Xt(t){this.layer=t,this.Ai(this.Si),this.view.si=1}Ai(t,i=0){const s=this.layer*(this.images.length/this.Pi);for(let e=0;e<this.images.length;e++){const h=this.images[e],o=e-s-t;0!==o?h.Ys=0>o||o>i?0:1:(h.Ys=1,this.Si=t,this.view.si=1)}this.N.K()}A(t,i,s,e,h,o,n=0,r=0){const a=this.main.el;a.li>0&&(e+=e/(1-a.li/a.height),this.wt.oi=0,a.li=0),a.ci>0&&(s+=s*(a.ci/a.width),this.wt.oi=0,a.ci=0),h&&(this.wt.oi=0),this.view.set(t,i,s,e),r&&!h&&this.view.oi(0,0,this.rs),o||this.wt.wi.hi(this.view),this.width>0&&(this.is360?(this.D.A(t,i,s,e,{noLimit:h,correctNorth:n}),this.view.set(t,i,s,e)):this.N.vs()&&this.N.xs())}Qi(){return this.is360?this.D.Ci:this.N.Ci}X(){const t=this.D;return this.is360?t.Ei<=t.Ii:this.N.X()}j(t=0){const i=this.D;return this.is360?i.Ei>=i.zi:this.N.j(t)}K(t){this.N.K(t)}H(t){const i=this.N;i.Y=t,i.K(),i.vs(),this.D.me()}Z(t,i,s=0){isNaN(i)&&(i=this.D.U),this.D.Z(t,i,s?this.D.de:0)}ht(t,i,s,e,h,o,n,r,a=1,c=1,l=0){const u=2e4/this.width;return this.D.ht(t,i,s*u,e,h,o,n,r,a,c,l).arr}st(){this.#xi=1,this.wt.pause()}et(){this.#xi=0,this.wt.resume()}it(){this.wt.stop();for(let t=0;t<this.#wi.length;t++)this.#wi[t].it()}P(){const t=this.ye?.camera;if(t){for(t.P&&t.P();t.C.length;)t.C.shift()?.();t.S=t.P=void 0}}S(){const t=this.ye?.camera;t&&(t.S&&t.S(),t.C.length=0,t.S=t.P=void 0)}},Zt=class t{ready=0;el=new Vt;ce=new Float32Array(18);Me=new Float32Array(4608);be=[];Te=0;ke=0;now=0;Be=0;Ne=0;Ve=0;Fe=0;ze=.25;je=.5;We=ot;Ce=.5;ie=.5;mi=1;Rs=0;Xs=0;Hs=4;ne=0;Re=0;ws=0;bs=0;Ie=0;Se=0;Ee=0;te=1/60;#Gi=[];#Yi=0;#Hi=[];#Ri=new Set;#Xi=new Set;#ji=new Set;#Wi=new Map;#Ui=new Map;#Zi;#qi=[];#Ji=new Map;#Ki=new Map;Je=0;static Ke=t.#Qi(1,1);static Qe;#ts=0;#is=-1;#ss=0;#es=null;#hs=new Map;Bt(t){return this.#hs.get(t)?.canvas}#os(t){this.#hs.set(t.micrioImage,t)}micrio;constructor(t){this.micrio=t,this.#Zi=kt.iOS?5:H(this.micrio.canvas.isMobile)?30:90,this.render=this.render.bind(this),this.#qi.push(t.current.subscribe(this.#ns.bind(this)))}static#Qi(t,i){const s=new Float32Array(12*t*i),e=1/t,h=1/i;for(let o=0,n=0;i>n;n++)for(let i=0;t>i;i++,o+=12)s[o+3]=s[o+7]=s[o+9]=(s[o+1]=s[o+5]=s[o+11]=n*h)+h,s[o+4]=s[o+8]=s[o+10]=(s[o+0]=s[o+2]=s[o+6]=i*e)+e;return s}th(){this.ready||(t.Qe=t.#Qi(16,16),this.ready=1,this.#qi.push(this.micrio.barebone.subscribe(t=>{this.Re=t,this.#Yi=t})))}He=(t,i,s,e,h,o,n,r)=>{this.#Ri.add(i);const a=this.#rs(i);a.ih=void 0;const c=At(),l=this.#Gi[t],u="camera"in l,d=u&&l.It,p=u&&l.I,m=u?l:l.image,f="sh"in l?l.sh:void 0,g=u&&l.$settings.noSmoothing;if(0===a.eh&&Tt>c){if(this.#Yi?c>2&&n:r&&n&&c>0)return 0;if(d&&!p)a.eh=2,a.hh=this.micrio.Rt.oh();else{a.eh=1;const t=m.Yt(s,e,h,f);if(!t)return a.eh=0,0;this.oh(i,t,n,{noSmoothing:g})}}else if(a.eh>=2){if(this.#ss||this.#as(),a.hh){if(d){if(!m.Et||!m.Et.dataset.playing)return 0;this.micrio.Rt.nh(a.hh,m.Et)}this.micrio.Rt.He(a.hh,o,p)}return 2===a.eh&&(a.eh=3,a.rh=this.now),1}return 0};Xe=t=>this.#Wi.get(t)?.Ot||0;ee=(t,i=0,s=1)=>{const e=this.#Wi.get(t);return e?(1>e.Ot&&(e.Ot=i?1:e.rh&&e.rh>0?Math.min(1,(this.now-e.rh)/250)*s:0),e.Ot):0};Oe=(t,i)=>{const s=this.#Ji.get(t);s&&"visible"in s&&s.visible.set(i)};ah(){for(this.#cs();this.#qi.length;)this.#qi.pop()?.();this.#Ui.forEach(t=>$t(t)),this.#Ui.clear();for(const[t,i]of this.#Wi.entries())i.uh&&clearTimeout(i.uh),this.#ls(t);this.#Wi.clear(),this.#us()}#ds(t){const i=t.$info;if(!i)return;if(t.error)return void this.micrio.dh.set(0);if(!(t.$t||i.width&&i.height))throw new Error("Invalid Micrio image size");const s=t.$settings;this.#ts=!!H(this.micrio.gallery)||t.Lt,s.gallery?.archive&&(this.Rs=1,this.Xs=s.gallery.archiveLayerOffset??0),i.version&&3.1>=parseFloat(i.version)&&(this.Hs=8),i.is360&&(s.limitToCoverScale=0);const e=!!s.limitToCoverScale,h=e||"cover"==s.initType;t.$t&&this.micrio.dh.set(0);const o=[.5,.5],n=s.focus,r=!!i.spacesId;n&&(isNaN(n[0])||null===n[0]||(o[0]=n[0]),isNaN(n[1])||null===n[1]||(o[1]=n[1]));const a=s.l?.video,c=i.is360&&a&&(a.src||"video"in a&&a.video),l=!!this.#ts&&"switch"==s.gallery?.type,u=s.omni?.layers?.length??1;s.omni&&(s.omni.layerStartIndex=Math.min(u-1,s.omni?.layerStartIndex??0));const d=new Ut(this,i.width,i.height,t.Ot,e,i.tileSize??1024,i.is360??0,t.$t,!!i.isDeepZoom,s.freeMove??0,h,s.zoomLimit||1,0!=s.zoomLimitDPRFix?this.micrio.canvas.getRatio(t.$settings):1,s.camspeed??1,t.camera.rotationY,l,!!s.gallery?.isSpreads&&"swipe"==s.gallery.type,t.Lt,s.pinchZoomOutLimit??0,u,!(!i.isSingle&&!c),s.omni?.layerStartIndex??0,0);t.ot=1,d.ye=t,this.#os({canvas:d,micrioImage:t,camera:t.camera}),this.#Gi.push(t),this.#ps(t),t.opts.area&&t.camera.setArea(t.opts.area,{direct:1,noDispatch:1,noRender:1}),s?.restrict&&t.camera.setLimit(s.restrict),s?.crossfadeDuration&&(this.ze=s.crossfadeDuration),s?.embedFadeDuration&&(this.ie=s.embedFadeDuration),void 0!==s?.dragElasticity&&(this.mi=s.dragElasticity),s?.skipBaseLevels&&(this.ne=s.skipBaseLevels),s?.omni&&(d.ds=-(s.omni.distance??0),d.us=s.omni.fieldOfView??0,d.fs=s.omni.verticalAngle??0,d.ps=s.omni.offsetX??0,t.state.view.set([0,0,1,1])),this.micrio.hasAttribute("data-limited")&&t.canvas&&(t.canvas.oe=1),d.Ue(),this.Te>0&&this.#ms(this.Te-1);const p=H(t.state.view)||s.view;!p||0==p[0]&&0==p[1]&&1==p[2]&&1==p[3]?!r&&i.is360||!o||"0.5,0.5"==o.toString()||(d.camera.setCoo(o[0],o[1],0),s.focus=void 0):d.A(p[0]+p[2]/2,p[1]+p[3]/2,p[2],p[3],0,0,0,0),t.video.subscribe(t=>t&&t.addEventListener("play",this.render)),t.$t&&t.visible.set(1),this.#ns(t)}#ps(t){const i=this.#hs.get(t).canvas;t.camera.L(i)}#ns(t){if(t&&(!t.ot||t!==this.#es?.micrioImage))if(t.ot){if(t!==this.#es?.micrioImage){const i=this.#hs.get(t);if(!i)return;if(i.canvas.cs)return;const s=t.I&&this.#es?this.#es.canvas.D.U:0;if(this.#es=i,t.I&&!this.Je){const e=(this.Ie+.5)%1*Math.PI*2;i.canvas.Z(e-t.camera.rotationY,s,1)}0===i.canvas._e&&i.canvas.Ae(),t.$settings.omni?.layerStartIndex&&t.state.layer.set(t.$settings.omni.layerStartIndex),this.Je=0,this.ready=1,this.render()}}else{if(!H(this.micrio.current)||!t.$info.isIIIF&&t.$info.id!=H(this.micrio.current).id)return;this.#ds(t),t.Vt.length&&t.Vt.forEach(i=>this.Ut(i,t))}}ph(t){t.ot||this.#ds(t)}mh(t){if(!t.ot)throw new Error("Canvas is not placed yet");const i=this.#hs.get(t);i&&(i.canvas.qe(),this.#hs.delete(t),this.render())}render(){0>this.#is&&(this.#is=this.micrio.Rt.fh.requestAnimationFrame(this.#fs))}#fs=(t=performance.now())=>{if(this.micrio.isConnected&&this.micrio.$current){this.#is=-1,this.#ss=0,(this.De(t)||this.micrio.gh||this.micrio.events.isNavigating||0==this.micrio.$current?.Et?.paused)&&this.render(),this.#ts&&this.#as(),this.#Ri.clear();for(let t=0;t<this.be.length;t++)this.be[t].Ge();this.micrio.events.xt("draw"),this.#gs(),this.micrio.Rt.wh()}};De(t){this.te=1e3/Math.min(33,t-this.now),this.now=t,this.Fe=0,this.Ve=0,this.Be=0;for(let i=0;i<this.be.length;i++)this.be[i].De();return this.Be||1>this.Ne}#cs(){0>this.#is||(this.micrio.Rt.fh.cancelAnimationFrame(this.#is),this.#is=-1)}#rs(t){let i=this.#Wi.get(t);return i||(i={eh:0,Ot:0},this.#Wi.set(t,i)),i}#ms(t){this.#rs(t).Ot=1,this.#Hi.push(t)}#as(){this.#ss||(this.micrio.Rt.Mh(),this.#ss=1)}oh(t,i,s,e={}){if(this.#Wi.get(t)?.hh||this.#Ui.has(t)||!e.force&&At()>=Tt)return;const h=_t.db.has(i);h||this.micrio.dh.set(1),this.#Ui.set(t,i),(h?_t.getImage(i):(t=>new Promise((i,s)=>{Ct.push([t,i,s]),It()}))(i)).then(i=>this.#vs(t,i,s,e.noSmoothing)).catch(()=>this.#ws(t))}#vs(t,i,s,e){const h=this.#rs(t);h.hh=this.micrio.Rt.oh(i,h.hh,e),void 0!==self.ImageBitmap&&i instanceof ImageBitmap&&i.close instanceof Function&&i.close(),h.eh=2,h.uh=setTimeout(()=>{this.#ws(t)},s?150:50)}#ws(t){this.#Ui.delete(t);const i=this.#Wi.get(t);i?.uh&&(clearTimeout(i.uh),i.uh=void 0),this.#Ui.size||this.micrio.dh.set(0)}#ls(t){const i=this.#Wi.get(t);i&&(i.hh&&this.micrio.Rt.gl.deleteTexture(i.hh),i.uh&&clearTimeout(i.uh),this.#Wi.delete(t))}#gs(){const t=performance.now();for(const s of this.#Xi){if(this.#Ri.has(s))continue;if(this.#Hi.includes(s))continue;const i=this.#Wi.get(s);if(i&&0!==i.eh)switch(i.Ot=0,i.eh){case 1:const e=this.#Ui.get(s);e&&$t(e),i.eh=0;break;case 2:this.#Ui.has(s)&&this.#ws(s),this.#ls(s);break;case 3:i.ih||(i.ih=t)}}const i=this.#Xi;this.#Xi=this.#ji,this.#ji=i,this.#ji.clear();for(const s of this.#Ri)this.#Xi.add(s);for(const[s,e]of this.#Wi.entries())e.ih&&(t-e.ih)/1e3>this.#Zi&&this.#ls(s)}ve(t){this.el.set(t.width,t.height,t.left,t.top,t.ratio,t.scale,t.portrait);for(let i=0;i<this.be.length;i++)this.be[i].ve();this.ready&&(this.#cs(),this.#fs())}#Ms=(t,i,s=0,e=1,h)=>{this.#Gi.push(t),this.#ys(t,i,s,e,h)};#ys=(t,i,s,e,h)=>{const o="$info"in t?t.$info:i.$info;if(!o)return;const n=t.opts.area??[0,0,1,1],r=t instanceof yt?t.$settings.l??{}:{},a=this.#hs.get(i);if(!a)return;let c;if(s){const i=a.canvas.xe(n[0],n[1],n[0]+n[2],n[1]+n[3],o.width,o.height,o.tileSize??1024,o.isSingle??0,o.isDeepZoom??0,o.isVideo??0,e,r.rotX??0,r.rotY??0,r.rotZ??0,r.scale??1,h??0);return this.#Ji.set(i,t),this.#Ki.set(t,i),t.ot=1,this.#os({canvas:a.canvas,micrioImage:t}),t.zt=this.Te-1,void this.#ms(t.zt)}{if(!(t instanceof yt))return;let s={};s=t.$settings.gallery?.archive||t.$settings.gallery?.type?{coverLimit:0,coverStart:0}:{coverLimit:!!t.$settings?.limitToCoverScale||!!i.$settings?.limitToCoverScale,coverStart:!(!t.$settings?.limitToCoverScale&&"cover"!=t.$settings?.initType&&"cover"!=i.$settings?.initType)},c=a.canvas.Pe(n[0],n[1],n[0]+n[2],n[1]+n[3],o.width,o.height,s),c.ye=t}if(t.ot=1,this.#os({canvas:c,micrioImage:t,camera:t.camera}),!s){this.#ps(t);const i=t.$settings.focus;i?c.camera.setCoo(i[0],i[1],0):c.cs&&c.A(c.view.qt,c.view.Jt,c.view.width,c.view.height,0,0),c.Ue()}t.zt=this.Te-1,this.#ms(t.zt)};Ut(t,i,s={}){t.ot||this.#Ms(t,i,1,s.opacity??1,"camera"in t&&s.asImage?void 0:s.fromScale)}Pe=(t,i)=>this.#Ms(t,i);yh(t,i,s=0){const e=this.#hs.get(t),h=e?.canvas;if(h){if(e.camera)h._e=i;else{const t=h.images;for(let e=0;e<t.length;e++){const h=t[e];h.nt>0&&(h.Ys=i,s&&(h.opacity=i))}}this.render()}}_h(t,i){const s=this.#Ki.get(t);s&&(s.Gs=i)}#us(){for(let t=0;t<this.be.length;t++)this.be[t].Ze()}qe(t){for(let i=0;i<this.be.length;i++)if(this.be[i]===t)return void this.be.splice(i,1)}},qt=new Float32Array([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]),Jt=["attribute vec2 a_position;","attribute vec2 a_texCoord;","varying vec2 v_texCoord;","void main() {","v_texCoord = a_texCoord;","gl_Position = vec4(a_position, 0.0, 1.0);","}"].join(""),Kt=class{bh;#_s;#bs;#ks;#xs;#Ts;#Ps;#Ss;constructor(t,i,s){if(this.#Ss=t,this.#ks=t.createProgram(),i.Rt.kh(this.#ks,t.VERTEX_SHADER,Jt),i.Rt.kh(this.#ks,t.FRAGMENT_SHADER,s),t.linkProgram(this.#ks),t.getProgramParameter(this.#ks,t.LINK_STATUS)||console.error("Postprocess shader link error:",t.getProgramInfoLog(this.#ks)),t.useProgram(this.#ks),this.#xs=t.getAttribLocation(this.#ks,"a_position"),this.#Ts=t.getAttribLocation(this.#ks,"a_texCoord"),this.#Ps=t.getUniformLocation(this.#ks,"u_time"),this.#_s=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.#_s),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.#Ss.drawingBufferWidth,this.#Ss.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.bh=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,this.bh),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.#_s,0),t.checkFramebufferStatus(t.FRAMEBUFFER)!==t.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer not complete");t.bindFramebuffer(t.FRAMEBUFFER,null),this.#bs=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.#bs),t.bufferData(t.ARRAY_BUFFER,qt,t.STATIC_DRAW)}xh(){const t=this.#Ss;t.bindFramebuffer(t.FRAMEBUFFER,null),t.useProgram(this.#ks),t.bindBuffer(t.ARRAY_BUFFER,this.#bs),t.enableVertexAttribArray(this.#xs),t.vertexAttribPointer(this.#xs,2,t.FLOAT,0,4*Float32Array.BYTES_PER_ELEMENT,0),t.enableVertexAttribArray(this.#Ts),t.vertexAttribPointer(this.#Ts,2,t.FLOAT,0,4*Float32Array.BYTES_PER_ELEMENT,2*Float32Array.BYTES_PER_ELEMENT),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.#_s),t.uniform1f(this.#Ps,performance.now()/1e3),t.drawArrays(t.TRIANGLE_STRIP,0,4)}ve(){const t=this.#Ss;t.bindTexture(t.TEXTURE_2D,this.#_s),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.#Ss.drawingBufferWidth,this.#Ss.drawingBufferHeight,0,t.RGBA,t.UNSIGNED_BYTE,null),t.bindTexture(t.TEXTURE_2D,null)}Th(){const t=this.#Ss;t.deleteFramebuffer(this.bh),t.deleteTexture(this.#_s),t.deleteBuffer(this.#bs),t.deleteProgram(this.#ks)}},Qt=kt.firefox,ti=["uniform mat4 GLMatrix;","attribute vec3 pos;","attribute vec2 aTextureCoord;","varying highp vec2 vTextureCoord;","void main()","{","gl_Position = GLMatrix * vec4(pos, 1.0);","vTextureCoord = aTextureCoord;","}"].join(""),ii=["precision mediump float;","varying highp vec2 vTextureCoord;","uniform sampler2D uSampler;","uniform float opacity;","uniform int noTexture;","void main() {","if(noTexture==1) {","gl_FragColor = vec4(.1,.1,.1,.1);","} else {",...Qt?["vec4 textureColor = texture2D(uSampler, vTextureCoord);","float newAlpha = min(1., textureColor.a * opacity);","gl_FragColor = vec4(textureColor.rgb * newAlpha, newAlpha);"]:["gl_FragColor = texture2D(uSampler, vTextureCoord) * opacity;"],"}","}"].join(""),si=256,ei=class{gl;fh=self;#ks;#Es;#Cs;Ye;#zs=-1;#Is;#Ls;#As;#$s=null;#Ds=null;#Os=new Float32Array([-1,-1,0,1,-1,0,-1,1,0,-1,1,0,1,-1,0,1,1,0]);#Fs=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0]);#Vs=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);#Ns=.075;#Bs=-1;#Gs=0;#Ys=-1;#Hs=-1;Ph;#Rs;constructor(t){this.#Rs=t}Sh(){const t="WebGL2RenderingContext"in window,i=this.#Rs.canvas.element.getContext(t?"webgl2":"webgl",{alpha:1,preserveDrawingBuffer:this.#Rs.hasAttribute("data-preserve-drawing-buffer"),stencil:0,antialias:0,depth:0,desynchronized:0});if(t?!(i instanceof window.WebGL2RenderingContext):!(i instanceof window.WebGLRenderingContext))throw new _("WebGL context creation failed",{code:r,displayMessage:"Your browser does not support WebGL, which is required to view this content. Please try a different browser."});this.gl=i;const s=this.#Rs.$current?.$settings.postProcessingFragmentShader;s&&(this.Ph=new Kt(i,this.#Rs,s),this.#Rs.gh=1);const e=i.createProgram();if(!(e instanceof WebGLProgram))throw new _("Failed to create WebGL program",{code:c,displayMessage:"There was a problem initializing the graphics. Please try refreshing the page."});if(this.#ks=e,this.kh(this.#ks,i.VERTEX_SHADER,ti),this.kh(this.#ks,i.FRAGMENT_SHADER,ii),i.linkProgram(this.#ks),!i.getProgramParameter(this.#ks,i.LINK_STATUS))throw new _("Shader link error: "+i.getProgramInfoLog(this.#ks),{code:c,displayMessage:"There was a problem initializing the graphics. Please try refreshing the page."});i.useProgram(this.#ks),i.blendFunc(i.ONE,i.ONE_MINUS_SRC_ALPHA),i.enable(i.BLEND),i.disable(i.DEPTH_TEST),i.clearColor(0,0,0,0);const h=i.getUniformLocation(this.#ks,"opacity");if(!h)throw new _("Failed to bind WebGL opacity uniform",{code:c});this.#Es=h;const o=i.getUniformLocation(this.#ks,"GLMatrix");if(!o)throw new _("Failed to bind WebGL matrix uniform",{code:c});this.Ye=o;const n=i.getUniformLocation(this.#ks,"noTexture");if(!n)throw new _("Failed to bind WebGL texture uniform",{code:c});this.#Cs=n,this.#zs=i.getAttribLocation(this.#ks,"aTextureCoord");const a=i.createBuffer();if(!a)throw new _("Failed to create WebGL texture buffer",{code:l,displayMessage:"Your device is low on memory. Try closing other browser tabs or applications."});this.#Is=a,i.bindBuffer(i.ARRAY_BUFFER,this.#Is),i.bufferData(i.ARRAY_BUFFER,Zt.Ke,i.STATIC_DRAW);const u=i.createBuffer();if(!u)throw new _("Failed to create WebGL watermark buffer",{code:l,displayMessage:"Your device is low on memory. Try closing other browser tabs or applications."});this.#As=u;const d=i.createBuffer();if(!d)throw new _("Failed to create WebGL geometry buffer",{code:l,displayMessage:"Your device is low on memory. Try closing other browser tabs or applications."});this.#Ls=d,this.#Bs=i.getAttribLocation(this.#ks,"pos"),this.#Xs(),i.activeTexture(i.TEXTURE0),i.viewport(0,0,this.gl.drawingBufferWidth,this.gl.drawingBufferHeight)}#Xs(){const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,this.#Ls),t.bufferData(t.ARRAY_BUFFER,this.#Rs.Eh.Me.byteLength,t.DYNAMIC_DRAW),t.enableVertexAttribArray(this.#zs),t.bindBuffer(t.ARRAY_BUFFER,this.#Is),t.vertexAttribPointer(this.#zs,2,t.FLOAT,0,0,0),t.enableVertexAttribArray(this.#Bs),t.bindBuffer(t.ARRAY_BUFFER,this.#Ls),t.vertexAttribPointer(this.#Bs,3,t.FLOAT,0,0,0)}Th(t=0){const i=this.gl;if(i){if(i.bindBuffer(i.ARRAY_BUFFER,null),i.bindTexture(i.TEXTURE_2D,null),i.deleteBuffer(this.#Is),i.deleteBuffer(this.#Ls),i.deleteBuffer(this.#As),i.deleteProgram(this.#ks),this.Ph?.Th(),this.#$s&&i.deleteTexture(this.#$s),t){const t=i.getExtension("WEBGL_lose_context");t instanceof Object&&t.loseContext instanceof Function&&t.loseContext()}this.gl=null}}kh(t,i,s){const e=this.gl.createShader(i);if(!e)throw new Error(`Could not create WebGL shader (type: ${i})`);if(this.gl.shaderSource(e,s),this.gl.compileShader(e),!this.gl.getShaderParameter(e,this.gl.COMPILE_STATUS))throw this.gl.deleteProgram(t),new _("Shader compilation failed: "+this.gl.getShaderInfoLog(e),{code:c,displayMessage:"There was a problem initializing the graphics. Please try refreshing the page."});this.gl.attachShader(t,e),this.gl.deleteShader(e)}oh(t,i,s){const e=this.gl,h=i??e.createTexture();if(!h)throw new Error("Could not create WebGL texture");return e.bindTexture(e.TEXTURE_2D,h),t&&e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,s?e.NEAREST:e.LINEAR),h}nh(t,i){const s=this.gl;s.bindTexture(s.TEXTURE_2D,t),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,i),s.bindTexture(s.TEXTURE_2D,null)}Mh(){const t=this.gl;this.Ph&&t.bindFramebuffer(t.FRAMEBUFFER,this.Ph.bh),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}wh(){this.Ph&&(this.Ph.xh(),this.gl.useProgram(this.#ks),this.#Xs()),this.#$s&&this.#js()}He(t,i=1,s=0){const e=this.gl,h=t?0:1;h!==this.#Ys&&(e.uniform1i(this.#Cs,h),this.#Ys=h),i!==this.#Hs&&(e.uniform1f(this.#Es,i),this.#Hs=i),t&&e.bindTexture(e.TEXTURE_2D,t);const o=s?1536:6;s!=this.#Gs&&(e.bindBuffer(e.ARRAY_BUFFER,this.#Is),e.bufferData(e.ARRAY_BUFFER,s?Zt.Qe:Zt.Ke,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.#Ls),this.#Gs=s),e.bufferSubData(e.ARRAY_BUFFER,0,s?this.#Rs.Eh.Me:this.#Rs.Eh.ce),e.drawArrays(e.TRIANGLES,0,o)}Ht(t,i){if(t===this.#Ds)return;this.#Ds=t;const s=new Image;i&&(this.#Ns=i),s.crossOrigin="anonymous",s.src=t,s.onload=()=>{const t=dt("canvas",{props:{width:si,height:si}}),i=t.getContext("2d");if(!i)return;const e=Math.min(96/s.width,64/s.height),h=s.width*e,o=s.height*e;i.drawImage(s,(si-h)/2,(si-o)/2,h,o),this.#$s&&this.gl.deleteTexture(this.#$s),this.#$s=this.oh(t);const n=this.gl;n.bindTexture(n.TEXTURE_2D,this.#$s),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.bindTexture(n.TEXTURE_2D,null),this.#Rs.Eh.render()}}#js(){const t=this.gl;if(!this.#$s)return;t.useProgram(this.#ks),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.uniformMatrix4fv(this.Ye,0,this.#Vs),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.#$s),t.uniform1i(this.#Cs,0),t.uniform1f(this.#Es,this.#Ns),this.#Ys=0,this.#Hs=this.#Ns;const i=t.drawingBufferWidth/si,s=t.drawingBufferHeight/si,e=this.#Fs;e[1]=s,e[2]=i,e[3]=s,e[8]=i,e[9]=s,e[10]=i,t.bindBuffer(t.ARRAY_BUFFER,this.#Ls),t.bufferData(t.ARRAY_BUFFER,this.#Os,t.DYNAMIC_DRAW),t.vertexAttribPointer(this.#Bs,3,t.FLOAT,0,0,0),t.bindBuffer(t.ARRAY_BUFFER,this.#As),t.bufferData(t.ARRAY_BUFFER,this.#Fs,t.DYNAMIC_DRAW),t.vertexAttribPointer(this.#zs,2,t.FLOAT,0,0,0),t.drawArrays(t.TRIANGLES,0,6),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),this.#Xs(),this.#Gs=0}},hi=class{element=dt("canvas");#Ws;viewport={width:0,height:0,left:0,top:0,ratio:0,scale:0,portrait:0};isMobile=Y(0);get $isMobile(){return H(this.isMobile)}#Rs;constructor(t){this.#Rs=t,this.element.className="micrio",this.onresize=this.onresize.bind(this),self.ResizeObserver&&(this.#Ws=new self.ResizeObserver(this.onresize))}place(){if(this.element.parentNode)return;const t=this.#Rs.querySelector("img.preview");this.#Rs.insertBefore(this.element,t?t.nextSibling:this.#Rs.firstChild)}hook(){this.onresize(),this.#Ws?this.#Ws.observe(this.element):window.addEventListener("resize",this.onresize)}unhook(){this.#Ws?this.#Ws.unobserve(this.element):window.removeEventListener("resize",this.onresize)}onresize(){const t=this.element.getBoundingClientRect();let i=t.width,s=t.height;if(!i||!s)return;const e=self.getComputedStyle(this.element),h=parseFloat(e.width);isNaN(h)||(s=parseFloat(e.height)*i/Math.max(1,h));const o=this.#Rs.hasAttribute("data-static")?1:Math.floor(i)/this.#Rs.offsetWidth;i/=o,s/=o;const n=1!=o?1:this.getRatio(),r=this.viewport;r.width==i&&r.height==s&&r.ratio==n&&r.scale==o||(r.width=i,r.height=s,r.ratio=n,r.scale=o,r.top=t.top,r.left=t.left,r.portrait=window.matchMedia("(orientation: portrait)")?.matches??s>i,this.element.width=i*n,this.element.height=s*n,this.#Rs.Rt.gl.viewport(0,0,r.width*r.ratio,r.height*r.ratio),this.#Rs.Rt.Ph?.ve(),this.#Rs.Eh.ve(r),this.#Rs.events.xt("resize",t),this.isMobile.set(/mobile/i.test(navigator.userAgent)))}getRatio=(t=this.#Rs.$current?.$settings??{})=>!kt.iOS&&!t?.noRetina&&self.devicePixelRatio&&Math.max(1,Math.min(2,self.devicePixelRatio))||1;setMargins(t,i){this.#Rs.Eh.ready&&(this.#Rs.Eh.el.ci=t,this.#Rs.Eh.el.li=i)}},oi={passive:1},ni={passive:1,capture:1},ri={passive:0};function ai(t){t.stopPropagation(),t.preventDefault()}var ci=class{#Us=0;#Zs;constructor(t){this.#Zs=t}hook(){this.#Us||(this.#Us=1,this.#Zs.Ch.addEventListener("dragstart",ai),this.#Zs.Ch.addEventListener("pointerdown",this.start,oi),self.addEventListener("pointercancel",this.#qs,oi),this.#Zs.Ch.setAttribute("data-hooked",""))}unhook(){this.#Us&&(this.#Us=0,this.#Zs.Ch.removeEventListener("pointerdown",this.start,oi),this.#Zs.Ch.removeEventListener("dragstart",ai),self.removeEventListener("pointercancel",this.#qs,oi),this.#Zs.Ch.removeAttribute("data-hooked"))}start=(t,i=0,s=0)=>{if(0!=t.button||"touch"==t.pointerType&&this.#Zs.zh)return;if(!(i||t.target==this.#Zs.Ih||t.target instanceof Element&&t.target.closest("[data-scroll-through]")))return;if(this.#Zs.Ch.$current?.Lt&&t.shiftKey)return;if(this.#Zs.Lh)return;if(this.#Zs.Ah)return void(t instanceof TouchEvent&&t.touches.length>1&&this.stop());const e=this.#Zs.$h({x:t.clientX,y:t.clientY});e&&(this.#Zs.Ah=1,this.#Zs.Oh.Dh.Cs=[t.clientX,t.clientY,performance.now()],this.#Zs.Oh.Dh.Fh=e,this.#Zs.Ch.addEventListener("pointermove",this.#Js,oi),this.#Zs.Ch.addEventListener("pointerup",this.stop,oi),this.#Zs.Ch.setAttribute("data-panning",""),e.canvas?.Wi.stop(),s||e.camera.stop(),this.#Zs.Ch.Eh.render(),this.#Zs.xt("panstart"))};#Js=t=>{const i=t.clientX,s=t.clientY,e=Math.hypot(this.#Zs.Oh.Dh.Cs[0]-t.clientX,this.#Zs.Oh.Dh.Cs[1]-t.clientY);!this.#Zs.Vh&&e>10&&(this.#Zs.Vh=t.pointerId,this.#Zs.Ch.setPointerCapture(t.pointerId)),this.#Zs.Oh.Dh.Nh&&this.#Zs.Oh.Dh.Fh?.camera.pan(this.#Zs.Oh.Dh.Nh[0]-i,this.#Zs.Oh.Dh.Nh[1]-s),this.#Zs.Oh.Dh.Nh=[i,s]};stop=(t,i=0,s=0)=>{if(this.#Zs.Ah){if(this.#Zs.Ah=0,this.#Zs.Oh.Dh.Nh=void 0,this.#Zs.Ch.removeEventListener("pointermove",this.#Js,oi),this.#Zs.Ch.removeEventListener("pointerup",this.stop,oi),this.#Zs.Vh&&this.#Zs.Ch.releasePointerCapture(this.#Zs.Vh),this.#Zs.Vh=void 0,this.#Zs.Ch.removeAttribute("data-panning"),t&&0==i){const i=this.#Zs.Oh.Dh.Fh??this.#Zs.$h({x:t.clientX,y:t.clientY});i&&(i.canvas?.Wi.start(),this.#Zs.Ch.Eh.render())}this.#Zs.Oh.Dh.Fh=void 0,s||this.#Zs.xt("panend",t?{duration:performance.now()-this.#Zs.Oh.Dh.Cs[2],movedX:t.clientX-this.#Zs.Oh.Dh.Cs[0],movedY:t.clientY-this.#Zs.Oh.Dh.Cs[1]}:void 0)}};#qs=t=>{this.#Zs.Ah&&(void 0!==this.#Zs.Vh&&t.pointerId!==this.#Zs.Vh||this.stop(void 0,1,1))}};function li(t,i){t.Oh.ji.Bh=t.Ah,i.stop(void 0,0,1),t.Lh=1,t.Ch.setAttribute("data-pinching",""),t.Gh=void 0,t.Oh.ji.Fh&&t.Oh.ji.Fh.canvas?.camera.Zi(),t.Ch.Eh.render(),t.xt("pinchstart"),t.zh&&t.xt("panstart")}function ui(t,i,s){const e=t.Oh.ji,h=e.Fh;h&&(t.Gh=Math.hypot(i.x-s.x,i.y-s.y)/e.Yh,h.canvas?.camera.ji(i.x,i.y,s.x,s.y))}function di(t,i,s){if(!t.Lh)return;t.Lh=0,self.removeEventListener("touchmove",s,{passive:1,capture:1}),self.removeEventListener("pointermove",s,{passive:1,capture:1}),t.Ch.removeAttribute("data-pinching");const e=t.Oh.ji.Fh;e&&(e.canvas?.camera.qi(),t.Ch.Eh.render()),t.Oh.ji.Fh=void 0,t.Gh=void 0,t.xt("pinchend"),t.zh&&!t.Oh.ji.Bh&&t.xt("panend")}function pi(t,i,s){if(s instanceof TouchList?1===s.length:1===s.size){let e;if(s instanceof TouchList){const i=s[0];e={button:0,target:t.Ih,clientX:i.clientX,clientY:i.clientY}}else{const[i,{x:h,y:o}]=s.entries().next().value;e={button:0,pointerType:"touch",target:t.Ih,clientX:h,clientY:o,pointerId:i}}i.start(e,1,1)}}var mi=class{#Zs;#Ks;constructor(t,i){this.#Zs=t,this.#Ks=i}hook(){kt.iOS&&this.#Zs.Hh&&this.#Zs.Ch.addEventListener("touchstart",this.start,oi)}unhook(){kt.iOS&&this.#Zs.Hh&&this.#Zs.Ch.removeEventListener("touchstart",this.start,oi),self.removeEventListener("touchmove",this.#Js,ni),self.removeEventListener("touchend",this.stop,ni)}start=t=>{if(!(kt.hasTouch&&t instanceof TouchEvent))return;if(this.#Zs.zh&&2>t.touches.length)return;if(this.#Zs.Lh||2!=t.touches.length)return void this.stop(t);t.stopPropagation();const i=t.touches;this.#Zs.Oh.ji.Fh=this.#Zs.$h({x:i[0].clientX,y:i[0].clientY}),this.#Zs.Oh.ji.Yh=Math.hypot(i[0].clientX-i[1].clientX,i[0].clientY-i[1].clientY),self.addEventListener("touchmove",this.#Js,ni),self.addEventListener("touchend",this.stop,ni),li(this.#Zs,this.#Ks)};#Js=t=>{if(!(kt.hasTouch&&t instanceof TouchEvent))return;const i=t.touches;if(2>i?.length)return;const s={x:i[0].clientX,y:i[0].clientY},e={x:i[1].clientX,y:i[1].clientY};ui(this.#Zs,s,e)};stop=t=>{di(this.#Zs,0,this.#Js),t instanceof TouchEvent&&pi(this.#Zs,this.#Ks,t.touches)}},fi=class{#Zs;#Ks;constructor(t,i){this.#Zs=t,this.#Ks=i}hook(){this.#Zs.Ch.addEventListener("pointerdown",this.start,oi),self.addEventListener("pointerup",this.end,oi),self.addEventListener("pointercancel",this.end,oi)}unhook(){this.#Zs.Ch.removeEventListener("pointerdown",this.start,oi),self.removeEventListener("pointerup",this.end,oi),self.removeEventListener("pointercancel",this.end,oi),self.removeEventListener("pointermove",this.#Js,ni),this.#Zs.Rh.clear()}start=t=>{if("touch"===t.pointerType&&t.target==this.#Zs.Ih&&(this.#Zs.Rh.set(t.pointerId,{x:t.clientX,y:t.clientY}),2===this.#Zs.Rh.size&&!this.#Zs.Lh)){const t=Array.from(this.#Zs.Rh.values()),i=t[0],s=t[1];this.#Zs.Oh.ji.Fh=this.#Zs.$h({x:i.x,y:i.y}),this.#Zs.Oh.ji.Yh=Math.hypot(i.x-s.x,i.y-s.y),self.addEventListener("pointermove",this.#Js,ni),li(this.#Zs,this.#Ks)}};#Js=t=>{if("touch"!==t.pointerType)return;if(!this.#Zs.Rh.has(t.pointerId))return;if(this.#Zs.Rh.set(t.pointerId,{x:t.clientX,y:t.clientY}),!this.#Zs.Lh||2!==this.#Zs.Rh.size)return;const i=Array.from(this.#Zs.Rh.values()),s={x:i[0].x,y:i[0].y},e={x:i[1].x,y:i[1].y};ui(this.#Zs,s,e)};end=t=>{"touch"===t.pointerType&&(this.#Zs.Rh.delete(t.pointerId),this.#Zs.Lh&&2>this.#Zs.Rh.size&&(self.removeEventListener("pointermove",this.#Js,ni),di(this.#Zs,0,this.#Js),pi(this.#Zs,this.#Ks,this.#Zs.Rh)))}},gi=class{#Zs;constructor(t){this.#Zs=t}hook(){kt.OSX&&(this.#Zs.Ch.addEventListener("gesturestart",this.#Qs,ri),this.#Zs.Ch.addEventListener("gesturechange",this.#Qs,ri),this.#Zs.Ch.addEventListener("gestureend",this.#Qs,ri))}unhook(){kt.OSX&&(this.#Zs.Ch.removeEventListener("gesturestart",this.#Qs,ri),this.#Zs.Ch.removeEventListener("gesturechange",this.#Qs,ri),this.#Zs.Ch.removeEventListener("gestureend",this.#Qs,ri))}#te(t){if("scale"in t&&"number"==typeof t.scale){const i=t;return{scale:i.scale,clientX:i.clientX,clientY:i.clientY}}return null}#Qs=t=>{const i=this.#te(t);if(!i||1===i.scale)return;if(t.target instanceof Element&&t.target!=this.#Zs.Ih)return;const s=this.#Zs.Xh-i.scale;this.#Zs.Xh=i.scale,t.stopPropagation(),t.preventDefault(),"gesturechange"==t.type&&this.#Zs.$h({x:i.clientX,y:i.clientY})?.camera.zoom(s*this.#Zs.Ch.canvas.viewport.height,0,i.clientX,i.clientY)}},vi=class{hooked=0;#ie=-1;#Zs;constructor(t){this.#Zs=t}hook(){this.hooked||(this.#Zs.Ch.addEventListener("wheel",this.handle,ri),this.hooked=1)}unhook(){this.#Zs.Ch.removeEventListener("wheel",this.handle,ri),this.hooked=0}handle=(t,i=0,s=0)=>{if(!(t instanceof WheelEvent))return;if(this.#Zs.jh&&!t.ctrlKey)return;if(!i&&t.target instanceof Element&&t.target!=this.#Zs.Ih&&!t.target.classList.contains("marker")&&!t.target.closest("[data-scroll-through]"))return;let e=t.deltaY;t.ctrlKey&&(this.#Zs.Wh=1);const h=this.#Zs.jh&&10*e%1==0,o=this.#Zs.Wh&&!h,n=kt.firefox||t.ctrlKey||!o;if(this.#Zs.zh&&this.#Zs.Ch.$current?.camera.isZoomedOut())return;t.stopPropagation(),t.preventDefault(),(kt.OSX||o)&&t.ctrlKey&&(e*=10);const r={x:t.clientX,y:t.clientY},a=this.#Zs.$h(r);if(a){if(n){const t=this.#Zs.Ch.canvas.viewport;let i=0;const h=this.#Zs.Ch.getBoundingClientRect();a.camera.zoom(1*e/Math.sqrt(t.scale),0,r.x-s-h.left,r.y-h.top-i)}else a.camera.pan(t.deltaX,t.deltaY);this.#Zs.Uh=1,clearTimeout(this.#ie),this.#ie=setTimeout(this.#se,50)}};#se=()=>{this.#Zs.Uh=0}},wi=Symbol("micrio-provides"),Mi=class extends HTMLElement{static tag;static Zh=new Map;#ee=[];#he=null;qh={};connectedCallback(){this.Jh?.(),this.xh?.()}disconnectedCallback(){this.Kh?.(),this.#gs()}bt(t){Object.assign(this.qh,t),this.isConnected&&this.xh()}xh(){}Qh(t){this.#ee.push(t)}io(t){return t===this.#he?(this.so?.(),0):(this.#he=t,1)}eo(t,i,s){let e=i;s?.skipFirst&&(e=j(i)),s?.defer&&(e=X(i)),this.Qh(t.subscribe(e))}ho(t,i){this.eo(t,i,{skipFirst:1})}oo(t,i){this.eo(t,i,{skipFirst:1,defer:1})}no(t,i){this.Qh(t.subscribe(i))}ro(t,i){let s=this[wi];s||(this[wi]=s=new Map),s.set(t,i)}ao(t){let i=this;for(;i;){const s=i[wi];if(s?.has(t))return s.get(t);i=i.parentElement}}co(){return this.ao("micrio")}#gs(){for(const t of this.#ee)t();this.#ee=[]}},yi={0:[0,-.5,1,.5],90:[1,0,.5,1],180:[0,1,1,.5],270:[-.5,0,.5,1]},_i={0:[0,-1,1,1],90:[1,0,1,1],180:[0,1,1,1],270:[-1,0,1,1]},bi={0:[0,1,1,1],90:[-1,0,1,1],180:[0,-1,1,1],270:[1,0,1,1]},ki={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down"},xi=class extends Mi{static tag="micrio-button";#oe;#ne;so(){const t=this.qh;t.type!==this.#ne&&(this.#ne&&this.classList.remove(this.#ne),t.type&&this.classList.add(t.type),this.#ne=t.type)}xh(){const t=this.qh,i=`${t.type}|${t.icon?.src??""}|${t.title??""}|${t.disabled??""}|${t.active??""}|${t.className??""}|${t.href??""}|${t.blankTarget??""}|${t.noClick??""}`;if(!this.io(i))return;const s=!!t.href,e=s?"a":"button",h=`${t.className?t.className+" ":""}${t.active?"active":""}${t.noClick?" no-click":""}`.trim();this.#ne&&this.classList.remove(this.#ne),t.type&&this.classList.add(t.type),this.#ne=t.type,this.#oe&&this.#oe.remove();const o={title:t.title??"","aria-label":t.title??""};s&&(o.href=t.href,t.blankTarget&&(o.target="_blank"));const n=dt(e,{className:h,attrs:o,props:{disabled:s?void 0:!!t.disabled},events:{...t.onclick&&{click:t.onclick},...t.onfocus&&{focus:t.onfocus},...t.onpointerdown&&{pointerdown:t.onpointerdown}},parent:this});this.#oe=n,t.type?dt("micrio-icon",{setProps:{name:t.type},parent:n}):t.icon&&dt("img",{props:{src:t.icon.src,alt:"Icon"},parent:n});const r=[];for(const c of this.childNodes)c===n||c.nodeType!==Node.TEXT_NODE&&c.nodeType!==Node.ELEMENT_NODE||(r.push(c.textContent??""),c.remove());const a=r.join("").trim();a&&dt("span",{textContent:a,parent:n})}};customElements.define(xi.tag,xi);var Ti=(t=>(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))({}),Pi=new WeakMap;function Si(t,i,s,e){"string"==typeof i&&(i=Ti[i]);const h=i+(s??"");if(t.lo==h)return;const o=(t=>{let i=Pi.get(t);return i||(i={[Ti.focus](i,s){const e=i?.split("|").map(t=>t.trim()),h=(e?.[0]??"").split(",").map(i=>t.uo.get(i.trim())).filter(t=>void 0!==t);1==h.length?t.gridFocus(h[0],{duration:s}):h.length>0&&t.set(h.map(t=>({id:t.id,size:[1]})),{duration:s,horizontal:"h"==e?.[1]})},[Ti.flyTo](i,s){const e=i?.split(",").map(i=>t.do.find(t=>t.id==i?.trim()));if(e?.length){const i=e.map(t=>t?.opts.area?.[0]??0),h=e.map(t=>t?.opts.area?.[1]??0),o=Math.max(...e.map(t=>(t?.opts.area?.[0]??0)+(t?.opts.area?.[2]??1))),n=Math.max(...e.map(t=>(t?.opts.area?.[1]??0)+(t?.opts.area?.[3]??1))),r=Math.min(...i),a=Math.min(...h);t.image.camera.flyToView([r,a,o-r,n-a],{duration:s?1e3*s:void 0}).catch(()=>{})}else console.warn("Given image IDs gave no current displayed images")},[Ti.focusTagged](i,s){t.po(i,s)},[Ti.focusWithTagged](i,s){t.po(i,s,1)},[Ti.reset](i,s){t.reset(s)},[Ti.back](i,s){t.back(s)},[Ti.switchToGrid](){(t=>{const i=t.$focussed;if(!i)return;const s=i.camera.getView();s&&t.reset(0,1).then(()=>{i.opts.area&&t.image.camera.setView(i.opts.area,{noLimit:1}),i.camera.setView(s,{noLimit:1}),t.micrio.current.set(t.image)})})(t)},[Ti.nextFadeDuration](i){t.mo=Number(i)},[Ti.filterTourImages](i,s){const e=H(t.micrio.state.tour);if(!e||!("steps"in e)||!e.stepInfo)return;const h=e.stepInfo.map(t=>t.micrioId),o=h.filter((t,i)=>h.indexOf(t)==i).map(i=>t.uo.get(i)).filter(t=>!!t);o.length&&t.set(o.map(t=>({id:t.id,size:[1]})),{duration:s,horizontal:"h"==i})}},Pi.set(t,i)),i})(t)[i];o?o(s,e):console.warn("Warning: unknown grid tour event",i),t.lo=h}var Ei=class extends Mi{static tag="micrio-grid";fo=[];uo=new Map;do=[];vo=new Map;wo=0;Mo="grid";yo=Y();get $focussed(){return H(this.yo)}_o=Y([]);#re=[];#ae=Y(0);bo=1;#ce=.5;#le=.5;mo;#ue=0;#de=new Map;#pe=new Map;lo;#me;#fe;#ge;#ve="ease";#we;static ko=0;micrio;image;#Me;#pt=0;Jh(){if(this.#pt)return;this.#pt=1;const t=this.qh;this.micrio=t.micrio,this.image=t.image,this.#Me=t.gallery,this.#Me.fo.forEach(t=>this.#ye(t));const i=this.image.$settings?.grid;this.wo=i?.clickable&&["focus","zoom"].includes(i.clickable)?i.clickable:0,this.Mo="cells"==i?.panZoom?"cells":"grid",this.wo&&this.image.$settings.hookKeys&&(t=>{if(Ei.ko=1,document.addEventListener("keydown",(t=>i=>{if(!t.do.length||!t.wo)return;if("Escape"==i.key)return t.vo.forEach(t=>t.classList.remove("focussed")),void(t.$focussed?(t.back(),i.preventDefault(),i.stopPropagation()):t.image.camera.isZoomedOut()||(t.reset(),i.preventDefault(),i.stopPropagation()));const s=ki[i.key];if(!s||t.$focussed)return;i.preventDefault(),i.stopPropagation();const e=((t,i)=>{const s=t.do.map((t,i)=>({img:t,i:i,cx:t.opts.area[0]+t.opts.area[2]/2,cy:t.opts.area[1]+t.opts.area[3]/2}));if(!s.length)return;let e=s.findIndex(i=>i.img.id==t.querySelector(":focus")?.getAttribute("data-id"));0>e&&(e=0);const h=s[e],o=.05;let n;for(const r of s){if(r.i===e)continue;const t=r.cx-h.cx,s=r.cy-h.cy;let a=0;switch(i){case"left":a=0>t&&Math.abs(s)<o;break;case"right":a=t>0&&Math.abs(s)<o;break;case"up":a=0>s&&Math.abs(t)<o;break;case"down":a=s>0&&Math.abs(t)<o}if(!a)continue;const c=Math.abs(t)+Math.abs(s);n&&c>=n.dist||(n={img:r.img,dist:c})}return n?n.img:s["right"==i||"down"==i?0:s.length-1].img})(t,s);if(!e)return;const h=e.id;t.vo.forEach((t,i)=>{i===h?(t.focus(),t.classList.add("focussed")):(t.blur(),t.classList.remove("focussed"))}),"zoom"!=t.wo||t.image.camera.isZoomedOut()||t.image.camera.flyToView(e.opts.area??[0,0,1,1],{duration:1e3*t.bo,limit:0})})(t)),"grid"==t.Mo&&t.wo){let i={x:0,y:0};t.micrio.addEventListener("pointerdown",t=>{i={x:t.clientX,y:t.clientY}}),t.micrio.addEventListener("pointerup",s=>{if(!i)return;const e=Math.hypot(s.clientX-i.x,s.clientY-i.y);if(i=void 0,e>10)return;const[h,o]=t.image.camera.getCoo(s.clientX,s.clientY,1),n=t.do.find(t=>t.opts.area&&K(h,o,t.opts.area));n&&t.xo(n)})}})(this),void 0!==i?.transitionDuration&&(this.bo=this.#ce=i.transitionDuration),void 0!==i?.transitionDurationOut&&(this.#ce=i.transitionDurationOut),this.set(this.#_e,{cover:"cover"==this.image.$settings?.initType,duration:0}).then(()=>{this.#be(),this.micrio.events.xt("grid-load")}),this.#we=dt("micrio-button",{setProps:{type:"close",onclick:()=>this.back(),title:"Close"}}),this.Qh(()=>this.#we.remove()),this.Qh(this.yo.subscribe(t=>{t?this.appendChild(this.#we):this.#we.remove()})),this.micrio.events.xt("grid-init",this)}#be(){if(this.micrio.state.marker.subscribe(t=>{if(t&&"string"!=typeof t){const i=t.data?.To;if(i?.gridSize){const s="number"==typeof i.gridSize?[i.gridSize,i.gridSize]:i.gridSize.split(",").map(Number),e=this.fo.find(i=>i.$data?.markers?.find(i=>i==t))?.id;e&&this.#pe.set(e,s)}R().then(()=>{const t=i?.gridAction?.split("|");t?.length&&"string"==typeof t[0]&&this.action(t.shift(),t.join("|"))})}}),this.wo){this.addEventListener("click",t=>{this.xo(t.target?.dataset.id)});const t=t=>{t?this.#ke():this.#xe()};this.micrio.state.tour.subscribe(t),this.micrio.state.marker.subscribe(t),this.yo.subscribe(t)}var t;this.#Te=(t=this,i=>{const s=i.detail;s&&s.action?.startsWith("grid:")&&s.active&&Si(t,s.action.slice(5),s.data,s.end-s.start)}),this.micrio.addEventListener("tour-event",this.#Te),this.micrio.addEventListener("serialtour-pause",()=>this.fo.forEach(t=>t.camera.pause())),this.micrio.addEventListener("serialtour-play",()=>this.fo.forEach(t=>t.camera.resume()))}#Te;#Pe(){clearTimeout(this.#fe),clearTimeout(this.#ge)}#ye(t){this.fo.push(t),this.uo.set(t.id,t)}get#_e(){return this.#Me.fo.map(t=>({id:t.id,size:[1]}))}#Se(){this.#ae.set(this.#re.push({layout:this.do.map(t=>({id:t.id,view:t.state.$view,size:this.#de.get(t.id)})),horizontal:this.#ue,view:this.image.camera.getView()}))}set(t=[],i={}){return new Promise((s,e)=>{delete this.image.$settings?.focus,this.lo=void 0,0==i.cover&&i.coverLimit&&(i.coverLimit=0),i.coverLimit&&null==i.cover&&(i.cover=1);const h=this.$focussed,o=i.transition?.endsWith("-delayed"),n="behind-delayed"==i.transition,{Eh:r}=this.micrio;"crossfade"==i.transition?i.duration=0:"behind"!=i.transition&&"behind-delayed"!=i.transition||((t,i,s,e)=>{const h="behind-delayed"==s.transition,o=1==s.coverLimit;s.forceAni=1,s.coverLimit=o,s.forceAreaAni=1;const n=h?1/i.length:1;let r=0;t.fo.forEach(t=>{t.camera.setCoverLimit(o),i.find(i=>i.id==t.id)&&(t.camera.setArea([0,0,e?.id==t.id?1:n,1],{noDispatch:1,direct:1}),t!=e&&t.camera.setView([0,0,1,1]),h&&t.canvas&&(t.canvas.zIndex=i.length-r++))}),i.forEach(t=>t.view=[0,0,1,1])})(this,t,i,h);const a=this.image.ot,c=i.duration??(i.noHistory?this.#ce:this.bo),l=this.mo??this.image.$settings.crossfadeDuration??1,u=(c||this.bo)/(n?2:1);this.mo=void 0,a&&(r.je=c,r.ze=u);const d=!i.noBlur&&h;d&&this.blur(),!i.noHistory&&this.do.length&&this.#Se(),this.#ue=!!i.horizontal,this.#Ee(this.fo.filter(i=>!t.find(t=>t.id==i.id))),this.#Ce(t,{horizontal:i.horizontal,keepGrid:i.keepGrid,scale:i.scale,columns:i.columns}),this.#Pe();let p=0;a&&!i.noCamAni&&(i.view?this.image.camera.flyToView(i.view,{duration:1e3*c}):this.image.camera.flyToFullView({duration:1e3*c})).catch(()=>{this.#Pe(),p||e()}),this.#pe.clear(),null==i.coverLimit&&(i.coverLimit=!!this.image.$settings.limitToCoverScale);const m=i.cover&&!i.coverLimit;m&&(i.coverLimit=1,t.forEach(t=>this.uo.get(t.id)?.camera.setCoverLimit(1)));const f="appear-delayed"==i.transition,g=t=>t*this.#le+(t>0&&f?c:0);this.do=t.map((t,s)=>this.#ze(t,{duration:!i.forceAni&&d&&t.id!=h?.id?0:c,delay:o?g(s):0,noCamAni:f&&s>0?1:!!i.noCamAni,forceAreaAni:f&&s>0?0:i.forceAreaAni,cover:i.cover})),f&&this.do.slice(1).forEach(t=>{const i=t.canvas;i&&(i._e=i.Ot=.9999)});const v=()=>this.do.forEach((t,i)=>mt(o?1e3*(g(i)+(n?c/2:0)):0).then(()=>t.canvas?.Ae())),w=()=>{this.#Pe(),requestAnimationFrame(()=>r.ze=l),o&&this.fo.forEach(t=>{t.canvas&&(t.canvas.zIndex=0)}),m?t.forEach(t=>this.uo.get(t.id)?.camera.setCoverLimit(0)):i.coverLimit&&t.forEach(t=>this.uo.get(t.id)?.camera.setCoverLimit(1)),this.wo&&this.#xe(),this.lo=void 0,p=1,s(this.do)};c||u?(i.noFade||(this.#ge=setTimeout(v,Math.max(0,c/2*1e3))),this.#fe=setTimeout(w,1e3*(Math.max(u,c)+(o?(t.length-1)*this.#le:0)))):(i.noFade||v(),w())})}#Ie(){return this.do.length!==this.fo.length?1:this.do.some((t,i)=>t.id!==this.fo[i].id)}#Ce(t,i){const s=t.reduce((t,i)=>t+i.size[0]*(i.size[1]??1),0),e=i.columns??(i.horizontal?t.length:((t,i)=>{let s=Math.ceil(i/Math.ceil(Math.sqrt(i)));if(t==i){const i=Math.floor(Math.sqrt(t)),e=[];for(let h=i;s+i>h;h++)t%h||e.push(h);e.length&&(s=e[Math.floor(e.length/2)])}return s})(t.length,s));this.style.gridTemplateColumns=`repeat(${e}, auto)`;for(const a of this.vo.values())a.remove();this.vo.clear(),this.style.removeProperty("--translate"),this.style.removeProperty("--scale"),t.forEach(t=>{this.vo.has(t.id)||this.vo.set(t.id,dt("button"));const i=this.vo.get(t.id);1!==t.size[0]||void 0!==t.size[1]?(i.style.gridArea=`auto / auto / span ${t.size[1]} / span ${t.size[0]||t.size[1]}`,this.#de.set(t.id,t.size)):(i.style.removeProperty("grid-area"),this.#de.delete(t.id)),i.dataset.id=t.id,i.setAttribute("data-scroll-through",""),this.appendChild(i)}),this.classList.toggle("grid-pan-zoom","grid"==this.Mo);const h=this.classList.contains("grid-cells-hidden");h&&this.classList.remove("grid-cells-hidden"),this.micrio.events.xt("grid-layout-set",this);const o=this.micrio.offsetWidth,n=this.micrio.offsetHeight,r=Math.max(0,Math.min(1,1-(i.scale??1)));this.style.transform="",this.childNodes.forEach(i=>{const s=i,e=s.dataset.id,h=s.getBoundingClientRect(),a=t.find(t=>t.id==e),c=[r/2*h.width,r/2*h.height];a&&!a.area&&(a.area=[(h.x+c[0])/o,(h.y+c[1])/n,(h.width-2*c[0])/o,(h.height-2*c[1])/n])}),this.wo||(this.style.display="none"),h&&this.classList.add("grid-cells-hidden")}#xe(){!this.wo||this.micrio.state.$tour||this.micrio.state.$marker||(this.classList.remove("grid-cells-hidden"),this.#me=this.image.state.view.subscribe(this.#Le))}#ke(){this.#me&&this.#me(),this.classList.add("grid-cells-hidden")}#Le=()=>{const t=this.image.camera.getXY(0,0,1);this.style.setProperty("--translate",`translate3d(${t[0]}px, ${t[1]}px, 0)`),this.style.setProperty("--scale",this.image.camera.getScale().toString()),this.dispatchEvent(new CustomEvent("update"))};#ze(t,i){const{Eh:s}=this.micrio,e=this.uo.get(t.id);if(e.ot||s.Pe(e,this.image),t.area){const h=()=>e.camera.setArea(t.area,{direct:0==i.duration||!i.forceAreaAni&&!H(e.visible)});i.delay?mt(1e3*i.delay).then(h).then(()=>s.render()):h()}const h={duration:1e3*i.duration,timingFunction:this.#ve,limit:0};return i.noCamAni||e.camera.P||!e.ot||(t.view?e.camera.flyToView(t.view,h):i.cover?e.camera.flyToCoverView({...h,duration:0}):e.camera.flyToView([0,0,1,1],h)).catch(()=>{}),e}#Ee(t){const{Eh:i}=this.micrio;t.forEach(t=>{t.ot&&t.canvas?.Le(),this.vo.get(t.id)?.remove(),this.vo.delete(t.id)}),i.render()}Po(){const t=this.micrio.$current;return t==this.image||!!t&&this.uo.has(t.id)}async reset(t,i,s){const e=this.#re[0];return this.fo.forEach(t=>t.camera.stop()),this.image.camera.stop(),this._o.set([]),await R(),s||i||!this.micrio.camera?.isZoomedOut()||this.micrio.state.$tour||this.$focussed||this.#Ie()||(t=0),this.set(this.#Ae(e)??this.#_e,{noHistory:1,duration:t,noCamAni:i,forceAni:s,horizontal:e?e.horizontal:0}).then(t=>(this.#ae.set(this.#re.length=0),this.micrio.current.set(this.image),t))}async po(t,i,s){const e=t?.split("|").map(t=>t.trim()),h=e?.[0]??"",o=h?this.fo.filter(t=>!!t.$data?.markers?.find(t=>t.tags?.includes(h))):this.fo;return this.set(o.map(t=>{const i=t.$data?.markers?.find(t=>t.tags?.includes(h));return{id:t.id,size:[1],view:s?void 0:i?.view}}),{duration:i,horizontal:"h"==e?.[1]})}async back(t){const i=this.#re.pop();if(!i)return;this.#ae.set(this.#re.length),this.micrio.current.set(this.image),this.$focussed&&this.blur();const s=this.#Ae(i)??[];await this.set(s,{duration:t,noHistory:1,horizontal:i.horizontal,view:i.view})}#Ae(t){if(t?.layout?.length)return t.layout.map(t=>this.uo.has(t.id)?{id:t.id,size:t.size??[1],view:t.view}:null).filter(Boolean)}#$e(t){this.micrio.Eh.We=lt(this.#ve=t)}xo(t){const i="string"==typeof t?this.fo.find(i=>i.id==t):t;if(this.wo&&i)if(this.vo.forEach(t=>t.classList.remove("focussed")),this.vo.get(i.id)?.classList.add("focussed"),"zoom"==this.wo){const t=i.opts.area??[0,0,1,1];this.image.camera.flyToView(t,{duration:1e3*this.bo,limit:0})}else this.gridFocus(i)}async gridFocus(t,i={}){if(!t)return this.back();i.coverLimit&&(i.cover=1);const s=this.micrio;H(s.jt).find(t=>t==this.image)||s.current.set(this.image);const e=this.$focussed;if(e==t)return;i.transition?.startsWith("slide-")||0!=i.duration&&(!e||e.canvas?.$e()||this.do.includes(t))||t.camera.setArea([0,0,1,1],{noDispatch:1,direct:1}),e&&this.blur(),t.camera.setCoverLimit(!!i.cover),this.#$e("ease");const h=await(async(t,i,s,{duration:e,view:h,transition:o,noViewAni:n,exitView:r,blur:a,cover:c})=>{if(!o)return[{id:i.id,size:[1],view:h}];if("crossfade"==o&&(i.camera.setArea([0,0,1,1]),n=1),h&&n&&i.camera.setView(h,{noRender:1,noLimit:1}),!s||"crossfade"==o)return[{id:i.id,size:[1],view:h}];const l=o.startsWith("slide")||o.startsWith("swipe"),u=o.startsWith("behind"),d=l?o.endsWith("-up")?0:o.endsWith("-down")?180:o.endsWith("-left")?270:90:void 0;if(l||u){const t=i.canvas;t&&(t._e=.9999,t.Ot=.9999)}if(o.startsWith("slide"))i.camera.setArea(yi[d],{noDispatch:1,direct:1});else if(o.startsWith("swipe"))i.camera.setArea(_i[d],{noDispatch:1,direct:1});else if(u){i.camera.setArea([0,0,1,1]),i.camera.setView([0,0,1,1]);const e=[{id:s.id,size:[1],view:[0,0,1,1]},{id:i.id,size:[1],view:[0,0,1,1]}];"behind-left"==o&&e.reverse(),await t.set(e,{noBlur:1,horizontal:1,coverLimit:c}).then(()=>mt(200))}if(a&&!isNaN(a)&&a>0){const i=(e=e??t.mo??t.bo)/2,s=t.micrio.canvas.element.style;s.transition=`filter ${i}s ease`,s.filter=`blur(${a}px)`,setTimeout(()=>{s.filter="",setTimeout(()=>s.transform="",1e3*i)},1e3*i)}return o.startsWith("swipe")?[{id:s.id,size:[1],view:r??s.camera.getView(),area:bi[d]},{id:i.id,size:[1],view:h,area:[0,0,1,1]}]:[{id:i.id,size:[1],view:h}]})(this,t,e,i);return t.canvas&&(t.canvas.zIndex=3),this.yo.set(t),H(t.visible)||"crossfade"!=i.transition&&i.transition||(i.duration=0),this.set(h,{noBlur:1,duration:i.duration,forceAreaAni:"crossfade"!=i.transition,cover:!!i.cover,coverLimit:!!i.coverLimit}).then(()=>{s.events.xt("grid-focus",t),this.#ke(),s.$current!=t&&s.current.set(t),this.image.camera.setLimit([0,0,1,1])}).catch(()=>{})}blur(){const t=this.$focussed;t&&(this.vo.forEach(t=>t.classList.remove("focussed")),t.canvas&&(t.canvas.zIndex=2),this.micrio.events.xt("grid-blur"),this.yo.set(void 0),this.image.camera.setLimit([0,0,1,1]),this.micrio.current.set(this.image))}action(t,i,s){Si(this,t,i,s)}async enlarge(t,i,s=i){const e=this.#re[this.#re.length-1]?.layout,h="cover"===this.image.$settings?.initType;if(!e?.length){const e=this.#Me.fo;return e.length?this.set(e.map((e,h)=>({id:e.id,size:h==t?[i,s]:[1]})),{noHistory:1,keepGrid:1,duration:.5,cover:h}):this.do}const o=e.map((e,h)=>({id:e.id,size:h==t?[i,s]:e.size??[1]}));return this.set(o,{noHistory:1,keepGrid:1,duration:.5,cover:h})}So(t,i){const s=this.micrio.$current;if(s&&this.fo.some(t=>t===s))return s;if("grid"==this.Mo)return this.image;const[e,h]=this.image.camera.getCoo(t,i,1);return this.do.find(t=>t.opts.area&&K(e,h,t.opts.area))}};customElements.define(Ei.tag,Ei);var Ci=class{#Zs;constructor(t){this.#Zs=t}hook(){document.addEventListener("keydown",this.#Qs)}unhook(){document.removeEventListener("keydown",this.#Qs)}#Qs=t=>{if(this.#Zs.Ah||this.#Zs.Lh||!this.#Zs.Ch.$current?.camera)return;if(Ei.ko&&(t.key.startsWith("Arrow")||"Enter"==t.key||" "==t.key||"Escape"==t.key))return;const i=this.#Zs.Ch.$current.camera,s=this.#Zs.Ch.offsetWidth/2,e=this.#Zs.Ch.offsetHeight/2;let h=0,o=0;switch(t.key){case"ArrowUp":o-=e;break;case"ArrowDown":o+=e;break;case"ArrowLeft":h-=s;break;case"ArrowRight":h+=s;break;case"+":case"=":i.zoom(-200,150).catch(()=>{});break;case"-":case"_":i.zoom(200,150).catch(()=>{});break;default:return}t.preventDefault(),t.stopPropagation(),0==h&&0==o||i.pan(h,o,150)}},zi=class{#Zs;constructor(t){this.#Zs=t}hookTap(){this.#Zs.Ih.addEventListener("touchstart",this.#De)}unhookTap(){this.#Zs.Ih.removeEventListener("touchstart",this.#De)}hookClick(){this.#Zs.Ih.addEventListener("dblclick",this.#Oe)}unhookClick(){this.#Zs.Ih.removeEventListener("dblclick",this.#Oe)}#De=t=>{if(!(kt.hasTouch&&t instanceof TouchEvent))return;const i=performance.now();1==t.touches.length&&250>i-this.#Zs.Oh.Co.Eo&&(t.stopPropagation(),t.preventDefault(),this.#Oe(t)),this.#Zs.Oh.Co.Eo=i};#Oe=t=>{const i=t instanceof TouchEvent?t.touches[0]:t;this.#Zs.$h({x:i.clientX,y:i.clientY})?.camera.zoom(-300,500,i.clientX,i.clientY,1,!this.#Zs.Ch.$current?.album).catch(()=>{})}},Ii=class{Ih;enabled=Y(0);get $enabled(){return H(this.enabled)}#Us=0;Ah=0;Lh=0;Uh=0;jh=0;zh=0;Xh=1;Hh=kt.hasTouch&&"ontouchstart"in self;Wh=0;#Fe;#Ve;Oh={Dh:{Nh:void 0,Cs:[0,0,0],Fh:void 0},Co:{Eo:0},ji:{Fh:void 0,Yh:0,Bh:0}};Gh;Rh=new Map;Vh;Ch;#Ks;#Ne;#Be;#Ge;#Ye;#He;#Re;constructor(t){this.Ch=t,this.Ih=t.canvas.element,this.#Ks=new ci(this),this.#Ne=new mi(this,this.#Ks),this.#Be=new fi(this,this.#Ks),this.#Ge=new gi(this),this.#Ye=new vi(this),this.#He=new Ci(this),this.#Re=new zi(this),this.enabled.subscribe(t=>{t?this.hook():this.unhook()}),t.jt.subscribe(t=>this.#Ve=t),t.current.subscribe(t=>{t&&!this.#Fe&&(this.#Fe=t.$settings,!t.error&&this.#Fe.hookEvents&&this.enabled.set(1))})}zo(){return this.$enabled}get isNavigating(){return this.Ah||this.Lh||this.Uh}xt(t,i){this.Ch.dispatchEvent(new CustomEvent(t,void 0!==i?{detail:i}:void 0))}$h(t){if(!this.#Ve)return;const i=this.Ch.offsetWidth,s=this.Ch.offsetHeight,e=Math.max(0,Math.min(1,t.x/i)),h=Math.max(0,Math.min(1,t.y/s)),o=this.#Ve.filter(t=>!t.$t&&!t.Dt),n=this.Ch.be.find(t=>t.grid);if(n)return n.grid?.So(t.x,t.y)??this.Ch.$current;const r=1==o.length?o[0]:o.find(({grid:t,opts:{area:i}})=>t?0:i?!(e<i[0]||e>i[0]+i[2]||h<i[1]||h>i[1]+i[3]):0);return r&&!r.grid?r:this.Ch.$current}Io(){return this.#Ve}hook(){if(this.#Us)return;this.#Us=1;const t=this.#Fe;t&&(this.zh=!!t.twoFingerPan,this.zh?this.Ch.setAttribute("data-can-pan",""):this.Ch.removeAttribute("data-can-pan"),t?.hookKeys&&this.hookKeys(),t.hookDrag&&this.hookDrag(),t.noZoom||this.hookZoom())}unhook(){this.#Us&&(this.#Us=0,this.Rh.clear(),this.unhookDrag(),this.unhookZoom(),this.unhookKeys())}hookKeys(){this.#He.hook()}unhookKeys(){this.#He.unhook()}hookZoom(){const t=this.#Fe;this.jh=!!t?.controlZoom,t&&!t.hookPinch||this.hookPinch(),(!t||t.hookScroll||this.jh)&&this.hookScroll(),this.Ch.canvas.$isMobile?this.#Re.hookTap():this.#Re.hookClick()}unhookZoom(){this.unhookPinch(),this.unhookScroll(),this.Ch.canvas.$isMobile?this.#Re.unhookTap():this.#Re.unhookClick()}get scrollHooked(){return this.#Ye.hooked}hookScroll(){this.#Ye.hook()}unhookScroll(){this.#Ye.unhook()}hookPinch(){kt.iOS&&this.Hh?this.#Ne.hook():this.#Be.hook(),this.#Ge.hook()}unhookPinch(){kt.iOS&&this.Hh?this.#Ne.unhook():this.#Be.unhook(),this.#Ge.unhook()}hookDrag(){this.#Ks.hook()}unhookDrag(){this.#Ks.unhook()}},Li=class t{Lo;fo;#_;#Xe=null;#je=Y(0);#We=0;#Ue=0;constructor(t,i,s){this.#_=i,this.Lo=s;const e="switch"==s.type,h=s.isSpreads,o=h?s.coverPages??0:0;e&&(this.#Ue=Math.max(...t.map(t=>t.height)),this.#We=Math.max(...t.map(t=>t.width*(h?2:1)))),this.fo=t.map((n,r)=>{const a={...s.settings};void 0!==s.archiveLayerOffset&&(a.gallery={...a.gallery||{},archive:1,archiveLayerOffset:s.archiveLayerOffset});const c={},l=B.m(n.id)?.data;if(e){let i;c.isEmbed=1,c.useParentCamera=1,i=h?0>r-o||r==t.length-1&&(r-o)%2==0?[.25,0,.5,1]:(r-o)%2==0?[0,0,.5,1]:[.5,0,.5,1]:[0,0,1,1];let s=((t,i,s,e,h)=>{const[o,n,r,a]=t,c=r*i,l=a*s,u=Math.min(c/e,l/h),d=e*u/i,p=h*u/s;return[o+r/2-d/2,n+a/2-p/2,d,p]})(i,this.#We,this.#Ue,n.width,n.height);h&&(.5===i[0]?s[0]=.5:0===i[0]&&(s[0]=.5-s[2])),c.area=s}else c.area=[r,0,1,1];return new yt(i,{id:n.id,info:n,settings:a,data:l},c)})}static Ao(i,s){if("sc:Manifest"===i["@type"]||i.sequences)throw new _("IIIF_V2_UNSUPPORTED",{displayMessage:"Only IIIF Presentation API 3 manifests are supported"});if("Manifest"===i.type){const e=i.items?.flatMap(t=>t.items?.[0]?.items?.[0]?.body)?.filter(t=>t?.service?.[0]?.id)??[];if(!e.length)throw new _("NO_CANVASES",{displayMessage:"No valid IIIF canvases found in the manifest"});const h=e.map(t=>({id:t.service[0].id,path:t.service[0].id.replace(/\/[^/]*$/,""),version:"",width:t.width,height:t.height,isPng:"image/png"===t.format}));return 1===h.length?null:new t(h,s,{type:"swipe",settings:{}})}return null}static $o(i,s,e,h){const o=h?.basePath??e.$current?.Ct??"https://b.micr.io/",n=i.map(t=>({id:t.micrioId??t.id,path:o,version:"",width:t.width,height:t.height,isDeepZoom:t.isDeepZoom,isPng:t.isPng,isWebP:t.isWebP}));return new t(n,s,{type:"swipe",startId:h?.startId,settings:{skipMeta:1,noLogo:1}})}static async Do(i,s,e){const h=B.T(i);if(!h)return null;const o=e?.path??B.k()?.baseUrl??"https://r2.micr.io/";h.archive&&await _t.load(o,"g/"+h.archive,e?.onProgress);const n={...h,startId:e?.startId??h.startId};if(h.settings&&(n.settings={...h.settings}),"grid"===h.type&&h.archive){const t=n.grid?.clickable??n.settings?.grid?.clickable,i={zoomLimit:15,minimap:0,...n.settings??{}};t&&void 0===i.hookKeys&&(i.hookKeys=1),n.settings=i}const r=await t.#Ze(h.archive.split(".")[0],o);r&&(n.archiveLayerOffset=r.delta);const a=n.sort;return a&&r?.images&&r.images.sort(t.#qe(a)),new t((r?.images??[]).map(t=>({...t,path:o,version:""})),s,{...n,type:n.type??"swipe"})}static#Ze=async(t,i)=>_t.get(`${i}${t}.json`).then(t=>(t.images.forEach(t=>b.set(`${i}${t.id}/info.json`,t)),t));static#qe(t){return"random"==t?()=>Math.random()-.5:"name"==t?(t,i)=>t.title&&i.title?t.title<i.title?-1:t.title>i.title?1:0:0:"-name"==t?(t,i)=>t.title&&i.title?t.title<i.title?1:t.title>i.title?-1:0:0:"-created"==t?(t,i)=>t.created&&i.created?t.created<i.created?1:t.created>i.created?-1:0:0:(t,i)=>t.created&&i.created?t.created<i.created?-1:t.created>i.created?1:0:0}Oo(){const t=!!this.Lo.isSpreads,i=this.Lo.coverPages??0,s=[];if(t){let t=0;for(;t<Math.min(i,this.fo.length);t++)s.push([t]);for(;t<this.fo.length;t+=2){const i=[t];t+1<this.fo.length&&i.push(t+1),s.push(i)}}else for(let e=0;e<this.fo.length;e++)s.push([e]);return{pages:s,numPages:s.length}}Fo(t){if(this.#Xe=t,"grid"==this.Lo.type){const i=t.engine.micrio;t.grid=dt(Ei.tag,{setProps:{micrio:i,image:t,gallery:this}})}}async Vo(t){const i="switch"==this.Lo.type,s={view:[0,0,1,1],gallery:{...this.Lo},pinchZoomOutLimit:i?1:void 0};this.Lo.settings&&Object.assign(s,this.Lo.settings);const e=B.k()?.baseUrl??"https://r2.micr.io/";await t.open({id:"",info:{id:"",path:e,version:"",width:i?this.#We:t.offsetWidth*t.canvas.getRatio(),height:i?this.#Ue:t.offsetHeight*t.canvas.getRatio()},settings:s},{gallery:this})}goto(t){this.#je.set(t),this.#Xe&&this.#_.micrio.events.xt("gallery-show",t)}next(){const t=H(this.#je);this.goto(Math.min(this.fo.length-1,t+1))}prev(){const t=H(this.#je);this.goto(Math.max(0,t-1))}},Ai=navigator?.language??"en-EN",$i="Intl"in self&&Intl.DisplayNames?new Intl.DisplayNames([Ai],{type:"language"}):void 0,Di=["ar","dv","fa","he","iw","ku","ps","sd","syr","ug","ur","yi"],Oi=["en","nl","de"],Fi={No:["Close","Sluit","Schließen"],Bo:["Zoom in","Zoom in","Vergrößern"],Go:["Zoom out","Zoom uit","Verkleinern"],Yo:["Toggle fullscreen","Volledig scherm aan / uit","Vollbild umschalten"],Ho:["Switch language","Kies taal","Sprache wechseln"],Ro:["Share","Deel","Teilen"],Xo:["Mute audio","Geluid uit","Ton stummschalten"],jo:["Unmute audio","Geluid aan","Ton einschalten"],Wo:["Close this marker","Sluit deze marker","Diesen Marker schließen"],Uo:["Next step","Volgende stap","Nächster Schritt"],Zo:["Previous step","Vorige stap","Vorheriger Schritt"],qo:["Stop this tour","Stop deze tour","Tour beenden"],Jo:["Minimize","Minimaliseer","Minimieren"],Ko:["Play","Start","Abspielen"],Qo:["Pause","Pauzeer","Pause"],tn:["Stop","Stop","Stopp"],sn:["Toggle subtitles","Ondertitels aan / uit","Untertitel umschalten"],hn:["Previous image","Vorige afbeelding","Vorheriges Bild"],nn:["Next image","Volgende afbeelding","Nächstes Bild"],rn:["Toggle menu","Menu openen / sluiten","Menü umschalten"],an:["Go this way","Ga deze richting","Diesen Weg gehen"],cn:["Tours","Tours","Touren"],ln:["Marker tours","Marker tours","Marker-Touren"],un:["Video tours","Video tours","Video-Touren"]},Vi={},Ni=Object.keys(Fi);for(let pe=0;Oi.length>pe;pe++){const t={};for(const i of Ni)t[i]=Fi[i][pe];Vi[Oi[pe]]=t}var Bi=Y(Vi.en);function Gi(t){if(!t)return;const i=t.split(",").map(t=>t.trim());return i[0]?{micrioId:i[0],markerId:i[1]||void 0,follows:!!i[2]&&"false"!==i[2]}:void 0}var Yi=new Map;function Hi(t){return Yi.get(t)?.secondary}function Ri(t){for(const i of Yi.values())if(i.secondary===t)return 1;return 0}async function Xi(t,i,s,e){if(Yi.has(i))return;if(i.$t||i.grid||Ri(i))return;const h=await B.p(s.micrioId);if(!h)return;const o=new yt(t.Eh,h);t.be.push(o),t.Eh.ph(o),o.Ot=0,0!=e?.isPassive&&(o.Dt=1);const n=t.canvas.viewport.portrait;i.camera.setArea(n?[0,0,1,.5]:[0,0,.5,1]),o.camera.setArea(n?[0,1,1,0]:[1,0,0,1],{direct:1}),o.camera.setArea(n?[0,.5,1,.5]:[.5,0,.5,1]);let r=null;if(0!=e?.isPassive&&(r=i.state.view.subscribe(t=>{t&&!o.camera.P&&o.camera.setView(t,{noLimit:1})})),s.markerId){let t;t=o.data.subscribe(i=>{if(!i)return;const e=i.markers?.find(t=>t.id===s.markerId);e?.view&&o.camera.flyToView(e.view,{isJump:1}),t?.()})}Yi.set(i,{secondary:o,unsub:r}),t.events.xt("splitscreen-start",o)}function ji(t,i,s){const e=Yi.get(i);if(!e)return;Yi.delete(i),e.unsub?.();const h=t.canvas.viewport.portrait;e.secondary.camera.setArea(h?[0,1,1,0]:[1,0,0,1],{direct:1}),i.camera.setArea([0,0,1,1]),s?.keepSecondaryCanvas||setTimeout(()=>t.Eh.mh(e.secondary),400),t.events.xt("splitscreen-stop",e.secondary)}var Wi=class{el;o;to;dn=1;constructor(t,i={}){this.el=t,this.o={delay:4e3,onIdle(){},onActive(){},shouldIdle:()=>1,...i}}get idle(){return this.el.hasAttribute("data-idle")}get enabled(){return this.dn}set enabled(t){this.dn=t,t||this.pause()}activity(){this.idle&&(this.el.removeAttribute("data-idle"),this.o.onActive()),this.#Je()}show(){this.idle&&(this.el.removeAttribute("data-idle"),this.o.onActive())}hide(){this.idle||(this.el.setAttribute("data-idle",""),this.o.onIdle()),this.pause()}pause(){clearTimeout(this.to)}resume(){this.#Je()}destroy(){clearTimeout(this.to)}#Je(){clearTimeout(this.to),this.dn&&(this.to=window.setTimeout(()=>{this.o.shouldIdle()?this.idle||(this.el.setAttribute("data-idle",""),this.o.onIdle()):this.#Je()},this.o.delay))}},Ui=class extends Mi{static get observedAttributes(){return["id","muted","data-limited","lang"]}static VERSION;static tag="micr-io";#Ke=0;be=[];current=Y();jt=Y([]);#Qe;get $current(){return this.#Qe}get camera(){return this.#Qe?.camera}canvas=new hi(this);events=new Ii(this);state=new st.Main;Tt=[];kt=[];barebone=Y(0);Rt=new ei(this);Eh=new Zt(this);pn;defaultSettings;dh=Y(1);Wt=Y(0);mn=Y("1"==localStorage.getItem(z));Gt=Y();spaceData;gallery=Y();gh=0;#th;#ih=0;attributeChangedCallback(t,i,s){switch(t){case"id":if(!this.isConnected||!s)return;this.#Ke?this.open(s):this.#sh();break;case"muted":H(this.mn)!==this.hasAttribute("muted")&&this.mn.set(this.hasAttribute("muted"));break;case"data-limited":this.Eh?.ce&&this.$current?.canvas&&(this.$current.canvas.oe=!!s);break;case"lang":{let t=H(this.Gt);if(t!=s){this.Gt.set(s);const i=s.split("-")[0];Bi.set(Vi[s]??Vi[i]??Vi.en),s&&(e=s,Di.some(t=>e===t||e.startsWith(t+"-"))?this.setAttribute("dir","rtl"):this.removeAttribute("dir")),t&&this.events.xt("lang-switch",s)}break}}var e}Jh(){this.ro("micrio",this),this.canvas.place(),this.id&&!this.#Ke&&this.#sh(),"muted"in this||(Object.defineProperty(this,"muted",{get(){return H(this.mn)},set(t){t?this.setAttribute("muted",""):this.removeAttribute("muted")}}),this.eo(this.mn,t=>{this.muted=t,t?(localStorage.setItem(z,"1"),this.events.xt("audio-mute")):(localStorage.removeItem(z),this.events.xt("audio-unmute"))}));const t=()=>{const t=H(this.jt).filter(t=>t.id),i=1===t.length?t[0]:this.#Qe;this.toggleAttribute("data-zoomed",!!i?.camera&&!i.camera.isZoomedOut())};this.eo(this.current,i=>{this.#Qe=i,t()}),this.eo(this.jt,()=>t());const i=()=>t();this.kt.push(i),this.Qh(()=>{const t=this.kt.indexOf(i);0>t||this.kt.splice(t,1)});let s=0;const e=this.dh.subscribe(t=>{if(t)return;e(),this.setAttribute("data-loaded",""),this.eo(this.Wt,t=>{t?this.setAttribute("data-switching",""):(s||R().then(()=>this.events.xt("show",this)),s=1,this.removeAttribute("data-switching"))});const i=this.querySelector("img.preview");i&&setTimeout(()=>i.remove(),500)});this.#th=new Wi(this,{shouldIdle:()=>{if(document.activeElement&&this.contains(document.activeElement))return 0;const t=this.querySelectorAll("button, micrio-button");for(const i of t)if(i.matches(":hover"))return 0;return 1}});const h=()=>this.#th.activity();for(const o of["mouseover","pointerdown","wheel","focusin"])this.addEventListener(o,h,{passive:1});window.addEventListener("keydown",h),this.#th.activity()}addEventListener(t,i,s){super.addEventListener(t,i,s)}removeEventListener(t,i,s){super.removeEventListener(t,i,s)}destroy(){this.current.set(void 0),this.events.enabled.set(0),this.canvas.unhook(),this.Eh.ah(),this.pn&&this.pn.remove(),delete this.pn,this.Rt.Th(1),this.#th?.destroy(),this.#Ke=0}async#eh(t){const i=await T(t).catch(t=>{this.#hh(t)});if(!i)return;let s;try{s=Li.Ao(i,this.Eh)}catch(h){return void this.#hh(h)}if(s)return void s.Vo(this);const e=i["@id"]||i.id||t.replace(/info.json$/,"");return{id:e,info:{id:e,path:e.replace(/\/[^/]*$/,"")+"/",width:i.width,height:i.height,version:G,isIIIF:1}}}async#sh(){if(this.#Ke)return;this.#Ke=1,await R();const i=this.#oh();if(i.settings||(i.settings={}),this.defaultSettings&&t(this.defaultSettings,i.settings),i.settings.noLogo||this.#nh(!!i.settings.noUI,0),i.id&&S(i.id)&&!this.hasAttribute("width")&&!this.hasAttribute("height")){const t=await B.p(i.id).catch(()=>{});if(t&&t.info?.albumId){const s=await Li.Do(t.info.albumId,this.Eh,{startId:i.id,onProgress:t=>this.pn?.bt?.({loadingProgress:t})}).catch(()=>null);if(s)return void s.Vo(this)}}if(i.id&&i.id.startsWith("http")){const t=await this.#eh(i.id);if(!t)return;return t.settings=i.settings,void this.open(t)}this.gh=!!i.settings.keepRendering,this.events.xt("print",i);const s=()=>{i.id&&this.open(i.id)};if(void 0!==i.settings.lazyload&&"IntersectionObserver"in window){const t=new IntersectionObserver(i=>{i[0]&&i[0].isIntersecting&&(t.unobserve(this),s())},{rootMargin:100*i.settings.lazyload+"% 0px"});t.observe(this)}else i.id&&requestAnimationFrame(s)}#nh(t,i){this.pn?this.pn.bt?.({noHTML:t,noLogo:i}):this.pn=dt("micrio-main",{setProps:{noHTML:t,noLogo:i},parent:this})}#hh(t){const i=(s=t??"An unknown error has occurred")instanceof _?s.displayMessage:(s instanceof Error?s.message:s)??"An unknown error has occurred";var s;console.error("Error:",i+(t instanceof _?` (${t.code}: ${t.message})`:"")),this.pn||this.#nh(0,0),this.pn?.bt?.({error:i}),this.dh.set(0)}async open(i,s={}){this.#Ke||await this.#sh();const e=this.#oh();let h;if("string"==typeof i&&i.startsWith("http")){const t=await this.#eh(i);if(!t)return this.$current;h=t}else if("string"==typeof i){if(h=await B.p(i),!h)return this.#hh('Image with id "'+i+'" not found, published, or embeddable.'),this.$current}else h=i;if(h.settings||(h.settings={}),e.settings?.gallery?.archive&&!/\.\d+$/.test(e.settings.gallery.archive)&&delete e.settings.gallery.archive,"string"==typeof i&&t(e.settings,h.settings),this.defaultSettings&&t(this.defaultSettings,h.settings),h.settings?.gallery?.settings&&t(h.settings.gallery.settings,h.settings),t(I,h.settings,{noOverwrite:1}),this.$current&&h.id==this.$current?.id)return this.$current;this.$current&&!s.gridView&&(t=>{for(const i of[...Yi.keys()])ji(t,i)})(this),!s.gridView&&this.$current&&this.Wt.set(1),this.#nh(!!h.settings.noUI,!!h.settings.noLogo);let o=this.be.find(t=>h.id&&t.id==h.id),n=0;const r=this.be[0]?.grid;if(!o&&r){const t=h.id?r.fo.find(t=>t.id==h.id):void 0;n=!!t,o=h.id?t:this.be[0],n&&!r.Po()&&this.current.set(this.be[0])}if(!o){if(this.be.length){const t=this.be[0];h.info.path=t.Ct,h.info.lang=this.lang}this.be.push(o=new yt(this.Eh,h))}if(s.gallery&&(s.gallery.Fo(o),this.gallery.set(s.gallery)),s.startView&&(o.state.view.set(h.settings.view=s.startView),o.ot&&o.engine.ready&&o.camera.setView(h.settings.view,{noRender:1})),this.lang||(this.lang="en"),this.Eh.th(),!this.Rt.gl)try{this.Rt.Sh()}catch(a){return this.#hh(a),o}if(!this.#ih){switch(this.canvas.hook(),this.#Qe?.$settings?.theme){case"light":this.setAttribute("data-light-mode","");break;case"os":this.setAttribute("data-auto-scheme","")}this.#ih=1}R().then(()=>this.dispatchEvent(new CustomEvent("load",{detail:o})));const a=this.Eh;return a.Ie=s.vector?.direction??0,a.Se=s.vector?.distanceX??0,a.Ee=s.vector?.distanceY??0,a.Je=!s.vector,!n||s.gridView&&r?.do.find(t=>t.id==h.id)?this.current.set(o):r?.gridFocus(o,{view:h.settings?.view}).then(()=>this.current.set(o)),o.$t&&this.dh.set(0),!o.$settings.micrioSplitLink||o.$t||o.grid||R().then(()=>{this.$current===o&&Xi(this,o,{micrioId:o.$settings.micrioSplitLink},{isPassive:!o.$settings.noFollow})}),o}close(t){this.Eh.mh(t)}#oh(){const t={gallery:{}},i={settings:t,id:this.id},s=(t,i,s)=>{const e=i.split(".");for(let h=0;h<e.length-1;h++)t=t[e[h]];t[e[e.length-1]]=s},e=(e,h)=>{for(const o of Object.keys(e)){const n=e[o],r=this.getAttribute(o),a=n.f||o.replace("data-",""),c=h(r,n);void 0!==c&&s(n.r?i:t,a,c)}};return e(L,t=>t||void 0),e(A,(t,i)=>{const s=null!=t&&(""===t||"true"===t);if(s||"false"===t)return i.n?!s:!!s}),e($,(t,i)=>{if(void 0!==i.dN&&null==t&&(t=i.dN),null==t)return;const s=Number(t);return isNaN(s)?void 0:s}),e(D,t=>null!=t?t.split(",").map(Number):void 0),t.static&&(t.noUI=t.skipMeta=1,t.hookEvents=0),i}get lang(){return H(this.Gt)}set lang(t){this.setAttribute("lang",t)}};function Zi(t,i){return pt("svg",{...i,attrs:{...i?.attrs,viewBox:`0 0 ${t[0]} ${t[1]}`,fill:"currentColor"},children:[pt("path",{attrs:{d:t[2]}}),...i?.children??[]]})}var qi={down:[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"],prev:[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"],next:[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"],up:[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"],menu:[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"],error:[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"],subtitles:[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"],subtitlesOff:[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"],fullscreenLeave:[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"],fullscreenEnter:[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"],linkExt:[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"],a11y:[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"],zoomOut:[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"],playFilled:[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"],zoomIn:[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"],audio:[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"],unmuted:[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"],muted:[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"],close:[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"]},Ji=new Set(["chevronDown","linkExt"]),Ki=class extends Mi{static tag="micrio-icon";#rh="close";#ah;Jh(){this.#ch(),this.#lh()}bt(t){t.name&&(this.#rh=t.name),this.isConnected&&(this.#ch(),this.#lh())}#ch(){const t=this.co();this.#ah=t?.$current?.$settings?.ui?.icons?.[this.#rh]}#lh(){const t=this.#ah;if(t)return void(this.innerHTML=t);const i=qi[this.#rh];if(!i)return void this.replaceChildren();const s=Zi(i);Ji.has(this.#rh)&&s.classList.add("small"),this.replaceChildren(s)}};customElements.define(Ki.tag,Ki);var Qi=class extends Mi{static tag="micrio-button-group"};customElements.define(Qi.tag,Qi);var ts="100",is=80*Math.PI,ss={r:"40",cx:"50",cy:"50",fill:"transparent","stroke-width":"8px"},es=class extends Mi{static tag="micrio-progress-circle";#uh={};#dh;Jh(){const t=pt("svg",{attrs:{width:ts,height:ts,viewBox:`0 0 ${ts} ${ts}`}});pt("circle",{attrs:{...ss,stroke:"#e0e0e0"},parent:t});const i=pt("circle",{attrs:{...ss,stroke:"#00d4ee","stroke-dasharray":`${is}px`},parent:t});this.appendChild(t),this.#dh=i,this.#ph()}bt(t){Object.assign(this.#uh,t),this.isConnected&&this.#ph()}#ph(){if(!this.#dh)return;const t=this.#uh.progress??0,i=is*(1-t);this.#dh.setAttribute("stroke-dashoffset",`${i}px`)}};customElements.define(es.tag,es);var hs=class extends Mi{static tag="micrio-logo";#mh;#fh;#gh=0;Jh(){const t=this.co();if(!t)return;const i=/micr\.io/.test(location.origin)&&self.parent==self?void 0:"_blank";this.#mh=dt("a",{props:{rel:"noopener",href:"https://micr.io/",title:"Powered by Micrio"},attrs:{"aria-label":"Micrio homepage"},parent:this}),i&&(this.#mh.target=i),this.Qh(t.dh.subscribe(t=>{clearTimeout(this.#fh),t?this.#gh||(this.#fh=setTimeout(()=>{this.#gh=1,this.#vh()},750)):(this.#gh=0,this.#vh())})),this.Qh(()=>clearTimeout(this.#fh))}Kh(){clearTimeout(this.#fh)}#vh(){this.#mh&&this.#mh.classList.toggle("loading",this.#gh)}};customElements.define(hs.tag,hs);var os=class extends Mi{static tag="micrio-article";xh(){this.qh.html&&(this.innerHTML=this.qh.html)}};customElements.define(os.tag,os);var ns="micrio-captions-disable",rs=Y("1"!=localStorage.getItem(ns));rs.subscribe(t=>{t?localStorage.removeItem(ns):localStorage.setItem(ns,"1")});var as=class extends Mi{static tag="micrio-subtitles";#uh={};#wh=[];#Mh=0;#yh;#gs;Jh(){this.#gs=rs.subscribe(()=>this.#_h());const t=this.#uh.mediaEl?.querySelector("video,audio")||(this.#uh.mediaEl instanceof HTMLMediaElement?this.#uh.mediaEl:void 0);if(t){const i=()=>{this.#Mh=t.currentTime,this.#_h()};t.addEventListener("timeupdate",i);const s=this.#gs;this.#gs=()=>{s?.(),t.removeEventListener("timeupdate",i)}}this.#uh.src&&this.#ph()}bt(t){const i=void 0!==t.src&&t.src!==this.#uh.src;Object.assign(this.#uh,t),i&&this.isConnected&&this.#ph()}#ph(){this.#uh.src?(this.#wh=[],fetch(this.#uh.src).then(t=>t.text()).then(t=>{const i=t.split("\n"),s=[];for(let e=0;e<i.length;e++)if(/-->/.test(i[e])){let t=e+1;const h=[];for(;!i[t]&&t<i.length;)t++;for(;i[t]&&i[t].trim();)h.push(i[t++]);const[o,n]=i[e].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);s.push({start:o,end:n,data:h.join("\n")}),e+=h.length+1}this.#wh=s,this.#_h()}).catch(t=>console.error("micrio-subtitles: fetch error:",t))):this.replaceChildren()}#_h(){if(!H(rs)||!this.#wh.length)return this.replaceChildren(),void(this.#yh=void 0);const t=this.#wh.find(t=>t.start<=this.#Mh&&t.end>=this.#Mh);t!==this.#yh&&(this.#yh=t,this.innerHTML=t?`<p>${t.data}</p>`:"")}Kh(){this.#gs?.()}};customElements.define(as.tag,as);var cs=class extends Mi{static tag="micrio-details";#uh={};#bh;Jh(){this.co()&&(this.#bh=dt("details",{parent:this}),this.#lh())}bt(t){void 0!==t.info&&(this.#uh.info=t.info),void 0!==t.data&&(this.#uh.data=t.data),this.isConnected&&this.#lh()}#lh(){const t=this.#uh.info,i=this.#uh.data,s=this.co(),e=s?H(s.Gt):void 0,h=s?H(s.current):void 0;if(!t||!e||!h)return;const o=i?.i18n?i.i18n[e]:i,n=o?.title??t.title??"",r=o?.description,a=o?.sourceUrl,c=o?.copyright;(n||r||a)&&(this.#bh.replaceChildren(),n&&dt("summary",{children:[dt("span",{textContent:n})],parent:this.#bh}),r&&dt("div",{innerHTML:r,parent:this.#bh}),a&&dt("p",{parent:this.#bh,children:[dt("a",{props:{href:a,target:"_blank",rel:"noopener noreferrer"},textContent:c||a})]}))}};customElements.define(cs.tag,cs);var ls=class extends Mi{static tag="micrio-error";xh(){this.replaceChildren(),dt("div",{parent:this,children:[dt("micrio-icon",{setProps:{name:"error"}}),dt("span",{textContent:this.qh.message??"An unknown error has occurred"})]})}};customElements.define(ls.tag,ls);var us=class extends Mi{static tag="micrio-controls";#uh={};#kh=0;#xh=0;#Th=0;#Ph=0;#Sh="";#Eh=()=>{const t=this.co();t&&t.mn.set(!H(t.mn))};#Ch=()=>{const t=this.co();if(t&&navigator.share&&t.$current?.$info){const i=t.$current.$data?.i18n?.[H(t.Gt)];navigator.share({title:t.$current.$info?.title,text:i?.description||`${t.$current.$info.width} x ${t.$current.$info.height} | Micrio`,url:location.href})}};#zh=t=>{this.co().lang=t};#Ih;#Lh;#Ah;#$h;#Dh;#Oh;#Fh;#Vh;Jh(){const t=this.co();if(!t)return;const{state:i,Gt:s}=t,{tour:e,popup:h}=i,o=t=>{this.#xh=!!t.ui?.controls?.cultureSwitch,this.#Th=!!t.social,void 0!==t.fullscreen&&(this.#Ph=!!t.fullscreen),this.#Nh()};let n;t.$current&&o(t.$current.$settings),this.Qh(t.current.subscribe(t=>{if(t){if(H(e)&&"steps"in H(e))return;n?.(),n=t.Pt.subscribe(o)}})),this.ho(e,()=>this.#Nh()),this.ho(h,()=>this.#Nh()),this.ho(s,()=>this.#Nh()),this.ho(t.mn,()=>this.#Nh());const r=new MutationObserver(()=>this.#Nh());r.observe(t,{attributes:1,attributeFilter:["class"]}),this.Qh(()=>r.disconnect()),this.#Bh(),this.#Nh()}bt(t){Object.assign(this.#uh,t)}#Bh(){this.#kh||(this.#Ih=dt("aside",{parent:this}),this.#kh=1)}#Nh(){if(!this.#kh||!this.isConnected)return;const t=this.co();if(!t)return;const i=H(Bi),s=H(t.mn),e=H(t.Gt),h=t.$current,o=!(h?.$settings)?.noZoom,n=H(t.state.popup),r=h?.$info,a=r?.revision?Object.keys(r.revision):[],c=t.canvas.$isMobile,l=!(!("micrioAudioContext"in window)&&!this.#uh.hasAudio),u=this.#xh&&a.length>1,d=this.#Th&&"share"in navigator,p=l||u||d||o||this.#Ph,m=this.#Ph&&!!n&&c,f=o&&!m&&!(h?.grid&&"cells"==h?.$settings?.grid?.panZoom),g=l||f||this.#Ph;if(n&&c||!p)this.#Ih.replaceChildren();else{if(u&&!m){this.#$h?.isConnected||(this.#$h?.remove(),this.#Dh=void 0,this.#Sh="",this.#$h=dt("menu",{attrs:{tabindex:"0"},children:[dt("micrio-button"),this.#Dh=dt("div")]}),this.#Ih.insertBefore(this.#$h,this.#Ah?.isConnected?this.#Ah:null)),this.#$h.querySelector("micrio-button")?.bt({type:"a11y",title:i.Ho});const t=this.#Dh,s=a.join(",");if(s!==this.#Sh){this.#Sh=s,t.replaceChildren();for(const i of a)dt("micrio-button",{setProps:{title:$i?.of(i)??i,onclick:()=>{this.#zh(i)}},children:[i.toUpperCase()],parent:t})}const h=t.querySelectorAll(":scope > micrio-button");for(let i=0;i<h.length;i++){const t=h[i].querySelector("button, a");t&&t.classList.toggle("active",a[i].toLowerCase()===e.toLowerCase())}}else this.#$h?.isConnected&&this.#$h.remove();d&&!m?(this.#Ah?.isConnected||(this.#Ah?.remove(),this.#Ah=dt("micrio-button"),this.#Ih.insertBefore(this.#Ah,this.#Oh?.isConnected?this.#Oh:null)),this.#Ah.bt({type:"share",title:i.Ro,onclick:this.#Ch})):this.#Ah?.isConnected&&this.#Ah.remove(),g?(this.#Oh?.isConnected||(this.#Oh?.remove(),this.#Oh=dt("micrio-button-group",{parent:this.#Ih})),l?(this.#Lh?.isConnected||(this.#Lh?.remove(),this.#Lh=dt("micrio-button"),this.#Oh.prepend(this.#Lh)),this.#Lh.bt({type:s?"muted":"unmuted",title:s?i.jo:i.Xo,onclick:this.#Eh})):this.#Lh?.isConnected&&this.#Lh.remove(),f?this.#Fh?.isConnected||(this.#Fh?.remove(),this.#Fh=dt("micrio-zoom-buttons"),this.#Vh?.isConnected?this.#Oh.insertBefore(this.#Fh,this.#Vh):this.#Oh.appendChild(this.#Fh)):this.#Fh?.isConnected&&this.#Fh.remove(),this.#Ph?(this.#Vh?.isConnected||(this.#Vh?.remove(),this.#Vh=dt("micrio-fullscreen",{parent:this.#Oh})),this.#Vh.bt({el:t})):this.#Vh?.isConnected&&this.#Vh.remove()):this.#Oh?.isConnected&&this.#Oh.remove()}}};customElements.define(us.tag,us);var ds=class extends Mi{static tag="micrio-fullscreen";#uh={};#Gh=0;#pt=0;#Yh=()=>{const t=this.#uh.el;t&&(this.#Gh?document.exitFullscreen():t.requestFullscreen())};Jh(){this.#uh?.el&&this.#Hh()}bt(t){void 0!==t.el&&(this.#uh.el=t.el,this.isConnected&&!this.#pt&&this.#Hh())}#Hh(){if(this.#pt)return;this.#pt=1;const t=this.#uh.el;if(!("requestFullscreen"in t))return;this.#Gh=document.fullscreenElement===t;const i=this.co(),s=i&&t==i&&!i.events.scrollHooked,e=()=>{this.#Gh=document.fullscreenElement===t,s&&(this.#Gh?i.events.hookScroll():i.events.unhookScroll()),this.#Rh()};document.addEventListener("fullscreenchange",e),this.Qh(()=>document.removeEventListener("fullscreenchange",e)),this.#Rh()}#Rh(){this.replaceChildren();const t=H(Bi);dt("micrio-button",{setProps:{type:this.#Gh?"fullscreenLeave":"fullscreenEnter",title:t.Yo,onclick:this.#Yh},parent:this})}};customElements.define(ds.tag,ds);var ps=class extends Mi{static tag="micrio-zoom-buttons";#Xh;#jh;Jh(){const t=this.co();if(!t)return;const i=()=>{const i=H(t.jt).filter(t=>t.id);return 1===i.length?i[0]:t.$current};this.#Xh=dt("micrio-button",{parent:this}),this.#Xh.bt({type:"zoomIn",onclick:()=>i()?.camera.zoomIn()}),this.#jh=dt("micrio-button",{parent:this}),this.#jh.bt({type:"zoomOut",onclick:()=>i()?.camera.zoomOut()});const s=()=>{const t=i(),s=H(Bi);this.#Xh.bt({title:s.Bo,disabled:t?.camera.isZoomedIn()??1}),this.#jh.bt({title:s.Go,disabled:t?.camera.isZoomedOut()})};this.Qh(t.current.subscribe(()=>s())),this.Qh(t.jt.subscribe(()=>s()));const e=()=>s();t.kt.push(e),this.Qh(()=>{const i=t.kt.indexOf(e);0>i||t.kt.splice(i,1)}),s()}};function ms(t){if("string"==typeof t)return t;let i=0,s=Math.max(t.width,t.height);for(;s>1024;)i++,s/=2;return t.micrioId&&t.width>1024?"https://r2.micr.io/"+t.micrioId+"/"+i+"/0-0."+(t.isPng?"png":t.isWebP?"webp":"jpg"):t.src}customElements.define(ps.tag,ps);var fs=class extends Mi{static tag="micrio-logo-org";#uh={organisation:null};Jh(){this.co()&&this.#lh()}bt(t){void 0!==t.organisation&&(this.#uh.organisation=t.organisation),this.isConnected&&this.#lh()}#lh(){const t=this.#uh.organisation;t?.logo?(this.replaceChildren(),dt("a",{props:{rel:"noopener",href:t.href??"#",title:t.name??"",target:"_blank"},attrs:{"aria-label":`${t.name} homepage`},children:[dt("img",{props:{src:ms(t.logo),alt:"Logo"}})],parent:this})):this.replaceChildren()}};function gs(t,i){const s=t.$current;if(!s)return;const e=t.spaceData?.images.find(t=>t.id==s.id),h=t.spaceData?.images.find(t=>t.id==i);if(!e||!h)return;const o=[(h.x??.5)-(e.x??.5),(e.y??.5)-(h.y??.5),(h.z??.5)-(e.z??.5)];let n=o[0]*o[0]+o[1]*o[1]+o[2]*o[2];n>0&&(n=1/Math.sqrt(n));const r=[o[0]*n,o[1]*n,o[2]*n],a=W(Math.atan2(-r[0],r[2])/Math.PI/2);return{v:o,vN:r,directionX:a,vector:{direction:a%1,distanceX:Math.max(0,Math.min(.4,Math.sqrt(r[0]*r[0]+r[2]*r[2]))),distanceY:-o[1]}}}customElements.define(fs.tag,fs);var vs=class extends Mi{static tag="micrio-waypoint";#uh={targetId:"",image:null};#Wh=0;#Uh=0;#Zh;#qh;#Jh;#Kh;#Qh;#Oe;#to;Jh(){this.#io(),this.#lh()}bt(t){void 0!==t.targetId&&(this.#uh.targetId=t.targetId),void 0!==t.image&&(this.#uh.image=t.image),void 0!==t.settings&&(this.#uh.settings=t.settings),this.isConnected&&(this.#io(),this.#lh())}#io(){const{targetId:t,image:i,settings:s}=this.#uh;if(!i||!t)return;const e=this.co();if(!e)return;const h=i.$info,o=gs(e,t);if(!o)return void console.error(`[Micrio] Could not calculate vector for target ${t}`);const{directionX:n,v:r,vN:a,vector:c}=o;this.#Qh=c;const l=.3>Math.abs(a[1]),u=l?.65:.5+a[1]/10,d={x:n,y:u,baseScale:h.width/1024,scale:1,rotX:(1+(l?-(1-u):a[1]))*Math.PI/2,rotY:0,rotZ:0},p=s?.coords??structuredClone(d),m=p.custom;this.#qh=m?p:d,this.classList.toggle("direction-up",0>r[1]),this.classList.toggle("direction-down",r[1]>0);const f=()=>{this.#Uh||(this.style.transform=`matrix3d(${i.camera.getMatrix(this.#qh.x,this.#qh.y,this.#qh.baseScale*this.#qh.scale,1,this.#qh.rotX,this.#qh.rotY,this.#qh.rotZ,0,1,1,1).join(",")})`)},g=this;this.#Jh={coords:p,settings:s??{},click(){},get deleted(){return 0},set deleted(t){t&&(g.#Uh=1)}},f(),this.Qh(i.state.view.subscribe(f)),B.u(t).then(t=>{t&&(this.#Zh=t),this.#lh()}),e.dispatchEvent(new CustomEvent("wp-print",{detail:this.#Jh})),this.#Oe=()=>{i.$settings.t?.noMarkerActions||(this.#Wh=1,i.St=void 0,i.state.marker.set(void 0),e.open(t,{vector:this.#Qh}))},this.#to=()=>{i.$settings.t?.noMarkerActions||(this.parentNode?.scrollTo(0,0),clearTimeout(this.#Kh),this.#Kh=setTimeout(()=>{const t=i.camera.getXY(this.#qh.x,this.#qh.y);!this.#Wh&&(0>t[0]||t[0]>=e.offsetWidth||0>t[1]||t[1]>=e.offsetHeight||i.I&&t[3]>4)&&i.camera.flyToCoo([this.#qh.x,this.#qh.y],{speed:2,limit:1}).catch(()=>{})},150))}}#lh(){if(this.#Uh)return void(this.style.display="none");const{settings:t}=this.#uh,i=this.co(),s=i?H(i.Gt):"en",e=H(Bi),h=i?.spaceData,o=t?.i18n?.[s]?.title||this.#Zh?.i18n?.[s]?.title,n=h?.icons?.[t?.customIconIdx??-1];this.classList.toggle("clicked",this.#Wh),this.replaceChildren(),dt("micrio-button",{setProps:{type:n?void 0:"up",icon:n||void 0,title:o??e.an,onclick:this.#Oe,onfocus:this.#to},parent:this})}Kh(){clearTimeout(this.#Kh)}};customElements.define(vs.tag,vs);var ws=class extends Mi{static tag="micrio-marker-content";fn;xh(){const{marker:t,noEmbed:i=0,noImages:s=0,noGallery:e=0,onclose:h}=this.qh;if(!t)return;const o=this.co(),n=Mi.Zh,r=t.id?n.get(t.id):void 0;if(!o||!r)return;const a=H(o.Gt),c=`${t.id}::${a}::${i}::${s}::${e}`;if(!this.io(c))return;const l=H(o.state.tour),u=l&&"steps"in l&&l.isSerialTour,d=r.$settings.t??{},p=!d.preventAutoPlay,m=t.i18n?.[a],f=1==t.images?.length,g=!t.data?.preventImageOpen&&!e,v=r.Nt?.includes("micrio.dev"),w=f&&t.images?.[0]?.i18n?.[a]?.description,M=t=>t.i18n?.[a]?.title,y=()=>{l&&"steps"in l&&(l.isSerialTour||d.tourAutoProgress)&&h?.()};if(m){if(this.replaceChildren(),m.title){const t=dt("h1",{textContent:m.title,parent:this});this.fn=t}if(m.body&&d.primaryBodyFirst&&dt("micrio-article",{setProps:{html:m.body},parent:this}),!u&&(!m.embedUrl&&t.videoTour||m.audio)){const i=(t.videoTour?.i18n?.[a]?.audio??m?.audio)?.src,s=!p||!t?.audioAutoPlay;dt("micrio-media",{setProps:{src:i,noPlayOverlay:1,image:r,uuid:t.id,tour:t.videoTour,autoplay:t.audioAutoPlay||!m.audio&&!!t.videoTour,controls:!t.videoTour||!m.embedUrl,onended:y,paused:s},parent:this})}if(!s&&t.images?.length){const i=dt("section");for(const s of t.images){const e=dt("button",{props:{title:M(s)??"",disabled:!g},events:g?{click(){return i=s.micrioId,void(g&&o.state.popover.set({gallery:t.images,galleryStart:i,image:r}));var i}}:void 0}),h=dt("figure");dt("img",{props:{alt:M(s)??"",src:s.micrioId?`https://iiif.${v?"micrio.dev":"micr.io"}/${s.micrioId}/full/${f?"^"+Math.min(s.width,640)+",":"^,320"}/0/default.webp`:s.src},parent:h}),w&&dt("figcaption",{textContent:w,parent:h}),e.appendChild(h),i.appendChild(e)}this.appendChild(i)}if(m.embedUrl&&!i){!m.audio&&t.videoTour&&dt("micrio-media",{setProps:{image:r,className:"hidden",uuid:t.id,tour:t.videoTour,autoplay:p,secondary:1},parent:this});const i=0==t?.embedAutoPlay||!p||!(!m?.audio||!t?.audioAutoPlay);dt("micrio-media",{setProps:{image:r,src:m.embedUrl,uuid:t.id,width:400,height:240,controls:1,title:m.embedTitle,figcaption:m.embedDescription,autoplay:!i,onended:y,paused:i},parent:this})}m.body&&!d.primaryBodyFirst&&dt("micrio-article",{setProps:{html:m.body},parent:this}),m.bodySecondary&&dt("micrio-article",{setProps:{html:m.bodySecondary},parent:this})}else this.replaceChildren()}};customElements.define(ws.tag,ws);var Ms=Y(void 0),ys=0;function _s(){Ms.set(void 0)}Ms.subscribe(t=>{t?ys||window.addEventListener("click",_s):ys&&window.removeEventListener("click",_s),ys=!!t});var bs=class extends Mi{static tag="micrio-menu";#uh={menu:null,originalId:null};#so;Jh(){const{menu:t}=this.#uh,i=this.co();if(!i)return;const{Gt:s}=i;1!==t.children?.length||this.#eo(t,H(s))?.title||(this.#uh.menu=t.children[0]),this.#ho(),this.#lh(),this.eo(Ms,()=>this.classList.toggle("opened",this.#oo(this.#uh.menu))),this.no(s,X(j(()=>{this.#ho(),this.#lh()})))}#ho(){const{menu:t,originalId:i}=this.#uh,s=this.co();if(!s)return;const{events:e,state:h,Gt:o}=s,n=this.#eo(t,H(o)),r=t;this.#so=void 0,t.action?this.#so=t.action:t.markerId?this.#so=()=>{i&&s.$current?.id!=i&&s.open(i),s.$current?.state.marker.set(t.markerId)}:(n?.content||n?.embed||t.image||r.content||r.embedUrl||n?.title&&!t.children?.length&&!t.link&&!t.markerId)&&(this.#so=()=>{e.xt("page-open",t),h.popover.set({contentPage:t})})}bt(t){Object.assign(this.#uh,t)}#eo(t,i){return t.i18n?.[i]??t}#oo(t){const i=H(Ms);if(!i)return 0;const s=t=>t===i||!!t.children?.some(s);return s(t)}#lh(){const{menu:t,originalId:i,onclose:s}=this.#uh,e=this.co();if(!e)return;const h=H(e.Gt),o=this.#eo(t,h);this.replaceChildren(),this.classList.toggle("opened",this.#oo(t)),this.setAttribute("data-title",o?.title?.toLowerCase()??"");const n=i=>{t.link||i.preventDefault(),t.children?.length&&i.stopPropagation(),this.#so?.();const e=!!(this.#oo(t)||this.#so||t.link);Ms.set(e?void 0:t),(this.#so||t.link)&&s?.()};if(t.link){const i=dt("a",{props:{href:t.link},events:{click:n},children:[dt("strong",{textContent:o?.title??"(Unknown)",children:[dt("micrio-icon",{setProps:{name:t.linkTargetBlank?"linkExt":"link"},style:{opacity:".75"}})]})],parent:this});t.linkTargetBlank&&(i.target="_blank")}else{const i=[o?.title??"(Unknown)"];t.children?.length&&i.push(dt("micrio-icon",{setProps:{name:"chevronDown"}}));const s=[dt("strong",{children:i})];t.icon&&s.unshift(Zi(t.icon,{style:"height:1em;vertical-align:-.125em;margin-right:10px"})),dt("button",{props:{type:"button"},events:{click:n},children:s,parent:this})}t.children?.length&&dt("div",{parent:this,children:t.children.map(t=>dt("micrio-menu",{setProps:{menu:t,originalId:i,onclose:_s}}))})}};customElements.define(bs.tag,bs);var ks=class extends Mi{static tag="micrio-toolbar";#x;#no=0;#ro=0;#Yh=()=>{this.#no=!this.#no,this.#lh()};Jh(){const t=this.co();if(!t)return;const{Gt:i}=t;this.#ro=500>=window.innerWidth;const s=()=>{this.#ro=500>=window.innerWidth,this.#ro||(this.#no=0),this.#lh()};this.#lh(),this.Qh(t.current.subscribe(t=>{t&&(this.Qh(t.data.subscribe(t=>{this.#x=t,this.#lh()})),this.Qh(t.Pt.subscribe(()=>this.so?.())))})),this.Qh(t.state.tour.subscribe(()=>this.#lh())),this.Qh(t.state.marker.subscribe(()=>this.#lh())),this.Qh(t.state.popover.subscribe(()=>this.#lh())),this.Qh(i.subscribe(()=>this.#lh())),window.addEventListener("resize",s),this.Qh(()=>window.removeEventListener("resize",s))}#lh(){if(!this.#x)return;const t=this.co();if(!t)return;const{Gt:i,spaceData:s,state:e}=t,h=H(i),o=H(e.tour),n=H(e.marker),r=H(e.popover),a=H(Bi),c=t.$current?.id,l=t=>!!t.i18n?.[h],u=!!o||!!n||!!r,d=(this.#x?.markerTours??[]).concat(s?.markerTours??[]).filter(l),p=d.length>0,m=this.#x?.tours?.filter(l)??[],f=m.length>0,g=p&&f,v=this.#x?.pages?this.#x.pages.filter(t=>!t.id?.startsWith("_")&&(t=>!!t.i18n?.[h])(t)).concat(this.#x.pages.filter(t=>t.id?.startsWith("_"))):void 0,w=!(v?.length||p||f),M=[(v||[]).map(t=>t.id).join(","),d.map(t=>t.id).join(",")+"|"+m.map(t=>t.id).join(","),u,h,this.#ro,this.#no].join("::");if(!this.io(M))return;if(w||u)return void this.replaceChildren();this.replaceChildren(),this.#ro&&this.#no&&dt("div",{className:"backdrop",events:{click:this.#Yh},parent:this});const y=dt("menu",{className:(this.#ro&&this.#no?"shown":"")||void 0}),_=()=>{this.#ro&&(this.#no=0,this.#lh())};if(v)for(const b of v)dt("micrio-menu",{setProps:{menu:b,originalId:c,onclose:_},parent:y});p&&dt("micrio-menu",{setProps:{onclose:_,menu:{id:"marker-tours",i18n:{[h]:{title:g?a.ln:a.cn}},children:d.map(t=>({id:t.id??E(),i18n:{[h]:{title:t.i18n?.[h]?.title??"(Untitled)"}},action(){t.initialStep=0,e.tour.set(t)}}))}},parent:y}),f&&dt("micrio-menu",{setProps:{onclose:_,menu:{id:"video-tours",i18n:{[h]:{title:g?a.un:a.cn}},children:m.map(i=>({id:i.id??E(),i18n:{[h]:{title:i.i18n?.[h]?.title??"(Untitled)"}},action(){t.$current&&t.$current.id!=c&&t.open(c),e.tour.set(i)}}))}},parent:y}),this.appendChild(y),this.so?.(),this.#ro&&dt("micrio-button",{setProps:{title:a.rn,type:this.#no?"close":"ellipsisVertical",className:"transparent"+(this.querySelector("menu.indent")?" indent":"")||void 0,onclick:this.#Yh},parent:this})}so(){const t=this.querySelector("menu");if(t){const i=!this.co()?.$current?.$settings?.noLogo;t.classList.toggle("indent",i)}}};customElements.define(ks.tag,ks);var xs,Ts,Ps=class{#Rs;#ao;#co;#lo;#uo;#gs;constructor(t,i,s,e){this.#Rs=t,this.#Hh(i,s,e)}#Hh(t,i,s){const e=this.#Rs.$current.$info;if(!e)return;const h=e.width,o=e.height,n=t.positionalAudio;if(!n)return;this.#ao=i.createGain(),this.#co=i.createPanner(),this.#co.panningModel="equalpower",this.#co.rolloffFactor=1,this.#co.coneOuterGain=0;const r=()=>{if(this.#ao.gain.value=n.volume??1,s){this.#co.refDistance=2.75*n.radius,this.#co.maxDistance=n.radius*(11/3);const i=t.x*-Math.PI*2,s=(t.y-.5)*-Math.PI,e=Math.cos(s)*Math.sin(i)*11,h=11*Math.sin(s),o=Math.cos(s)*Math.cos(i)*11;this.#co.positionX.value=e,this.#co.positionY.value=h,this.#co.positionZ.value=o;const[r,a,c]=tt(e,h,o);this.#co.orientationX.value=r,this.#co.orientationY.value=a,this.#co.orientationZ.value=c}else this.#co.distanceModel="linear",this.#co.positionX.value=2*(t.x-.5),this.#co.positionY.value=2*(.5-t.y)*(o/h),this.#co.positionZ.value=-.2,this.#co.rolloffFactor=2,this.#co.refDistance=n.radius*n.radius*10,this.#co.maxDistance=5*n.radius},a=()=>{this.#lo&&this.#lo.disconnect(),this.#lo=i.createBufferSource(),n.loop&&(n.repeatAfter>0?this.#lo.onended=()=>{this.#uo=setTimeout(a,1e3*n.repeatAfter)}:this.#lo.loop=1),this.#ao.gain.value=n.volume??1,this.#lo.buffer=window.__micrioAudioBuffers?.[n.src]??null,this.#lo.buffer&&(this.#lo.connect(this.#co),this.#lo.start())};r(),this.#co.connect(this.#ao),this.#ao.connect(xs??i.destination),(async()=>{if(!n.src)return;const t=window.__micrioAudioBuffers||{};t[n.src]||(t[n.src]=await fetch(n.src).then(t=>t.arrayBuffer()).then(t=>i.decodeAudioData(t)),window.__micrioAudioBuffers=t),n.alwaysPlay&&n.repeatAfter>0?this.#uo=setTimeout(a,1e3*n.repeatAfter):a()})(),this.#Rs.addEventListener("audio-update",r),this.#gs=()=>this.#Rs.removeEventListener("audio-update",r)}#se(){this.#lo&&this.#lo.disconnect(),clearTimeout(this.#uo),this.#co.disconnect(),this.#ao.disconnect()}destroy(){this.#gs?.(),this.#se()}},Ss=null,Es=Y(0);function Cs(t,i,s){Ts&&(Ts.setPosition?Ts.setPosition(t,i,s):"positionX"in Ts&&(Ts.positionX.value=t,Ts.positionY.value=i,Ts.positionZ.value=s))}function zs(t,i,s){Ts&&(Ts.setOrientation?Ts.setOrientation(t,i,s,0,1,0):"forwardX"in Ts&&(Ts.forwardX.value=t,Ts.forwardY.value=i,Ts.forwardZ.value=s))}var Is=class{#do=new Audio;#po;#mo;#fo=-1;constructor(t,i,s){this.#po=t,this.#mo=i,this.#do.preload="none",this.#do.loop=0,this.#do.volume=s,this.#do.onended=()=>this.#go(),this.#go()}#go(){if(!this.#mo&&this.#fo+1===this.#po.length)return;const t=this.#po[++this.#fo%this.#po.length];this.#do.src=t.src??"",this.#do.play()}destroy(){this.#do.pause()}},Ls=class{#Rs;#d;#vo;#wo=[];#Mo=[];constructor(t,i){this.#Rs=t,this.#d=i,this.#Hh()}#yo(t){for(const h of this.#Mo)h.destroy();if(this.#Mo=[],!Ss||!t)return;const i=t.$info;if(!i)return;const s=!!i.is360,e=t.$data?.markers?.filter(t=>!!t.positionalAudio);if(e?.length)for(const h of e)this.#Mo.push(new Ps(this.#Rs,h,Ss,s))}#Hh(){const t=this.#Rs,i=this.#d,{events:s}=t,e=i.$info;if(!e)return;const h=!!e.is360,o=e.height/e.width;if(!("AudioContext"in window))return;const n=()=>Es.set(1),r=()=>{"suspended"===Ss?.state?Ss.resume().then(()=>{}).catch(()=>{}):Ss||n()},a=new Audio("data:audio/mpeg;base64,...");a.volume=kt.iOS?0:1e-4,document.body.appendChild(a),this.#wo.push(Es.subscribe(s=>{if(!s)return;const e=H(t.mn)?0:1;Ss||(t=>{if(!xs){if(Ss||(Ss="micrioAudioContext"in window?window.micrioAudioContext:new AudioContext),!Ss)return console.warn("[Micrio] Your browser does not support the Web Audio API");"suspended"===Ss.state&&Ss.resume().then(()=>{}).catch(()=>{}),(xs=Ss.createGain()).connect(Ss.destination),xs.gain.value=t,"upX"in(Ts=Ss.listener)&&(Ts.upX.value=0,Ts.upY.value=1,Ts.upZ.value=0)}})("number"==typeof e?e:1),Ss&&(i.$data?.markers?.filter(t=>!!t.positionalAudio).length&&this.#wo.push(i.state.view.subscribe(t=>{if(!t)return;const s=Math.max(0,1.05-i.camera.getScale());((t,i,s)=>{if(h){t*=2*-Math.PI,i-=.5,i*=-Math.PI;const e=10*(1-s),h=Math.cos(i)*Math.sin(t)*e,o=Math.sin(i)*e,n=Math.cos(i)*Math.cos(t)*e;Cs(h,o,n);const[r,a,c]=tt(h,o,n);zs(r,a,c)}else Cs(2*(t-.5),2*(.5-i)*o,s),zs(0,0,-1)})(t[0]+t[2]/2,t[1]+t[3]/2,s*(h?1:1.5))})),this.#yo(t.$current))})),this.#wo.push(t.current.subscribe(t=>{t&&Ss&&this.#yo(t)})),Ss||(a.play().then(n).catch(()=>s.xt("autoplay-blocked")),addEventListener("pointerup",r,{once:1}));const c=i.$data;if(c?.music?.items.length){const i=H(t.mn)?0:1;this.#vo=new Is(c.music.items,c.music.loop??1,i*(c.music.volume??1))}this.#wo.push(t.mn.subscribe(t=>{xs&&(xs.gain.value=t?0:1)})),this.#wo.push(()=>{Ss&&(a.remove(),removeEventListener("pointerup",r))})}destroy(){for(const t of this.#Mo)t.destroy();this.#Mo=[];for(const t of this.#wo)t();this.#wo=[],this.#vo?.destroy()}},As=class{#_o=[];#je;#bo;#fe;#ko=1;#xo=0;#Z;#To=0;#Po;#So=0;#Eo;#Rs;#d;#x;constructor(t,i){this.#d=t,this.#x=i,this.#Rs=t.engine.micrio;const s=i.i18n?.[H(this.#Rs.Gt)];if(!s)throw new Error("No valid content for video tour!");this.#Eo=s,this.#So=!i.keepInteraction&&this.#Rs.events.$enabled,i.instance=this,this.read(),this.#Co(),this.#Rs.events.xt("videotour-start",this.#x)}destroy(){this.#So&&this.#Rs.events.enabled.set(1),this.#zo(),this.#Rs.removeAttribute("data-tour-active"),clearTimeout(this.#fe),this.#xo&&(this.#d.camera.stop(),this.#xo=0),this.#Rs.events.xt("videotour-stop",this.#x),this.#Po=void 0,this.#x.instance=void 0,this.#bo=void 0}read(){const t=this.#Eo.timeline;this.#_o=[];for(let i=0;i<t.length;i++){const s=t[i],e=t[i-1],h=e?e.end:0;this.#_o.push({view:s.rect,start:1e3*h,duration:1e3*(s.start-h),pauseDuration:1e3*(s.end-s.start)})}this.#Po&&!this.#xo&&(this.progress=this.currentTime)}#Co(){const t=this.#Eo.events;if(!t?.length)return;const i=this.duration;for(const s of t)s.start=Number(s.start||0),s.end=Math.min(Number(s.end||0),i)}#zo(){const t=this.#Eo.events;if(t?.length)for(const i of t)i.active&&(i.active=0,this.#Rs.events.xt("tour-event",{...i}))}updateEvents(t){const i=this.#Eo.events;if(i?.length)for(const s of i){const i=s.start<=t&&s.end>=t;i!=!!s.active&&(s.active=i,this.#Rs.events.xt("tour-event",{...s}))}}get duration(){return Number(this.#Eo.duration)}set duration(t){this.#Eo.duration=t}get paused(){return this.#ko}get ended(){return this.currentTime>=this.duration}get currentTime(){return(this.#Z??(this.#Po?Date.now()-this.#Po:0))/1e3}set currentTime(t){this.#Io(t/this.#Eo.duration)}get progress(){return this.currentTime/this.#Eo.duration}set progress(t){this.#Io(t)}play(){this.#Lo(),this.#To=0,this.#Z?(this.#Po=Date.now()-this.#Z,this.#ko=0,this.#Ao(this.#Z),this.#Z=void 0):this.#xo||(this.#Po=Date.now(),void 0===this.#bo?this.#$o(0,0):this.#Ao(this.duration*this.#bo*1e3),this.#bo=void 0),this.#ko=0,this.#xo=1}pause(){this.#ko||null==this.#je||null==this.#Po||(this.#ko=1,this.#Do(),clearTimeout(this.#fe),0>this.#je||this.#d.camera.stop(),this.ended?this.#us():this.#Z=Date.now()-this.#Po)}#us(){this.#Do(),this.#Z=void 0,this.#xo=0,this.read()}#$o(t,i){if(null==this.#Po)return;if(clearTimeout(this.#fe),!this.#_o[t]){if(!this.paused||!this.#To){const t=Math.max(0,Math.round(1e3*this.duration-(Date.now()-this.#Po)));t>0&&(this.#fe=setTimeout(()=>this.pause(),t))}return}const s=this.#_o[t],e=Math.round(s.start-(Date.now()-this.#Po));this.#je=t,this.#d.camera.stop(),e>0?this.#ko||(this.#fe=setTimeout(()=>this.#Oo(i),e)):this.#Oo(i)}#Fo(){null!=this.#je&&this.#$o(this.#je+1)}#Oo(t=0){if(null==this.#je||isNaN(t))return;const i=this.#_o[this.#je];if(!i)return;const s=this.#_o[this.#je-1]?.view;if(this.#To&&s){const e=ot.get(t),h=J(s),o=J(i.view);this.#d.camera.setView([h.centerX*(1-e)+o.centerX*e-(h.width*(1-e)+o.width*e)/2,h.centerY*(1-e)+o.centerY*e-(h.height*(1-e)+o.height*e)/2,h.width*(1-e)+o.width*e,h.height*(1-e)+o.height*e],{noLimit:1}),this.#Fo()}else this.#d.camera.flyToView(i.view,{duration:i.duration,progress:t,prevView:s}).then(()=>{null!=this.#je&&i===this.#_o[this.#je]&&this.#Fo()}).catch(()=>{})}#Lo(){this.#Rs.setAttribute("data-tour-active",""),this.#Rs.events.xt("videotour-play"),this.#So&&this.#Rs.events.enabled.set(0)}#Do(){this.#Rs.events.xt("videotour-pause"),this.#So&&this.#Rs.events.enabled.set(1)}#Io(t){t=Math.max(0,Math.min(1,t)),this.#To=!!this.paused||!this.#xo,this.pause(),this.#To||(this.#ko=0,this.#Lo());const i=this.duration*t*1e3;this.#Z=i,this.#Ao(i),this.#To?this.pause():(this.#Z=void 0,this.#ko=0)}#Ao(t){let i,s=0;for(;s<this.#_o.length&&this.#_o[s].start<=t;s++)i=this.#_o[s];if(!i)return this.#_o.length&&this.#d.camera.stop(),this.paused||this.#$o(0),void this.updateEvents(t/1e3);this.#d.camera.stop();const e=i.duration>0?(t-i.start)/i.duration:0;this.#Po=Date.now()-i.start-i.duration*e,e>1?(this.#$o(s),i.view&&this.#d.camera.setView(i.view,{noLimit:1})):(s>1&&this.#d.camera.setView(this.#_o[s-2].view,{noLimit:1}),this.#$o(s-1,e)),this.updateEvents(t/1e3)}},$s={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5},Ds=class{#Vo;#No=0;#Bo;#Go;#Yo;constructor(t,i,s={}){this.#Bo=t,this.#Go=i,this.#Yo=s}async initialize(){return await vt("YT","https://r2.micr.io/youtube.js","onYouTubeIframeAPIReady"),new Promise((t,i)=>{this.#Vo=new window.YT.Player(this.#Bo,{host:"https://www.youtube-nocookie.com",width:this.#Go.width.toString(),height:this.#Go.height.toString(),playerVars:{controls:0},events:{onError:()=>{this.#Yo.onError?.(new Error("YouTube player error")),i(new Error("YouTube player error"))},onReady:()=>{this.#No?i(new Error("Player destroyed during initialization")):(this.#Yo.onReady?.(),this.#Yo.onDurationChange?.(this.#Vo.getDuration()),t())},onStateChange:t=>this.#Ho(t.data)}})})}#Ho(t){switch(t){case $s.UNSTARTED:this.#Yo.onBlocked?.(),this.#Yo.onPause?.();break;case $s.ENDED:this.#Yo.onEnded?.();break;case $s.PLAYING:this.#Yo.onPlay?.(),this.#Yo.onSeeked?.();break;case $s.PAUSED:this.#Yo.onPause?.();break;case $s.BUFFERING:this.#Yo.onBuffering?.(),this.#Yo.onSeeking?.()}}async play(){this.#Vo?.playVideo()}pause(){this.#No||this.#Vo?.pauseVideo?.()}async getCurrentTime(){return this.#Vo?.getCurrentTime?.()??0}setCurrentTime(t){this.#Yo.onSeeking?.(),this.#Vo?.seekTo?.(t)}async getDuration(){return this.#Vo?.getDuration?.()??0}async isPaused(){if(!this.#Vo)return 1;const t=this.#Vo.getPlayerState?.();return void 0===t||[$s.UNSTARTED,$s.ENDED,$s.PAUSED,$s.CUED].includes(t)}setMuted(t){t?this.#Vo?.mute?.():this.#Vo?.unMute?.()}setVolume(t){}destroy(){this.#No=1,this.#Vo?.destroy?.(),this.#Vo=void 0}},Os=class{#Vo;#No=0;#Bo;#Go;#Yo;constructor(t,i,s={}){this.#Bo=t,this.#Go=i,this.#Yo=s}async initialize(){return await vt("Vimeo","https://r2.micr.io/vimeo.min.js"),new Promise((t,i)=>{this.#Vo=new window.Vimeo.Player(this.#Bo,{width:this.#Go.width.toString(),height:this.#Go.height.toString(),title:0,autoplay:0});const s=this.#Vo;s.on("error",()=>{this.#Yo.onError?.(new Error("Vimeo player error")),i(new Error("Vimeo player error"))}),s.on("loaded",()=>{this.#No?i(new Error("Player destroyed during initialization")):s.getVolume().then(()=>{this.#Yo.onReady?.(),t()})}),s.on("play",()=>{this.#Yo.onPlay?.(),this.#Yo.onSeeked?.()}),s.on("bufferstart",()=>{this.#Yo.onBuffering?.(),this.#Yo.onSeeking?.()}),s.on("seeked",()=>{this.#Yo.onSeeked?.()}),s.on("pause",()=>{this.#Yo.onPause?.()}),s.on("timeupdate",t=>{t&&(this.#Yo.onDurationChange?.(t.duration),this.#Yo.onTimeUpdate?.(t.seconds))}),s.on("ended",()=>{this.#Yo.onEnded?.()})})}async play(){this.#Vo?.play()}pause(){this.#Vo?.pause()}async getCurrentTime(){return await(this.#Vo?.getCurrentTime?.())??0}setCurrentTime(t){this.#Vo?.setCurrentTime?.(t)}async getDuration(){return await(this.#Vo?.getDuration?.())??0}async isPaused(){return await(this.#Vo?.getPaused?.())??1}setMuted(t){this.#Vo?.setVolume?.(t?0:1)}setVolume(t){this.#Vo?.setVolume?.(Math.max(0,Math.min(1,t)))}destroy(){if(this.#No=1,this.#Vo){for(const t of["error","loaded","play","bufferstart","seeked","pause","volumechange","timeupdate","ended"])this.#Vo.off(t);this.#Vo.destroy(),this.#Vo=void 0}}},Fs=class{element;callbacks;constructor(t,i={}){this.element=t,this.callbacks=i,this.#Ro()}#Ro(){const t=this.element,i=this.callbacks;i.onPlay&&t.addEventListener("play",i.onPlay),i.onPause&&t.addEventListener("pause",i.onPause),i.onEnded&&t.addEventListener("ended",i.onEnded),i.onSeeking&&t.addEventListener("seeking",i.onSeeking),i.onSeeked&&t.addEventListener("seeked",i.onSeeked),i.onTimeUpdate&&t.addEventListener("timeupdate",()=>i.onTimeUpdate?.(t.currentTime)),i.onDurationChange&&t.addEventListener("durationchange",()=>i.onDurationChange?.(t.duration)),i.onError&&t.addEventListener("error",()=>i.onError?.(new Error("Media playback error"))),i.onReady&&t.addEventListener("canplay",i.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,i=this.callbacks;i.onPlay&&t.removeEventListener("play",i.onPlay),i.onPause&&t.removeEventListener("pause",i.onPause),i.onEnded&&t.removeEventListener("ended",i.onEnded),i.onSeeking&&t.removeEventListener("seeking",i.onSeeking),i.onSeeked&&t.removeEventListener("seeked",i.onSeeked)}},Vs="https://r2.micr.io/hls-1.6.15.min.js",Ns={abrEwmaDefaultEstimate:1e7,abrEwmaDefaultEstimateMax:5e7},Bs=()=>"MediaSource"in globalThis||"ManagedMediaSource"in globalThis,Gs=t=>`https://videodelivery.net/${t}/manifest/video.m3u8`,Ys=class extends Fs{#Xo;#No=0;#jo;constructor(t,i,s={}){super(t,s),this.#jo=i}async initialize(){if(await vt("Hls",Vs),this.#No)throw new Error("Adapter destroyed during initialization");const t=new window.Hls(Ns);this.#Xo=t,t.loadSource(this.#jo),t.attachMedia(this.element),this.callbacks.onReady?.()}destroy(){this.#No=1,super.destroy(),this.#Xo?.destroy(),this.#Xo=void 0}};function Hs(t){if(isNaN(t))return"0:00";const i=new Date(1e3*Math.abs(t)).toISOString().slice(11,19);return(0>t?"-":"")+(i.startsWith("00:")?i.slice(3):i)}var Rs=class extends Mi{static tag="micrio-media-controls";#uh={paused:1,ended:0};#Wo;#Uo;#Zo;#qo;#Jo;#Ko;#Qo;#kh=0;#tn;#in=0;#sn=0;#en=-1;#L="";Jh(){this.#Bh(),this.Qh(rs.subscribe(()=>this.#Nh()))}bt(t){Object.assign(this.#uh,t),this.isConnected&&(this.#Bh(),this.#kh&&this.#Nh())}#Bh(){const t=this.#uh;if(!this.#kh){this.#kh=1,this.#Wo=dt("aside",{events:{click:t=>t.stopPropagation(),keydown:t=>t.stopPropagation()},parent:this}),this.#Uo=dt("micrio-button",{parent:this.#Wo}),t.hasAudio&&(this.#Zo=dt("micrio-button",{parent:this.#Wo})),t.subtitles&&(this.#qo=dt("micrio-button",{parent:this.#Wo}));const i=dt("div"),s=dt("div",{attrs:{"data-part":"bars"},children:[this.#Ko=dt("div",{attrs:{"data-part":"bar"}})]}),e=t=>{0==t.button&&(window.addEventListener("mousemove",h),window.addEventListener("mouseup",o),h(t))},h=t=>{const i=s.getClientRects()[0];if(!i)return;const e=Math.min(1,Math.max(0,(t.clientX-i.left)/i.width));this.#uh.onseek?.(e*this.#uh.duration)},o=()=>{window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",o)};s.addEventListener("mousedown",e),i.appendChild(s),this.#Qo=dt("span",{parent:i}),this.#Wo.appendChild(i),t.fullscreenEl&&(this.#Jo=dt("micrio-fullscreen",{parent:this.#Wo})),t.onclose&&dt("micrio-button",{setProps:{type:"close",title:H(Bi).No,onclick:t.onclose},parent:this.#Wo})}this.#Nh()}#Nh(){const t=this.#uh,i=H(Bi),s=H(rs);if(t.paused===this.#tn&&t.seeking===this.#in&&void 0!==this.#tn||(this.#tn=t.paused,this.#in=!!t.seeking,this.#Uo.bt({type:t.paused?"play":"pause",title:t.paused?i.Ko:i.Qo,disabled:!!t.seeking,onclick:t.onplaypause})),this.#Zo&&t.muted!==this.#sn&&(this.#sn=!!t.muted,this.#Zo.bt({type:t.muted?"muted":"unmuted",title:t.muted?i.jo:i.Xo,disabled:t.seeking,onclick:t.onmute})),this.#qo&&this.#qo.bt({type:s?"subtitles":"subtitlesOff",active:s,title:i.sn,onclick:()=>rs.set(!H(rs))}),this.#Jo&&this.#Jo.bt({el:t.fullscreenEl}),t.duration&&!isNaN(t.duration)){const i=(t.currentTime??0)/t.duration*100;(Math.abs(i-this.#en)>.5||0===i)&&(this.#en=i,this.#Ko.style.width=`${i}%`);const s=t.getTimeDisplay?t.getTimeDisplay(t.currentTime??0,t.duration):(0>t.duration-(t.currentTime??0)?"":"-")+(t=>new Date(1e3*Math.abs(t)).toISOString().slice(14,19))(Math.abs(t.duration-(t.currentTime??0)));s!==this.#L&&(this.#L=s,this.#Qo.textContent=s)}else"0:00"===this.#L&&0===this.#en||(this.#L="0:00",this.#en=0,this.#Qo.textContent="0:00",this.#Ko.style.width="0%")}};customElements.define(Rs.tag,Rs);var Xs,js=/((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be|youtube-nocookie\.com))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)?/,Ws=/vimeo\.com/,Us=0,Zs=class extends Mi{static tag="micrio-media";#hn;#on;#Bo;#jo;#nn;#rn;#an=1;#cn=0;#W=0;#Mh=0;#ln=0;#un=0;#dn;#pn(t,i,s){const e=t.match(js)?.[5];if(!e)return;const h=dt("iframe",{props:{src:`https://www.youtube-nocookie.com/embed/${e}?autoplay=${i.autoplay?1:0}&playsinline=1&enablejsapi=1`,width:String(i.width??400),height:String(i.height??240)},attrs:{allow:"autoplay; encrypted-media",allowfullscreen:""},parent:s});this.#Bo=h}#mn(t,i,s){const e=t.match(/\/(\d+)/);if(!e?.[1])return;const h=e[1],o=t.slice(t.indexOf(h)+h.length+1).replace(/\?.*$/,"")||void 0,n=dt("iframe",{props:{src:`https://player.vimeo.com/video/${h}?${o?`h=${o}&`:""}title=0&portrait=0&sidedock=0&byline=0&controls=0`,width:String(i.width??400),height:String(i.height??240)},attrs:{allow:"autoplay; fullscreen",allowfullscreen:""},parent:s});this.#Bo=n}#fn(t,i,s){const e=Gs(t.slice(8)),h=dt("video",{props:{src:e,width:i.width??400,height:i.height??240,controls:0,preload:"metadata",playsInline:1,crossOrigin:"anonymous",...i.autoplay?{autoplay:1}:{},...i.muted?{muted:1}:{}},parent:s});this.#hn=h,this.#gn(h),this.#jo=e}#vn(t,i,s){if(!(this.#hn instanceof HTMLAudioElement)){const t=(Xs||((Xs=document.createElement("audio")).style.display="none",Xs.controls=0,Xs.preload="metadata",document.body.appendChild(Xs)),Us++,Xs);this.#hn=t,this.#gn(t),this.Qh(()=>{--Us>0||(Us=0,Xs?.remove(),Xs=void 0),this.#hn=void 0})}const e=this.#hn;e.src=t,i.autoplay?e.setAttribute("autoplay",""):e.removeAttribute("autoplay"),e.muted=!!i.muted}#wn(t,i,s){const e=dt("video",{props:{src:t,width:i.width??400,height:i.height??240,controls:0,preload:"metadata",playsInline:1,crossOrigin:"anonymous",...i.autoplay?{autoplay:1}:{},...i.muted?{muted:1}:{}},parent:s});this.#hn=e,this.#gn(e)}xh(){const t=this.qh,i=t.src;if(!i&&!t.tour)return void this.replaceChildren();const s=i?js.test(i):0,e=i?Ws.test(i):0,h=i?i.startsWith("cfvid://"):0,o=i?i.includes(".mp3")||i.includes(".ogg")||i.includes(".wav")||i.includes("audio/"):0,n=!!t.tour&&!!t.image&&!i;this.replaceChildren();const r=dt("figure",{className:t.className});if(t.is360&&r.style.setProperty("--micrio-background","transparent"),s?this.#pn(i,t,r):e?this.#mn(i,t,r):h?this.#fn(i,t,r):o&&i?this.#vn(i,t,r):i&&this.#wn(i,t,r),t.figcaption&&dt("figcaption",{textContent:t.figcaption,parent:r}),this.appendChild(r),this.#Bo){const i=t.width??400,h=t.height??240;s?(this.#nn=new Ds(this.#Bo,{width:i,height:h},{onPlay:()=>{this.#an=0,this.#Mn(),this.#yn()},onPause:()=>{this.#an=1,this.#_n(),this.#yn()},onEnded:()=>{this.#cn=1,this.#an=1,this.#_n(),this.#yn(),t.onended?.()},onSeeking:()=>{this.#ln=1},onSeeked:()=>{this.#ln=0,this.#yn()}}),this.#nn.initialize().then(()=>{t.autoplay&&this.#nn.play()}).catch(()=>{})):e&&(this.#nn=new Os(this.#Bo,{width:i,height:h},{onPlay:()=>{this.#an=0,this.#yn()},onPause:()=>{this.#an=1,this.#yn()},onEnded:()=>{this.#cn=1,this.#an=1,this.#yn(),t.onended?.()},onTimeUpdate:t=>{this.#Mh=t,this.#yn()},onDurationChange:t=>{this.#W=t}}),this.#nn.initialize().then(()=>{t.autoplay&&this.#nn.play()}).catch(()=>{}))}if(h&&this.#jo&&this.#hn&&Bs()&&(this.#nn=new Ys(this.#hn,this.#jo,{onReady:()=>{this.#yn()},onEnded:()=>{this.#cn=1,this.#an=1,this.#yn(),t.onended?.()}}),this.#nn.initialize().catch(()=>{})),t.tour&&t.image&&(this.#hn||n)){if(this.#on=new As(t.image,t.tour),this.#hn){const t=()=>this.#on?.play();this.#hn.addEventListener("play",t),this.Qh(()=>this.#hn?.removeEventListener("play",t))}if(n){this.#W=this.#on.duration;const i=setInterval(()=>{this.#Mh=this.#on.currentTime,this.#W=this.#on.duration,this.#an=this.#on.paused,this.#cn=this.#on.ended,this.#on.updateEvents(this.#Mh),this.#yn(),t.secondary||this.co()?.dispatchEvent(new CustomEvent("timeupdate",{detail:this.#Mh})),!this.#cn||this.#hn&&!this.#hn.ended||t.onended?.()},250);this.Qh(()=>clearInterval(i)),t.autoplay&&this.#on.play()}else{const t=()=>this.#on?.pause();this.#hn?.addEventListener("ended",t),this.Qh(()=>this.#hn?.removeEventListener("ended",t)),this.#hn?.paused||this.#on?.play()}}if(!t.secondary&&t.tour&&!("steps"in t.tour)){const i=this.co()?.lang||"en",s=t.tour.i18n?.[i]?.subtitle;s?.src&&(this.#dn=dt("micrio-subtitles",{setProps:{src:s.src,mediaEl:this.#hn??this},parent:this.closest("micrio-main")||this.parentNode}))}if(0!=t.controls){const i=!(t.secondary||!t.tour||"steps"in t.tour||!t.tour.i18n?.[this.co()?.lang||"en"]?.subtitle),s=()=>{const t=this.#hn;t?t.paused?(t.play().catch(()=>{}),this.#on?.play()):(t.pause(),this.#on?.pause()):this.#on?this.#on.paused?this.#on.play():this.#on.pause():this.#nn&&this.#nn.isPaused().then(t=>{t?this.#nn.play():this.#nn.pause()})},e=()=>{const t=this.#hn;t?(this.#un=!this.#un,t.muted=this.#un,this.#yn()):this.#nn&&(this.#un=!this.#un,this.#nn.setMuted(this.#un),this.#yn())},h=t=>{const i=this.#hn;i?i.currentTime=t:this.#on?this.#on.currentTime=t:this.#nn&&this.#nn.setCurrentTime(t)},a=()=>{const n=this.#hn;if(!n)return this.#on?void 0:void this.#nn;this.#Mh=n.currentTime,this.#W=n.duration||0,this.#an=n.paused,this.#cn=n.ended||0,this.#ln=n.seeking,this.#un=n.muted,c.bt({currentTime:this.#Mh,duration:this.#W,paused:this.#an,ended:this.#cn,seeking:this.#ln,muted:this.#un,hasAudio:t.hasAudio??(!!t.src&&!o),subtitles:i,getTimeDisplay:t.getTimeDisplay,fullscreenEl:t.fullscreenEl??(o?void 0:r),onplaypause:s,onmute:e,onseek:h,onclose:t.onclose})},c=dt("micrio-media-controls",{setProps:{paused:1,ended:0,hasAudio:t.hasAudio??(!!t.src&&!o),subtitles:i,getTimeDisplay:t.getTimeDisplay,fullscreenEl:t.fullscreenEl??(o?void 0:r),onplaypause:s,onmute:e,onseek:h,onclose:t.onclose},parent:r});if(this.#hn&&(this.#hn instanceof HTMLVideoElement||this.#hn instanceof HTMLAudioElement)&&!n){const i=()=>{a(),this.#on?.updateEvents(this.#Mh),t.secondary||this.co()?.dispatchEvent(new CustomEvent("timeupdate",{detail:this.#Mh}))},s=()=>{a(),n||t.onended?.()},e=()=>{this.#ln=1,a()},h=()=>{this.#ln=0,a()};this.#hn.addEventListener("timeupdate",i),this.#hn.addEventListener("loadedmetadata",a),this.#hn.addEventListener("play",a),this.#hn.addEventListener("pause",a),this.#hn.addEventListener("ended",s),this.#hn.addEventListener("seeking",e),this.#hn.addEventListener("seeked",h),this.Qh(()=>{const t=this.#hn;t&&(t.removeEventListener("timeupdate",i),t.removeEventListener("loadedmetadata",a),t.removeEventListener("play",a),t.removeEventListener("pause",a),t.removeEventListener("ended",s),t.removeEventListener("seeking",e),t.removeEventListener("seeked",h))}),a()}}}#gn(t){const i=this.ao("volume");i&&this.Qh(i.subscribe(i=>{t.volume=i}))}#Mn(){null==this.#rn&&(this.#rn=setInterval(async()=>{this.#nn&&(this.#Mh=await this.#nn.getCurrentTime(),this.#W=await this.#nn.getDuration(),this.#on?.updateEvents(this.#Mh),this.#yn())},250))}#_n(){null!=this.#rn&&(clearInterval(this.#rn),this.#rn=void 0)}#yn(){const t=this.querySelector("micrio-media-controls");t&&t.bt({currentTime:this.#Mh,duration:this.#W,paused:this.#an,ended:this.#cn,seeking:this.#ln,muted:this.#un})}Kh(){this.#on?.destroy(),this.#nn?.destroy(),this.#_n(),this.#dn?.remove()}};customElements.define(Zs.tag,Zs);var qs=class extends Mi{static tag="micrio-marker-popup";#uh={marker:null};#Eo;#bn;#kn=0;#xn=0;#Tn=0;#Pn=new WeakMap;Jh(){const{marker:t}=this.#uh,i=this.co();i&&t&&(t.tags?.forEach(t=>this.classList.add(t)),ft().then(()=>this.querySelector("micrio-button:last-child > button")?.focus()),this.Qh(i.state.popup.subscribe(i=>{this.#xn=!i||i!=t,this.classList.toggle("destroying",this.#xn)})),this.addEventListener("transitionend",t=>{t.target===this&&this.#xn&&this.remove()}),this.#lh())}bt(t){void 0!==t.marker&&t.marker.id!==this.#uh.marker?.id&&(this.#uh.marker=t.marker,this.isConnected&&this.#lh())}#lh(){const{marker:t}=this.#uh,i=this.co();if(!i||!t)return;const s=Mi.Zh,e=t.id?s.get(t.id):void 0;if(!e)return;const h=H(i.state.tour),o=H(i.current),n=H(Bi),r=e.$settings.t??{},a=t.data||{},c=r.canMinimizePopup,l=h&&"steps"in h?h:void 0,u=(l?i.be.find(t=>t.$data?.markerTours?.find(t=>t.id===l.id)):void 0)?.$settings.t,d=l&&l.steps?.findIndex(i=>i.startsWith(t.id))>=0,p=!i.canvas.$isMobile&&d&&!l?.isSerialTour&&(u?.tourControlsInPopup??r.tourControlsInPopup),m=p||(l?l.currentStep==l.steps.length-1:void 0),f=t=>{h&&d&&"steps"in h?t instanceof Event&&m?i.state.tour.set(void 0):h.next?.():o&&o.id!=e.id&&a.micrioLink?.id==o.id?(i.open(e.id),e.state.marker.set(void 0),i.state.popup.set(void 0)):e.state.marker.set(void 0)},g=()=>{if(this.#kn=!this.#kn,this.classList.toggle("minimized",this.#kn),this.#Eo)for(let t=0;t<this.#Eo.children.length;t++){const i=this.#Eo.children[t];i&&i!==this.#bn&&(this.#Pn.has(i)||(this.#Pn.set(i,i.offsetHeight),i.style.height=i.offsetHeight+"px"),setTimeout(()=>{i.style.height=this.#kn?"0px":this.#Pn.get(i)+"px"},100))}};if(this.replaceChildren(),!p){const t=dt("aside");a.alwaysOpen||dt("micrio-button",{setProps:{type:!d||m?"close":"next",title:!d||m?n.Wo:n.Uo,disabled:this.#Tn,onclick:f},parent:t}),c&&dt("micrio-button",{setProps:{type:this.#kn?"up":"down",title:n.Jo,onclick:g},parent:t}),this.appendChild(t)}this.#Eo=dt("micrio-marker-content",{setProps:{marker:t,onclose:f},parent:this}),p&&requestAnimationFrame(()=>{const t=document.querySelector("micrio-tour")?.aside;t&&!this.contains(t)&&this.appendChild(t)})}};customElements.define(qs.tag,qs);var Js=class extends Mi{static tag="micrio-marker";#uh={marker:null};#Sn=0;#En=0;#Cn=0;#zn=0;#In=1;#Ln=0;#An="";#Kh;#$n=0;#Dn;Jh(){const{marker:t,image:i,forceHidden:s=0}=this.#uh,e=this.co();if(!e||!i||!t)return;const h=Mi.Zh;!h.has(t.id)&&i&&h.set(t.id,i);const o=e.events,n=H(e.Gt),r=i.$settings.t??{},a=t.i18n?.[n],c=t.data??{},l=0==t.data?.showTitle||!!r.noTitles||!!i.$settings.omni?.sideLabels,u=/[?&]micrioNoTooltips/.test(location.search)||!!i.$settings.omni?.sideLabels;if(t.videoTour){const i=t.videoTour.i18n?.[n]?.timeline;i?.length&&(t.view=i[0].rect)}const d=a&&!l&&(a.label||a.title),p="cluster"==t.type,m=p||"link"!=t.type?"media"==t.type?"play":void 0:"link",f=null!=t.data?.customIconIdx?i.$settings.t?.customIcons?.[t.data.customIconIdx]:t.data?.icon||r.markerIcon,g=!!m||!!f,v=g||"default"==t.type,w=i.$settings.omni;if(i.Lt&&w){const s=(t.rotation??0)+(t.backside?Math.PI:0);if(this.#$n=i.camera.dt(s)??0,t.visibleArc){const s=i.camera.dt(t.visibleArc[0]),e=i.camera.dt(t.visibleArc[1]);null!=s&&null!=e&&(this.#Dn=[s,e])}}const M=!!t.data?.scales||!!i.$settings.markersScale,y=()=>{if(i.I&&M)this.#An=i.camera.getMatrix(t.x,t.y,1,1,0,0,0).join(","),this.style.setProperty("--mat",`matrix3d(${this.#An})`),this.classList.add("mat3d");else{const s=i.camera.O(t.x,t.y,{radius:t.radius,rotation:t.rotation});if([this.#Cn,this.#zn,this.#In,this.#Ln]=s,i.I)this.#En=this.#Ln>0;else if(i.Lt&&w)if(this.#Dn&&null!=t.rotation){const t=w.frames/(w.layers?.length??1);let s=(i.omni?.currentIndex??0)-this.#$n;s>t/2&&(s-=t),-t/2>s&&(s+=t),this.#En=s<=this.#Dn[0]||s>=this.#Dn[1]}else w.distance&&(this.#En=0>this.#Ln);this.style.setProperty("--x",`${this.#Cn}px`),this.style.setProperty("--y",`${this.#zn}px`),M&&this.style.setProperty("--scale",`${this.#In}`),this.classList.remove("mat3d"),this.classList.toggle("behind",this.#En)}},_=()=>{if(t.onclick)return t.onclick(t);r.noMarkerActions||("cluster"==t.type?t.view&&e.$current?.$info&&i.camera.flyToView(t.view,{limitZoom:1}):i.state.marker.set(t))},b=()=>{r.noMarkerActions||(this.parentNode?.scrollTo(0,0),clearTimeout(this.#Kh),this.#Kh=setTimeout(()=>{const s=i.camera.getXY(t.x,t.y);!this.#Sn&&(0>s[0]||s[0]>=e.offsetWidth||0>s[1]||s[1]>=e.offsetHeight||i.I&&s[3]>4)&&i.camera.flyToCoo([t.x,t.y],{speed:2,limit:1}).catch(()=>{})},150))},k=async()=>{if(this.#Sn)return void(H(e.state.popup)||i.state.marker.set(void 0));if(this.#Sn=1,this.classList.add("opened"),clearTimeout(this.#Kh),r.noMarkerActions)return;o.xt("marker-open",t);const s=H(e.state.tour);!s||"steps"in s&&s.steps?.some(i=>i.startsWith(t.id))||e.state.tour.set(void 0),await R(),!t.view||c.noAnimate||t.videoTour?x():i.camera.flyToView(t.view,{omniIndex:i.Lt?this.#$n:void 0,isJump:1}).then(x).catch(()=>{i.state.$marker===t&&(i.St=void 0,i.state.marker.set(void 0))})},x=async()=>{if(p)return;if(i.state.$marker!=t){if(!i.state.$marker)return;return i.state.marker.set(t)}if(r.noMarkerActions)return;const s=H(e.state.tour);if(o.xt("marker-opened",t),"popup"==t.popupType&&(a?.title||a?.body||a?.bodySecondary||a?.embedUrl||t.images?.length||t.videoTour))R().then(()=>e.state.popup.set(t));else if("popover"==t.popupType)e.state.popover.set({marker:t,image:i,markerTour:s&&"steps"in s?s:void 0});else if(t.videoTour&&!s){e.state.tour.set(t.videoTour);const s=e.state.tour.subscribe(t=>{t||(s(),i.state.marker.set(void 0))})}const h=c.micrioLink?.id;h&&R().then(()=>{e.open(h,{vector:gs(e,h)?.vector})});const n=c.micrioSplitLink;if(n&&!Ri(i)){const t=Gi(n);if(t){const s=Hi(i);if(s)if(s.id===t.micrioId){if(t.markerId){const i=s.$data?.markers?.find(i=>i.id===t.markerId);i?.view&&s.camera.flyToView(i.view,{isJump:1})}}else ji(e,i),R().then(()=>Xi(e,i,t,{isPassive:t.follows}));else Xi(e,i,t,{isPassive:t.follows})}}},T=()=>{this.classList.remove("opened"),o.xt("marker-closed",t),e.state.popover.set(void 0),e.state.popup.set(void 0)};if(this.Qh(i.state.marker.subscribe(s=>{if("string"==typeof s&&s==t.id)i.state.marker.set(t);else if(s==t)k();else if(!(c.alwaysOpen||s&&s==t)){if(this.#Sn){if(c.micrioSplitLink){const t=s&&"string"!=typeof s?s:null;if(t&&t.data?.micrioSplitLink){const s=Gi(t.data.micrioSplitLink),h=Hi(i);s&&h&&s.micrioId===h.id||ji(e,i)}else ji(e,i)}T()}else s||this.classList.remove("opened");this.#Sn=0,H(e.state.tour)||i.camera.stop()}})),t.noMarker||this.Qh(i.state.view.subscribe(()=>{y()})),s||R().then(()=>{const s=H(e.state.popup),h=H(e.state.tour);this.#Sn&&!t.noMarker&&s&&s!=t&&!h?i.state.marker.set(void 0):c.alwaysOpen&&x()}),this.classList.toggle("cluster",p),this.classList.toggle("default",!!v),this.classList.toggle("has-icon",g),this.classList.toggle("has-custom-icon",!!f),!t.htmlElement&&!t.noMarker){const i=dt("button",{props:{...u||p?{}:{title:a?.label||a?.title||""},id:t.id},attrs:{"data-scroll-through":""},events:{click:_,focus:b,blur:()=>clearTimeout(this.#Kh),mouseenter:()=>e.state.markerHoverId.set(t.id),mouseleave:()=>e.state.markerHoverId.set(void 0)},parent:this});f?dt("img",{props:{src:"string"==typeof f?f:f.src,alt:""},parent:i}):m&&dt("micrio-icon",{setProps:{name:m},parent:i}),d&&dt("label",{textContent:a?.label||a?.title||"",attrs:{for:t.id,"data-scroll-through":""},parent:i})}t.noMarker||y(),t.tags&&t.tags.forEach(t=>this.classList.add(t))}bt(t){Object.assign(this.#uh,t)}Kh(){clearTimeout(this.#Kh)}};customElements.define(Js.tag,Js);var Ks=class extends Mi{static tag="micrio-markers";#uh={image:null};Jh(){const{image:t}=this.#uh,i=this.co();if(!i||!t)return;const{Wt:s,state:e}=i,h=i.be[0]?.grid,o=h?.yo,n=h?._o;this.Qh(t.Ft.subscribe(t=>{if(!t||4>t.length)return;t=t.map(t=>Math.round(100*t)/100);const s=i.canvas.viewport;this.style.left=t[0]?`${t[0]}px`:"",this.style.top=t[1]?`${t[1]}px`:"",this.style.width=t[2]==s.width?"":`${t[2]}px`,this.style.height=t[3]==s.height?"":`${t[3]}px`}));const r=()=>{if(!t.$settings.clusterMarkers)return;const s=t.$data?.markers?.filter(t=>!t.i18n||t.i18n[H(i.Gt)]);if(!s)return;const e=t.$settings.clusterMarkerRadius??16,h=s.map(i=>{const s=t.camera.O(i.x,i.y,{radius:i.radius,rotation:i.rotation});return[s[0],s[1]]}),o=[];for(let t=0;t<s.length;t++)for(let i=t+1;i<s.length;i++){if(s[i].tags?.includes("no-cluster"))continue;if(Math.abs(h[i][0]-h[t][0])>=e||Math.abs(h[i][1]-h[t][1])>=e)continue;const n=o.find(s=>s.includes(t)||s.includes(i));n?n.push(t,i):o.push([t,i])}const n=o.map(t=>[...new Set(t)].sort((t,i)=>t-i)),r=new Set;for(const t of n)for(const i of t)r.add(i);for(let t=0;t<s.length;t++)this.querySelector(`[data-marker-id="${s[t].id}"]`)?.classList.toggle("overlapped",r.has(t));const a=new Set(n.map(t=>t.join(",")));for(const t of this.querySelectorAll(":scope > micrio-marker.cluster")){const i=t.getAttribute("data-marker-id");i&&!a.has(i)&&t.remove()}for(const i of n){const e=i.join(",");if(this.querySelector(`:scope > micrio-marker.cluster[data-marker-id="${e}"]`))continue;const h=i.reduce((t,i)=>t+s[i].x,0)/i.length,o=i.reduce((t,i)=>t+s[i].y,0)/i.length,n=Math.min(...i.map(t=>s[t].view?s[t].view[0]:s[t].x)),r=Math.max(...i.map(t=>s[t].view?s[t].view[0]+s[t].view[2]:s[t].x)),a=Math.min(...i.map(t=>s[t].view?s[t].view[1]:s[t].y)),c=Math.max(...i.map(t=>s[t].view?s[t].view[1]+s[t].view[3]:s[t].y));dt("micrio-marker",{attrs:{"data-marker-id":e},setProps:{marker:{id:e,x:h,y:o,type:"cluster",title:i.length+"",view:[n,a,Math.max(.1,r-n),Math.max(.1,c-a)],data:{},popupType:"none",tags:[]},image:t},parent:this})}},a=()=>{const e=t.$data?.markers,a=o?H(o):void 0,c=n?H(n):void 0,l=h&&a!=t&&c&&0>c.indexOf(t),u=!!t.$settings.t?.showTitles;if(this.classList.toggle("inactive",!!l),this.classList.toggle("show-titles",u),!H(s)&&i.spaceData){const s=i.spaceData.links.filter(i=>i[0]==t.id||i[1]==t.id),e=new Set(s.map(i=>i[0]==t.id?i[1]:i[0]));for(const t of this.querySelectorAll(":scope > micrio-waypoint"))e.has(t.getAttribute("data-target-id"))||t.remove();for(const i of s){const s=i[0]==t.id?i[1]:i[0];let e=this.querySelector(`:scope > micrio-waypoint[data-target-id="${s}"]`);e||(e=dt("micrio-waypoint",{attrs:{"data-target-id":s},setProps:{targetId:s,settings:i[2]?.[t.id],image:t},parent:this}))}}else for(const t of this.querySelectorAll(":scope > micrio-waypoint"))t.remove();if(e){const s=H(i.Gt),h=e.filter(t=>!t.i18n||t.i18n[s]),o=new Set(h.map(t=>t.id));for(const t of this.querySelectorAll(":scope > micrio-marker")){const i=t.getAttribute("data-marker-id");i&&!t.classList.contains("cluster")&&(o.has(i)||t.remove())}for(const i of h){let s=this.querySelector(`:scope > micrio-marker[data-marker-id="${i.id}"]`);s||(s=dt("micrio-marker",{attrs:{"data-marker-id":i.id},setProps:{marker:i,image:t,...i.noMarker?{forceHidden:1}:{}},parent:this}))}}else for(const t of this.querySelectorAll(":scope > micrio-marker"))t.remove();if(l)for(const t of this.querySelectorAll(":scope > micrio-marker, :scope > micrio-waypoint"))t.remove();t.$settings.clusterMarkers&&r()};if(this.ho(t.data,a),this.ho(s,a),e.tour&&this.ho(e.tour,a),o&&this.ho(o,a),n&&this.ho(n,a),this.oo(i.Gt,a),t.$settings.clusterMarkers&&this.Qh(t.state.view.subscribe(r)),!t.grid&&t.$settings.t?.zoomOutAfterClose){let s=0;this.Qh(t.state.marker.subscribe(e=>{e&&"string"!=typeof e&&!t.St&&!e.noMarker&&e.view?(t.St=H(i.state.tour)&&!("steps"in H(i.state.tour))?void 0:structuredClone(t.state.$view??t.camera?.getView()),s=!!e.videoTour):e||!t.St||H(i.state.tour)||setTimeout(()=>{if(t.St){const i=t.St,s=Math.min(1,i[2]),e=Math.min(1,i[3]),h=s/2,o=e/2,n=Math.max(h,Math.min(1-h,i[0]+h)),r=Math.max(o,Math.min(1-o,i[1]+o));t.camera.flyToView([n-h,r-o,s,e],{speed:t.$settings.t?.zoomOutAfterCloseSpeed}).catch(()=>{})}t.St=void 0,s=0},s?250:10)}))}a()}bt(t){void 0!==t.image&&(this.#uh.image=t.image)}};customElements.define(Ks.tag,Ks);var Qs=class extends Mi{static tag="micrio-dial";#uh={currentRotation:0,frames:1};Jh(){const t=this.co();if(!t)return;const i=t.$current?.camera;if(!i)return;let s,e=0,h=0;const o=s=>{const o=Math.max(1,(i.getXY(1,.5)[0]-i.getXY(0,.5)[0])/t.offsetWidth),n=(h/360+(e-s.clientX)/(this.offsetWidth*o))*this.#uh.frames;this.#uh.onturn?.(n)},n=()=>{s&&t.releasePointerCapture(s),t.removeAttribute("data-panning"),t.removeEventListener("pointermove",o),t.removeEventListener("pointerup",n)};this.addEventListener("pointerdown",i=>{i.stopPropagation(),i.preventDefault(),0==i.button&&(t.addEventListener("pointermove",o),t.addEventListener("pointerup",n),t.setAttribute("data-panning",""),t.setPointerCapture(s=i.pointerId),h=this.#uh.currentRotation,e=i.clientX)})}bt(t){if(Object.assign(this.#uh,t),this.isConnected){const t=-this.#uh.currentRotation/360*(this.offsetWidth??0);this.style.setProperty("--micrio-dial-offset",`${t}px`)}}};customElements.define(Qs.tag,Qs);var te=class extends Mi{static tag="micrio-minimap";#uh={image:null};#On=null;#Fn;#Vn;#Nn;Jh(){this.#io()}bt(t){void 0!==t.image&&t.image!==this.#uh.image&&(this.#uh.image=t.image,this.isConnected&&(this.#Nn?.(),this.replaceChildren(),this.#On=null,this.#io()))}#io(){const{image:t}=this.#uh;if(!this.co()||!t)return;const i=t.$info;if(!i)return;const s=t.camera,e=t.$settings,h=e.minimapWidth??200,o=e.minimapHeight??160,n=i.width/i.height,r=h/n>o?Math.round(o*n):h,a=h/n>o?o:Math.round(h/n),c=-s.rotationY/(2*Math.PI),l=self.crossOriginIsolated;let u=l?void 0:t.thumbSrc;const d=s=>{if(!s||!this.#On)return;const e=this.#On;e.clearRect(0,0,r,a);const h=!(!t.thumbSrc&&!u);if(i.is360){h&&(e.globalCompositeOperation="source-over",e.fillStyle="rgba(0,0,0,.45)",e.fillRect(0,0,r,a),e.globalCompositeOperation="destination-out");const t=U(s[0]+s[2]/2),i=Math.max(0,Math.min(1,s[1]+s[3]/2)),o=Math.round(t*r),n=Math.round(i*a),c=Math.max(1,Math.round(s[2]*r/2));e.fillStyle=h?"white":"rgba(255,255,255,.8)",e.fillRect(Math.round(o-c),0,2*c,a);const l=Math.max(1,Math.round(s[3]*a/2));e.fillRect(0,Math.round(n-l),r,2*l),e.beginPath(),e.arc(o,n,3,0,2*Math.PI),e.fill(),h&&(e.globalCompositeOperation="source-over")}else h?(e.globalCompositeOperation="source-over",e.fillStyle="rgba(0,0,0,.5)",e.fillRect(0,0,r,a),e.globalCompositeOperation="destination-out"):(e.fillStyle="rgba(0,0,0,.5)",e.fillRect(0,0,r,a)),e.beginPath(),e.fillStyle="white",e.rect(Math.floor(s[0]*r),Math.floor(s[1]*a),Math.ceil(s[2]*r),Math.ceil(s[3]*a)),h&&(e.fill(),e.globalCompositeOperation="source-over"),e.stroke()},p=t=>{if(!this.#Vn)return;const i=Math.max(0,Math.min(1,(t.clientX-this.#Vn.left)/this.#Vn.width)),e=Math.max(0,Math.min(1,(t.clientY-this.#Vn.top)/this.#Vn.height));this.#Fn?s.setView([i-this.#Fn.width/2,e-this.#Fn.height/2,this.#Fn.width,this.#Fn.height]):s.setCoo(i,e)},m=()=>{window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",m),this.#Fn=void 0},f=dt("canvas",{props:{width:r,height:a},className:e.alwaysShowMinimap?"fixed":void 0,events:{mousedown:t=>{if(0!=t.button)return;window.addEventListener("mousemove",p),window.addEventListener("mouseup",m),this.#Vn=f.getBoundingClientRect();const i=s.getView();i&&(this.#Fn={width:i[2],height:i[3]}),p(t)}},parent:this});u&&(f.style.backgroundImage=`url('${u}')`,0!=c&&(f.style.backgroundPositionX=r*c+"px")),f.addEventListener("wheel",t=>{s.zoom(t.deltaY*(kt.firefox?50:1))},{passive:1}),this.#On=f.getContext("2d"),this.#On&&(this.#On.lineWidth=1,this.#On.strokeStyle="white"),l&&t.thumbSrc&&fetch(t.thumbSrc).then(t=>t.blob()).then(i=>{u=URL.createObjectURL(i),f.style.backgroundImage=`url('${u}')`,d(H(t.state.view))}),this.#Nn?.(),this.#Nn=t.state.view.subscribe(d),this.Qh(this.#Nn)}};customElements.define(te.tag,te);var ie=class{#Bn=0;#Gn=void 0;#Yn=void 0;#Hn=void 0;#Rn=void 0;#Xn=0;#jn=1;gn=void 0;#Wn=1;#_;#d;#Un;#an;#Zn;constructor(t,i,s,e,h){this.#_=t,this.#d=i,this.#Un=s,this.#an=e,this.#Zn=h,this.#Bn=!!s.video?.streamId&&!s.video?.transparent,this.gn=i.Et,this.#jn=s.video?.autoplay??1;let o=1;this.#Yn=this.#d.visible.subscribe(t=>{clearTimeout(this.#Rn),this.#Rn=t?setTimeout(()=>{this.#Wn&&(this.gn?(this.#be(),this.#jn&&!this.#an&&this.gn.play().catch(t=>console.warn("WebGL Embed video play() failed",t))):this.#qn())},o?0:100):setTimeout(()=>this.gn?.pause(),0),o=0})}vn(){clearTimeout(this.#Rn)}wn(){this.#Wn=0,clearTimeout(this.#Rn),clearTimeout(this.#Hn),this.gn?.pause(),this.#Jn(),this.#Yn?.(),this.#Gn?.destroy(),this.#Gn=void 0,this.#Kn()}#Qn(t){this.gn&&(this.#an=!t,t?this.gn.dataset.playing="1":delete this.gn.dataset.playing,this.#_._h(this.#d,t),this.#Un.hideWhenPaused&&this.#_.yh(this.#d,t?1:0),t&&this.#_.render())}#qn(){if(!this.#Un.video||this.gn)return;const t=this.#Bn?Gs(this.#Un.video.streamId):this.#Un.video.src;t?(this.gn=dt("video",{props:{crossOrigin:"anonymous",playsInline:1,width:this.#Un.width,height:this.#Un.height,muted:this.#Un.video.muted}}),this.#be(),this.#Bn&&Bs()?vt("Hls",Vs).then(()=>{this.#Gn=new window.Hls(Ns),this.#Gn.loadSource(t),this.gn&&this.#Gn.attachMedia(this.gn)}).catch(t=>console.error("[Micrio GL Embed] Failed to load HLS.js:",t)):this.gn.src=t):console.error("[Micrio GL Embed] No video source found for embed:",this.#Un.id)}#tr={play:()=>this.#Qn(1),pause:()=>this.#Qn(0),playing:()=>{!this.#d.Et&&this.gn&&("requestVideoFrameCallback"in this.gn?this.gn.requestVideoFrameCallback(()=>{this.gn&&this.#Wn&&(this.#d.video.set(this.gn),this.#_.render())}):this.#d.video.set(this.gn))},canplayEvt:kt.iOS?"loadedmetadata":"canplay",canplay:()=>{this.gn&&this.#Wn&&(this.#jn&&!this.#an?(this.gn.play().catch(t=>console.warn("WebGL Embed video play() failed on canplay:",t)),this.#Zn()):this.#Un.hideWhenPaused||(this.#Qn(1),R().then(()=>{this.#Qn(0),this.#Kn()})))}};#Kn(){this.#Xn&&this.gn?.parentNode&&(this.gn.remove(),this.#Xn=0)}#be(){if(!this.#Un.video||!this.gn)return;const t=this.#Un.video.loopAfter,i=this.gn;this.#Un.video.loop&&t?(i.loop=0,i.onended=()=>{this.#Qn(0),this.#Hn=setTimeout(()=>i?.play().catch(t=>console.warn("WebGL Embed video loop play() failed:",t)),1e3*t)},i.onplay=()=>this.#Qn(1)):(i.loop=this.#Un.video.loop,i.onended=null,i.onplay=null),i.parentNode||this.#jn||this.#Bn||(i.setAttribute("style","opacity:0;position:absolute;top:0;left:0;transform-origin:left top;transform:scale(0.1);pointer-events:none;"),document.body.appendChild(i),this.#Xn=1),i.addEventListener("play",this.#tr.play),i.addEventListener("pause",this.#tr.pause),i.addEventListener("playing",this.#tr.playing,{once:1}),i.addEventListener(this.#tr.canplayEvt,this.#tr.canplay,{once:1})}#Jn(){const t=this.gn;t&&(t.removeEventListener("play",this.#tr.play),t.removeEventListener("pause",this.#tr.pause),t.removeEventListener("playing",this.#tr.playing),t.removeEventListener(this.#tr.canplayEvt,this.#tr.canplay),t.onended=null,t.onplay=null)}},se=class extends Mi{static tag="micrio-embed";#uh={embed:null,image:null};#Rs;#w;#ir;#sr;#er;#hr;#or;#nr;#rr;#ar=0;#jn=1;#cr=0;#lr=0;#ur=0;#dr=0;#pr=0;#mr=0;#fr;#gr=0;#vr=0;#wr=0;#an=0;#Mr=0;#yr=0;#Ln=0;#_r=0;#br=0;#kr=0;#xr=1;#Tr=0;#Pr=0;#Sr=0;#Er=1;#ri=1;#Cn=0;#zn=0;#In=0;#An="";#Cr="";Jh(){const{embed:t,image:i,marker:s}=this.#uh;if(this.#Rs=this.co(),!this.#Rs||!t||!i)return;if(this.#w=i.$info,!this.#w)return;t.uuid||(t.uuid=E()),this.#ar=i.I,this.#jn=t.video?.autoplay??1;const e=i.grid;if(e){const t=e.yo,s=e._o,h=()=>{const h=H(t),o=s?H(s):void 0,n=!!(e&&h&&h!=i&&o&&0>o.indexOf(i));this.#er?.classList.toggle("inactive",n)};this.eo(t,h),s&&this.eo(s,h)}this.#ir=i.Vt.find(i=>i.uuid==t.uuid||i.$info?.title==t.uuid),this.#ur=matchMedia("(dynamic-range: high)").matches||kt.OSX,this.#cr=t.src?.toLowerCase().endsWith(".svg")??0,this.#lr=t.width&&t.height?1048576>t.width*t.height:0;const h=/iPhone OS 14_/i.test(navigator.userAgent),o=this.#Rs.getAttribute("data-embeds-inside-gl");this.#dr=this.#cr||h||!this.#ur&&!this.#Rs.hasAttribute("data-embeds-inside-gl")&&!!t.video||"false"==o,this.#pr=!(this.#dr||(!t.micrioId||this.#lr&&t.src)&&(!t.video||t.video.controls||t.video.transparent)),this.#mr=!t.clickAction&&!t.frameSrc&&!s,this.#fr="href"==t.clickAction?t.clickTarget:void 0,this.#gr=!(!this.#fr||!t.clickTargetBlank),this.#vr=this.#pr&&!!t.video,this.#wr=!this.#pr||!!t.clickAction,this.#yr=!!t.hideWhenPaused,t.video&&!t.video.controls&&(t.video.muted=1),this.#zr(),this.#wr&&this.#Ir(t,s),this.#pr&&this.#Lr();const n=i.camera?.image,r=n&&n!==i?n:i;(this.#wr||t.video?.pauseWhenSmallerThan||t.video?.pauseWhenLargerThan)&&(this.eo(r.state.view,()=>this.#Zn()),this.eo(r.Ft,()=>this.#Zn())),this.#Ar(),this.addEventListener("change",this.#$r)}#zr(){const{embed:t}=this.#uh,i=t.area;this.#Ln=i[2],this.#_r=i[3],this.#br=i[0]+this.#Ln/2,this.#kr=i[1]+this.#_r/2,this.#xr=t.scale||1,this.#Tr=t.rotX??0,this.#Pr=t.rotY??0,this.#Sr=t.rotZ??0,this.#Er=t.scaleX??1,this.#ri=t.scaleY??1;const s=this.#pr&&t.micrioId&&t.width,e=s?10:1;let h=this.#Ln*this.#w.width/(t.width??100)/(this.#pr?t.width?this.#Ln:1:this.#xr)*(this.#ar?Math.PI/2:1);const o=[];s&&t.width&&(h=this.#Ln/(t.width/this.#w.width)*e*(this.#ar?Math.PI/2:1),o.push(`width:${t.width/e}px`)),o.push(`--ratio:${this.#Ln/this.#_r*this.#w.width/this.#w.height};--scale:${h}`),this.#cr&&t.height&&o.push(`height:${t.height}px`),this.#Cr=o.join(";"),t.video&&(t.video.width>t.video.height?this.#Mr=Math.min(t.video.width,this.#Ln*this.#w.width,2048):this.#Mr=Math.min(t.video.height,this.#_r*this.#w.height,2048)/(t.video.height/t.video.width))}#Ir(t,i){if(this.#er=dt(this.#fr?"a":"div",{className:(this.#mr?"no-events":"")+(this.#yr&&!this.#pr&&t.video?" hide-when-paused":"")||void 0,id:t.id?"e-"+t.id:void 0,props:this.#fr?{href:this.#fr}:{role:"figure"},attrs:this.#fr&&this.#gr?{target:"_blank"}:void 0,events:{click:()=>this.#Oe(),keydown:()=>this.#Oe()},parent:this}),t.video&&!this.#pr)this.#Dr(t);else if(t.frameSrc)this.#Or(t);else if(!this.#pr&&t.src)dt("img",{props:{src:t.src,alt:"Embed",...this.#cr&&t.width?{width:t.width}:{},...this.#cr&&t.height?{height:t.height}:{}},style:this.#Cr,attrs:{"data-scroll-through":""},parent:this.#er});else{const s=H(this.#Rs.Gt),e=t.title||i?.i18n?.[s]?.title;dt("button",{props:e?{title:e}:void 0,style:this.#Cr,attrs:{"data-scroll-through":"","aria-label":"embed-button"},parent:this.#er})}}#Dr(t){const i=t.video,s=this.#Mr,e=s/(i.width/i.height),h=this.#Ln*this.#w.width/s,o=dt("video",{props:{src:i.src,width:Math.round(s),height:Math.round(e),controls:!!i.controls,loop:!(!i.loop||i.loopAfter&&i.loopAfter>0),muted:!!i.muted,playsInline:1,crossOrigin:"anonymous",preload:"metadata"},style:1!==h?`transform:scale(${h})`:void 0,children:i.transparent&&i.hasH265&&i.src?.endsWith(".webm")?[dt("source",{props:{src:i.src.replace(".webm",".mp4"),type:"video/mp4;codecs=hvc1"}})]:void 0});if(this.#or=dt("figure",{children:[o],parent:this.#er}),this.#hr=o,t.id&&this.#uh.image&&this.#uh.image.Zt(t.id,o),i.loop&&null!=i.loopAfter&&i.loopAfter>0){o.loop=0;const t=()=>{this.#rr=setTimeout(()=>{this.#an||o.play().catch(()=>{})},1e3*i.loopAfter)};o.addEventListener("ended",t)}!this.#an&&this.#jn&&o.play().catch(()=>{})}#Or(t){dt("iframe",{parent:this.#er,props:{src:t.frameSrc,width:String(Math.round(this.#Ln*this.#w.width)),height:String(Math.round(this.#_r*this.#w.height))},attrs:{frameborder:"0",allow:"autoplay; encrypted-media",allowfullscreen:""}})}#Lr(){const{embed:t,image:i}=this.#uh;if(!i)return;const s=t.hideWhenPaused?.01:t.opacity??1;this.#ir&&(this.#ir.ot||i.Vt.includes(this.#ir))?(this.#ir.camera.setArea(t.area),this.#ir.camera.setRotation(this.#Tr,this.#Pr,this.#Sr),this.#ir.ot&&i.engine.yh(this.#ir,s)):this.#ir=i.addEmbed({...t,id:t.video?t.id:t.micrioId,title:t.uuid,path:this.#w.tileBasePath??this.#w.path,isSingle:!!t.video,isVideo:!!t.video},{l:{rotX:this.#Tr,rotY:this.#Pr,rotZ:this.#Sr}},t.area,{opacity:s,asImage:0}),this.#vr&&(this.#sr=new ie(i.engine,this.#ir,t,this.#an,()=>this.#Zn())),i.engine.render()}#Zn(){void 0===this.#nr&&(this.#nr=requestAnimationFrame(()=>{this.#nr=void 0,this.#Ar()}))}#Ar(){const{embed:t,image:i}=this.#uh;if(!i?.engine.ready)return;const s=H(i.Ft),e=H(i.state.view);if(e&&s?.[2]>0&&s?.[3]>0&&e[2]>0&&e[3]>0)this.#Cn=s[0]+(this.#br-e[0])/e[2]*s[2],this.#zn=s[1]+(this.#kr-e[1])/e[3]*s[3],this.#In=s[2]/(e[2]*this.#w.width);else{const t=i.camera.O(this.#br,this.#kr);[this.#Cn,this.#zn,this.#In]=Array.from(t)}if(this.#ar){const t=i.camera.getMatrix(this.#br,this.#kr,this.#xr,1,this.#Tr,this.#Pr,this.#Sr,void 0,this.#Er,this.#ri);this.#An=Array.from(t).join(",")}if(this.#er){const i=this.#ar?`transform:matrix3d(${this.#An});`:`--x:${this.#Cn}px;--y:${this.#zn}px;--s:${this.#In};`,s=void 0!==t.opacity&&1!==t.opacity?`--opacity:${t.opacity};`:"";this.#er.style.cssText=i+s,this.#er.classList.toggle("embed3d",this.#ar)}if((t.video?.pauseWhenSmallerThan||t.video?.pauseWhenLargerThan)&&this.#Ln){this.#an=this.#Fr();const t=this.#sr?.gn;t&&(this.#an?t.paused||t.pause():t.paused&&(this.#sr.vn(),i?.$settings?.embedRestartWhenShown&&(t.currentTime=0),t.play())),this.#Vr(i)}}#Vr(t){const i=this.#hr;i&&(this.#or&&this.#or.classList.toggle("paused",this.#an),this.#an?i.paused||i.pause():i.paused&&(t?.$settings?.embedRestartWhenShown&&(i.currentTime=0),i.play().catch(()=>{})))}#Fr(){const{embed:t}=this.#uh,i=t.video;if(!i?.pauseWhenSmallerThan&&!i?.pauseWhenLargerThan)return!this.#jn;const s=this.#Rs.canvas.viewport,e=this.#In?Math.max(this.#Ln*this.#w.width*this.#In/s.width,this.#_r*this.#w.height*this.#In/s.height):0;return!!(i.pauseWhenSmallerThan&&e<i.pauseWhenSmallerThan||i.pauseWhenLargerThan&&e>i.pauseWhenLargerThan)}#Oe(){const{embed:t,image:i,marker:s}=this.#uh,e="markerId"==t.clickAction?t.clickTarget:s?.id;e&&i&&!this.#fr&&i.state.marker.set(e)}#$r(t){if(t&&"detail"in t){const i=t.detail,s=this.#uh.embed;for(const t of Object.keys(i))s[t]=i[t]}this.#zr(),this.#Zn()}bt(t){Object.assign(this.#uh,t)}Kh(){clearTimeout(this.#rr),this.#sr?.wn();const{embed:t,image:i}=this.#uh;this.#ir&&this.#ir.ot&&i&&(i.engine.yh(this.#ir,0),i.engine.render()),t.video&&t.id&&i&&i.Zt(t.id),this.removeEventListener("change",this.#$r),this.#er&&(this.#er.removeEventListener("click",this.#Oe),this.#er.removeEventListener("keydown",this.#Oe))}};customElements.define(se.tag,se);var ee=class extends Mi{static tag="micrio-image-embeds";#uh={image:null};Jh(){const{image:t}=this.#uh;this.eo(t.data,i=>{if(this.replaceChildren(),i?.embeds)for(const s of i.embeds)dt("micrio-embed",{parent:this,setProps:{embed:s,image:t}})})}bt(t){void 0!==t.image&&(this.#uh.image=t.image)}};customElements.define(ee.tag,ee);var he=class extends Mi{static tag="micrio-tour";#uh={tour:null};#Nr=0;aside;Jh(){const{tour:t}=this.#uh,i=this.co();if(!i||!t)return;const s="steps"in t;if(!("steps"in t)){const s=t,e=i.$current;if(e){const t=s.i18n?.[H(i.Gt)]?.audio;dt("micrio-media",{parent:this,setProps:{src:t?.src,image:e,tour:s,controls:1,autoplay:1,fullscreenEl:i,onended:()=>i.state.tour.set(void 0),onclose:()=>i.state.tour.set(void 0)}})}}if(s){const s=t;s.currentStep??=s.initialStep??0,this.#Nr=s.currentStep;const e=s.stepInfo,h=!!i.$current.$settings?.t?.tourControlsInPopup,o=async(t,s)=>{const h=e?.[s];if(!h)return;const o=e?.[t];if(o?.micrioId){const t=i.be?.find(t=>t.id===o.micrioId);t&&H(t.state.marker)&&t.state.marker.set(void 0)}let n;const r=B.M(h);if(r?.videoTour){const t=i.lang,s=r.videoTour.i18n?.[t]?.timeline;s?.length&&1>=s[0].start&&(n=s[0].rect)}const a=h.micrioId&&i.$current?.id!==h.micrioId?await i.open(h.micrioId,{startView:n}):i.$current;a&&a.state.marker.set(h.markerId)};s.next=()=>{if(this.#Nr<s.steps.length-1){const t=this.#Nr;this.#Nr++,s.currentStep=this.#Nr,o(t,this.#Nr),n()}},s.prev=()=>{if(this.#Nr>0){const t=this.#Nr;this.#Nr--,s.currentStep=this.#Nr,o(t,this.#Nr),n()}},this.aside||(this.aside=dt("aside",{className:"marker-tour",parent:h?void 0:this}));const n=()=>{if(this.aside&&(this.aside.replaceChildren(),dt("micrio-button",{parent:this.aside,setProps:{type:"prev",title:H(Bi).Zo,disabled:0===this.#Nr,onclick:()=>s.prev?.()}}),dt("span",{textContent:`${this.#Nr+1}/${s.steps.length}`,parent:this.aside}),dt("micrio-button",{parent:this.aside,setProps:{type:"next",title:H(Bi).Uo,disabled:this.#Nr>=s.steps.length-1,onclick:()=>s.next?.()}}),!s.cannotClose)){const t=dt("micrio-button",{parent:this.aside,setProps:{type:"close",title:H(Bi).No,onclick:()=>i.state.tour.set(void 0)}});h&&this.aside.insertBefore(t,this.aside.firstChild)}};this.Qh(i.state.marker.subscribe(t=>{if(!t)return;const i="string"==typeof t?t:t.id,e=s.steps.findIndex(t=>t.startsWith(i));0>e||e===this.#Nr||(this.#Nr=e,s.currentStep=e,n())})),o(-1,this.#Nr),n()}this.Qh(i.state.tour.subscribe(e=>{if(!e&&s){const s=t.stepInfo?.[this.#Nr];if(s){const t=i.be?.find(t=>t.id===s.micrioId);t&&t.state.marker.set(void 0)}}}))}bt(t){Object.assign(this.#uh,t)}};customElements.define(he.tag,he);var oe=class extends Mi{static tag="micrio-swipe-gallery";#uh={gallery:null,lang:""};bt(t){void 0!==t.gallery&&(this.#uh.gallery=t.gallery),void 0!==t.galleryStart&&(this.#uh.galleryStart=t.galleryStart),void 0!==t.lang&&(this.#uh.lang=t.lang)}Jh(){const t=dt("micr-io",{parent:this}),i=dt("figcaption",{parent:this}),s=this.co()?.$current?.$info?.path;requestAnimationFrame(()=>{Li.$o(this.#uh.gallery,t.Eh,t,{startId:this.#uh.galleryStart,basePath:s}).Vo(t)});let e=0;const h=()=>{const t=this.#uh.gallery[e]?.i18n?.[this.#uh.lang]?.description;i.innerHTML=t??"",i.style.display=t?"":"none"};t.addEventListener("gallery-show",t=>{e=t.detail,h()}),h()}Kh(){this.querySelector(":scope > micr-io")?.destroy()}};customElements.define(oe.tag,oe);var ne=class extends Mi{static tag="micrio-popover";#uh={popover:null};#Br;Jh(){const t=this.co();t&&(this.#Br=dt("dialog",{events:{close:()=>{const i=this.#uh.popover;i&&"marker"in i&&i.marker&&i.image?.state?.marker&&i.image.state.marker.set(void 0),t.state.popover.set(void 0)},click:i=>{i.target===this.#Br&&t.state.popover.set(void 0)}},parent:this}),this.#lh())}bt(t){void 0!==t.popover&&(this.#uh.popover=t.popover),this.isConnected&&this.#lh()}#lh(){const t=this.#uh.popover,i=this.co();if(!i||!t)return;const s=H(i.Gt),e=H(Bi),h="contentPage"in t?t.contentPage?.id:"",o="marker"in t?t.marker?.id:"",n=`${t?.constructor?.name??typeof t}::${h}::${o}::${s}`;if(!this.io(n))return;this.#Br.replaceChildren(),this.#Br.classList.remove("article","page","has-media","gallery");const r="marker"in t?t.marker:void 0,a="markerTour"in t?t.markerTour:void 0,c=!(!(r&&a&&"steps"in a)||0>a.steps?.findIndex(t=>t.startsWith(r.id))),l=c?a.currentStep==a.steps.length-1:1,u=t=>{if(c&&a&&"steps"in a){const s=a;t instanceof Event&&l?i.state.tour.set(void 0):s.next?.()}this.#Br?.open&&this.#Br.close()};if(dt("aside",{parent:this.#Br,children:[dt("micrio-button",{setProps:{type:!c||l?"close":"next",title:!c||l?e.Wo:e.Uo,onclick:u}})]}),"contentPage"in t&&t.contentPage){const i=t.contentPage,e=i.i18n?.[s];this.#Br.classList.add("page");const h=e?.embed&&(!e.content||250>e.content.length)&&!i.image&&!i.buttons?.length;if((e?.embed||i.image)&&this.#Br.classList.add("has-media"),h)e.embed&&dt("micrio-media",{setProps:{src:e.embed,figcaption:e.content,controls:1,autoplay:1},parent:this.#Br});else{this.#Br.classList.add("article");const t=[];e?.title&&t.push(dt("h2",{textContent:e.title})),e?.embed&&t.push(dt("micrio-media",{setProps:{src:e.embed,controls:1}})),e?.content&&t.push(dt("div",{innerHTML:e.content})),dt("article",{children:t,parent:this.#Br})}}if("gallery"in t&&t.gallery?.length&&(this.#Br.classList.add("gallery"),dt("micrio-swipe-gallery",{setProps:{gallery:t.gallery,galleryStart:t.galleryStart,lang:s},parent:this.#Br})),"marker"in t&&t.marker){const i=t.marker,e=i.i18n?.[s],h=!!i.images?.length,o=!(!e||!e.body)||h&&!!t.contentPage?.i18n?.[s]?.embed;e?.embedUrl?dt("micrio-media",{setProps:{src:e.embedUrl,uuid:i.id,figcaption:e.embedDescription,controls:1,autoplay:i.embedAutoPlay},parent:this.#Br}):h&&dt("micrio-swipe-gallery",{setProps:{gallery:i.images,lang:s},parent:this.#Br}),o&&dt("micrio-marker-content",{setProps:{marker:i,noEmbed:1,noGallery:1,noImages:!e||!e.embedUrl,onclose:u},parent:this.#Br})}this.#Br.open||this.#Br.showModal()}Kh(){this.#Br?.open&&this.#Br.close()}};customElements.define(ne.tag,ne);var re=class{#Rs;#d;#Xe;#Gr=0;#Yr={};#Hr;#Rr;#Xr=0;#jr=[];#is;#Wr=new Map;#Ur=0;#Zr=0;#qr;#Jr=()=>{};#Kr;#wo=[];goto(t){this.#Jr(t)}get currentIndex(){return this.#d.canvas?.Si??-1}constructor(t,i,s,e){this.#Rs=t,this.#d=i,this.#Xe=s,this.#Kr=e}async setup(){const t=this.#Rs,i=this.#d,s=this.#Xe,e=B.m(i.id);if(!e)return;const h=i.$settings.omni;if(!h)return;const o=t.Eh,n=i.$info;if(!n)return;const r=h.frames,a=r/(h.layers?.length??1);if(!i.ot)return;const c=[];for(let g=0;r>g;g++){const t={id:n.id+"/"+g,image:i,visible:Y(0),sh:g,opts:{area:[0,0,1,1]},ot:0,zt:-1,thumbSrc:i.Yt(i.At,0,0,g)};o.Ut(t,i,{opacity:0,asImage:0}),c.push(t)}e.settings?.omni&&parseFloat(e.info.version)>=5&&await _t.load(e.info.tileBasePath||e.info.path,(e.info.tilesId??e.info.id)+"/base",i=>t.pn?.bt?.({loadingProgress:i})).catch(()=>{}),i.canvas?.Ai(0,0),o.render();const l=!!i.$settings.gallery?.archive,u="requestIdleCallback"in self?Math.max(36,2*Math.floor(r/8)):50,d=t=>{this.#Kr(t,r,u,t=>c[t]?{baseTileIdx:c[t].zt,thumbSrc:c[t].thumbSrc}:void 0,o,l)},p=dt("micrio-dial",{parent:s,setProps:{currentRotation:0,frames:a,degrees:1,onturn:t=>{this.goto(Math.round(t)%a)}}});this.#Gr=a,this.#Yr={continuous:1},this.#Jr=t=>{for(;0>t;)t+=a;t%=a,i.canvas?.Ai(t,0),p.bt?.({currentRotation:t/a*360}),d(t),o.render()},this.#Qr(),i.omni=this,d(0),this.#wo.push(i.state.layer.subscribe(t=>{p.bt?.({currentRotation:t/a*360})}));const m=i.$settings.omni,f=m?.layers?.length??1;if(f>1){const s=m.layers.map((t,i)=>({i18n:Object.fromEntries(Object.entries(t.i18n||{}).map(([t,s])=>[t,{title:s??"Layer "+(i+1)}]))})),e=Object.keys(n.revision??{});if(!e.length){const i=H(t.Gt);i&&e.push(i)}if(e.length)for(const t of e)for(let i=0;i<s.length;i++)s[i].i18n[t]||(s[i].i18n[t]={title:"Layer "+(i+1)});const h=()=>{const t=H(i.state.layer);i.data.update(e=>(e||(e={}),e.pages||(e.pages=[]),e.pages=e.pages.filter(t=>!t.id?.startsWith("_omni-layers")),e.pages.push({id:"_omni-layers-"+t,i18n:s[t].i18n,icon:qi.layerGroup,children:s.map((t,s)=>({id:"omni-layer-"+s,i18n:t.i18n,action(){i.state.layer.set(s),d(H(i.state.layer)*Math.floor(r/f))}})).filter(i=>i.id!="omni-layer-"+t)}),e))};h(),this.#wo.push(i.state.layer.subscribe(h))}}destroy(){this.#ta();for(const t of this.#wo)t();this.#wo=[]}#Qr(){const t=this.#Rs;this.#Yr.sensitivity||(this.#Yr.sensitivity=Number(t.getAttribute("data-swipe-sensitivity")??1));const i=t.getAttribute("data-swipe-snap");i&&(this.#jr=i.split(",").map(Number)),this.#Rs.setAttribute("data-hooked",""),this.#d.state.view.subscribe(t=>this.#Ur=this.#Yr.coverLimit?this.#d.camera.isZoomedOut():t?Math.round(1e3*t[3])/1e3>=1:1),t.Eh.bs=1,t.Eh.ws=1,this.#Rs.canvas.element.addEventListener("pointerdown",this.#ia)}#ta(){this.#Rs.canvas.element.removeEventListener("pointerdown",this.#ia),this.#Wr.clear(),this.#sa()}#sa(){this.#Rs.removeEventListener("pointermove",this.#ea),this.#Rs.removeEventListener("pointerup",this.#ha)}#oa=()=>2==this.#Wr.size||(this.#Ur||this.#Zr)&&1==this.#Wr.size;#ia=t=>{if(0!==t.button)return;this.#Zr=t.shiftKey;const i=!this.#oa();if(this.#Wr.set(t.pointerId,1),this.#Wr.size>2)return this.#Wr.clear(),void this.#sa();i&&(this.#Xr=0,this.#Rs.setAttribute("data-panning",""),this.#Hr=this.currentIndex,this.#Rr=t.clientX,this.#qr=t.pointerId,this.#Rs.addEventListener("pointermove",this.#ea),this.#Rs.addEventListener("pointerup",this.#ha),this.#Rs.setPointerCapture(t.pointerId))};#ea=t=>{if(!this.#oa()||t.pointerId!=this.#qr||void 0===this.#Rr||void 0===this.#Hr)return;if(!this.#Xr&&void 0!==this.#Rr&&(this.#Xr=2!=this.#Wr.size?1:Math.abs(t.clientX-this.#Rr)>(this.#Rs.events.Gh&&this.#Rs.events.Gh>1.25?.3:.15)*this.#Rs.offsetWidth)&&(this.#Rr=t.clientX),!this.#Xr)return;const i=this.#Rs.$current.camera,s=this.#Yr.continuous?Math.max(.1,(i.getXY(1,.5)[0]-i.getXY(0,.5)[0])/this.#Rs.offsetWidth):1,e=Math.round((t.clientX-this.#Rr)/(this.#Rs.offsetWidth*s)*this.#Gr*(this.#Yr.sensitivity??1));let h=this.#Hr-e;if(this.#Yr.continuous){for(;0>h;)h+=this.#Gr;for(;h>this.#Gr-1;)h-=this.#Gr}h=Math.max(0,Math.min(this.#Gr-1,h)),h!=this.currentIndex&&this.#Jr(h)};#ha=t=>{this.#Wr.delete(t.pointerId),t.pointerId==this.#qr&&(this.#Rs.releasePointerCapture(this.#qr),this.#qr=void 0),this.#Wr.size||this.#na()};#na(){if(this.#Rs.removeAttribute("data-panning"),this.#sa(),this.#Xr=0,this.#jr.length){const t=this.#jr[this.#jr.map((t,i)=>[i,Math.abs(t-this.currentIndex)]).sort((t,i)=>t[1]>i[1]?1:t[1]<i[1]?-1:0)[0][0]];t!=this.currentIndex&&this.animateTo(t)}}animateTo(t){this.#is&&cancelAnimationFrame(this.#is);const i=performance.now(),s=this.currentIndex,e=s-t,h=t=>{const o=Math.min(1,(t-i)/250);1>o&&(this.#is=requestAnimationFrame(h));const n=s-Math.round(ot.get(o)*e);n!=this.currentIndex&&this.#Jr(n)};this.#is=requestAnimationFrame(h)}},ae=class{#Rs;#Gi;#ra;#aa;#ca;#la;#ua;#da=-1;#pa;#ma=0;#fa=0;#ga=0;#va=0;#wa=0;#Ma=0;#ya=0;constructor(t,i,s,e,h,o,n){this.#Rs=t,this.#Gi=i,this.#ra=s,this.#aa=e,this.#ca=h,this.#la=o,this.#ua=n}async setup(t,i,s){this.#da=t,s.We=lt("ease-out"),await Promise.allSettled(this.#Gi.map(t=>s.Pe(t,i)));const e=this.#aa[t]??0;for(let h=0;h<this.#Gi.length;h++){const t=this.#Gi[h];if(!t.camera)continue;t.camera.setCoverLimit(0);const i=[this.#aa[h]-e,0,this.#ca[h],1];t.camera.setArea(i,{direct:1,noDispatch:1}),t.camera.setView([0,0,1,1])}this.#Gi[t]?.visible.set(1)}#_a(){return!!this.#Gi[this.#da]?.camera?.isZoomedOut()}animateTo(t,i,s,e){this.#da=e;const h=this.#Gi;if(!h[t])return;const o=0===s?0:i?.125:.2,n=h[e>-1&&e!==t?e:-1],r=o>0&&n?.camera&&!n.camera.isZoomedOut(),a=h[0]?.engine;if(!a)return;const c=this.#aa[t],l=()=>{a.je=o,a.ze=0;for(let t=0;t<h.length;t++){const i=h[t];if(!i?.camera)continue;const s=i.opts.area??[0,0,1,1],e=s[0],n=s[0]+s[2]>-1&&2>e,r=this.#aa[t]-c,a=this.#ca[t],l=r+a>-1&&1>r,u=Math.abs(s[0]-r)>1e-4||Math.abs(s[2]-a)>1e-4,d=o>0&&u&&(n||l);i.camera.setArea([r,0,a,1],{direct:!d,noDispatch:1})}h[t]?.camera?.setView([0,0,1,1]),a.render()};r?n.camera.flyToCoverView({duration:600*o,speed:2}).then(l).catch(l):l()}#ba=()=>{this.#ka(),this.#pa=void 0,this.#wa=0,this.#Rs.removeAttribute("data-panning"),this.#Rs.gh=0};handlePointerDown=t=>{0===t.button&&(void 0===this.#pa?this.#_a()&&(this.#pa=t.pointerId,this.#ma=this.#fa=t.clientX,this.#ya=t.clientY,this.#ga=t.timeStamp,this.#va=0,this.#wa=0,this.#Ma=0,window.addEventListener("pointermove",this.#xa),window.addEventListener("pointerup",this.#Ta),window.addEventListener("pointercancel",this.#Ta)):t.pointerId!==this.#pa&&(this.#wa&&this.#la(this.#ua()),this.#ba()))};#xa=t=>{if(t.pointerId!==this.#pa)return;const i=t.clientX-this.#ma,s=t.clientY-this.#ya;if(!this.#wa){if(6>Math.abs(i)&&6>Math.abs(s))return;if(this.#Ma=Math.abs(i)>Math.abs(s),!this.#Ma)return void this.#Ta(t);this.#wa=1,this.#Rs.setAttribute("data-panning",""),this.#Rs.gh=1,this.#Rs.canvas.element.setPointerCapture(t.pointerId)}const e=Math.max(1,t.timeStamp-this.#ga);this.#va=(t.clientX-this.#fa)/e,this.#fa=t.clientX,this.#ga=t.timeStamp;const h=i/(this.#Rs.offsetWidth||1);this.#Pa(h)};#Ta=t=>{if(t.pointerId!==this.#pa)return;const i=this.#wa;if(this.#ba(),!i)return;try{this.#Rs.canvas.element.releasePointerCapture(t.pointerId)}catch(o){}const s=this.#Rs.offsetWidth||1,e=(t.clientX-this.#ma)/s;let h=this.#ua();-.3>e||-.5>this.#va?h=Math.min(this.#ra.length-1,this.#ua()+1):(e>.3||this.#va>.5)&&(h=Math.max(0,this.#ua()-1)),this.#la(h)};#ka=()=>{window.removeEventListener("pointermove",this.#xa),window.removeEventListener("pointerup",this.#Ta),window.removeEventListener("pointercancel",this.#Ta)};#Pa(t){const i=this.#Gi,s=this.#ua(),e=this.#ra.length,h=0===s&&t>0||s===e-1&&0>t?Math.sign(t)*Math.sqrt(Math.abs(t))*.3:t,o=this.#ra[s]?.[0]??0,n=this.#aa[o],r=i[0]?.engine;if(r&&void 0!==n){for(let t=0;t<i.length;t++){const s=i[t];if(!s?.camera)continue;const e=this.#aa[t]-n+h,o=this.#ca[t];e+o>-1&&1>e&&s.camera.setArea([e,0,o,1],{direct:1,noDispatch:1})}r.render()}}destroy(){this.#Rs.removeAttribute("data-panning"),this.#Rs.gh=0,this.#ka()}},ce=class extends Mi{static tag="micrio-gallery";#uh={};#Sa=-1;#da=0;#Gi=[];#ra=[];#aa=[];#ca=[];#Ea;#Ca=null;#za=null;#Ia=null;#La=0;#Aa=-1;#$a=0;#Da=0;#Oa=null;#Fa;#Va;#Na=new Map;#Ba=0;async Jh(){const t=this.co();if(!t)return;const i=t.$current;if(!i)return;if(i.$settings?.omni)return this.#Fa=new re(t,i,this,(t,i,s,e,h,o)=>this.#Ga(t,i,s,e,h,o)),void(await this.#Fa.setup());const s=this.#uh.controller;s&&this.#Ya(t,i,s)}bt(t){void 0!==t.controller&&(this.#uh.controller=t.controller)}#Ha(t){if(!this.#Ca)return 0;const i=this.#Ca.clientWidth;return 16+t/Math.max(1,this.#ra.length-1)*(i-32)}#Ra(t){const i=this.#ra[t];return i&&i.length>1?`${i[0]+1}-${i[i.length-1]+1}`:String(t+1)}#Jr(t,i=0,s=150,e=0){if(!this.#Gi.length)return;const h=Math.round(Math.max(0,Math.min(this.#ra.length-1,t))),o=this.#ra[h]?.[0]??0,n=e||h!==this.#Sa;if(this.#Sa=h,this.#da=o,n&&this.#Xa(),this.#Va)this.#Va.animateTo(o,i,s,this.#da);else if(n){const t=(this.#ra[h]?.length??1)-1;if(this.#Ea.canvas?.Ai(o,t),t>0)this.#Ea.camera.setView([0,0,1,1]);else{const t=this.#Gi[o]?.opts?.area;t&&this.#Ea.camera.setView(t)}}this.#Ea.album.hooked=1}#Xa(){this.#ja(this.#da),this.co()?.events.xt("gallery-show",this.#Sa),this.#Va&&this.#Ea.album?.currentImage?.set(this.#Gi[this.#da]),this.#Wa()}#Ua=t=>{if(t.preventDefault(),t.stopPropagation(),this.#$a||(this.#Da="button"in t)&&0!==t.button||!this.#Ca)return;this.#Oa=this.#Ca.getBoundingClientRect();const i=this.co();i&&(i.gh=this.#$a=1,this.#Aa=-1,window.addEventListener(this.#Da?"pointermove":"touchmove",this.#Za),window.addEventListener(this.#Da?"pointerup":"touchend",this.#qa),this.#Za(t))};#Ja(t){const i=this.#Oa??this.#Ca.getBoundingClientRect(),s=this.#ra.length,e="button"in t?t.clientX:t.touches[0].clientX,h=Math.min(1,Math.max(0,(e-i.left-16)/(i.width-32)));return[h,Math.max(0,Math.min(s-1,Math.round(h*Math.max(1,s-1))))]}#Za=t=>{const[i,s]=this.#Ja(t);this.#La=16+i*(this.#Oa.width-32),s!==this.#Sa&&this.#Jr(s,1)};#Ka=t=>{this.#$a||(this.#Aa=this.#Ja(t)[1]),this.#Wa()};#qa=()=>{window.removeEventListener(this.#Da?"pointermove":"touchmove",this.#Za),window.removeEventListener(this.#Da?"pointerup":"touchend",this.#qa);const t=this.co();t&&(this.#$a=t.gh=0,this.#Jr(this.#Sa))};#Ga(t,i,s,e,h,o){if(!i||!h)return;const n=self.requestIdleCallback??self.requestAnimationFrame;for(let r=-s;s>=r;r++){if(!r)continue;let s=t+r;for(;0>s;)s+=i;for(;s>=i;)s-=i;const a=e(s);a?.thumbSrc&&!this.#Na.has(a.thumbSrc)&&this.#Na.set(a.thumbSrc,n(()=>h.oh(a.baseTileIdx,a.thumbSrc,0,{force:o})))}}#ja(t){const i=this.#Gi;if(!i.length||1>=i.length)return;const s=i[0].engine,e=!!i[0]?.$settings?.gallery?.archive;this.#Ga(t,i.length,this.#Ba,t=>i[t]?{baseTileIdx:i[t].zt,thumbSrc:i[t].thumbSrc}:void 0,s,e)}#Qa=t=>{switch(t.key){case"PageUp":case"ArrowLeft":this.#Jr(this.#Sa-1,1);break;case"PageDown":case"ArrowRight":this.#Jr(this.#Sa+1,1);break;case"Home":this.#Jr(0);break;case"End":this.#Jr(this.#ra.length-1);break;default:return}};async#Ya(t,i,s){const e=[...s.fo];if(!e.length)return;this.#Gi=e,this.#Ea=i;const h=s.Oo();this.#ra=h.pages,this.#aa=[],this.#ca=[];for(const[u,d]of h.pages.entries()){const t=d.length;for(let i=0;t>i;i++)this.#aa[d[i]]=u+i/t,this.#ca[d[i]]=1/t}const o=s.Lo.startId?Math.max(0,e.findIndex(t=>t.id===s.Lo.startId)):0,n=h.pages.findIndex(t=>t.includes(o)),r=0>n?0:n;this.#Ba="requestIdleCallback"in self?100:50;const a=t.Eh,c=i;"swipe"===s.Lo.type&&(this.#Va=new ae(t,e,this.#ra,this.#aa,this.#ca,t=>this.#Jr(t),()=>this.#Sa)),this.#Sa=r,this.#tc(),this.#Wa();const l=this;if(c.album={numPages:h.numPages,get currentIndex(){return l.#Sa},info:c.$settings.gallery,prev:()=>l.#Jr(l.#Sa-1),next:()=>l.#Jr(l.#Sa+1),goto:t=>l.#Jr(t),...l.#Va?{currentImage:Y(e[o])}:{}},this.#Va)await this.#Va.setup(o,c,a),this.#da=o,this.#Sa=r,this.#Xa(),c.album.hooked=1;else{await Promise.allSettled(e.map(t=>("state"in t&&!("image"in t)&&(t.camera=c.camera),a.Ut(t,c,{opacity:0,asImage:"camera"in t}))));const t=this.#ra[r],i=(t?.length??1)-1;if(c.canvas?.Ai(t[0],i),i>0)c.camera.setView([0,0,1,1]);else{const t=this.#Gi[o]?.opts?.area;t&&c.camera.setView(t)}this.#Sa=r,this.#Xa(),c.album.hooked=1}this.#Va&&e.length>1&&(t.canvas.element.addEventListener("pointerdown",this.#Va.handlePointerDown),this.Qh(()=>t.canvas.element.removeEventListener("pointerdown",this.#Va.handlePointerDown))),window.addEventListener("keydown",this.#Qa),this.Qh(()=>window.removeEventListener("keydown",this.#Qa))}#tc(){const t=this.#ra.length;if(!this.#Gi.length||1>=t||this.querySelector("ul"))return;const i=H(Bi),s=t>24,e=s?Math.max(1,Math.ceil(t/24)):1,h=this.#Sa;this.#za=dt("micrio-button",{parent:this,setProps:{type:"prev",title:i.hn,disabled:0>=h,onclick:()=>this.#Jr(this.#Sa-1)}});const o=dt("ul",{className:s?"dense":"",parent:this,events:{pointerdown:this.#Ua,pointermove:this.#Ka,pointerleave:()=>{this.#Aa=-1,this.#Wa()}}});this.#Ca=o,o.addEventListener("touchstart",this.#Ua,{passive:0}),dt("span",{parent:o,children:[dt("span")]}),dt("span",{parent:o,children:Array.from({length:t},(i,h)=>s&&h%e!==0&&h!==t-1?null:dt("span",{attrs:s&&h%(5*e)==0?{"data-major":""}:{},style:{left:(t>1?h/(t-1)*100:50)+"%"}}))}),dt("button",{parent:o,props:{role:"slider",tabIndex:0},attrs:{"aria-label":"Gallery position","aria-valuemin":"1","aria-valuemax":String(t)}}),dt("span",{parent:o}),this.#Ia=dt("micrio-button",{parent:this,setProps:{type:"next",title:i.nn,disabled:h>=t-1,onclick:()=>this.#Jr(this.#Sa+1)}})}#Wa(){const t=this.#ra.length;if(!t)return;const i=this.#Sa,s=t>24,e=s?Math.max(1,Math.ceil(t/24)):1,h=t>1?i/(t-1)*100:0,o=this.#Ca&&!this.#$a?this.#Ha(i):this.#La,n=this.querySelector("ul > :first-child > span");n&&(n.style.width=`${h}%`);const r=this.querySelectorAll("ul > :nth-child(2) > span"),a=[];for(let d=0;t>d;d++)s&&d%e!==0&&d!==t-1&&d!==i||a.push(d);r.forEach((t,s)=>{const e=a[s];void 0!==e&&(t.toggleAttribute("data-active",e===i),t.toggleAttribute("data-hover",e===this.#Aa))});const c=this.querySelector("ul > button");c&&(c.style.left=`${o}px`,c.classList.toggle("dragging",this.#$a),c.setAttribute("aria-valuenow",String(i+1)));const l=this.querySelector("ul > button + span");l&&(l.style.left=`${o}px`,l.classList.toggle("dragging",this.#$a),l.textContent=this.#Ra(i)+(s?` / ${t}`:""));let u=this.querySelector('[data-part="hover-label"]');0>this.#Aa||this.#Aa===i||this.#$a?u?.remove():(u||(u=dt("span",{attrs:{"data-part":"hover-label"},parent:this.querySelector("ul")??void 0})),u.style.left=(t>1?this.#Aa/(t-1)*100:50)+"%",u.textContent=this.#Ra(this.#Aa)),this.#za&&this.#za.querySelector("button")?.toggleAttribute("disabled",0>=i),this.#Ia&&this.#Ia.querySelector("button")?.toggleAttribute("disabled",i>=t-1)}Kh(){this.#Fa?.destroy(),this.#Va?.destroy()}};customElements.define(ce.tag,ce);var le=class extends Mi{static tag="micrio-serial-tour";#uh={tour:null};#ic=[];#Nr=0;#kh=0;#hn=void 0;#W=0;#sc=0;Jh(){const{tour:t}=this.#uh,i=this.co();if(!i||!t)return;this.#ic=t.stepInfo||[],this.#W=this.#ic.reduce((t,i)=>t+(i.duration||0),0),this.#sc=!!i.$current?.$settings?.ui?.controls?.serialTourNoTimeScrub,i.setAttribute("data-tour-active",""),this.Qh(()=>i.removeAttribute("data-tour-active"));const s=t;s.next=()=>this.#Fo(),s.prev=()=>{this.#Nr>0&&this.#ec(this.#Nr-1)},this.Qh(i.state.marker.subscribe(t=>{if(!t||!this.#ic.length)return;const i="string"==typeof t?t:t.id,s=this.#ic.findIndex(t=>t.markerId===i);0>s||s===this.#Nr||(this.#ic.forEach(t=>t.ended=0),this.#ec(s))})),this.#Bh(),this.#ec(0)}#Bh(){if(!this.#kh&&(this.#kh=1,this.#uh.tour.printChapters)){const t=dt("ol");this.#ic.forEach((i,s)=>{const e=B.M(i),h=this.#hc(e);h&&dt("li",{dataset:{idx:String(s)},parent:t,children:[dt("button",{textContent:h,events:{click:()=>this.#Jr(s)}})]})}),t.children.length&&this.appendChild(t)}}async#ec(t){const i=this.co();if(!i)return;const s=()=>{i.state.tour.set(void 0),this.#uh.onended?.(),this.remove()},e=this.#ic[t];if(!e)return;e.ended=0,e.currentTime=0;const h=B.M(e);let o;if(h?.videoTour){const t=h.videoTour.i18n?.[i.lang]?.timeline;t?.length&&1>=t[0].start&&(o=t[0].rect)}if(e.micrioId&&i.$current?.id!==e.micrioId&&await i.open(e.micrioId,{startView:o}),this.#hn&&(this.#hn.remove(),this.#hn=void 0),h?.videoTour){const t=i.lang,e=h.videoTour.i18n?.[t]?.audio??h.i18n?.[t]?.audio,o=dt("micrio-media",{parent:this,setProps:{tour:h.videoTour,src:e?.src,image:i.$current,controls:1,autoplay:1,onended:()=>this.#Fo(),onclose:s,hasAudio:this.#ic.some(t=>t.duration>0),fullscreenEl:i,getTimeDisplay:()=>`${Hs(this.#oc())} / ${Hs(this.#W)}`}});this.#hn=o,await ft(),this.#nc();const n=this.#hn.querySelector("video,audio");n&&n.addEventListener("timeupdate",()=>{const t=this.#ic[this.#Nr];t&&(t.currentTime=n.currentTime),this.#rc()})}this.#Nr=t,this.#rc(),h?.videoTour||t!==this.#ic.length-1||this.#Fo()}#Fo(){const t=this.#ic[this.#Nr];t&&(t.ended=1),this.#Nr<this.#ic.length-1?this.#ec(this.#Nr+1):(this.#uh.onended?.(),this.co()?.state.tour.set(void 0),this.remove())}#hc(t){return t?.i18n?.[this.co()?.lang||"en"]?.title}#nc(){const t=this.#hn?.querySelector("micrio-media-controls > aside");if(!t)return;const i=t.querySelector("div");if(!i)return;i.querySelector('[data-part="bars"]')?.remove();const s=dt("div",{attrs:{"data-part":"bars"}});this.#ic.forEach((t,i)=>{const e=B.M(t);dt("div",{attrs:{"data-part":"bar",role:"progressbar",tabindex:"0"},dataset:{idx:String(i)},props:{title:this.#hc(e)??""},style:{width:t.duration/(this.#W||1)*100+"%"},events:{click:()=>this.#Jr(i)},parent:s})}),i.prepend(s)}#Jr(t){this.#sc&&t===this.#Nr||t!==this.#Nr&&(this.#ic.forEach(t=>t.ended=0),this.#ec(t))}#oc(){let t=0;for(let i=0;i<this.#ic.length;i++){const s=this.#ic[i];if(i>=this.#Nr&&!s.ended){if(i===this.#Nr){t+=s.currentTime??0;break}break}t+=s.duration}return t}#rc(){this.#kh&&((this.#hn?.querySelectorAll('aside [data-part="bars"] > [data-part="bar"]')??[]).forEach((t,i)=>{const s=this.#ic[i],e=i===this.#Nr?s.currentTime??0:0,h=i<this.#Nr||s.ended?100:i===this.#Nr?Math.round(e/(s.duration||1)*1e4)/100:0;t.style.setProperty("--progress",`${h}%`),t.classList.toggle("active",i===this.#Nr)}),this.querySelectorAll("ol.chapters li").forEach(t=>t.classList.toggle("active",Number(t.dataset.idx)===this.#Nr)))}bt(t){void 0!==t.tour&&(this.#uh.tour=t.tour),void 0!==t.onended&&(this.#uh.onended=t.onended)}};function ue(t,i){if(i)for(let s,e=0;e<i.length;e++)if(i[e].id==t||(s=ue(t,i[e].children)))return s??i[e]}customElements.define(le.tag,le);var de=class extends Mi{static tag="micrio-main";#uh={};#w;#Fe;#ac=0;#cc;#lc;#uc=new Map;#k=new Map;#dc;#pc(){this.#dc?.destroy(),this.#dc=void 0}#mc=["audio","media","logo","orgLogo","details","toolbar","grid","gallery","controls","embeds","markers","popup","tour","popover","minimap","error","progress"];#fc=new Map;#gc(t){for(let i=this.#mc.indexOf(t)+1;i<this.#mc.length;i++){const t=this.#fc.get(this.#mc[i]);if(t?.isConnected)return t}return null}#vc(t,i){if(i.isConnected)return;const s=this.#gc(t);s?this.insertBefore(i,s):this.appendChild(i)}#wc(t,i,s,e){const h=this.#fc.get(t);if(i){if(h?.isConnected)return void e?.(h);h?.remove();const i=s();this.#fc.set(t,i),this.#vc(t,i)}else h?.isConnected&&(h.remove(),this.#fc.set(t,null))}Jh(){const t=this.co();if(!t)return;const i=Y(H(t.mn)?0:1);this.ro("volume",i),this.Qh(t.mn.subscribe(t=>i.set(t?0:1))),this.ro("mediaPaused",Y(0)),"markers"==t.getAttribute("data-ui")&&(this.#uh.noHTML=1);const s=[];this.Qh(t.current.subscribe(i=>{if(!i)return;this.#w=i.$info,this.#Fe=void 0,this.#ac=1,this.#Fe=i.Pt,this.#Fe&&this.Qh(this.#Fe.subscribe(()=>this.#Mc())),!this.#cc&&B.k()?.logo&&(this.#cc=B.k()),this.#Mc(),this.isConnected&&this.#Nh();const e=i.$data;if(e&&0>s.indexOf(i.id)){s.push(i.id);const h=i.$settings.start;h&&R().then(R).then(()=>{if(!(H(t.state.popover)||H(t.state.marker)||H(t.state.tour)))switch(h.type){case"marker":i.state.marker.set(h.id);break;case"markerTour":{const i=e.markerTours?.find(t=>t.id==h.id);i&&t.state.tour.set(i);break}case"tour":{const i=e.tours?.find(t=>t.id==h.id);i&&t.state.tour.set(i);break}case"page":{const i=ue(h.id,e.pages);i&&t.state.popover.set({contentPage:i,showLangSelect:1});break}}})}this.#Mc()})),this.Qh(t.state.tour.subscribe(()=>{const i=this.#fc.get("subtitles");i&&i.bt?.({raised:!!H(t.state.tour)})}));for(const e of[t.jt,t.gallery,t.state.popup,t.state.popover,t.state.tour,t.state.marker])this.Qh(e.subscribe(()=>this.#Mc()));this.Qh(t.Gt.subscribe(()=>this.#Mc())),this.#Mc()}bt(t){Object.assign(this.#uh,t),this.isConnected&&this.#Mc()}#yc=0;#Mc(){this.#yc||(this.#yc=1,requestAnimationFrame(()=>{this.#yc=0,this.isConnected&&this.#Nh()}))}#Nh(){const t=this.co();if(!t)return;const i=H(t.state.tour),s=H(t.state.marker),e=H(t.state.popup),h=H(t.state.popover),o=this.#w,n=this.#Fe?H(this.#Fe):void 0,r=t.$current?H(t.$current.data):void 0,a=this.#uh.error,c=this.#uh.loadingProgress??1,l=this.#uh.noHTML??0,u=this.#uh.noLogo??l,d=t.canvas.$isMobile,p=t.$current?.I,m=p?n.l.video:void 0,f=m?.src;this.classList.toggle("is360",p);const g=r?.markers?.filter(t=>!!t.positionalAudio),v=!!r?.music?.items.length||!!g?.length,w=i||s,M=!l||"markers"==t.getAttribute("data-ui"),y=!(u||o&&l||n?.noLogo||s||e),_=!l&&y&&!n?.noOrgLogo&&!!this.#cc&&!h,b=!l&&!!o&&!n?.noControls,k=!l&&!w&&!!n?.showInfo,x=!l&&this.#ac&&!n?.noToolbar,T=!(l||!o||0==n?.minimap||n?.noControls||!t.$current?.thumbSrc||e&&d);v&&r&&o&&t.$current?this.#dc||(this.#dc=new Ls(t,t.$current),this.Qh(()=>this.#pc())):this.#pc(),this.#wc("media",!!f&&!!o,()=>dt("div")),this.#wc("logo",y,()=>dt("micrio-logo")),this.#wc("details",k&&!!r,()=>dt("micrio-details",{setProps:{info:this.#w,data:r}})),this.#wc("toolbar",x,()=>dt("micrio-toolbar"));const P=H(t.jt);this.#_c(this.#uc,"micrio-markers","markers",P,M,i=>!(i.opts?.isEmbed||!i.$data?.markers?.length&&!t.spaceData)),this.#_c(this.#k,"micrio-image-embeds","embeds",P,"false"!=t.getAttribute("data-embeds"),t=>!!t.$data?.embeds?.length),this.#wc("controls",b,()=>dt("micrio-controls",{setProps:{hasAudio:v||!(!f||!m||m.muted)}})),this.#wc("orgLogo",_&&!!this.#cc,()=>dt("micrio-logo-org",{setProps:{organisation:this.#cc}}));const S=H(t.gallery),E=t.$current?.grid;E&&this.#vc("grid",E),this.#wc("gallery",!!n?.omni||!("grid"===S?.Lo?.type||!S),()=>dt("micrio-gallery",{setProps:{controller:S??void 0}})),this.#wc("minimap",T,()=>dt("micrio-minimap",{setProps:{image:t.$current}}),i=>i.bt?.({image:t.$current}));const C=H(t.state.popup),z=null!=C&&"popover"!==C.popupType,I=this.#fc.get("popup");if(z?(I?.isConnected&&(C.id!==this.#lc||I.classList.contains("destroying"))&&(I.remove(),this.#fc.set("popup",null)),this.#lc=C.id,this.#fc.get("popup")?.isConnected||this.#fc.set("popup",dt("micrio-marker-popup",{setProps:{marker:C},parent:this}))):I?.isConnected||(this.#fc.set("popup",null),this.#lc=void 0),this.#wc("tour",!!i,()=>dt(i&&"steps"in i&&i.isSerialTour?"micrio-serial-tour":"micrio-tour",{setProps:{tour:i,noHTML:l}})),this.#wc("popover",!!h,()=>dt("micrio-popover",{setProps:{popover:h}})),this.#wc("error",!!a,()=>dt("micrio-error",{setProps:{message:a}})),this.#wc("progress",1>c,()=>dt("micrio-progress-circle",{setProps:{progress:c}})),1>c){const t=this.#fc.get("progress");t?.isConnected&&t.bt?.({progress:c})}}#_c(t,i,s,e,h,o){const n=e.filter(t=>o(t)),r=new Set(n.map(t=>t.id));for(const[a,c]of t)r.has(a)||(c.remove(),t.delete(a));if(h)for(const a of n){if(t.has(a.id))continue;const e=dt(i,{setProps:{image:a}});t.set(a.id,e);const h=this.#gc(s);h?this.insertBefore(e,h):this.appendChild(e)}else{for(const i of t.values())i.remove();t.clear()}this.#fc.set(s,t.values().next().value??null)}};customElements.define(de.tag,de),Ui.VERSION=G,customElements.define("micr-io",Ui),console.info("%c◈%c Micrio %cv7.0.0 - https://micr.io/ %c| New in version 7: https://doc.micr.io/client/v7/changes.html","color: #00d4ee","color: #c5ff5b","color: inherit","color: #888")}();
|